-
Notifications
You must be signed in to change notification settings - Fork 757
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: expand structured data hashing in line with SNIP-12 (#920)
* feat: expand structured data hashing in line with SNIP-12 * chore: reduce revision overlap * chore: allow hash method override for the Merkle tree class * chore: simplify enum and array handling
- Loading branch information
Showing
14 changed files
with
637 additions
and
224 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"types": { | ||
"StarknetDomain": [ | ||
{ "name": "name", "type": "shortstring" }, | ||
{ "name": "version", "type": "shortstring" }, | ||
{ "name": "chainId", "type": "shortstring" }, | ||
{ "name": "revision", "type": "shortstring" } | ||
], | ||
"Example": [ | ||
{ "name": "n0", "type": "felt" }, | ||
{ "name": "n1", "type": "bool" }, | ||
{ "name": "n2", "type": "string" }, | ||
{ "name": "n3", "type": "selector" }, | ||
{ "name": "n4", "type": "u128" }, | ||
{ "name": "n5", "type": "ContractAddress" }, | ||
{ "name": "n6", "type": "ClassHash" }, | ||
{ "name": "n7", "type": "timestamp" }, | ||
{ "name": "n8", "type": "shortstring" } | ||
] | ||
}, | ||
"primaryType": "Example", | ||
"domain": { | ||
"name": "StarkNet Mail", | ||
"version": "1", | ||
"chainId": "1", | ||
"revision": "1" | ||
}, | ||
"message": { | ||
"n0": "0x3e8", | ||
"n1": true, | ||
"n2": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", | ||
"n3": "transfer", | ||
"n4": "0x3e8", | ||
"n5": "0x3e8", | ||
"n6": "0x3e8", | ||
"n7": 1000, | ||
"n8": "transfer" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"types": { | ||
"StarknetDomain": [ | ||
{ "name": "name", "type": "shortstring" }, | ||
{ "name": "version", "type": "shortstring" }, | ||
{ "name": "chainId", "type": "shortstring" }, | ||
{ "name": "revision", "type": "shortstring" } | ||
], | ||
"Example": [{ "name": "someEnum", "type": "enum", "contains": "MyEnum" }], | ||
"MyEnum": [ | ||
{ "name": "Variant 1", "type": "()" }, | ||
{ "name": "Variant 2", "type": "(u128,u128*)" }, | ||
{ "name": "Variant 3", "type": "(u128)" } | ||
] | ||
}, | ||
"primaryType": "Example", | ||
"domain": { | ||
"name": "StarkNet Mail", | ||
"version": "1", | ||
"chainId": "1", | ||
"revision": "1" | ||
}, | ||
"message": { | ||
"someEnum": { | ||
"Variant 2": [2, [0, 1]] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"types": { | ||
"StarknetDomain": [ | ||
{ "name": "name", "type": "shortstring" }, | ||
{ "name": "version", "type": "shortstring" }, | ||
{ "name": "chainId", "type": "shortstring" }, | ||
{ "name": "revision", "type": "shortstring" } | ||
], | ||
"Example": [ | ||
{ "name": "n0", "type": "TokenAmount" }, | ||
{ "name": "n1", "type": "NftId" } | ||
] | ||
}, | ||
"primaryType": "Example", | ||
"domain": { | ||
"name": "StarkNet Mail", | ||
"version": "1", | ||
"chainId": "1", | ||
"revision": "1" | ||
}, | ||
"message": { | ||
"n0": { | ||
"token_address": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", | ||
"amount": { | ||
"low": "0x3e8", | ||
"high": "0x0" | ||
} | ||
}, | ||
"n1": { | ||
"collection_address": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", | ||
"token_id": { | ||
"low": "0x3e8", | ||
"high": "0x0" | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.