Created
November 25, 2020 04:04
-
-
Save OmarKhattab/f1d9444a0e51246b8d1a62e576121e07 to your computer and use it in GitHub Desktop.
send xrp to coinbase
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
"use strict"; | |
const RippleAPI = require("ripple-lib").RippleAPI; | |
const address = "THE ADDRESS OF YOUR WALLET"; | |
const secret = "THE SECRET KEY FOR YOUR WALLET"; | |
const api = new RippleAPI({ server: "wss://s1.ripple.com:443" }); | |
const instructions = { maxLedgerVersionOffset: 5 }; | |
const payment = { | |
source: { | |
address: address, | |
maxAmount: { | |
value: "1597.22", | |
currency: "XRP", | |
}, | |
}, | |
destination: { | |
address: "YOUR COINBASE ADDRESS", | |
amount: { | |
value: "1597.22", | |
currency: "XRP", | |
}, | |
tag: "YOUR COINBASE TAG THIS IS REQUIRED", | |
}, | |
}; | |
function quit(message) { | |
console.log(message); | |
process.exit(0); | |
} | |
function fail(message) { | |
console.error(message); | |
process.exit(1); | |
} | |
api | |
.connect() | |
.then(() => { | |
console.log("Connected..."); | |
return api | |
.preparePayment(address, payment, instructions) | |
.then((prepared) => { | |
console.log("Payment transaction prepared..."); | |
const { signedTransaction } = api.sign(prepared.txJSON, secret); | |
console.log("Payment transaction signed..."); | |
api.submit(signedTransaction).then(quit, fail); | |
}); | |
}) | |
.catch(fail); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment