viem 0.0.1-alpha.23 → 0.0.1-alpha.25

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 (155) hide show
  1. package/contract/package.json +4 -0
  2. package/dist/call-ac509982.d.ts +23 -0
  3. package/dist/{chain-aa4898d0.d.ts → chain-c4ccb458.d.ts} +1 -1
  4. package/dist/{chain-4b39613a.d.ts → chain-f16512e8.d.ts} +20 -1
  5. package/dist/chains.d.ts +20 -8
  6. package/dist/chains.js +46 -46
  7. package/dist/chains.mjs +1 -1
  8. package/dist/{chunk-RJLUZTJS.mjs → chunk-2Y3UZMSP.mjs} +203 -84
  9. package/dist/chunk-2Y3UZMSP.mjs.map +1 -0
  10. package/dist/{chunk-ZKYGWITF.js → chunk-CD2XJOBJ.js} +261 -142
  11. package/dist/chunk-CD2XJOBJ.js.map +1 -0
  12. package/dist/{chunk-XBUH66KN.mjs → chunk-KSAO4Y4Q.mjs} +133 -54
  13. package/dist/chunk-KSAO4Y4Q.mjs.map +1 -0
  14. package/dist/{chunk-TXHOG6KU.mjs → chunk-LEPQJNVO.mjs} +18 -2
  15. package/dist/chunk-LEPQJNVO.mjs.map +1 -0
  16. package/dist/{chunk-7Y5QVLX7.js → chunk-NUXMGPMK.js} +30 -14
  17. package/dist/chunk-NUXMGPMK.js.map +1 -0
  18. package/dist/{chunk-SSPRUPGN.js → chunk-THMRUG4D.js} +148 -69
  19. package/dist/chunk-THMRUG4D.js.map +1 -0
  20. package/dist/{contract-4c3a37b3.d.ts → contract-9e76e561.d.ts} +44 -31
  21. package/dist/contract.d.ts +123 -0
  22. package/dist/contract.js +53 -0
  23. package/dist/{clients/index.js.map → contract.js.map} +0 -0
  24. package/dist/contract.mjs +53 -0
  25. package/dist/{clients/index.mjs.map → contract.mjs.map} +0 -0
  26. package/dist/{createClient-55a04188.d.ts → createClient-68ee4bb4.d.ts} +3 -3
  27. package/dist/{createPublicClient-3b27b282.d.ts → createPublicClient-b732194e.d.ts} +3 -3
  28. package/dist/{createTestClient-93f9eac6.d.ts → createTestClient-dedf321e.d.ts} +3 -3
  29. package/dist/{createWalletClient-c10df94d.d.ts → createWalletClient-75813d83.d.ts} +3 -3
  30. package/dist/decodeErrorResult-0b934d23.d.ts +16 -0
  31. package/dist/{eip1193-4c24765a.d.ts → eip1193-6f9ba163.d.ts} +1 -1
  32. package/dist/ens.d.ts +82 -1
  33. package/dist/ens.js +208 -3
  34. package/dist/ens.js.map +1 -1
  35. package/dist/ens.mjs +209 -4
  36. package/dist/ens.mjs.map +1 -1
  37. package/dist/getAbiItem-c8e6e7d4.d.ts +97 -0
  38. package/dist/index.d.ts +85 -133
  39. package/dist/index.js +237 -275
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +245 -283
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/public.d.ts +352 -10
  44. package/dist/public.js +3 -4
  45. package/dist/public.mjs +6 -7
  46. package/dist/readContract-4f6e2692.d.ts +10 -0
  47. package/dist/rpc-a5a7f376.d.ts +121 -0
  48. package/dist/{sendTransaction-f17a2389.d.ts → sendTransaction-e713f90c.d.ts} +3 -3
  49. package/dist/test.d.ts +160 -5
  50. package/dist/test.js +222 -18
  51. package/dist/test.js.map +1 -1
  52. package/dist/test.mjs +233 -29
  53. package/dist/test.mjs.map +1 -1
  54. package/dist/transactionReceipt-2a86c7c7.d.ts +26 -0
  55. package/dist/{transactionRequest-93e9f001.d.ts → transactionRequest-c7794f5e.d.ts} +1 -1
  56. package/dist/utils/index.d.ts +224 -20
  57. package/dist/utils/index.js +2 -6
  58. package/dist/utils/index.mjs +3 -7
  59. package/dist/wallet.d.ts +41 -7
  60. package/dist/wallet.js +3 -3
  61. package/dist/wallet.mjs +2 -2
  62. package/dist/watchEvent-c346c12d.d.ts +41 -0
  63. package/dist/window.d.ts +2 -2
  64. package/ens/package.json +4 -0
  65. package/package.json +13 -9
  66. package/src/_test/constants.ts +2 -0
  67. package/src/_test/utils.ts +10 -5
  68. package/src/actions/ens/getEnsAddress.bench.ts +26 -0
  69. package/src/actions/ens/getEnsAddress.test.ts +97 -0
  70. package/src/actions/ens/getEnsAddress.ts +122 -0
  71. package/src/actions/ens/getEnsName.bench.ts +30 -0
  72. package/src/actions/ens/getEnsName.test.ts +101 -0
  73. package/src/actions/ens/getEnsName.ts +106 -0
  74. package/src/actions/ens/index.test.ts +12 -0
  75. package/src/actions/ens/index.ts +3 -0
  76. package/src/actions/index.test.ts +2 -0
  77. package/src/actions/index.ts +9 -3
  78. package/src/actions/public/createEventFilter.test.ts +36 -4
  79. package/src/actions/public/createEventFilter.ts +27 -10
  80. package/src/actions/public/getFilterChanges.test.ts +198 -4
  81. package/src/actions/public/getFilterLogs.test.ts +195 -2
  82. package/src/actions/public/getLogs.test.ts +201 -2
  83. package/src/actions/public/index.test.ts +0 -1
  84. package/src/actions/public/index.ts +1 -7
  85. package/src/actions/public/multicall.ts +8 -3
  86. package/src/actions/public/simulateContract.ts +1 -4
  87. package/src/actions/public/watchContractEvent.test.ts +4 -4
  88. package/src/actions/{public → wallet}/deployContract.test.ts +1 -2
  89. package/src/actions/{public → wallet}/deployContract.ts +0 -0
  90. package/src/actions/wallet/index.test.ts +1 -0
  91. package/src/actions/wallet/index.ts +6 -0
  92. package/src/chains.test.ts +44 -1517
  93. package/src/clients/transports/webSocket.test.ts +1 -0
  94. package/src/clients/transports/webSocket.ts +1 -0
  95. package/src/contract.test.ts +31 -0
  96. package/src/contract.ts +68 -0
  97. package/src/ens.test.ts +15 -0
  98. package/src/ens.ts +4 -1
  99. package/src/errors/abi.ts +18 -2
  100. package/src/errors/chain.test.ts +46 -0
  101. package/src/errors/chain.ts +33 -0
  102. package/src/errors/contract.ts +2 -2
  103. package/src/errors/index.ts +3 -0
  104. package/src/index.test.ts +0 -145
  105. package/src/index.ts +0 -251
  106. package/src/public.test.ts +36 -0
  107. package/src/public.ts +2 -6
  108. package/src/test.test.ts +38 -0
  109. package/src/test.ts +1 -0
  110. package/src/types/contract.ts +144 -40
  111. package/src/types/index.ts +2 -1
  112. package/src/types/utils.ts +21 -0
  113. package/src/utils/abi/decodeErrorResult.test.ts +1 -1
  114. package/src/utils/abi/decodeEventLog.test.ts +542 -0
  115. package/src/utils/abi/decodeEventLog.ts +107 -0
  116. package/src/utils/abi/decodeFunctionData.test.ts +1 -2
  117. package/src/utils/abi/decodeFunctionData.ts +5 -2
  118. package/src/utils/abi/encodeFunctionData.ts +1 -4
  119. package/src/utils/abi/index.test.ts +1 -0
  120. package/src/utils/abi/index.ts +6 -0
  121. package/src/utils/ens/index.test.ts +1 -0
  122. package/src/utils/ens/index.ts +2 -0
  123. package/src/utils/ens/packetToBytes.test.ts +11 -0
  124. package/src/utils/ens/packetToBytes.ts +29 -0
  125. package/src/utils/index.test.ts +1 -3
  126. package/src/utils/index.ts +3 -2
  127. package/src/utils/rpc.test.ts +1 -0
  128. package/src/utils/rpc.ts +4 -2
  129. package/src/wallet.test.ts +19 -0
  130. package/wallet/package.json +4 -0
  131. package/clients/package.json +0 -4
  132. package/dist/chunk-7Y5QVLX7.js.map +0 -1
  133. package/dist/chunk-BV5NTHUX.js +0 -260
  134. package/dist/chunk-BV5NTHUX.js.map +0 -1
  135. package/dist/chunk-EGVXCZNJ.mjs +0 -260
  136. package/dist/chunk-EGVXCZNJ.mjs.map +0 -1
  137. package/dist/chunk-GX2KDAM3.mjs +0 -256
  138. package/dist/chunk-GX2KDAM3.mjs.map +0 -1
  139. package/dist/chunk-NW6724MI.js +0 -256
  140. package/dist/chunk-NW6724MI.js.map +0 -1
  141. package/dist/chunk-RJLUZTJS.mjs.map +0 -1
  142. package/dist/chunk-SSPRUPGN.js.map +0 -1
  143. package/dist/chunk-TXHOG6KU.mjs.map +0 -1
  144. package/dist/chunk-XBUH66KN.mjs.map +0 -1
  145. package/dist/chunk-ZKYGWITF.js.map +0 -1
  146. package/dist/clients/index.d.ts +0 -9
  147. package/dist/clients/index.js +0 -24
  148. package/dist/clients/index.mjs +0 -24
  149. package/dist/normalize-ef9240c0.d.ts +0 -33
  150. package/dist/parseGwei-3411cf2d.d.ts +0 -355
  151. package/dist/rpc-26932bae.d.ts +0 -61
  152. package/dist/stopImpersonatingAccount-afb26486.d.ts +0 -156
  153. package/dist/watchAsset-efd3dd05.d.ts +0 -38
  154. package/dist/watchPendingTransactions-57df1a13.d.ts +0 -373
  155. package/dist/webSocket-d2e7bd0e.d.ts +0 -83
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
4
 
@@ -8,7 +8,6 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkBV5NTHUXjs = require('./chunk-BV5NTHUX.js');
12
11
 
13
12
 
14
13
 
@@ -41,7 +40,6 @@ var _chunkBV5NTHUXjs = require('./chunk-BV5NTHUX.js');
41
40
 
42
41
 
43
42
 
44
- var _chunkZKYGWITFjs = require('./chunk-ZKYGWITF.js');
45
43
 
46
44
 
47
45
 
@@ -59,18 +57,252 @@ var _chunkZKYGWITFjs = require('./chunk-ZKYGWITF.js');
59
57
 
60
58
 
61
59
 
60
+ var _chunkTHMRUG4Djs = require('./chunk-THMRUG4D.js');
62
61
 
62
+ // src/clients/transports/createTransport.ts
63
+ function createTransport(config, value) {
64
+ return {
65
+ config,
66
+ value
67
+ };
68
+ }
63
69
 
70
+ // src/clients/transports/custom.ts
71
+ function custom(provider, { key = "custom", name = "Custom Provider" } = {}) {
72
+ return () => createTransport({
73
+ key,
74
+ name,
75
+ request: provider.request.bind(provider),
76
+ type: "custom"
77
+ });
78
+ }
64
79
 
80
+ // src/clients/transports/fallback.ts
81
+ function fallback(transports, { key = "fallback", name = "Fallback" } = {}) {
82
+ return ({ chain }) => createTransport(
83
+ {
84
+ key,
85
+ name,
86
+ async request({ method, params }) {
87
+ const fetch = async (i = 0) => {
88
+ const transport = transports[i]({ chain });
89
+ try {
90
+ return await transport.config.request({
91
+ method,
92
+ params
93
+ });
94
+ } catch (err) {
95
+ if (!(err instanceof _chunkTHMRUG4Djs.RpcError) && i < transports.length - 1)
96
+ return fetch(i + 1);
97
+ throw err;
98
+ }
99
+ };
100
+ return fetch();
101
+ },
102
+ type: "fallback"
103
+ },
104
+ {
105
+ transports: transports.map(
106
+ (fn) => fn({ chain })
107
+ )
108
+ }
109
+ );
110
+ }
65
111
 
