Kit
Type aliases

TransactionModifyingSigner

TransactionModifyingSigner<TAddress> = Readonly<{ address: Address<TAddress>; modifyAndSignTransactions: Promise<readonly T[]>; }>

A signer interface that potentially modifies the provided Transaction | Transactions before signing them.

For instance, this enables wallets to inject additional instructions into the transaction before signing them. For each transaction, instead of returning a SignatureDirectory, its TransactionModifyingSigner#modifyAndSignTransactions | modifyAndSignTransactions function returns an updated Transaction with a potentially modified set of instructions and signature dictionary.

Type Parameters

Type ParameterDefault typeDescription
TAddress extends stringstringSupply a string literal to define a signer having a particular address.

Example

const signer: TransactionModifyingSigner<'1234..5678'> = {
    address: address('1234..5678'),
    modifyAndSignTransactions: async <T extends Transaction>(
        transactions: T[]
    ): Promise<T[]> => {
        // My custom signing logic.
    },
};

Remarks

Here are the main characteristics of this signer interface:

  • Sequential. Contrary to partial signers, these cannot be executed in parallel as each call can modify the provided transactions.
  • First signers. For a given transaction, a modifying signer must always be used before a partial signer as the former will likely modify the transaction and thus impact the outcome of the latter.
  • Potential conflicts. If more than one modifying signer is provided, the second signer may invalidate the signature of the first one. However, modifying signers may decide not to modify a transaction based on the existence of signatures for that transaction.

See

On this page