viem 2.21.54 → 2.21.55

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +7 -0
  3. package/_cjs/account-abstraction/accounts/implementations/toSoladySmartAccount.js +0 -8
  4. package/_cjs/account-abstraction/accounts/implementations/toSoladySmartAccount.js.map +1 -1
  5. package/_cjs/actions/public/estimateContractGas.js +2 -2
  6. package/_cjs/actions/public/estimateContractGas.js.map +1 -1
  7. package/_cjs/chains/definitions/creatorTestnet.js +28 -0
  8. package/_cjs/chains/definitions/creatorTestnet.js.map +1 -0
  9. package/_cjs/chains/definitions/dailyNetwork.js +24 -0
  10. package/_cjs/chains/definitions/dailyNetwork.js.map +1 -0
  11. package/_cjs/chains/definitions/dailyNetworkTestnet.js +24 -0
  12. package/_cjs/chains/definitions/dailyNetworkTestnet.js.map +1 -0
  13. package/_cjs/chains/definitions/mitosisTestnet.js +22 -0
  14. package/_cjs/chains/definitions/mitosisTestnet.js.map +1 -0
  15. package/_cjs/chains/definitions/plume.js +29 -0
  16. package/_cjs/chains/definitions/plume.js.map +1 -0
  17. package/_cjs/chains/definitions/plumeDevnet.js +30 -0
  18. package/_cjs/chains/definitions/plumeDevnet.js.map +1 -0
  19. package/_cjs/chains/definitions/sanko.js +6 -0
  20. package/_cjs/chains/definitions/sanko.js.map +1 -1
  21. package/_cjs/chains/definitions/sonic.js +24 -0
  22. package/_cjs/chains/definitions/sonic.js.map +1 -0
  23. package/_cjs/chains/definitions/superseed.js +56 -0
  24. package/_cjs/chains/definitions/superseed.js.map +1 -0
  25. package/_cjs/chains/definitions/superseedSepolia.js +49 -0
  26. package/_cjs/chains/definitions/superseedSepolia.js.map +1 -0
  27. package/_cjs/chains/definitions/treasure.js +35 -0
  28. package/_cjs/chains/definitions/treasure.js.map +1 -0
  29. package/_cjs/chains/definitions/treasureTopaz.js +35 -0
  30. package/_cjs/chains/definitions/treasureTopaz.js.map +1 -0
  31. package/_cjs/chains/definitions/xrOne.js +24 -0
  32. package/_cjs/chains/definitions/xrOne.js.map +1 -0
  33. package/_cjs/chains/index.js +33 -9
  34. package/_cjs/chains/index.js.map +1 -1
  35. package/_cjs/errors/version.js +1 -1
  36. package/_cjs/experimental/erc7739/actions/signTypedData.js +2 -8
  37. package/_cjs/experimental/erc7739/actions/signTypedData.js.map +1 -1
  38. package/_cjs/experimental/erc7739/utils/hashTypedData.js +1 -5
  39. package/_cjs/experimental/erc7739/utils/hashTypedData.js.map +1 -1
  40. package/_cjs/index.js +5 -4
  41. package/_cjs/index.js.map +1 -1
  42. package/_cjs/utils/index.js +2 -1
  43. package/_cjs/utils/index.js.map +1 -1
  44. package/_cjs/utils/signature/hashTypedData.js.map +1 -1
  45. package/_esm/account-abstraction/accounts/implementations/toSoladySmartAccount.js +0 -8
  46. package/_esm/account-abstraction/accounts/implementations/toSoladySmartAccount.js.map +1 -1
  47. package/_esm/actions/public/estimateContractGas.js +2 -2
  48. package/_esm/actions/public/estimateContractGas.js.map +1 -1
  49. package/_esm/chains/definitions/creatorTestnet.js +25 -0
  50. package/_esm/chains/definitions/creatorTestnet.js.map +1 -0
  51. package/_esm/chains/definitions/dailyNetwork.js +21 -0
  52. package/_esm/chains/definitions/dailyNetwork.js.map +1 -0
  53. package/_esm/chains/definitions/dailyNetworkTestnet.js +21 -0
  54. package/_esm/chains/definitions/dailyNetworkTestnet.js.map +1 -0
  55. package/_esm/chains/definitions/mitosisTestnet.js +19 -0
  56. package/_esm/chains/definitions/mitosisTestnet.js.map +1 -0
  57. package/_esm/chains/definitions/plume.js +26 -0
  58. package/_esm/chains/definitions/plume.js.map +1 -0
  59. package/_esm/chains/definitions/plumeDevnet.js +27 -0
  60. package/_esm/chains/definitions/plumeDevnet.js.map +1 -0
  61. package/_esm/chains/definitions/sanko.js +6 -0
  62. package/_esm/chains/definitions/sanko.js.map +1 -1
  63. package/_esm/chains/definitions/sonic.js +21 -0
  64. package/_esm/chains/definitions/sonic.js.map +1 -0
  65. package/_esm/chains/definitions/superseed.js +53 -0
  66. package/_esm/chains/definitions/superseed.js.map +1 -0
  67. package/_esm/chains/definitions/superseedSepolia.js +46 -0
  68. package/_esm/chains/definitions/superseedSepolia.js.map +1 -0
  69. package/_esm/chains/definitions/treasure.js +32 -0
  70. package/_esm/chains/definitions/treasure.js.map +1 -0
  71. package/_esm/chains/definitions/treasureTopaz.js +32 -0
  72. package/_esm/chains/definitions/treasureTopaz.js.map +1 -0
  73. package/_esm/chains/definitions/xrOne.js +21 -0
  74. package/_esm/chains/definitions/xrOne.js.map +1 -0
  75. package/_esm/chains/index.js +13 -0
  76. package/_esm/chains/index.js.map +1 -1
  77. package/_esm/errors/version.js +1 -1
  78. package/_esm/experimental/erc7739/actions/signTypedData.js +2 -8
  79. package/_esm/experimental/erc7739/actions/signTypedData.js.map +1 -1
  80. package/_esm/experimental/erc7739/utils/hashTypedData.js +1 -5
  81. package/_esm/experimental/erc7739/utils/hashTypedData.js.map +1 -1
  82. package/_esm/index.js +1 -1
  83. package/_esm/index.js.map +1 -1
  84. package/_esm/utils/index.js +1 -1
  85. package/_esm/utils/index.js.map +1 -1
  86. package/_esm/utils/signature/hashTypedData.js.map +1 -1
  87. package/_types/account-abstraction/accounts/implementations/toSoladySmartAccount.d.ts +0 -6
  88. package/_types/account-abstraction/accounts/implementations/toSoladySmartAccount.d.ts.map +1 -1
  89. package/_types/actions/public/estimateContractGas.d.ts +5 -1
  90. package/_types/actions/public/estimateContractGas.d.ts.map +1 -1
  91. package/_types/chains/definitions/creatorTestnet.d.ts +32 -0
  92. package/_types/chains/definitions/creatorTestnet.d.ts.map +1 -0
  93. package/_types/chains/definitions/dailyNetwork.d.ts +37 -0
  94. package/_types/chains/definitions/dailyNetwork.d.ts.map +1 -0
  95. package/_types/chains/definitions/dailyNetworkTestnet.d.ts +37 -0
  96. package/_types/chains/definitions/dailyNetworkTestnet.d.ts.map +1 -0
  97. package/_types/chains/definitions/mitosisTestnet.d.ts +37 -0
  98. package/_types/chains/definitions/mitosisTestnet.d.ts.map +1 -0
  99. package/_types/chains/definitions/plume.d.ts +39 -0
  100. package/_types/chains/definitions/plume.d.ts.map +1 -0
  101. package/_types/chains/definitions/plumeDevnet.d.ts +39 -0
  102. package/_types/chains/definitions/plumeDevnet.d.ts.map +1 -0
  103. package/_types/chains/definitions/sanko.d.ts +6 -10
  104. package/_types/chains/definitions/sanko.d.ts.map +1 -1
  105. package/_types/chains/definitions/sonic.d.ts +37 -0
  106. package/_types/chains/definitions/sonic.d.ts.map +1 -0
  107. package/_types/chains/definitions/superseed.d.ts +307 -0
  108. package/_types/chains/definitions/superseed.d.ts.map +1 -0
  109. package/_types/chains/definitions/superseedSepolia.d.ts +295 -0
  110. package/_types/chains/definitions/superseedSepolia.d.ts.map +1 -0
  111. package/_types/chains/definitions/treasure.d.ts +405 -0
  112. package/_types/chains/definitions/treasure.d.ts.map +1 -0
  113. package/_types/chains/definitions/treasureTopaz.d.ts +405 -0
  114. package/_types/chains/definitions/treasureTopaz.d.ts.map +1 -0
  115. package/_types/chains/definitions/xrOne.d.ts +37 -0
  116. package/_types/chains/definitions/xrOne.d.ts.map +1 -0
  117. package/_types/chains/index.d.ts +13 -0
  118. package/_types/chains/index.d.ts.map +1 -1
  119. package/_types/errors/version.d.ts +1 -1
  120. package/_types/experimental/erc7739/actions/signTypedData.d.ts +0 -4
  121. package/_types/experimental/erc7739/actions/signTypedData.d.ts.map +1 -1
  122. package/_types/experimental/erc7739/utils/hashTypedData.d.ts +0 -2
  123. package/_types/experimental/erc7739/utils/hashTypedData.d.ts.map +1 -1
  124. package/_types/index.d.ts +1 -1
  125. package/_types/index.d.ts.map +1 -1
  126. package/_types/utils/index.d.ts +1 -1
  127. package/_types/utils/index.d.ts.map +1 -1
  128. package/_types/utils/signature/hashTypedData.d.ts +1 -1
  129. package/_types/utils/signature/hashTypedData.d.ts.map +1 -1
  130. package/account-abstraction/accounts/implementations/toSoladySmartAccount.ts +0 -8
  131. package/actions/public/estimateContractGas.ts +7 -3
  132. package/chains/definitions/creatorTestnet.ts +25 -0
  133. package/chains/definitions/dailyNetwork.ts +21 -0
  134. package/chains/definitions/dailyNetworkTestnet.ts +21 -0
  135. package/chains/definitions/mitosisTestnet.ts +19 -0
  136. package/chains/definitions/plume.ts +27 -0
  137. package/chains/definitions/plumeDevnet.ts +28 -0
  138. package/chains/definitions/sanko.ts +6 -0
  139. package/chains/definitions/sonic.ts +21 -0
  140. package/chains/definitions/superseed.ts +54 -0
  141. package/chains/definitions/superseedSepolia.ts +47 -0
  142. package/chains/definitions/treasure.ts +32 -0
  143. package/chains/definitions/treasureTopaz.ts +32 -0
  144. package/chains/definitions/xrOne.ts +21 -0
  145. package/chains/index.ts +13 -0
  146. package/errors/version.ts +1 -1
  147. package/experimental/erc7739/actions/signTypedData.ts +2 -16
  148. package/experimental/erc7739/utils/hashTypedData.ts +1 -15
  149. package/index.ts +2 -0
  150. package/package.json +1 -1
  151. package/utils/index.ts +2 -0
  152. package/utils/signature/hashTypedData.ts +4 -1
