diff --git a/HISTORY.md b/HISTORY.md index e25fc696f4..47297f7a3d 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,21 @@ # Release History +## 0.11.2 (2020-03-17) + +- Fixes a package import issue +- Fixes an issue where `AgentLoop` did not teardown properly under certain conditions +- Fixes a bug in testing tools +- Fixes a bug where plugins are not loaded after installation in `MultiAgentManager` +- Adds unit tests for weather, thermometer and car park skills +- Fixes a missing dependency in Windows +- Improves SOEF connections' error handling +- Fixes bug in ML skills and adds unit tests +- Adds script to bump plugin versions +- Adds gas price strategy support in `aea-ledger-ethereum` plugin +- Adds CLI plugin for IPFS interactions (add/get) +- Adds support for CLI plugins to framework +- Multiple additional tests and test stability fixes + ## 0.11.1 (2020-03-06) - Bumps `aiohttp` to `>=3.7.4` to address a CVE affecting `http_server`, `http_client` and `webhook` connections diff --git a/aea/__version__.py b/aea/__version__.py index 9ec6f4d302..bda252e5cc 100644 --- a/aea/__version__.py +++ b/aea/__version__.py @@ -22,7 +22,7 @@ __title__ = "aea" __description__ = "Autonomous Economic Agent framework" __url__ = "https://github.com/fetchai/agents-aea.git" -__version__ = "0.11.1" +__version__ = "0.11.2" __author__ = "Fetch.AI Limited" __license__ = "Apache-2.0" __copyright__ = "2019 Fetch.AI Limited" diff --git a/aea/multiplexer.py b/aea/multiplexer.py index 1817778b95..eb2c0ef1e3 100644 --- a/aea/multiplexer.py +++ b/aea/multiplexer.py @@ -581,6 +581,7 @@ def _get_connection_id_from_envelope( :param envelope_protocol_id: the protocol id of the message contained in the envelope :return: public id if found """ + self.logger.debug(f"Routing envelope: {envelope}") # component to component messages are routed by their component id if envelope.is_component_to_component_message: connection_id = envelope.to_as_public_id diff --git a/deploy-image/Dockerfile b/deploy-image/Dockerfile index ead0d10851..665f3e773e 100644 --- a/deploy-image/Dockerfile +++ b/deploy-image/Dockerfile @@ -13,7 +13,7 @@ ENV PYTHONPATH "$PYTHONPATH:/usr/lib/python3.7/site-packages" RUN apk add --no-cache go RUN pip install --upgrade pip -RUN pip install --upgrade --force-reinstall aea[all]==0.11.1 +RUN pip install --upgrade --force-reinstall aea[all]==0.11.2 # COPY ./packages /home/packages # enable to add packages dir WORKDIR home diff --git a/deploy-image/docker-env.sh b/deploy-image/docker-env.sh index e713a547e7..2eebba1182 100755 --- a/deploy-image/docker-env.sh +++ b/deploy-image/docker-env.sh @@ -1,7 +1,7 @@ #!/bin/bash # Swap the following lines if you want to work with 'latest' -DOCKER_IMAGE_TAG=fetchai/aea-deploy:0.11.1 +DOCKER_IMAGE_TAG=fetchai/aea-deploy:0.11.2 # DOCKER_IMAGE_TAG=fetchai/aea-deploy:latest DOCKER_BUILD_CONTEXT_DIR=.. diff --git a/develop-image/docker-env.sh b/develop-image/docker-env.sh index 7fce1d7acb..e94fd6c10d 100755 --- a/develop-image/docker-env.sh +++ b/develop-image/docker-env.sh @@ -1,7 +1,7 @@ #!/bin/bash # Swap the following lines if you want to work with 'latest' -DOCKER_IMAGE_TAG=fetchai/aea-develop:0.11.1 +DOCKER_IMAGE_TAG=fetchai/aea-develop:0.11.2 # DOCKER_IMAGE_TAG=aea-develop:latest DOCKER_BUILD_CONTEXT_DIR=.. diff --git a/docs/api/crypto/plugin.md b/docs/api/crypto/plugin.md index 77b7813c63..ccad079091 100644 --- a/docs/api/crypto/plugin.md +++ b/docs/api/crypto/plugin.md @@ -70,7 +70,7 @@ Get the entry point path. #### load`_`all`_`plugins ```python -load_all_plugins() -> None +load_all_plugins(is_raising_exception: bool = True) -> None ``` Load all plugins. diff --git a/docs/api/helpers/async_utils.md b/docs/api/helpers/async_utils.md index 9e29d9c574..0fb25d8e91 100644 --- a/docs/api/helpers/async_utils.md +++ b/docs/api/helpers/async_utils.md @@ -271,59 +271,6 @@ Run a coroutine inside the event loop. Stop event loop in thread. - -## ItemGetter Objects - -```python -class ItemGetter() -``` - -Virtual queue like object to get items from getters function. - - -#### `__`init`__` - -```python - | __init__(getters: List[Callable]) -> None -``` - -Init ItemGetter. - -**Arguments**: - -- `getters`: List of couroutines to be awaited. - - -#### get - -```python - | async get() -> Any -``` - -Get item. - - -## HandlerItemGetter Objects - -```python -class HandlerItemGetter(ItemGetter) -``` - -ItemGetter with handler passed. - - -#### `__`init`__` - -```python - | __init__(getters: List[Tuple[Callable[[Any], None], Callable]]) -> None -``` - -Init HandlerItemGetter. - -**Arguments**: - -- `getters`: List of tuples of handler and couroutine to be awaiteed for an item. - ## Runnable Objects diff --git a/docs/api/plugins/aea_cli_ipfs/core.md b/docs/api/plugins/aea_cli_ipfs/core.md new file mode 100644 index 0000000000..b47f8d5a48 --- /dev/null +++ b/docs/api/plugins/aea_cli_ipfs/core.md @@ -0,0 +1,80 @@ + +# plugins.aea-cli-ipfs.aea`_`cli`_`ipfs.core + +Core components for `ipfs cli command`. + + +#### ipfs + +```python +@click.group() +@click.pass_context +ipfs(click_context: click.Context) -> None +``` + +IPFS Commands + + +#### process`_`result + +```python +@ipfs.resultcallback() +@click.pass_context +process_result(click_context: click.Context, *_: Any) -> None +``` + +Tear down command group. + + +#### add + +```python +@ipfs.command() +@click.argument( + "dir_path", + type=click.Path( + exists=True, dir_okay=True, file_okay=False, resolve_path=True, readable=True + ), + required=False, +) +@click.option("-p", "--publish", is_flag=True) +@click.option("--no-pin", is_flag=True) +@click.pass_context +add(click_context: click.Context, dir_path: Optional[str], publish: bool = False, no_pin: bool = False) -> None +``` + +Add directory to ipfs, if not directory specified the current one will be added. + + +#### remove + +```python +@ipfs.command() +@click.argument( + "hash_", metavar="hash", type=str, required=True, +) +@click.pass_context +remove(click_context: click.Context, hash_: str) -> None +``` + +Remove a directory from ipfs by it's hash. + + +#### download + +```python +@ipfs.command() +@click.argument( + "hash_", metavar="hash", type=str, required=True, +) +@click.argument( + "target_dir", + type=click.Path(dir_okay=True, file_okay=False, resolve_path=True), + required=False, +) +@click.pass_context +download(click_context: click.Context, hash_: str, target_dir: Optional[str]) -> None +``` + +Download directory by it's hash, if not target directory specified will use current one. + diff --git a/docs/api/plugins/aea_cli_ipfs/ipfs_utils.md b/docs/api/plugins/aea_cli_ipfs/ipfs_utils.md new file mode 100644 index 0000000000..7d98a79314 --- /dev/null +++ b/docs/api/plugins/aea_cli_ipfs/ipfs_utils.md @@ -0,0 +1,203 @@ + +# plugins.aea-cli-ipfs.aea`_`cli`_`ipfs.ipfs`_`utils + +Ipfs utils for `ipfs cli command`. + + +## IPFSDaemon Objects + +```python +class IPFSDaemon() +``` + +Set up the IPFS daemon. + +**Raises**: + +- `Exception`: if IPFS is not installed. + + +#### `__`init`__` + +```python + | __init__() -> None +``` + +Initialise IPFS daemon. + + +#### is`_`started + +```python + | is_started() -> bool +``` + +Check daemon was started. + + +#### start + +```python + | start() -> None +``` + +Run the ipfs daemon. + + +#### stop + +```python + | stop() -> None +``` + +Terminate the ipfs daemon. + + +## BaseIPFSToolException Objects + +```python +class BaseIPFSToolException(Exception) +``` + +Base ipfs tool exception. + + +## RemoveError Objects + +```python +class RemoveError(BaseIPFSToolException) +``` + +Exception on remove. + + +## PublishError Objects + +```python +class PublishError(BaseIPFSToolException) +``` + +Exception on publish. + + +## NodeError Objects + +```python +class NodeError(BaseIPFSToolException) +``` + +Exception for node connection check. + + +## DownloadError Objects + +```python +class DownloadError(BaseIPFSToolException) +``` + +Exception on download failed. + + +## IPFSTool Objects + +```python +class IPFSTool() +``` + +IPFS tool to add, publish, remove, download directories. + + +#### `__`init`__` + +```python + | __init__(client_options: Optional[Dict] = None) +``` + +Init tool. + +**Arguments**: + +- `client_options`: dict, options for ipfshttpclient instance. + + +#### add + +```python + | add(dir_path: str, pin: bool = True) -> Tuple[str, str, List] +``` + +Add directory to ipfs. + +It wraps into directory. + +**Arguments**: + +- `dir_path`: str, path to dir to publish +- `pin`: bool, pin object or not + +**Returns**: + +dir name published, hash, list of items processed + + +#### remove + +```python + | remove(hash_id: str) -> Dict +``` + +Remove dir added by it's hash. + +**Arguments**: + +- `hash_id`: str. hash of dir to remove + +**Returns**: + +dict with unlinked items. + + +#### download + +```python + | download(hash_id: str, target_dir: str, fix_path: bool = True) -> None +``` + +Download dir by it's hash. + +**Arguments**: + +- `hash_id`: str. hash od fir to download +- `target_dir`: str. directory to place downlaoded +- `fix_path`: boo. default True. on download dont wrap result in to hash_id dirrectory. + +**Returns**: + +None + + +#### publish + +```python + | publish(hash_id: str) -> Dict +``` + +Publish directory by it's hash id. + +**Arguments**: + +- `hash_id`: hash of the directory to publish. + +**Returns**: + +dict of names it was publish for. + + +#### chec`_`ipfs`_`node`_`running + +```python + | chec_ipfs_node_running() -> None +``` + +Check ipfs node running. + diff --git a/docs/api/plugins/aea_ledger_ethereum/ethereum.md b/docs/api/plugins/aea_ledger_ethereum/ethereum.md index 16f6db449a..3b55f94977 100644 --- a/docs/api/plugins/aea_ledger_ethereum/ethereum.md +++ b/docs/api/plugins/aea_ledger_ethereum/ethereum.md @@ -3,6 +3,15 @@ Ethereum module wrapping the public and private key cryptography and ledger api. + +#### get`_`gas`_`price`_`strategy + +```python +get_gas_price_strategy(gas_price_strategy: Optional[str] = None, api_key: Optional[str] = None) -> Callable[[Web3, TxParams], Wei] +``` + +Get the gas price strategy. + ## SignedTransactionTranslator Objects @@ -421,7 +430,7 @@ Call a specified function on the ledger API. #### get`_`transfer`_`transaction ```python - | get_transfer_transaction(sender_address: Address, destination_address: Address, amount: int, tx_fee: int, tx_nonce: str, chain_id: Optional[int] = None, gas_price: Optional[str] = None, **kwargs: Any, ,) -> Optional[JSONLike] + | get_transfer_transaction(sender_address: Address, destination_address: Address, amount: int, tx_fee: int, tx_nonce: str, chain_id: Optional[int] = None, gas_price: Optional[str] = None, gas_price_strategy: Optional[str] = None, **kwargs: Any, ,) -> Optional[JSONLike] ``` Submit a transfer transaction to the ledger. @@ -430,11 +439,12 @@ Submit a transfer transaction to the ledger. - `sender_address`: the sender address of the payer. - `destination_address`: the destination address of the payee. -- `amount`: the amount of wealth to be transferred. -- `tx_fee`: the transaction fee. -- `tx_nonce`: verifies the authenticity of the tx -- `chain_id`: the Chain ID of the Ethereum transaction. Default is 3 (i.e. ropsten; mainnet has 1). -- `gas_price`: the gas price +- `amount`: the amount of wealth to be transferred (in Wei). +- `tx_fee`: the transaction fee (gas) to be used (in Wei). +- `tx_nonce`: verifies the authenticity of the tx. +- `chain_id`: the Chain ID of the Ethereum transaction. +- `gas_price`: the gas price (in Wei) +- `gas_price_strategy`: the gas price strategy to be used. **Returns**: @@ -530,7 +540,7 @@ the contract instance #### get`_`deploy`_`transaction ```python - | get_deploy_transaction(contract_interface: Dict[str, str], deployer_address: Address, value: int = 0, gas: int = 0, **kwargs: Any, ,) -> Optional[JSONLike] + | get_deploy_transaction(contract_interface: Dict[str, str], deployer_address: Address, value: int = 0, gas: int = 0, gas_price: Optional[str] = None, gas_price_strategy: Optional[str] = None, **kwargs: Any, ,) -> Optional[JSONLike] ``` Get the transaction to deploy the smart contract. @@ -539,8 +549,10 @@ Get the transaction to deploy the smart contract. - `contract_interface`: the contract interface. - `deployer_address`: The address that will deploy the contract. -- `value`: value to send to contract (ETH in Wei) -- `gas`: the gas to be used +- `value`: value to send to contract (in Wei) +- `gas`: the gas to be used (in Wei) +- `gas_price`: the gas price (in Wei) +- `gas_price_strategy`: the gas price strategy to be used. :returns tx: the transaction dictionary. diff --git a/docs/api/skills/tasks.md b/docs/api/skills/tasks.md index d6b308ff42..2cd903b9c5 100644 --- a/docs/api/skills/tasks.md +++ b/docs/api/skills/tasks.md @@ -25,7 +25,7 @@ Initialize a task. #### `__`call`__` ```python - | __call__(*args: Any, **kwargs: Any) -> "Task" + | __call__(*args: Any, **kwargs: Any) -> Any ``` Execute the task. @@ -84,7 +84,7 @@ None ```python | @abstractmethod - | execute(*args: Any, **kwargs: Any) -> None + | execute(*args: Any, **kwargs: Any) -> Any ``` Run the task logic. @@ -135,7 +135,7 @@ A Task manager. #### `__`init`__` ```python - | __init__(nb_workers: int = 2, is_lazy_pool_start: bool = True, logger: Optional[logging.Logger] = None) -> None + | __init__(nb_workers: int = 2, is_lazy_pool_start: bool = True, logger: Optional[logging.Logger] = None, pool_mode: str = "multithread") -> None ``` Initialize the task manager. @@ -144,6 +144,7 @@ Initialize the task manager. - `nb_workers`: the number of worker processes. - `is_lazy_pool_start`: option to postpone pool creation till the first enqueue_task called. +- `pool_mode`: str. multithread or multiprocess #### is`_`started diff --git a/docs/aries-cloud-agent-demo.md b/docs/aries-cloud-agent-demo.md index 1e6b48dda0..9ecbf3fe0c 100644 --- a/docs/aries-cloud-agent-demo.md +++ b/docs/aries-cloud-agent-demo.md @@ -180,7 +180,7 @@ Now you can create **Alice_AEA** and **Faber_AEA** in terminals 3 and 4 respecti In the third terminal, fetch **Alice_AEA** and move into its project folder: ``` bash -aea fetch fetchai/aries_alice:0.23.0 +aea fetch fetchai/aries_alice:0.24.0 cd aries_alice ``` @@ -191,8 +191,8 @@ The following steps create **Alice_AEA** from scratch: ``` bash aea create aries_alice cd aries_alice -aea add connection fetchai/p2p_libp2p:0.17.0 -aea add connection fetchai/soef:0.18.0 +aea add connection fetchai/p2p_libp2p:0.18.0 +aea add connection fetchai/soef:0.19.0 aea add connection fetchai/http_client:0.19.0 aea add connection fetchai/webhook:0.15.0 aea add skill fetchai/aries_alice:0.18.0 @@ -257,14 +257,14 @@ Finally run **Alice_AEA**: aea run ``` -Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of the address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.17.0 -u public_uri` to retrieve the address.) We will refer to this as **Alice_AEA's P2P address**. +Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of the address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.18.0 -u public_uri` to retrieve the address.) We will refer to this as **Alice_AEA's P2P address**. ### Faber_AEA In the fourth terminal, fetch **Faber_AEA** and move into its project folder: ``` bash -aea fetch fetchai/aries_faber:0.23.0 +aea fetch fetchai/aries_faber:0.24.0 cd aries_faber ``` @@ -275,8 +275,8 @@ The following steps create **Faber_AEA** from scratch: ``` bash aea create aries_faber cd aries_faber -aea add connection fetchai/p2p_libp2p:0.17.0 -aea add connection fetchai/soef:0.18.0 +aea add connection fetchai/p2p_libp2p:0.18.0 +aea add connection fetchai/soef:0.19.0 aea add connection fetchai/http_client:0.19.0 aea add connection fetchai/webhook:0.15.0 aea add skill fetchai/aries_faber:0.17.0 diff --git a/docs/car-park-skills.md b/docs/car-park-skills.md index fc91a6d6b0..c1c097436d 100644 --- a/docs/car-park-skills.md +++ b/docs/car-park-skills.md @@ -55,7 +55,7 @@ Follow the Preliminaries and =0.1.0"} + "aea-ledger-fetchai": {"version": "<0.3.0,>=0.2.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.17.0 +aea config set agent.default_connection fetchai/p2p_libp2p:0.18.0 aea config set --type dict agent.default_routing \ '{ - "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.14.0", - "fetchai/oef_search:0.14.0": "fetchai/soef:0.18.0" + "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.15.0", + "fetchai/oef_search:0.14.0": "fetchai/soef:0.19.0" }' aea install aea build @@ -93,7 +93,7 @@ aea build Then, fetch the car data client AEA: ``` bash -aea fetch fetchai/car_data_buyer:0.24.0 +aea fetch fetchai/car_data_buyer:0.25.0 cd car_data_buyer aea install aea build @@ -106,19 +106,19 @@ The following steps create the car data client from scratch: ``` bash aea create car_data_buyer cd car_data_buyer -aea add connection fetchai/p2p_libp2p:0.17.0 -aea add connection fetchai/soef:0.18.0 -aea add connection fetchai/ledger:0.14.0 -aea add skill fetchai/carpark_client:0.21.0 +aea add connection fetchai/p2p_libp2p:0.18.0 +aea add connection fetchai/soef:0.19.0 +aea add connection fetchai/ledger:0.15.0 +aea add skill fetchai/carpark_client:0.22.0 aea config set --type dict agent.dependencies \ '{ - "aea-ledger-fetchai": {"version": "<0.2.0,>=0.1.0"} + "aea-ledger-fetchai": {"version": "<0.3.0,>=0.2.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.17.0 +aea config set agent.default_connection fetchai/p2p_libp2p:0.18.0 aea config set --type dict agent.default_routing \ '{ - "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.14.0", - "fetchai/oef_search:0.14.0": "fetchai/soef:0.18.0" + "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.15.0", + "fetchai/oef_search:0.14.0": "fetchai/soef:0.19.0" }' aea install aea build @@ -183,7 +183,7 @@ First, run the car data seller AEA: aea run ``` -Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of the address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.17.0 -u public_uri` to retrieve the address.) +Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of the address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.18.0 -u public_uri` to retrieve the address.) This is the entry peer address for the local agent communication network created by the car data seller. Then, in the car data buyer, run this command (replace `SOME_ADDRESS` with the correct value as described above): diff --git a/docs/cli-vs-programmatic-aeas.md b/docs/cli-vs-programmatic-aeas.md index 46f4500eca..1cd191c2eb 100644 --- a/docs/cli-vs-programmatic-aeas.md +++ b/docs/cli-vs-programmatic-aeas.md @@ -33,7 +33,7 @@ If you want to create the weather station AEA step by step you can follow this g Fetch the weather station AEA with the following command : ``` bash -aea fetch fetchai/weather_station:0.23.0 +aea fetch fetchai/weather_station:0.24.0 cd weather_station aea install aea build diff --git a/docs/config.md b/docs/config.md index 70d98c17dd..5a4cbb9e38 100644 --- a/docs/config.md +++ b/docs/config.md @@ -27,7 +27,7 @@ protocols: # The list of protocol public id - fetchai/default:0.13.0 skills: # The list of skill public ids the AEA project depends on (each public id must satisfy PUBLIC_ID_REGEX). - fetchai/error:0.13.0 -default_connection: fetchai/p2p_libp2p:0.17.0 # The default connection used for envelopes sent by the AEA (must satisfy PUBLIC_ID_REGEX). +default_connection: fetchai/p2p_libp2p:0.18.0 # The default connection used for envelopes sent by the AEA (must satisfy PUBLIC_ID_REGEX). default_ledger: fetchai # The default ledger identifier the AEA project uses (must satisfy LEDGER_ID_REGEX) default_routing: {} # The default routing scheme applied to envelopes sent by the AEA, it maps from protocol public ids to connection public ids (both keys and values must satisfy PUBLIC_ID_REGEX) connection_private_key_paths: # The private key paths the AEA project uses for its connections (keys must satisfy LEDGER_ID_REGEX, values must be file paths) diff --git a/docs/connect-a-frontend.md b/docs/connect-a-frontend.md index 16c6cf9dd2..7f1f50dfe8 100644 --- a/docs/connect-a-frontend.md +++ b/docs/connect-a-frontend.md @@ -6,4 +6,4 @@ This page lays out two options for connecting a front-end to an AEA. The followi The first option is to create a `HTTP Server` connection that handles incoming requests from a REST API. In this scenario, the REST API communicates with the AEA and requests are handled by the `HTTP Server` connection package. The REST API should send CRUD requests to the `HTTP Server` connection (`fetchai/http_server:0.18.0`) which translates these into Envelopes to be consumed by the correct skill. ## Case 2 -The second option is to create a front-end comprising a stand-alone `Multiplexer` with a `P2P` connection (`fetchai/p2p_libp2p:0.17.0`). In this scenario the Agent Communication Network can be used to send Envelopes from the AEA to the front-end. \ No newline at end of file +The second option is to create a front-end comprising a stand-alone `Multiplexer` with a `P2P` connection (`fetchai/p2p_libp2p:0.18.0`). In this scenario the Agent Communication Network can be used to send Envelopes from the AEA to the front-end. \ No newline at end of file diff --git a/docs/contract.md b/docs/contract.md index d0fcc70036..2db6fc69a2 100644 --- a/docs/contract.md +++ b/docs/contract.md @@ -18,16 +18,16 @@ Interacting with contracts in almost all cases requires network access. Therefor Message flow for contract and ledger interactions -In particular, the `fetchai/ledger:0.14.0` connection can be used to execute contract related logic. The skills communicate with the `fetchai/ledger:0.14.0` connection via the `fetchai/contract_api:0.12.0` protocol. This protocol implements a request-response pattern to serve the four types of methods listed above: +In particular, the `fetchai/ledger:0.15.0` connection can be used to execute contract related logic. The skills communicate with the `fetchai/ledger:0.15.0` connection via the `fetchai/contract_api:0.12.0` protocol. This protocol implements a request-response pattern to serve the four types of methods listed above: -- the `get_deploy_transaction` message is used to request a deploy transaction for a specific contract. For instance, to request a deploy transaction for the deployment of the smart contract wrapped in the `fetchai/erc1155:0.17.0` package, we send the following message to the `fetchai/ledger:0.14.0`: +- the `get_deploy_transaction` message is used to request a deploy transaction for a specific contract. For instance, to request a deploy transaction for the deployment of the smart contract wrapped in the `fetchai/erc1155:0.18.0` package, we send the following message to the `fetchai/ledger:0.15.0`: ``` python contract_api_msg = ContractApiMessage( performative=ContractApiMessage.Performative.GET_DEPLOY_TRANSACTION, dialogue_reference=contract_api_dialogues.new_self_initiated_dialogue_reference(), ledger_id=strategy.ledger_id, - contract_id="fetchai/erc1155:0.17.0", + contract_id="fetchai/erc1155:0.18.0", callable="get_deploy_transaction", kwargs=ContractApiMessage.Kwargs( {"deployer_address": self.context.agent_address} @@ -37,22 +37,22 @@ contract_api_msg = ContractApiMessage( Any additional arguments needed by the contract's constructor method should be added to `kwargs`. -This message will be handled by the `fetchai/ledger:0.14.0` connection and then a `raw_transaction` message will be returned with the matching raw transaction. To send this transaction to the ledger for processing, we first sign the message with the decision maker and then send the signed transaction to the `fetchai/ledger:0.14.0` connection using the `fetchai/ledger_api:0.11.0` protocol. For details on how to implement the message handling, see the handlers in the `erc1155_deploy` skill. +This message will be handled by the `fetchai/ledger:0.15.0` connection and then a `raw_transaction` message will be returned with the matching raw transaction. To send this transaction to the ledger for processing, we first sign the message with the decision maker and then send the signed transaction to the `fetchai/ledger:0.15.0` connection using the `fetchai/ledger_api:0.11.0` protocol. For details on how to implement the message handling, see the handlers in the `erc1155_deploy` skill.

