0
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.

xpring-jsを使ってXRPをMainnet上で送る

Last updated at Posted at 2020-06-01

やりたいこと

  • タイトルの通り

ソース

  const senderWallet = Wallet.generateWalletFromSeed(process.env.SENDER_SEED);
  const remoteURL = process.env.REMOTE_URL;
  const drop = BigInt((Math.round(amount*1000000)).toString()); // 1XRP = 1,000,000drop

  let testOrMain = XrplNetwork.Main;
  if(process.env.IS_TESTNET){
    testOrMain = XrplNetwork.Test;
  }

  const xrpClient = new XrpClient(remoteURL, testOrMain);
  const senderXAddress = senderWallet.getAddress();
  const senderClassicAddress = XrpUtils.decodeXAddress(senderXAddress);
  const receiverXAddress = XrpUtils.encodeXAddress(receiverClassicAddress, receiverTag);
  const transactionHash = await xrpClient.send(drop, receiverXAddress, senderWallet);

使い方


node send-xrp.js --help
Usage: send-xrp [options]

Options:
  -V, --version                    output the version number
  -d, --destination <destination>  Destination xrp address (default: false)
  -t, --tag [tag]                  Destination tag (default: null)
  -a, --amount <amount>            Send amount. 1 = 1 XRP. (default: false)
  -h, --help                       display help for command

Examples:
  node mainnet-send-xrp.js -d rUas92gJndsSWhFCBbkH3N1yt8YztVfosA -t 4294967295 -a 0.000001

ほか

  • Xpringがサーバー側コンポーネントを用意してくれてるのでXRPの送信は楽ですね :)
  • 需要があればもう少し書く
0
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
0
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?