Type Alias TransactionModifyingSigner<TAddress>

TransactionModifyingSigner<TAddress>: Readonly<{
    address: Address<TAddress>;
    modifyAndSignTransactions(transactions: readonly (Readonly<{
        messageBytes: TransactionMessageBytes;
        signatures: SignaturesMap;
    }> | Readonly<{
        messageBytes: TransactionMessageBytes;
        signatures: SignaturesMap;
    }> & TransactionWithLifetime)[], config?: BaseTransactionSignerConfig): Promise<readonly (Readonly<{
        messageBytes: TransactionMessageBytes;
        signatures: SignaturesMap;
    }> & TransactionWithinSizeLimit & TransactionWithLifetime)[]>;
}>

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 SignatureDictionary, its TransactionModifyingSigner#modifyAndSignTransactions | modifyAndSignTransactions function returns an updated Transaction with a potentially modified set of instructions and signature dictionary. The returned transaction must be within the transaction size limit, and include a lifetimeConstraint.

Type Parameters

  • TAddress extends string = string

    Supply a string literal to define a signer having a particular address.

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

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.
  • isTransactionModifyingSigner
  • assertIsTransactionModifyingSigner