viem 2.0.0-alpha.7 → 2.0.0-alpha.8

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 (40) hide show
  1. package/_cjs/actions/public/multicall.js.map +1 -1
  2. package/_cjs/chains/definitions/kroma.js +26 -0
  3. package/_cjs/chains/definitions/kroma.js.map +1 -0
  4. package/_cjs/chains/definitions/kromaSepolia.js +26 -0
  5. package/_cjs/chains/definitions/kromaSepolia.js.map +1 -0
  6. package/_cjs/chains/index.js +6 -2
  7. package/_cjs/chains/index.js.map +1 -1
  8. package/_cjs/errors/node.js +11 -11
  9. package/_cjs/errors/node.js.map +1 -1
  10. package/_cjs/errors/rpc.js +18 -18
  11. package/_cjs/errors/rpc.js.map +1 -1
  12. package/_cjs/errors/version.js +1 -1
  13. package/_esm/actions/public/multicall.js.map +1 -1
  14. package/_esm/chains/definitions/kroma.js +23 -0
  15. package/_esm/chains/definitions/kroma.js.map +1 -0
  16. package/_esm/chains/definitions/kromaSepolia.js +23 -0
  17. package/_esm/chains/definitions/kromaSepolia.js.map +1 -0
  18. package/_esm/chains/index.js +2 -0
  19. package/_esm/chains/index.js.map +1 -1
  20. package/_esm/errors/node.js +22 -11
  21. package/_esm/errors/node.js.map +1 -1
  22. package/_esm/errors/rpc.js +36 -18
  23. package/_esm/errors/rpc.js.map +1 -1
  24. package/_esm/errors/version.js +1 -1
  25. package/_types/chains/definitions/kroma.d.ts +29 -0
  26. package/_types/chains/definitions/kroma.d.ts.map +1 -0
  27. package/_types/chains/definitions/kromaSepolia.d.ts +29 -0
  28. package/_types/chains/definitions/kromaSepolia.d.ts.map +1 -0
  29. package/_types/chains/index.d.ts +2 -0
  30. package/_types/chains/index.d.ts.map +1 -1
  31. package/_types/errors/version.d.ts +1 -1
  32. package/_types/types/multicall.d.ts +9 -3
  33. package/_types/types/multicall.d.ts.map +1 -1
  34. package/actions/public/multicall.ts +1 -1
  35. package/chains/definitions/kroma.ts +23 -0
  36. package/chains/definitions/kromaSepolia.ts +23 -0
  37. package/chains/index.ts +2 -0
  38. package/errors/version.ts +1 -1
  39. package/package.json +1 -1
  40. package/types/multicall.ts +39 -7
@@ -22,9 +22,15 @@ export type MulticallResults<contracts extends readonly unknown[] = readonly Con
22
22
  } = {
23
23
  error: Error;
24
24
  mutability: AbiStateMutability;
25
- }> = {
26
- [index in keyof contracts]: MulticallResponse<GetMulticallContractReturnType<contracts[index], options['mutability']>, options['error'], allowFailure>;
27
- };
25
+ }, result extends any[] = []> = contracts extends readonly [] ? [] : contracts extends readonly [infer contract] ? [
26
+ ...result,
27
+ MulticallResponse<GetMulticallContractReturnType<contract, options['mutability']>, options['error'], allowFailure>
28
+ ] : contracts extends readonly [infer contract, ...infer rest] ? MulticallResults<[
29
+ ...rest
30
+ ], allowFailure, options, [
31
+ ...result,
32
+ MulticallResponse<GetMulticallContractReturnType<contract, options['mutability']>, options['error'], allowFailure>
33
+ ]> : readonly unknown[] extends contracts ? unknown[] : contracts extends readonly (infer contract extends ContractFunctionParameters)[] ? MulticallResponse<GetMulticallContractReturnType<contract, options['mutability']>, options['error'], allowFailure>[] : unknown[];
28
34
  export type MulticallResponse<result = unknown, error = unknown, allowFailure extends boolean = true> = allowFailure extends true ? {
29
35
  error?: undefined;
30
36
  result: result;
@@ -1 +1 @@
1
- {"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../../types/multicall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEtD,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAExD,MAAM,MAAM,kBAAkB,CAC5B,SAAS,SAAS,SAAS,OAAO,EAAE,EACpC,OAAO,SAAS;IACd,UAAU,EAAE,kBAA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E,MAAM,YAAY,SAAS,oBAAoB,CAC3D,GAAG,EACH,UAAU,CACX,CAAA;CACF,GAEC,QAAQ,SAAS;IACf,IAAI,EAAE,MAAM,IAAI,SAAS,oBAAoB,CAC3C,GAAG,EACH,UAAU,EACV,YAAY,CACb,CAAA;CACF,GACC,0BAA0B,CAAC,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI,CAAC,GAC/D,0BAA0B,CAAC,GAAG,EAAE,UAAU,EAAE,YAAY,CAAC,GAC3D,0BAA0B,CAAC,GAAG,EAAE,UAAU,CAAC,GAC7C,0BAA0B,CAAA"}
@@ -254,5 +254,5 @@ export async function multicall<
254
254
 
255
255
  if (results.length !== contracts.length)
256
256
  throw new BaseError('multicall results mismatch')
257
- return results as MulticallResults<contracts, allowFailure>
257
+ return results as MulticallReturnType<contracts, allowFailure>
258
258
  }
