@sentio/sdk 2.43.1 → 2.43.2-rc.2
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/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +1 -321
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.js +1 -132
- package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.js +1 -259
- package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.js +1 -125
- package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.js +1 -206
- package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.js +1 -145
- package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
- package/lib/eth/codegen/function-calls.d.ts.map +1 -1
- package/lib/eth/codegen/function-calls.js +0 -14
- package/lib/eth/codegen/function-calls.js.map +1 -1
- package/lib/eth/eth.js +2 -2
- package/lib/eth/eth.js.map +1 -1
- package/package.json +3 -3
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +0 -324
- package/src/eth/builtin/internal/erc1155-processor.ts +0 -132
- package/src/eth/builtin/internal/erc20-processor.ts +0 -259
- package/src/eth/builtin/internal/erc20bytes-processor.ts +0 -125
- package/src/eth/builtin/internal/erc721-processor.ts +0 -206
- package/src/eth/builtin/internal/weth9-processor.ts +0 -145
- package/src/eth/codegen/function-calls.ts +0 -16
- package/src/eth/eth.ts +2 -2
@@ -21,7 +21,6 @@ import {
|
|
21
21
|
EthContext,
|
22
22
|
EthFetchConfig,
|
23
23
|
PreprocessResult,
|
24
|
-
makeEthCallKey,
|
25
24
|
} from "@sentio/sdk/eth";
|
26
25
|
import { EthCallParam, EthCallContext, PreparedData } from "@sentio/protos";
|
27
26
|
|
@@ -180,20 +179,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
180
179
|
ethCallContext?: EthCallContext
|
181
180
|
): Promise<bigint> {
|
182
181
|
try {
|
183
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
184
|
-
const calldata = iface.encodeFunctionData("totalSupply", []);
|
185
|
-
const ethCallKey = makeEthCallKey({
|
186
|
-
context: ethCallContext,
|
187
|
-
calldata,
|
188
|
-
});
|
189
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
190
|
-
if (ret) {
|
191
|
-
const result = iface
|
192
|
-
.decodeFunctionResult("totalSupply", ret)
|
193
|
-
.toArray();
|
194
|
-
return result.length == 1 ? result[0] : result;
|
195
|
-
}
|
196
|
-
}
|
197
182
|
return await this.contract.getFunction("totalSupply()")(overrides || {});
|
198
183
|
} catch (e) {
|
199
184
|
const stack = new Error().stack;
|
@@ -208,18 +193,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
208
193
|
ethCallContext?: EthCallContext
|
209
194
|
): Promise<bigint> {
|
210
195
|
try {
|
211
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
212
|
-
const calldata = iface.encodeFunctionData("balanceOf", [owner]);
|
213
|
-
const ethCallKey = makeEthCallKey({
|
214
|
-
context: ethCallContext,
|
215
|
-
calldata,
|
216
|
-
});
|
217
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
218
|
-
if (ret) {
|
219
|
-
const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
|
220
|
-
return result.length == 1 ? result[0] : result;
|
221
|
-
}
|
222
|
-
}
|
223
196
|
return await this.contract.getFunction("balanceOf(address)")(
|
224
197
|
owner,
|
225
198
|
overrides || {}
|
@@ -237,20 +210,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
237
210
|
ethCallContext?: EthCallContext
|
238
211
|
): Promise<string> {
|
239
212
|
try {
|
240
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
241
|
-
const calldata = iface.encodeFunctionData("getApproved", [tokenId]);
|
242
|
-
const ethCallKey = makeEthCallKey({
|
243
|
-
context: ethCallContext,
|
244
|
-
calldata,
|
245
|
-
});
|
246
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
247
|
-
if (ret) {
|
248
|
-
const result = iface
|
249
|
-
.decodeFunctionResult("getApproved", ret)
|
250
|
-
.toArray();
|
251
|
-
return result.length == 1 ? result[0] : result;
|
252
|
-
}
|
253
|
-
}
|
254
213
|
return await this.contract.getFunction("getApproved(uint256)")(
|
255
214
|
tokenId,
|
256
215
|
overrides || {}
|
@@ -269,23 +228,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
269
228
|
ethCallContext?: EthCallContext
|
270
229
|
): Promise<boolean> {
|
271
230
|
try {
|
272
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
273
|
-
const calldata = iface.encodeFunctionData("isApprovedForAll", [
|
274
|
-
owner,
|
275
|
-
operator,
|
276
|
-
]);
|
277
|
-
const ethCallKey = makeEthCallKey({
|
278
|
-
context: ethCallContext,
|
279
|
-
calldata,
|
280
|
-
});
|
281
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
282
|
-
if (ret) {
|
283
|
-
const result = iface
|
284
|
-
.decodeFunctionResult("isApprovedForAll", ret)
|
285
|
-
.toArray();
|
286
|
-
return result.length == 1 ? result[0] : result;
|
287
|
-
}
|
288
|
-
}
|
289
231
|
return await this.contract.getFunction(
|
290
232
|
"isApprovedForAll(address,address)"
|
291
233
|
)(owner, operator, overrides || {});
|
@@ -301,18 +243,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
301
243
|
ethCallContext?: EthCallContext
|
302
244
|
): Promise<string> {
|
303
245
|
try {
|
304
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
305
|
-
const calldata = iface.encodeFunctionData("name", []);
|
306
|
-
const ethCallKey = makeEthCallKey({
|
307
|
-
context: ethCallContext,
|
308
|
-
calldata,
|
309
|
-
});
|
310
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
311
|
-
if (ret) {
|
312
|
-
const result = iface.decodeFunctionResult("name", ret).toArray();
|
313
|
-
return result.length == 1 ? result[0] : result;
|
314
|
-
}
|
315
|
-
}
|
316
246
|
return await this.contract.getFunction("name()")(overrides || {});
|
317
247
|
} catch (e) {
|
318
248
|
const stack = new Error().stack;
|
@@ -327,18 +257,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
327
257
|
ethCallContext?: EthCallContext
|
328
258
|
): Promise<string> {
|
329
259
|
try {
|
330
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
331
|
-
const calldata = iface.encodeFunctionData("ownerOf", [tokenId]);
|
332
|
-
const ethCallKey = makeEthCallKey({
|
333
|
-
context: ethCallContext,
|
334
|
-
calldata,
|
335
|
-
});
|
336
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
337
|
-
if (ret) {
|
338
|
-
const result = iface.decodeFunctionResult("ownerOf", ret).toArray();
|
339
|
-
return result.length == 1 ? result[0] : result;
|
340
|
-
}
|
341
|
-
}
|
342
260
|
return await this.contract.getFunction("ownerOf(uint256)")(
|
343
261
|
tokenId,
|
344
262
|
overrides || {}
|
@@ -356,22 +274,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
356
274
|
ethCallContext?: EthCallContext
|
357
275
|
): Promise<boolean> {
|
358
276
|
try {
|
359
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
360
|
-
const calldata = iface.encodeFunctionData("supportsInterface", [
|
361
|
-
interfaceId,
|
362
|
-
]);
|
363
|
-
const ethCallKey = makeEthCallKey({
|
364
|
-
context: ethCallContext,
|
365
|
-
calldata,
|
366
|
-
});
|
367
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
368
|
-
if (ret) {
|
369
|
-
const result = iface
|
370
|
-
.decodeFunctionResult("supportsInterface", ret)
|
371
|
-
.toArray();
|
372
|
-
return result.length == 1 ? result[0] : result;
|
373
|
-
}
|
374
|
-
}
|
375
277
|
return await this.contract.getFunction("supportsInterface(bytes4)")(
|
376
278
|
interfaceId,
|
377
279
|
overrides || {}
|
@@ -388,18 +290,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
388
290
|
ethCallContext?: EthCallContext
|
389
291
|
): Promise<string> {
|
390
292
|
try {
|
391
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
392
|
-
const calldata = iface.encodeFunctionData("symbol", []);
|
393
|
-
const ethCallKey = makeEthCallKey({
|
394
|
-
context: ethCallContext,
|
395
|
-
calldata,
|
396
|
-
});
|
397
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
398
|
-
if (ret) {
|
399
|
-
const result = iface.decodeFunctionResult("symbol", ret).toArray();
|
400
|
-
return result.length == 1 ? result[0] : result;
|
401
|
-
}
|
402
|
-
}
|
403
293
|
return await this.contract.getFunction("symbol()")(overrides || {});
|
404
294
|
} catch (e) {
|
405
295
|
const stack = new Error().stack;
|
@@ -414,18 +304,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
414
304
|
ethCallContext?: EthCallContext
|
415
305
|
): Promise<string> {
|
416
306
|
try {
|
417
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
418
|
-
const calldata = iface.encodeFunctionData("tokenURI", [tokenId]);
|
419
|
-
const ethCallKey = makeEthCallKey({
|
420
|
-
context: ethCallContext,
|
421
|
-
calldata,
|
422
|
-
});
|
423
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
424
|
-
if (ret) {
|
425
|
-
const result = iface.decodeFunctionResult("tokenURI", ret).toArray();
|
426
|
-
return result.length == 1 ? result[0] : result;
|
427
|
-
}
|
428
|
-
}
|
429
307
|
return await this.contract.getFunction("tokenURI(uint256)")(
|
430
308
|
tokenId,
|
431
309
|
overrides || {}
|
@@ -447,18 +325,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
447
325
|
ethCallContext?: EthCallContext
|
448
326
|
): Promise<void> {
|
449
327
|
try {
|
450
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
451
|
-
const calldata = iface.encodeFunctionData("approve", [to, tokenId]);
|
452
|
-
const ethCallKey = makeEthCallKey({
|
453
|
-
context: ethCallContext,
|
454
|
-
calldata,
|
455
|
-
});
|
456
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
457
|
-
if (ret) {
|
458
|
-
const result = iface.decodeFunctionResult("approve", ret).toArray();
|
459
|
-
return result.length == 1 ? result[0] : result;
|
460
|
-
}
|
461
|
-
}
|
462
328
|
return await this.contract
|
463
329
|
.getFunction("approve(address,uint256)")
|
464
330
|
.staticCall(to, tokenId, overrides || {});
|
@@ -476,24 +342,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
476
342
|
ethCallContext?: EthCallContext
|
477
343
|
): Promise<void> {
|
478
344
|
try {
|
479
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
480
|
-
const calldata = iface.encodeFunctionData("safeTransferFrom", [
|
481
|
-
from,
|
482
|
-
to,
|
483
|
-
tokenId,
|
484
|
-
]);
|
485
|
-
const ethCallKey = makeEthCallKey({
|
486
|
-
context: ethCallContext,
|
487
|
-
calldata,
|
488
|
-
});
|
489
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
490
|
-
if (ret) {
|
491
|
-
const result = iface
|
492
|
-
.decodeFunctionResult("safeTransferFrom", ret)
|
493
|
-
.toArray();
|
494
|
-
return result.length == 1 ? result[0] : result;
|
495
|
-
}
|
496
|
-
}
|
497
345
|
return await this.contract
|
498
346
|
.getFunction("safeTransferFrom(address,address,uint256)")
|
499
347
|
.staticCall(from, to, tokenId, overrides || {});
|
@@ -512,25 +360,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
512
360
|
ethCallContext?: EthCallContext
|
513
361
|
): Promise<void> {
|
514
362
|
try {
|
515
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
516
|
-
const calldata = iface.encodeFunctionData("safeTransferFrom", [
|
517
|
-
from,
|
518
|
-
to,
|
519
|
-
tokenId,
|
520
|
-
data,
|
521
|
-
]);
|
522
|
-
const ethCallKey = makeEthCallKey({
|
523
|
-
context: ethCallContext,
|
524
|
-
calldata,
|
525
|
-
});
|
526
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
527
|
-
if (ret) {
|
528
|
-
const result = iface
|
529
|
-
.decodeFunctionResult("safeTransferFrom", ret)
|
530
|
-
.toArray();
|
531
|
-
return result.length == 1 ? result[0] : result;
|
532
|
-
}
|
533
|
-
}
|
534
363
|
return await this.contract
|
535
364
|
.getFunction("safeTransferFrom(address,address,uint256,bytes)")
|
536
365
|
.staticCall(from, to, tokenId, data, overrides || {});
|
@@ -547,23 +376,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
547
376
|
ethCallContext?: EthCallContext
|
548
377
|
): Promise<void> {
|
549
378
|
try {
|
550
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
551
|
-
const calldata = iface.encodeFunctionData("setApprovalForAll", [
|
552
|
-
operator,
|
553
|
-
_approved,
|
554
|
-
]);
|
555
|
-
const ethCallKey = makeEthCallKey({
|
556
|
-
context: ethCallContext,
|
557
|
-
calldata,
|
558
|
-
});
|
559
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
560
|
-
if (ret) {
|
561
|
-
const result = iface
|
562
|
-
.decodeFunctionResult("setApprovalForAll", ret)
|
563
|
-
.toArray();
|
564
|
-
return result.length == 1 ? result[0] : result;
|
565
|
-
}
|
566
|
-
}
|
567
379
|
return await this.contract
|
568
380
|
.getFunction("setApprovalForAll(address,bool)")
|
569
381
|
.staticCall(operator, _approved, overrides || {});
|
@@ -581,24 +393,6 @@ export class ERC721ContractView extends ContractView<ERC721> {
|
|
581
393
|
ethCallContext?: EthCallContext
|
582
394
|
): Promise<void> {
|
583
395
|
try {
|
584
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
585
|
-
const calldata = iface.encodeFunctionData("transferFrom", [
|
586
|
-
from,
|
587
|
-
to,
|
588
|
-
tokenId,
|
589
|
-
]);
|
590
|
-
const ethCallKey = makeEthCallKey({
|
591
|
-
context: ethCallContext,
|
592
|
-
calldata,
|
593
|
-
});
|
594
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
595
|
-
if (ret) {
|
596
|
-
const result = iface
|
597
|
-
.decodeFunctionResult("transferFrom", ret)
|
598
|
-
.toArray();
|
599
|
-
return result.length == 1 ? result[0] : result;
|
600
|
-
}
|
601
|
-
}
|
602
396
|
return await this.contract
|
603
397
|
.getFunction("transferFrom(address,address,uint256)")
|
604
398
|
.staticCall(from, to, tokenId, overrides || {});
|
@@ -21,7 +21,6 @@ import {
|
|
21
21
|
EthContext,
|
22
22
|
EthFetchConfig,
|
23
23
|
PreprocessResult,
|
24
|
-
makeEthCallKey,
|
25
24
|
} from "@sentio/sdk/eth";
|
26
25
|
import { EthCallParam, EthCallContext, PreparedData } from "@sentio/protos";
|
27
26
|
|
@@ -134,18 +133,6 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
134
133
|
ethCallContext?: EthCallContext
|
135
134
|
): Promise<string> {
|
136
135
|
try {
|
137
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
138
|
-
const calldata = iface.encodeFunctionData("name", []);
|
139
|
-
const ethCallKey = makeEthCallKey({
|
140
|
-
context: ethCallContext,
|
141
|
-
calldata,
|
142
|
-
});
|
143
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
144
|
-
if (ret) {
|
145
|
-
const result = iface.decodeFunctionResult("name", ret).toArray();
|
146
|
-
return result.length == 1 ? result[0] : result;
|
147
|
-
}
|
148
|
-
}
|
149
136
|
return await this.contract.getFunction("name()")(overrides || {});
|
150
137
|
} catch (e) {
|
151
138
|
const stack = new Error().stack;
|
@@ -159,20 +146,6 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
159
146
|
ethCallContext?: EthCallContext
|
160
147
|
): Promise<bigint> {
|
161
148
|
try {
|
162
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
163
|
-
const calldata = iface.encodeFunctionData("totalSupply", []);
|
164
|
-
const ethCallKey = makeEthCallKey({
|
165
|
-
context: ethCallContext,
|
166
|
-
calldata,
|
167
|
-
});
|
168
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
169
|
-
if (ret) {
|
170
|
-
const result = iface
|
171
|
-
.decodeFunctionResult("totalSupply", ret)
|
172
|
-
.toArray();
|
173
|
-
return result.length == 1 ? result[0] : result;
|
174
|
-
}
|
175
|
-
}
|
176
149
|
return await this.contract.getFunction("totalSupply()")(overrides || {});
|
177
150
|
} catch (e) {
|
178
151
|
const stack = new Error().stack;
|
@@ -186,18 +159,6 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
186
159
|
ethCallContext?: EthCallContext
|
187
160
|
): Promise<bigint> {
|
188
161
|
try {
|
189
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
190
|
-
const calldata = iface.encodeFunctionData("decimals", []);
|
191
|
-
const ethCallKey = makeEthCallKey({
|
192
|
-
context: ethCallContext,
|
193
|
-
calldata,
|
194
|
-
});
|
195
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
196
|
-
if (ret) {
|
197
|
-
const result = iface.decodeFunctionResult("decimals", ret).toArray();
|
198
|
-
return result.length == 1 ? result[0] : result;
|
199
|
-
}
|
200
|
-
}
|
201
162
|
return await this.contract.getFunction("decimals()")(overrides || {});
|
202
163
|
} catch (e) {
|
203
164
|
const stack = new Error().stack;
|
@@ -212,18 +173,6 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
212
173
|
ethCallContext?: EthCallContext
|
213
174
|
): Promise<bigint> {
|
214
175
|
try {
|
215
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
216
|
-
const calldata = iface.encodeFunctionData("balanceOf", [arg0]);
|
217
|
-
const ethCallKey = makeEthCallKey({
|
218
|
-
context: ethCallContext,
|
219
|
-
calldata,
|
220
|
-
});
|
221
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
222
|
-
if (ret) {
|
223
|
-
const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
|
224
|
-
return result.length == 1 ? result[0] : result;
|
225
|
-
}
|
226
|
-
}
|
227
176
|
return await this.contract.getFunction("balanceOf(address)")(
|
228
177
|
arg0,
|
229
178
|
overrides || {}
|
@@ -240,18 +189,6 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
240
189
|
ethCallContext?: EthCallContext
|
241
190
|
): Promise<string> {
|
242
191
|
try {
|
243
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
244
|
-
const calldata = iface.encodeFunctionData("symbol", []);
|
245
|
-
const ethCallKey = makeEthCallKey({
|
246
|
-
context: ethCallContext,
|
247
|
-
calldata,
|
248
|
-
});
|
249
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
250
|
-
if (ret) {
|
251
|
-
const result = iface.decodeFunctionResult("symbol", ret).toArray();
|
252
|
-
return result.length == 1 ? result[0] : result;
|
253
|
-
}
|
254
|
-
}
|
255
192
|
return await this.contract.getFunction("symbol()")(overrides || {});
|
256
193
|
} catch (e) {
|
257
194
|
const stack = new Error().stack;
|
@@ -267,18 +204,6 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
267
204
|
ethCallContext?: EthCallContext
|
268
205
|
): Promise<bigint> {
|
269
206
|
try {
|
270
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
271
|
-
const calldata = iface.encodeFunctionData("allowance", [arg0, arg1]);
|
272
|
-
const ethCallKey = makeEthCallKey({
|
273
|
-
context: ethCallContext,
|
274
|
-
calldata,
|
275
|
-
});
|
276
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
277
|
-
if (ret) {
|
278
|
-
const result = iface.decodeFunctionResult("allowance", ret).toArray();
|
279
|
-
return result.length == 1 ? result[0] : result;
|
280
|
-
}
|
281
|
-
}
|
282
207
|
return await this.contract.getFunction("allowance(address,address)")(
|
283
208
|
arg0,
|
284
209
|
arg1,
|
@@ -301,18 +226,6 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
301
226
|
ethCallContext?: EthCallContext
|
302
227
|
): Promise<boolean> {
|
303
228
|
try {
|
304
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
305
|
-
const calldata = iface.encodeFunctionData("approve", [guy, wad]);
|
306
|
-
const ethCallKey = makeEthCallKey({
|
307
|
-
context: ethCallContext,
|
308
|
-
calldata,
|
309
|
-
});
|
310
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
311
|
-
if (ret) {
|
312
|
-
const result = iface.decodeFunctionResult("approve", ret).toArray();
|
313
|
-
return result.length == 1 ? result[0] : result;
|
314
|
-
}
|
315
|
-
}
|
316
229
|
return await this.contract
|
317
230
|
.getFunction("approve(address,uint256)")
|
318
231
|
.staticCall(guy, wad, overrides || {});
|
@@ -330,24 +243,6 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
330
243
|
ethCallContext?: EthCallContext
|
331
244
|
): Promise<boolean> {
|
332
245
|
try {
|
333
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
334
|
-
const calldata = iface.encodeFunctionData("transferFrom", [
|
335
|
-
src,
|
336
|
-
dst,
|
337
|
-
wad,
|
338
|
-
]);
|
339
|
-
const ethCallKey = makeEthCallKey({
|
340
|
-
context: ethCallContext,
|
341
|
-
calldata,
|
342
|
-
});
|
343
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
344
|
-
if (ret) {
|
345
|
-
const result = iface
|
346
|
-
.decodeFunctionResult("transferFrom", ret)
|
347
|
-
.toArray();
|
348
|
-
return result.length == 1 ? result[0] : result;
|
349
|
-
}
|
350
|
-
}
|
351
246
|
return await this.contract
|
352
247
|
.getFunction("transferFrom(address,address,uint256)")
|
353
248
|
.staticCall(src, dst, wad, overrides || {});
|
@@ -363,20 +258,6 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
363
258
|
ethCallContext?: EthCallContext
|
364
259
|
): Promise<void> {
|
365
260
|
try {
|
366
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
367
|
-
const calldata = iface.encodeFunctionData("withdraw", [wad]);
|
368
|
-
const ethCallKey = makeEthCallKey({
|
369
|
-
context: ethCallContext,
|
370
|
-
calldata,
|
371
|
-
});
|
372
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
373
|
-
if (ret) {
|
374
|
-
const result = iface
|
375
|
-
.decodeFunctionResult("withdraw", ret)
|
376
|
-
.toArray();
|
377
|
-
return result.length == 1 ? result[0] : result;
|
378
|
-
}
|
379
|
-
}
|
380
261
|
return await this.contract
|
381
262
|
.getFunction("withdraw(uint256)")
|
382
263
|
.staticCall(wad, overrides || {});
|
@@ -393,20 +274,6 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
393
274
|
ethCallContext?: EthCallContext
|
394
275
|
): Promise<boolean> {
|
395
276
|
try {
|
396
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
397
|
-
const calldata = iface.encodeFunctionData("transfer", [dst, wad]);
|
398
|
-
const ethCallKey = makeEthCallKey({
|
399
|
-
context: ethCallContext,
|
400
|
-
calldata,
|
401
|
-
});
|
402
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
403
|
-
if (ret) {
|
404
|
-
const result = iface
|
405
|
-
.decodeFunctionResult("transfer", ret)
|
406
|
-
.toArray();
|
407
|
-
return result.length == 1 ? result[0] : result;
|
408
|
-
}
|
409
|
-
}
|
410
277
|
return await this.contract
|
411
278
|
.getFunction("transfer(address,uint256)")
|
412
279
|
.staticCall(dst, wad, overrides || {});
|
@@ -421,18 +288,6 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
421
288
|
ethCallContext?: EthCallContext
|
422
289
|
): Promise<void> {
|
423
290
|
try {
|
424
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
425
|
-
const calldata = iface.encodeFunctionData("deposit", []);
|
426
|
-
const ethCallKey = makeEthCallKey({
|
427
|
-
context: ethCallContext,
|
428
|
-
calldata,
|
429
|
-
});
|
430
|
-
const ret = preparedData.ethCallResults[ethCallKey];
|
431
|
-
if (ret) {
|
432
|
-
const result = iface.decodeFunctionResult("deposit", ret).toArray();
|
433
|
-
return result.length == 1 ? result[0] : result;
|
434
|
-
}
|
435
|
-
}
|
436
291
|
return await this.contract
|
437
292
|
.getFunction("deposit()")
|
438
293
|
.staticCall(overrides || {});
|
@@ -44,22 +44,6 @@ export function generateViewFunction(view: boolean, fn: FunctionDeclaration, inc
|
|
44
44
|
useStructs: true
|
45
45
|
})}overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext): ${generateReturnTypes(fn)} {
|
46
46
|
try {
|
47
|
-
if (preparedData?.ethCallResults && ethCallContext) {
|
48
|
-
const calldata = iface.encodeFunctionData(
|
49
|
-
"${fn.name}",[${
|
50
|
-
fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''
|
51
|
-
}]
|
52
|
-
)
|
53
|
-
const ethCallKey = makeEthCallKey({
|
54
|
-
context: ethCallContext,
|
55
|
-
calldata
|
56
|
-
})
|
57
|
-
const ret = preparedData.ethCallResults[ethCallKey]
|
58
|
-
if (ret) {
|
59
|
-
const result = iface.decodeFunctionResult("${fn.name}", ret).toArray()
|
60
|
-
return result.length == 1? result[0]: result
|
61
|
-
}
|
62
|
-
}
|
63
47
|
return await ${func}${call}(${
|
64
48
|
fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''
|
65
49
|
} overrides || {})
|
package/src/eth/eth.ts
CHANGED
@@ -70,11 +70,11 @@ export function transformEtherError(e: Error, ctx: ContractContext<any, any> | u
|
|
70
70
|
}
|
71
71
|
return new SimpleEthersError(msg, err, stack)
|
72
72
|
} else {
|
73
|
-
return new SimpleEthersError(`eth call error, ${checkPage}:\n${JSON.stringify(err)}`, err, stack)
|
73
|
+
return new SimpleEthersError(`eth call error ${err.message}, ${checkPage}:\n${JSON.stringify(err)}`, err, stack)
|
74
74
|
}
|
75
75
|
}
|
76
76
|
|
77
|
-
msg = 'other error during call error\n' + JSON.stringify(e) + '\n' + stack?.toString() + '\n' + checkPage
|
77
|
+
msg = 'other error during call error ${e.message}\n' + JSON.stringify(e) + '\n' + stack?.toString() + '\n' + checkPage
|
78
78
|
return new Error(msg)
|
79
79
|
}
|
80
80
|
|