Skip to content

refactor(account): lift prependTokenPaymasterApproveToCallData onto base smart account class #104

Description

@coderabbitai

Summary

Currently, Erc7677Paymaster.createPaymasterUserOperation casts SmartAccountWithEntrypoint to PrependTokenPaymasterApproveAccount when context.token is set, without a static type guarantee that the method exists on the account.

Every smart account class in the SDK already implements prependTokenPaymasterApproveToCallData, so the cast is safe today — but the lack of a static guarantee means a consumer passing a custom account without the method would get an opaque runtime TypeError.

Proposed fix

Lift prependTokenPaymasterApproveToCallData onto the base smart account class so that the Erc7677Paymaster token-flow parameter type can reflect the guarantee statically, removing the need for the cast entirely.

Once done, the tokenPaymasterFlow signature can accept SmartAccountWithEntrypoint (or the updated base type) directly, and no runtime guard is required.

Background

Raised during review of PR #102 (feat(paymaster): add generic ERC-7677 paymaster class).
Relevant review comment: #102 (comment)

Requested by: @andrewwahid

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions