Skip to content

autonomy.chain.mint

Helpers for minting components

transact

def transact(ledger_api: LedgerApi,
             crypto: Crypto,
             tx: Dict,
             max_retries: int = 5,
             sleep: float = 5.0,
             timeout: Optional[float] = None) -> Dict

Make a transaction and return a receipt

sort_service_dependency_metadata

def sort_service_dependency_metadata(
        agent_ids: List[int], number_of_slots_per_agents: List[int],
        cost_of_bond_per_agent: List[int]) -> Tuple[List[int], ...]

Sort service dependencies and their respective parameters

get_min_threshold

def get_min_threshold(n: int) -> int

Calculate minimum threshold required for N number of agents.

MintManager Objects

class MintManager()

Mint helper.

__init__

def __init__(ledger_api: LedgerApi,
             crypto: Crypto,
             chain_type: ChainType,
             dry_run: bool = False,
             timeout: Optional[float] = None,
             retries: Optional[int] = None,
             sleep: Optional[float] = None) -> None

Initialize object.

validate_address

def validate_address(address: str) -> str

Validate address string.

mint_component

def mint_component(metadata_hash: str,
                   component_type: UnitType,
                   owner: Optional[str] = None,
                   dependencies: Optional[List[int]] = None) -> Optional[int]

Publish component on-chain.

update_component

def update_component(metadata_hash: str, unit_id: int,
                     component_type: UnitType) -> Optional[int]

Update component on-chain.

mint_service

def mint_service(metadata_hash: str,
                 agent_ids: List[int],
                 number_of_slots_per_agent: List[int],
                 cost_of_bond_per_agent: List[int],
                 threshold: Optional[int] = None,
                 token: Optional[str] = None,
                 owner: Optional[str] = None) -> Optional[int]

Publish component on-chain.

update_service

def update_service(metadata_hash: str,
                   service_id: int,
                   agent_ids: List[int],
                   number_of_slots_per_agent: List[int],
                   cost_of_bond_per_agent: List[int],
                   threshold: Optional[int] = None,
                   token: Optional[str] = None) -> Optional[int]

Publish component on-chain.