Last active
October 20, 2020 14:32
-
-
Save WietseWind/e8b07274192020eb65f75b98568b903f to your computer and use it in GitHub Desktop.
XUMM SDK payload & subscription
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
const {XummSdk} = require('xumm-sdk') | |
const Sdk = new XummSdk('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', '...') | |
const main = async () => { | |
const appInfo = await Sdk.ping() | |
console.log(appInfo.application.name) | |
// Please change the destination account to an account (and possibly: DestinationTag) | |
// you own, or you'll be testing sending a small amount of XRP to the XRPL Labs team ;) | |
const request = { | |
"TransactionType": "Payment", | |
"Destination": "rwietsevLFg8XSmG3bEZzFein1g8RBqWDZ", | |
"Amount": "10000", | |
"Memos": [ | |
{ | |
"Memo": { | |
"MemoData": "F09F988E20596F7520726F636B21" | |
} | |
} | |
] | |
} | |
const subscription = await Sdk.payload.createAndSubscribe(request, event => { | |
console.log('New payload event:', event.data) | |
if (event.data.signed === true) { | |
console.log('Woohoo! The sign request was signed :)') | |
return event.data | |
} | |
if (event.data.signed === false) { | |
console.log('The sign request was rejected :(') | |
return false | |
} | |
}) | |
console.log(subscription.created) | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment