Ejemplo n.º 1
0
def run():
    channel = grpc.insecure_channel(SERVER_ADDRESS)
    stub = AdmissionControlStub(channel)

    account = GetAccountStateRequest(address=bytes.fromhex(ADDRESS))
    item = RequestItem(get_account_state_request=account)
    request = UpdateToLatestLedgerRequest(client_known_version=125190,
                                          requested_items=[item])
    response = stub.UpdateToLatestLedger(request)

    state = response.response_items[
        0].get_account_state_response.account_state_with_proof
    print(state)
Ejemplo n.º 2
0
def run():
    channel = grpc.insecure_channel(SERVER_ADDRESS)
    stub = AdmissionControlStub(channel)

    request = UpdateToLatestLedgerRequest(client_known_version=0,
                                          requested_items=[])
    response = stub.UpdateToLatestLedger(request)

    ledger_info = response.ledger_info_with_sigs.ledger_info
    print('version:', ledger_info.version)
    print('consensus_data_hash:', ledger_info.consensus_data_hash.hex())
    print('consensus_block_id:', ledger_info.consensus_block_id.hex())
    print()

    signatures = response.ledger_info_with_sigs.signatures
    for item in signatures:
        print('Validator ID:', item.validator_id.hex())
        print('Signature:', item.signature.hex())
        print()
Ejemplo n.º 3
0
def start_rpc_client_instance(rpc_server, mint_addr):
    global last_version_seen
    global stub
    global SERVER_ADDRESS
    global MINT_ACCOUNT

    SERVER_ADDRESS = rpc_server
    MINT_ACCOUNT = mint_addr

    channel = grpc.insecure_channel(SERVER_ADDRESS)
    stub = AdmissionControlStub(channel)

    last_version_seen = get_latest_version_from_ledger()

    return stub