-
Notifications
You must be signed in to change notification settings - Fork 822
Closed
Labels
Type: bugSomething isn't workingSomething isn't working
Description
Describe the bug
When encoding an enum type that uses another user-defined type as an array, the referenced type fails to be included in the encoded signature.
Edit: After looking into the problematic code I realized this is the case not just for when using as array. It happens as long as contains
is not exactly (DEPENDENCY_TYPE)
. So the reproducer below would still trigger the issue even if (Child*)
is changed to something like (u128,Child)
.
To Reproduce
Run this code:
import { typedData, TypedDataRevision } from "starknet";
console.log(
typedData.encodeType(
{
Parent: [{ name: "variant", type: "(Child*)" }],
Child: [{ name: "test", type: "u128" }],
},
"Parent",
TypedDataRevision.ACTIVE,
),
);
and it prints:
"Parent"("variant":("Child*"))
Expected behavior
The correct encoding would instead be:
"Parent"("variant":("Child*"))"Child"("test":"u128")
since Child
is indeed used by Parent
.
Screenshots
N/A
Desktop (please complete the following information):
- Node version:
v20.17.0
- Starknet.js version:
v6.20.3
Additional context
N/A
Metadata
Metadata
Assignees
Labels
Type: bugSomething isn't workingSomething isn't working