Skip to content

autonomy.chain.config

On-chain tools configurations.

LedgerType Objects

class LedgerType(str, Enum)

Ledger type enum.

config_file

@property
def config_file() -> str

Config filename.

key_file

@property
def key_file() -> str

Key filename.

from_id

@classmethod
def from_id(cls, chain_id: int) -> "LedgerType"

Load from chain ID.

ChainType Objects

class ChainType(Enum)

Chain types.

id

@property
def id() -> Optional[int]

Chain ID

rpc

@property
def rpc() -> Optional[str]

RPC String

rpc_env_name

@property
def rpc_env_name() -> str

RPC Environment variable name

ledger_type

@property
def ledger_type() -> LedgerType

Ledger type.

from_string

@classmethod
def from_string(cls, chain: str) -> "Chain"

Load from string.

from_id

@classmethod
def from_id(cls, chain_id: int) -> "Chain"

Load from chain ID.

ContractConfig Objects

@dataclass
class ContractConfig()

Contract config class.

OnChainHelper Objects

class OnChainHelper()

On-chain interaction helper.

__init__

def __init__(chain_type: ChainType,
             key: Optional[Path] = None,
             password: Optional[str] = None,
             hwi: bool = False,
             timeout: Optional[float] = None,
             retries: Optional[int] = None,
             sleep: Optional[float] = None,
             dry_run: bool = False) -> None

Initialize object.

load_hwi_plugin

@staticmethod
def load_hwi_plugin() -> Type[LedgerApi]

Load HWI Plugin.

load_crypto

@staticmethod
def load_crypto(file: Path, password: Optional[str] = None) -> Crypto

Load crypto object.

get_ledger_and_crypto_objects

@classmethod
def get_ledger_and_crypto_objects(
        cls,
        chain_type: ChainType,
        key: Optional[Path] = None,
        password: Optional[str] = None,
        hwi: bool = False) -> Tuple[LedgerApi, Crypto]

Create ledger_api and crypto objects

check_required_environment_variables

def check_required_environment_variables(
        configs: Tuple[ContractConfig, ...]) -> None

Check for required enviroment variables when working with the custom chain.

DynamicContract Objects

class DynamicContract(Dict[ChainType, str])

Contract mapping for addresses from on-chain deployments.

__init__

def __init__(source_contract_id: PublicId, getter_method: str) -> None

Initialize the dynamic contract.

__getitem__

def __getitem__(chain: ChainType) -> str

Get address for given chain.

ChainConfig Objects

@dataclass
class ChainConfig()

Chain config

ChainConfigs Objects

class ChainConfigs()

Name space for chain configs.

get

@classmethod
def get(cls, chain_type: ChainType) -> ChainConfig

Return chain config for given chain type.

get_rpc_env_var

@classmethod
def get_rpc_env_var(cls, chain_type: ChainType) -> Optional[str]

Return chain config for given chain type.

ContractConfigs Objects

class ContractConfigs()

A namespace for contract configs.

get

@classmethod
def get(cls, name: str) -> ContractConfig

Return chain config for given chain type.