Skip to content

Instantly share code, notes, and snippets.

@WietseWind
Last active October 20, 2020 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WietseWind/e8b07274192020eb65f75b98568b903f to your computer and use it in GitHub Desktop.
Save WietseWind/e8b07274192020eb65f75b98568b903f to your computer and use it in GitHub Desktop.
XUMM SDK payload & subscription
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