viem 2.21.34 → 2.21.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/_cjs/chains/definitions/base.js +5 -0
  3. package/_cjs/chains/definitions/base.js.map +1 -1
  4. package/_cjs/chains/definitions/genesys.js +24 -0
  5. package/_cjs/chains/definitions/genesys.js.map +1 -0
  6. package/_cjs/chains/definitions/iota.js +6 -0
  7. package/_cjs/chains/definitions/iota.js.map +1 -1
  8. package/_cjs/chains/definitions/meld.js +26 -0
  9. package/_cjs/chains/definitions/meld.js.map +1 -0
  10. package/_cjs/chains/definitions/morph.js +27 -0
  11. package/_cjs/chains/definitions/morph.js.map +1 -0
  12. package/_cjs/chains/definitions/that.js +22 -0
  13. package/_cjs/chains/definitions/that.js.map +1 -0
  14. package/_cjs/chains/definitions/tomb.js +22 -0
  15. package/_cjs/chains/definitions/tomb.js.map +1 -0
  16. package/_cjs/chains/definitions/unichainSepolia.js +18 -0
  17. package/_cjs/chains/definitions/unichainSepolia.js.map +1 -1
  18. package/_cjs/chains/definitions/velas.js +22 -0
  19. package/_cjs/chains/definitions/velas.js.map +1 -0
  20. package/_cjs/chains/definitions/worldchain.js +1 -0
  21. package/_cjs/chains/definitions/worldchain.js.map +1 -1
  22. package/_cjs/chains/definitions/worldchainSepolia.js +1 -0
  23. package/_cjs/chains/definitions/worldchainSepolia.js.map +1 -1
  24. package/_cjs/chains/index.js +19 -7
  25. package/_cjs/chains/index.js.map +1 -1
  26. package/_cjs/errors/typedData.js +10 -1
  27. package/_cjs/errors/typedData.js.map +1 -1
  28. package/_cjs/errors/version.js +1 -1
  29. package/_cjs/index.js +5 -4
  30. package/_cjs/index.js.map +1 -1
  31. package/_cjs/op-stack/chains.js +3 -1
  32. package/_cjs/op-stack/chains.js.map +1 -1
  33. package/_cjs/utils/typedData.js +6 -2
  34. package/_cjs/utils/typedData.js.map +1 -1
  35. package/_esm/chains/definitions/base.js +5 -0
  36. package/_esm/chains/definitions/base.js.map +1 -1
  37. package/_esm/chains/definitions/genesys.js +21 -0
  38. package/_esm/chains/definitions/genesys.js.map +1 -0
  39. package/_esm/chains/definitions/iota.js +6 -0
  40. package/_esm/chains/definitions/iota.js.map +1 -1
  41. package/_esm/chains/definitions/meld.js +23 -0
  42. package/_esm/chains/definitions/meld.js.map +1 -0
  43. package/_esm/chains/definitions/morph.js +24 -0
  44. package/_esm/chains/definitions/morph.js.map +1 -0
  45. package/_esm/chains/definitions/that.js +19 -0
  46. package/_esm/chains/definitions/that.js.map +1 -0
  47. package/_esm/chains/definitions/tomb.js +19 -0
  48. package/_esm/chains/definitions/tomb.js.map +1 -0
  49. package/_esm/chains/definitions/unichainSepolia.js +18 -0
  50. package/_esm/chains/definitions/unichainSepolia.js.map +1 -1
  51. package/_esm/chains/definitions/velas.js +19 -0
  52. package/_esm/chains/definitions/velas.js.map +1 -0
  53. package/_esm/chains/definitions/worldchain.js +1 -0
  54. package/_esm/chains/definitions/worldchain.js.map +1 -1
  55. package/_esm/chains/definitions/worldchainSepolia.js +1 -0
  56. package/_esm/chains/definitions/worldchainSepolia.js.map +1 -1
  57. package/_esm/chains/index.js +6 -0
  58. package/_esm/chains/index.js.map +1 -1
  59. package/_esm/errors/typedData.js +8 -0
  60. package/_esm/errors/typedData.js.map +1 -1
  61. package/_esm/errors/version.js +1 -1
  62. package/_esm/index.js +1 -1
  63. package/_esm/index.js.map +1 -1
  64. package/_esm/op-stack/chains.js +1 -0
  65. package/_esm/op-stack/chains.js.map +1 -1
  66. package/_esm/utils/typedData.js +7 -3
  67. package/_esm/utils/typedData.js.map +1 -1
  68. package/_types/chains/definitions/base.d.ts +5 -0
  69. package/_types/chains/definitions/base.d.ts.map +1 -1
  70. package/_types/chains/definitions/genesys.d.ts +37 -0
  71. package/_types/chains/definitions/genesys.d.ts.map +1 -0
  72. package/_types/chains/definitions/iota.d.ts +6 -10
  73. package/_types/chains/definitions/iota.d.ts.map +1 -1
  74. package/_types/chains/definitions/meld.d.ts +33 -0
  75. package/_types/chains/definitions/meld.d.ts.map +1 -0
  76. package/_types/chains/definitions/morph.d.ts +38 -0
  77. package/_types/chains/definitions/morph.d.ts.map +1 -0
  78. package/_types/chains/definitions/that.d.ts +37 -0
  79. package/_types/chains/definitions/that.d.ts.map +1 -0
  80. package/_types/chains/definitions/tomb.d.ts +37 -0
  81. package/_types/chains/definitions/tomb.d.ts.map +1 -0
  82. package/_types/chains/definitions/unichainSepolia.d.ts +267 -2
  83. package/_types/chains/definitions/unichainSepolia.d.ts.map +1 -1
  84. package/_types/chains/definitions/velas.d.ts +37 -0
  85. package/_types/chains/definitions/velas.d.ts.map +1 -0
  86. package/_types/chains/definitions/worldchain.d.ts +234 -2
  87. package/_types/chains/definitions/worldchain.d.ts.map +1 -1
  88. package/_types/chains/definitions/worldchainSepolia.d.ts +234 -2
  89. package/_types/chains/definitions/worldchainSepolia.d.ts.map +1 -1
  90. package/_types/chains/index.d.ts +6 -0
  91. package/_types/chains/index.d.ts.map +1 -1
  92. package/_types/errors/typedData.d.ts +10 -0
  93. package/_types/errors/typedData.d.ts.map +1 -1
  94. package/_types/errors/version.d.ts +1 -1
  95. package/_types/index.d.ts +1 -1
  96. package/_types/index.d.ts.map +1 -1
  97. package/_types/op-stack/chains.d.ts +1 -0
  98. package/_types/op-stack/chains.d.ts.map +1 -1
  99. package/_types/utils/typedData.d.ts.map +1 -1
  100. package/chains/definitions/base.ts +5 -0
  101. package/chains/definitions/genesys.ts +21 -0
  102. package/chains/definitions/iota.ts +6 -0
  103. package/chains/definitions/meld.ts +23 -0
  104. package/chains/definitions/morph.ts +24 -0
  105. package/chains/definitions/that.ts +19 -0
  106. package/chains/definitions/tomb.ts +19 -0
  107. package/chains/definitions/unichainSepolia.ts +18 -0
  108. package/chains/definitions/velas.ts +19 -0
  109. package/chains/definitions/worldchain.ts +1 -0
  110. package/chains/definitions/worldchainSepolia.ts +1 -0
  111. package/chains/index.ts +6 -0
  112. package/errors/typedData.ts +20 -0
  113. package/errors/version.ts +1 -1
  114. package/index.ts +2 -0
  115. package/op-stack/chains.ts +1 -0
  116. package/package.json +1 -1
  117. package/utils/typedData.ts +8 -2
