xrpl.js 2.0: small code updates

This commit is contained in:
mDuo13
2021-10-13 17:37:37 -07:00
parent 46b9a90c08
commit 69641175ce
4 changed files with 4 additions and 7 deletions

View File

@@ -44,7 +44,7 @@ $("#sign-button").click( function(event) {
const wallet = get_wallet(event)
if (!wallet) {return}
{tx_blob, hash} = wallet.sign(preparedTxJSON)
const {tx_blob, hash} = wallet.sign(preparedTxJSON)
block.find(".output-area").html(
`<div><strong>Signed Transaction blob:</strong>

View File

@@ -10,8 +10,8 @@ async function main() {
await client.connect()
// Create a wallet and fund it with the Testnet faucet:
const test_wallet = new xrpl.Wallet() // TODO: change to define based on fundWallet result
const fund_result = await client.fundWallet(test_wallet)
const test_wallet = fund_result.wallet
console.log(fund_result)
// Get info from the ledger about the address we just funded

View File

@@ -32,10 +32,7 @@ api.on('connected', async () => {
// The earliest ledger a transaction could appear in is the first ledger
// after the one that's already validated at the time it's *first* submitted.
const min_ledger = (await api.getLedgerIndex()) + 1
const result = await api.request({
"command": "submit",
"tx_blob": signed.tx_blob
})
const result = await api.submit(signed.tx_blob)
console.log("Tentative result code:", result.result.engine_result)
console.log("Tentative result message:", result.result.engine_result_message)

View File

@@ -196,7 +196,7 @@ The result of the signing operation is a transaction object containing a signatu
Now that you have a signed transaction, you can submit it to an XRP Ledger server, and that server will relay it through the network. It's also a good idea to take note of the latest validated ledger index before you submit. The earliest ledger version that your transaction could get into as a result of this submission is one higher than the latest validated ledger when you submit it. Of course, if the same transaction was previously submitted, it could already be in a previous ledger. (It can't succeed a second time, but you may not realize it succeeded if you aren't looking in the right ledger versions.)
- **JavaScript:** Use the [`submitReliable()` method of the Client](TODO: link) to submit a transaction to the network and wait for the response.
- **JavaScript:** Use the [`submitSignedReliable()` method of the Client](https://js.xrpl.org/classes/Client.html#submitSignedReliable) to submit a signed transaction to the network and wait for the response, or use [`submitSigned()`](https://js.xrpl.org/classes/Client.html#submitSigned) to submit a transaction and get only the preliminary response.
- **Python:** Use the [`xrpl.transaction.send_reliable_submission()` method](https://xrpl-py.readthedocs.io/en/latest/source/xrpl.transaction.html#xrpl.transaction.send_reliable_submission) to submit a transaction to the network and wait for a response.
- **Java:** Use the [`XrplClient.submit(SignedTransaction)` method](https://javadoc.io/doc/org.xrpl/xrpl4j-client/latest/org/xrpl/xrpl4j/client/XrplClient.html#submit(org.xrpl.xrpl4j.crypto.signing.SignedTransaction)) to submit a transaction to the network. Use the [`XrplClient.ledger()`](https://javadoc.io/doc/org.xrpl/xrpl4j-client/latest/org/xrpl/xrpl4j/client/XrplClient.html#ledger(org.xrpl.xrpl4j.model.client.ledger.LedgerRequestParams)) method to get the latest validated ledger index.