@sentio/sdk 2.45.3-rc.1 → 2.45.3-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.
Files changed (49) hide show
  1. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +23 -23
  2. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
  3. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +93 -659
  4. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
  5. package/lib/eth/builtin/internal/erc1155-processor.d.ts +8 -8
  6. package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
  7. package/lib/eth/builtin/internal/erc1155-processor.js +33 -264
  8. package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
  9. package/lib/eth/builtin/internal/erc20-processor.d.ts +18 -18
  10. package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
  11. package/lib/eth/builtin/internal/erc20-processor.js +75 -538
  12. package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
  13. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts +9 -9
  14. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
  15. package/lib/eth/builtin/internal/erc20bytes-processor.js +37 -268
  16. package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
  17. package/lib/eth/builtin/internal/erc721-processor.d.ts +14 -14
  18. package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
  19. package/lib/eth/builtin/internal/erc721-processor.js +57 -430
  20. package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
  21. package/lib/eth/builtin/internal/weth9-processor.d.ts +11 -11
  22. package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
  23. package/lib/eth/builtin/internal/weth9-processor.js +45 -321
  24. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  25. package/lib/eth/codegen/file.d.ts.map +1 -1
  26. package/lib/eth/codegen/file.js +3 -6
  27. package/lib/eth/codegen/file.js.map +1 -1
  28. package/lib/eth/codegen/function-calls.d.ts.map +1 -1
  29. package/lib/eth/codegen/function-calls.js +5 -27
  30. package/lib/eth/codegen/function-calls.js.map +1 -1
  31. package/lib/eth/context.d.ts +4 -2
  32. package/lib/eth/context.d.ts.map +1 -1
  33. package/lib/eth/context.js +15 -0
  34. package/lib/eth/context.js.map +1 -1
  35. package/lib/eth/eth.d.ts +2 -0
  36. package/lib/eth/eth.d.ts.map +1 -1
  37. package/lib/eth/eth.js +15 -1
  38. package/lib/eth/eth.js.map +1 -1
  39. package/package.json +3 -3
  40. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +189 -662
  41. package/src/eth/builtin/internal/erc1155-processor.ts +69 -261
  42. package/src/eth/builtin/internal/erc20-processor.ts +136 -535
  43. package/src/eth/builtin/internal/erc20bytes-processor.ts +68 -265
  44. package/src/eth/builtin/internal/erc721-processor.ts +118 -433
  45. package/src/eth/builtin/internal/weth9-processor.ts +81 -318
  46. package/src/eth/codegen/file.ts +2 -6
  47. package/src/eth/codegen/function-calls.ts +7 -29
  48. package/src/eth/context.ts +19 -2
  49. package/src/eth/eth.ts +21 -1
@@ -1,30 +1,6 @@
1
- /* Autogenerated file. Do not edit manually. */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- import { Interface } from "ethers";
5
- import { addContractByABI, getContractByABI, addProcessor, getProcessor, getProvider, transformEtherError, BaseProcessor, BaseProcessorTemplate, BoundContractView, ContractView, DummyProvider, } from "@sentio/sdk/eth";
1
+ import { addContractByABI, getContractByABI, addProcessor, getProcessor, getProvider, transformEtherError, BaseProcessor, BaseProcessorTemplate, BoundContractView, ContractView, DummyProvider, encodeCallData, } from "@sentio/sdk/eth";
6
2
  import { ERC20__factory } from "./index.js";
7
3
  const templateContract = ERC20__factory.connect("0x0", DummyProvider);
8
- const iface = new Interface([
9
- "function allowance(address owner, address spender) view returns (uint256)",
10
- "function approve(address spender, uint256 amount) returns (bool)",
11
- "function balanceOf(address account) view returns (uint256)",
12
- "function burn(uint256 amount) returns ()",
13
- "function burnFrom(address account, uint256 amount) returns ()",
14
- "function decimals() view returns (uint8)",
15
- "function decreaseAllowance(address spender, uint256 subtractedValue) returns (bool)",
16
- "function increaseAllowance(address spender, uint256 addedValue) returns (bool)",
17
- "function locker() view returns (address)",
18
- "function name() view returns (string)",
19
- "function owner() view returns (address)",
20
- "function renounceOwnership() returns ()",
21
- "function setLocker(address _locker) returns ()",
22
- "function symbol() view returns (string)",
23
- "function totalSupply() view returns (uint256)",
24
- "function transfer(address recipient, uint256 amount) returns (bool)",
25
- "function transferFrom(address sender, address recipient, uint256 amount) returns (bool)",
26
- "function transferOwnership(address newOwner) returns ()",
27
- ]);
28
4
  export class ERC20ContractView extends ContractView {
29
5
  constructor(contract) {
30
6
  super(contract);
@@ -216,743 +192,304 @@ export class ERC20ContractView extends ContractView {
216
192
  },
217
193
  };
218
194
  encodeCall = {
219
- allowance(owner, spender, ethCallContext) {
220
- try {
221
- const iface = new Interface(["function allowance(address,address)"]);
222
- const calldata = iface.encodeFunctionData("allowance", [
223
- owner,
224
- spender,
225
- ]);
226
- return {
227
- context: ethCallContext,
228
- calldata,
229
- };
230
- }
231
- catch (e) {
232
- const stack = new Error().stack;
233
- throw transformEtherError(e, undefined, stack);
234
- }
195
+ allowance(owner, spender, callContext) {
196
+ return encodeCallData(callContext, "allowance", "function allowance(address,address)", [owner, spender]);
235
197
  },
236
- approve(spender, amount, ethCallContext) {
237
- try {
238
- const iface = new Interface(["function approve(address,uint256)"]);
239
- const calldata = iface.encodeFunctionData("approve", [spender, amount]);
240
- return {
241
- context: ethCallContext,
242
- calldata,
243
- };
244
- }
245
- catch (e) {
246
- const stack = new Error().stack;
247
- throw transformEtherError(e, undefined, stack);
248
- }
198
+ approve(spender, amount, callContext) {
199
+ return encodeCallData(callContext, "approve", "function approve(address,uint256)", [spender, amount]);
249
200
  },
250
- balanceOf(account, ethCallContext) {
251
- try {
252
- const iface = new Interface(["function balanceOf(address)"]);
253
- const calldata = iface.encodeFunctionData("balanceOf", [account]);
254
- return {
255
- context: ethCallContext,
256
- calldata,
257
- };
258
- }
259
- catch (e) {
260
- const stack = new Error().stack;
261
- throw transformEtherError(e, undefined, stack);
262
- }
201
+ balanceOf(account, callContext) {
202
+ return encodeCallData(callContext, "balanceOf", "function balanceOf(address)", [account]);
263
203
  },
264
- burn(amount, ethCallContext) {
265
- try {
266
- const iface = new Interface(["function burn(uint256)"]);
267
- const calldata = iface.encodeFunctionData("burn", [amount]);
268
- return {
269
- context: ethCallContext,
270
- calldata,
271
- };
272
- }
273
- catch (e) {
274
- const stack = new Error().stack;
275
- throw transformEtherError(e, undefined, stack);
276
- }
204
+ burn(amount, callContext) {
205
+ return encodeCallData(callContext, "burn", "function burn(uint256)", [
206
+ amount,
207
+ ]);
277
208
  },
278
- burnFrom(account, amount, ethCallContext) {
279
- try {
280
- const iface = new Interface(["function burnFrom(address,uint256)"]);
281
- const calldata = iface.encodeFunctionData("burnFrom", [
282
- account,
283
- amount,
284
- ]);
285
- return {
286
- context: ethCallContext,
287
- calldata,
288
- };
289
- }
290
- catch (e) {
291
- const stack = new Error().stack;
292
- throw transformEtherError(e, undefined, stack);
293
- }
209
+ burnFrom(account, amount, callContext) {
210
+ return encodeCallData(callContext, "burnFrom", "function burnFrom(address,uint256)", [account, amount]);
294
211
  },
295
- decimals(ethCallContext) {
296
- try {
297
- const iface = new Interface(["function decimals()"]);
298
- const calldata = iface.encodeFunctionData("decimals", []);
299
- return {
300
- context: ethCallContext,
301
- calldata,
302
- };
303
- }
304
- catch (e) {
305
- const stack = new Error().stack;
306
- throw transformEtherError(e, undefined, stack);
307
- }
212
+ decimals(callContext) {
213
+ return encodeCallData(callContext, "decimals", "function decimals()", []);
308
214
  },
309
- decreaseAllowance(spender, subtractedValue, ethCallContext) {
310
- try {
311
- const iface = new Interface([
312
- "function decreaseAllowance(address,uint256)",
313
- ]);
314
- const calldata = iface.encodeFunctionData("decreaseAllowance", [
315
- spender,
316
- subtractedValue,
317
- ]);
318
- return {
319
- context: ethCallContext,
320
- calldata,
321
- };
322
- }
323
- catch (e) {
324
- const stack = new Error().stack;
325
- throw transformEtherError(e, undefined, stack);
326
- }
215
+ decreaseAllowance(spender, subtractedValue, callContext) {
216
+ return encodeCallData(callContext, "decreaseAllowance", "function decreaseAllowance(address,uint256)", [spender, subtractedValue]);
327
217
  },
328
- increaseAllowance(spender, addedValue, ethCallContext) {
329
- try {
330
- const iface = new Interface([
331
- "function increaseAllowance(address,uint256)",
332
- ]);
333
- const calldata = iface.encodeFunctionData("increaseAllowance", [
334
- spender,
335
- addedValue,
336
- ]);
337
- return {
338
- context: ethCallContext,
339
- calldata,
340
- };
341
- }
342
- catch (e) {
343
- const stack = new Error().stack;
344
- throw transformEtherError(e, undefined, stack);
345
- }
218
+ increaseAllowance(spender, addedValue, callContext) {
219
+ return encodeCallData(callContext, "increaseAllowance", "function increaseAllowance(address,uint256)", [spender, addedValue]);
346
220
  },
347
- locker(ethCallContext) {
348
- try {
349
- const iface = new Interface(["function locker()"]);
350
- const calldata = iface.encodeFunctionData("locker", []);
351
- return {
352
- context: ethCallContext,
353
- calldata,
354
- };
355
- }
356
- catch (e) {
357
- const stack = new Error().stack;
358
- throw transformEtherError(e, undefined, stack);
359
- }
221
+ locker(callContext) {
222
+ return encodeCallData(callContext, "locker", "function locker()", []);
360
223
  },
361
- name(ethCallContext) {
362
- try {
363
- const iface = new Interface(["function name()"]);
364
- const calldata = iface.encodeFunctionData("name", []);
365
- return {
366
- context: ethCallContext,
367
- calldata,
368
- };
369
- }
370
- catch (e) {
371
- const stack = new Error().stack;
372
- throw transformEtherError(e, undefined, stack);
373
- }
224
+ name(callContext) {
225
+ return encodeCallData(callContext, "name", "function name()", []);
374
226
  },
375
- owner(ethCallContext) {
376
- try {
377
- const iface = new Interface(["function owner()"]);
378
- const calldata = iface.encodeFunctionData("owner", []);
379
- return {
380
- context: ethCallContext,
381
- calldata,
382
- };
383
- }
384
- catch (e) {
385
- const stack = new Error().stack;
386
- throw transformEtherError(e, undefined, stack);
387
- }
227
+ owner(callContext) {
228
+ return encodeCallData(callContext, "owner", "function owner()", []);
388
229
  },
389
- renounceOwnership(ethCallContext) {
390
- try {
391
- const iface = new Interface(["function renounceOwnership()"]);
392
- const calldata = iface.encodeFunctionData("renounceOwnership", []);
393
- return {
394
- context: ethCallContext,
395
- calldata,
396
- };
397
- }
398
- catch (e) {
399
- const stack = new Error().stack;
400
- throw transformEtherError(e, undefined, stack);
401
- }
230
+ renounceOwnership(callContext) {
231
+ return encodeCallData(callContext, "renounceOwnership", "function renounceOwnership()", []);
402
232
  },
403
- setLocker(_locker, ethCallContext) {
404
- try {
405
- const iface = new Interface(["function setLocker(address)"]);
406
- const calldata = iface.encodeFunctionData("setLocker", [_locker]);
407
- return {
408
- context: ethCallContext,
409
- calldata,
410
- };
411
- }
412
- catch (e) {
413
- const stack = new Error().stack;
414
- throw transformEtherError(e, undefined, stack);
415
- }
233
+ setLocker(_locker, callContext) {
234
+ return encodeCallData(callContext, "setLocker", "function setLocker(address)", [_locker]);
416
235
  },
417
- symbol(ethCallContext) {
418
- try {
419
- const iface = new Interface(["function symbol()"]);
420
- const calldata = iface.encodeFunctionData("symbol", []);
421
- return {
422
- context: ethCallContext,
423
- calldata,
424
- };
425
- }
426
- catch (e) {
427
- const stack = new Error().stack;
428
- throw transformEtherError(e, undefined, stack);
429
- }
236
+ symbol(callContext) {
237
+ return encodeCallData(callContext, "symbol", "function symbol()", []);
430
238
  },
431
- totalSupply(ethCallContext) {
432
- try {
433
- const iface = new Interface(["function totalSupply()"]);
434
- const calldata = iface.encodeFunctionData("totalSupply", []);
435
- return {
436
- context: ethCallContext,
437
- calldata,
438
- };
439
- }
440
- catch (e) {
441
- const stack = new Error().stack;
442
- throw transformEtherError(e, undefined, stack);
443
- }
239
+ totalSupply(callContext) {
240
+ return encodeCallData(callContext, "totalSupply", "function totalSupply()", []);
444
241
  },
445
- transfer(recipient, amount, ethCallContext) {
446
- try {
447
- const iface = new Interface(["function transfer(address,uint256)"]);
448
- const calldata = iface.encodeFunctionData("transfer", [
449
- recipient,
450
- amount,
451
- ]);
452
- return {
453
- context: ethCallContext,
454
- calldata,
455
- };
456
- }
457
- catch (e) {
458
- const stack = new Error().stack;
459
- throw transformEtherError(e, undefined, stack);
460
- }
242
+ transfer(recipient, amount, callContext) {
243
+ return encodeCallData(callContext, "transfer", "function transfer(address,uint256)", [recipient, amount]);
461
244
  },
462
- transferFrom(sender, recipient, amount, ethCallContext) {
463
- try {
464
- const iface = new Interface([
465
- "function transferFrom(address,address,uint256)",
466
- ]);
467
- const calldata = iface.encodeFunctionData("transferFrom", [
468
- sender,
469
- recipient,
470
- amount,
471
- ]);
472
- return {
473
- context: ethCallContext,
474
- calldata,
475
- };
476
- }
477
- catch (e) {
478
- const stack = new Error().stack;
479
- throw transformEtherError(e, undefined, stack);
480
- }
245
+ transferFrom(sender, recipient, amount, callContext) {
246
+ return encodeCallData(callContext, "transferFrom", "function transferFrom(address,address,uint256)", [sender, recipient, amount]);
481
247
  },
482
- transferOwnership(newOwner, ethCallContext) {
483
- try {
484
- const iface = new Interface(["function transferOwnership(address)"]);
485
- const calldata = iface.encodeFunctionData("transferOwnership", [
486
- newOwner,
487
- ]);
488
- return {
489
- context: ethCallContext,
490
- calldata,
491
- };
492
- }
493
- catch (e) {
494
- const stack = new Error().stack;
495
- throw transformEtherError(e, undefined, stack);
496
- }
248
+ transferOwnership(newOwner, callContext) {
249
+ return encodeCallData(callContext, "transferOwnership", "function transferOwnership(address)", [newOwner]);
497
250
  },
498
251
  };
499
252
  }
500
253
  export class ERC20BoundContractView extends BoundContractView {
501
254
  async allowance(owner, spender, overrides) {
502
- const ethCallContext = {
503
- chainId: this.context.chainId,
504
- blockTag: "0x" + this.context.blockNumber.toString(16),
505
- address: this.context.address,
506
- };
507
255
  return await this.view.allowance(owner, spender, {
508
256
  blockTag: this.context.blockNumber,
509
257
  ...overrides,
510
- }, this.context.preparedData, ethCallContext);
258
+ }, this.context.preparedData, this.context.getEthCallContext());
511
259
  }
512
260
  async balanceOf(account, overrides) {
513
- const ethCallContext = {
514
- chainId: this.context.chainId,
515
- blockTag: "0x" + this.context.blockNumber.toString(16),
516
- address: this.context.address,
517
- };
518
261
  return await this.view.balanceOf(account, {
519
262
  blockTag: this.context.blockNumber,
520
263
  ...overrides,
521
- }, this.context.preparedData, ethCallContext);
264
+ }, this.context.preparedData, this.context.getEthCallContext());
522
265
  }
523
266
  async decimals(overrides) {
524
- const ethCallContext = {
525
- chainId: this.context.chainId,
526
- blockTag: "0x" + this.context.blockNumber.toString(16),
527
- address: this.context.address,
528
- };
529
267
  return await this.view.decimals({
530
268
  blockTag: this.context.blockNumber,
531
269
  ...overrides,
532
- }, this.context.preparedData, ethCallContext);
270
+ }, this.context.preparedData, this.context.getEthCallContext());
533
271
  }
534
272
  async locker(overrides) {
535
- const ethCallContext = {
536
- chainId: this.context.chainId,
537
- blockTag: "0x" + this.context.blockNumber.toString(16),
538
- address: this.context.address,
539
- };
540
273
  return await this.view.locker({
541
274
  blockTag: this.context.blockNumber,
542
275
  ...overrides,
543
- }, this.context.preparedData, ethCallContext);
276
+ }, this.context.preparedData, this.context.getEthCallContext());
544
277
  }
545
278
  async name(overrides) {
546
- const ethCallContext = {
547
- chainId: this.context.chainId,
548
- blockTag: "0x" + this.context.blockNumber.toString(16),
549
- address: this.context.address,
550
- };
551
279
  return await this.view.name({
552
280
  blockTag: this.context.blockNumber,
553
281
  ...overrides,
554
- }, this.context.preparedData, ethCallContext);
282
+ }, this.context.preparedData, this.context.getEthCallContext());
555
283
  }
556
284
  async owner(overrides) {
557
- const ethCallContext = {
558
- chainId: this.context.chainId,
559
- blockTag: "0x" + this.context.blockNumber.toString(16),
560
- address: this.context.address,
561
- };
562
285
  return await this.view.owner({
563
286
  blockTag: this.context.blockNumber,
564
287
  ...overrides,
565
- }, this.context.preparedData, ethCallContext);
288
+ }, this.context.preparedData, this.context.getEthCallContext());
566
289
  }
567
290
  async symbol(overrides) {
568
- const ethCallContext = {
569
- chainId: this.context.chainId,
570
- blockTag: "0x" + this.context.blockNumber.toString(16),
571
- address: this.context.address,
572
- };
573
291
  return await this.view.symbol({
574
292
  blockTag: this.context.blockNumber,
575
293
  ...overrides,
576
- }, this.context.preparedData, ethCallContext);
294
+ }, this.context.preparedData, this.context.getEthCallContext());
577
295
  }
578
296
  async totalSupply(overrides) {
579
- const ethCallContext = {
580
- chainId: this.context.chainId,
581
- blockTag: "0x" + this.context.blockNumber.toString(16),
582
- address: this.context.address,
583
- };
584
297
  return await this.view.totalSupply({
585
298
  blockTag: this.context.blockNumber,
586
299
  ...overrides,
587
- }, this.context.preparedData, ethCallContext);
300
+ }, this.context.preparedData, this.context.getEthCallContext());
588
301
  }
589
302
  callStatic = {
590
303
  view: this.view,
591
304
  context: this.context,
592
305
  async approve(spender, amount, overrides) {
593
- const ethCallContext = {
594
- chainId: this.context.chainId,
595
- blockTag: "0x" + this.context.blockNumber.toString(16),
596
- address: this.context.address,
597
- };
598
306
  return await this.view.callStatic.approve(spender, amount, {
599
307
  blockTag: this.context.blockNumber,
600
308
  ...overrides,
601
- }, this.context.preparedData, ethCallContext);
309
+ }, this.context.preparedData, this.context.getEthCallContext());
602
310
  },
603
311
  async burn(amount, overrides) {
604
- const ethCallContext = {
605
- chainId: this.context.chainId,
606
- blockTag: "0x" + this.context.blockNumber.toString(16),
607
- address: this.context.address,
608
- };
609
312
  return await this.view.callStatic.burn(amount, {
610
313
  blockTag: this.context.blockNumber,
611
314
  ...overrides,
612
- }, this.context.preparedData, ethCallContext);
315
+ }, this.context.preparedData, this.context.getEthCallContext());
613
316
  },
614
317
  async burnFrom(account, amount, overrides) {
615
- const ethCallContext = {
616
- chainId: this.context.chainId,
617
- blockTag: "0x" + this.context.blockNumber.toString(16),
618
- address: this.context.address,
619
- };
620
318
  return await this.view.callStatic.burnFrom(account, amount, {
621
319
  blockTag: this.context.blockNumber,
622
320
  ...overrides,
623
- }, this.context.preparedData, ethCallContext);
321
+ }, this.context.preparedData, this.context.getEthCallContext());
624
322
  },
625
323
  async decreaseAllowance(spender, subtractedValue, overrides) {
626
- const ethCallContext = {
627
- chainId: this.context.chainId,
628
- blockTag: "0x" + this.context.blockNumber.toString(16),
629
- address: this.context.address,
630
- };
631
324
  return await this.view.callStatic.decreaseAllowance(spender, subtractedValue, {
632
325
  blockTag: this.context.blockNumber,
633
326
  ...overrides,
634
- }, this.context.preparedData, ethCallContext);
327
+ }, this.context.preparedData, this.context.getEthCallContext());
635
328
  },
636
329
  async increaseAllowance(spender, addedValue, overrides) {
637
- const ethCallContext = {
638
- chainId: this.context.chainId,
639
- blockTag: "0x" + this.context.blockNumber.toString(16),
640
- address: this.context.address,
641
- };
642
330
  return await this.view.callStatic.increaseAllowance(spender, addedValue, {
643
331
  blockTag: this.context.blockNumber,
644
332
  ...overrides,
645
- }, this.context.preparedData, ethCallContext);
333
+ }, this.context.preparedData, this.context.getEthCallContext());
646
334
  },
