Function: assertPaymasterTransactionSafety()
assertPaymasterTransactionSafety(
preparedTransaction,calls,paymasterDetails,chainId,maxFeeInGasToken?):void
Defined in: src/plugins/paymaster/utils.ts:249
Asserts that a paymaster-prepared transaction is safe to sign. It checks that the typed-data domain is bound to the account's own chain, and — for non-sponsored transactions — that the calls and the appended gas-token transfer match what the user asked for. It then rebuilds the outside execution it expects, from its own SNIP-9 shape and the user's own calls, and checks that the hash the account would sign is that outside execution and nothing else. When the user gave time bounds, the signed window must stay inside them.
Parameters
preparedTransaction
The transaction returned by the paymaster.
calls
Call[]
The calls originally requested by the user.
paymasterDetails
The fee mode and related paymaster details.
chainId
"0x534e5f4d41494e" | "0x534e5f5345504f4c4941"
The chain id of the account's own provider.
maxFeeInGasToken?
Optional user-approved ceiling on the gas-token fee.
Returns
void
Throws
Throws an error if any of the above safety properties do not hold.
Example
assertPaymasterTransactionSafety(
preparedTransaction,
calls,
{ feeMode: { mode: 'default', gasToken: strkAddress } },
constants.StarknetChainId.SN_SEPOLIA
);
// does not throw if preparedTransaction is exactly what was requested