Stellar: Sign transaction

Asks device to sign given transaction. User is asked to confirm all transaction details on Trezor.

const result = await TrezorConnect.stellarSignTransaction(params);

Params

**Optional common params**

flowtype
  • pathrequired string | Array<number> minimum length is 3. read more
  • networkPassphrase - required string network passphrase
  • transaction - required Object type of StellarTransaction

Stellar SDK compatibility

stellar-sdk is not a part of trezor-connect repository. To transform StellarSDK.Transaction object into TrezorConnect.StellarTransaction object copy this plugin into your project.

import StellarSDK from 'stellar-sdk';
import transformTrezorTransaction from '<path-to-plugin>/index.js';

const tx = new StellarSdk.TransactionBuilder(...);
...
tx.build();

const params = transformTrezorTransaction(tx);
const result = TrezorConnect.stellarSignTransaction(params);

if (result.success) {
    tx.addSignature('account-public-key', result.payload.signature);
}

Example

TrezorConnect.stellarSignTransaction(
    path: "m/44'/148'/0'",
    networkPassphrase: "Test SDF Network ; September 2015",
    transaction: {
        source: "GAXSFOOGF4ELO5HT5PTN23T5XE6D5QWL3YBHSVQ2HWOFEJNYYMRJENBV",
        fee: 100,
        sequence: 4294967296,
        memo: {
            type: 0,
        },
        operations: [
            {
                type: "payment",
                source: "GAXSFOOGF4ELO5HT5PTN23T5XE6D5QWL3YBHSVQ2HWOFEJNYYMRJENBV",
                destination: "GAXSFOOGF4ELO5HT5PTN23T5XE6D5QWL3YBHSVQ2HWOFEJNYYMRJENBV",
                amount: "10000"
            }
        ]
    }
});

Result

flowtype
{
    success: true,
    payload: {
        publicKey: string,
        signature: string,
    }
}

Error

{
    success: false,
    payload: {
        error: string // error message
    }
}