@latticexyz/schema-type 2.0.12-main-2f436a5c → 2.0.12-type-resolutions-effc7ab1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/cache/solidity-files-cache.json +1 -0
  2. package/package.json +3 -3
  3. package/src/solidity/SchemaType.sol +0 -230
  4. package/src/typescript/arrayAbiTypes.test.ts +0 -78
  5. package/src/typescript/arrayAbiTypes.ts +0 -47
  6. package/src/typescript/deprecated/SchemaType.ts +0 -202
  7. package/src/typescript/deprecated/mappings/AbiTypeToDefaultValue.ts +0 -208
  8. package/src/typescript/deprecated/mappings/AbiTypeToPrimitiveType.ts +0 -12
  9. package/src/typescript/deprecated/mappings/AbiTypeToSchemaType.ts +0 -6
  10. package/src/typescript/deprecated/mappings/SchemaTypeArrayToElement.ts +0 -109
  11. package/src/typescript/deprecated/mappings/SchemaTypeToAbiType.ts +0 -210
  12. package/src/typescript/deprecated/mappings/SchemaTypeToPrimitiveType.ts +0 -9
  13. package/src/typescript/deprecated/mappings/index.ts +0 -5
  14. package/src/typescript/deprecated/mappings/types.test-d.ts +0 -233
  15. package/src/typescript/deprecated/types/AbiTypes.ts +0 -5
  16. package/src/typescript/deprecated/types/ArraySchemaType.ts +0 -101
  17. package/src/typescript/deprecated/types/DynamicSchemaType.ts +0 -4
  18. package/src/typescript/deprecated/types/StaticAbiTypes.ts +0 -10
  19. package/src/typescript/deprecated/types/StaticArray.ts +0 -3
  20. package/src/typescript/deprecated/types/StaticSchemaType.ts +0 -4
  21. package/src/typescript/deprecated/types/index.ts +0 -8
  22. package/src/typescript/deprecated/utils/encodeSchema.ts +0 -48
  23. package/src/typescript/deprecated/utils/getAbiTypeDefaultValue.ts +0 -11
  24. package/src/typescript/deprecated/utils/getStaticByteLength.ts +0 -25
  25. package/src/typescript/deprecated/utils/index.ts +0 -3
  26. package/src/typescript/dynamicAbiTypes.test-d.ts +0 -66
  27. package/src/typescript/dynamicAbiTypes.ts +0 -128
  28. package/src/typescript/exports/deprecated.ts +0 -4
  29. package/src/typescript/exports/index.ts +0 -5
  30. package/src/typescript/exports/internal.ts +0 -6
  31. package/src/typescript/schemaAbiTypeToDefaultValue.ts +0 -8
  32. package/src/typescript/schemaAbiTypeToPrimitiveType.ts +0 -7
  33. package/src/typescript/schemaAbiTypes.test.ts +0 -17
  34. package/src/typescript/schemaAbiTypes.ts +0 -219
  35. package/src/typescript/staticAbiTypes.test-d.ts +0 -58
  36. package/src/typescript/staticAbiTypes.ts +0 -223
  37. package/src/typescript/utils.ts +0 -25
