Sign | Developers

Sign

Estimated reading time: One minute

Introduction

Signing a transaction is pretty straight-forward.

signTransaction:

async signTransaction(
    accountId: string,
    transaction: Transaction,
    params?: {
      /**
       * The name of the Ledger Nano app to use for the signing process
       */
      useApp: string;
    }
  ): Promise<RawSignedTransaction> 

The two mandatory parameters that you need in order to sign a transaction are:

  • Get the account of the user: accountId
  • Build the transaction: transaction.

Account Id

To get the accountID, you have two options. You can either use the listAccounts or the requestAccount functions.

List account

List the accounts added by the user on Ledger Live.

listAccounts:

async listAccounts(): Promise<Account[]>

Request account

Let the user choose an account in Ledger Live, providing filters for choosing currency or allowing add account.

requestAccount:

async requestAccount(
    params: {
      currencies?: string[];
      allowAddAccount?: boolean;
    } = {}
  ): Promise<Account> 

Transaction

The transaction parameter (type) must be built by yourself, it isn’t returned by a function.

transaction:

export interface TransactionCommon {
  amount: BigNumber;
  recipient: string;
}

export type Transaction =
  | EthereumTransaction
  | BitcoinTransaction
  | AlgorandTransaction
  | CryptoOrgTransaction
  | RippleTransaction
  | CosmosTransaction
  | TezosTransaction
  | PolkadotTransaction
  | StellarTransaction
  | TronTransaction;

Did you find this page helpful?


How would you improve this page for developers?



Setup
Broadcast
Getting Started
Theme Features
Customization