mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-21 04:05:49 +00:00
- Moved the LAN config tutorial to its own (draft) file to be finished later - Mentioned dedicated signing devices such as the Ledger Nano S - Improved the JS example's handling of secrets
26 lines
678 B
JavaScript
26 lines
678 B
JavaScript
'use strict'
|
|
const RippleAPI = require('ripple-lib').RippleAPI
|
|
|
|
// Load address & secret from environment variables:
|
|
const from_address = process.env['MY_ADDRESS']
|
|
const secret = process.env['MY_SECRET']
|
|
|
|
// Can sign offline if the txJSON has all required fields
|
|
const api = new RippleAPI()
|
|
|
|
const txJSON = JSON.stringify({
|
|
"Account": from_address,
|
|
"TransactionType":"Payment",
|
|
"Destination":"rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
|
"Amount":"13000000",
|
|
"Flags":2147483648,
|
|
"LastLedgerSequence":7835923,
|
|
"Fee":"13",
|
|
"Sequence":2
|
|
})
|
|
|
|
const signed = api.sign(txJSON, secret)
|
|
|
|
console.log("tx_blob is:", signed.signedTransaction)
|
|
console.log("tx hash is:", signed.id)
|