Skip to content

Better ModuleAccount JSON serialization #5270

Closed

Description

Summary

Improve the way ModuleAccount is serialized to JSON

Problem Definition

Currently a ModuleAccount is serialized as follows:

{
  "BaseAccount": {
    "address": "did:com:154s52fcvu6ema0ga6qftww2gva7avxx54hy2p5",
    "coins": [
      {
        "denom": "ucommercio",
        "amount": "20"
      }
    ],
    "public_key": null,
    "account_number": "7",
    "sequence": "0"
  },
  "name": "id",
  "permissions": null
}

The BaseAccount is due to Amino not following json encoding standards about wrapped types.
I think this can be easily and safely dropped and doing so will also allow easier reading.

Proposal

I think it should be better to implement a custom serializer that allows to write the a ModuleAccount instance as

{
  "address": "did:com:154s52fcvu6ema0ga6qftww2gva7avxx54hy2p5",
  "coins": [
    {
      "denom": "ucommercio",
      "amount": "20"
    }
  ],
  "public_key": null,
  "account_number": "7",
  "sequence": "0",
  "name": "id",
  "permissions": null
}

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions