Skip to content

Instantly share code, notes, and snippets.

@WietseWind
Created March 18, 2019 09:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save WietseWind/2b83b59a534d8994c6c9af73518291f6 to your computer and use it in GitHub Desktop.
Save WietseWind/2b83b59a534d8994c6c9af73518291f6 to your computer and use it in GitHub Desktop.
XRPL Payment with Memo
const RippledWsClient = require('rippled-ws-client')
const RippledWsClientSign = require('rippled-ws-client-sign')
const SeedOrKeypair = 'sZZZZZZZZZ' // The secret of the sending wallet
const Transaction = {
TransactionType: 'Payment',
Account: 'rXXXXX',
Destination: 'rYYYYYYY',
Amount: 4635000000,
Fee: 10,
Memos: [
{
Memo: {
MemoType: Buffer.from('TestMemo', 'utf8').toString('hex').toUpperCase(),
MemoData: Buffer.from('Hi there!', 'utf8').toString('hex').toUpperCase()
}
},
{
Memo: {
MemoType: Buffer.from('Sender', 'utf8').toString('hex').toUpperCase(),
MemoData: Buffer.from('JohnDoe', 'utf8').toString('hex').toUpperCase()
}
}
]
}
new RippledWsClient('wss://s1.ripple.com').then((Connection) => {
new RippledWsClientSign(Transaction, SeedOrKeypair, Connection).then((TransactionSuccess) => {
console.log('TransactionSuccess', TransactionSuccess)
Connection.close()
}).catch((SignError) => {
console.log('SignError', SignError.details)
Connection.close()
})
}).catch((ConnectionError) => {
console.log('ConnectionError', ConnectionError)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment