coinbase_agentkit.action_providers.erc721 package¶
Submodules¶
coinbase_agentkit.action_providers.erc721.constants module¶
Constants for ERC721 action provider.
coinbase_agentkit.action_providers.erc721.erc721_action_provider module¶
ERC721 action provider.
- class coinbase_agentkit.action_providers.erc721.erc721_action_provider.Erc721ActionProvider¶
Bases:
ActionProvider
[EvmWalletProvider
]Action provider for ERC721 contract interactions.
- get_balance(wallet_provider, args)¶
Get the NFT balance for a given address and contract.
This function queries an ERC721 NFT contract to get the token balance for a specific address. It uses the standard ERC721 balanceOf function which returns the number of tokens owned by the given address for that NFT collection.
- Parameters:
wallet_provider (EvmWalletProvider) – The wallet provider to use for making the contract call
args (dict[str, Any]) –
The input arguments containing: - contract_address (str): The address of the ERC721 NFT contract to query - address (str, optional): The address to check NFT balance for. If not provided,
uses the wallet’s default address
- Returns:
- A message containing either:
The NFT balance details if successful
An error message if the balance check fails
- Return type:
str
- Raises:
Exception – If the contract call fails for any reason
- mint(wallet_provider, args)¶
Mint an NFT (ERC-721) to a specified 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
- supports_network(network)¶
Check if the ERC721 action provider supports the given network.
- Parameters:
network (
Network
) – The network to check.- Return type:
bool
- Returns:
True if the ERC721 action provider supports the network, false otherwise.
- transfer(wallet_provider, args)¶
Transfer an NFT (ERC721 token) 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.erc721.erc721_action_provider.erc721_action_provider()¶
Create an instance of the ERC721 action provider.
- Return type:
- Returns:
An instance of the ERC721 action provider.
coinbase_agentkit.action_providers.erc721.schemas module¶
Schemas for ERC721 action provider.
- class coinbase_agentkit.action_providers.erc721.schemas.GetBalanceSchema(**data)¶
Bases:
BaseModel
Input schema for get NFT (ERC721) balance action.
-
address:
str
|None
¶
-
contract_address:
str
¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
address:
- class coinbase_agentkit.action_providers.erc721.schemas.MintSchema(**data)¶
Bases:
BaseModel
Input schema for mint NFT (ERC721) action.
-
contract_address:
str
¶
-
destination:
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.erc721.schemas.TransferSchema(**data)¶
Bases:
BaseModel
Input schema for NFT (ERC721) transfer action.
-
contract_address:
str
¶
-
destination:
str
¶
-
from_address:
str
|None
¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
token_id:
str
¶
-
contract_address:
Module contents¶
ERC721 action provider for NFT interactions.
- class coinbase_agentkit.action_providers.erc721.Erc721ActionProvider¶
Bases:
ActionProvider
[EvmWalletProvider
]Action provider for ERC721 contract interactions.
- get_balance(wallet_provider, args)¶
Get the NFT balance for a given address and contract.
This function queries an ERC721 NFT contract to get the token balance for a specific address. It uses the standard ERC721 balanceOf function which returns the number of tokens owned by the given address for that NFT collection.
- Parameters:
wallet_provider (EvmWalletProvider) – The wallet provider to use for making the contract call
args (dict[str, Any]) –
The input arguments containing: - contract_address (str): The address of the ERC721 NFT contract to query - address (str, optional): The address to check NFT balance for. If not provided,
uses the wallet’s default address
- Returns:
- A message containing either:
The NFT balance details if successful
An error message if the balance check fails
- Return type:
str
- Raises:
Exception – If the contract call fails for any reason
- mint(wallet_provider, args)¶
Mint an NFT (ERC-721) to a specified 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
- supports_network(network)¶
Check if the ERC721 action provider supports the given network.
- Parameters:
network (
Network
) – The network to check.- Return type:
bool
- Returns:
True if the ERC721 action provider supports the network, false otherwise.
- transfer(wallet_provider, args)¶
Transfer an NFT (ERC721 token) 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.erc721.erc721_action_provider()¶
Create an instance of the ERC721 action provider.
- Return type:
- Returns:
An instance of the ERC721 action provider.