Class TrezorDI

Represents an interface for Trezor device interactions.

Implements

  • Connected

Constructors

Properties

policyRegistrationRequired: boolean = false

Methods

  • Converts PSBT to Trezor sign parameters.

    Parameters

    • psbtHex: string

      The hexadecimal representation of the partially signed bitcoin transaction (PSBT).

    • params: {
          network: NetworkEnum;
          walletKey: WalletKey;
          walletType: WalletTypeEnum;
      }

      Additional parameters for signing.

      • network: NetworkEnum
      • walletKey: WalletKey
      • walletType: WalletTypeEnum

    Returns Params<SignTransaction>

    The Trezor sign parameters.

  • Gets the master fingerprint from the Trezor device.

    Parameters

    • network: NetworkEnum = NetworkEnum.MAINNET

      The network type.

    Returns Promise<string>

    Resolves with the master fingerprint.

  • Gets the extended public key (xpub) from the Trezor device.

    Parameters

    • derivationPath: string

      The derivation path.

    • network: NetworkEnum

      The network type.

    Returns Promise<string>

    Resolves with xpub.

  • Gets the extended public key (xpub) information from the Trezor device.

    Parameters

    • derivationPath: string

      The derivation path.

    • network: NetworkEnum

      The network type.

    Returns Promise<{
        derivationPath: string;
        masterFingerprint: string;
        xpub: string;
    }>

    Resolves with the xpub information.

  • Initializes the connection with Trezor device.

    Parameters

    • Optional options: {
          manifest: {
              appUrl: string;
              email: string;
          };
      }

      The options for initialization.

      • manifest: {
            appUrl: string;
            email: string;
        }

        The manifest object containing email and appUrl.

        • appUrl: string
        • email: string

    Returns Promise<void>

    Resolves once the initialization is complete.

  • Signs a message with the Trezor device.

    Parameters

    • message: string

      The message to sign.

    • derivationPath: string

      The derivation path.

    • network: NetworkEnum

      The network type.

    Returns Promise<{
        signature: string;
    }>

    Resolves with the signature of the message.

  • Signs a transaction with the Trezor device.

    Parameters

    • psbtHex: string

      The hexadecimal representation of the partially signed bitcoin transaction (PSBT).

    • params: {
          network: NetworkEnum;
          walletKey: WalletKey;
          walletType: WalletTypeEnum;
      }

      Additional parameters for signing.

      • network: NetworkEnum
      • walletKey: WalletKey
      • walletType: WalletTypeEnum

    Returns Promise<string>

    Resolves with the raw signed transaction.

  • Initializes the TrezorDI instance asynchronously. This method should be used to create an instance of TrezorDI. It waits for the initialization process to complete.

    Returns Promise<TrezorDI>

    Resolves with a fully initialized instance of TrezorDI.