aergo_wallet

class aergo_wallet.wallet.AergoWallet(config_file_path: str, config_data: Dict[KT, VT] = None)

A wallet loads it’s private key from config.json and implements the functionality to transfer tokens to sidechains

config_data(*json_path, value: Union[str, int, List[T], Dict[KT, VT]] = None)

Get the value in nested dictionary at the end of json path if value is None, or set value at the end of the path.

deploy_token(payload_str: str, asset_name: str, total_supply: int, network_name: str, receiver: str = None, privkey_name: str = 'default', privkey_pwd: str = None) → str

Deploy a new standard token, store the address in config_data

finalize_transfer_mint(from_chain: str, to_chain: str, asset_name: str, receiver: str = None, lock_height: int = 0, privkey_name: str = 'default', privkey_pwd: str = None) → Tuple[str, str]

Finalize a transfer of assets to a sidechain by minting then after the lock is final and a new anchor was made. NOTE anybody can mint so sender is not necessary. The amount to mint is the difference between total deposit and already minted amount. Bridge tempo is taken from config_data

finalize_transfer_unlock(from_chain: str, to_chain: str, asset_name: str, receiver: str = None, burn_height: int = 0, privkey_name: str = 'default', privkey_pwd: str = None) → str

Finalize a transfer of assets from a sidechain by unlocking then after the burn is final and a new anchor was made. NOTE anybody can unlock so sender is not necessary. The amount to unlock is the difference between total burn and already unlocked amount. Bridge tempo is taken from config_data

get_aergo(network_name: str, privkey_name: str = 'default', privkey_pwd: str = None, skip_state: bool = False) → aergo.herapy.aergo.Aergo

Return aergo provider with new account created with priv_key

get_asset_address(asset_name: str, network_name: str, asset_origin_chain: str = None) → str

Get the address of a time in config_data given it’s name

get_balance(asset_name: str, network_name: str, asset_origin_chain: str = None, account_name: str = 'default', account_addr: str = None) → Tuple[int, str]

Get account name balance of asset_name on network_name, and specify asset_origin_chain for a pegged asset query,

get_bridge_tempo(from_chain: str, to_chain: str, aergo: aergo.herapy.aergo.Aergo = None, bridge_address: str = None, sync: bool = False) → Tuple[int, int]

Return the anchoring periode of from_chain onto to_chain and minimum finality time of from_chain. This information is queried from bridge_to.

get_mintable_balance(from_chain: str, to_chain: str, asset_name: str, account_name: str = 'default', account_addr: str = None) → Tuple[int, int]

Get the balance that has been locked on one side of the bridge and not yet minted on the other side Calculates the difference between the total amount deposited and total amount withdrawn. Set pending to true to include deposits than have not yet been anchored

get_unlockable_balance(from_chain: str, to_chain: str, asset_name: str, account_name: str = 'default', account_addr: str = None) → Tuple[int, int]

Get the balance that has been burnt on one side of the bridge and not yet unlocked on the other side Calculates the difference between the total amount deposited and total amount withdrawn. Set pending to true to include deposits than have not yet been anchored

initiate_transfer_burn(from_chain: str, to_chain: str, asset_name: str, amount: int, receiver: str = None, privkey_name: str = 'default', privkey_pwd: str = None) → Tuple[int, str]

Initiate a transfer from a sidechain by burning the assets.

initiate_transfer_lock(from_chain: str, to_chain: str, asset_name: str, amount: int, receiver: str = None, privkey_name: str = 'default', privkey_pwd: str = None) → Tuple[int, str]

Initiate a transfer to a sidechain by locking the asset.

register_account(account_name: str, exported_privkey: str, password: str = None, addr: str = None) → str

Register and exported account to config.json

register_asset(asset_name: str, origin_chain_name: str, addr_on_origin_chain: str, pegged_chain_name: str = None, addr_on_pegged_chain: str = None) → None

Register an existing asset to config.json

transfer(value: int, to: str, asset_name: str, network_name: str, asset_origin_chain: str = None, privkey_name: str = 'default', privkey_pwd: str = None) → str

Transfer aer or tokens on network_name and specify asset_origin_chain for transfers of pegged assets.

