Checks tutorial: separate signing for CheckCreate

This commit is contained in:
mDuo13
2018-03-21 15:14:54 -07:00
parent f335bcaa41
commit ab596fd371
12 changed files with 258 additions and 51 deletions

View File

@@ -0,0 +1,33 @@
'use strict'
const RippleAPI = require('ripple-lib').RippleAPI
// This example connects to a public Test Net server
const api = new RippleAPI({server: 'wss://s.altnet.rippletest.net:51233'})
api.connect().then(() => {
console.log('Connected')
const sender = 'rBXsgNkPcDN2runsvWmwxk3Lh97zdgo9za'
const receiver = 'rGPnRH1EBpHeTF2QG8DCAgM7z5pb75LAis'
const options = {
// Allow up to 60 ledger versions (~5 min) instead of the default 3 versions
// before this transaction fails permanently.
"maxLedgerVersionOffset": 60
}
return api.prepareCheckCreate(sender, {
"destination": receiver,
"sendMax": {
"currency": "XRP",
"value": "100" // RippleAPI uses decimal XRP, not integer drops
}
}, options)
}).then(prepared => {
console.log("txJSON:", prepared.txJSON);
// Disconnect and return
}).then(() => {
api.disconnect().then(() => {
console.log('Disconnected')
process.exit()
})
}).catch(console.error)