XRPL (XRP Ledger)
Last updated
const transactionJson = {
"TransactionType": "AccountSet", // or use defined value `dcent.xrpTxType.AccountSet`
"Account": "rfQrsnD8ywrgSX457qshpBTDru7EDnM2Lb",
"Fee": "10",
"Sequence": 34,
"MessageKey": "02000000000000000000000000415F8315C9948AD91E2CCE5B8583A36DA431FB61",
"Flags": 2147483648, // if exist then D'Cent check that `tfFullyCanonicalSig` is set?
}
var result
try {
result = await dcent.getXrpSignedTransaction(transactionJson, "m/44'/144'/0'/0/0");
} catch (e) {
console.log(e)
result = e
}{
"header": {
"version": "1.0",
"response_from": "ripple",
"status": "success"
},
"body": {
"command": "get_sign",
"parameter": {
"sign": "3045022100e81c9e2...8e373e30b8f5e0a33eb094ffc7c8d009ad71fd7581b6b89ef9",
"pubkey": "02c65f2a496909123973282c47edbd0e760bb44bb0d87ec1b30115b2ce3072c766",
"accountId": "462a5a061ebe03fb52e5bca443233bcc6d0e9699"
}
}
}// You can use xrp library for encoding
//const api = require('ripple-binary-codec')
//const addrs = require('ripple-address-codec')
const transactionJson = {
"TransactionType": "Payment",
"Account": "rfQrsnD8ywrgSX457qshpBTDru7EDnM2Lb",
"Fee": "30", // normal cost * (1 + N)
"Sequence": 45,
"Amount": "1234567",
"Flags": 2147483648,
"Destination": "rJZMdVmbqFPi5oMyzGKJhHW9mNHwpiYKpS",
"SigningPubKey": "", // Must be blank
}
var result
var signer = {}
try {
// Keypath is SignerEntry's key path
result = await DcentWebConnector.getXrpSignedTransaction(transactionJson, "m/44'/144'/1'/0/0");
signer = {
"Account": "rBV2LGGm5XAc5KbL7hBaPnLnUJ5aTQzVj9", // addrs.encodeAccountID(Buffer.from(result.accountId,'hex'))
"SigningPubKey": result.pubkey,
"TxnSignature": result.sign
}
} catch (e) {
console.log(e)
result = e
}