kaspaSignTransaction

Use requirement

  • Firmware version required

    • Touch: 4.3.0

    • Classic/Mini: 3.0.0

Kaspa: Sign transaction

Asks device to sign given transaction using the private key derived by given BIP32 path. User is asked to confirm all transaction details on OneKey.

const result = await HardwareSDK.kaspaSignTransaction(connectId, deviceId, params);

Params

Optional common params

  • version — required number transaction version.

  • inputs - required Array of KaspaSignInputParams.

  • outputs - required Array of KaspaSignOutputParams.

  • lockTime - required number

  • sigHashType - required number

    • SIGHASH_ALL = 0x01,
      SIGHASH_NONE = 0x02,
      SIGHASH_SINGLE = 0x03,
      SIGHASH_FORKID = 0x40,
      SIGHASH_ANYONECANPAY = 0x80,
  • sigOpCount - optional number

  • subNetworkID - optional string

  • prefix - optional string Address prefix. Default is set to kaspa

  • scheme - optional string Encryption algorithm mode. Default is set to schnorr

Examples

const response = await HardwareSDK.kaspaSignTransaction(
  connectId,
  deviceId,
  {
    version: 0,
    lockTime: '0',
    sigHashType: 0x1,
    sigOpCount: 1,
    subNetworkID: "00000000000000000000000000000000",
    prefix: "prefix",
    scheme: "schnorr",
    inputs: [
      {
        outputIndex: 1,
        path: "m/44'/111111'/0'/0/0",
        prevTxId: '1f226507807ff7dc5a7f8f2dec353fffc9dacc2645d8aecd02e5046907e3e2b2',
        sequenceNumber: '0',
        sigOpCount: 1,
        output: {
          satoshis: '990096458',
          script: '207afdae557e69c0040fd4135adffc60f9486fb21f4cbae233fd6db3e84ba47c55ac',
        },
      },
    ],
    outputs: [
      {
        satoshis: '100000000',
        script: '205ca3a7530284e5c5e472544edd6002c3afeb8c8f84d3a728fad255a4872753fbac',
        scriptVersion: 0,
      },
      {
        satoshis: '890094182',
        script: '207afdae557e69c0040fd4135adffc60f9486fb21f4cbae233fd6db3e84ba47c55ac',
        scriptVersion: 0,
      },
    ]
  }
);

Result

{
  success: true,
  payload: {
    index: 0,
    signature: "signed data"
  }
}

Error

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

Last updated