@@ -0,0 +1,32 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+ import { chainConfig } from '../../zksync/chainConfig.js'
3
+
4
+ export const treasureTopaz = /*#__PURE__*/ defineChain({
5
+ ...chainConfig,
6
+ id: 978_658,
7
+ name: 'Treasure Topaz Testnet',
8
+ nativeCurrency: {
9
+ decimals: 18,
10
+ name: 'MAGIC',
11
+ symbol: 'MAGIC',
12
+ },
13
+ rpcUrls: {
14
+ default: {
15
+ http: ['https://rpc.topaz.treasure.lol'],
16
+ webSocket: ['wss://rpc.topaz.treasure.lol/ws'],
17
+ },
18
+ },
19
+ blockExplorers: {
20
+ default: {
21
+ name: 'Treasure Topaz Block Explorer',
22
+ url: 'https://topaz.treasurescan.io',
23
+ },
24
+ },
25
+ contracts: {
26
+ multicall3: {
27
+ address: '0xF9cda624FBC7e059355ce98a31693d299FACd963',
28
+ blockCreated: 108112,
29
+ },
30
+ },
31
+ testnet: true,
32
+ })
@@ -0,0 +1,21 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const xrOne = /*#__PURE__*/ defineChain({
4
+ id: 273,
5
+ name: 'XR One',
6
+ nativeCurrency: {
7
+ decimals: 18,
8
+ name: 'XR',
9
+ symbol: 'XR',
10
+ },
11
+ rpcUrls: {
12
+ default: { http: ['https://xr-one.calderachain.xyz/http'] },
13
+ },
14
+ blockExplorers: {
15
+ default: {
16
+ name: 'Blockscout',
17
+ url: 'https://xr-one.calderaexplorer.xyz',
18
+ },
19
+ },
20
+ testnet: false,
21
+ })
package/chains/index.ts CHANGED
@@ -91,6 +91,7 @@ export { coreDao } from './definitions/coreDao.js'
91
91
  export { corn } from './definitions/corn.js'
92
92
  export { cornTestnet } from './definitions/cornTestnet.js'
93
93
  export { crab } from './definitions/crab.js'
94
+ export { creatorTestnet } from './definitions/creatorTestnet.js'
94
95
  export { cronos } from './definitions/cronos.js'
95
96
  export { cronosTestnet } from './definitions/cronosTestnet.js'
96
97
  export { cronoszkEVM } from './definitions/cronoszkEVM.js'
@@ -99,6 +100,8 @@ export { crossbell } from './definitions/crossbell.js'
99
100
  export { curtis } from './definitions/curtis.js'
100
101
  export { cyber } from './definitions/cyber.js'
101
102
  export { cyberTestnet } from './definitions/cyberTestnet.js'
103
+ export { dailyNetwork } from './definitions/dailyNetwork.js'
104
+ export { dailyNetworkTestnet } from './definitions/dailyNetworkTestnet.js'
102
105
  export { darwinia } from './definitions/darwinia.js'
103
106
  export { dchain } from './definitions/dchain.js'
104
107
  export { dchainTestnet } from './definitions/dchainTestnet.js'
@@ -271,6 +274,7 @@ export { mev } from './definitions/mev.js'
271
274
  export { mevTestnet } from './definitions/mevTestnet.js'
272
275
  export { mint } from './definitions/mint.js'
273
276
  export { mintSepoliaTestnet } from './definitions/mintSepoliaTestnet.js'
277
+ export { mitosisTestnet } from './definitions/mitosisTestnet.js'
274
278
  export { mode } from './definitions/mode.js'
275
279
  export { modeTestnet } from './definitions/modeTestnet.js'
276
280
  export { moonbaseAlpha } from './definitions/moonbaseAlpha.js'
@@ -311,6 +315,9 @@ export { phoenix } from './definitions/phoenix.js'
311
315
  export { planq } from './definitions/planq.js'
312
316
  export { playfiAlbireo } from './definitions/playfiAlbireo.js'
313
317
  export { plinga } from './definitions/plinga.js'
318
+ export { plume } from './definitions/plume.js'
319
+ export { plumeDevnet } from './definitions/plumeDevnet.js'
320
+ /** @deprecated Use `plumeDevnet` instead. */
314
321
  export { plumeTestnet } from './definitions/plumeTestnet.js'
315
322
  export { polterTestnet } from './definitions/polterTestnet.js'
316
323
  export { polygon } from './definitions/polygon.js'
@@ -382,6 +389,7 @@ export { sketchpad } from './definitions/sketchpad.js'
382
389
  export { snax } from './definitions/snax.js'
383
390
  export { snaxTestnet } from './definitions/snaxTestnet.js'
384
391
  export { soneiumMinato } from './definitions/soneiumMinato.js'
392
+ export { sonic } from './definitions/sonic.js'
385
393
  export { sonicTestnet } from './definitions/sonicTestnet.js'
386
394
  export { songbird } from './definitions/songbird.js'
387
395
  export { songbirdTestnet } from './definitions/songbirdTestnet.js'
@@ -394,6 +402,8 @@ export { storyTestnet } from './definitions/storyTestnet.js'
394
402
  export { stratis } from './definitions/stratis.js'
395
403
  export { superlumio } from './definitions/superlumio.js'
396
404
  export { superposition } from './definitions/superposition.js'
405
+ export { superseed } from './definitions/superseed.js'
406
+ export { superseedSepolia } from './definitions/superseedSepolia.js'
397
407
  export { swan } from './definitions/swan.js'
398
408
  export { swanProximaTestnet } from './definitions/swanProximaTestnet.js'
399
409
  export { swanSaturnTestnet } from './definitions/swanSaturnTestnet.js'
@@ -419,6 +429,8 @@ export { thunderCore } from './definitions/thunderCore.js'
419
429
  export { thunderTestnet } from './definitions/thunderTestnet.js'
420
430
  export { tiktrixTestnet } from './definitions/tiktrixTestnet.js'
421
431
  export { tomb } from './definitions/tomb.js'
432
+ export { treasure } from './definitions/treasure.js'
433
+ export { treasureTopaz } from './definitions/treasureTopaz.js'
422
434
  export { tron } from './definitions/tron.js'
423
435
  export { ubiq } from './definitions/ubiq.js'
424
436
  export { ultron } from './definitions/ultron.js'
@@ -453,6 +465,7 @@ export {
453
465
  x1Testnet,
454
466
  xLayerTestnet,
455
467
  } from './definitions/xLayerTestnet.js'
468
+ export { xrOne } from './definitions/xrOne.js'
456
469
  export { xrSepolia } from './definitions/xrSepolia.js'
457
470
  export { yooldoVerse } from './definitions/yooldoVerse.js'
458
471
  export { yooldoVerseTestnet } from './definitions/yooldoVerseTestnet.js'
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.21.54'
1
+ export const version = '2.21.55'
@@ -37,8 +37,6 @@ export type SignTypedDataParameters<
37
37
  TypedDataDomain,
38
38
  'chainId' | 'name' | 'verifyingContract' | 'salt' | 'version'
39
39
  >
40
- fields: Hex
41
- extensions: readonly bigint[]
42
40
  verifier?: undefined
43
41
  }
44
42
  | (GetVerifierParameter<verifier> & {
@@ -48,8 +46,6 @@ export type SignTypedDataParameters<
48
46
  'chainId' | 'name' | 'verifyingContract' | 'salt' | 'version'
49
47
  >
50
48
  | undefined
51
- fields?: Hex | undefined
52
- extensions?: readonly bigint[] | undefined
53
49
  })
54
50
  >
55
51
 
@@ -189,16 +185,10 @@ export async function signTypedData<
189
185
  const account = parseAccount(account_!)
190
186
 
191
187
  // Retrieve account EIP712 domain.
192
- const {
193
- domain: verifierDomain,
194
- fields,
195
- extensions,
196
- } = await (async () => {
197
- if (parameters.verifierDomain && parameters.fields && parameters.extensions)
188
+ const { domain: verifierDomain } = await (async () => {
189
+ if (parameters.verifierDomain)
198
190
  return {
199
191
  domain: parameters.verifierDomain,
200
- fields: parameters.fields,
201
- extensions: parameters.extensions,
202
192
  }
203
193
  return getAction(
204
194
  client,
@@ -223,20 +213,16 @@ export async function signTypedData<
223
213
  ...types,
224
214
  TypedDataSign: [
225
215
  { name: 'contents', type: primaryType },
226
- { name: 'fields', type: 'bytes1' },
227
216
  { name: 'name', type: 'string' },
228
217
  { name: 'version', type: 'string' },
229
218
  { name: 'chainId', type: 'uint256' },
230
219
  { name: 'verifyingContract', type: 'address' },
231
220
  { name: 'salt', type: 'bytes32' },
232
- { name: 'extensions', type: 'uint256[]' },
233
221
  ],
234
222
  },
235
223
  primaryType: 'TypedDataSign',
236
224
  message: {
237
225
  contents: message as any,
238
- fields,
239
- extensions,
240
226
  ...(verifierDomain as any),
241
227
  },
242
228
  })
@@ -14,8 +14,6 @@ export type HashTypedDataParameters<
14
14
  ///
15
15
  primaryTypes = typedData extends TypedData ? keyof typedData : string,
16
16
  > = TypedDataDefinition<typedData, primaryType, primaryTypes> & {
17
- fields: Hex
18
- extensions: readonly bigint[]
19
17
  verifierDomain: RequiredBy<
20
18
  TypedDataDomain,
21
19
  'chainId' | 'name' | 'verifyingContract' | 'version'
@@ -76,15 +74,7 @@ export function hashTypedData<
76
74
  >(
77
75
  parameters: HashTypedDataParameters<typedData, primaryType>,
78
76
  ): HashTypedDataReturnType {
79
- const {
80
- domain,
81
- extensions,
82
- fields,
83
- message,
84
- primaryType,
85
- types,
86
- verifierDomain,
87
- } = parameters
77
+ const { domain, message, primaryType, types, verifierDomain } = parameters
88
78
 
89
79
  return hashTypedData_({
90
80
  domain: domain as any,
@@ -92,20 +82,16 @@ export function hashTypedData<
92
82
  ...types,
93
83
  TypedDataSign: [
94
84
  { name: 'contents', type: primaryType },
95
- { name: 'fields', type: 'bytes1' },
96
85
  { name: 'name', type: 'string' },
97
86
  { name: 'version', type: 'string' },
98
87
  { name: 'chainId', type: 'uint256' },
99
88
  { name: 'verifyingContract', type: 'address' },
100
89
  { name: 'salt', type: 'bytes32' },
101
- { name: 'extensions', type: 'uint256[]' },
102
90
  ],
103
91
  },
104
92
  primaryType: 'TypedDataSign',
105
93
  message: {
106
94
  contents: message as any,
107
- fields,
108
- extensions,
109
95
  ...(verifierDomain as any),
110
96
  },
111
97
  })
package/index.ts CHANGED
@@ -1272,10 +1272,12 @@ export {
1272
1272
  } from './utils/transaction/getTransactionType.js'
1273
1273
  export {
1274
1274
  type HashDomainErrorType,
1275
+ type HashStructErrorType,
1275
1276
  type HashTypedDataErrorType,
1276
1277
  type HashTypedDataParameters,
1277
1278
  type HashTypedDataReturnType,
1278
1279
  hashDomain,
1280
+ hashStruct,
1279
1281
  hashTypedData,
1280
1282
  } from './utils/signature/hashTypedData.js'
1281
1283
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.21.54",
4
+ "version": "2.21.55",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
package/utils/index.ts CHANGED
@@ -406,8 +406,10 @@ export { type Sha256ErrorType, sha256 } from './hash/sha256.js'
406
406
  export { type Ripemd160ErrorType, ripemd160 } from './hash/ripemd160.js'
407
407
  export {
408
408
  type HashDomainErrorType,
409
+ type HashStructErrorType,
409
410
  type HashTypedDataParameters,
410
411
  type HashTypedDataReturnType,
412
+ hashStruct,
411
413
  hashTypedData,
412
414
  } from './signature/hashTypedData.js'
413
415
  export {
@@ -100,7 +100,10 @@ export function hashDomain({
100
100
  })
101
101
  }
102
102
 
103
- type HashStructErrorType = EncodeDataErrorType | Keccak256ErrorType | ErrorType
103
+ export type HashStructErrorType =
104
+ | EncodeDataErrorType
105
+ | Keccak256ErrorType
106
+ | ErrorType
104
107
 
105
108
  export function hashStruct({
106
109
  data,