coinbase_agentkit.action_providers.erc20 package¶
Submodules¶
coinbase_agentkit.action_providers.erc20.constants module¶
Constants for ERC20 action provider.
coinbase_agentkit.action_providers.erc20.erc20_action_provider module¶
ERC20 action provider.
- class coinbase_agentkit.action_providers.erc20.erc20_action_provider.ERC20ActionProvider¶
Bases:
ActionProvider
[EvmWalletProvider
]Action provider for ERC20 tokens.
- get_balance(wallet_provider, args)¶
Get the balance of an ERC20 token for the wallet’s address.
- Parameters:
wallet_provider (EvmWalletProvider) – The wallet provider instance.
args (dict[str, Any]) – Input arguments for the action.
- Returns:
A message containing the action response or error details.
- Return type:
str
- supports_network(network)¶
Check if the network is supported by this action provider.
- Parameters:
network (Network) – The network to check support for.
- Returns:
Whether the network is supported.
- Return type:
bool
- transfer(wallet_provider, args)¶
Transfer ERC20 tokens to a destination address.
- Parameters:
wallet_provider (EvmWalletProvider) – The wallet provider instance.
args (dict[str, Any]) – Input arguments for the action.
- Returns:
A message containing the action response or error details.
- Return type:
str
- coinbase_agentkit.action_providers.erc20.erc20_action_provider.erc20_action_provider()¶
Create a new instance of the ERC20 action provider.
- Return type:
- Returns:
A new ERC20 action provider instance.
coinbase_agentkit.action_providers.erc20.schemas module¶
Schemas for the ERC20 action provider.
- class coinbase_agentkit.action_providers.erc20.schemas.GetBalanceSchema(**data)¶
Bases:
BaseModel
Schema for getting the balance of an ERC20 token.
-
contract_address:
str
¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
contract_address:
- class coinbase_agentkit.action_providers.erc20.schemas.TransferSchema(**data)¶
Bases:
BaseModel
Schema for transferring ERC20 tokens.
-
amount:
str
¶
-
contract_address:
str
¶
-
destination:
str
¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod validate_wei_amount(v)¶
Validate wei amount.
- Return type:
str
-
amount:
coinbase_agentkit.action_providers.erc20.validators module¶
Validators for ERC20 action provider schemas.
- coinbase_agentkit.action_providers.erc20.validators.wei_amount_validator(value)¶
Validate that amount is a valid wei value (positive whole number as string).
- Parameters:
value (str) – The string value to validate, expected to be a positive whole number
- Returns:
The validated value if it passes all checks
- Return type:
str
- Raises:
PydanticCustomError – If the value is not a positive whole number string or is zero/negative
Module contents¶
ERC20 action provider for token interactions.