fetchai/cosmpy

Bug report: send_tokens function

Closed this issue · 1 comments

I was using the send_tokens function.

private_key = ""
to_address = ""
memo = ""
amount = ""

client = LedgerClient(NetworkConfig(
            chain_id="cosmoshub-4",
            url="rest+https://cosmos-rest.publicnode.com",
            fee_minimum_gas_price=0.005,
            fee_denomination="uatom",
            staking_denomination="uatom",
        ))

wallet = LocalWallet(PrivateKey(private_key), 'cosmos')
transaction = client.send_tokens(
    destination=Address(to_address),
    amount=int(amount * Decimal('1_000_000')),
    denom='uatom',
    sender=wallet,
    memo=memo
)
transaction.wait_to_complete()

but recently I got the following error:

google.protobuf.json_format.ParseError: Failed to parse result field: Failed to parse events field: Failed to parse attributes field: Failed to parse key field: Invalid base64-encoded string: number of data characters (9) cannot be 1 more than a multiple of 4....

How can I solve this issue?

Hey there. Sadly no easy fix exists. The error arises as a consequence of you connecting to a node with a newer version of CosmosSDK. Cosmpy supports only 1 version of Cosmos SDK which is the same version that we use on the Fetch.ai network.
We can create a fork with the updated protobuf files, but if we want to support multiple versions of CosmosSDK at once it would require significant code changes.