aergo_cli¶
-
class
aergo_cli.main.MerkleBridgeCli(root_path: str = './')¶ CLI tool for interacting with the AergoWallet.
First choose an existing config file or create one from scratch. Once a config file is chosen, the CLI provides an interface to the AergoWallet and has the following features: - edit config file settings - transfer assets between networks - check status of transfers - check balances for each asset on each network
-
check_balances()¶ Iterate every registered wallet, network and asset and query balances.
-
check_withdrawable_balance()¶ Check the status of cross chain transfers.
-
create_config()¶ Create a new configuration file from scratch.
This tool registers 2 networks, bridge contracts, a private key for each network and bridge validators
-
edit_settings()¶ Menu for editing the config file of the currently loaded wallet
-
finalize_transfer()¶ Finalize a token transfer between 2 chains.
-
finalize_transfer_arguments(prompt_last_deposit=True)¶ Prompt the arguments needed to finalize a transfer.
The arguments can be taken from the pending transfers or inputed manually by users.
- Returns:
- List of transfer arguments
-
get_registered_assets(from_chain, to_chain)¶ Get the list of registered assets on each network.
-
get_registered_networks()¶ Get the list of networks registered in the wallet config.
-
initiate_transfer()¶ Initiate a new transfer of tokens between 2 networks.
-
load_config()¶ Load the configuration file from path and create a wallet object.
Menu for interacting with network.
Users can change settings, query balances, check pending transfers, execute cross chain transactions
-
prompt_bridge_networks()¶ Prompt user to choose 2 networks between registered networks.
-
prompt_commun_transfer_params()¶ Prompt the common parameters necessary for all transfers.
- Returns:
- List of transfer parameters : from_chain, to_chain, from_assets, to_assets, asset_name, receiver
-
prompt_signing_key(wallet_name)¶ Prompt user to select a private key.
- Note:
- Keys are displayed by name and should have been registered in wallet config.
-
prompt_transfer_networks()¶ Prompt user to choose 2 networks between registered bridged networks.
-
register_asset()¶ Register a new asset and it’s pegs on other networks in the wallet’s config.
-
register_bridge()¶ Register bridge contracts between 2 already defined networks.
-
register_key()¶ Register new key in wallet’s config.
-
register_network()¶ Register a new network in the wallet’s config.
-
register_new_validators()¶ Register new validators in the wallet’s config.
-
start()¶ Entry point of cli : load a wallet configuration file of create a new one
-
store_pending_transfers()¶ Record pending transfers in json file so they can be finalized later.
-
-
aergo_cli.utils.format_amount(num: str)¶ Format a float string to an integer with 18 decimals.
- Example:
- ‘2.3’ -> 2300000000000000000
-
aergo_cli.utils.promptYN(q, y, n)¶ Prompt user to procede with a transfer of not.
-
aergo_cli.utils.prompt_aergo_keystore()¶ Prompt user to register a new aergo keystore.
- Returns:
- name of the key
- address of the key
- keystore path
-
aergo_cli.utils.prompt_amount()¶ Prompt a number of tokens to transfer.
-
aergo_cli.utils.prompt_deposit_height()¶ Prompt the block number of deposit.
-
aergo_cli.utils.prompt_new_asset(networks)¶ Prompt user to input a new asset by providing the following: - asset name - origin network (where it was first issued) - address on origin network - other networks where the asset exists as a peg - address of pegs
-
aergo_cli.utils.prompt_new_bridge(net1, net2)¶ Prompt user to input bridge contracts and tempo.
For each contract on each bridged network, provide: - bridge contract address - anchoring periode - finality of the anchored chain
-
aergo_cli.utils.prompt_new_network()¶ Prompt user to input a new network’s information: - Name - IP/url
-
aergo_cli.utils.prompt_new_validators()¶ Prompt user to input validators
- Note:
- The list of validators must have the same order as defined in the bridge contracts
- Returns:
- List of ordered validators
-
aergo_cli.utils.prompt_number(message, formator=<class 'int'>)¶ Prompt a number.