viem 2.16.2 → 2.16.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/_cjs/chains/definitions/bitTorrent.js +6 -0
  3. package/_cjs/chains/definitions/bitTorrent.js.map +1 -1
  4. package/_cjs/chains/definitions/etherlink.js +29 -0
  5. package/_cjs/chains/definitions/etherlink.js.map +1 -0
  6. package/_cjs/chains/definitions/lyra.js +28 -0
  7. package/_cjs/chains/definitions/lyra.js.map +1 -0
  8. package/_cjs/chains/definitions/morphHolesky.js +24 -0
  9. package/_cjs/chains/definitions/morphHolesky.js.map +1 -0
  10. package/_cjs/chains/definitions/real.js +30 -0
  11. package/_cjs/chains/definitions/real.js.map +1 -0
  12. package/_cjs/chains/definitions/unreal.js +31 -0
  13. package/_cjs/chains/definitions/unreal.js.map +1 -0
  14. package/_cjs/chains/index.js +15 -5
  15. package/_cjs/chains/index.js.map +1 -1
  16. package/_cjs/errors/base.js.map +1 -1
  17. package/_cjs/errors/request.js +2 -1
  18. package/_cjs/errors/request.js.map +1 -1
  19. package/_cjs/errors/version.js +1 -1
  20. package/_cjs/utils/rpc/http.js +1 -1
  21. package/_cjs/utils/rpc/http.js.map +1 -1
  22. package/_esm/chains/definitions/bitTorrent.js +6 -0
  23. package/_esm/chains/definitions/bitTorrent.js.map +1 -1
  24. package/_esm/chains/definitions/etherlink.js +26 -0
  25. package/_esm/chains/definitions/etherlink.js.map +1 -0
  26. package/_esm/chains/definitions/lyra.js +25 -0
  27. package/_esm/chains/definitions/lyra.js.map +1 -0
  28. package/_esm/chains/definitions/morphHolesky.js +21 -0
  29. package/_esm/chains/definitions/morphHolesky.js.map +1 -0
  30. package/_esm/chains/definitions/real.js +27 -0
  31. package/_esm/chains/definitions/real.js.map +1 -0
  32. package/_esm/chains/definitions/unreal.js +28 -0
  33. package/_esm/chains/definitions/unreal.js.map +1 -0
  34. package/_esm/chains/index.js +5 -0
  35. package/_esm/chains/index.js.map +1 -1
  36. package/_esm/errors/base.js.map +1 -1
  37. package/_esm/errors/request.js +2 -1
  38. package/_esm/errors/request.js.map +1 -1
  39. package/_esm/errors/version.js +1 -1
  40. package/_esm/utils/rpc/http.js +1 -1
  41. package/_esm/utils/rpc/http.js.map +1 -1
  42. package/_types/chains/definitions/bitTorrent.d.ts +6 -8
  43. package/_types/chains/definitions/bitTorrent.d.ts.map +1 -1
  44. package/_types/chains/definitions/etherlink.d.ts +33 -0
  45. package/_types/chains/definitions/etherlink.d.ts.map +1 -0
  46. package/_types/chains/definitions/lyra.d.ts +34 -0
  47. package/_types/chains/definitions/lyra.d.ts.map +1 -0
  48. package/_types/chains/definitions/morphHolesky.d.ts +37 -0
  49. package/_types/chains/definitions/morphHolesky.d.ts.map +1 -0
  50. package/_types/chains/definitions/real.d.ts +34 -0
  51. package/_types/chains/definitions/real.d.ts.map +1 -0
  52. package/_types/chains/definitions/unreal.d.ts +34 -0
  53. package/_types/chains/definitions/unreal.d.ts.map +1 -0
  54. package/_types/chains/index.d.ts +5 -0
  55. package/_types/chains/index.d.ts.map +1 -1
  56. package/_types/errors/base.d.ts +3 -7
  57. package/_types/errors/base.d.ts.map +1 -1
  58. package/_types/errors/request.d.ts +2 -1
  59. package/_types/errors/request.d.ts.map +1 -1
  60. package/_types/errors/version.d.ts +1 -1
  61. package/chains/definitions/bitTorrent.ts +6 -0
  62. package/chains/definitions/etherlink.ts +26 -0
  63. package/chains/definitions/lyra.ts +25 -0
  64. package/chains/definitions/morphHolesky.ts +21 -0
  65. package/chains/definitions/real.ts +27 -0
  66. package/chains/definitions/unreal.ts +28 -0
  67. package/chains/index.ts +5 -0
  68. package/errors/base.ts +3 -10
  69. package/errors/request.ts +3 -0
  70. package/errors/version.ts +1 -1
  71. package/package.json +6 -6
  72. package/utils/rpc/http.ts +1 -1
