mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-19 19:25:51 +00:00
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
const prompt = require('prompt')
|
|
const xrpl = require('xrpl')
|
|
|
|
sendTransaction = async function (tx_blob) {
|
|
const client = new xrpl.Client('wss://s.altnet.rippletest.net:51233')
|
|
await client.connect()
|
|
|
|
console.log("Connected to node")
|
|
|
|
const tx = await client.submitAndWait(tx_blob)
|
|
|
|
const txHash = tx.result.hash
|
|
const txDestination = tx.result.Destination
|
|
const txXrpAmount = xrpl.dropsToXrp(tx.result.Amount)
|
|
const txAccount = tx.result.Account
|
|
|
|
console.log("XRPL Explorer: https://testnet.xrpl.org/transactions/" + txHash)
|
|
console.log("Transaction Hash: " + txHash)
|
|
console.log("Transaction Destination: " + txDestination)
|
|
console.log("XRP sent: " + txXrpAmount)
|
|
console.log("Wallet used: " + txAccount)
|
|
|
|
await client.disconnect()
|
|
}
|
|
|
|
main = async function () {
|
|
const {tx_blob} = await prompt.get([{
|
|
name: 'tx_blob',
|
|
description: 'Set tx to \'tx_blob\' received from scanning the QR code generated by the airgapped wallet',
|
|
type: 'string',
|
|
required: true
|
|
}])
|
|
|
|
await sendTransaction(tx_blob)
|
|
}
|
|
|
|
main() |