For the complete documentation index, see llms.txt. This page is also available as Markdown.

Stellar

Sign Transaction

The D'CENT Web SDK provides functions for signing transaction of coins.

getStellarSignedTransaction()

Supported Coin Type

  • STELLAR

Parameters

  • transactionJson: this value conforms JSON format of Transaction Types in Stellar Docs

Requirements

  • D'CENT Bridge version 1.4.0 or higher is required.

  • D'CENT Biometric Wallet version 2.20.0 or higher is required.

Useage

const _buf2hex = (buffer) => { // buffer is an ArrayBuffer
    return Array.prototype.map.call(new Uint8Array(buffer), x => ('00' + x.toString(16)).slice(-2)).join('');
}
const server = new StellarSdk.Server('https://horizon.stellar.org')
const account = await server.loadAccount(address)

// Operation
const operationXdr = StellarSdk.Operation.createAccount({
    destination: toAddr,
    startingBalance: amount
})

// Builder
const transactionBuilder = new StellarSdk.TransactionBuilder(account, { 
    fee: StellarSdk.BASE_FEE,
    networkPassphrase: StellarSdk.Networks.TESTNET
})
.addOperation(operationXdr)
.setTimeout(300)
.build()

const unsignedTx = _buf2hex(transactionBuilder.signatureBase())

const transactionJson = {
    unsignedTx: unsignedTx,
    fee: StellarSdk.BASE_FEE
    path: `m/44'/148'/0'`,
}

var result
try {
    result = await DcentWebConnector.getStellarSignedTransaction(transactionJson);    
} catch (e) {
    console.log(e)
    result = e
}

Returned response object

Last updated