@@ -0,0 +1,25 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const lyra = /*#__PURE__*/ defineChain({
4
+ id: 957,
5
+ name: 'Lyra Chain',
6
+ nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
7
+ rpcUrls: {
8
+ default: {
9
+ http: ['https://rpc.lyra.finance'],
10
+ },
11
+ },
12
+ blockExplorers: {
13
+ default: {
14
+ name: 'Lyra Explorer',
15
+ url: 'https://explorer.lyra.finance',
16
+ apiUrl: 'https://explorer.lyra.finance/api/v2',
17
+ },
18
+ },
19
+ contracts: {
20
+ multicall3: {
21
+ address: '0xca11bde05977b3631167028862be2a173976ca11',
22
+ blockCreated: 1935198,
23
+ },
24
+ },
25
+ })
@@ -0,0 +1,21 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const morphHolesky = /*#__PURE__*/ defineChain({
4
+ id: 2810,
5
+ name: 'Morph Holesky',
6
+ nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
7
+ rpcUrls: {
8
+ default: {
9
+ http: ['https://rpc-quicknode-holesky.morphl2.io'],
10
+ webSocket: ['wss://rpc-quicknode-holesky.morphl2.io'],
11
+ },
12
+ },
13
+ blockExplorers: {
14
+ default: {
15
+ name: 'Morph Holesky Explorer',
16
+ url: 'https://explorer-holesky.morphl2.io',
17
+ apiUrl: 'https://explorer-api-holesky.morphl2.io/api?',
18
+ },
19
+ },
20
+ testnet: true,
21
+ })
@@ -0,0 +1,27 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const real = /*#__PURE__*/ defineChain({
4
+ id: 111188,
5
+ name: 're.al',
6
+ nativeCurrency: {
7
+ name: 'reETH',
8
+ decimals: 18,
9
+ symbol: 'reETH',
10
+ },
11
+ rpcUrls: {
12
+ default: { http: ['https://real.drpc.org'] },
13
+ },
14
+ blockExplorers: {
15
+ default: {
16
+ name: 're.al Explorer',
17
+ url: 'https://explorer.re.al',
18
+ apiUrl: 'https://explorer.re.al/api/v2',
19
+ },
20
+ },
21
+ contracts: {
22
+ multicall3: {
23
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
24
+ blockCreated: 695,
25
+ },
26
+ },
27
+ })
@@ -0,0 +1,28 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const unreal = /*#__PURE__*/ defineChain({
4
+ id: 18233,
5
+ name: 'Unreal',
6
+ nativeCurrency: {
7
+ name: 'reETH',
8
+ decimals: 18,
9
+ symbol: 'reETH',
10
+ },
11
+ rpcUrls: {
12
+ default: { http: ['https://rpc.unreal-orbit.gelato.digital'] },
13
+ },
14
+ blockExplorers: {
15
+ default: {
16
+ name: 'Unreal Explorer',
17
+ url: 'https://unreal.blockscout.com',
18
+ apiUrl: 'https://unreal.blockscout.com/api/v2',
19
+ },
20
+ },
21
+ testnet: true,
22
+ contracts: {
23
+ multicall3: {
24
+ address: '0x8b6B0e60D8CD84898Ea8b981065A12F876eA5677',
25
+ blockCreated: 1745,
26
+ },
27
+ },
28
+ })
package/chains/index.ts CHANGED
@@ -78,6 +78,7 @@ export { edgewareTestnet } from './definitions/edgewareTestnet.js'
78
78
  export { eon } from './definitions/eon.js'
79
79
  export { eos } from './definitions/eos.js'
80
80
  export { eosTestnet } from './definitions/eosTestnet.js'
81
+ export { etherlink } from './definitions/etherlink.js'
81
82
  export { etherlinkTestnet } from './definitions/etherlinkTestnet.js'
82
83
  export { evmos } from './definitions/evmos.js'
83
84
  export { evmosTestnet } from './definitions/evmosTestnet.js'
@@ -146,6 +147,7 @@ export { localhost } from './definitions/localhost.js'
146
147
  export { lukso } from './definitions/lukso.js'
147
148
  export { luksoTestnet } from './definitions/luksoTestnet.js'
148
149
  export { lycan } from './definitions/lycan.js'
150
+ export { lyra } from './definitions/lyra.js'
149
151
  export { mainnet } from './definitions/mainnet.js'
150
152
  export { mandala } from './definitions/mandala.js'
151
153
  export { manta } from './definitions/manta.js'
