Skip to content

SNIP-12 merkletree doesn't include dependent types #1342

Open
@sgc-code

Description

@sgc-code

Describe the bug
Regarding SNIP-12.
When calculating the encodetype of an object that includes a merkletree, the dependent types are not transitively added

To Reproduce
It can be reproduced with the following types:

{
  StarknetDomain: [
    { name: "name", type: "shortstring" },
    { name: "version", type: "shortstring" },
    { name: "chainId", type: "shortstring" },
    { name: "revision", type: "shortstring" },
  ],
  Object: [{ name: "tree", type: "merkletree", contains: "OtherObject" }],
  OtherObject: [{ name: "number", type: "uint128" }]
}

Expected behavior
Object encodeType is calculated as
"Object"("tree":"merkletree")

but it should include declaration of the other object too like this:
"Object"("tree":"merkletree")"OtherObject"("number":"uint128")

This works correctly on enums but for some reason it's not done correctly with merkletrees

Screenshots

Desktop (please complete the following information):
Node version: 18
Starknet.js version: v6.23.1 (latest)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions