Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better ModuleAccount JSON serialization #5270

Closed
4 tasks
RiccardoM opened this issue Nov 4, 2019 · 1 comment · Fixed by #5280
Closed
4 tasks

Better ModuleAccount JSON serialization #5270

RiccardoM opened this issue Nov 4, 2019 · 1 comment · Fixed by #5280

Comments

@RiccardoM
Copy link
Contributor

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
@alexanderbez
Copy link
Contributor

By all means, please implement a JSON marshall/unmarshal for the ModuleAccount type. Maybe even the standard account types too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants