Skip to content

Conversation

@md0x
Copy link
Contributor

@md0x md0x commented Dec 17, 2024

Changes proposed in this PR:

  • Add script to read and print svm events in a human readable format.

Signed-off-by: Pablo Maldonado <pablomaldonadoturci@gmail.com>
@md0x md0x force-pushed the pablo/query-events-script branch from 70c4631 to 423dcaa Compare December 17, 2024 10:32
@md0x md0x marked this pull request as ready for review December 17, 2024 10:33
md0x added 2 commits December 17, 2024 10:41
Signed-off-by: Pablo Maldonado <pablomaldonadoturci@gmail.com>
Signed-off-by: Pablo Maldonado <pablomaldonadoturci@gmail.com>
Signed-off-by: Pablo Maldonado <pablomaldonadoturci@gmail.com>
type: "string",
demandOption: false,
describe: "Name of the event to query",
choices: [
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: shouldn't event names start with capital letter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The EventCoder returns them with the first letter in lowercase. I guess we could capitalize the events ourselves in the processEventFromTx function as a custom treatment, but we aren’t doing that. That’s why the event names should match those returned by the EventCoder.

*/
export function stringifyCpiEvent(obj: any): any {
if (obj?.constructor?.toString()?.includes("PublicKey")) {
if (obj.toString().includes("111111111111")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

unlikely to have zeroes anywhere else than in the beginning, though, still better to restrict that only the first 12 bytes matching 0 are translated as EVM addresses

Copy link
Contributor Author

Choose a reason for hiding this comment

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

100%

md0x and others added 2 commits December 17, 2024 15:17
Co-authored-by: Reinis Martinsons <77973553+Reinis-FRP@users.noreply.github.com>
Signed-off-by: Pablo Maldonado <pablomaldonadoturci@gmail.com>
@md0x md0x requested a review from Reinis-FRP December 17, 2024 17:20
md0x added 2 commits December 17, 2024 18:30
Signed-off-by: Pablo Maldonado <pablomaldonadoturci@gmail.com>
Signed-off-by: Pablo Maldonado <pablomaldonadoturci@gmail.com>
Copy link
Contributor

@Reinis-FRP Reinis-FRP left a comment

Choose a reason for hiding this comment

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

nice!

@md0x md0x merged commit ab4b762 into master Dec 20, 2024
9 checks passed
@md0x md0x deleted the pablo/query-events-script branch December 20, 2024 09:31
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.

4 participants