Signer#
BaseSigner interface#
- class starknet_py.net.signer.BaseSigner#
Base class for transaction signer. Implement methods from this ABC to use a custom signer in Account.
- abstract sign_message(typed_data: TypedData, account_address: int) List[int] #
Sign TypedData object for off-chain usage with the Starknet private key and return the signature. This adds a message prefix, so it can’t be interchanged with transactions.
- Parameters:
typed_data – TypedData to be signed.
account_address – account address.
- Returns:
the signature of the JSON object.
- abstract sign_transaction(transaction: AccountTransaction) List[int] #
Sign execute transaction and return a signature
- Parameters:
transaction – Execute transaction to sign
- Returns:
transaction signature
- abstract property public_key: int#
Public key of the signer.
- Returns:
public key
BaseSigner default implementation#
By default, starknet.py uses StarkCurveSigner
which works with OpenZeppelin’s account contract.
- class starknet_py.net.signer.stark_curve_signer.StarkCurveSigner#
- __init__(account_address: int | str, key_pair: KeyPair, chain_id: StarknetChainId)#
- Parameters:
account_address – Address of the account contract.
key_pair – Key pair of the account contract.
chain_id – ChainId of the chain.
- sign_message(typed_data: TypedData, account_address: int) List[int] #
Sign TypedData object for off-chain usage with the Starknet private key and return the signature. This adds a message prefix, so it can’t be interchanged with transactions.
- Parameters:
typed_data – TypedData to be signed.
account_address – account address.
- Returns:
the signature of the JSON object.
- sign_transaction(transaction: AccountTransaction) List[int] #
Sign execute transaction and return a signature
- Parameters:
transaction – Execute transaction to sign
- Returns:
transaction signature
- property private_key: int#
Private key of the signer.
- property public_key: int#
Public key of the signer.
- Returns:
public key