Skip to content

Add paymaster interface #1617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: spr/development/96f1b9cb
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions starknet_py/net/paymaster/paymaster.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from abc import ABC, abstractmethod
from typing import Optional

from starknet_py.net.client_models import Calls, OutsideExecutionTimeBounds
from starknet_py.net.paymaster.client import PaymasterClient
from starknet_py.net.paymaster.models import FeeMode, BuildTransactionResponse


class BasePaymaster(ABC):
@abstractmethod
async def client(self) -> PaymasterClient:
"""
Get the PaymasterClient used by the Paymaster.
"""

@abstractmethod
async def execute(
self,
*,
calls: Calls,
fee_mode: FeeMode,
execution_time_bounds: Optional[OutsideExecutionTimeBounds] = None,
):
"""
Takes calls and token and executes a transaction through the paymaster service.
"""

@abstractmethod
async def sign(
self,
*,
calls: Calls,
fee_mode: FeeMode,
execution_time_bounds: Optional[OutsideExecutionTimeBounds] = None,
) -> BuildTransactionResponse:
"""
Takes calls and token and crates a transaction through the paymaster service without executing it.
"""
Loading