viem 2.37.6 → 2.37.7

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 (51) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/_cjs/actions/public/estimateGas.js +11 -36
  3. package/_cjs/actions/public/estimateGas.js.map +1 -1
  4. package/_cjs/chains/definitions/botanix.js +22 -0
  5. package/_cjs/chains/definitions/botanix.js.map +1 -0
  6. package/_cjs/chains/definitions/botanixTestnet.js +1 -1
  7. package/_cjs/chains/definitions/eni.js +24 -0
  8. package/_cjs/chains/definitions/eni.js.map +1 -0
  9. package/_cjs/chains/definitions/eniTestnet.js +24 -0
  10. package/_cjs/chains/definitions/eniTestnet.js.map +1 -0
  11. package/_cjs/chains/definitions/icbNetwork.js +25 -0
  12. package/_cjs/chains/definitions/icbNetwork.js.map +1 -0
  13. package/_cjs/chains/index.js +20 -12
  14. package/_cjs/chains/index.js.map +1 -1
  15. package/_cjs/errors/version.js +1 -1
  16. package/_esm/actions/public/estimateGas.js +11 -39
  17. package/_esm/actions/public/estimateGas.js.map +1 -1
  18. package/_esm/chains/definitions/botanix.js +20 -0
  19. package/_esm/chains/definitions/botanix.js.map +1 -0
  20. package/_esm/chains/definitions/botanixTestnet.js +1 -1
  21. package/_esm/chains/definitions/eni.js +21 -0
  22. package/_esm/chains/definitions/eni.js.map +1 -0
  23. package/_esm/chains/definitions/eniTestnet.js +21 -0
  24. package/_esm/chains/definitions/eniTestnet.js.map +1 -0
  25. package/_esm/chains/definitions/icbNetwork.js +22 -0
  26. package/_esm/chains/definitions/icbNetwork.js.map +1 -0
  27. package/_esm/chains/index.js +4 -0
  28. package/_esm/chains/index.js.map +1 -1
  29. package/_esm/errors/version.js +1 -1
  30. package/_types/actions/public/estimateGas.d.ts.map +1 -1
  31. package/_types/chains/definitions/botanix.d.ts +40 -0
  32. package/_types/chains/definitions/botanix.d.ts.map +1 -0
  33. package/_types/chains/definitions/botanixTestnet.d.ts +1 -1
  34. package/_types/chains/definitions/eni.d.ts +39 -0
  35. package/_types/chains/definitions/eni.d.ts.map +1 -0
  36. package/_types/chains/definitions/eniTestnet.d.ts +39 -0
  37. package/_types/chains/definitions/eniTestnet.d.ts.map +1 -0
  38. package/_types/chains/definitions/icbNetwork.d.ts +40 -0
  39. package/_types/chains/definitions/icbNetwork.d.ts.map +1 -0
  40. package/_types/chains/index.d.ts +4 -0
  41. package/_types/chains/index.d.ts.map +1 -1
  42. package/_types/errors/version.d.ts +1 -1
  43. package/actions/public/estimateGas.ts +3 -40
  44. package/chains/definitions/botanix.ts +20 -0
  45. package/chains/definitions/botanixTestnet.ts +1 -1
  46. package/chains/definitions/eni.ts +21 -0
  47. package/chains/definitions/eniTestnet.ts +21 -0
  48. package/chains/definitions/icbNetwork.ts +22 -0
  49. package/chains/index.ts +4 -0
  50. package/errors/version.ts +1 -1
  51. package/package.json +2 -2
@@ -40,7 +40,6 @@ import {
40
40
  type PrepareTransactionRequestParameters,
41
41
  prepareTransactionRequest,
42
42
  } from '../wallet/prepareTransactionRequest.js'
43
- import { getBalance } from './getBalance.js'
44
43
 
45
44
  export type EstimateGasParameters<
46
45
  chain extends Chain | undefined = Chain | undefined,
