Links

XRPL (XRP Ledger)

Sign Transaction

Supported Transaction Types

The following transaction types are supported on D'CENT Biometric wallet.
Transaction Type
Supported
AccountSet
O
AccountDelete
O
CheckCancel
O
CheckCash
O
CheckCreate
O
DepositPreauth
O
EscrowCancel
O
EscrowCreate
O
EscrowFinish
O
NFTokenAcceptOffer
X
NFTokenBurn
X
NFTokenCancelOffer
X
NFTokenCreateOffer
X
NFTokenMint
X
OfferCancel
O
OfferCreate
O
Payment
O
PaymentChannelClaim
O
PaymentChannelCreate
O
PaymentChannelFund
O
SetRegularKey
O
SignerListSet
O
TicketCreate
X
TrustSet
O
For your reference, All transaction types for XRPL can be found here.

getXrpSignedTransaction()

Supported Coin Type

  • XRP(Ripple)

Parameters :

  • transaction: this value conforms JSON format of Transaction Types in XRP Doc.
  • key: key path, wallet sign with that private key with a given key path (BIP32 ex) "m/44'/144'/0'/0/0").

Requirements:

  • D'CENT Bridge version 1.1.4 or higher is required.
  • D'CENT Biometric Wallet version 2.4.0. or higher is required.

Usage:

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
}

Returned response object:

{
"header": {
"version": "1.0",
"response_from": "ripple",
"status": "success"
},
"body": {
"command": "get_sign",
"parameter": {
"sign": "3045022100e81c9e2...8e373e30b8f5e0a33eb094ffc7c8d009ad71fd7581b6b89ef9",
"pubkey": "02c65f2a496909123973282c47edbd0e760bb44bb0d87ec1b30115b2ce3072c766",
"accountId": "462a5a061ebe03fb52e5bca443233bcc6d0e9699"
}
}
}

Send a Multi-Signed Transaction

  • Reference the XRP Doc
  • Multi-signing a Transaction
    1. 1.
      First, prepare by referring to Set Up Multi-Signing (You can get address of account using getAddress() function.)
    2. 2.
      Get signature

Example

// 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
}
For broadcast the sign transaction, you must reconstruct transaction include TxnSignature & SigningPubKey for normal (single-signature) or Signers array for multi-signed-transaction