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

Event keys are not necessarily located in the beginning #44

Open
m-kus opened this issue Nov 21, 2024 · 0 comments
Open

Event keys are not necessarily located in the beginning #44

m-kus opened this issue Nov 21, 2024 · 0 comments

Comments

@m-kus
Copy link
Member

m-kus commented Nov 21, 2024

Any event field can be marked as #[key] in Cairo, in most cases those fields are the first ones.
Here is a counter example: https://sepolia.voyager.online/event/330906_31_0

Event ABI:

{
            "type": "event",
            "name": "hello::HelloStarknet::BalanceIncreased",
            "kind": "struct",
            "members": [
                {
                    "name": "amount",
                    "type": "core::felt252",
                    "kind": "data"
                },
                {
                    "name": "by",
                    "type": "core::starknet::contract_address::ContractAddress",
                    "kind": "key"
                }
            ]
},

The decoding will likely fail here

parsed, err := abi.DecodeEventData(values, *event, contractAbi.Structs, contractAbi.Enums)

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

No branches or pull requests

1 participant