Skip to content

plugins.aea-ledger-fetchai.aea_ledger_fetchai.fetchai

Fetchai module wrapping the public and private key cryptography and ledger api.

FetchAIHelper Objects

class FetchAIHelper(CosmosHelper)

Helper class usable as Mixin for FetchAIApi or as standalone class.

FetchAICrypto Objects

class FetchAICrypto(CosmosCrypto)

Class wrapping the Entity Generation from Fetch.AI ledger.

FetchAIApi Objects

class FetchAIApi(_CosmosApi, FetchAIHelper)

Class to interact with the Fetch ledger APIs.

__init__

def __init__(**kwargs: Any) -> None

Initialize the Fetch.ai ledger APIs.

contract_method_call

def contract_method_call(contract_instance: Any, method_name: str,
                         **method_args: Any) -> Optional[JSONLike]

Call a contract's method

Arguments:

  • contract_instance: the contract to use
  • method_name: the contract method to call
  • method_args: the contract call parameters

build_transaction

def build_transaction(contract_instance: Any,
                      method_name: str,
                      method_args: Optional[Dict],
                      tx_args: Optional[Dict],
                      raise_on_try: bool = False) -> Optional[JSONLike]

Prepare a transaction

Arguments:

  • contract_instance: the contract to use
  • method_name: the contract method to call
  • method_args: the contract parameters
  • tx_args: the transaction parameters
  • raise_on_try: whether the method will raise or log on error

get_transaction_transfer_logs

def get_transaction_transfer_logs(
        contract_instance: Any,
        tx_hash: str,
        target_address: Optional[str] = None) -> Optional[JSONLike]

Get all transfer events derived from a transaction.

Arguments:

  • contract_instance: the contract
  • tx_hash: the transaction hash
  • target_address: optional address to filter transfer events to just those that affect it

send_signed_transactions

def send_signed_transactions(signed_transactions: List[JSONLike],
                             raise_on_try: bool = False,
                             **kwargs: Any) -> Optional[List[str]]

Simulate and send a bundle of transactions.

This operation is not supported for fetchai.

Arguments:

  • signed_transactions: the raw signed transactions to bundle together and send.
  • raise_on_try: whether the method will raise or log on error.
  • kwargs: the keyword arguments.

filter_event

def filter_event(event: Any, match_single: Dict[str, Any],
                 match_any: Dict[str, Any], to_block: int, from_block: int,
                 batch_size: int, max_retries: int, reduce_factor: float,
                 timeout: int) -> Optional[JSONLike]

Filter an event using batching to avoid RPC timeouts.

Arguments:

  • event: the event to filter for.
  • match_single: the filter parameters with value checking against the event abi. It allows for defining a single match value.
  • match_any: the filter parameters with value checking against the event abi. It allows for defining multiple match values.
  • to_block: the block to which to filter.
  • from_block: the block from which to start filtering.
  • batch_size: the blocks' batch size of the filtering.
  • max_retries: the maximum number of retries.
  • reduce_factor: the percentage by which the batch size is reduced in case of a timeout.
  • timeout: a timeout in seconds to interrupt the operation in case the RPC request hangs.

FetchAIFaucetApi Objects

class FetchAIFaucetApi(CosmosFaucetApi)

Fetchai testnet faucet API.