viem 2.21.34 → 2.21.36
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +26 -0
- package/_cjs/chains/definitions/base.js +5 -0
- package/_cjs/chains/definitions/base.js.map +1 -1
- package/_cjs/chains/definitions/genesys.js +24 -0
- package/_cjs/chains/definitions/genesys.js.map +1 -0
- package/_cjs/chains/definitions/iota.js +6 -0
- package/_cjs/chains/definitions/iota.js.map +1 -1
- package/_cjs/chains/definitions/meld.js +26 -0
- package/_cjs/chains/definitions/meld.js.map +1 -0
- package/_cjs/chains/definitions/morph.js +27 -0
- package/_cjs/chains/definitions/morph.js.map +1 -0
- package/_cjs/chains/definitions/that.js +22 -0
- package/_cjs/chains/definitions/that.js.map +1 -0
- package/_cjs/chains/definitions/tomb.js +22 -0
- package/_cjs/chains/definitions/tomb.js.map +1 -0
- package/_cjs/chains/definitions/unichainSepolia.js +18 -0
- package/_cjs/chains/definitions/unichainSepolia.js.map +1 -1
- package/_cjs/chains/definitions/velas.js +22 -0
- package/_cjs/chains/definitions/velas.js.map +1 -0
- package/_cjs/chains/definitions/worldchain.js +1 -0
- package/_cjs/chains/definitions/worldchain.js.map +1 -1
- package/_cjs/chains/definitions/worldchainSepolia.js +1 -0
- package/_cjs/chains/definitions/worldchainSepolia.js.map +1 -1
- package/_cjs/chains/index.js +19 -7
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/typedData.js +10 -1
- package/_cjs/errors/typedData.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js +5 -4
- package/_cjs/index.js.map +1 -1
- package/_cjs/op-stack/chains.js +3 -1
- package/_cjs/op-stack/chains.js.map +1 -1
- package/_cjs/utils/typedData.js +6 -2
- package/_cjs/utils/typedData.js.map +1 -1
- package/_esm/chains/definitions/base.js +5 -0
- package/_esm/chains/definitions/base.js.map +1 -1
- package/_esm/chains/definitions/genesys.js +21 -0
- package/_esm/chains/definitions/genesys.js.map +1 -0
- package/_esm/chains/definitions/iota.js +6 -0
- package/_esm/chains/definitions/iota.js.map +1 -1
- package/_esm/chains/definitions/meld.js +23 -0
- package/_esm/chains/definitions/meld.js.map +1 -0
- package/_esm/chains/definitions/morph.js +24 -0
- package/_esm/chains/definitions/morph.js.map +1 -0
- package/_esm/chains/definitions/that.js +19 -0
- package/_esm/chains/definitions/that.js.map +1 -0
- package/_esm/chains/definitions/tomb.js +19 -0
- package/_esm/chains/definitions/tomb.js.map +1 -0
- package/_esm/chains/definitions/unichainSepolia.js +18 -0
- package/_esm/chains/definitions/unichainSepolia.js.map +1 -1
- package/_esm/chains/definitions/velas.js +19 -0
- package/_esm/chains/definitions/velas.js.map +1 -0
- package/_esm/chains/definitions/worldchain.js +1 -0
- package/_esm/chains/definitions/worldchain.js.map +1 -1
- package/_esm/chains/definitions/worldchainSepolia.js +1 -0
- package/_esm/chains/definitions/worldchainSepolia.js.map +1 -1
- package/_esm/chains/index.js +6 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/typedData.js +8 -0
- package/_esm/errors/typedData.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/op-stack/chains.js +1 -0
- package/_esm/op-stack/chains.js.map +1 -1
- package/_esm/utils/typedData.js +7 -3
- package/_esm/utils/typedData.js.map +1 -1
- package/_types/chains/definitions/base.d.ts +5 -0
- package/_types/chains/definitions/base.d.ts.map +1 -1
- package/_types/chains/definitions/genesys.d.ts +37 -0
- package/_types/chains/definitions/genesys.d.ts.map +1 -0
- package/_types/chains/definitions/iota.d.ts +6 -10
- package/_types/chains/definitions/iota.d.ts.map +1 -1
- package/_types/chains/definitions/meld.d.ts +33 -0
- package/_types/chains/definitions/meld.d.ts.map +1 -0
- package/_types/chains/definitions/morph.d.ts +38 -0
- package/_types/chains/definitions/morph.d.ts.map +1 -0
- package/_types/chains/definitions/that.d.ts +37 -0
- package/_types/chains/definitions/that.d.ts.map +1 -0
- package/_types/chains/definitions/tomb.d.ts +37 -0
- package/_types/chains/definitions/tomb.d.ts.map +1 -0
- package/_types/chains/definitions/unichainSepolia.d.ts +267 -2
- package/_types/chains/definitions/unichainSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/velas.d.ts +37 -0
- package/_types/chains/definitions/velas.d.ts.map +1 -0
- package/_types/chains/definitions/worldchain.d.ts +234 -2
- package/_types/chains/definitions/worldchain.d.ts.map +1 -1
- package/_types/chains/definitions/worldchainSepolia.d.ts +234 -2
- package/_types/chains/definitions/worldchainSepolia.d.ts.map +1 -1
- package/_types/chains/index.d.ts +6 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/typedData.d.ts +10 -0
- package/_types/errors/typedData.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +1 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/op-stack/chains.d.ts +1 -0
- package/_types/op-stack/chains.d.ts.map +1 -1
- package/_types/utils/typedData.d.ts.map +1 -1
- package/chains/definitions/base.ts +5 -0
- package/chains/definitions/genesys.ts +21 -0
- package/chains/definitions/iota.ts +6 -0
- package/chains/definitions/meld.ts +23 -0
- package/chains/definitions/morph.ts +24 -0
- package/chains/definitions/that.ts +19 -0
- package/chains/definitions/tomb.ts +19 -0
- package/chains/definitions/unichainSepolia.ts +18 -0
- package/chains/definitions/velas.ts +19 -0
- package/chains/definitions/worldchain.ts +1 -0
- package/chains/definitions/worldchainSepolia.ts +1 -0
- package/chains/index.ts +6 -0
- package/errors/typedData.ts +20 -0
- package/errors/version.ts +1 -1
- package/index.ts +2 -0
- package/op-stack/chains.ts +1 -0
- package/package.json +1 -1
- package/utils/typedData.ts +8 -2
package/utils/typedData.ts
CHANGED
@@ -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 {
|
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')
|
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
|