xrpl.js 2.0: start migrating code (incomplete)

This commit is contained in:
mDuo13
2021-09-17 18:28:24 -07:00
parent 52f649e75e
commit 2e931a013b
9 changed files with 311 additions and 152 deletions

View File

@@ -1,17 +1,23 @@
const xrpl = ripple; // TODO: remove when webpack build is updated
async function wait_for_seq(network_url, address) {
const api = new ripple.RippleAPI({server: network_url})
const api = new xrpl.Client(network_url)
await api.connect()
let result;
let response;
while (true) {
try {
result = await api.request("account_info", {account: address, ledger_index: "validated"})
response = await api.request({
command: "account_info",
account: address,
ledger_index: "validated"
})
break
} catch(e) {
await new Promise(resolve => setTimeout(resolve, 1000))
}
}
$("#sequence").html('<h3>Sequence Number</h3> '+result.account_data.Sequence)
console.log(response)
$("#sequence").html('<h3>Sequence Number</h3> '+response.result.account_data.Sequence)
api.disconnect()
}