112
+ // src/clients/transports/http.ts
113
+ function http(url, { key = "http", name = "HTTP JSON-RPC" } = {}) {
114
+ return ({ chain }) => {
115
+ const url_ = url || _optionalChain([chain, 'optionalAccess', _ => _.rpcUrls, 'access', _2 => _2.default, 'access', _3 => _3.http, 'access', _4 => _4[0]]);
116
+ if (!url_)
117
+ throw new (0, _chunkTHMRUG4Djs.UrlRequiredError)();
118
+ return createTransport(
119
+ {
120
+ key,
121
+ name,
122
+ async request({ method, params }) {
123
+ const { result } = await _chunkTHMRUG4Djs.rpc.http(url_, {
124
+ body: {
125
+ method,
126
+ params
127
+ }
128
+ });
129
+ return result;
130
+ },
131
+ type: "http"
132
+ },
133
+ {
134
+ url
135
+ }
136
+ );
137
+ };
138
+ }
139
+
140
+ // src/clients/transports/webSocket.ts
141
+ function webSocket(url, {
142
+ key = "webSocket",
143
+ name = "WebSocket JSON-RPC"
144
+ } = {}) {
145
+ return ({ chain }) => {
146
+ const url_ = url || _optionalChain([chain, 'optionalAccess', _5 => _5.rpcUrls, 'access', _6 => _6.default, 'access', _7 => _7.webSocket, 'optionalAccess', _8 => _8[0]]);
147
+ if (!url_)
148
+ throw new (0, _chunkTHMRUG4Djs.UrlRequiredError)();
149
+ return createTransport(
150
+ {
151
+ key,
152
+ name,
153
+ async request({ method, params }) {
154
+ const socket = await _chunkTHMRUG4Djs.getSocket.call(void 0, url_);
155
+ const { result } = await _chunkTHMRUG4Djs.rpc.webSocketAsync(socket, {
156
+ body: { method, params }
157
+ });
158
+ return result;
159
+ },
160
+ type: "webSocket"
161
+ },
162
+ {
163
+ getSocket() {
164
+ return _chunkTHMRUG4Djs.getSocket.call(void 0, url_);
165
+ },
166
+ async subscribe({ params, onData, onError }) {
167
+ const socket = await _chunkTHMRUG4Djs.getSocket.call(void 0, url_);
168
+ const { result: subscriptionId } = await new Promise(
169
+ (resolve, reject) => _chunkTHMRUG4Djs.rpc.webSocket(socket, {
170
+ body: {
171
+ method: "eth_subscribe",
172
+ params
173
+ },
174
+ onData: (data) => {
175
+ if (typeof data.id === "number") {
176
+ resolve(data);
177
+ return;
178
+ }
179
+ onData(data);
180
+ },
181
+ onError: (error) => {
182
+ reject(error);
183
+ _optionalChain([onError, 'optionalCall', _9 => _9(error)]);
184
+ }
185
+ })
186
+ );
187
+ return {
188
+ subscriptionId,
189
+ async unsubscribe() {
190
+ return new Promise(
191
+ (resolve, reject) => _chunkTHMRUG4Djs.rpc.webSocket(socket, {
192
+ body: {
193
+ method: "eth_unsubscribe",
194
+ params: [subscriptionId]
195
+ },
196
+ onData: resolve,
197
+ onError: reject
198
+ })
199
+ );
200
+ }
201
+ };
202
+ }
203
+ }
204
+ );
205
+ };
206
+ }
207
+
208
+ // src/utils/uid.ts
209
+ var size = 256;
210
+ var index = size;
211
+ var buffer;
212
+ function uid(length = 11) {
213
+ if (!buffer || index + length > size * 2) {
214
+ buffer = "";
215
+ index = 0;
216
+ for (let i = 0; i < size; i++) {
217
+ buffer += (256 + Math.random() * 256 | 0).toString(16).substring(1);
218
+ }
219
+ }
220
+ return buffer.substring(index, index++ + length);
221
+ }
222
+
223
+ // src/clients/createClient.ts
224
+ function createClient({
225
+ chain,
226
+ key = "base",
227
+ name = "Base Client",
228
+ pollingInterval = 4e3,
229
+ transport,
230
+ type = "base"
231
+ }) {
232
+ const { config, value } = transport({ chain });
233
+ return {
234
+ chain,
235
+ key,
236
+ name,
237
+ pollingInterval,
238
+ request: _chunkTHMRUG4Djs.buildRequest.call(void 0, config.request),
239
+ transport: { ...config, ...value },
240
+ type,
241
+ uid: uid()
242
+ };
243
+ }
244
+
245
+ // src/clients/createPublicClient.ts
246
+ function createPublicClient({
247
+ chain,
248
+ key = "public",
249
+ name = "Public Client",
250
+ transport,
251
+ pollingInterval
252
+ }) {
253
+ chain;
254
+ return createClient({
255
+ chain,
256
+ key,
257
+ name,
258
+ pollingInterval,
259
+ transport,
260
+ type: "publicClient"
261
+ });
262
+ }
66
263
 
264
+ // src/clients/createTestClient.ts
265
+ function createTestClient({
266
+ chain,
267
+ key = "test",
268
+ name = "Test Client",
269
+ mode,
270
+ pollingInterval,
271
+ transport
272
+ }) {
273
+ return {
274
+ ...createClient({
275
+ chain,
276
+ key,
277
+ name,
278
+ pollingInterval,
279
+ transport,
280
+ type: "testClient"
281
+ }),
282
+ mode
283
+ };
284
+ }
67
285
 
286
+ // src/clients/createWalletClient.ts
287
+ function createWalletClient({
288
+ transport,
289
+ key = "wallet",
290
+ name = "Wallet Client",
291
+ pollingInterval
292
+ }) {
293
+ return createClient({
294
+ key,
295
+ name,
296
+ pollingInterval,
297
+ transport,
298
+ type: "walletClient"
299
+ });
300
+ }
68
301
 
69
302
 
70
303
 
71
304
 
72
305
 
73
- var _chunkNW6724MIjs = require('./chunk-NW6724MI.js');
74
306
 
75
307
 
76
308
 
@@ -82,7 +314,6 @@ var _chunkNW6724MIjs = require('./chunk-NW6724MI.js');
82
314
 
83
315
 
84
316
 
85
- var _chunk7Y5QVLX7js = require('./chunk-7Y5QVLX7.js');
86
317
 
87
318
 
88
319
 
@@ -132,274 +363,5 @@ var _chunk7Y5QVLX7js = require('./chunk-7Y5QVLX7.js');
132
363
 
133
364
 