@@ -185,13 +184,8 @@ export async function estimateGas<
185
184
  value,
186
185
  } as TransactionRequest)
187
186
 
188
- function estimateGas_rpc(parameters: {
189
- block: any
190
- request: any
191
- rpcStateOverride: any
192
- }) {
193
- const { block, request, rpcStateOverride } = parameters
194
- return client.request({
187
+ return BigInt(
188
+ await client.request({
195
189
  method: 'eth_estimateGas',
196
190
  params: rpcStateOverride
197
191
  ? [
@@ -202,39 +196,8 @@ export async function estimateGas<
202
196
  : block
203
197
  ? [request, block]
204
198
  : [request],
205
- })
206
- }
207
-
208
- let estimate = BigInt(
209
- await estimateGas_rpc({ block, request, rpcStateOverride }),
199
+ }),
210
200
  )
211
-
212
- // TODO(7702): Remove this once https://github.com/ethereum/execution-apis/issues/561 is resolved.
213
- // Authorization list schema is not implemented on JSON-RPC spec yet, so we need to
214
- // manually estimate the gas.
215
- if (authorizationList) {
216
- const value = await getBalance(client, { address: request.from })
217
- const estimates = await Promise.all(
218
- authorizationList.map(async (authorization) => {
219
- const { address } = authorization
220
- const estimate = await estimateGas_rpc({
221
- block,
222
- request: {
223
- authorizationList: undefined,
224
- data,
225
- from: account?.address,
226
- to: address,
227
- value: numberToHex(value),
228
- },
229
- rpcStateOverride,
230
- }).catch(() => 100_000n)
231
- return 2n * BigInt(estimate)
232
- }),
233
- )
234
- estimate += estimates.reduce((acc, curr) => acc + curr, 0n)
235
- }
236
-
237
- return estimate
238
201
  } catch (err) {
239
202
  throw getEstimateGasError(err as BaseError, {
240
203
  ...args,
@@ -0,0 +1,20 @@
1
+ // src/chains/definitions/example.ts
2
+ import { defineChain } from '../../utils/chain/defineChain.js'
3
+
4
+ export const botanix = /*#__PURE__*/ defineChain({
5
+ id: 3637,
6
+ name: 'Botanix',
7
+ nativeCurrency: { name: 'Bitcoin', symbol: 'BTC', decimals: 18 },
8
+ rpcUrls: {
9
+ default: {
10
+ http: ['https://rpc.botanixlabs.com'],
11
+ webSocket: ['wss://rpc.botanixlabs.com/ws'],
12
+ },
13
+ },
14
+ blockExplorers: {
15
+ default: {
16
+ name: 'Botanixscan',
17
+ url: 'https://botanixscan.io',
18
+ },
19
+ },
20
+ })
@@ -3,7 +3,7 @@ import { defineChain } from '../../utils/chain/defineChain.js'
3
3
  export const botanixTestnet = /*#__PURE__*/ defineChain({
4
4
  id: 3636,
5
5
  name: 'Botanix Testnet',
6
- nativeCurrency: { name: 'Botanix', symbol: 'BTC', decimals: 18 },
6
+ nativeCurrency: { name: 'Bitcoin', symbol: 'BTC', decimals: 18 },
7
7
  rpcUrls: {
8
8
  default: {
9
9
  http: ['https://node.botanixlabs.dev'],
@@ -0,0 +1,21 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const eni = /*#__PURE__*/ defineChain({
4
+ id: 173,
5
+ name: 'ENI Mainnet',
6
+ nativeCurrency: {
7
+ decimals: 18,
8
+ name: 'ENI',
9
+ symbol: 'ENI',
10
+ },
11
+ rpcUrls: {
12
+ default: { http: ['https://rpc.eniac.network'] },
13
+ },
14
+ blockExplorers: {
15
+ default: {
16
+ name: 'ENI Explorer',
17
+ url: 'https://scan.eniac.network',
18
+ },
19
+ },
20
+ testnet: false,
21
+ })
@@ -0,0 +1,21 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const eniTestnet = /*#__PURE__*/ defineChain({
4
+ id: 6_912_115,
5
+ name: 'ENI Testnet',
6
+ nativeCurrency: {
7
+ decimals: 18,
8
+ name: 'ENI Testnet Token',
9
+ symbol: 'ENI',
10
+ },
11
+ rpcUrls: {
12
+ default: { http: ['https://rpc-testnet.eniac.network'] },
13
+ },
14
+ blockExplorers: {
15
+ default: {
16
+ name: 'ENI Testnet Explorer',
17
+ url: 'https://scan-testnet.eniac.network',
18
+ },
19
+ },
20
+ testnet: true,
21
+ })
@@ -0,0 +1,22 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const icbNetwork = /*#__PURE__*/ defineChain({
4
+ id: 73115,
5
+ name: 'ICB Network',
6
+ nativeCurrency: {
7
+ decimals: 18,
8
+ name: 'ICB Native Token',
9
+ symbol: 'ICBX',
10
+ },
11
+ rpcUrls: {
12
+ default: { http: ['https://rpc1-mainnet.icbnetwork.info'] },
13
+ },
14
+ blockExplorers: {
15
+ default: {
16
+ name: 'ICB Explorer',
17
+ url: 'https://icbscan.io',
18
+ apiUrl: 'https://icbscan.io/api',
19
+ },
20
+ },
21
+ testnet: false,
22
+ })
package/chains/index.ts CHANGED
@@ -77,6 +77,7 @@ export { boba } from './definitions/boba.js'
77
77
  export { bobaSepolia } from './definitions/bobaSepolia.js'
78
78
  export { bobSepolia } from './definitions/bobSepolia.js'
79
79
  export { boolBetaMainnet } from './definitions/boolBetaMainnet.js'
80
+ export { botanix } from './definitions/botanix.js'
80
81
  export { botanixTestnet } from './definitions/botanixTestnet.js'
81
82
  export { bounceBit } from './definitions/bounceBit.js'
82
83
  export { bounceBitTestnet } from './definitions/bounceBitTestnet.js'
@@ -161,6 +162,8 @@ export { electroneum } from './definitions/electroneum.js'
161
162
  export { electroneumTestnet } from './definitions/electroneumTestnet.js'
162
163
  export { elysiumTestnet } from './definitions/elysiumTestnet.js'
163
164
  export { energy } from './definitions/energy.js'
165
+ export { eni } from './definitions/eni.js'
166
+ export { eniTestnet } from './definitions/eniTestnet.js'
164
167
  export { enuls } from './definitions/enuls.js'
165
168
  export { eon } from './definitions/eon.js'
166
169
  export { eos } from './definitions/eos.js'
@@ -254,6 +257,7 @@ export { humanodeTestnet5 } from './definitions/humanodeTestnet5.js'
254
257
  export { hychain } from './definitions/hychain.js'
255
258
  export { hychainTestnet } from './definitions/hychainTestnet.js'
256
259
  export { hyperliquidEvmTestnet } from './definitions/hyperliquidEvmTestnet.js'
260
+ export { icbNetwork } from './definitions/icbNetwork.js'
257
261
  export { idchain } from './definitions/idchain.js'
258
262
  export { immutableZkEvm } from './definitions/immutableZkEvm.js'
259
263
  export { immutableZkEvmTestnet } from './definitions/immutableZkEvmTestnet.js'
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.37.6'
1
+ export const version = '2.37.7'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.37.6",
4
+ "version": "2.37.7",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
@@ -201,7 +201,7 @@
201
201
  "@scure/bip39": "1.6.0",
202
202
  "abitype": "1.1.0",
203
203
  "isows": "1.0.7",
204
- "ox": "0.9.3",
204
+ "ox": "0.9.6",
205
205
  "ws": "8.18.3"
206
206
  },
207
207
  "license": "MIT",