CosmWasm based smart contract deployments

-

When using CosmWasm based smart contracts two types of deployment transactions exist. The first transaction stores the code on the chain. The second transaction initialises the code. This way, the same contract code can be initialised many times.
Both the `store` and `init` messages use the `ContractApiMessage.Performative.GET_DEPLOY_TRANSACTION` performative. The ledger API automatically detects the type of transactions based on the provided keyword arguments. In particular, an `init` transaction requires the keyword arguments `code_id` (integer), `label` (string), `amount` (integer) and `init_msg` (JSON).
For an example look at the `fetchai/erc1155:0.17.0` package. +

When using CosmWasm based smart contracts two types of deployment transactions exist. The first transaction stores the code on the chain. The second transaction initialises the code. This way, the same contract code can be initialised many times.
Both the `store` and `init` messages use the `ContractApiMessage.Performative.GET_DEPLOY_TRANSACTION` performative. The ledger API automatically detects the type of transactions based on the provided keyword arguments. In particular, an `init` transaction requires the keyword arguments `code_id` (integer), `label` (string), `amount` (integer) and `init_msg` (JSON).
For an example look at the `fetchai/erc1155:0.18.0` package.

-- the `get_raw_transaction` message is used to request any transaction for a specific contract which changes state in the contract. For instance, to request a transaction for the creation of token in the deployed `erc1155` smart contract wrapped in the `fetchai/erc1155:0.17.0` package, we send the following message to the `fetchai/ledger:0.14.0`: +- the `get_raw_transaction` message is used to request any transaction for a specific contract which changes state in the contract. For instance, to request a transaction for the creation of token in the deployed `erc1155` smart contract wrapped in the `fetchai/erc1155:0.18.0` package, we send the following message to the `fetchai/ledger:0.15.0`: ``` python contract_api_msg = ContractApiMessage( performative=ContractApiMessage.Performative.GET_RAW_TRANSACTION, dialogue_reference=contract_api_dialogues.new_self_initiated_dialogue_reference(), ledger_id=strategy.ledger_id, - contract_id="fetchai/erc1155:0.17.0", + contract_id="fetchai/erc1155:0.18.0", contract_address=strategy.contract_address, callable="get_create_batch_transaction", kwargs=ContractApiMessage.Kwargs( @@ -64,16 +64,16 @@ contract_api_msg = ContractApiMessage( ) ``` -This message will be handled by the `fetchai/ledger:0.14.0` connection and then a `raw_transaction` message will be returned with the matching raw transaction. For this to be executed correctly, the `fetchai/erc1155:0.17.0` contract package needs to implement the `get_create_batch_transaction` method with the specified key word arguments (see example in *Deploy your own*, below). Similarly to above, to send this transaction to the ledger for processing, we first sign the message with the decision maker and then send the signed transaction to the `fetchai/ledger:0.14.0` connection using the `fetchai/ledger_api:0.11.0` protocol. +This message will be handled by the `fetchai/ledger:0.15.0` connection and then a `raw_transaction` message will be returned with the matching raw transaction. For this to be executed correctly, the `fetchai/erc1155:0.18.0` contract package needs to implement the `get_create_batch_transaction` method with the specified key word arguments (see example in *Deploy your own*, below). Similarly to above, to send this transaction to the ledger for processing, we first sign the message with the decision maker and then send the signed transaction to the `fetchai/ledger:0.15.0` connection using the `fetchai/ledger_api:0.11.0` protocol. -- the `get_raw_message` message is used to request any contract method call for a specific contract which does not change state in the contract. For instance, to request a call to get a hash from some input data in the deployed `erc1155` smart contract wrapped in the `fetchai/erc1155:0.17.0` package, we send the following message to the `fetchai/ledger:0.14.0`: +- the `get_raw_message` message is used to request any contract method call for a specific contract which does not change state in the contract. For instance, to request a call to get a hash from some input data in the deployed `erc1155` smart contract wrapped in the `fetchai/erc1155:0.18.0` package, we send the following message to the `fetchai/ledger:0.15.0`: ``` python contract_api_msg = ContractApiMessage( performative=ContractApiMessage.Performative.GET_RAW_MESSAGE, dialogue_reference=contract_api_dialogues.new_self_initiated_dialogue_reference(), ledger_id=strategy.ledger_id, - contract_id="fetchai/erc1155:0.17.0", + contract_id="fetchai/erc1155:0.18.0", contract_address=strategy.contract_address, callable="get_hash_single", kwargs=ContractApiMessage.Kwargs( @@ -89,17 +89,17 @@ contract_api_msg = ContractApiMessage( ), ) ``` -This message will be handled by the `fetchai/ledger:0.14.0` connection and then a `raw_message` message will be returned with the matching raw message. For this to be executed correctly, the `fetchai/erc1155:0.17.0` contract package needs to implement the `get_hash_single` method with the specified key word arguments. We can then send the raw message to the `fetchai/ledger:0.14.0` connection using the `fetchai/ledger_api:0.11.0` protocol. In this case, signing is not required. +This message will be handled by the `fetchai/ledger:0.15.0` connection and then a `raw_message` message will be returned with the matching raw message. For this to be executed correctly, the `fetchai/erc1155:0.18.0` contract package needs to implement the `get_hash_single` method with the specified key word arguments. We can then send the raw message to the `fetchai/ledger:0.15.0` connection using the `fetchai/ledger_api:0.11.0` protocol. In this case, signing is not required. -- the `get_state` message is used to request any contract method call to query state in the deployed contract. For instance, to request a call to get the balances in the deployed `erc1155` smart contract wrapped in the `fetchai/erc1155:0.17.0` package, we send the following message to the `fetchai/ledger:0.14.0`: +- the `get_state` message is used to request any contract method call to query state in the deployed contract. For instance, to request a call to get the balances in the deployed `erc1155` smart contract wrapped in the `fetchai/erc1155:0.18.0` package, we send the following message to the `fetchai/ledger:0.15.0`: ``` python contract_api_msg = ContractApiMessage( performative=ContractApiMessage.Performative.GET_STATE, dialogue_reference=contract_api_dialogues.new_self_initiated_dialogue_reference(), ledger_id=strategy.ledger_id, - contract_id="fetchai/erc1155:0.17.0", + contract_id="fetchai/erc1155:0.18.0", contract_address=strategy.contract_address, callable="get_balance", kwargs=ContractApiMessage.Kwargs( @@ -107,7 +107,7 @@ contract_api_msg = ContractApiMessage( ), ) ``` -This message will be handled by the `fetchai/ledger:0.14.0` connection and then a `state` message will be returned with the matching state. For this to be executed correctly, the `fetchai/erc1155:0.17.0` contract package needs to implement the `get_balance` method with the specified key word arguments. We can then send the raw message to the `fetchai/ledger:0.14.0` connection using the `fetchai/ledger_api:0.11.0` protocol. In this case, signing is not required. +This message will be handled by the `fetchai/ledger:0.15.0` connection and then a `state` message will be returned with the matching state. For this to be executed correctly, the `fetchai/erc1155:0.18.0` contract package needs to implement the `get_balance` method with the specified key word arguments. We can then send the raw message to the `fetchai/ledger:0.15.0` connection using the `fetchai/ledger_api:0.11.0` protocol. In this case, signing is not required. ## Developing your own @@ -180,6 +180,6 @@ class MyContract(Contract): tx = cls._try_estimate_gas(ledger_api, tx) return tx ``` -Above, we implement a method to create a transaction, in this case a transaction to create a batch of tokens. The method will be called by the framework, specifically the `fetchai/ledger:0.14.0` connection once it receives a message (see bullet point 2 above). The method first gets the latest transaction nonce of the `deployer_address`, then constructs the contract instance, then uses the instance to build the transaction and finally updates the gas on the transaction. +Above, we implement a method to create a transaction, in this case a transaction to create a batch of tokens. The method will be called by the framework, specifically the `fetchai/ledger:0.15.0` connection once it receives a message (see bullet point 2 above). The method first gets the latest transaction nonce of the `deployer_address`, then constructs the contract instance, then uses the instance to build the transaction and finally updates the gas on the transaction. -It helps to look at existing contract packages, like `fetchai/erc1155:0.17.0`, and skills using them, like `fetchai/erc1155_client:0.11.0` and `fetchai/erc1155_deploy:0.23.0`, for inspiration and guidance. +It helps to look at existing contract packages, like `fetchai/erc1155:0.18.0`, and skills using them, like `fetchai/erc1155_client:0.11.0` and `fetchai/erc1155_deploy:0.24.0`, for inspiration and guidance. diff --git a/docs/deployment.md b/docs/deployment.md index 2333f8befe..2c0bdb665c 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -28,7 +28,7 @@ Finally, we run it: docker run -it aea-deploy:latest ``` -This will run the `fetchai/my_first_aea:0.22.0` demo project. You can edit `entrypoint.sh` to run whatever project you would like. +This will run the `fetchai/my_first_aea:0.23.0` demo project. You can edit `entrypoint.sh` to run whatever project you would like. ## Deployment diff --git a/docs/erc1155-skills.md b/docs/erc1155-skills.md index bfd265b947..0747b32d31 100644 --- a/docs/erc1155-skills.md +++ b/docs/erc1155-skills.md @@ -25,7 +25,7 @@ The scope of this guide is demonstrating how you can deploy a smart contract and Fetch the AEA that will deploy the contract: ``` bash -aea fetch fetchai/erc1155_deployer:0.25.0 +aea fetch fetchai/erc1155_deployer:0.26.0 cd erc1155_deployer aea install aea build @@ -39,22 +39,22 @@ Create the AEA that will deploy the contract. ``` bash aea create erc1155_deployer cd erc1155_deployer -aea add connection fetchai/p2p_libp2p:0.17.0 -aea add connection fetchai/soef:0.18.0 -aea add connection fetchai/ledger:0.14.0 -aea add skill fetchai/erc1155_deploy:0.23.0 +aea add connection fetchai/p2p_libp2p:0.18.0 +aea add connection fetchai/soef:0.19.0 +aea add connection fetchai/ledger:0.15.0 +aea add skill fetchai/erc1155_deploy:0.24.0 aea config set --type dict agent.dependencies \ '{ - "aea-ledger-fetchai": {"version": "<0.2.0,>=0.1.0"}, - "aea-ledger-ethereum": {"version": "<0.2.0,>=0.1.0"}, - "aea-ledger-cosmos": {"version": "<0.2.0,>=0.1.0"} + "aea-ledger-fetchai": {"version": "<0.3.0,>=0.2.0"}, + "aea-ledger-ethereum": {"version": "<0.3.0,>=0.2.0"}, + "aea-ledger-cosmos": {"version": "<0.3.0,>=0.2.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.17.0 +aea config set agent.default_connection fetchai/p2p_libp2p:0.18.0 aea config set --type dict agent.default_routing \ '{ - "fetchai/contract_api:0.12.0": "fetchai/ledger:0.14.0", - "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.14.0", - "fetchai/oef_search:0.14.0": "fetchai/soef:0.18.0" + "fetchai/contract_api:0.12.0": "fetchai/ledger:0.15.0", + "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.15.0", + "fetchai/oef_search:0.14.0": "fetchai/soef:0.19.0" }' aea config set --type list vendor.fetchai.connections.p2p_libp2p.cert_requests \ '[{"identifier": "acn", "ledger_id": "ethereum", "not_after": "2022-01-01", "not_before": "2021-01-01", "public_key": "fetchai", "save_path": ".certs/conn_cert.txt"}]' @@ -95,7 +95,7 @@ aea issue-certificates In another terminal, fetch the client AEA which will receive some tokens from the deployer. ``` bash -aea fetch fetchai/erc1155_client:0.25.0 +aea fetch fetchai/erc1155_client:0.26.0 cd erc1155_client aea install aea build @@ -109,22 +109,22 @@ Create the AEA that will get some tokens from the deployer. ``` bash aea create erc1155_client cd erc1155_client -aea add connection fetchai/p2p_libp2p:0.17.0 -aea add connection fetchai/soef:0.18.0 -aea add connection fetchai/ledger:0.14.0 -aea add skill fetchai/erc1155_client:0.22.0 +aea add connection fetchai/p2p_libp2p:0.18.0 +aea add connection fetchai/soef:0.19.0 +aea add connection fetchai/ledger:0.15.0 +aea add skill fetchai/erc1155_client:0.23.0 aea config set --type dict agent.dependencies \ '{ - "aea-ledger-fetchai": {"version": "<0.2.0,>=0.1.0"}, - "aea-ledger-ethereum": {"version": "<0.2.0,>=0.1.0"}, - "aea-ledger-cosmos": {"version": "<0.2.0,>=0.1.0"} + "aea-ledger-fetchai": {"version": "<0.3.0,>=0.2.0"}, + "aea-ledger-ethereum": {"version": "<0.3.0,>=0.2.0"}, + "aea-ledger-cosmos": {"version": "<0.3.0,>=0.2.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.17.0 +aea config set agent.default_connection fetchai/p2p_libp2p:0.18.0 aea config set --type dict agent.default_routing \ '{ - "fetchai/contract_api:0.12.0": "fetchai/ledger:0.14.0", - "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.14.0", - "fetchai/oef_search:0.14.0": "fetchai/soef:0.18.0" + "fetchai/contract_api:0.12.0": "fetchai/ledger:0.15.0", + "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.15.0", + "fetchai/oef_search:0.14.0": "fetchai/soef:0.19.0" }' aea config set --type list vendor.fetchai.connections.p2p_libp2p.cert_requests \ '[{"identifier": "acn", "ledger_id": "ethereum", "not_after": "2022-01-01", "not_before": "2021-01-01", "public_key": "fetchai", "save_path": ".certs/conn_cert.txt"}]' @@ -199,7 +199,7 @@ aea run Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of this address. -Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.17.0 -u public_uri` to retrieve the address. The output will be something like `/dns4/127.0.0.1/tcp/9000/p2p/16Uiu2HAm2JPsUX1Su59YVDXJQizYkNSe8JCusqRpLeeTbvY76fE5`. +Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.18.0 -u public_uri` to retrieve the address. The output will be something like `/dns4/127.0.0.1/tcp/9000/p2p/16Uiu2HAm2JPsUX1Su59YVDXJQizYkNSe8JCusqRpLeeTbvY76fE5`. This is the entry peer address for the local agent communication network created by the deployer. diff --git a/docs/generic-skills-step-by-step.md b/docs/generic-skills-step-by-step.md index 75155106a1..43a437fc12 100644 --- a/docs/generic-skills-step-by-step.md +++ b/docs/generic-skills-step-by-step.md @@ -11,16 +11,16 @@ Follow the Preliminaries and Preliminaries and =0.1.0"} + "aea-ledger-fetchai": {"version": "<0.3.0,>=0.2.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.17.0 +aea config set agent.default_connection fetchai/p2p_libp2p:0.18.0 aea config set --type dict agent.default_routing \ '{ - "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.14.0", - "fetchai/oef_search:0.14.0": "fetchai/soef:0.18.0" + "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.15.0", + "fetchai/oef_search:0.14.0": "fetchai/soef:0.19.0" }' aea install aea build @@ -96,7 +96,7 @@ aea build Then, in another terminal fetch the buyer AEA: ``` bash -aea fetch fetchai/generic_buyer:0.21.0 --alias my_buyer_aea +aea fetch fetchai/generic_buyer:0.22.0 --alias my_buyer_aea cd my_buyer_aea aea install aea build @@ -109,19 +109,19 @@ The following steps create the buyer from scratch: ``` bash aea create my_buyer_aea cd my_buyer_aea -aea add connection fetchai/p2p_libp2p:0.17.0 -aea add connection fetchai/soef:0.18.0 -aea add connection fetchai/ledger:0.14.0 -aea add skill fetchai/generic_buyer:0.21.0 +aea add connection fetchai/p2p_libp2p:0.18.0 +aea add connection fetchai/soef:0.19.0 +aea add connection fetchai/ledger:0.15.0 +aea add skill fetchai/generic_buyer:0.22.0 aea config set --type dict agent.dependencies \ '{ - "aea-ledger-fetchai": {"version": "<0.2.0,>=0.1.0"} + "aea-ledger-fetchai": {"version": "<0.3.0,>=0.2.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.17.0 +aea config set agent.default_connection fetchai/p2p_libp2p:0.18.0 aea config set --type dict agent.default_routing \ '{ - "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.14.0", - "fetchai/oef_search:0.14.0": "fetchai/soef:0.18.0" + "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.15.0", + "fetchai/oef_search:0.14.0": "fetchai/soef:0.19.0" }' aea install aea build @@ -252,7 +252,7 @@ First, run the seller AEA: aea run ``` -Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of this address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.17.0 -u public_uri` to retrieve the address.) +Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of this address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.18.0 -u public_uri` to retrieve the address.) This is the entry peer address for the local agent communication network created by the seller. Then, configure the buyer to connect to this same local ACN by running the following command in the buyer terminal, replacing `SOME_ADDRESS` with the value you noted above: diff --git a/docs/gym-skill.md b/docs/gym-skill.md index 339629ef61..a46cfbb1dd 100644 --- a/docs/gym-skill.md +++ b/docs/gym-skill.md @@ -19,7 +19,7 @@ Follow the Preliminaries and GitHub. -The configurations can be specified for the `fetchai/ledger:0.14.0` connection. +The configurations can be specified for the `fetchai/ledger:0.15.0` connection. ## CosmWasm supporting chains diff --git a/docs/ml-skills.md b/docs/ml-skills.md index b804146eaa..716d0e59f9 100644 --- a/docs/ml-skills.md +++ b/docs/ml-skills.md @@ -62,7 +62,7 @@ Follow the Preliminaries and =0.1.0"} + "aea-ledger-fetchai": {"version": "<0.3.0,>=0.2.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.17.0 +aea config set agent.default_connection fetchai/p2p_libp2p:0.18.0 aea config set --type dict agent.default_routing \ '{ - "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.14.0", - "fetchai/oef_search:0.14.0": "fetchai/soef:0.18.0" + "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.15.0", + "fetchai/oef_search:0.14.0": "fetchai/soef:0.19.0" }' aea install aea build @@ -100,7 +100,7 @@ aea build Then, fetch the model trainer AEA: ``` bash -aea fetch fetchai/ml_model_trainer:0.24.0 +aea fetch fetchai/ml_model_trainer:0.25.0 cd ml_model_trainer aea install aea build @@ -113,19 +113,19 @@ The following steps create the model trainer from scratch: ``` bash aea create ml_model_trainer cd ml_model_trainer -aea add connection fetchai/p2p_libp2p:0.17.0 -aea add connection fetchai/soef:0.18.0 -aea add connection fetchai/ledger:0.14.0 -aea add skill fetchai/ml_train:0.22.0 +aea add connection fetchai/p2p_libp2p:0.18.0 +aea add connection fetchai/soef:0.19.0 +aea add connection fetchai/ledger:0.15.0 +aea add skill fetchai/ml_train:0.23.0 aea config set --type dict agent.dependencies \ '{ - "aea-ledger-fetchai": {"version": "<0.2.0,>=0.1.0"} + "aea-ledger-fetchai": {"version": "<0.3.0,>=0.2.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.17.0 +aea config set agent.default_connection fetchai/p2p_libp2p:0.18.0 aea config set --type dict agent.default_routing \ '{ - "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.14.0", - "fetchai/oef_search:0.14.0": "fetchai/soef:0.18.0" + "fetchai/ledger_api:0.11.0": "fetchai/ledger:0.15.0", + "fetchai/oef_search:0.14.0": "fetchai/soef:0.19.0" }' aea install aea build @@ -190,7 +190,7 @@ First, run the data provider AEA: aea run ``` -Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of the address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.17.0 -u public_uri` to retrieve the address.) +Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of the address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.18.0 -u public_uri` to retrieve the address.) This is the entry peer address for the local agent communication network created by the ML data provider.