XRPL Accountlib & XRPL Client together
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const lib = require('xrpl-accountlib') | |
const { XrplClient } = require('xrpl-client') | |
const secret = 's...' | |
const account = 'r...' // Can be derived | |
const client = new XrplClient('wss://hooks-testnet.xrpl-labs.com') | |
const keypair = lib.derive.familySeed(secret) | |
const main = async () => { | |
console.log('Getting ready...') | |
const { account_data } = await client.send({ command: 'account_info', account }) | |
const tx = { | |
TransactionType: 'Payment', | |
Account: account, | |
Amount: '1', | |
Destination: 'rwietsevLFg8XSmG3bEZzFein1g8RBqWDZ', | |
Fee: '12', | |
Sequence: account_data.Sequence | |
} | |
const {signedTransaction} = lib.sign(tx, keypair) | |
const submit = await client.send({ command: 'submit', 'tx_blob': signedTransaction }) | |
console.log(submit.engine_result, submit.engine_result_message, submit.tx_json.hash) | |
console.log('Shutting down...') | |
client.close() | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment