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

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

Property
Description
Type

transaction

The transaction that is being initiated. Contains the operation and expiration wrapped using hive-tx.Transaction()

hive-tx Transaction

method

The type of key subscribing to the WebSocket. Can be "Active" or "Posting"

KeychainKeyTypes enum

expirationDate

The expiration date of the multisig request. Must be minimum of 10 minutes and maximum of 1 hour from the time of creatio

Date or string

initiator object

Initiator details corresponding to the method. Including username, public key, and weight.

username: string publicKey: string weight: number

Last updated