viem 0.0.1-alpha.26 → 0.0.1-alpha.27
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.
- package/dist/chains.js +46 -46
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-YTG4YXMB.js → chunk-2DSFM32P.js} +15 -15
- package/dist/{chunk-YTG4YXMB.js.map → chunk-2DSFM32P.js.map} +1 -1
- package/dist/{chunk-PRG3BBPZ.mjs → chunk-AKGXRZDN.mjs} +214 -55
- package/dist/chunk-AKGXRZDN.mjs.map +1 -0
- package/dist/{chunk-QSIX64VZ.mjs → chunk-BJJH7RYH.mjs} +2 -2
- package/dist/{chunk-QSIX64VZ.mjs.map → chunk-BJJH7RYH.mjs.map} +0 -0
- package/dist/{chunk-LINNE4N4.js → chunk-JY7JGKSA.js} +70 -70
- package/dist/{chunk-LINNE4N4.js.map → chunk-JY7JGKSA.js.map} +0 -0
- package/dist/{chunk-BSAB6UH4.mjs → chunk-LF6P33WQ.mjs} +6 -6
- package/dist/chunk-LF6P33WQ.mjs.map +1 -0
- package/dist/{chunk-DSQO3E4F.js → chunk-W7KWIGWO.js} +210 -51
- package/dist/chunk-W7KWIGWO.js.map +1 -0
- package/dist/contract.js +4 -4
- package/dist/contract.mjs +3 -3
- package/dist/ens.js +21 -21
- package/dist/ens.js.map +1 -1
- package/dist/ens.mjs +9 -9
- package/dist/ens.mjs.map +1 -1
- package/dist/index.js +13 -13
- package/dist/index.mjs +1 -1
- package/dist/public.js +3 -3
- package/dist/public.mjs +2 -2
- package/dist/test.js +13 -13
- package/dist/test.mjs +1 -1
- package/dist/utils/index.d.ts +11 -11
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.mjs +13 -13
- package/dist/wallet.js +3 -3
- package/dist/wallet.mjs +2 -2
- package/package.json +1 -2
- package/dist/chunk-BSAB6UH4.mjs.map +0 -1
- package/dist/chunk-DSQO3E4F.js.map +0 -1
- package/dist/chunk-PRG3BBPZ.mjs.map +0 -1
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
var
|
29
|
+
var _chunkW7KWIGWOjs = require('./chunk-W7KWIGWO.js');
|
30
30
|
|
31
31
|
// src/actions/public/call.ts
|
32
32
|
async function call(client, {
|
@@ -45,10 +45,10 @@ async function call(client, {
|
|
45
45
|
...rest
|
46
46
|
}) {
|
47
47
|
if (maxFeePerGas !== void 0 && maxPriorityFeePerGas !== void 0 && maxFeePerGas < maxPriorityFeePerGas)
|
48
|
-
throw new (0,
|
49
|
-
const blockNumberHex = blockNumber ?
|
48
|
+
throw new (0, _chunkW7KWIGWOjs.InvalidGasArgumentsError)();
|
49
|
+
const blockNumberHex = blockNumber ? _chunkW7KWIGWOjs.numberToHex.call(void 0, blockNumber) : void 0;
|
50
50
|
const formatter = _optionalChain([client, 'access', _ => _.chain, 'optionalAccess', _2 => _2.formatters, 'optionalAccess', _3 => _3.transactionRequest]);
|
51
|
-
const request_ =
|
51
|
+
const request_ = _chunkW7KWIGWOjs.format.call(void 0,
|
52
52
|
{
|
53
53
|
from,
|
54
54
|
accessList,
|
@@ -61,10 +61,10 @@ async function call(client, {
|
|
61
61
|
to,
|
62
62
|
value,
|
63
63
|
// Pick out extra data that might exist on the chain's transaction request type.
|
64
|
-
...
|
64
|
+
..._chunkW7KWIGWOjs.extract.call(void 0, rest, { formatter })
|
65
65
|
},
|
66
66
|
{
|
67
|
-
formatter: formatter ||
|
67
|
+
formatter: formatter || _chunkW7KWIGWOjs.formatTransactionRequest
|
68
68
|
}
|
69
69
|
);
|
70
70
|
const response = await client.request({
|
@@ -84,7 +84,7 @@ async function simulateContract(client, {
|
|
84
84
|
functionName,
|
85
85
|
...callRequest
|
86
86
|
}) {
|
87
|
-
const calldata =
|
87
|
+
const calldata = _chunkW7KWIGWOjs.encodeFunctionData.call(void 0, {
|
88
88
|
abi,
|
89
89
|
args,
|
90
90
|
functionName
|
@@ -95,7 +95,7 @@ async function simulateContract(client, {
|
|
95
95
|
to: address,
|
96
96
|
...callRequest
|
97
97
|
});
|
98
|
-
const result =
|
98
|
+
const result = _chunkW7KWIGWOjs.decodeFunctionResult.call(void 0, {
|
99
99
|
abi,
|
100
100
|
args,
|
101
101
|
functionName,
|
@@ -112,7 +112,7 @@ async function simulateContract(client, {
|
|
112
112
|
}
|
113
113
|
};
|
114
114
|
} catch (err) {
|
115
|
-
throw
|
115
|
+
throw _chunkW7KWIGWOjs.getContractError.call(void 0, err, {
|
116
116
|
abi,
|
117
117
|
address,
|
118
118
|
args,
|
@@ -155,9 +155,9 @@ async function estimateGas(client, {
|
|
155
155
|
value,
|
156
156
|
...rest
|
157
157
|
}) {
|
158
|
-
const blockNumberHex = blockNumber ?
|
158
|
+
const blockNumberHex = blockNumber ? _chunkW7KWIGWOjs.numberToHex.call(void 0, blockNumber) : void 0;
|
159
159
|
const formatter = _optionalChain([client, 'access', _4 => _4.chain, 'optionalAccess', _5 => _5.formatters, 'optionalAccess', _6 => _6.transactionRequest]);
|
160
|
-
const request_ =
|
160
|
+
const request_ = _chunkW7KWIGWOjs.format.call(void 0,
|
161
161
|
{
|
162
162
|
from,
|
163
163
|
accessList,
|
@@ -170,10 +170,10 @@ async function estimateGas(client, {
|
|
170
170
|
to,
|
171
171
|
value,
|
172
172
|
// Pick out extra data that might exist on the chain's transaction request type.
|
173
|
-
...
|
173
|
+
..._chunkW7KWIGWOjs.extract.call(void 0, rest, { formatter })
|
174
174
|
},
|
175
175
|
{
|
176
|
-
formatter: formatter ||
|
176
|
+
formatter: formatter || _chunkW7KWIGWOjs.formatTransactionRequest
|
177
177
|
}
|
178
178
|
);
|
179
179
|
const balance = await client.request({
|
@@ -191,7 +191,7 @@ async function estimateContractGas(client, {
|
|
191
191
|
functionName,
|
192
192
|
...request
|
193
193
|
}) {
|
194
|
-
const data =
|
194
|
+
const data = _chunkW7KWIGWOjs.encodeFunctionData.call(void 0, {
|
195
195
|
abi,
|
196
196
|
args,
|
197
197
|
functionName
|
@@ -204,7 +204,7 @@ async function estimateContractGas(client, {
|
|
204
204
|
});
|
205
205
|
return gas;
|
206
206
|
} catch (err) {
|
207
|
-
throw
|
207
|
+
throw _chunkW7KWIGWOjs.getContractError.call(void 0, err, {
|
208
208
|
abi,
|
209
209
|
address,
|
210
210
|
args,
|
@@ -217,7 +217,7 @@ async function estimateContractGas(client, {
|
|
217
217
|
|
218
218
|
// src/actions/public/getBalance.ts
|
219
219
|
async function getBalance(client, { address, blockNumber, blockTag = "latest" }) {
|
220
|
-
const blockNumberHex = blockNumber ?
|
220
|
+
const blockNumberHex = blockNumber ? _chunkW7KWIGWOjs.numberToHex.call(void 0, blockNumber) : void 0;
|
221
221
|
const balance = await client.request({
|
222
222
|
method: "eth_getBalance",
|
223
223
|
params: [address, blockNumberHex || blockTag]
|
@@ -232,7 +232,7 @@ async function getBlock(client, {
|
|
232
232
|
blockTag = "latest",
|
233
233
|
includeTransactions = false
|
234
234
|
} = {}) {
|
235
|
-
const blockNumberHex = blockNumber !== void 0 ?
|
235
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunkW7KWIGWOjs.numberToHex.call(void 0, blockNumber) : void 0;
|
236
236
|
let block = null;
|
237
237
|
if (blockHash) {
|
238
238
|
block = await client.request({
|
@@ -246,19 +246,19 @@ async function getBlock(client, {
|
|
246
246
|
});
|
247
247
|
}
|
248
248
|
if (!block)
|
249
|
-
throw new (0,
|
250
|
-
return
|
251
|
-
formatter: _optionalChain([client, 'access', _7 => _7.chain, 'optionalAccess', _8 => _8.formatters, 'optionalAccess', _9 => _9.block]) ||
|
249
|
+
throw new (0, _chunkW7KWIGWOjs.BlockNotFoundError)({ blockHash, blockNumber });
|
250
|
+
return _chunkW7KWIGWOjs.format.call(void 0, block, {
|
251
|
+
formatter: _optionalChain([client, 'access', _7 => _7.chain, 'optionalAccess', _8 => _8.formatters, 'optionalAccess', _9 => _9.block]) || _chunkW7KWIGWOjs.formatBlock
|
252
252
|
});
|
253
253
|
}
|
254
254
|
|
255
255
|
// src/actions/public/getBlockNumber.ts
|
256
256
|
var cacheKey = (id) => `blockNumber.${id}`;
|
257
257
|
function getBlockNumberCache(id) {
|
258
|
-
return
|
258
|
+
return _chunkW7KWIGWOjs.getCache.call(void 0, cacheKey(id));
|
259
259
|
}
|
260
260
|
async function getBlockNumber(client, { maxAge = client.pollingInterval } = {}) {
|
261
|
-
const blockNumberHex = await
|
261
|
+
const blockNumberHex = await _chunkW7KWIGWOjs.withCache.call(void 0,
|
262
262
|
() => client.request({
|
263
263
|
method: "eth_blockNumber"
|
264
264
|
}),
|
@@ -273,7 +273,7 @@ async function getBlockTransactionCount(client, {
|
|
273
273
|
blockNumber,
|
274
274
|
blockTag = "latest"
|
275
275
|
} = {}) {
|
276
|
-
const blockNumberHex = blockNumber !== void 0 ?
|
276
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunkW7KWIGWOjs.numberToHex.call(void 0, blockNumber) : void 0;
|
277
277
|
let count = null;
|
278
278
|
if (blockHash) {
|
279
279
|
count = await client.request({
|
@@ -286,12 +286,12 @@ async function getBlockTransactionCount(client, {
|
|
286
286
|
params: [blockNumberHex || blockTag]
|
287
287
|
});
|
288
288
|
}
|
289
|
-
return
|
289
|
+
return _chunkW7KWIGWOjs.hexToNumber.call(void 0, count);
|
290
290
|
}
|
291
291
|
|
292
292
|
// src/actions/public/getBytecode.ts
|
293
293
|
async function getBytecode(client, { address, blockNumber, blockTag = "latest" }) {
|
294
|
-
const blockNumberHex = blockNumber !== void 0 ?
|
294
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunkW7KWIGWOjs.numberToHex.call(void 0, blockNumber) : void 0;
|
295
295
|
const hex = await client.request({
|
296
296
|
method: "eth_getCode",
|
297
297
|
params: [address, blockNumberHex || blockTag]
|
@@ -304,7 +304,7 @@ async function getBytecode(client, { address, blockNumber, blockTag = "latest" }
|
|
304
304
|
// src/actions/public/getChainId.ts
|
305
305
|
async function getChainId(client) {
|
306
306
|
const chainIdHex = await client.request({ method: "eth_chainId" });
|
307
|
-
return
|
307
|
+
return _chunkW7KWIGWOjs.hexToNumber.call(void 0, chainIdHex);
|
308
308
|
}
|
309
309
|
|
310
310
|
// src/actions/public/getFeeHistory.ts
|
@@ -314,16 +314,16 @@ async function getFeeHistory(client, {
|
|
314
314
|
blockTag = "latest",
|
315
315
|
rewardPercentiles
|
316
316
|
}) {
|
317
|
-
const blockNumberHex = blockNumber ?
|
317
|
+
const blockNumberHex = blockNumber ? _chunkW7KWIGWOjs.numberToHex.call(void 0, blockNumber) : void 0;
|
318
318
|
const feeHistory = await client.request({
|
319
319
|
method: "eth_feeHistory",
|
320
320
|
params: [
|
321
|
-
|
321
|
+
_chunkW7KWIGWOjs.numberToHex.call(void 0, blockCount),
|
322
322
|
blockNumberHex || blockTag,
|
323
323
|
rewardPercentiles
|
324
324
|
]
|
325
325
|
});
|
326
|
-
return
|
326
|
+
return _chunkW7KWIGWOjs.formatFeeHistory.call(void 0, feeHistory);
|
327
327
|
}
|
328
328
|
|
329
329
|
// src/actions/public/getFilterChanges.ts
|
@@ -333,7 +333,7 @@ async function getFilterChanges(client, { filter }) {
|
|
333
333
|
params: [filter.id]
|
334
334
|
});
|
335
335
|
return logs.map(
|
336
|
-
(log) => typeof log === "string" ? log :
|
336
|
+
(log) => typeof log === "string" ? log : _chunkW7KWIGWOjs.formatLog.call(void 0, log)
|
337
337
|
);
|
338
338
|
}
|
339
339
|
|
@@ -343,7 +343,7 @@ async function getFilterLogs(client, { filter }) {
|
|
343
343
|
method: "eth_getFilterLogs",
|
344
344
|
params: [filter.id]
|
345
345
|
});
|
346
|
-
return logs.map(
|
346
|
+
return logs.map(_chunkW7KWIGWOjs.formatLog);
|
347
347
|
}
|
348
348
|
|
349
349
|
// src/actions/public/getGasPrice.ts
|
@@ -370,8 +370,8 @@ async function createEventFilter(client, {
|
|
370
370
|
params: [
|
371
371
|
{
|
372
372
|
address,
|
373
|
-
fromBlock: typeof fromBlock === "bigint" ?
|
374
|
-
toBlock: typeof toBlock === "bigint" ?
|
373
|
+
fromBlock: typeof fromBlock === "bigint" ? _chunkW7KWIGWOjs.numberToHex.call(void 0, fromBlock) : fromBlock,
|
374
|
+
toBlock: typeof toBlock === "bigint" ? _chunkW7KWIGWOjs.numberToHex.call(void 0, toBlock) : toBlock,
|
375
375
|
...topics.length ? { topics } : {}
|
376
376
|
}
|
377
377
|
]
|
@@ -382,13 +382,13 @@ function buildFilterTopics({
|
|
382
382
|
event,
|
383
383
|
args
|
384
384
|
}) {
|
385
|
-
const eventName =
|
385
|
+
const eventName = _chunkW7KWIGWOjs.extractFunctionName.call(void 0, event);
|
386
386
|
const abi = unstable_parseAbi(event);
|
387
|
-
return
|
387
|
+
return _chunkW7KWIGWOjs.encodeEventTopics.call(void 0, { abi, eventName, args });
|
388
388
|
}
|
389
389
|
function unstable_parseAbi(definition) {
|
390
|
-
const name =
|
391
|
-
const params =
|
390
|
+
const name = _chunkW7KWIGWOjs.extractFunctionName.call(void 0, definition);
|
391
|
+
const params = _chunkW7KWIGWOjs.extractFunctionParams.call(void 0, definition);
|
392
392
|
return [
|
393
393
|
{
|
394
394
|
type: "event",
|
@@ -424,18 +424,18 @@ async function getLogs(client, {
|
|
424
424
|
{
|
425
425
|
address,
|
426
426
|
topics,
|
427
|
-
fromBlock: typeof fromBlock === "bigint" ?
|
428
|
-
toBlock: typeof toBlock === "bigint" ?
|
427
|
+
fromBlock: typeof fromBlock === "bigint" ? _chunkW7KWIGWOjs.numberToHex.call(void 0, fromBlock) : fromBlock,
|
428
|
+
toBlock: typeof toBlock === "bigint" ? _chunkW7KWIGWOjs.numberToHex.call(void 0, toBlock) : toBlock
|
429
429
|
}
|
430
430
|
]
|
431
431
|
});
|
432
432
|
}
|
433
|
-
return logs.map(
|
433
|
+
return logs.map(_chunkW7KWIGWOjs.formatLog);
|
434
434
|
}
|
435
435
|
|
436
436
|
// src/actions/public/getStorageAt.ts
|
437
437
|
async function getStorageAt(client, { address, blockNumber, blockTag = "latest", slot }) {
|
438
|
-
const blockNumberHex = blockNumber !== void 0 ?
|
438
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunkW7KWIGWOjs.numberToHex.call(void 0, blockNumber) : void 0;
|
439
439
|
const data = await client.request({
|
440
440
|
method: "eth_getStorageAt",
|
441
441
|
params: [address, slot, blockNumberHex || blockTag]
|
@@ -451,7 +451,7 @@ async function getTransaction(client, {
|
|
451
451
|
hash,
|
452
452
|
index
|
453
453
|
}) {
|
454
|
-
const blockNumberHex = blockNumber !== void 0 ?
|
454
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunkW7KWIGWOjs.numberToHex.call(void 0, blockNumber) : void 0;
|
455
455
|
let transaction = null;
|
456
456
|
if (hash) {
|
457
457
|
transaction = await client.request({
|
@@ -461,24 +461,24 @@ async function getTransaction(client, {
|
|
461
461
|
} else if (blockHash) {
|
462
462
|
transaction = await client.request({
|
463
463
|
method: "eth_getTransactionByBlockHashAndIndex",
|
464
|
-
params: [blockHash,
|
464
|
+
params: [blockHash, _chunkW7KWIGWOjs.numberToHex.call(void 0, index)]
|
465
465
|
});
|
466
466
|
} else if (blockNumberHex || blockTag) {
|
467
467
|
transaction = await client.request({
|
468
468
|
method: "eth_getTransactionByBlockNumberAndIndex",
|
469
|
-
params: [blockNumberHex || blockTag,
|
469
|
+
params: [blockNumberHex || blockTag, _chunkW7KWIGWOjs.numberToHex.call(void 0, index)]
|
470
470
|
});
|
471
471
|
}
|
472
472
|
if (!transaction)
|
473
|
-
throw new (0,
|
473
|
+
throw new (0, _chunkW7KWIGWOjs.TransactionNotFoundError)({
|
474
474
|
blockHash,
|
475
475
|
blockNumber,
|
476
476
|
blockTag,
|
477
477
|
hash,
|
478
478
|
index
|
479
479
|
});
|
480
|
-
return
|
481
|
-
formatter: _optionalChain([client, 'access', _10 => _10.chain, 'optionalAccess', _11 => _11.formatters, 'optionalAccess', _12 => _12.transaction]) ||
|
480
|
+
return _chunkW7KWIGWOjs.format.call(void 0, transaction, {
|
481
|
+
formatter: _optionalChain([client, 'access', _10 => _10.chain, 'optionalAccess', _11 => _11.formatters, 'optionalAccess', _12 => _12.transaction]) || _chunkW7KWIGWOjs.formatTransaction
|
482
482
|
});
|
483
483
|
}
|
484
484
|
|
@@ -498,9 +498,9 @@ async function getTransactionConfirmations(client, { hash, transactionReceipt })
|
|
498
498
|
async function getTransactionCount(client, { address, blockTag = "latest", blockNumber }) {
|
499
499
|
const count = await client.request({
|
500
500
|
method: "eth_getTransactionCount",
|
501
|
-
params: [address, blockNumber ?
|
501
|
+
params: [address, blockNumber ? _chunkW7KWIGWOjs.numberToHex.call(void 0, blockNumber) : blockTag]
|
502
502
|
});
|
503
|
-
return
|
503
|
+
return _chunkW7KWIGWOjs.hexToNumber.call(void 0, count);
|
504
504
|
}
|
505
505
|
|
506
506
|
// src/actions/public/getTransactionReceipt.ts
|
@@ -510,9 +510,9 @@ async function getTransactionReceipt(client, { hash }) {
|
|
510
510
|
params: [hash]
|
511
511
|
});
|
512
512
|
if (!receipt)
|
513
|
-
throw new (0,
|
514
|
-
return
|
515
|
-
formatter: _optionalChain([client, 'access', _15 => _15.chain, 'optionalAccess', _16 => _16.formatters, 'optionalAccess', _17 => _17.transactionReceipt]) ||
|
513
|
+
throw new (0, _chunkW7KWIGWOjs.TransactionReceiptNotFoundError)({ hash });
|
514
|
+
return _chunkW7KWIGWOjs.format.call(void 0, receipt, {
|
515
|
+
formatter: _optionalChain([client, 'access', _15 => _15.chain, 'optionalAccess', _16 => _16.formatters, 'optionalAccess', _17 => _17.transactionReceipt]) || _chunkW7KWIGWOjs.formatTransactionReceipt
|
516
516
|
});
|
517
517
|
}
|
518
518
|
|
@@ -524,7 +524,7 @@ async function readContract(client, {
|
|
524
524
|
functionName,
|
525
525
|
...callRequest
|
526
526
|
}) {
|
527
|
-
const calldata =
|
527
|
+
const calldata = _chunkW7KWIGWOjs.encodeFunctionData.call(void 0, {
|
528
528
|
abi,
|
529
529
|
args,
|
530
530
|
functionName
|
@@ -535,14 +535,14 @@ async function readContract(client, {
|
|
535
535
|
to: address,
|
536
536
|
...callRequest
|
537
537
|
});
|
538
|
-
return
|
538
|
+
return _chunkW7KWIGWOjs.decodeFunctionResult.call(void 0, {
|
539
539
|
abi,
|
540
540
|
args,
|
541
541
|
functionName,
|
542
542
|
data: data || "0x"
|
543
543
|
});
|
544
544
|
} catch (err) {
|
545
|
-
throw
|
545
|
+
throw _chunkW7KWIGWOjs.getContractError.call(void 0, err, {
|
546
546
|
abi,
|
547
547
|
address,
|
548
548
|
args,
|
@@ -563,7 +563,7 @@ async function multicall(client, args) {
|
|
563
563
|
} = args;
|
564
564
|
const calls = contracts.map(({ abi, address, args: args2, functionName }) => {
|
565
565
|
try {
|
566
|
-
const callData =
|
566
|
+
const callData = _chunkW7KWIGWOjs.encodeFunctionData.call(void 0, {
|
567
567
|
abi,
|
568
568
|
args: args2,
|
569
569
|
functionName
|
@@ -574,7 +574,7 @@ async function multicall(client, args) {
|
|
574
574
|
target: address
|
575
575
|
};
|
576
576
|
} catch (err) {
|
577
|
-
const error =
|
577
|
+
const error = _chunkW7KWIGWOjs.getContractError.call(void 0, err, {
|
578
578
|
abi,
|
579
579
|
address,
|
580
580
|
args: args2,
|
@@ -591,7 +591,7 @@ async function multicall(client, args) {
|
|
591
591
|
}
|
592
592
|
});
|
593
593
|
const results = await readContract(client, {
|
594
|
-
abi:
|
594
|
+
abi: _chunkW7KWIGWOjs.multicall3Abi,
|
595
595
|
address: multicallAddress,
|
596
596
|
args: [calls],
|
597
597
|
blockNumber,
|
@@ -603,17 +603,17 @@ async function multicall(client, args) {
|
|
603
603
|
const { abi, address, functionName, args: args2 } = contracts[i];
|
604
604
|
try {
|
605
605
|
if (callData === "0x")
|
606
|
-
throw new (0,
|
606
|
+
throw new (0, _chunkW7KWIGWOjs.AbiDecodingZeroDataError)();
|
607
607
|
if (!success)
|
608
|
-
throw new (0,
|
609
|
-
const result =
|
608
|
+
throw new (0, _chunkW7KWIGWOjs.RawContractError)({ data: returnData });
|
609
|
+
const result = _chunkW7KWIGWOjs.decodeFunctionResult.call(void 0, {
|
610
610
|
abi,
|
611
611
|
data: returnData,
|
612
612
|
functionName
|
613
613
|
});
|
614
614
|
return { result, status: "success" };
|
615
615
|
} catch (err) {
|
616
|
-
const error =
|
616
|
+
const error = _chunkW7KWIGWOjs.getContractError.call(void 0, err, {
|
617
617
|
abi,
|
618
618
|
address,
|
619
619
|
args: args2,
|
@@ -686,7 +686,7 @@ async function createContractEventFilter(client, {
|
|
686
686
|
fromBlock,
|
687
687
|
toBlock
|
688
688
|
}) {
|
689
|
-
const topics = eventName ?
|
689
|
+
const topics = eventName ? _chunkW7KWIGWOjs.encodeEventTopics.call(void 0, {
|
690
690
|
abi,
|
691
691
|
args,
|
692
692
|
eventName
|
@@ -696,8 +696,8 @@ async function createContractEventFilter(client, {
|
|
696
696
|
params: [
|
697
697
|
{
|
698
698
|
address,
|
699
|
-
fromBlock: typeof fromBlock === "bigint" ?
|
700
|
-
toBlock: typeof toBlock === "bigint" ?
|
699
|
+
fromBlock: typeof fromBlock === "bigint" ? _chunkW7KWIGWOjs.numberToHex.call(void 0, fromBlock) : fromBlock,
|
700
|
+
toBlock: typeof toBlock === "bigint" ? _chunkW7KWIGWOjs.numberToHex.call(void 0, toBlock) : toBlock,
|
701
701
|
topics
|
702
702
|
}
|
703
703
|
]
|
@@ -714,12 +714,12 @@ function poll(fn, { emitOnBegin, initialWaitTime, interval }) {
|
|
714
714
|
if (emitOnBegin)
|
715
715
|
data = await fn({ unpoll: unwatch });
|
716
716
|
const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall', _21 => _21(data)]), async () => ( interval));
|
717
|
-
await
|
717
|
+
await _chunkW7KWIGWOjs.wait.call(void 0, initialWait);
|
718
718
|
const poll2 = async () => {
|
719
719
|
if (!active)
|
720
720
|
return;
|
721
721
|
await fn({ unpoll: unwatch });
|
722
|
-
await
|
722
|
+
await _chunkW7KWIGWOjs.wait.call(void 0, interval);
|
723
723
|
poll2();
|
724
724
|
};
|
725
725
|
poll2();
|
@@ -1026,7 +1026,7 @@ async function waitForTransactionReceipt(client, {
|
|
1026
1026
|
return new Promise((resolve, reject) => {
|
1027
1027
|
if (timeout)
|
1028
1028
|
setTimeout(
|
1029
|
-
() => reject(new (0,
|
1029
|
+
() => reject(new (0, _chunkW7KWIGWOjs.WaitForTransactionReceiptTimeoutError)({ hash })),
|
1030
1030
|
timeout
|
1031
1031
|
);
|
1032
1032
|
const unobserve = observe(
|
@@ -1056,7 +1056,7 @@ async function waitForTransactionReceipt(client, {
|
|
1056
1056
|
return;
|
1057
1057
|
done(() => emit.resolve(receipt));
|
1058
1058
|
} catch (err) {
|
1059
|
-
if (transaction && (err instanceof
|
1059
|
+
if (transaction && (err instanceof _chunkW7KWIGWOjs.TransactionNotFoundError || err instanceof _chunkW7KWIGWOjs.TransactionReceiptNotFoundError)) {
|
1060
1060
|
replacedTransaction = transaction;
|
1061
1061
|
const block = await getBlock(client, {
|
1062
1062
|
blockNumber,
|
@@ -1133,4 +1133,4 @@ async function waitForTransactionReceipt(client, {
|
|
1133
1133
|
|
1134
1134
|
|
1135
1135
|
exports.call = call; exports.simulateContract = simulateContract; exports.createPendingTransactionFilter = createPendingTransactionFilter; exports.createBlockFilter = createBlockFilter; exports.estimateGas = estimateGas; exports.estimateContractGas = estimateContractGas; exports.getBalance = getBalance; exports.getBlock = getBlock; exports.getBlockNumberCache = getBlockNumberCache; exports.getBlockNumber = getBlockNumber; exports.getBlockTransactionCount = getBlockTransactionCount; exports.getBytecode = getBytecode; exports.getChainId = getChainId; exports.getFeeHistory = getFeeHistory; exports.getFilterChanges = getFilterChanges; exports.getFilterLogs = getFilterLogs; exports.getGasPrice = getGasPrice; exports.getLogs = getLogs; exports.getStorageAt = getStorageAt; exports.getTransaction = getTransaction; exports.getTransactionConfirmations = getTransactionConfirmations; exports.getTransactionCount = getTransactionCount; exports.getTransactionReceipt = getTransactionReceipt; exports.readContract = readContract; exports.multicall = multicall; exports.uninstallFilter = uninstallFilter; exports.waitForTransactionReceipt = waitForTransactionReceipt; exports.watchBlockNumber = watchBlockNumber; exports.watchBlocks = watchBlocks; exports.watchContractEvent = watchContractEvent; exports.watchEvent = watchEvent; exports.watchPendingTransactions = watchPendingTransactions;
|
1136
|
-
//# sourceMappingURL=chunk-
|
1136
|
+
//# sourceMappingURL=chunk-JY7JGKSA.js.map
|
File without changes
|
@@ -4,13 +4,13 @@ import {
|
|
4
4
|
checksumAddress,
|
5
5
|
encodeDeployData,
|
6
6
|
encodeFunctionData,
|
7
|
-
encodeHex,
|
8
7
|
extract,
|
9
8
|
format,
|
10
9
|
formatTransactionRequest,
|
11
10
|
getAddress,
|
12
|
-
numberToHex
|
13
|
-
|
11
|
+
numberToHex,
|
12
|
+
toHex
|
13
|
+
} from "./chunk-AKGXRZDN.mjs";
|
14
14
|
|
15
15
|
// src/actions/wallet/addChain.ts
|
16
16
|
async function addChain(client, chain) {
|
@@ -105,14 +105,14 @@ async function signMessage(client, { from, data: data_ }) {
|
|
105
105
|
if (typeof data_ === "string") {
|
106
106
|
if (!data_.startsWith("0x"))
|
107
107
|
throw new BaseError(
|
108
|
-
`data ("${data_}") must be a hex value. Encode it first to a hex with the \`
|
108
|
+
`data ("${data_}") must be a hex value. Encode it first to a hex with the \`toHex\` util.`,
|
109
109
|
{
|
110
110
|
docsPath: "/TODO"
|
111
111
|
}
|
112
112
|
);
|
113
113
|
data = data_;
|
114
114
|
} else {
|
115
|
-
data =
|
115
|
+
data = toHex(data_);
|
116
116
|
}
|
117
117
|
const signed = await client.request({
|
118
118
|
method: "personal_sign",
|
@@ -189,4 +189,4 @@ export {
|
|
189
189
|
watchAsset,
|
190
190
|
writeContract
|
191
191
|
};
|
192
|
-
//# sourceMappingURL=chunk-
|
192
|
+
//# sourceMappingURL=chunk-LF6P33WQ.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/actions/wallet/addChain.ts","../src/actions/wallet/getAccounts.ts","../src/actions/wallet/getPermissions.ts","../src/actions/wallet/requestAccounts.ts","../src/actions/wallet/requestPermissions.ts","../src/actions/wallet/sendTransaction.ts","../src/actions/wallet/signMessage.ts","../src/actions/wallet/switchChain.ts","../src/actions/wallet/watchAsset.ts","../src/actions/wallet/writeContract.ts","../src/actions/wallet/deployContract.ts"],"sourcesContent":["import type { WalletClient } from '../../clients'\nimport type { Chain } from '../../types'\nimport { numberToHex } from '../../utils'\n\nexport async function addChain(client: WalletClient, chain: Chain) {\n const { id, name, nativeCurrency, rpcUrls, blockExplorers } = chain\n await client.request({\n method: 'wallet_addEthereumChain',\n params: [\n {\n chainId: numberToHex(id),\n chainName: name,\n nativeCurrency,\n rpcUrls: rpcUrls.default.http,\n blockExplorerUrls: blockExplorers\n ? Object.values(blockExplorers).map(({ url }) => url)\n : undefined,\n },\n ],\n })\n}\n","import type { WalletClient } from '../../clients'\nimport { checksumAddress } from '../../utils/address'\n\nexport async function getAccounts(client: WalletClient) {\n const addresses = await client.request({ method: 'eth_accounts' })\n return addresses.map((address) => checksumAddress(address))\n}\n","import type { WalletClient } from '../../clients'\nimport type { WalletPermission } from '../../types/eip1193'\n\nexport type GetPermissionsResponse = WalletPermission[]\n\nexport async function getPermissions(client: WalletClient) {\n const permissions = await client.request({ method: 'wallet_getPermissions' })\n return permissions\n}\n","import type { WalletClient } from '../../clients'\nimport { getAddress } from '../../utils'\n\nexport async function requestAccounts(client: WalletClient) {\n const addresses = await client.request({ method: 'eth_requestAccounts' })\n return addresses.map((address) => getAddress(address))\n}\n","import type { WalletClient } from '../../clients'\nimport type { WalletPermission } from '../../types/eip1193'\n\nexport type RequestPermissionsArgs = {\n eth_accounts: Record<string, any>\n} & {\n [key: string]: Record<string, any>\n}\nexport type RequestPermissionsResponse = WalletPermission[]\n\nexport async function requestPermissions(\n client: WalletClient,\n permissions: RequestPermissionsArgs,\n) {\n return client.request({\n method: 'wallet_requestPermissions',\n params: [permissions],\n })\n}\n","import type { WalletClient } from '../../clients'\nimport { InvalidGasArgumentsError } from '../../errors'\nimport type {\n Chain,\n Formatter,\n Hash,\n MergeIntersectionProperties,\n TransactionRequest,\n} from '../../types'\nimport type { Formatted, TransactionRequestFormatter } from '../../utils'\nimport { extract, format, formatTransactionRequest } from '../../utils'\n\nexport type FormattedTransactionRequest<\n TFormatter extends Formatter | undefined = Formatter,\n> = MergeIntersectionProperties<\n Formatted<TFormatter, TransactionRequest, true>,\n TransactionRequest\n>\n\nexport type SendTransactionArgs<TChain extends Chain = Chain> =\n FormattedTransactionRequest<TransactionRequestFormatter<TChain>> & {\n chain?: TChain\n }\n\nexport type SendTransactionResponse = Hash\n\nexport async function sendTransaction<TChain extends Chain>(\n client: WalletClient,\n {\n chain,\n from,\n accessList,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value,\n ...rest\n }: SendTransactionArgs<TChain>,\n): Promise<SendTransactionResponse> {\n if (\n maxFeePerGas !== undefined &&\n maxPriorityFeePerGas !== undefined &&\n maxFeePerGas < maxPriorityFeePerGas\n )\n throw new InvalidGasArgumentsError()\n\n const formatter = chain?.formatters?.transactionRequest\n const request_ = format(\n {\n from,\n accessList,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value,\n // Pick out extra data that might exist on the chain's transaction request type.\n ...extract(rest, { formatter }),\n } as TransactionRequest,\n {\n formatter: formatter || formatTransactionRequest,\n },\n )\n\n const hash = await client.request({\n method: 'eth_sendTransaction',\n params: [request_],\n })\n return hash\n}\n","import type { WalletClient } from '../../clients'\nimport { BaseError } from '../../errors'\nimport type { Address, ByteArray, Hex } from '../../types'\nimport { toHex } from '../../utils'\n\nexport type SignMessageArgs = {\n from: Address\n data: Hex | ByteArray\n}\n\nexport type SignMessageResponse = Hex\n\nexport async function signMessage(\n client: WalletClient,\n { from, data: data_ }: SignMessageArgs,\n): Promise<SignMessageResponse> {\n let data\n if (typeof data_ === 'string') {\n if (!data_.startsWith('0x'))\n throw new BaseError(\n `data (\"${data_}\") must be a hex value. Encode it first to a hex with the \\`toHex\\` util.`,\n {\n docsPath: '/TODO',\n },\n )\n data = data_\n } else {\n data = toHex(data_)\n }\n const signed = await client.request({\n method: 'personal_sign',\n params: [data, from],\n })\n return signed\n}\n","import type { WalletClient } from '../../clients'\nimport { Chain } from '../../types'\nimport { numberToHex } from '../../utils'\n\nexport type SwitchChainArgs = { id: Chain['id'] }\n\nexport async function switchChain(\n client: WalletClient,\n { id }: SwitchChainArgs,\n) {\n await client.request({\n method: 'wallet_switchEthereumChain',\n params: [\n {\n chainId: numberToHex(id),\n },\n ],\n })\n}\n","import type { WalletClient } from '../../clients'\nimport type { WatchAssetParams } from '../../types/eip1193'\n\nexport type WatchAssetArgs = WatchAssetParams\nexport type WatchAssetResponse = boolean\n\nexport async function watchAsset(\n client: WalletClient,\n params: WatchAssetParams,\n): Promise<WatchAssetResponse> {\n const added = await client.request({\n method: 'wallet_watchAsset',\n params: [params],\n })\n return added\n}\n","import { Abi } from 'abitype'\n\nimport type { WalletClient } from '../../clients'\nimport type { Chain, ContractConfig, GetValue } from '../../types'\nimport { EncodeFunctionDataArgs, encodeFunctionData } from '../../utils'\nimport {\n sendTransaction,\n SendTransactionArgs,\n SendTransactionResponse,\n} from './sendTransaction'\n\nexport type WriteContractArgs<\n TChain extends Chain = Chain,\n TAbi extends Abi | readonly unknown[] = Abi,\n TFunctionName extends string = string,\n> = Omit<SendTransactionArgs<TChain>, 'to' | 'data' | 'value'> & {\n value?: GetValue<TAbi, TFunctionName, SendTransactionArgs<TChain>['value']>\n} & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>\n\nexport type WriteContractResponse = SendTransactionResponse\n\nexport async function writeContract<\n TChain extends Chain,\n TAbi extends Abi | readonly unknown[],\n TFunctionName extends string,\n>(\n client: WalletClient,\n {\n abi,\n address,\n args,\n functionName,\n ...request\n }: WriteContractArgs<TChain, TAbi, TFunctionName>,\n): Promise<WriteContractResponse> {\n const data = encodeFunctionData({\n abi,\n args,\n functionName,\n } as unknown as EncodeFunctionDataArgs<TAbi, TFunctionName>)\n const hash = await sendTransaction(client, {\n data,\n to: address,\n ...request,\n } as unknown as SendTransactionArgs<TChain>)\n return hash\n}\n","import { Abi, Narrow } from 'abitype'\nimport { WalletClient } from '../../clients'\n\nimport { Chain, ExtractConstructorArgsFromAbi, Hex } from '../../types'\nimport { encodeDeployData } from '../../utils'\nimport {\n sendTransaction,\n SendTransactionArgs,\n SendTransactionResponse,\n} from '../wallet'\n\nexport type DeployContractArgs<\n TChain extends Chain = Chain,\n TAbi extends Abi | readonly unknown[] = Abi,\n> = Omit<\n SendTransactionArgs<TChain>,\n 'accessList' | 'to' | 'data' | 'value'\n> & {\n abi: Narrow<TAbi>\n bytecode: Hex\n} & ExtractConstructorArgsFromAbi<TAbi>\n\nexport type DeployContractResponse = SendTransactionResponse\n\nexport function deployContract<TChain extends Chain, TAbi extends Abi>(\n walletClient: WalletClient,\n { abi, args, bytecode, ...request }: DeployContractArgs<TChain, TAbi>,\n): Promise<DeployContractResponse> {\n const calldata = encodeDeployData({\n abi,\n args,\n bytecode,\n } as unknown as DeployContractArgs<TChain, TAbi>)\n return sendTransaction(walletClient, {\n ...request,\n data: calldata,\n } as unknown as SendTransactionArgs<TChain>)\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA,eAAsB,SAAS,QAAsB,OAAc;AACjE,QAAM,EAAE,IAAI,MAAM,gBAAgB,SAAS,eAAe,IAAI;AAC9D,QAAM,OAAO,QAAQ;AAAA,IACnB,QAAQ;AAAA,IACR,QAAQ;AAAA,MACN;AAAA,QACE,SAAS,YAAY,EAAE;AAAA,QACvB,WAAW;AAAA,QACX;AAAA,QACA,SAAS,QAAQ,QAAQ;AAAA,QACzB,mBAAmB,iBACf,OAAO,OAAO,cAAc,EAAE,IAAI,CAAC,EAAE,IAAI,MAAM,GAAG,IAClD;AAAA,MACN;AAAA,IACF;AAAA,EACF,CAAC;AACH;;;ACj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