aea.contracts.base
The base contract.
Contract Objects
class Contract(Component)
Abstract definition of a contract.
__
init__
| __init__(contract_config: ContractConfig, **kwargs: Any) -> None
Initialize the contract.
Arguments:
contract_config
: the contract configurations.
id
| @property
| id() -> PublicId
Get the name.
configuration
| @property
| configuration() -> ContractConfig
Get the configuration.
get_
instance
| @classmethod
| get_instance(cls, ledger_api: LedgerApi, contract_address: Optional[str] = None) -> Any
Get the instance.
Arguments:
ledger_api
: the ledger api we are using.contract_address
: the contract address.
Returns:
the contract instance
from_
dir
| @classmethod
| from_dir(cls, directory: str, **kwargs: Any) -> "Contract"
Load the protocol from a directory.
Arguments:
directory
: the directory to the skill package.
Returns:
the contract object.
from_
config
| @classmethod
| from_config(cls, configuration: ContractConfig, **kwargs: Any) -> "Contract"
Load contract from configuration.
Arguments:
configuration
: the contract configuration.
Returns:
the contract object.
get_
deploy_
transaction
| @classmethod
| get_deploy_transaction(cls, ledger_api: LedgerApi, deployer_address: str, **kwargs: Any) -> Optional[JSONLike]
Handler method for the 'GET_DEPLOY_TRANSACTION' requests.
Implement this method in the sub class if you want to handle the contract requests manually.
Arguments:
ledger_api
: the ledger apis.deployer_address
: The address that will deploy the contract.kwargs
: keyword arguments.
Returns:
the tx
get_
raw_
transaction
| @classmethod
| get_raw_transaction(cls, ledger_api: LedgerApi, contract_address: str, **kwargs: Any) -> Optional[JSONLike]
Handler method for the 'GET_RAW_TRANSACTION' requests.
Implement this method in the sub class if you want to handle the contract requests manually.
Arguments:
ledger_api
: the ledger apis.contract_address
: the contract address.
Returns:
the tx
get_
raw_
message
| @classmethod
| get_raw_message(cls, ledger_api: LedgerApi, contract_address: str, **kwargs: Any) -> Optional[bytes]
Handler method for the 'GET_RAW_MESSAGE' requests.
Implement this method in the sub class if you want to handle the contract requests manually.
Arguments:
ledger_api
: the ledger apis.contract_address
: the contract address.
Returns:
the tx
get_
state
| @classmethod
| get_state(cls, ledger_api: LedgerApi, contract_address: str, **kwargs: Any) -> Optional[JSONLike]
Handler method for the 'GET_STATE' requests.
Implement this method in the sub class if you want to handle the contract requests manually.
Arguments:
ledger_api
: the ledger apis.contract_address
: the contract address.
Returns:
the tx