Skip to content

Unmarshalling LCD API response into Protobuf types fails #69

Discussion options

You must be logged in to vote

REST. I already managed to fix it btw, only needed to parse it via legacy amino, so feel free to mark it as resolved:

import (
    "github.com/cosmos/cosmos-sdk/codec"
    codecTypes "github.com/cosmos/cosmos-sdk/codec/types"
    "github.com/cosmos/cosmos-sdk/std"
    stakingTypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)

    interfaceRegistry := codecTypes.NewInterfaceRegistry()
    std.RegisterInterfaces(interfaceRegistry)
    parseCodec := codec.NewProtoCodec(interfaceRegistry)

    // function that does a HTTP query and returns JSON response as []byte 
    bytes, err := client.GetPlain(
        "/cosmos/staking/v1beta1/validators?status=BOND_STATUS_BONDED&pagination.limit=1000…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@freak12techno
Comment options

Answer selected by tac0turtle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants