2 - User A requests a transaction

Once the user has successfully subscribed to the WebSocket, they can initiate a multisig transaction.

Create the operation

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

Create a transaction by encapsulating with hiveTx

const _hiveTx = new hiveTx.Transaction();
const transaction = _hiveTx.create([op], getSeconds(expiration))

Encode the transaction

const txEncode: IEncodeTransaction = {
          transaction: transaction,
          method: 'posting',
          expirationDate: expiration,
          initiator: 'user-a',
        };
        
const multisig = HiveMultisig.getInstance(window: Window,options?:MultisigOptions); 
const encodedTx = await multisig.utils.encodeTransaction(txEncode)

Request for signatures

await multisig.wss.requestSignatures(encodedTx:RequestSignatureMessage);

The multisig.wss.requestSignatures() function informs the backend to distribute the encoded messages to the potential signers.

RequestSignatureMessage object

This object is obtained by encoding the transaction.

Last updated