diff --git a/scripts/v0/SimpleStruct.ts b/scripts/v0/SimpleStruct.ts index 0006c56..a5ace2d 100644 --- a/scripts/v0/SimpleStruct.ts +++ b/scripts/v0/SimpleStruct.ts @@ -13,8 +13,8 @@ const types = { }; interface SimpleStruct { - some_felt252: string; - some_u128: string; + someFelt252: string; + someU128: string; } function getDomain(chainId: string): StarknetDomain { @@ -36,13 +36,13 @@ function getTypedData(myStruct: SimpleStruct, chainId: string): TypedData { types, primaryType: "SimpleStruct", domain: getDomain(chainId), - message: { ...myStruct }, + message: { som_felt252: myStruct.someFelt252, some_u128: myStruct.someU128 }, }; } const simpleStruct: SimpleStruct = { - some_felt252: "712", - some_u128: "42", + someFelt252: "712", + someU128: "42", }; console.log(`test test_valid_hash ${getTypedDataHash(simpleStruct, "0", 420n)};`); diff --git a/scripts/v0/StructWithArray.ts b/scripts/v0/StructWithArray.ts index e8fa26c..a03713e 100644 --- a/scripts/v0/StructWithArray.ts +++ b/scripts/v0/StructWithArray.ts @@ -13,8 +13,8 @@ const types = { }; interface StructWithArray { - some_felt252: string; - some_array: string[]; + someFelt252: string; + someArray: string[]; } function getDomain(chainId: string): StarknetDomain { @@ -36,13 +36,13 @@ function getTypedData(myStruct: StructWithArray, chainId: string): TypedData { types, primaryType: "StructWithArray", domain: getDomain(chainId), - message: { ...myStruct }, + message: { some_felt252: myStruct.someFelt252, some_array: myStruct.someArray }, }; } const structWithArray: StructWithArray = { - some_felt252: "712", - some_array: ["4", "2"], + someFelt252: "712", + someArray: ["4", "2"], }; console.log(`test test_valid_hash ${getTypedDataHash(structWithArray, "0", 420n)};`); diff --git a/scripts/v0/StructWithMerkletree.ts b/scripts/v0/StructWithMerkletree.ts index 6debda9..5cc3170 100644 --- a/scripts/v0/StructWithMerkletree.ts +++ b/scripts/v0/StructWithMerkletree.ts @@ -14,8 +14,8 @@ const types = { }; interface StructWithMerkletree { - some_felt252: string; - some_merkletree_root: SomeLeaf[]; + someFelt252: string; + someMerkletreeRoot: SomeLeaf[]; } export interface SomeLeaf { @@ -41,13 +41,13 @@ function getTypedData(myStruct: StructWithMerkletree, chainId: string): TypedDat types, primaryType: "StructWithMerkletree", domain: getDomain(chainId), - message: { ...myStruct }, + message: { some_felt252: myStruct.someFelt252, some_merkletree_root: myStruct.someMerkletreeRoot }, }; } const structWithMerkletree: StructWithMerkletree = { - some_felt252: "712", - some_merkletree_root: [{ contract_address: "0x1" }, { contract_address: "0x2" }], + someFelt252: "712", + someMerkletreeRoot: [{ contract_address: "0x1" }, { contract_address: "0x2" }], }; console.log(`test test_valid_hash ${getTypedDataHash(structWithMerkletree, "0", 420n)};`); diff --git a/scripts/v0/StructWithU256.ts b/scripts/v0/StructWithU256.ts index 2787d72..b655a2c 100644 --- a/scripts/v0/StructWithU256.ts +++ b/scripts/v0/StructWithU256.ts @@ -17,8 +17,8 @@ const types = { }; interface StructWithU256 { - some_felt252: string; - some_u256: Uint256; + someFelt252: string; + someU256: Uint256; } function getDomain(chainId: string): StarknetDomain { @@ -40,13 +40,13 @@ function getTypedData(myStruct: StructWithU256, chainId: string): TypedData { types, primaryType: "StructWithU256", domain: getDomain(chainId), - message: { ...myStruct }, + message: { some_felt252: myStruct.someFelt252, some_u256: myStruct.someU256 }, }; } const structWithU256: StructWithU256 = { - some_felt252: "712", - some_u256: uint256.bnToUint256(42), + someFelt252: "712", + someU256: uint256.bnToUint256(42), }; console.log(`test test_valid_hash ${getTypedDataHash(structWithU256, "0", 420n)};`); diff --git a/scripts/v1/StructWithArray.ts b/scripts/v1/StructWithArray.ts index a4ffb90..5e679ed 100644 --- a/scripts/v1/StructWithArray.ts +++ b/scripts/v1/StructWithArray.ts @@ -39,7 +39,7 @@ function getTypedData(myStruct: StructWithArray, chainId: string): TypedData { types, primaryType: "StructWithArray", domain: getDomain(chainId), - message: { "Some felt252": myStruct.someFelt252, "Some array": myStruct.someArray}, + message: { "Some felt252": myStruct.someFelt252, "Some array": myStruct.someArray }, }; }