@@ -0,0 +1,23 @@
1
+ import { defineChain } from '../../utils/chain.js'
2
+
3
+ export const kroma = /*#__PURE__*/ defineChain({
4
+ id: 255,
5
+ network: 'kroma',
6
+ name: 'Kroma',
7
+ nativeCurrency: { name: 'ETH', symbol: 'ETH', decimals: 18 },
8
+ rpcUrls: {
9
+ default: {
10
+ http: ['https://api.kroma.network'],
11
+ },
12
+ public: {
13
+ http: ['https://api.kroma.network'],
14
+ },
15
+ },
16
+ blockExplorers: {
17
+ default: {
18
+ name: 'Kroma Explorer',
19
+ url: 'https://blockscout.kroma.network',
20
+ },
21
+ },
22
+ testnet: false,
23
+ })
@@ -0,0 +1,23 @@
1
+ import { defineChain } from '../../utils/chain.js'
2
+
3
+ export const kromaSepolia = /*#__PURE__*/ defineChain({
4
+ id: 2358,
5
+ network: 'kroma-sepolia',
6
+ name: 'Kroma Sepolia',
7
+ nativeCurrency: { name: 'Sepolia Ether', symbol: 'ETH', decimals: 18 },
8
+ rpcUrls: {
9
+ default: {
10
+ http: ['https://api.sepolia.kroma.network'],
11
+ },
12
+ public: {
13
+ http: ['https://api.sepolia.kroma.network'],
14
+ },
15
+ },
16
+ blockExplorers: {
17
+ default: {
18
+ name: 'Kroma Sepolia Explorer',
19
+ url: 'https://blockscout.sepolia.kroma.network',
20
+ },
21
+ },
22
+ testnet: true,
23
+ })
package/chains/index.ts CHANGED
@@ -63,6 +63,8 @@ export { haqqMainnet } from './definitions/haqqMainnet.js'
63
63
  export { haqqTestedge2 } from './definitions/haqqTestedge2.js'
64
64
  export { holesky } from './definitions/holesky.js'
65
65
  export { klaytn } from './definitions/klaytn.js'
66
+ export { kroma } from './definitions/kroma.js'
67
+ export { kromaSepolia } from './definitions/kromaSepolia.js'
66
68
  export { linea } from './definitions/linea.js'
67
69
  export { lineaTestnet } from './definitions/lineaTestnet.js'
68
70
  export { localhost } from './definitions/localhost.js'
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.0.0-alpha.7'
1
+ export const version = '2.0.0-alpha.8'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.0.0-alpha.7",
4
+ "version": "2.0.0-alpha.8",
5
5
  "type": "module",
6
6
  "main": "./_cjs/index.js",
7
7
  "module": "./_esm/index.js",
@@ -80,13 +80,45 @@ export type MulticallResults<
80
80
  error?: Error
81
81
  mutability: AbiStateMutability
82
82
  } = { error: Error; mutability: AbiStateMutability },
83
- > = {
84
- [index in keyof contracts]: MulticallResponse<
85
- GetMulticallContractReturnType<contracts[index], options['mutability']>,
86
- options['error'],
87
- allowFailure
88
- >
89
- }
83
+ ///
84
+ result extends any[] = [],
85
+ > = contracts extends readonly [] // no contracts, return empty
86
+ ? []
87
+ : contracts extends readonly [infer contract] // one contract left before returning `result`
88
+ ? [
89
+ ...result,
90
+ MulticallResponse<
91
+ GetMulticallContractReturnType<contract, options['mutability']>,
92
+ options['error'],
93
+ allowFailure
94
+ >,
95
+ ]
96
+ : contracts extends readonly [infer contract, ...infer rest] // grab first contract and recurse through `rest`
97
+ ? MulticallResults<
98
+ [...rest],
99
+ allowFailure,
100
+ options,
101
+ [
102
+ ...result,
103
+ MulticallResponse<
104
+ GetMulticallContractReturnType<contract, options['mutability']>,
105
+ options['error'],
106
+ allowFailure
107
+ >,
108
+ ]
109
+ >
110
+ : readonly unknown[] extends contracts
111
+ ? unknown[]
112
+ : // If `contracts` is *some* array but we couldn't assign `unknown[]` to it, then it must hold some known/homogenous type!
113
+ // use this to infer the param types in the case of Array.map() argument
114
+ contracts extends readonly (infer contract extends ContractFunctionParameters)[]
115
+ ? MulticallResponse<
116
+ GetMulticallContractReturnType<contract, options['mutability']>,
117
+ options['error'],
118
+ allowFailure
119
+ >[]
120
+ : // Fallback
121
+ unknown[]
90
122
 
91
123
  export type MulticallResponse<
92
124
  result = unknown,