viem 2.39.0 → 2.39.3
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.
- package/CHANGELOG.md +26 -0
- package/_cjs/chains/definitions/etherlinkShadownetTestnet.js +24 -0
- package/_cjs/chains/definitions/etherlinkShadownetTestnet.js.map +1 -0
- package/_cjs/chains/definitions/jasmyChain.js +18 -0
- package/_cjs/chains/definitions/jasmyChain.js.map +1 -0
- package/_cjs/chains/definitions/jasmyChainTestnet.js +18 -0
- package/_cjs/chains/definitions/jasmyChainTestnet.js.map +1 -0
- package/_cjs/chains/definitions/monad.js +27 -0
- package/_cjs/chains/definitions/monad.js.map +1 -0
- package/_cjs/chains/definitions/potosTestnet.js +26 -0
- package/_cjs/chains/definitions/potosTestnet.js.map +1 -0
- package/_cjs/chains/index.js +21 -11
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/createClient.js +1 -0
- package/_cjs/clients/createClient.js.map +1 -1
- package/_cjs/clients/transports/createTransport.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/utils/errors/getContractError.js +5 -2
- package/_cjs/utils/errors/getContractError.js.map +1 -1
- package/_cjs/utils/signature/hashTypedData.js +4 -7
- package/_cjs/utils/signature/hashTypedData.js.map +1 -1
- package/_cjs/utils/typedData.js +1 -1
- package/_cjs/utils/typedData.js.map +1 -1
- package/_esm/chains/definitions/etherlinkShadownetTestnet.js +21 -0
- package/_esm/chains/definitions/etherlinkShadownetTestnet.js.map +1 -0
- package/_esm/chains/definitions/jasmyChain.js +15 -0
- package/_esm/chains/definitions/jasmyChain.js.map +1 -0
- package/_esm/chains/definitions/jasmyChainTestnet.js +15 -0
- package/_esm/chains/definitions/jasmyChainTestnet.js.map +1 -0
- package/_esm/chains/definitions/monad.js +24 -0
- package/_esm/chains/definitions/monad.js.map +1 -0
- package/_esm/chains/definitions/potosTestnet.js +23 -0
- package/_esm/chains/definitions/potosTestnet.js.map +1 -0
- package/_esm/chains/index.js +5 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/createClient.js +1 -0
- package/_esm/clients/createClient.js.map +1 -1
- package/_esm/clients/transports/createTransport.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/utils/errors/getContractError.js +6 -3
- package/_esm/utils/errors/getContractError.js.map +1 -1
- package/_esm/utils/signature/hashTypedData.js +4 -7
- package/_esm/utils/signature/hashTypedData.js.map +1 -1
- package/_esm/utils/typedData.js +1 -1
- package/_esm/utils/typedData.js.map +1 -1
- package/_types/chains/definitions/etherlinkShadownetTestnet.d.ts +39 -0
- package/_types/chains/definitions/etherlinkShadownetTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/jasmyChain.d.ts +47 -0
- package/_types/chains/definitions/jasmyChain.d.ts.map +1 -0
- package/_types/chains/definitions/jasmyChainTestnet.d.ts +47 -0
- package/_types/chains/definitions/jasmyChainTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/monad.d.ts +39 -0
- package/_types/chains/definitions/monad.d.ts.map +1 -0
- package/_types/chains/definitions/potosTestnet.d.ts +39 -0
- package/_types/chains/definitions/potosTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +5 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/createClient.d.ts.map +1 -1
- package/_types/clients/transports/createTransport.d.ts +2 -0
- package/_types/clients/transports/createTransport.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/types/typedData.d.ts +5 -5
- package/_types/types/typedData.d.ts.map +1 -1
- package/_types/utils/errors/getContractError.d.ts.map +1 -1
- package/_types/utils/signature/hashTypedData.d.ts +5 -11
- package/_types/utils/signature/hashTypedData.d.ts.map +1 -1
- package/chains/definitions/etherlinkShadownetTestnet.ts +21 -0
- package/chains/definitions/jasmyChain.ts +15 -0
- package/chains/definitions/jasmyChainTestnet.ts +15 -0
- package/chains/definitions/monad.ts +24 -0
- package/chains/definitions/potosTestnet.ts +23 -0
- package/chains/index.ts +5 -0
- package/clients/createClient.ts +1 -0
- package/clients/transports/createTransport.ts +2 -0
- package/errors/version.ts +1 -1
- package/index.ts +5 -1
- package/package.json +1 -1
- package/types/typedData.ts +6 -4
- package/utils/errors/getContractError.ts +6 -3
- package/utils/signature/hashTypedData.ts +21 -22
- package/utils/typedData.ts +1 -1
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type { TypedData, TypedDataDomain, TypedDataToPrimitiveTypes } from 'abitype';
|
|
2
2
|
import type { Prettify } from './utils.js';
|
|
3
|
-
export type TypedDataDefinition<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData, primaryTypes = typedData extends TypedData ? keyof typedData : string> = primaryType extends 'EIP712Domain' ? EIP712DomainDefinition<typedData, primaryType> : MessageDefinition<typedData, primaryType, primaryTypes>;
|
|
4
|
-
type MessageDefinition<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData = keyof typedData, primaryTypes = typedData extends TypedData ? keyof typedData : string, schema extends Record<string, unknown> = typedData extends TypedData ? TypedDataToPrimitiveTypes<typedData> : Record<string, unknown>, message = schema[primaryType extends keyof schema ? primaryType : keyof schema]> = {
|
|
3
|
+
export type TypedDataDefinition<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData, primaryTypes = typedData extends TypedData ? keyof typedData : string> = primaryType extends 'EIP712Domain' ? EIP712DomainDefinition<typedData, primaryType> : MessageDefinition<typedData, primaryType, 'message', primaryTypes>;
|
|
4
|
+
export type MessageDefinition<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData = keyof typedData, messageKey extends string = 'message', primaryTypes = typedData extends TypedData ? keyof typedData : string, schema extends Record<string, unknown> = typedData extends TypedData ? TypedDataToPrimitiveTypes<typedData> : Record<string, unknown>, message = schema[primaryType extends keyof schema ? primaryType : keyof schema]> = {
|
|
5
5
|
types: typedData;
|
|
6
6
|
} & {
|
|
7
7
|
primaryType: primaryTypes | (primaryType extends primaryTypes ? primaryType : never);
|
|
8
8
|
domain?: (schema extends {
|
|
9
9
|
EIP712Domain: infer domain;
|
|
10
10
|
} ? domain : Prettify<TypedDataDomain>) | undefined;
|
|
11
|
-
|
|
11
|
+
} & {
|
|
12
|
+
[k in messageKey]: {
|
|
12
13
|
[_: string]: any;
|
|
13
14
|
} extends message ? Record<string, unknown> : message;
|
|
14
15
|
};
|
|
15
|
-
type EIP712DomainDefinition<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends 'EIP712Domain' = 'EIP712Domain', schema extends Record<string, unknown> = typedData extends TypedData ? TypedDataToPrimitiveTypes<typedData> : Record<string, unknown>> = {
|
|
16
|
+
export type EIP712DomainDefinition<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends 'EIP712Domain' = 'EIP712Domain', schema extends Record<string, unknown> = typedData extends TypedData ? TypedDataToPrimitiveTypes<typedData> : Record<string, unknown>> = {
|
|
16
17
|
types?: typedData | undefined;
|
|
17
18
|
} & {
|
|
18
19
|
primaryType: 'EIP712Domain' | primaryType;
|
|
@@ -21,5 +22,4 @@ type EIP712DomainDefinition<typedData extends TypedData | Record<string, unknown
|
|
|
21
22
|
} ? domain : Prettify<TypedDataDomain>;
|
|
22
23
|
message?: undefined;
|
|
23
24
|
};
|
|
24
|
-
export {};
|
|
25
25
|
//# sourceMappingURL=typedData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typedData.d.ts","sourceRoot":"","sources":["../../types/typedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C,MAAM,MAAM,mBAAmB,CAC7B,SAAS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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getContractError.d.ts","sourceRoot":"","sources":["../../../utils/errors/getContractError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAI3C,OAAO,EAEL,KAAK,kCAAkC,EAEvC,KAAK,iCAAiC,EAEtC,KAAK,iCAAiC,EAEvC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAItD,MAAM,MAAM,0BAA0B,CAAC,KAAK,GAAG,SAAS,IAAI,IAAI,CAC9D,kCAAkC,EAClC,OAAO,CACR,GAAG;IACF,KAAK,EACD,KAAK,GACL,iCAAiC,GACjC,iCAAiC,CAAA;CACtC,CAAA;AAED,wBAAgB,gBAAgB,CAAC,GAAG,SAAS,SAAS,CAAC,MAAM,CAAC,EAC5D,GAAG,EAAE,GAAG,EACR,EACE,GAAG,EACH,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,MAAM,GACP,EAAE;IACD,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,GAAG,CAAA;IACT,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC7B,GACA,0BAA0B,
|
|
1
|
+
{"version":3,"file":"getContractError.d.ts","sourceRoot":"","sources":["../../../utils/errors/getContractError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAI3C,OAAO,EAEL,KAAK,kCAAkC,EAEvC,KAAK,iCAAiC,EAEtC,KAAK,iCAAiC,EAEvC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAItD,MAAM,MAAM,0BAA0B,CAAC,KAAK,GAAG,SAAS,IAAI,IAAI,CAC9D,kCAAkC,EAClC,OAAO,CACR,GAAG;IACF,KAAK,EACD,KAAK,GACL,iCAAiC,GACjC,iCAAiC,CAAA;CACtC,CAAA;AAED,wBAAgB,gBAAgB,CAAC,GAAG,SAAS,SAAS,CAAC,MAAM,CAAC,EAC5D,GAAG,EAAE,GAAG,EACR,EACE,GAAG,EACH,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,MAAM,GACP,EAAE;IACD,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,GAAG,CAAA;IACT,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC7B,GACA,0BAA0B,CA0C5B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { TypedData
|
|
1
|
+
import type { TypedData } from 'abitype';
|
|
2
2
|
import type { ErrorType } from '../../errors/utils.js';
|
|
3
3
|
import type { Hex } from '../../types/misc.js';
|
|
4
|
-
import type { TypedDataDefinition } from '../../types/typedData.js';
|
|
4
|
+
import type { EIP712DomainDefinition, MessageDefinition, TypedDataDefinition } from '../../types/typedData.js';
|
|
5
|
+
import type { UnionOmit } from '../../types/utils.js';
|
|
5
6
|
import { type EncodeAbiParametersErrorType } from '../abi/encodeAbiParameters.js';
|
|
6
7
|
import { type ToHexErrorType } from '../encoding/toHex.js';
|
|
7
8
|
import { type Keccak256ErrorType } from '../hash/keccak256.js';
|
|
@@ -15,16 +16,9 @@ export type HashTypedDataReturnType = Hex;
|
|
|
15
16
|
export type HashTypedDataErrorType = GetTypesForEIP712DomainErrorType | HashDomainErrorType | HashStructErrorType | ValidateTypedDataErrorType | ErrorType;
|
|
16
17
|
export declare function hashTypedData<const typedData extends TypedData | Record<string, unknown>, primaryType extends keyof typedData | 'EIP712Domain'>(parameters: HashTypedDataParameters<typedData, primaryType>): HashTypedDataReturnType;
|
|
17
18
|
export type HashDomainErrorType = HashStructErrorType | ErrorType;
|
|
18
|
-
export declare function hashDomain({ domain, types, }: {
|
|
19
|
-
domain: TypedDataDomain;
|
|
20
|
-
types: Record<string, MessageTypeProperty[]>;
|
|
21
|
-
}): `0x${string}`;
|
|
19
|
+
export declare function hashDomain<const typedData extends TypedData | Record<string, unknown> = TypedData>({ domain, types, }: UnionOmit<EIP712DomainDefinition<typedData>, 'primaryType'>): `0x${string}`;
|
|
22
20
|
export type HashStructErrorType = EncodeDataErrorType | Keccak256ErrorType | ErrorType;
|
|
23
|
-
export declare function hashStruct({ data, primaryType, types, }: {
|
|
24
|
-
data: Record<string, unknown>;
|
|
25
|
-
primaryType: string;
|
|
26
|
-
types: Record<string, readonly MessageTypeProperty[]>;
|
|
27
|
-
}): `0x${string}`;
|
|
21
|
+
export declare function hashStruct<const typedData extends TypedData | Record<string, unknown>, primaryType extends keyof typedData | 'EIP712Domain'>({ data, primaryType, types, }: MessageDefinition<typedData, primaryType, 'data'>): `0x${string}`;
|
|
28
22
|
type EncodeDataErrorType = EncodeAbiParametersErrorType | EncodeFieldErrorType | HashTypeErrorType | ErrorType;
|
|
29
23
|
type HashTypeErrorType = ToHexErrorType | EncodeTypeErrorType | Keccak256ErrorType | ErrorType;
|
|
30
24
|
type EncodeTypeErrorType = FindTypeDependenciesErrorType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashTypedData.d.ts","sourceRoot":"","sources":["../../../utils/signature/hashTypedData.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"hashTypedData.d.ts","sourceRoot":"","sources":["../../../utils/signature/hashTypedData.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,SAAS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,GAAG,mBAAmB,GAAG,SAAS,CAAA;AAEjE,wBAAgB,UAAU,CACxB,KAAK,CAAC,SAAS,SAAS,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACvE,EACA,MAAM,EACN,KAAK,GACN,EAAE,SAAS,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC,iBAM7D;AAED,MAAM,MAAM,mBAAmB,GAC3B,mBAAmB,GACnB,kBAAkB,GAClB,SAAS,CAAA;AAEb,wBAAgB,UAAU,CACxB,KAAK,CAAC,SAAS,SAAS,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,WAAW,SAAS,MAAM,SAAS,GAAG,cAAc,EACpD,EACA,IAAI,EACJ,WAAW,EACX,KAAK,GACN,EAAE,iBAAiB,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,CAAC,iBAOnD;AAED,KAAK,mBAAmB,GACpB,4BAA4B,GAC5B,oBAAoB,GACpB,iBAAiB,GACjB,SAAS,CAAA;AA4Bb,KAAK,iBAAiB,GAClB,cAAc,GACd,mBAAmB,GACnB,kBAAkB,GAClB,SAAS,CAAA;AAab,KAAK,mBAAmB,GAAG,6BAA6B,CAAA;AAExD,wBAAgB,UAAU,CAAC,EACzB,WAAW,EACX,KAAK,GACN,EAAE;IACD,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC,CAAA;CACtD,UAaA;AAED,KAAK,6BAA6B,GAAG,SAAS,CAAA;AA0B9C,KAAK,oBAAoB,GACrB,kBAAkB,GAClB,4BAA4B,GAC5B,cAAc,GACd,SAAS,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const etherlinkShadownetTestnet = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 127823,
|
|
5
|
+
name: 'Etherlink Shadownet Testnet',
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
decimals: 18,
|
|
8
|
+
name: 'tez',
|
|
9
|
+
symbol: 'XTZ',
|
|
10
|
+
},
|
|
11
|
+
rpcUrls: {
|
|
12
|
+
default: { http: ['https://node.shadownet.etherlink.com'] },
|
|
13
|
+
},
|
|
14
|
+
blockExplorers: {
|
|
15
|
+
default: {
|
|
16
|
+
name: 'Etherlink Shadownet Testnet Explorer',
|
|
17
|
+
url: 'https://shadownet.explorer.etherlink.com',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
testnet: true,
|
|
21
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const jasmyChain = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 680,
|
|
5
|
+
name: 'Jasmy Chain',
|
|
6
|
+
network: 'jasmyChain',
|
|
7
|
+
nativeCurrency: { name: 'JasmyCoin', symbol: 'JASMY', decimals: 18 },
|
|
8
|
+
rpcUrls: {
|
|
9
|
+
default: {
|
|
10
|
+
http: ['https://rpc.jasmychain.io'],
|
|
11
|
+
webSocket: ['wss://rpc.jasmychain.io'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
testnet: false,
|
|
15
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const jasmyChainTestnet = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 681,
|
|
5
|
+
name: 'Jasmy Chain Testnet',
|
|
6
|
+
network: 'jasmyChainTestnet',
|
|
7
|
+
nativeCurrency: { name: 'JasmyCoin', symbol: 'JASMY', decimals: 18 },
|
|
8
|
+
rpcUrls: {
|
|
9
|
+
default: {
|
|
10
|
+
http: ['https://rpc_testnet.jasmychain.io'],
|
|
11
|
+
webSocket: ['wss://rpc_testnet.jasmychain.io'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
testnet: true,
|
|
15
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const monad = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 143,
|
|
5
|
+
name: 'Monad',
|
|
6
|
+
blockTime: 400,
|
|
7
|
+
nativeCurrency: {
|
|
8
|
+
name: 'Monad',
|
|
9
|
+
symbol: 'MON',
|
|
10
|
+
decimals: 18,
|
|
11
|
+
},
|
|
12
|
+
rpcUrls: {
|
|
13
|
+
default: {
|
|
14
|
+
http: ['https://rpc.monad.xyz'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
blockExplorers: {
|
|
18
|
+
default: {
|
|
19
|
+
name: 'Monvision',
|
|
20
|
+
url: 'https://mainnet-beta.monvision.io',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
testnet: false,
|
|
24
|
+
})
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const potosTestnet = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 60600,
|
|
5
|
+
name: 'POTOS Testnet',
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
decimals: 18,
|
|
8
|
+
name: 'POTOS Token',
|
|
9
|
+
symbol: 'POT',
|
|
10
|
+
},
|
|
11
|
+
rpcUrls: {
|
|
12
|
+
default: {
|
|
13
|
+
http: ['https://rpc-testnet.potos.hk'],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
blockExplorers: {
|
|
17
|
+
default: {
|
|
18
|
+
name: 'POTOS Testnet explorer',
|
|
19
|
+
url: 'https://scan-testnet.potos.hk',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
testnet: true,
|
|
23
|
+
})
|
package/chains/index.ts
CHANGED
|
@@ -180,6 +180,7 @@ export { eos } from './definitions/eos.js'
|
|
|
180
180
|
export { eosTestnet } from './definitions/eosTestnet.js'
|
|
181
181
|
export { eteria } from './definitions/eteria.js'
|
|
182
182
|
export { etherlink } from './definitions/etherlink.js'
|
|
183
|
+
export { etherlinkShadownetTestnet } from './definitions/etherlinkShadownetTestnet.js'
|
|
183
184
|
export { etherlinkTestnet } from './definitions/etherlinkTestnet.js'
|
|
184
185
|
export { ethernity } from './definitions/ethernity.js'
|
|
185
186
|
export { etp } from './definitions/etp.js'
|
|
@@ -286,6 +287,8 @@ export { iotaTestnet } from './definitions/iotaTestnet.js'
|
|
|
286
287
|
export { iotex } from './definitions/iotex.js'
|
|
287
288
|
export { iotexTestnet } from './definitions/iotexTestnet.js'
|
|
288
289
|
export { iSunCoin } from './definitions/iSunCoin.js'
|
|
290
|
+
export { jasmyChain } from './definitions/jasmyChain.js'
|
|
291
|
+
export { jasmyChainTestnet } from './definitions/jasmyChainTestnet.js'
|
|
289
292
|
export { jbc } from './definitions/jbc.js'
|
|
290
293
|
export { jbcTestnet } from './definitions/jbcTestnet.js'
|
|
291
294
|
export { jocMainnet } from './definitions/jocMainnet.js'
|
|
@@ -390,6 +393,7 @@ export { mintSepoliaTestnet } from './definitions/mintSepoliaTestnet.js'
|
|
|
390
393
|
export { mitosisTestnet } from './definitions/mitosisTestnet.js'
|
|
391
394
|
export { mode } from './definitions/mode.js'
|
|
392
395
|
export { modeTestnet } from './definitions/modeTestnet.js'
|
|
396
|
+
export { monad } from './definitions/monad.js'
|
|
393
397
|
export { monadTestnet } from './definitions/monadTestnet.js'
|
|
394
398
|
export { moonbaseAlpha } from './definitions/moonbaseAlpha.js'
|
|
395
399
|
export { moonbeam } from './definitions/moonbeam.js'
|
|
@@ -463,6 +467,7 @@ export { polygonZkEvmTestnet } from './definitions/polygonZkEvmTestnet.js'
|
|
|
463
467
|
export { polynomial } from './definitions/polynomial.js'
|
|
464
468
|
export { polynomialSepolia } from './definitions/polynomialSepolia.js'
|
|
465
469
|
export { potos } from './definitions/potos.js'
|
|
470
|
+
export { potosTestnet } from './definitions/potosTestnet.js'
|
|
466
471
|
export { premiumBlockTestnet } from './definitions/premiumBlock.js'
|
|
467
472
|
export { pulsechain } from './definitions/pulsechain.js'
|
|
468
473
|
export { pulsechainV4 } from './definitions/pulsechainV4.js'
|
package/clients/createClient.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ErrorType } from '../../errors/utils.js'
|
|
2
|
+
import type { Account } from '../../types/account.js'
|
|
2
3
|
import type { Chain } from '../../types/chain.js'
|
|
3
4
|
import type { EIP1193RequestFn } from '../../types/eip1193.js'
|
|
4
5
|
import type { OneOf } from '../../types/utils.js'
|
|
@@ -44,6 +45,7 @@ export type Transport<
|
|
|
44
45
|
> = <chain extends Chain | undefined = Chain>({
|
|
45
46
|
chain,
|
|
46
47
|
}: {
|
|
48
|
+
account?: Account | undefined
|
|
47
49
|
chain?: chain | undefined
|
|
48
50
|
pollingInterval?: ClientConfig['pollingInterval'] | undefined
|
|
49
51
|
retryCount?: TransportConfig['retryCount'] | undefined
|
package/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.39.
|
|
1
|
+
export const version = '2.39.3'
|
package/index.ts
CHANGED
|
@@ -1227,7 +1227,11 @@ export type {
|
|
|
1227
1227
|
TransactionType,
|
|
1228
1228
|
} from './types/transaction.js'
|
|
1229
1229
|
export type { GetPollOptions, GetTransportConfig } from './types/transport.js'
|
|
1230
|
-
export type {
|
|
1230
|
+
export type {
|
|
1231
|
+
EIP712DomainDefinition,
|
|
1232
|
+
MessageDefinition,
|
|
1233
|
+
TypedDataDefinition,
|
|
1234
|
+
} from './types/typedData.js'
|
|
1231
1235
|
export type {
|
|
1232
1236
|
Assign,
|
|
1233
1237
|
Branded,
|
package/package.json
CHANGED
package/types/typedData.ts
CHANGED
|
@@ -13,11 +13,12 @@ export type TypedDataDefinition<
|
|
|
13
13
|
primaryTypes = typedData extends TypedData ? keyof typedData : string,
|
|
14
14
|
> = primaryType extends 'EIP712Domain'
|
|
15
15
|
? EIP712DomainDefinition<typedData, primaryType>
|
|
16
|
-
: MessageDefinition<typedData, primaryType, primaryTypes>
|
|
16
|
+
: MessageDefinition<typedData, primaryType, 'message', primaryTypes>
|
|
17
17
|
|
|
18
|
-
type MessageDefinition<
|
|
18
|
+
export type MessageDefinition<
|
|
19
19
|
typedData extends TypedData | Record<string, unknown> = TypedData,
|
|
20
20
|
primaryType extends keyof typedData = keyof typedData,
|
|
21
|
+
messageKey extends string = 'message',
|
|
21
22
|
///
|
|
22
23
|
primaryTypes = typedData extends TypedData ? keyof typedData : string,
|
|
23
24
|
schema extends Record<string, unknown> = typedData extends TypedData
|
|
@@ -37,12 +38,13 @@ type MessageDefinition<
|
|
|
37
38
|
? domain
|
|
38
39
|
: Prettify<TypedDataDomain>)
|
|
39
40
|
| undefined
|
|
40
|
-
|
|
41
|
+
} & {
|
|
42
|
+
[k in messageKey]: { [_: string]: any } extends message // Check if message was inferred
|
|
41
43
|
? Record<string, unknown>
|
|
42
44
|
: message
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
type EIP712DomainDefinition<
|
|
47
|
+
export type EIP712DomainDefinition<
|
|
46
48
|
typedData extends TypedData | Record<string, unknown> = TypedData,
|
|
47
49
|
primaryType extends 'EIP712Domain' = 'EIP712Domain',
|
|
48
50
|
///
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
RawContractError,
|
|
13
13
|
} from '../../errors/contract.js'
|
|
14
14
|
import { RpcRequestError } from '../../errors/request.js'
|
|
15
|
-
import { InternalRpcError } from '../../errors/rpc.js'
|
|
15
|
+
import { InternalRpcError, InvalidInputRpcError } from '../../errors/rpc.js'
|
|
16
16
|
import type { ErrorType } from '../../errors/utils.js'
|
|
17
17
|
|
|
18
18
|
const EXECUTION_REVERTED_ERROR_CODE = 3
|
|
@@ -59,8 +59,11 @@ export function getContractError<err extends ErrorType<string>>(
|
|
|
59
59
|
if (err instanceof AbiDecodingZeroDataError)
|
|
60
60
|
return new ContractFunctionZeroDataError({ functionName })
|
|
61
61
|
if (
|
|
62
|
-
[EXECUTION_REVERTED_ERROR_CODE, InternalRpcError.code].includes(code) &&
|
|
63
|
-
|
|
62
|
+
([EXECUTION_REVERTED_ERROR_CODE, InternalRpcError.code].includes(code) &&
|
|
63
|
+
(data || details || message || shortMessage)) ||
|
|
64
|
+
(code === InvalidInputRpcError.code &&
|
|
65
|
+
details === 'execution reverted' &&
|
|
66
|
+
data)
|
|
64
67
|
) {
|
|
65
68
|
return new ContractFunctionRevertedError({
|
|
66
69
|
abi,
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
// Implementation forked and adapted from https://github.com/MetaMask/eth-sig-util/blob/main/src/sign-typed-data.ts
|
|
2
2
|
|
|
3
|
-
import type { AbiParameter, TypedData
|
|
3
|
+
import type { AbiParameter, TypedData } from 'abitype'
|
|
4
4
|
|
|
5
5
|
import type { ErrorType } from '../../errors/utils.js'
|
|
6
6
|
import type { Hex } from '../../types/misc.js'
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
EIP712DomainDefinition,
|
|
9
|
+
MessageDefinition,
|
|
10
|
+
TypedDataDefinition,
|
|
11
|
+
} from '../../types/typedData.js'
|
|
12
|
+
import type { UnionOmit } from '../../types/utils.js'
|
|
8
13
|
import {
|
|
9
14
|
type EncodeAbiParametersErrorType,
|
|
10
15
|
encodeAbiParameters,
|
|
@@ -86,17 +91,16 @@ export function hashTypedData<
|
|
|
86
91
|
|
|
87
92
|
export type HashDomainErrorType = HashStructErrorType | ErrorType
|
|
88
93
|
|
|
89
|
-
export function hashDomain
|
|
94
|
+
export function hashDomain<
|
|
95
|
+
const typedData extends TypedData | Record<string, unknown> = TypedData,
|
|
96
|
+
>({
|
|
90
97
|
domain,
|
|
91
98
|
types,
|
|
92
|
-
}: {
|
|
93
|
-
domain: TypedDataDomain
|
|
94
|
-
types: Record<string, MessageTypeProperty[]>
|
|
95
|
-
}) {
|
|
99
|
+
}: UnionOmit<EIP712DomainDefinition<typedData>, 'primaryType'>) {
|
|
96
100
|
return hashStruct({
|
|
97
|
-
data: domain,
|
|
101
|
+
data: domain as Record<string, unknown>,
|
|
98
102
|
primaryType: 'EIP712Domain',
|
|
99
|
-
types,
|
|
103
|
+
types: types as Record<string, readonly MessageTypeProperty[]>,
|
|
100
104
|
})
|
|
101
105
|
}
|
|
102
106
|
|
|
@@ -105,19 +109,18 @@ export type HashStructErrorType =
|
|
|
105
109
|
| Keccak256ErrorType
|
|
106
110
|
| ErrorType
|
|
107
111
|
|
|
108
|
-
export function hashStruct
|
|
112
|
+
export function hashStruct<
|
|
113
|
+
const typedData extends TypedData | Record<string, unknown>,
|
|
114
|
+
primaryType extends keyof typedData | 'EIP712Domain',
|
|
115
|
+
>({
|
|
109
116
|
data,
|
|
110
117
|
primaryType,
|
|
111
118
|
types,
|
|
112
|
-
}: {
|
|
113
|
-
data: Record<string, unknown>
|
|
114
|
-
primaryType: string
|
|
115
|
-
types: Record<string, readonly MessageTypeProperty[]>
|
|
116
|
-
}) {
|
|
119
|
+
}: MessageDefinition<typedData, primaryType, 'data'>) {
|
|
117
120
|
const encoded = encodeData({
|
|
118
|
-
data,
|
|
121
|
+
data: data as Record<string, unknown>,
|
|
119
122
|
primaryType,
|
|
120
|
-
types,
|
|
123
|
+
types: types as Record<string, readonly MessageTypeProperty[]>,
|
|
121
124
|
})
|
|
122
125
|
return keccak256(encoded)
|
|
123
126
|
}
|
|
@@ -244,11 +247,7 @@ function encodeField({
|
|
|
244
247
|
]
|
|
245
248
|
}
|
|
246
249
|
|
|
247
|
-
if (type === 'bytes') {
|
|
248
|
-
const prepend = value.length % 2 ? '0' : ''
|
|
249
|
-
value = `0x${prepend + value.slice(2)}`
|
|
250
|
-
return [{ type: 'bytes32' }, keccak256(value)]
|
|
251
|
-
}
|
|
250
|
+
if (type === 'bytes') return [{ type: 'bytes32' }, keccak256(value)]
|
|
252
251
|
|
|
253
252
|
if (type === 'string') return [{ type: 'bytes32' }, keccak256(toHex(value))]
|
|
254
253
|
|
package/utils/typedData.ts
CHANGED
|
@@ -164,7 +164,7 @@ export type DomainSeparatorErrorType =
|
|
|
164
164
|
|
|
165
165
|
export function domainSeparator({ domain }: { domain: TypedDataDomain }): Hex {
|
|
166
166
|
return hashDomain({
|
|
167
|
-
domain,
|
|
167
|
+
domain: domain as never,
|
|
168
168
|
types: {
|
|
169
169
|
EIP712Domain: getTypesForEIP712Domain({ domain }),
|
|
170
170
|
},
|