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

DecodeAccountKey for new AddAccountKey event format #300

Open
bthaile opened this issue Jun 22, 2022 · 1 comment
Open

DecodeAccountKey for new AddAccountKey event format #300

bthaile opened this issue Jun 22, 2022 · 1 comment

Comments

@bthaile
Copy link
Contributor

bthaile commented Jun 22, 2022

Instructions

Problem

flow.AccountKeyAdded has two formats from GetEventsForHeightRange, I've been told that the events are from on-chain and can not be reformatted from server. There is a helper flow.DecodeAccountKey(pkBytes) for process the old format. I don't see any helpers for processing the new format.

new format example in json

https://gist.github.com/bthaile/8e2c600797da0d47d7766b5079c69962

old format example in json

https://gist.github.com/bthaile/1244c7a4d6fbf755dbab2caf898ee742

Steps to Reproduce

query := client.EventRangeQuery{
Type: "flow.AccountKeyAdded",
StartHeight: lowHeight,
EndHeight: highHeight,
}

set the block range for the past 100 blocks and keep pulling every 100 blocks and eventually you will see the new format. Most of the event's I'm seeing are in the old format

events, err := client.GetEventsForHeightRange(context, query)

Acceptance Criteria

Helper method to parse new AccountKeyAdded event publicKey 64 byte array.
old AccountKeyAdded event format has publicKey as a 73 bytes array

Context

Building public key indexer that maps public keys to account addresses. I can reduce calls to Access Node by using event data.

@turbolent
Copy link
Member

@bthaile Coud you please add the code for the decoding function you have so far (what we discussed on Slack)?

@devbugging devbugging moved this to 🔖 Ready for Pickup in 🌊 Flow 4D Mar 30, 2023
@gregsantos gregsantos moved this from 🔖 Ready for Pickup to 🧊Ice Box in 🌊 Flow 4D Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants