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

Publish account data #240

Merged
merged 1 commit into from
Apr 8, 2024
Merged

Publish account data #240

merged 1 commit into from
Apr 8, 2024

Conversation

Thomasvdam
Copy link
Member

Explanation of Changes

Marshalling with the interface gives us an identifier for the account type, which we can use on the indexer side to know how to unpack the object.

Testing

You can 'just' set up the plugin, queue emulator, and start a local node. When it starts you should see all the genesis accounts being indexed in block 1:

{"level":"info","msg":"2024-04-08 11:26:55: Queue: local-updates.fifo, Message: {\"type\":\"account\",\"data\":{\"@type\":\"/cosmos.auth.v1beta1.ModuleAccount\",\"base_account\":{\"address\":\"seda1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3r49h6k\",\"pub_key\":null,\"account_number\":\"7\",\"sequence\":\"0\"},\"name\":\"bonded_tokens_pool\",\"permissions\":[\"burner\",\"staking\"]}}\n","time":"2024-04-08T11:26:55Z"}
{"level":"info","msg":"2024-04-08 11:26:55: Queue: local-updates.fifo, Message: {\"type\":\"account\",\"data\":{\"@type\":\"/cosmos.auth.v1beta1.BaseAccount\",\"address\":\"seda12rype4zl8wxcgqwl237fll6hvufkgcj8kwnuah\",\"pub_key\":null,\"account_number\":\"2\",\"sequence\":\"0\"}}\n","time":"2024-04-08T11:26:55Z"}

Just the messages:

{
  "type": "account",
  "data": {
    "@type": "/cosmos.auth.v1beta1.ModuleAccount",
    "base_account": {
      "address": "seda1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3r49h6k",
      "pub_key": null,
      "account_number": "7",
      "sequence": "0"
    },
    "name": "bonded_tokens_pool",
    "permissions": ["burner", "staking"]
  }
}
{
  "type": "account",
  "data": {
    "@type": "/cosmos.auth.v1beta1.BaseAccount",
    "address": "seda12rype4zl8wxcgqwl237fll6hvufkgcj8kwnuah",
    "pub_key": null,
    "account_number": "2",
    "sequence": "0"
  }
}

When you submit transactions you'll also messages for the account with the increased sequence number.

Related PRs and Issues

Closes: #227

Marshalling with the interface gives us an identifier for the account
type, which we can use on the indexer side to know how to unpack the
object.

Closes: #227
@Thomasvdam Thomasvdam requested a review from a team April 8, 2024 12:05
Copy link
Member

@hacheigriega hacheigriega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you unmarshalling into concrete type from javascript side?

@Thomasvdam
Copy link
Member Author

JS doesn't really have concrete types 😅 But we do narrow done the 'shape' of the JSON based on the @type attribute.

@Thomasvdam Thomasvdam merged commit 62ff083 into main Apr 8, 2024
16 of 17 checks passed
@Thomasvdam Thomasvdam deleted the feat/publish-account-data branch April 8, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ Publish account data
3 participants