Created
March 18, 2019 09:34
-
-
Save WietseWind/2b83b59a534d8994c6c9af73518291f6 to your computer and use it in GitHub Desktop.
XRPL Payment with Memo
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 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