We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
SNIP-12 specifies the enum type to be encoded as:
enum
escape(enum_name) || "(" || escape(variant_1_name) || "(" || escape(param1_type) || "," || ... || escape(paramN_type) || ")," || ... || escape(variant_n_name) || "(" || ... || ")" || ")"
with an example given:
type_hash(MyEnum) = starknet_keccak('"My Enum"("Variant 1"(),"Variant 2"("u128","u128*"),...,"Variant N"("u128"))')
However, starknet.js inserts an extra : between variant names and their type lists:
:
https://github.com/starknet-io/starknet.js/blob/2b69310840fb57b89d76949a3ea6cc188c42e8aa/src/utils/typedData.ts#L269_L271
The code above does not distinguish between structs and enums and always inserts :.
To Reproduce
Run this code:
import { typedData, TypedDataRevision } from "starknet"; console.log( typedData.encodeType( { Enum: [{ name: "variant", type: "(u128)" }], }, "Enum", TypedDataRevision.ACTIVE, ), );
and it prints:
"Enum"("variant":("u128"))
Expected behavior
According to SNIP-12 there should be no : between "variant" and ("u128").
"variant"
("u128")
Screenshots
N/A
Desktop (please complete the following information):
v20.17.0
v6.20.3
Additional context
The text was updated successfully, but these errors were encountered:
🎉 This issue has been resolved in version 6.21.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Describe the bug
SNIP-12 specifies the
enum
type to be encoded as:with an example given:
However, starknet.js inserts an extra
:
between variant names and their type lists:https://github.com/starknet-io/starknet.js/blob/2b69310840fb57b89d76949a3ea6cc188c42e8aa/src/utils/typedData.ts#L269_L271
The code above does not distinguish between structs and enums and always inserts
:
.To Reproduce
Run this code:
and it prints:
Expected behavior
According to SNIP-12 there should be no
:
between"variant"
and("u128")
.Screenshots
N/A
Desktop (please complete the following information):
v20.17.0
v6.20.3
Additional context
N/A
The text was updated successfully, but these errors were encountered: