Encode Transaction

All multisig requests must be encrypted through Keychain to ensure that only the valid initiator and potential signers have access to them. Therefore we provided a utility function to encode as follows:

Encode Transaction

Begin by encapsulating the operation using hive-tx Transaction(), then integrate it into the 'IEncodeTransaction' object.

const multisig = HiveMultisig.getInstance(window: Window,options?:MultisigOptions); 

const op: Hive.TransferOperation = [
      'transfer',
      {
        from: 'joe',
        to: 'jane',
        amount: 1,
        memo: 'payment',
      },
    ];

const _hiveTx = new hiveTx.Transaction();
const transaction  _hiveTx.create([op], getSeconds(expiration))
const txEncode: IEncodeTransaction = {
          transaction: transaction,
          method: 'posting',
          expirationDate: expiration,
          initiator: 'joe',
        };

const encodedTx = await multisig.utils.encodeTransaction(txEncode)

The multisig.utils.encodeTransaction() function will automatically assign the encoded message to all potential signers. This process encodes the transaction through Keychain and returns the 'RequestSignatureMessage' object.

IEncodeTransaction object

Last updated