@@ -2,7 +2,10 @@ import type { TypedData, TypedDataDomain, TypedDataParameter } from 'abitype'
2
2
 
3
3
  import { BytesSizeMismatchError } from '../errors/abi.js'
4
4
  import { InvalidAddressError } from '../errors/address.js'
5
- import { InvalidStructTypeError } from '../errors/typedData.js'
5
+ import {
6
+ InvalidPrimaryTypeError,
7
+ InvalidStructTypeError,
8
+ } from '../errors/typedData.js'
6
9
  import type { ErrorType } from '../errors/utils.js'
7
10
  import type { Hex } from '../types/misc.js'
8
11
  import type { TypedDataDefinition } from '../types/typedData.js'
@@ -121,7 +124,10 @@ export function validateTypedData<
121
124
  if (types.EIP712Domain && domain) validateData(types.EIP712Domain, domain)
122
125
 
123
126
  // Validate message types.
124
- if (primaryType !== 'EIP712Domain') validateData(types[primaryType], message)
127
+ if (primaryType !== 'EIP712Domain') {
128
+ if (types[primaryType]) validateData(types[primaryType], message)
129
+ else throw new InvalidPrimaryTypeError({ primaryType, types })
130
+ }
125
131
  }
126
132
 
127
133
  export type GetTypesForEIP712DomainErrorType = ErrorType