647
335
  async renounceOwnership(overrides) {
648
- const ethCallContext = {
649
- chainId: this.context.chainId,
650
- blockTag: "0x" + this.context.blockNumber.toString(16),
651
- address: this.context.address,
652
- };
653
336
  return await this.view.callStatic.renounceOwnership({
654
337
  blockTag: this.context.blockNumber,
655
338
  ...overrides,
656
- }, this.context.preparedData, ethCallContext);
339
+ }, this.context.preparedData, this.context.getEthCallContext());
657
340
  },
658
341
  async setLocker(_locker, overrides) {
659
- const ethCallContext = {
660
- chainId: this.context.chainId,
661
- blockTag: "0x" + this.context.blockNumber.toString(16),
662
- address: this.context.address,
663
- };
664
342
  return await this.view.callStatic.setLocker(_locker, {
665
343
  blockTag: this.context.blockNumber,
666
344
  ...overrides,
667
- }, this.context.preparedData, ethCallContext);
345
+ }, this.context.preparedData, this.context.getEthCallContext());
668
346
  },
669
347
  async transfer(recipient, amount, overrides) {
670
- const ethCallContext = {
671
- chainId: this.context.chainId,
672
- blockTag: "0x" + this.context.blockNumber.toString(16),
673
- address: this.context.address,
674
- };
675
348
  return await this.view.callStatic.transfer(recipient, amount, {
676
349
  blockTag: this.context.blockNumber,
677
350
  ...overrides,
678
- }, this.context.preparedData, ethCallContext);
351
+ }, this.context.preparedData, this.context.getEthCallContext());
679
352
  },
680
353
  async transferFrom(sender, recipient, amount, overrides) {
681
- const ethCallContext = {
682
- chainId: this.context.chainId,
683
- blockTag: "0x" + this.context.blockNumber.toString(16),
684
- address: this.context.address,
685
- };
686
354
  return await this.view.callStatic.transferFrom(sender, recipient, amount, {
687
355
  blockTag: this.context.blockNumber,
688
356
  ...overrides,
689
- }, this.context.preparedData, ethCallContext);
357
+ }, this.context.preparedData, this.context.getEthCallContext());
690
358
  },
691
359
  async transferOwnership(newOwner, overrides) {
692
- const ethCallContext = {
693
- chainId: this.context.chainId,
694
- blockTag: "0x" + this.context.blockNumber.toString(16),
695
- address: this.context.address,
696
- };
697
360
  return await this.view.callStatic.transferOwnership(newOwner, {
698
361
  blockTag: this.context.blockNumber,
699
362
  ...overrides,
700
- }, this.context.preparedData, ethCallContext);
363
+ }, this.context.preparedData, this.context.getEthCallContext());
701
364
  },
702
365
  };
703
366
  encodeCall = {
704
367
  view: this.view,
705
368
  context: this.context,
706
369
  allowance(owner, spender, overrides) {
707
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
708
- if (overrides?.blockTag) {
709
- blockTagWithOverride =
710
- typeof overrides.blockTag == "string"
711
- ? overrides.blockTag
712
- : "0x" + overrides.blockTag.toString(16);
713
- }
714
370
  return this.view.encodeCall.allowance(owner, spender, {
715
371
  chainId: this.context.chainId.toString(),
716
372
  address: this.context.address,
717
- blockTag: blockTagWithOverride,
373
+ blockTag: this.context.getBlockTag(overrides),
718
374
  });
719
375
  },
720
376
  approve(spender, amount, overrides) {
721
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
722
- if (overrides?.blockTag) {
723
- blockTagWithOverride =
724
- typeof overrides.blockTag == "string"
725
- ? overrides.blockTag
726
- : "0x" + overrides.blockTag.toString(16);
727
- }
728
377
  return this.view.encodeCall.approve(spender, amount, {
729
378
  chainId: this.context.chainId.toString(),
730
379
  address: this.context.address,
731
- blockTag: blockTagWithOverride,
380
+ blockTag: this.context.getBlockTag(overrides),
732
381
  });
733
382
  },
734
383
  balanceOf(account, overrides) {
735
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
736
- if (overrides?.blockTag) {
737
- blockTagWithOverride =
738
- typeof overrides.blockTag == "string"
739
- ? overrides.blockTag
740
- : "0x" + overrides.blockTag.toString(16);
741
- }
742
384
  return this.view.encodeCall.balanceOf(account, {
743
385
  chainId: this.context.chainId.toString(),
744
386
  address: this.context.address,
745
- blockTag: blockTagWithOverride,
387
+ blockTag: this.context.getBlockTag(overrides),
746
388
  });
747
389
  },
748
390
  burn(amount, overrides) {
749
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
750
- if (overrides?.blockTag) {
751
- blockTagWithOverride =
752
- typeof overrides.blockTag == "string"
753
- ? overrides.blockTag
754
- : "0x" + overrides.blockTag.toString(16);
755
- }
756
391
  return this.view.encodeCall.burn(amount, {
757
392
  chainId: this.context.chainId.toString(),
758
393
  address: this.context.address,
759
- blockTag: blockTagWithOverride,
394
+ blockTag: this.context.getBlockTag(overrides),
760
395
  });
761
396
  },
762
397
  burnFrom(account, amount, overrides) {
763
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
764
- if (overrides?.blockTag) {
765
- blockTagWithOverride =
766
- typeof overrides.blockTag == "string"
767
- ? overrides.blockTag
768
- : "0x" + overrides.blockTag.toString(16);
769
- }
770
398
  return this.view.encodeCall.burnFrom(account, amount, {
771
399
  chainId: this.context.chainId.toString(),
772
400
  address: this.context.address,
773
- blockTag: blockTagWithOverride,
401
+ blockTag: this.context.getBlockTag(overrides),
774
402
  });
775
403
  },
776
404
  decimals(overrides) {
777
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
778
- if (overrides?.blockTag) {
779
- blockTagWithOverride =
780
- typeof overrides.blockTag == "string"
781
- ? overrides.blockTag
782
- : "0x" + overrides.blockTag.toString(16);
783
- }
784
405
  return this.view.encodeCall.decimals({
785
406
  chainId: this.context.chainId.toString(),
786
407
  address: this.context.address,
787
- blockTag: blockTagWithOverride,
408
+ blockTag: this.context.getBlockTag(overrides),
788
409
  });
789
410
  },
790
411
  decreaseAllowance(spender, subtractedValue, overrides) {
791
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
792
- if (overrides?.blockTag) {
793
- blockTagWithOverride =
794
- typeof overrides.blockTag == "string"
795
- ? overrides.blockTag
796
- : "0x" + overrides.blockTag.toString(16);
797
- }
798
412
  return this.view.encodeCall.decreaseAllowance(spender, subtractedValue, {
799
413
  chainId: this.context.chainId.toString(),
800
414
  address: this.context.address,
801
- blockTag: blockTagWithOverride,
415
+ blockTag: this.context.getBlockTag(overrides),
802
416
  });
803
417
  },
804
418
  increaseAllowance(spender, addedValue, overrides) {
805
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
806
- if (overrides?.blockTag) {
807
- blockTagWithOverride =
808
- typeof overrides.blockTag == "string"
809
- ? overrides.blockTag
810
- : "0x" + overrides.blockTag.toString(16);
811
- }
812
419
  return this.view.encodeCall.increaseAllowance(spender, addedValue, {
813
420
  chainId: this.context.chainId.toString(),
814
421
  address: this.context.address,
815
- blockTag: blockTagWithOverride,
422
+ blockTag: this.context.getBlockTag(overrides),
816
423
  });
817
424
  },
818
425
  locker(overrides) {
819
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
820
- if (overrides?.blockTag) {
821
- blockTagWithOverride =
822
- typeof overrides.blockTag == "string"
823
- ? overrides.blockTag
824
- : "0x" + overrides.blockTag.toString(16);
825
- }
826
426
  return this.view.encodeCall.locker({
827
427
  chainId: this.context.chainId.toString(),
828
428
  address: this.context.address,
829
- blockTag: blockTagWithOverride,
429
+ blockTag: this.context.getBlockTag(overrides),
830
430
  });
831
431
  },
832
432
  name(overrides) {
833
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
834
- if (overrides?.blockTag) {
835
- blockTagWithOverride =
836
- typeof overrides.blockTag == "string"
837
- ? overrides.blockTag
838
- : "0x" + overrides.blockTag.toString(16);
839
- }
840
433
  return this.view.encodeCall.name({
841
434
  chainId: this.context.chainId.toString(),
842
435
  address: this.context.address,
843
- blockTag: blockTagWithOverride,
436
+ blockTag: this.context.getBlockTag(overrides),
844
437
  });
845
438
  },
846
439
  owner(overrides) {
847
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
848
- if (overrides?.blockTag) {
849
- blockTagWithOverride =
850
- typeof overrides.blockTag == "string"
851
- ? overrides.blockTag
852
- : "0x" + overrides.blockTag.toString(16);
853
- }
854
440
  return this.view.encodeCall.owner({
855
441
  chainId: this.context.chainId.toString(),
856
442
  address: this.context.address,
857
- blockTag: blockTagWithOverride,
443
+ blockTag: this.context.getBlockTag(overrides),
858
444
  });
859
445
  },
860
446
  renounceOwnership(overrides) {
861
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
862
- if (overrides?.blockTag) {
863
- blockTagWithOverride =
864
- typeof overrides.blockTag == "string"
865
- ? overrides.blockTag
866
- : "0x" + overrides.blockTag.toString(16);
867
- }
868
447
  return this.view.encodeCall.renounceOwnership({
869
448
  chainId: this.context.chainId.toString(),
870
449
  address: this.context.address,
871
- blockTag: blockTagWithOverride,
450
+ blockTag: this.context.getBlockTag(overrides),
872
451
  });
873
452
  },
874
453
  setLocker(_locker, overrides) {
875
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
876
- if (overrides?.blockTag) {
877
- blockTagWithOverride =
878
- typeof overrides.blockTag == "string"
879
- ? overrides.blockTag
880
- : "0x" + overrides.blockTag.toString(16);
881
- }
882
454
  return this.view.encodeCall.setLocker(_locker, {
883
455
  chainId: this.context.chainId.toString(),
884
456
  address: this.context.address,
885
- blockTag: blockTagWithOverride,
457
+ blockTag: this.context.getBlockTag(overrides),
886
458
  });
887
459
  },
888
460
  symbol(overrides) {
889
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
890
- if (overrides?.blockTag) {
891
- blockTagWithOverride =
892
- typeof overrides.blockTag == "string"
893
- ? overrides.blockTag
894
- : "0x" + overrides.blockTag.toString(16);
895
- }
896
461
  return this.view.encodeCall.symbol({
897
462
  chainId: this.context.chainId.toString(),
898
463
  address: this.context.address,
899
- blockTag: blockTagWithOverride,
464
+ blockTag: this.context.getBlockTag(overrides),
900
465
  });
901
466
  },
902
467
  totalSupply(overrides) {
903
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
904
- if (overrides?.blockTag) {
905
- blockTagWithOverride =
906
- typeof overrides.blockTag == "string"
907
- ? overrides.blockTag
908
- : "0x" + overrides.blockTag.toString(16);
909
- }
910
468
  return this.view.encodeCall.totalSupply({
911
469
  chainId: this.context.chainId.toString(),
912
470
  address: this.context.address,
913
- blockTag: blockTagWithOverride,
471
+ blockTag: this.context.getBlockTag(overrides),
914
472
  });
915
473
  },
916
474
  transfer(recipient, amount, overrides) {
917
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
918
- if (overrides?.blockTag) {
919
- blockTagWithOverride =
920
- typeof overrides.blockTag == "string"
921
- ? overrides.blockTag
922
- : "0x" + overrides.blockTag.toString(16);
923
- }
924
475
  return this.view.encodeCall.transfer(recipient, amount, {
925
476
  chainId: this.context.chainId.toString(),
926
477
  address: this.context.address,
927
- blockTag: blockTagWithOverride,
478
+ blockTag: this.context.getBlockTag(overrides),
928
479
  });
929
480
  },
930
481
  transferFrom(sender, recipient, amount, overrides) {
931
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
932
- if (overrides?.blockTag) {
933
- blockTagWithOverride =
934
- typeof overrides.blockTag == "string"
935
- ? overrides.blockTag
936
- : "0x" + overrides.blockTag.toString(16);
937
- }
938
482
  return this.view.encodeCall.transferFrom(sender, recipient, amount, {
939
483
  chainId: this.context.chainId.toString(),
940
484
  address: this.context.address,
941
- blockTag: blockTagWithOverride,
485
+ blockTag: this.context.getBlockTag(overrides),
942
486
  });
943
487
  },
944
488
  transferOwnership(newOwner, overrides) {
945
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
946
- if (overrides?.blockTag) {
947
- blockTagWithOverride =
948
- typeof overrides.blockTag == "string"
949
- ? overrides.blockTag
950
- : "0x" + overrides.blockTag.toString(16);
951
- }
952
489
  return this.view.encodeCall.transferOwnership(newOwner, {
953
490
  chainId: this.context.chainId.toString(),
954
491
  address: this.context.address,
955
- blockTag: blockTagWithOverride,
492
+ blockTag: this.context.getBlockTag(overrides),
956
493
  });
957
494
  },
958
495
  };