NibiruChain / nibiru

Nibiru Chain: The breakthrough smart contract platform ushering in the next era of money. Nibiru powers an ecosystem of dApps including perps, RWAs, and more.
https://nibiru.fi
Apache License 2.0
187 stars 201 forks source link

feat: base64 decoder for cw3 wasm messages #1725

Closed k-yang closed 10 months ago

k-yang commented 11 months ago

A stargate message has the form

{
  "stargate": {
    "type_url": "/cosmos.staking.v1beta1.MsgUndelegate",
    "value": "Cj9uaWJpMTdwOXJ6d25uZnhjanAzMnVuOXVnN3loaHpndGtodmw5amZrc3p0Z3c1dWg2OXdhYzJwZ3N5bjcwbmoSMm5pYml2YWxvcGVyMXdqNWtma25qa3BjNmpkMzByeHRtOHRweGZqZjd4cWx3eDM4YzdwGgwKBXVuaWJpEgMxMTE="
  }
}

so it's very difficult to tell exactly what the message is doing.

Voters of a cw3/cw4 multisig can't make an informed decision without a tool to decode the base64 bytes.

Unique-Divine commented 10 months ago

It would be nice to have a simple string parser on the CLI that takes arbitrary JSON through stdin and looks for objects with the value and type_url keys, then tries to decode the protobuf Any using the encodingConfig.Marshaler. And ideally, the decoding will attempt to use the value as given and attempt to b64 decode the value, considering either of these cases as a success.