134
365
 
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
-
205
-
206
- var _chunkSSPRUPGNjs = require('./chunk-SSPRUPGN.js');
207
-
208
-
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
-
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
-
304
-
305
-
306
-
307
-
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
-
322
-
323
-
324
-
325
-
326
-
327
-
328
-
329
-
330
-
331
-
332
-
333
-
334
-
335
-
336
-
337
-
338
-
339
-
340
-
341
-
342
-
343
-
344
-
345
-
346
-
347
-
348
-
349
-
350
-
351
-
352
-
353
-
354
-
355
-
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
-
366
-
367
-
368
-
369
-
370
-
371
-
372
-
373
-
374
-
375
-
376
-
377
-
378
-
379
-
380
-
381
-
382
-
383
-
384
-
385
-
386
-
387
-
388
-
389
-
390
-
391
-
392
-
393
-
394
-
395
-
396
-
397
-
398
-
399
-
400
-
401
-
402
-
403
-
404
- exports.AbiConstructorNotFoundError = _chunkSSPRUPGNjs.AbiConstructorNotFoundError; exports.AbiConstructorParamsNotFoundError = _chunkSSPRUPGNjs.AbiConstructorParamsNotFoundError; exports.AbiDecodingDataSizeInvalidError = _chunkSSPRUPGNjs.AbiDecodingDataSizeInvalidError; exports.AbiEncodingArrayLengthMismatchError = _chunkSSPRUPGNjs.AbiEncodingArrayLengthMismatchError; exports.AbiEncodingLengthMismatchError = _chunkSSPRUPGNjs.AbiEncodingLengthMismatchError; exports.AbiErrorInputsNotFoundError = _chunkSSPRUPGNjs.AbiErrorInputsNotFoundError; exports.AbiErrorNotFoundError = _chunkSSPRUPGNjs.AbiErrorNotFoundError; exports.AbiErrorSignatureNotFoundError = _chunkSSPRUPGNjs.AbiErrorSignatureNotFoundError; exports.AbiEventNotFoundError = _chunkSSPRUPGNjs.AbiEventNotFoundError; exports.AbiFunctionNotFoundError = _chunkSSPRUPGNjs.AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = _chunkSSPRUPGNjs.AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = _chunkSSPRUPGNjs.AbiFunctionSignatureNotFoundError; exports.BaseError = _chunkSSPRUPGNjs.BaseError; exports.BlockNotFoundError = _chunkSSPRUPGNjs.BlockNotFoundError; exports.ContractFunctionExecutionError = _chunkSSPRUPGNjs.ContractFunctionExecutionError; exports.ContractFunctionRevertedError = _chunkSSPRUPGNjs.ContractFunctionRevertedError; exports.ContractFunctionZeroDataError = _chunkSSPRUPGNjs.ContractFunctionZeroDataError; exports.DataLengthTooLongError = _chunkSSPRUPGNjs.DataLengthTooLongError; exports.DataLengthTooShortError = _chunkSSPRUPGNjs.DataLengthTooShortError; exports.FilterTypeNotSupportedError = _chunkSSPRUPGNjs.FilterTypeNotSupportedError; exports.HttpRequestError = _chunkSSPRUPGNjs.HttpRequestError; exports.InternalRpcError = _chunkSSPRUPGNjs.InternalRpcError; exports.InvalidAbiDecodingTypeError = _chunkSSPRUPGNjs.InvalidAbiDecodingTypeError; exports.InvalidAbiEncodingTypeError = _chunkSSPRUPGNjs.InvalidAbiEncodingTypeError; exports.InvalidAddressError = _chunkSSPRUPGNjs.InvalidAddressError; exports.InvalidArrayError = _chunkSSPRUPGNjs.InvalidArrayError; exports.InvalidBytesBooleanError = _chunkSSPRUPGNjs.InvalidBytesBooleanError; exports.InvalidDefinitionTypeError = _chunkSSPRUPGNjs.InvalidDefinitionTypeError; exports.InvalidGasArgumentsError = _chunkSSPRUPGNjs.InvalidGasArgumentsError; exports.InvalidHexBooleanError = _chunkSSPRUPGNjs.InvalidHexBooleanError; exports.InvalidHexValueError = _chunkSSPRUPGNjs.InvalidHexValueError; exports.InvalidInputRpcError = _chunkSSPRUPGNjs.InvalidInputRpcError; exports.InvalidParamsRpcError = _chunkSSPRUPGNjs.InvalidParamsRpcError; exports.InvalidRequestRpcError = _chunkSSPRUPGNjs.InvalidRequestRpcError; exports.JsonRpcVersionUnsupportedError = _chunkSSPRUPGNjs.JsonRpcVersionUnsupportedError; exports.LimitExceededRpcError = _chunkSSPRUPGNjs.LimitExceededRpcError; exports.MethodNotFoundRpcError = _chunkSSPRUPGNjs.MethodNotFoundRpcError; exports.MethodNotSupportedRpcError = _chunkSSPRUPGNjs.MethodNotSupportedRpcError; exports.OffsetOutOfBoundsError = _chunkSSPRUPGNjs.OffsetOutOfBoundsError; exports.ParseRpcError = _chunkSSPRUPGNjs.ParseRpcError; exports.RequestError = _chunkSSPRUPGNjs.RequestError; exports.ResourceNotFoundRpcError = _chunkSSPRUPGNjs.ResourceNotFoundRpcError; exports.ResourceUnavailableRpcError = _chunkSSPRUPGNjs.ResourceUnavailableRpcError; exports.RpcError = _chunkSSPRUPGNjs.RpcError; exports.RpcRequestError = _chunkSSPRUPGNjs.RpcRequestError; exports.SizeExceedsPaddingSizeError = _chunkSSPRUPGNjs.SizeExceedsPaddingSizeError; exports.TimeoutError = _chunkSSPRUPGNjs.TimeoutError; exports.TransactionNotFoundError = _chunkSSPRUPGNjs.TransactionNotFoundError; exports.TransactionReceiptNotFoundError = _chunkSSPRUPGNjs.TransactionReceiptNotFoundError; exports.TransactionRejectedRpcError = _chunkSSPRUPGNjs.TransactionRejectedRpcError; exports.UnknownRpcError = _chunkSSPRUPGNjs.UnknownRpcError; exports.UrlRequiredError = _chunkSSPRUPGNjs.UrlRequiredError; exports.WaitForTransactionReceiptTimeoutError = _chunkSSPRUPGNjs.WaitForTransactionReceiptTimeoutError; exports.WebSocketRequestError = _chunkSSPRUPGNjs.WebSocketRequestError; exports.addChain = _chunk7Y5QVLX7js.addChain; exports.boolToBytes = _chunkSSPRUPGNjs.boolToBytes; exports.boolToHex = _chunkSSPRUPGNjs.boolToHex; exports.bytesToBigint = _chunkSSPRUPGNjs.bytesToBigint; exports.bytesToBool = _chunkSSPRUPGNjs.bytesToBool; exports.bytesToHex = _chunkSSPRUPGNjs.bytesToHex; exports.bytesToNumber = _chunkSSPRUPGNjs.bytesToNumber; exports.bytesToString = _chunkSSPRUPGNjs.bytesToString; exports.call = _chunkZKYGWITFjs.call; exports.createBlockFilter = _chunkZKYGWITFjs.createBlockFilter; exports.createClient = _chunkBV5NTHUXjs.createClient; exports.createContractEventFilter = _chunkZKYGWITFjs.createContractEventFilter; exports.createEventFilter = _chunkZKYGWITFjs.createEventFilter; exports.createPendingTransactionFilter = _chunkZKYGWITFjs.createPendingTransactionFilter; exports.createPublicClient = _chunkBV5NTHUXjs.createPublicClient; exports.createTestClient = _chunkBV5NTHUXjs.createTestClient; exports.createTransport = _chunkBV5NTHUXjs.createTransport; exports.createWalletClient = _chunkBV5NTHUXjs.createWalletClient; exports.custom = _chunkBV5NTHUXjs.custom; exports.decodeAbi = _chunkSSPRUPGNjs.decodeAbi; exports.decodeBytes = _chunkSSPRUPGNjs.decodeBytes; exports.decodeErrorResult = _chunkSSPRUPGNjs.decodeErrorResult; exports.decodeFunctionData = _chunkSSPRUPGNjs.decodeFunctionData; exports.decodeFunctionResult = _chunkSSPRUPGNjs.decodeFunctionResult; exports.decodeHex = _chunkSSPRUPGNjs.decodeHex; exports.decodeRlp = _chunkSSPRUPGNjs.decodeRlp; exports.deployContract = _chunkZKYGWITFjs.deployContract; exports.dropTransaction = _chunkNW6724MIjs.dropTransaction; exports.encodeAbi = _chunkSSPRUPGNjs.encodeAbi; exports.encodeBytes = _chunkSSPRUPGNjs.encodeBytes; exports.encodeDeployData = _chunkSSPRUPGNjs.encodeDeployData; exports.encodeErrorResult = _chunkSSPRUPGNjs.encodeErrorResult; exports.encodeEventTopics = _chunkSSPRUPGNjs.encodeEventTopics; exports.encodeFunctionData = _chunkSSPRUPGNjs.encodeFunctionData; exports.encodeFunctionResult = _chunkSSPRUPGNjs.encodeFunctionResult; exports.encodeHex = _chunkSSPRUPGNjs.encodeHex; exports.encodeRlp = _chunkSSPRUPGNjs.encodeRlp; exports.estimateGas = _chunkZKYGWITFjs.estimateGas; exports.etherUnits = _chunkSSPRUPGNjs.etherUnits; exports.fallback = _chunkBV5NTHUXjs.fallback; exports.formatBlock = _chunkSSPRUPGNjs.formatBlock; exports.formatEther = _chunkSSPRUPGNjs.formatEther; exports.formatGwei = _chunkSSPRUPGNjs.formatGwei; exports.formatTransaction = _chunkSSPRUPGNjs.formatTransaction; exports.formatTransactionRequest = _chunkSSPRUPGNjs.formatTransactionRequest; exports.formatUnit = _chunkSSPRUPGNjs.formatUnit; exports.getAccounts = _chunk7Y5QVLX7js.getAccounts; exports.getAddress = _chunkSSPRUPGNjs.getAddress; exports.getAutomine = _chunkNW6724MIjs.getAutomine; exports.getBalance = _chunkZKYGWITFjs.getBalance; exports.getBlock = _chunkZKYGWITFjs.getBlock; exports.getBlockNumber = _chunkZKYGWITFjs.getBlockNumber; exports.getBlockTransactionCount = _chunkZKYGWITFjs.getBlockTransactionCount; exports.getBytecode = _chunkZKYGWITFjs.getBytecode; exports.getChainId = _chunkZKYGWITFjs.getChainId; exports.getContractAddress = _chunkSSPRUPGNjs.getContractAddress; exports.getCreate2Address = _chunkSSPRUPGNjs.getCreate2Address; exports.getCreateAddress = _chunkSSPRUPGNjs.getCreateAddress; exports.getEventSignature = _chunkSSPRUPGNjs.getEventSignature; exports.getFeeHistory = _chunkZKYGWITFjs.getFeeHistory; exports.getFilterChanges = _chunkZKYGWITFjs.getFilterChanges; exports.getFilterLogs = _chunkZKYGWITFjs.getFilterLogs; exports.getFunctionSignature = _chunkSSPRUPGNjs.getFunctionSignature; exports.getGasPrice = _chunkZKYGWITFjs.getGasPrice; exports.getLogs = _chunkZKYGWITFjs.getLogs; exports.getPermissions = _chunk7Y5QVLX7js.getPermissions; exports.getStorageAt = _chunkZKYGWITFjs.getStorageAt; exports.getTransaction = _chunkZKYGWITFjs.getTransaction; exports.getTransactionConfirmations = _chunkZKYGWITFjs.getTransactionConfirmations; exports.getTransactionCount = _chunkZKYGWITFjs.getTransactionCount; exports.getTransactionReceipt = _chunkZKYGWITFjs.getTransactionReceipt; exports.getTxpoolContent = _chunkNW6724MIjs.getTxpoolContent; exports.getTxpoolStatus = _chunkNW6724MIjs.getTxpoolStatus; exports.gweiUnits = _chunkSSPRUPGNjs.gweiUnits; exports.hexToBigInt = _chunkSSPRUPGNjs.hexToBigInt; exports.hexToBool = _chunkSSPRUPGNjs.hexToBool; exports.hexToBytes = _chunkSSPRUPGNjs.hexToBytes; exports.hexToNumber = _chunkSSPRUPGNjs.hexToNumber; exports.hexToString = _chunkSSPRUPGNjs.hexToString; exports.http = _chunkBV5NTHUXjs.http; exports.impersonateAccount = _chunkNW6724MIjs.impersonateAccount; exports.increaseTime = _chunkNW6724MIjs.increaseTime; exports.inspectTxpool = _chunkNW6724MIjs.inspectTxpool; exports.isAddress = _chunkSSPRUPGNjs.isAddress; exports.isAddressEqual = _chunkSSPRUPGNjs.isAddressEqual; exports.isBytes = _chunkSSPRUPGNjs.isBytes; exports.isHex = _chunkSSPRUPGNjs.isHex; exports.keccak256 = _chunkSSPRUPGNjs.keccak256; exports.mine = _chunkNW6724MIjs.mine; exports.multicall = _chunkZKYGWITFjs.multicall; exports.multicall3Abi = _chunkSSPRUPGNjs.multicall3Abi; exports.numberToBytes = _chunkSSPRUPGNjs.numberToBytes; exports.numberToHex = _chunkSSPRUPGNjs.numberToHex; exports.pad = _chunkSSPRUPGNjs.pad; exports.padBytes = _chunkSSPRUPGNjs.padBytes; exports.padHex = _chunkSSPRUPGNjs.padHex; exports.parseEther = _chunkSSPRUPGNjs.parseEther; exports.parseGwei = _chunkSSPRUPGNjs.parseGwei; exports.parseUnit = _chunkSSPRUPGNjs.parseUnit; exports.readContract = _chunkZKYGWITFjs.readContract; exports.removeBlockTimestampInterval = _chunkNW6724MIjs.removeBlockTimestampInterval; exports.requestAccounts = _chunk7Y5QVLX7js.requestAccounts; exports.requestPermissions = _chunk7Y5QVLX7js.requestPermissions; exports.reset = _chunkNW6724MIjs.reset; exports.revert = _chunkNW6724MIjs.revert; exports.sendTransaction = _chunk7Y5QVLX7js.sendTransaction; exports.sendUnsignedTransaction = _chunkNW6724MIjs.sendUnsignedTransaction; exports.setAutomine = _chunkNW6724MIjs.setAutomine; exports.setBalance = _chunkNW6724MIjs.setBalance; exports.setBlockGasLimit = _chunkNW6724MIjs.setBlockGasLimit; exports.setBlockTimestampInterval = _chunkNW6724MIjs.setBlockTimestampInterval; exports.setCode = _chunkNW6724MIjs.setCode; exports.setCoinbase = _chunkNW6724MIjs.setCoinbase; exports.setIntervalMining = _chunkNW6724MIjs.setIntervalMining; exports.setLoggingEnabled = _chunkNW6724MIjs.setLoggingEnabled; exports.setMinGasPrice = _chunkNW6724MIjs.setMinGasPrice; exports.setNextBlockBaseFeePerGas = _chunkNW6724MIjs.setNextBlockBaseFeePerGas; exports.setNextBlockTimestamp = _chunkNW6724MIjs.setNextBlockTimestamp; exports.setNonce = _chunkNW6724MIjs.setNonce; exports.setStorageAt = _chunkNW6724MIjs.setStorageAt; exports.signMessage = _chunk7Y5QVLX7js.signMessage; exports.simulateContract = _chunkZKYGWITFjs.simulateContract; exports.size = _chunkSSPRUPGNjs.size; exports.slice = _chunkSSPRUPGNjs.slice; exports.sliceBytes = _chunkSSPRUPGNjs.sliceBytes; exports.sliceHex = _chunkSSPRUPGNjs.sliceHex; exports.snapshot = _chunkNW6724MIjs.snapshot; exports.stopImpersonatingAccount = _chunkNW6724MIjs.stopImpersonatingAccount; exports.stringToBytes = _chunkSSPRUPGNjs.stringToBytes; exports.stringToHex = _chunkSSPRUPGNjs.stringToHex; exports.switchChain = _chunk7Y5QVLX7js.switchChain; exports.transactionType = _chunkSSPRUPGNjs.transactionType; exports.trim = _chunkSSPRUPGNjs.trim; exports.uninstallFilter = _chunkZKYGWITFjs.uninstallFilter; exports.waitForTransactionReceipt = _chunkZKYGWITFjs.waitForTransactionReceipt; exports.watchAsset = _chunk7Y5QVLX7js.watchAsset; exports.watchBlockNumber = _chunkZKYGWITFjs.watchBlockNumber; exports.watchBlocks = _chunkZKYGWITFjs.watchBlocks; exports.watchPendingTransactions = _chunkZKYGWITFjs.watchPendingTransactions; exports.webSocket = _chunkBV5NTHUXjs.webSocket; exports.weiUnits = _chunkSSPRUPGNjs.weiUnits; exports.writeContract = _chunk7Y5QVLX7js.writeContract;
366
+ exports.AbiConstructorNotFoundError = _chunkTHMRUG4Djs.AbiConstructorNotFoundError; exports.AbiConstructorParamsNotFoundError = _chunkTHMRUG4Djs.AbiConstructorParamsNotFoundError; exports.AbiDecodingDataSizeInvalidError = _chunkTHMRUG4Djs.AbiDecodingDataSizeInvalidError; exports.AbiEncodingArrayLengthMismatchError = _chunkTHMRUG4Djs.AbiEncodingArrayLengthMismatchError; exports.AbiEncodingLengthMismatchError = _chunkTHMRUG4Djs.AbiEncodingLengthMismatchError; exports.AbiErrorInputsNotFoundError = _chunkTHMRUG4Djs.AbiErrorInputsNotFoundError; exports.AbiErrorNotFoundError = _chunkTHMRUG4Djs.AbiErrorNotFoundError; exports.AbiErrorSignatureNotFoundError = _chunkTHMRUG4Djs.AbiErrorSignatureNotFoundError; exports.AbiEventNotFoundError = _chunkTHMRUG4Djs.AbiEventNotFoundError; exports.AbiFunctionNotFoundError = _chunkTHMRUG4Djs.AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = _chunkTHMRUG4Djs.AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = _chunkTHMRUG4Djs.AbiFunctionSignatureNotFoundError; exports.BaseError = _chunkTHMRUG4Djs.BaseError; exports.BlockNotFoundError = _chunkTHMRUG4Djs.BlockNotFoundError; exports.ContractFunctionExecutionError = _chunkTHMRUG4Djs.ContractFunctionExecutionError; exports.ContractFunctionRevertedError = _chunkTHMRUG4Djs.ContractFunctionRevertedError; exports.ContractFunctionZeroDataError = _chunkTHMRUG4Djs.ContractFunctionZeroDataError; exports.DataLengthTooLongError = _chunkTHMRUG4Djs.DataLengthTooLongError; exports.DataLengthTooShortError = _chunkTHMRUG4Djs.DataLengthTooShortError; exports.FilterTypeNotSupportedError = _chunkTHMRUG4Djs.FilterTypeNotSupportedError; exports.HttpRequestError = _chunkTHMRUG4Djs.HttpRequestError; exports.InternalRpcError = _chunkTHMRUG4Djs.InternalRpcError; exports.InvalidAbiDecodingTypeError = _chunkTHMRUG4Djs.InvalidAbiDecodingTypeError; exports.InvalidAbiEncodingTypeError = _chunkTHMRUG4Djs.InvalidAbiEncodingTypeError; exports.InvalidAddressError = _chunkTHMRUG4Djs.InvalidAddressError; exports.InvalidArrayError = _chunkTHMRUG4Djs.InvalidArrayError; exports.InvalidBytesBooleanError = _chunkTHMRUG4Djs.InvalidBytesBooleanError; exports.InvalidDefinitionTypeError = _chunkTHMRUG4Djs.InvalidDefinitionTypeError; exports.InvalidGasArgumentsError = _chunkTHMRUG4Djs.InvalidGasArgumentsError; exports.InvalidHexBooleanError = _chunkTHMRUG4Djs.InvalidHexBooleanError; exports.InvalidHexValueError = _chunkTHMRUG4Djs.InvalidHexValueError; exports.InvalidInputRpcError = _chunkTHMRUG4Djs.InvalidInputRpcError; exports.InvalidParamsRpcError = _chunkTHMRUG4Djs.InvalidParamsRpcError; exports.InvalidRequestRpcError = _chunkTHMRUG4Djs.InvalidRequestRpcError; exports.JsonRpcVersionUnsupportedError = _chunkTHMRUG4Djs.JsonRpcVersionUnsupportedError; exports.LimitExceededRpcError = _chunkTHMRUG4Djs.LimitExceededRpcError; exports.MethodNotFoundRpcError = _chunkTHMRUG4Djs.MethodNotFoundRpcError; exports.MethodNotSupportedRpcError = _chunkTHMRUG4Djs.MethodNotSupportedRpcError; exports.OffsetOutOfBoundsError = _chunkTHMRUG4Djs.OffsetOutOfBoundsError; exports.ParseRpcError = _chunkTHMRUG4Djs.ParseRpcError; exports.RequestError = _chunkTHMRUG4Djs.RequestError; exports.ResourceNotFoundRpcError = _chunkTHMRUG4Djs.ResourceNotFoundRpcError; exports.ResourceUnavailableRpcError = _chunkTHMRUG4Djs.ResourceUnavailableRpcError; exports.RpcError = _chunkTHMRUG4Djs.RpcError; exports.RpcRequestError = _chunkTHMRUG4Djs.RpcRequestError; exports.SizeExceedsPaddingSizeError = _chunkTHMRUG4Djs.SizeExceedsPaddingSizeError; exports.TimeoutError = _chunkTHMRUG4Djs.TimeoutError; exports.TransactionNotFoundError = _chunkTHMRUG4Djs.TransactionNotFoundError; exports.TransactionReceiptNotFoundError = _chunkTHMRUG4Djs.TransactionReceiptNotFoundError; exports.TransactionRejectedRpcError = _chunkTHMRUG4Djs.TransactionRejectedRpcError; exports.UnknownRpcError = _chunkTHMRUG4Djs.UnknownRpcError; exports.UrlRequiredError = _chunkTHMRUG4Djs.UrlRequiredError; exports.WaitForTransactionReceiptTimeoutError = _chunkTHMRUG4Djs.WaitForTransactionReceiptTimeoutError; exports.WebSocketRequestError = _chunkTHMRUG4Djs.WebSocketRequestError; exports.createClient = createClient; exports.createPublicClient = createPublicClient; exports.createTestClient = createTestClient; exports.createTransport = createTransport; exports.createWalletClient = createWalletClient; exports.custom = custom; exports.fallback = fallback; exports.http = http; exports.multicall3Abi = _chunkTHMRUG4Djs.multicall3Abi; exports.webSocket = webSocket;
405
367
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
1
+ {"version":3,"sources":["../src/clients/transports/createTransport.ts","../src/clients/transports/custom.ts","../src/clients/transports/fallback.ts","../src/clients/transports/http.ts","../src/clients/transports/webSocket.ts","../src/utils/uid.ts","../src/clients/createClient.ts","../src/clients/createPublicClient.ts","../src/clients/createTestClient.ts","../src/clients/createWalletClient.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Chain } from '../../types'\nimport type { Requests } from '../../types/eip1193'\n\nexport type BaseRpcRequests = {\n request(...args: any): Promise<any>\n}\n\nexport type TransportConfig<\n TType extends string = string,\n TRequests extends BaseRpcRequests['request'] = Requests['request'],\n> = {\n /** The name of the transport. */\n name: string\n /** The key of the transport. */\n key: string\n /** The JSON-RPC request function that matches the EIP-1193 request spec. */\n request: TRequests\n /** The type of the transport. */\n type: TType\n}\n\nexport type Transport<\n TType extends string = string,\n TRpcAttributes = Record<string, any>,\n> = <TChain extends Chain = Chain>({\n chain,\n}: {\n chain?: TChain\n}) => {\n config: TransportConfig<TType>\n value?: TRpcAttributes\n}\n\n/**\n * @description Creates an transport intended to be used with a client.\n */\nexport function createTransport<\n TType extends string = string,\n TRpcAttributes = any,\n>(\n config: TransportConfig<TType>,\n value?: TRpcAttributes,\n): ReturnType<Transport<TType, TRpcAttributes>> {\n return {\n config,\n value,\n }\n}\n","import type {\n BaseRpcRequests,\n Transport,\n TransportConfig,\n} from './createTransport'\nimport { createTransport } from './createTransport'\n\ntype EthereumProvider = { request: BaseRpcRequests['request'] }\n\nexport type CustomTransportConfig = {\n /** The key of the transport. */\n key?: TransportConfig['key']\n /** The name of the transport. */\n name?: TransportConfig['name']\n}\n\nexport type CustomTransport = Transport<'custom', EthereumProvider['request']>\n\n/**\n * @description Creates a custom transport given an EIP-1193 compliant `request` attribute.\n */\nexport function custom<TProvider extends EthereumProvider>(\n /** An Ethereum provider with an EIP-1193 \"request\" attribute. */\n provider: TProvider,\n { key = 'custom', name = 'Custom Provider' }: CustomTransportConfig = {},\n): CustomTransport {\n return () =>\n createTransport({\n key,\n name,\n request: provider.request.bind(provider),\n type: 'custom',\n })\n}\n","import { HttpRequestError, RpcError } from '../../errors'\nimport type { Transport, TransportConfig } from './createTransport'\nimport { createTransport } from './createTransport'\n\nexport type FallbackTransportConfig = {\n /** The key of the Fallback transport. */\n key?: TransportConfig['key']\n /** The name of the Fallback transport. */\n name?: TransportConfig['name']\n}\n\nexport type FallbackTransport = Transport<\n 'fallback',\n { transports: Transport[] }\n>\n\nexport function fallback(\n transports: Transport[],\n { key = 'fallback', name = 'Fallback' }: FallbackTransportConfig = {},\n): FallbackTransport {\n return ({ chain }) =>\n createTransport(\n {\n key,\n name,\n async request({ method, params }) {\n const fetch = async (i: number = 0): Promise<any> => {\n const transport = transports[i]({ chain })\n try {\n return await transport.config.request({\n method,\n params,\n } as any)\n } catch (err) {\n if (!(err instanceof RpcError) && i < transports.length - 1)\n return fetch(i + 1)\n throw err\n }\n }\n return fetch()\n },\n type: 'fallback',\n },\n {\n transports: transports.map(\n (fn) => fn({ chain }) as unknown as Transport,\n ),\n },\n )\n}\n","import { UrlRequiredError } from '../../errors'\nimport { rpc } from '../../utils/rpc'\nimport type { Transport, TransportConfig } from './createTransport'\nimport { createTransport } from './createTransport'\n\nexport type HttpTransportConfig = {\n /** The key of the HTTP transport. */\n key?: TransportConfig['key']\n /** The name of the HTTP transport. */\n name?: TransportConfig['name']\n}\n\nexport type HttpTransport = Transport<\n 'http',\n {\n url?: string\n }\n>\n\n/**\n * @description Creates a HTTP transport that connects to a JSON-RPC API.\n */\nexport function http(\n /** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */\n url?: string,\n { key = 'http', name = 'HTTP JSON-RPC' }: HttpTransportConfig = {},\n): HttpTransport {\n return ({ chain }) => {\n const url_ = url || chain?.rpcUrls.default.http[0]\n if (!url_) throw new UrlRequiredError()\n return createTransport(\n {\n key,\n name,\n async request({ method, params }) {\n const { result } = await rpc.http(url_, {\n body: {\n method,\n params,\n },\n })\n return result\n },\n type: 'http',\n },\n {\n url,\n },\n )\n }\n}\n","import WebSocket from 'isomorphic-ws'\nimport { UrlRequiredError } from '../../errors'\nimport type { Hash } from '../../types'\nimport type { RpcResponse } from '../../utils/rpc'\nimport { getSocket, rpc } from '../../utils/rpc'\nimport type { Transport, TransportConfig } from './createTransport'\nimport { createTransport } from './createTransport'\n\ntype WebSocketTransportSubscribeArgs = {\n onData: (data: RpcResponse) => void\n onError?: (error: any) => void\n}\n\ntype WebSocketTransportSubscribeResponse = {\n subscriptionId: Hash\n unsubscribe: () => Promise<RpcResponse<boolean>>\n}\n\ntype WebSocketTransportSubscribe = {\n subscribe(\n args: WebSocketTransportSubscribeArgs & {\n /**\n * @description Add information about compiled contracts\n * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_addcompilationresult\n */\n params: ['newHeads']\n },\n ): Promise<WebSocketTransportSubscribeResponse>\n}\n\nexport type WebSocketTransportConfig = {\n /** The key of the WebSocket transport. */\n key?: TransportConfig['key']\n /** The name of the WebSocket transport. */\n name?: TransportConfig['name']\n}\n\nexport type WebSocketTransport = Transport<\n 'webSocket',\n {\n getSocket(): Promise<WebSocket>\n subscribe: WebSocketTransportSubscribe['subscribe']\n }\n>\n\n/**\n * @description Creates a WebSocket transport that connects to a JSON-RPC API.\n */\nexport function webSocket(\n /** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */\n url?: string,\n {\n key = 'webSocket',\n name = 'WebSocket JSON-RPC',\n }: WebSocketTransportConfig = {},\n): WebSocketTransport {\n return ({ chain }) => {\n const url_ = url || chain?.rpcUrls.default.webSocket?.[0]\n if (!url_) throw new UrlRequiredError()\n return createTransport(\n {\n key,\n name,\n async request({ method, params }) {\n const socket = await getSocket(url_)\n const { result } = await rpc.webSocketAsync(socket, {\n body: { method, params },\n })\n return result\n },\n type: 'webSocket',\n },\n {\n getSocket() {\n return getSocket(url_)\n },\n async subscribe({ params, onData, onError }: any) {\n const socket = await getSocket(url_)\n const { result: subscriptionId } = await new Promise<any>(\n (resolve, reject) =>\n rpc.webSocket(socket, {\n body: {\n method: 'eth_subscribe',\n params,\n },\n onData: (data) => {\n if (typeof data.id === 'number') {\n resolve(data)\n return\n }\n onData(data)\n },\n onError: (error) => {\n reject(error)\n onError?.(error)\n },\n }),\n )\n return {\n subscriptionId,\n async unsubscribe() {\n return new Promise<any>((resolve, reject) =>\n rpc.webSocket(socket, {\n body: {\n method: 'eth_unsubscribe',\n params: [subscriptionId],\n },\n onData: resolve,\n onError: reject,\n }),\n )\n },\n }\n },\n },\n )\n }\n}\n","let size = 256\nlet index = size\nlet buffer: string\n\nexport function uid(length = 11) {\n if (!buffer || index + length > size * 2) {\n buffer = ''\n index = 0\n for (let i = 0; i < size; i++) {\n buffer += ((256 + Math.random() * 256) | 0).toString(16).substring(1)\n }\n }\n return buffer.substring(index, index++ + length)\n}\n","import { Chain } from '../types'\nimport type { Requests } from '../types/eip1193'\nimport { buildRequest } from '../utils/buildRequest'\nimport { uid } from '../utils/uid'\nimport type { BaseRpcRequests, Transport } from './transports/createTransport'\n\nexport type Client<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TRequests extends BaseRpcRequests = Requests,\n> = {\n /** Chain for the client. */\n chain?: TChain\n /** A key for the client. */\n key: string\n /** A name for the client. */\n name: string\n /** Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. */\n pollingInterval: number\n /** Request function wrapped with friendly error handling */\n request: TRequests['request']\n /** The RPC transport (http, webSocket, custom, etc) */\n transport: ReturnType<TTransport>['config'] & ReturnType<TTransport>['value']\n /** The type of client. */\n type: string\n /** A unique ID for the client. */\n uid: string\n}\n\nexport type ClientConfig<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TRequests extends BaseRpcRequests = Requests,\n> = Partial<\n Pick<\n Client<TTransport, TChain, TRequests>,\n 'chain' | 'key' | 'name' | 'pollingInterval' | 'type'\n >\n> & {\n transport: TTransport\n}\n\n/**\n * @description Creates a base RPC client with the given transport.\n *\n * - Intended to be used as a base for other RPC clients.\n * - Has access to _all_ EIP-1474 RPC methods.\n *\n * @example\n * import { mainnet } from 'viem/chains'\n * import { createClient, http } from 'viem/clients'\n * const client = createClient(http({ chain: mainnet }))\n */\nexport function createClient<\n TTransport extends Transport,\n TChain extends Chain,\n TRequests extends BaseRpcRequests,\n>({\n chain,\n key = 'base',\n name = 'Base Client',\n pollingInterval = 4_000,\n transport,\n type = 'base',\n}: ClientConfig<TTransport, TChain, TRequests>): Client<\n TTransport,\n TChain,\n TRequests\n> {\n const { config, value } = transport({ chain })\n return {\n chain,\n key,\n name,\n pollingInterval,\n request: buildRequest(config.request),\n transport: { ...config, ...value },\n type,\n uid: uid(),\n }\n}\n","import type { PublicRequests } from '../types/eip1193'\nimport type { Transport } from './transports/createTransport'\nimport type { Client, ClientConfig } from './createClient'\nimport { createClient } from './createClient'\nimport { Chain } from '../types'\n\nexport type PublicClientConfig<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n> = Pick<\n ClientConfig<TTransport, TChain>,\n 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'\n>\n\nexport type PublicClient<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n> = Client<TTransport, TChain, PublicRequests>\n\n/**\n * @description Creates a public client with a given transport.\n *\n * - Only has access to \"public\" EIP-1474 RPC methods (ie. `eth_blockNumber`, etc).\n *\n * @example\n * import { mainnet } from 'viem/chains'\n * import { createPublicClient, http } from 'viem/clients'\n * const client = createPublicClient(http({ chain: mainnet }))\n */\nexport function createPublicClient<\n TTransport extends Transport,\n TChain extends Chain,\n>({\n chain,\n key = 'public',\n name = 'Public Client',\n transport,\n pollingInterval,\n}: PublicClientConfig<TTransport, TChain>): PublicClient<TTransport, TChain> {\n chain\n return createClient({\n chain,\n key,\n name,\n pollingInterval,\n transport,\n type: 'publicClient',\n })\n}\n","import type { TestRequests } from '../types/eip1193'\nimport type { Transport } from './transports/createTransport'\nimport type { Client, ClientConfig } from './createClient'\nimport { createClient } from './createClient'\nimport { Chain } from '../types'\n\ntype TestClientModes = 'anvil' | 'hardhat'\n\nexport type TestClientConfig<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TMode extends TestClientModes = TestClientModes,\n> = {\n chain?: ClientConfig<TTransport, TChain>['chain']\n /** The key of the client. */\n key?: ClientConfig['key']\n /** Mode of the test client. Available: \"anvil\" | \"hardhat\" */\n mode: TMode\n /** The name of the client. */\n name?: ClientConfig['name']\n /** Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. */\n pollingInterval?: ClientConfig['pollingInterval']\n transport: ClientConfig<TTransport, TChain>['transport']\n}\n\nexport type TestClient<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TMode extends TestClientModes = TestClientModes,\n> = Client<TTransport, TChain, TestRequests<TMode>> & {\n mode: TMode\n}\n\n/**\n * @description Creates a test client with a given transport.\n *\n * - Only has access to \"test\" RPC methods (ie. `anvil_setBalance`,\n * `evm_mine`, etc).\n *\n * @example\n * import { createTestClient, http } from 'viem'\n * import { local } from 'viem/chains'\n * const client = createTestClient({ chain: local, mode: 'anvil', transport: http() })\n */\nexport function createTestClient<\n TTransport extends Transport,\n TChain extends Chain,\n TMode extends TestClientModes,\n>({\n chain,\n key = 'test',\n name = 'Test Client',\n mode,\n pollingInterval,\n transport,\n}: TestClientConfig<TTransport, TChain, TMode>): TestClient<\n TTransport,\n TChain,\n TMode\n> {\n return {\n ...createClient({\n chain,\n key,\n name,\n pollingInterval,\n transport,\n type: 'testClient',\n }),\n mode,\n }\n}\n","import type { SignableRequests, WalletRequests } from '../types/eip1193'\nimport type { Transport } from './transports/createTransport'\nimport type { Client, ClientConfig } from './createClient'\nimport { createClient } from './createClient'\nimport { Chain } from '../types'\n\nexport type WalletClientConfig<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n> = {\n chain?: ClientConfig<TTransport, TChain>['chain']\n /** The key of the Wallet Client. */\n key?: ClientConfig['key']\n /** The name of the Wallet Client. */\n name?: ClientConfig['name']\n /** Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. */\n pollingInterval?: ClientConfig['pollingInterval']\n transport: ClientConfig<TTransport, TChain>['transport']\n}\n\nexport type WalletClient<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n> = Client<TTransport, TChain, SignableRequests & WalletRequests>\n\n/**\n * @description Creates a wallet client with a given transport.\n *\n * - Only has access to \"wallet\" & \"signable\" EIP-1474 RPC methods\n * (ie. `eth_sendTransaction`, `eth_requestAccounts`, etc).\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * const client = createWalletClient(\n * custom(window.ethereum)\n * )\n */\nexport function createWalletClient<\n TTransport extends Transport,\n TChain extends Chain,\n>({\n transport,\n key = 'wallet',\n name = 'Wallet Client',\n pollingInterval,\n}: WalletClientConfig<TTransport, TChain>): WalletClient<TTransport, TChain> {\n return createClient({\n key,\n name,\n pollingInterval,\n transport,\n type: 'walletClient',\n })\n}\n"]}