Skip to content

Conversation

PhilippeR26
Copy link
Collaborator

@PhilippeR26 PhilippeR26 commented Aug 11, 2025

Motivation and Resolution

SNIP-29 Paymaster is today accessible from an Account class, but not from a Contract class.
This PR add Paymaster in Contract class.

Usage related changes

  • fee estimation
const feeEstimation = await tokenContract.estimate(
  'transfer',
  [destinationAddress, cairo.uint256(100)],
  { paymasterDetails: feesDetails }
);
  • invoke
const res1 = await tokenContract.invoke('transfer', [destinationAddress, cairo.uint256(100)], {
  paymasterDetails: feesDetails,
  maxFeeInGasToken: feeEstimation.suggested_max_fee_in_gas_token,
});
  • .withOptions
const res2 = await myTestContract
  .withOptions({
    paymasterDetails: feesDetails,
    maxFeeInGasToken: feeEstimation.suggested_max_fee_in_gas_token,
  })
  .transfer(destinationAddress, cairo.uint256(100));

Development related changes

paymasterDetails?: PaymasterDetails;
maxFeeInGasToken?: BigNumberish;

are added in ExecuteOptions

Checklist:

  • Performed a self-review of the code
  • Rebased to the last commit of the target branch (or merged it into my branch)
  • Documented the changes in code (API docs will be generated automatically)
  • Updated the tests
  • All tests are passing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants