Skip to content

prepareTransactionForSigning

The prepareTransactionForSigning method prepares a Cosmos transaction for MPC signing by creating the transaction structure and computing the hash that needs to be signed.

Usage

const { transaction, hashesToSign } =
  await cosmosChain.prepareTransactionForSigning({
    address: 'cosmos1...',
    publicKey: '0350e8...',
    messages: [
      {
        typeUrl: '/cosmos.bank.v1beta1.MsgSend',
        value: {
          fromAddress: 'cosmos1...',
          toAddress: 'cosmos1...',
          amount: [{ denom: 'uatom', amount: '1000000' }],
        },
      },
    ],
    memo: 'Token transfer',
  })

Parameters

ParameterTypeDescription
transactionRequestCosmosTransactionRequestThe transaction request object containing address, publicKey, messages, and optional memo and fee settings

Returns

PropertyTypeDescription
transactionCosmosUnsignedTransactionObject containing the unsigned transaction
hashesToSignstring[]Array of hashes that need to be signed