@@ -171,6 +173,7 @@ export { moonbaseAlpha } from './definitions/moonbaseAlpha.js'
171
173
  export { moonbeam } from './definitions/moonbeam.js'
172
174
  export { moonbeamDev } from './definitions/moonbeamDev.js'
173
175
  export { moonriver } from './definitions/moonriver.js'
176
+ export { morphHolesky } from './definitions/morphHolesky.js'
174
177
  export { morphSepolia } from './definitions/morphSepolia.js'
175
178
  export { nautilus } from './definitions/nautilus.js'
176
179
  export { neonDevnet } from './definitions/neonDevnet.js'
@@ -206,6 +209,7 @@ export { pulsechain } from './definitions/pulsechain.js'
206
209
  export { pulsechainV4 } from './definitions/pulsechainV4.js'
207
210
  export { qMainnet } from './definitions/qMainnet.js'
208
211
  export { qTestnet } from './definitions/qTestnet.js'
212
+ export { real } from './definitions/real.js'
209
213
  export { redbellyTestnet } from './definitions/redbellyTestnet.js'
210
214
  export { redstone } from './definitions/redstone.js'
211
215
  export { reyaNetwork } from './definitions/reyaNetwork.js'
@@ -263,6 +267,7 @@ export { telosTestnet } from './definitions/telosTestnet.js'
263
267
  export { tenet } from './definitions/tenet.js'
264
268
  export { thaiChain } from './definitions/thaiChain.js'
265
269
  export { thunderTestnet } from './definitions/thunderTestnet.js'
270
+ export { unreal } from './definitions/unreal.js'
266
271
  export { vechain } from './definitions/vechain.js'
267
272
  export { wanchain } from './definitions/wanchain.js'
268
273
  export { wanchainTestnet } from './definitions/wanchainTestnet.js'
package/errors/base.ts CHANGED
@@ -1,20 +1,13 @@
1
1
  import { getVersion } from './utils.js'
2
2
 
3
3
  type BaseErrorParameters = {
4
+ cause?: BaseError | Error | undefined
5
+ details?: string | undefined
4
6
  docsBaseUrl?: string | undefined
5
7
  docsPath?: string | undefined
6
8
  docsSlug?: string | undefined
7
9
  metaMessages?: string[] | undefined
8
- } & (
9
- | {
10
- cause?: undefined
11
- details?: string | undefined
12
- }
13
- | {
14
- cause: BaseError | Error | undefined
15
- details?: undefined
16
- }
17
- )
10
+ }
18
11
 
19
12
  export type BaseErrorType = BaseError & { name: 'ViemError' }
20
13
  export class BaseError extends Error {
package/errors/request.ts CHANGED
@@ -16,18 +16,21 @@ export class HttpRequestError extends BaseError {
16
16
 
17
17
  constructor({
18
18
  body,
19
+ cause,
19
20
  details,
20
21
  headers,
21
22
  status,
22
23
  url,
23
24
  }: {
24
25
  body?: { [x: string]: unknown } | { [y: string]: unknown }[] | undefined
26
+ cause?: Error | undefined
25
27
  details?: string | undefined
26
28
  headers?: Headers | undefined
27
29
  status?: number | undefined
28
30
  url: string
29
31
  }) {
30
32
  super('HTTP request failed.', {
33
+ cause,
31
34
  details,
32
35
  metaMessages: [
33
36
  status && `Status: ${status}`,
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.16.2'
1
+ export const version = '2.16.4'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.16.2",
4
+ "version": "2.16.4",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
@@ -157,11 +157,11 @@
157
157
  },
158
158
  "dependencies": {
159
159
  "@adraffy/ens-normalize": "1.10.0",
160
- "@noble/curves": "1.2.0",
161
- "@noble/hashes": "1.3.2",
162
- "@scure/bip32": "1.3.2",
163
- "@scure/bip39": "1.2.1",
164
- "abitype": "1.0.4",
160
+ "@noble/curves": "1.4.0",
161
+ "@noble/hashes": "1.4.0",
162
+ "@scure/bip32": "1.4.0",
163
+ "@scure/bip39": "1.3.0",
164
+ "abitype": "1.0.5",
165
165
  "isows": "1.0.4",
166
166
  "ws": "8.17.1"
167
167
  },
package/utils/rpc/http.ts CHANGED
@@ -140,7 +140,7 @@ export function getHttpRpcClient(
140
140
  if (err instanceof TimeoutError) throw err
141
141
  throw new HttpRequestError({
142
142
  body,
143
- details: (err as Error).message,
143
+ cause: err as Error,
144
144
  url,
145
145
  })
146
146
  }