transfer_from_sidechain(from_chain: str, to_chain: str, asset_name: str, amount: int, receiver: str = None, privkey_name: str = 'default', privkey_pwd: str = None) → None

Transfer assets from from_chain to to_chain The asset being transfered back to the to_chain native chain should be a minted asset on the sidechain.

transfer_to_sidechain(from_chain: str, to_chain: str, asset_name: str, amount: int, receiver: str = None, privkey_name: str = 'default', privkey_pwd: str = None) → None

Transfer assets from from_chain to to_chain. The asset being transfered to the to_chain sidechain should be native of from_chain

aergo_wallet.transfer_to_sidechain.build_lock_proof(aergo_from: aergo.herapy.aergo.Aergo, aergo_to: aergo.herapy.aergo.Aergo, receiver: str, bridge_from: str, bridge_to: str, lock_height: int, token_origin: str) → aergo.herapy.obj.sc_state.SCState

Check the last anchored root includes the lock and build a lock proof for that root

aergo_wallet.transfer_to_sidechain.lock(aergo_from: aergo.herapy.aergo.Aergo, bridge_from: str, receiver: str, value: int, asset: str, gas_limit: int, gas_price: int) → Tuple[int, str]

Lock can be called to lock aer or tokens. it supports delegated transfers when tx broadcaster is not the same as the token owner

aergo_wallet.transfer_to_sidechain.mint(aergo_to: aergo.herapy.aergo.Aergo, receiver: str, lock_proof: aergo.herapy.obj.sc_state.SCState, token_origin: str, bridge_to: str, gas_limit: int, gas_price: int) → Tuple[str, str]

Mint the receiver’s deposit balance on aergo_to.

aergo_wallet.transfer_from_sidechain.build_burn_proof(aergo_from: aergo.herapy.aergo.Aergo, aergo_to: aergo.herapy.aergo.Aergo, receiver: str, bridge_from: str, bridge_to: str, burn_height: int, token_origin: str) → aergo.herapy.obj.sc_state.SCState

Check the last anchored root includes the burn and build a burn proof for that root

aergo_wallet.transfer_from_sidechain.burn(aergo_from: aergo.herapy.aergo.Aergo, bridge_from: str, receiver: str, value: int, token_pegged: str, gas_limit: int, gas_price: int) → Tuple[int, str]

Burn a minted token on a sidechain.

aergo_wallet.transfer_from_sidechain.unlock(aergo_to: aergo.herapy.aergo.Aergo, receiver: str, burn_proof: aergo.herapy.obj.sc_state.SCState, token_origin: str, bridge_to: str, gas_limit: int, gas_price: int) → str

Unlock the receiver’s deposit balance on aergo_to.

aergo_wallet.token_deployer.deploy_token(payload_str: str, aergo: aergo.herapy.aergo.Aergo, receiver: str, total_supply: int, fee_limit: int, fee_price: int) → str

Deploy a token contract payload and give the total supply to the deployer

aergo_wallet.wallet_utils.build_deposit_proof(aergo_from: aergo.herapy.aergo.Aergo, aergo_to: aergo.herapy.aergo.Aergo, receiver: str, bridge_from: str, bridge_to: str, deposit_height: int, token_origin: str, key_word: str) → aergo.herapy.obj.sc_state.SCState

Check the last anchored root includes the lock and build a lock proof for that root

aergo_wallet.wallet_utils.get_balance(account_addr: str, asset_addr: str, aergo: aergo.herapy.aergo.Aergo) → int

Get an account or the default wallet balance of Aer or any token on a given network.

aergo_wallet.wallet_utils.transfer(value: int, to: str, asset_addr: str, aergo: aergo.herapy.aergo.Aergo, sender: str, fee_limit: int, fee_price: int) → str

Support 3 types of transfers : simple aer transfers, token transfer, and signed token transfers (token owner != tx signer)

exception aergo_wallet.exceptions.InsufficientBalanceError
exception aergo_wallet.exceptions.InvalidArgumentsError
exception aergo_wallet.exceptions.InvalidMerkleProofError
exception aergo_wallet.exceptions.TxError
exception aergo_wallet.exceptions.UnknownContractError