@@ -0,0 +1 @@
1
+ {"_format":"","paths":{"artifacts":"out/solidity","build_infos":"out/solidity/build-info","sources":"src/solidity","tests":"test/solidity","scripts":"script","libraries":["node_modules"]},"files":{"node_modules/@latticexyz/gas-report/src/GasReporter.sol":{"lastModificationDate":1716457798803,"contentHash":"02c5aa45c2f5e06c0e15b853ccd0a736","sourceName":"node_modules/@latticexyz/gas-report/src/GasReporter.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":["node_modules/ds-test/src/test.sol","node_modules/forge-std/src/Base.sol","node_modules/forge-std/src/StdAssertions.sol","node_modules/forge-std/src/StdChains.sol","node_modules/forge-std/src/StdCheats.sol","node_modules/forge-std/src/StdError.sol","node_modules/forge-std/src/StdInvariant.sol","node_modules/forge-std/src/StdJson.sol","node_modules/forge-std/src/StdMath.sol","node_modules/forge-std/src/StdStorage.sol","node_modules/forge-std/src/StdStyle.sol","node_modules/forge-std/src/StdUtils.sol","node_modules/forge-std/src/Test.sol","node_modules/forge-std/src/Vm.sol","node_modules/forge-std/src/console.sol","node_modules/forge-std/src/console2.sol","node_modules/forge-std/src/interfaces/IMulticall3.sol","node_modules/forge-std/src/safeconsole.sol"],"versionRequirement":">=0.8.24","artifacts":{"GasReporter":{"0.8.24":"GasReporter.sol/GasReporter.json"}}},"node_modules/ds-test/src/test.sol":{"lastModificationDate":1716457812691,"contentHash":"9febff9d09f18af5306669dc276c4c43","sourceName":"node_modules/ds-test/src/test.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":[],"versionRequirement":">=0.5.0","artifacts":{"DSTest":{"0.8.24":"test.sol/DSTest.json"}}},"node_modules/forge-std/src/Base.sol":{"lastModificationDate":1716457812759,"contentHash":"ee13c050b1914464f1d3f90cde90204b","sourceName":"node_modules/forge-std/src/Base.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":["node_modules/forge-std/src/StdStorage.sol","node_modules/forge-std/src/Vm.sol"],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"CommonBase":{"0.8.24":"Base.sol/CommonBase.json"},"ScriptBase":{"0.8.24":"Base.sol/ScriptBase.json"},"TestBase":{"0.8.24":"Base.sol/TestBase.json"}}},"node_modules/forge-std/src/StdAssertions.sol":{"lastModificationDate":1716457812759,"contentHash":"6cc2858240bcd443debbbf075490e325","sourceName":"node_modules/forge-std/src/StdAssertions.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":["node_modules/ds-test/src/test.sol","node_modules/forge-std/src/StdMath.sol"],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"StdAssertions":{"0.8.24":"StdAssertions.sol/StdAssertions.json"}}},"node_modules/forge-std/src/StdChains.sol":{"lastModificationDate":1716457812759,"contentHash":"aff0685683a41d8e314d64aef646fe6f","sourceName":"node_modules/forge-std/src/StdChains.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":["node_modules/forge-std/src/Vm.sol"],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"StdChains":{"0.8.24":"StdChains.sol/StdChains.json"}}},"node_modules/forge-std/src/StdCheats.sol":{"lastModificationDate":1716457812759,"contentHash":"27745bb24c5568c75c3043277ee18bcb","sourceName":"node_modules/forge-std/src/StdCheats.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":["node_modules/forge-std/src/StdStorage.sol","node_modules/forge-std/src/Vm.sol"],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"StdCheats":{"0.8.24":"StdCheats.sol/StdCheats.json"},"StdCheatsSafe":{"0.8.24":"StdCheats.sol/StdCheatsSafe.json"}}},"node_modules/forge-std/src/StdError.sol":{"lastModificationDate":1716457812759,"contentHash":"64c896e1276a291776e5ea5aecb3870a","sourceName":"node_modules/forge-std/src/StdError.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":[],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"stdError":{"0.8.24":"StdError.sol/stdError.json"}}},"node_modules/forge-std/src/StdInvariant.sol":{"lastModificationDate":1716457812759,"contentHash":"6d12d54c05754ad4e03066726dca3a84","sourceName":"node_modules/forge-std/src/StdInvariant.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":[],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"StdInvariant":{"0.8.24":"StdInvariant.sol/StdInvariant.json"}}},"node_modules/forge-std/src/StdJson.sol":{"lastModificationDate":1716457812759,"contentHash":"2e1d13674e152408867795362d833c24","sourceName":"node_modules/forge-std/src/StdJson.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":["node_modules/forge-std/src/Vm.sol"],"versionRequirement":">=0.6.0, <0.9.0","artifacts":{"stdJson":{"0.8.24":"StdJson.sol/stdJson.json"}}},"node_modules/forge-std/src/StdMath.sol":{"lastModificationDate":1716457812759,"contentHash":"9da8f453eba6bb98f3d75bc6822bfb29","sourceName":"node_modules/forge-std/src/StdMath.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":[],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"stdMath":{"0.8.24":"StdMath.sol/stdMath.json"}}},"node_modules/forge-std/src/StdStorage.sol":{"lastModificationDate":1716457812759,"contentHash":"4fc0ff0cb196a405e5a4c9fa1c6acccb","sourceName":"node_modules/forge-std/src/StdStorage.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":["node_modules/forge-std/src/Vm.sol"],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"stdStorage":{"0.8.24":"StdStorage.sol/stdStorage.json"},"stdStorageSafe":{"0.8.24":"StdStorage.sol/stdStorageSafe.json"}}},"node_modules/forge-std/src/StdStyle.sol":{"lastModificationDate":1716457812759,"contentHash":"6281165a12aa639705c691fccefd855e","sourceName":"node_modules/forge-std/src/StdStyle.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":["node_modules/forge-std/src/Vm.sol"],"versionRequirement":">=0.4.22, <0.9.0","artifacts":{"StdStyle":{"0.8.24":"StdStyle.sol/StdStyle.json"}}},"node_modules/forge-std/src/StdUtils.sol":{"lastModificationDate":1716457812759,"contentHash":"3ce83748fd76644688f916c9cced545b","sourceName":"node_modules/forge-std/src/StdUtils.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":["node_modules/forge-std/src/Vm.sol","node_modules/forge-std/src/interfaces/IMulticall3.sol"],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"StdUtils":{"0.8.24":"StdUtils.sol/StdUtils.json"}}},"node_modules/forge-std/src/Test.sol":{"lastModificationDate":1716457812763,"contentHash":"c67db2c47c2e757cc33d38d6db0b1562","sourceName":"node_modules/forge-std/src/Test.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":["node_modules/ds-test/src/test.sol","node_modules/forge-std/src/Base.sol","node_modules/forge-std/src/StdAssertions.sol","node_modules/forge-std/src/StdChains.sol","node_modules/forge-std/src/StdCheats.sol","node_modules/forge-std/src/StdError.sol","node_modules/forge-std/src/StdInvariant.sol","node_modules/forge-std/src/StdJson.sol","node_modules/forge-std/src/StdMath.sol","node_modules/forge-std/src/StdStorage.sol","node_modules/forge-std/src/StdStyle.sol","node_modules/forge-std/src/StdUtils.sol","node_modules/forge-std/src/Vm.sol","node_modules/forge-std/src/console.sol","node_modules/forge-std/src/console2.sol","node_modules/forge-std/src/interfaces/IMulticall3.sol","node_modules/forge-std/src/safeconsole.sol"],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"Test":{"0.8.24":"Test.sol/Test.json"}}},"node_modules/forge-std/src/Vm.sol":{"lastModificationDate":1716457812763,"contentHash":"b098c2721502365797aae8d0ee1babb8","sourceName":"node_modules/forge-std/src/Vm.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":[],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"Vm":{"0.8.24":"Vm.sol/Vm.json"},"VmSafe":{"0.8.24":"Vm.sol/VmSafe.json"}}},"node_modules/forge-std/src/console.sol":{"lastModificationDate":1716457812763,"contentHash":"100b8a33b917da1147740d7ab8b0ded3","sourceName":"node_modules/forge-std/src/console.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":[],"versionRequirement":">=0.4.22, <0.9.0","artifacts":{"console":{"0.8.24":"console.sol/console.json"}}},"node_modules/forge-std/src/console2.sol":{"lastModificationDate":1716457812763,"contentHash":"491ca717c1915995e78cc361485a3067","sourceName":"node_modules/forge-std/src/console2.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":[],"versionRequirement":">=0.4.22, <0.9.0","artifacts":{"console2":{"0.8.24":"console2.sol/console2.json"}}},"node_modules/forge-std/src/interfaces/IMulticall3.sol":{"lastModificationDate":1716457812763,"contentHash":"7b131ca1ca32ef6378b7b9ad5488b901","sourceName":"node_modules/forge-std/src/interfaces/IMulticall3.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":[],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"IMulticall3":{"0.8.24":"IMulticall3.sol/IMulticall3.json"}}},"node_modules/forge-std/src/safeconsole.sol":{"lastModificationDate":1716457812763,"contentHash":"ac3b1bf5a444db5db3656021830258a8","sourceName":"node_modules/forge-std/src/safeconsole.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":[],"versionRequirement":">=0.6.2, <0.9.0","artifacts":{"safeconsole":{"0.8.24":"safeconsole.sol/safeconsole.json"}}},"src/solidity/SchemaType.sol":{"lastModificationDate":1716457798811,"contentHash":"67de13969f8911e576ec387fee8ee58d","sourceName":"src/solidity/SchemaType.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":[],"versionRequirement":">=0.8.24","artifacts":{}},"test/solidity/SchemaType.t.sol":{"lastModificationDate":1716457798811,"contentHash":"06716c2d8c483e773c772984322b8246","sourceName":"test/solidity/SchemaType.t.sol","compilerSettings":{"optimizer":{"enabled":true,"runs":3000},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":false,"libraries":{}},"imports":["node_modules/@latticexyz/gas-report/src/GasReporter.sol","node_modules/ds-test/src/test.sol","node_modules/forge-std/src/Base.sol","node_modules/forge-std/src/StdAssertions.sol","node_modules/forge-std/src/StdChains.sol","node_modules/forge-std/src/StdCheats.sol","node_modules/forge-std/src/StdError.sol","node_modules/forge-std/src/StdInvariant.sol","node_modules/forge-std/src/StdJson.sol","node_modules/forge-std/src/StdMath.sol","node_modules/forge-std/src/StdStorage.sol","node_modules/forge-std/src/StdStyle.sol","node_modules/forge-std/src/StdUtils.sol","node_modules/forge-std/src/Test.sol","node_modules/forge-std/src/Vm.sol","node_modules/forge-std/src/console.sol","node_modules/forge-std/src/console2.sol","node_modules/forge-std/src/interfaces/IMulticall3.sol","node_modules/forge-std/src/safeconsole.sol","src/solidity/SchemaType.sol"],"versionRequirement":">=0.8.24","artifacts":{"SchemaTypeTest":{"0.8.24":"SchemaType.t.sol/SchemaTypeTest.json"}}}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/schema-type",
3
- "version": "2.0.12-main-2f436a5c",
3
+ "version": "2.0.12-type-resolutions-effc7ab1",
4
4
  "description": "SchemaType enum for various languages",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  "dist",
19
19
  "out",
20
20
  "foundry.toml",
21
- "src"
21
+ "cache"
22
22
  ],
23
23
  "dependencies": {
24
24
  "abitype": "1.0.0",
@@ -29,7 +29,7 @@
29
29
  "forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1",
30
30
  "tsup": "^6.7.0",
31
31
  "vitest": "0.34.6",
32
- "@latticexyz/gas-report": "2.0.12-main-2f436a5c"
32
+ "@latticexyz/gas-report": "2.0.12-type-resolutions-effc7ab1"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "pnpm run build:js",
@@ -1,230 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.24;
3
-
4
- using { getStaticByteLength } for SchemaType global;
5
-
6
- // WARNING: All enum changes MUST be mirrored for the other languages!
7
- // WARNING: SchemaType methods use hardcoded enum indexes, review them after any changes to the enum
8
- // TODO add and implement BYTES_ARRAY, STRING_ARRAY if they are needed (see https://github.com/latticexyz/mud/issues/447)
9
- enum SchemaType {
10
- UINT8,
11
- UINT16,
12
- UINT24,
13
- UINT32,
14
- UINT40,
15
- UINT48,
16
- UINT56,
17
- UINT64,
18
- UINT72,
19
- UINT80,
20
- UINT88,
21
- UINT96,
22
- UINT104,
23
- UINT112,
24
- UINT120,
25
- UINT128,
26
- UINT136,
27
- UINT144,
28
- UINT152,
29
- UINT160,
30
- UINT168,
31
- UINT176,
32
- UINT184,
33
- UINT192,
34
- UINT200,
35
- UINT208,
36
- UINT216,
37
- UINT224,
38
- UINT232,
39
- UINT240,
40
- UINT248,
41
- UINT256,
42
- INT8,
43
- INT16,
44
- INT24,
45
- INT32,
46
- INT40,
47
- INT48,
48
- INT56,
49
- INT64,
50
- INT72,
51
- INT80,
52
- INT88,
53
- INT96,
54
- INT104,
55
- INT112,
56
- INT120,
57
- INT128,
58
- INT136,
59
- INT144,
60
- INT152,
61
- INT160,
62
- INT168,
63
- INT176,
64
- INT184,
65
- INT192,
66
- INT200,
67
- INT208,
68
- INT216,
69
- INT224,
70
- INT232,
71
- INT240,
72
- INT248,
73
- INT256,
74
- BYTES1,
75
- BYTES2,
76
- BYTES3,
77
- BYTES4,
78
- BYTES5,
79
- BYTES6,
80
- BYTES7,
81
- BYTES8,
82
- BYTES9,
83
- BYTES10,
84
- BYTES11,
85
- BYTES12,
86
- BYTES13,
87
- BYTES14,
88
- BYTES15,
89
- BYTES16,
90
- BYTES17,
91
- BYTES18,
92
- BYTES19,
93
- BYTES20,
94
- BYTES21,
95
- BYTES22,
96
- BYTES23,
97
- BYTES24,
98
- BYTES25,
99
- BYTES26,
100
- BYTES27,
101
- BYTES28,
102
- BYTES29,
103
- BYTES30,
104
- BYTES31,
105
- BYTES32,
106
- BOOL,
107
- ADDRESS,
108
- UINT8_ARRAY,
109
- UINT16_ARRAY,
110
- UINT24_ARRAY,
111
- UINT32_ARRAY,
112
- UINT40_ARRAY,
113
- UINT48_ARRAY,
114
- UINT56_ARRAY,
115
- UINT64_ARRAY,
116
- UINT72_ARRAY,
117
- UINT80_ARRAY,
118
- UINT88_ARRAY,
119
- UINT96_ARRAY,
120
- UINT104_ARRAY,
121
- UINT112_ARRAY,
122
- UINT120_ARRAY,
123
- UINT128_ARRAY,
124
- UINT136_ARRAY,
125
- UINT144_ARRAY,
126
- UINT152_ARRAY,
127
- UINT160_ARRAY,
128
- UINT168_ARRAY,
129
- UINT176_ARRAY,
130
- UINT184_ARRAY,
131
- UINT192_ARRAY,
132
- UINT200_ARRAY,
133
- UINT208_ARRAY,
134
- UINT216_ARRAY,
135
- UINT224_ARRAY,
136
- UINT232_ARRAY,
137
- UINT240_ARRAY,
138
- UINT248_ARRAY,
139
- UINT256_ARRAY,
140
- INT8_ARRAY,
141
- INT16_ARRAY,
142
- INT24_ARRAY,
143
- INT32_ARRAY,
144
- INT40_ARRAY,
145
- INT48_ARRAY,
146
- INT56_ARRAY,
147
- INT64_ARRAY,
148
- INT72_ARRAY,
149
- INT80_ARRAY,
150
- INT88_ARRAY,
151
- INT96_ARRAY,
152
- INT104_ARRAY,
153
- INT112_ARRAY,
154
- INT120_ARRAY,
155
- INT128_ARRAY,
156
- INT136_ARRAY,
157
- INT144_ARRAY,
158
- INT152_ARRAY,
159
- INT160_ARRAY,
160
- INT168_ARRAY,
161
- INT176_ARRAY,
162
- INT184_ARRAY,
163
- INT192_ARRAY,
164
- INT200_ARRAY,
165
- INT208_ARRAY,
166
- INT216_ARRAY,
167
- INT224_ARRAY,
168
- INT232_ARRAY,
169
- INT240_ARRAY,
170
- INT248_ARRAY,
171
- INT256_ARRAY,
172
- BYTES1_ARRAY,
173
- BYTES2_ARRAY,
174
- BYTES3_ARRAY,
175
- BYTES4_ARRAY,
176
- BYTES5_ARRAY,
177
- BYTES6_ARRAY,
178
- BYTES7_ARRAY,
179
- BYTES8_ARRAY,
180
- BYTES9_ARRAY,
181
- BYTES10_ARRAY,
182
- BYTES11_ARRAY,
183
- BYTES12_ARRAY,
184
- BYTES13_ARRAY,
185
- BYTES14_ARRAY,
186
- BYTES15_ARRAY,
187
- BYTES16_ARRAY,
188
- BYTES17_ARRAY,
189
- BYTES18_ARRAY,
190
- BYTES19_ARRAY,
191
- BYTES20_ARRAY,
192
- BYTES21_ARRAY,
193
- BYTES22_ARRAY,
194
- BYTES23_ARRAY,
195
- BYTES24_ARRAY,
196
- BYTES25_ARRAY,
197
- BYTES26_ARRAY,
198
- BYTES27_ARRAY,
199
- BYTES28_ARRAY,
200
- BYTES29_ARRAY,
201
- BYTES30_ARRAY,
202
- BYTES31_ARRAY,
203
- BYTES32_ARRAY,
204
- BOOL_ARRAY,
205
- ADDRESS_ARRAY,
206
- BYTES,
207
- STRING
208
- }
209
-
210
- /**
211
- * Get the length of the data for the given schema type
212
- * (Because Solidity doesn't support constant arrays, we need to use a function)
213
- */
214
- function getStaticByteLength(SchemaType schemaType) pure returns (uint256) {
215
- uint256 index = uint8(schemaType);
216
-
217
- if (index < 97) {
218
- // SchemaType enum elements are cyclically ordered for optimal static length lookup
219
- // indexes: 00-31, 32-63, 64-95, 96, 97, ...
220
- // lengths: 01-32, 01-32, 01-32, 01, 20, (the rest are 0s)
221
- unchecked {
222
- return (index & 31) + 1;
223
- }
224
- } else if (schemaType == SchemaType.ADDRESS) {
225
- return 20;
226
- } else {
227
- // Return 0 for all dynamic types
228
- return 0;
229
- }
230
- }
@@ -1,78 +0,0 @@
1
- import { describe, expect, expectTypeOf, it } from "vitest";
2
- import {
3
- ArrayAbiType,
4
- FixedArrayAbiType,
5
- fixedArrayToArray,
6
- isArrayAbiType,
7
- isFixedArrayAbiType,
8
- } from "./arrayAbiTypes";
9
-
10
- describe("isArrayAbiType", () => {
11
- it("should validate ABI type", () => {
12
- expect(isArrayAbiType("uint8")).toBe(false);
13
- expect(isArrayAbiType("uint8[]")).toBe(true);
14
- expect(isArrayAbiType("bool[]")).toBe(true);
15
- expect(isArrayAbiType("bool[4]")).toBe(false);
16
- expect(isArrayAbiType("string[]")).toBe(false);
17
- expect(isArrayAbiType("string[4]")).toBe(false);
18
- });
19
-
20
- it("should narrow the ABI type", () => {
21
- const abiType = "uint8[]";
22
- if (isArrayAbiType(abiType)) {
23
- expectTypeOf<typeof abiType>().toMatchTypeOf<ArrayAbiType>();
24
- expectTypeOf<typeof abiType>().toEqualTypeOf<"uint8[]">();
25
- } else {
26
- expect.fail();
27
- }
28
- });
29
-
30
- it("should narrow an unknown", () => {
31
- const abiType = "uint8[]" as unknown;
32
- if (isArrayAbiType(abiType)) {
33
- expectTypeOf<typeof abiType>().toEqualTypeOf<ArrayAbiType>();
34
- } else {
35
- expect.fail();
36
- }
37
- });
38
- });
39
-
40
- describe("isFixedArrayAbiType", () => {
41
- it("should validate ABI type", () => {
42
- expect(isFixedArrayAbiType("uint8")).toBe(false);
43
- expect(isFixedArrayAbiType("uint8[]")).toBe(false);
44
- expect(isFixedArrayAbiType("bool[]")).toBe(false);
45
- expect(isFixedArrayAbiType("bool[4]")).toBe(true);
46
- expect(isFixedArrayAbiType("string[]")).toBe(false);
47
- expect(isFixedArrayAbiType("string[4]")).toBe(false);
48
- });
49
-
50
- it("should narrow the ABI type", () => {
51
- const abiType = "uint8[4]";
52
- if (isFixedArrayAbiType(abiType)) {
53
- expectTypeOf<typeof abiType>().toMatchTypeOf<FixedArrayAbiType>();
54
- expectTypeOf<typeof abiType>().toEqualTypeOf<"uint8[4]">();
55
- } else {
56
- expect.fail();
57
- }
58
- });
59
-
60
- it("should narrow an unknown", () => {
61
- const abiType = "uint8[4]" as unknown;
62
- if (isFixedArrayAbiType(abiType)) {
63
- expectTypeOf<typeof abiType>().toEqualTypeOf<FixedArrayAbiType>();
64
- } else {
65
- expect.fail();
66
- }
67
- });
68
- });
69
-
70
- describe("fixedArrayToArray", () => {
71
- it("should convert a fixed array to a regular array", () => {
72
- expect(fixedArrayToArray("uint8[2]")).toBe("uint8[]");
73
- expectTypeOf(fixedArrayToArray("uint8[2]")).toEqualTypeOf<"uint8[]">();
74
-
75
- expect(fixedArrayToArray("bool[4]")).toBe("bool[]");
76
- expectTypeOf(fixedArrayToArray("bool[4]")).toEqualTypeOf<"bool[]">();
77
- });
78
- });
@@ -1,47 +0,0 @@
1
- import { StaticAbiType } from "./schemaAbiTypes";
2
- import { isStaticAbiType } from "./staticAbiTypes";
3
-
4
- export type ArrayAbiType = `${StaticAbiType}[]`;
5
- export type FixedArrayAbiType = `${StaticAbiType}[${number}]`;
6
-
7
- const arrayPattern = /\[\]$/;
8
- const fixedArrayPattern = /\[\d+\]$/;
9
-
10
- export function isArrayAbiType(abiType: unknown): abiType is ArrayAbiType {
11
- return (
12
- typeof abiType === "string" && arrayPattern.test(abiType) && isStaticAbiType(abiType.replace(arrayPattern, ""))
13
- );
14
- }
15
-
16
- export function isFixedArrayAbiType(abiType: unknown): abiType is FixedArrayAbiType {
17
- return (
18
- typeof abiType === "string" &&
19
- fixedArrayPattern.test(abiType) &&
20
- isStaticAbiType(abiType.replace(fixedArrayPattern, ""))
21
- );
22
- }
23
- export type arrayToStaticAbiType<abiType extends string> = abiType extends `${infer StaticAbiType}[]`
24
- ? StaticAbiType
25
- : never;
26
-
27
- export type fixedArrayToStaticAbiType<abiType extends string> = abiType extends `${infer StaticAbiType}[${number}]`
28
- ? StaticAbiType
29
- : never;
30
-
31
- export function arrayToStaticAbiType<abiType extends ArrayAbiType>(abiType: abiType): arrayToStaticAbiType<abiType> {
32
- return abiType.replace(arrayPattern, "") as arrayToStaticAbiType<abiType>;
33
- }
34
-
35
- export function fixedArrayToStaticAbiType<abiType extends FixedArrayAbiType>(
36
- abiType: abiType,
37
- ): fixedArrayToStaticAbiType<abiType> {
38
- return abiType.replace(fixedArrayPattern, "") as fixedArrayToStaticAbiType<abiType>;
39
- }
40
-
41
- export type fixedArrayToArray<abiType extends FixedArrayAbiType> = abiType extends `${infer staticAbiType}[${number}]`
42
- ? `${staticAbiType}[]`
43
- : never;
44
-
45
- export function fixedArrayToArray<abiType extends FixedArrayAbiType>(abiType: abiType): fixedArrayToArray<abiType> {
46
- return abiType.replace(fixedArrayPattern, "[]") as fixedArrayToArray<abiType>;
47
- }
@@ -1,202 +0,0 @@
1
- // WARNING: SchemaType enum MUST mirror the solidity version!
2
- // WARNING: SchemaType methods use hardcoded enum indexes, review them after any changes to the enum
3
- export enum SchemaType {
4
- UINT8,
5
- UINT16,
6
- UINT24,
7
- UINT32,
8
- UINT40,
9
- UINT48,
10
- UINT56,
11
- UINT64,
12
- UINT72,
13
- UINT80,
14
- UINT88,
15
- UINT96,
16
- UINT104,
17
- UINT112,
18
- UINT120,
19
- UINT128,
20
- UINT136,
21
- UINT144,
22
- UINT152,
23
- UINT160,
24
- UINT168,
25
- UINT176,
26
- UINT184,
27
- UINT192,
28
- UINT200,
29
- UINT208,
30
- UINT216,
31
- UINT224,
32
- UINT232,
33
- UINT240,
34
- UINT248,
35
- UINT256,
36
- INT8,
37
- INT16,
38
- INT24,
39
- INT32,
40
- INT40,
41
- INT48,
42
- INT56,
43
- INT64,
44
- INT72,
45
- INT80,
46
- INT88,
47
- INT96,
48
- INT104,
49
- INT112,
50
- INT120,
51
- INT128,
52
- INT136,
53
- INT144,
54
- INT152,
55
- INT160,
56
- INT168,
57
- INT176,
58
- INT184,
59
- INT192,
60
- INT200,
61
- INT208,
62
- INT216,
63
- INT224,
64
- INT232,
65
- INT240,
66
- INT248,
67
- INT256,
68
- BYTES1,
69
- BYTES2,
70
- BYTES3,
71
- BYTES4,
72
- BYTES5,
73
- BYTES6,
74
- BYTES7,
75
- BYTES8,
76
- BYTES9,
77
- BYTES10,
78
- BYTES11,
79
- BYTES12,
80
- BYTES13,
81
- BYTES14,
82
- BYTES15,
83
- BYTES16,
84
- BYTES17,
85
- BYTES18,
86
- BYTES19,
87
- BYTES20,
88
- BYTES21,
89
- BYTES22,
90
- BYTES23,
91
- BYTES24,
92
- BYTES25,
93
- BYTES26,
94
- BYTES27,
95
- BYTES28,
96
- BYTES29,
97
- BYTES30,
98
- BYTES31,
99
- BYTES32,
100
- BOOL,
101
- ADDRESS,
102
- UINT8_ARRAY,
103
- UINT16_ARRAY,
104
- UINT24_ARRAY,
105
- UINT32_ARRAY,
106
- UINT40_ARRAY,
107
- UINT48_ARRAY,
108
- UINT56_ARRAY,
109
- UINT64_ARRAY,
110
- UINT72_ARRAY,
111
- UINT80_ARRAY,
112
- UINT88_ARRAY,
113
- UINT96_ARRAY,
114
- UINT104_ARRAY,
115
- UINT112_ARRAY,
116
- UINT120_ARRAY,
117
- UINT128_ARRAY,
118
- UINT136_ARRAY,
119
- UINT144_ARRAY,
120
- UINT152_ARRAY,
121
- UINT160_ARRAY,
122
- UINT168_ARRAY,
123
- UINT176_ARRAY,
124
- UINT184_ARRAY,
125
- UINT192_ARRAY,
126
- UINT200_ARRAY,
127
- UINT208_ARRAY,
128
- UINT216_ARRAY,
129
- UINT224_ARRAY,
130
- UINT232_ARRAY,
131
- UINT240_ARRAY,
132
- UINT248_ARRAY,
133
- UINT256_ARRAY,
134
- INT8_ARRAY,
135
- INT16_ARRAY,
136
- INT24_ARRAY,
137
- INT32_ARRAY,
138
- INT40_ARRAY,
139
- INT48_ARRAY,
140
- INT56_ARRAY,
141
- INT64_ARRAY,
142
- INT72_ARRAY,
143
- INT80_ARRAY,
144
- INT88_ARRAY,
145
- INT96_ARRAY,
146
- INT104_ARRAY,
147
- INT112_ARRAY,
148
- INT120_ARRAY,
149
- INT128_ARRAY,
150
- INT136_ARRAY,
151
- INT144_ARRAY,
152
- INT152_ARRAY,
153
- INT160_ARRAY,
154
- INT168_ARRAY,
155
- INT176_ARRAY,
156
- INT184_ARRAY,
157
- INT192_ARRAY,
158
- INT200_ARRAY,
159
- INT208_ARRAY,
160
- INT216_ARRAY,
161
- INT224_ARRAY,
162
- INT232_ARRAY,
163
- INT240_ARRAY,
164
- INT248_ARRAY,
165
- INT256_ARRAY,
166
- BYTES1_ARRAY,
167
- BYTES2_ARRAY,
168
- BYTES3_ARRAY,
169
- BYTES4_ARRAY,
170
- BYTES5_ARRAY,
171
- BYTES6_ARRAY,
172
- BYTES7_ARRAY,
173
- BYTES8_ARRAY,
174
- BYTES9_ARRAY,
175
- BYTES10_ARRAY,
176
- BYTES11_ARRAY,
177
- BYTES12_ARRAY,
178
- BYTES13_ARRAY,
179
- BYTES14_ARRAY,
180
- BYTES15_ARRAY,
181
- BYTES16_ARRAY,
182
- BYTES17_ARRAY,
183
- BYTES18_ARRAY,
184
- BYTES19_ARRAY,
185
- BYTES20_ARRAY,
186
- BYTES21_ARRAY,
187
- BYTES22_ARRAY,
188
- BYTES23_ARRAY,
189
- BYTES24_ARRAY,
190
- BYTES25_ARRAY,
191
- BYTES26_ARRAY,
192
- BYTES27_ARRAY,
193
- BYTES28_ARRAY,
194
- BYTES29_ARRAY,
195
- BYTES30_ARRAY,
196
- BYTES31_ARRAY,
197
- BYTES32_ARRAY,
198
- BOOL_ARRAY,
199
- ADDRESS_ARRAY,
200
- BYTES,
201
- STRING,
202
- }