-
-
Save intelliBrain/6414b03ab676ed8dfa969971bf561d27 to your computer and use it in GitHub Desktop.
XRP (XRPL) EscrowCreate using NodeJS (featuring Memos) - Used for: https://twitter.com/WietseWind/status/998968185532579840
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 = 'sXXXXXXXXXXXXXXXXXXXX' // The secret of the sending wallet | |
// const FinishAfter = Math.floor(new Date('2031-12-01T12:00:00Z') / 1000) - 946684800 /* XRPL Timestamp offset */ | |
const FinishAfter = Math.floor(Date.parse('2018-10-10 12:00:00 GMT+1') / 1000) - 946684800 /* XRPL Timestamp offset */ | |
const Transaction = { | |
TransactionType: 'EscrowCreate', | |
Account: 'rSENDINGWALLET', | |
Destination: 'rRECEIVINGWALLET', | |
FinishAfter: FinishAfter, | |
Amount: 1 * 1000000, // Amount in drops, so multiply (6 decimal positions), this is 1 XRP | |
LastLedgerSequence: null, | |
Fee: 12, | |
Memos: [ | |
{ | |
Memo: { | |
MemoType: Buffer.from('Sometext over here', 'utf8').toString('hex').toUpperCase(), | |
MemoData: Buffer.from('Some more text over here', 'utf8').toString('hex').toUpperCase() | |
} | |
}, | |
{ | |
Memo: { | |
MemoData: Buffer.from('And more text', '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