1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ripple-libでXRPを送金する

Last updated at Posted at 2019-09-04

更新

XRPを送りたい

ソース


api.connect().then(() => {
  const preparedTx = await api.prepareTransaction({
    "TransactionType": "Payment",
    "Account": sender,
    "Amount": api.xrpToDrops(amount),
    "Destination": destination,
  }, {
    // Expire this transaction if it doesn't execute within ~5 minutes:
    "maxLedgerVersionOffset": 75
  })
  const maxLedgerVersion = preparedTx.instructions.maxLedgerVersion
  return preparedTx.txJSON
}).then(txJSON => {
  const response = api.sign(txJSON, secret)
  const txID = response.id
  const txBlob = response.signedTransaction
  return txBlob;
}).then(txBlob => {
  const latestLedgerVersion = await api.getLedgerVersion()
  const result = await api.submit(txBlob)
  return latestLedgerVersion + 1
}).then((earliestLedgerVersion) => {
  return api.disconnect();
}).then(() => {
  process.exit();
}).catch(console.error);
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?