コード例 #1
0
def registration_cost(shard_id: int, proxy: ElrondProxy) -> int:
    dns_address = compute_dns_address_for_shard_id(shard_id)
    contract = SmartContract(dns_address)
    result = contract.query(proxy, "getRegistrationCost", [])
    if len(result[0]) == 0:
        return 0
    else:
        return int("0x{}".format(result[0]))
コード例 #2
0
def resolve(name: str, proxy: ElrondProxy) -> Address:
    name_arg = "0x{}".format(str.encode(name).hex())
    dns_address = dns_address_for_name(name)
    contract = SmartContract(dns_address)
    result = contract.query(proxy, "resolve", [name_arg])
    if len(result) == 0:
        return Address.zero()
    return Address(result[0].hex)
コード例 #3
0
def query(args: Any):
    logger.debug("query")

    contract_address = args.contract
    function = args.function
    arguments = args.arguments

    contract = SmartContract(contract_address)
    result = contract.query(ElrondProxy(args.proxy), function, arguments)
    utils.dump_out_json(result)
コード例 #4
0
def version(shard_id: int, proxy: ElrondProxy) -> str:
    dns_address = compute_dns_address_for_shard_id(shard_id)
    contract = SmartContract(dns_address)
    result = contract.query(proxy, "version", [])
    return bytearray.fromhex(result[0].hex).decode()
コード例 #5
0
def validate_name(name: str, shard_id: int, proxy: ElrondProxy):
    name_arg = "0x{}".format(str.encode(name).hex())
    dns_address = compute_dns_address_for_shard_id(shard_id)
    contract = SmartContract(dns_address)
    contract.query(proxy, "validateName", [name_arg])