@sentio/sdk 2.40.0-rc.5 → 2.40.0-rc.6

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 (79) hide show
  1. package/lib/aptos/builtin/0x1.js +10 -10
  2. package/lib/aptos/builtin/0x3.js +11 -11
  3. package/lib/aptos/builtin/index.js +11 -11
  4. package/lib/aptos/codegen/index.js +3 -3
  5. package/lib/aptos/ext/index.js +10 -10
  6. package/lib/aptos/index.js +10 -10
  7. package/lib/chunk-2QEQTKQY.js +1050 -0
  8. package/lib/{chunk-Z7QWETBQ.js → chunk-3LE323R2.js} +2 -2
  9. package/lib/{chunk-QHHXY7LO.js → chunk-5XM56ENY.js} +5 -5
  10. package/lib/{chunk-RX5G4RN2.js → chunk-7NFMED3E.js} +2 -2
  11. package/lib/{chunk-KA5CLZU6.js → chunk-7NWX3CH7.js} +90 -53
  12. package/lib/{chunk-F2IZC2B6.js → chunk-EMF4HXFG.js} +5 -5
  13. package/lib/{chunk-VP6Y633M.js → chunk-GOWJIAB2.js} +2 -2
  14. package/lib/chunk-K5OSTLHI.js +916 -0
  15. package/lib/{chunk-WLLDVQFE.js → chunk-KO4GSZCM.js} +3 -3
  16. package/lib/chunk-KTAUVRJN.js +1910 -0
  17. package/lib/{chunk-2QVJGMW4.js → chunk-KVB555XD.js} +2 -2
  18. package/lib/{chunk-TDPQO2SX.js → chunk-LICAL3XW.js} +2 -2
  19. package/lib/{chunk-NBZRHB5V.js → chunk-O6QXDRGG.js} +5 -5
  20. package/lib/{chunk-6DDG76PU.js → chunk-P6T5WFAZ.js} +4 -4
  21. package/lib/chunk-QKJ5SWA2.js +861 -0
  22. package/lib/{chunk-VJTNBZMU.js → chunk-QTWMU7GQ.js} +1 -1
  23. package/lib/{chunk-OAIP7J4S.js → chunk-RXO7SOTL.js} +2757 -1157
  24. package/lib/{chunk-S727P6WP.js → chunk-SYEQKTIU.js} +1 -1
  25. package/lib/{chunk-7OBRGY7G.js → chunk-YNJXNOVA.js} +2 -2
  26. package/lib/{chunk-N4OQDWM2.js → chunk-YOLIZKGZ.js} +1 -1
  27. package/lib/{chunk-USETTWR7.js → chunk-Z5PQR6UE.js} +100 -54
  28. package/lib/core/index.js +3 -3
  29. package/lib/{eacaggregatorproxy-aed46d4a.d.ts → eacaggregatorproxy-cb8e39be.d.ts} +76 -24
  30. package/lib/{erc1155-80a76eb5.d.ts → erc1155-fb097c50.d.ts} +31 -9
  31. package/lib/{erc20-39aae019.d.ts → erc20-95ba7721.d.ts} +61 -19
  32. package/lib/{erc721-0a429bd4.d.ts → erc721-13bf7a61.d.ts} +49 -15
  33. package/lib/eth/builtin/eacaggregatorproxy.d.ts +1 -1
  34. package/lib/eth/builtin/eacaggregatorproxy.js +5 -5
  35. package/lib/eth/builtin/erc1155.d.ts +1 -1
  36. package/lib/eth/builtin/erc1155.js +5 -5
  37. package/lib/eth/builtin/erc20.d.ts +1 -1
  38. package/lib/eth/builtin/erc20.js +4 -4
  39. package/lib/eth/builtin/erc721.d.ts +1 -1
  40. package/lib/eth/builtin/erc721.js +4 -4
  41. package/lib/eth/builtin/index.d.ts +39 -15
  42. package/lib/eth/builtin/index.js +8 -8
  43. package/lib/eth/builtin/weth9.d.ts +1 -1
  44. package/lib/eth/builtin/weth9.js +5 -5
  45. package/lib/eth/codegen/index.js +130 -39
  46. package/lib/eth/index.d.ts +1 -0
  47. package/lib/eth/index.js +7 -4
  48. package/lib/fuel/index.js +4 -4
  49. package/lib/index.js +5 -3
  50. package/lib/move/index.js +4 -4
  51. package/lib/solana/builtin/index.js +4 -4
  52. package/lib/solana/index.js +4 -4
  53. package/lib/store/index.js +3 -3
  54. package/lib/sui/builtin/0x1.js +12 -12
  55. package/lib/sui/builtin/0x2.js +13 -13
  56. package/lib/sui/builtin/0x3.js +14 -14
  57. package/lib/sui/builtin/index.js +14 -14
  58. package/lib/sui/codegen/index.js +2 -2
  59. package/lib/sui/ext/index.js +10 -10
  60. package/lib/sui/index.js +11 -11
  61. package/lib/testing/index.js +14 -14
  62. package/lib/utils/index.js +7 -7
  63. package/lib/{weth9-08664cb7.d.ts → weth9-2b52cb06.d.ts} +40 -12
  64. package/package.json +1 -1
  65. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +1446 -115
  66. package/src/eth/builtin/internal/erc1155-processor.ts +611 -34
  67. package/src/eth/builtin/internal/erc20-processor.ts +1182 -84
  68. package/src/eth/builtin/internal/erc20bytes-processor.ts +595 -45
  69. package/src/eth/builtin/internal/erc721-processor.ts +967 -64
  70. package/src/eth/builtin/internal/weth9-processor.ts +698 -55
  71. package/src/eth/codegen/file.ts +26 -3
  72. package/src/eth/codegen/function-calls.ts +93 -8
  73. package/src/eth/codegen/types.ts +22 -1
  74. package/src/eth/eth-plugin.ts +4 -4
  75. package/src/eth/index.ts +2 -0
  76. package/lib/chunk-76HTCT5F.js +0 -469
  77. package/lib/chunk-ERTIHPSD.js +0 -528
  78. package/lib/chunk-LWKILLQ6.js +0 -820
  79. package/lib/chunk-S36AAZOU.js +0 -417
@@ -20,7 +20,7 @@ import {
20
20
  TemplateInstanceState,
21
21
  normalizeLabels,
22
22
  require_lib2 as require_lib
23
- } from "./chunk-KA5CLZU6.js";
23
+ } from "./chunk-7NWX3CH7.js";
24
24
  import {
25
25
  Endpoints,
26
26
  GLOBAL_CONFIG,
@@ -30,8 +30,9 @@ import {
30
30
  PluginManager,
31
31
  USER_PROCESSOR,
32
32
  errorString,
33
+ makeEthCallKey,
33
34
  mergeProcessResults
34
- } from "./chunk-USETTWR7.js";
35
+ } from "./chunk-Z5PQR6UE.js";
35
36
  import {
36
37
  __esm,
37
38
  __export,
@@ -1719,192 +1720,6 @@ __export(erc721_exports, {
1719
1720
  mockTransferLog: () => mockTransferLog2
1720
1721
  });
1721
1722
 
1722
- // src/eth/context.ts
1723
- var EthContext = class extends BaseContext {
1724
- chainId;
1725
- address;
1726
- log;
1727
- block;
1728
- trace;
1729
- blockNumber;
1730
- transactionHash;
1731
- transaction;
1732
- transactionReceipt;
1733
- timestamp;
1734
- preparedData;
1735
- constructor(chainId, address, timestamp, block, log, trace2, transaction, transactionReceipt, baseLabels, preparedData) {
1736
- super(baseLabels);
1737
- this.chainId = chainId;
1738
- this.log = log;
1739
- this.block = block;
1740
- this.trace = trace2;
1741
- this.address = address.toLowerCase();
1742
- this.transaction = transaction;
1743
- this.transactionReceipt = transactionReceipt;
1744
- this.timestamp = timestamp || /* @__PURE__ */ new Date(0);
1745
- this.preparedData = preparedData;
1746
- if (log) {
1747
- this.blockNumber = log.blockNumber;
1748
- this.transactionHash = log.transactionHash;
1749
- } else if (block) {
1750
- this.blockNumber = block.number;
1751
- } else if (trace2) {
1752
- this.blockNumber = trace2.blockNumber;
1753
- this.transactionHash = trace2.transactionHash;
1754
- }
1755
- }
1756
- getChainId() {
1757
- return this.chainId;
1758
- }
1759
- getMetaDataInternal(name, labels) {
1760
- if (this.log) {
1761
- return {
1762
- address: this.address,
1763
- contractName: this.getContractName(),
1764
- blockNumber: BigInt(this.blockNumber),
1765
- transactionIndex: this.log.transactionIndex,
1766
- transactionHash: this.transactionHash || "",
1767
- logIndex: this.log.index,
1768
- chainId: this.chainId,
1769
- name,
1770
- labels: normalizeLabels(labels)
1771
- };
1772
- }
1773
- if (this.trace) {
1774
- return {
1775
- address: this.address,
1776
- contractName: this.getContractName(),
1777
- blockNumber: BigInt(this.blockNumber),
1778
- transactionIndex: this.trace.transactionPosition,
1779
- transactionHash: this.transactionHash || "",
1780
- logIndex: -1,
1781
- chainId: this.chainId.toString(),
1782
- name,
1783
- labels: normalizeLabels(labels)
1784
- };
1785
- }
1786
- if (this.transaction) {
1787
- return {
1788
- address: this.address,
1789
- contractName: this.getContractName(),
1790
- blockNumber: BigInt(this.blockNumber),
1791
- transactionIndex: this.transaction.index || 0,
1792
- transactionHash: this.transaction.hash || "",
1793
- logIndex: -1,
1794
- chainId: this.chainId.toString(),
1795
- name,
1796
- labels: normalizeLabels(labels)
1797
- };
1798
- }
1799
- if (this.block) {
1800
- return {
1801
- address: this.address,
1802
- contractName: this.getContractName(),
1803
- blockNumber: BigInt(this.blockNumber),
1804
- transactionIndex: -1,
1805
- transactionHash: "",
1806
- logIndex: -1,
1807
- chainId: this.chainId.toString(),
1808
- name,
1809
- labels: normalizeLabels(labels)
1810
- };
1811
- }
1812
- throw new Error("Invaid ctx argument can't happen");
1813
- }
1814
- };
1815
- var AccountContext = class extends EthContext {
1816
- // constructor(chainId: number, address: string, block?: Block, log?: Log, trace?: Trace) {
1817
- // super(chainId, address, new Date(0), block, log, trace)
1818
- // }
1819
- getContractName() {
1820
- return "account";
1821
- }
1822
- };
1823
- var GlobalContext = class extends EthContext {
1824
- constructor(chainId, address, timestamp, block, log, trace2, transaction, transactionReceipt, baseLabels, preparedData) {
1825
- super(chainId, address, timestamp, block, log, trace2, transaction, transactionReceipt, baseLabels, preparedData);
1826
- }
1827
- getContractName() {
1828
- return "*";
1829
- }
1830
- getMetaDataInternal(name, labels) {
1831
- const address = this.address;
1832
- this.address = "*";
1833
- const res = super.getMetaDataInternal(name, labels);
1834
- this.address = address;
1835
- return res;
1836
- }
1837
- };
1838
- var ContractContext = class extends EthContext {
1839
- contract;
1840
- contractName;
1841
- constructor(contractName, view, chainId, timestamp, block, log, trace2, transaction, transactionReceipt, baseLabels, preparedData) {
1842
- super(
1843
- chainId,
1844
- view.address,
1845
- timestamp,
1846
- block,
1847
- log,
1848
- trace2,
1849
- transaction,
1850
- transactionReceipt,
1851
- baseLabels,
1852
- preparedData
1853
- );
1854
- view.context = this;
1855
- if (view.callStatic) {
1856
- view.callStatic.context = this;
1857
- }
1858
- this.contractName = contractName;
1859
- this.contract = view;
1860
- }
1861
- getContractName() {
1862
- return this.contractName;
1863
- }
1864
- };
1865
- var ContractView = class {
1866
- contract;
1867
- constructor(contract) {
1868
- this.contract = contract;
1869
- }
1870
- get rawContract() {
1871
- return this.contract;
1872
- }
1873
- get provider() {
1874
- if (this.contract.runner?.provider) {
1875
- return this.contract.runner.provider;
1876
- }
1877
- throw Error("Can't find provider for contract" + this.contract.toString());
1878
- }
1879
- };
1880
- var BoundContractView = class {
1881
- view;
1882
- address;
1883
- // context will be set right after context creation (in context's constructor)
1884
- // context: ContractContext<TContract, BoundContractView<TContract, TContractView>>
1885
- context;
1886
- callStatic;
1887
- constructor(address, view) {
1888
- this.address = address;
1889
- this.view = view;
1890
- }
1891
- get rawContract() {
1892
- return this.view.rawContract;
1893
- }
1894
- get provider() {
1895
- return this.view.provider;
1896
- }
1897
- get filters() {
1898
- return this.view.rawContract.filters;
1899
- }
1900
- };
1901
-
1902
- // src/eth/base-processor.ts
1903
- var import_nice_grpc = __toESM(require_lib(), 1);
1904
-
1905
- // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/crypto/crypto.js
1906
- import { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto";
1907
-
1908
1723
  // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/_version.js
1909
1724
  var version = "6.13.1";
1910
1725
 
@@ -3563,49 +3378,456 @@ function encodeRlp(object2) {
3563
3378
  return result;
3564
3379
  }
3565
3380
 
3566
- // ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/_assert.js
3567
- function number(n2) {
3568
- if (!Number.isSafeInteger(n2) || n2 < 0)
3569
- throw new Error(`Wrong positive integer: ${n2}`);
3570
- }
3571
- function bytes(b2, ...lengths) {
3572
- if (!(b2 instanceof Uint8Array))
3573
- throw new Error("Expected Uint8Array");
3574
- if (lengths.length > 0 && !lengths.includes(b2.length))
3575
- throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b2.length}`);
3381
+ // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/abstract-coder.js
3382
+ var WordSize = 32;
3383
+ var Padding = new Uint8Array(WordSize);
3384
+ var passProperties = ["then"];
3385
+ var _guard = {};
3386
+ var resultNames = /* @__PURE__ */ new WeakMap();
3387
+ function getNames(result) {
3388
+ return resultNames.get(result);
3576
3389
  }
3577
- function hash(hash2) {
3578
- if (typeof hash2 !== "function" || typeof hash2.create !== "function")
3579
- throw new Error("Hash should be wrapped by utils.wrapConstructor");
3580
- number(hash2.outputLen);
3581
- number(hash2.blockLen);
3390
+ function setNames(result, names) {
3391
+ resultNames.set(result, names);
3582
3392
  }
3583
- function exists(instance, checkFinished = true) {
3584
- if (instance.destroyed)
3585
- throw new Error("Hash instance has been destroyed");
3586
- if (checkFinished && instance.finished)
3587
- throw new Error("Hash#digest() has already been called");
3393
+ function throwError(name, error) {
3394
+ const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`);
3395
+ wrapped.error = error;
3396
+ throw wrapped;
3588
3397
  }
3589
- function output(out, instance) {
3590
- bytes(out);
3591
- const min = instance.outputLen;
3592
- if (out.length < min) {
3593
- throw new Error(`digestInto() expects output buffer of length at least ${min}`);
3398
+ function toObject(names, items, deep) {
3399
+ if (names.indexOf(null) >= 0) {
3400
+ return items.map((item, index) => {
3401
+ if (item instanceof Result) {
3402
+ return toObject(getNames(item), item, deep);
3403
+ }
3404
+ return item;
3405
+ });
3594
3406
  }
3407
+ return names.reduce((accum, name, index) => {
3408
+ let item = items.getValue(name);
3409
+ if (!(name in accum)) {
3410
+ if (deep && item instanceof Result) {
3411
+ item = toObject(getNames(item), item, deep);
3412
+ }
3413
+ accum[name] = item;
3414
+ }
3415
+ return accum;
3416
+ }, {});
3595
3417
  }
3596
-
3597
- // ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/_u64.js
3598
- var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
3599
- var _32n = /* @__PURE__ */ BigInt(32);
3600
- function fromBig(n2, le = false) {
3601
- if (le)
3602
- return { h: Number(n2 & U32_MASK64), l: Number(n2 >> _32n & U32_MASK64) };
3603
- return { h: Number(n2 >> _32n & U32_MASK64) | 0, l: Number(n2 & U32_MASK64) | 0 };
3604
- }
3605
- function split(lst, le = false) {
3606
- let Ah = new Uint32Array(lst.length);
3607
- let Al = new Uint32Array(lst.length);
3608
- for (let i = 0; i < lst.length; i++) {
3418
+ var Result = class extends Array {
3419
+ // No longer used; but cannot be removed as it will remove the
3420
+ // #private field from the .d.ts which may break backwards
3421
+ // compatibility
3422
+ #names;
3423
+ /**
3424
+ * @private
3425
+ */
3426
+ constructor(...args) {
3427
+ const guard = args[0];
3428
+ let items = args[1];
3429
+ let names = (args[2] || []).slice();
3430
+ let wrap = true;
3431
+ if (guard !== _guard) {
3432
+ items = args;
3433
+ names = [];
3434
+ wrap = false;
3435
+ }
3436
+ super(items.length);
3437
+ items.forEach((item, index) => {
3438
+ this[index] = item;
3439
+ });
3440
+ const nameCounts = names.reduce((accum, name) => {
3441
+ if (typeof name === "string") {
3442
+ accum.set(name, (accum.get(name) || 0) + 1);
3443
+ }
3444
+ return accum;
3445
+ }, /* @__PURE__ */ new Map());
3446
+ setNames(this, Object.freeze(items.map((item, index) => {
3447
+ const name = names[index];
3448
+ if (name != null && nameCounts.get(name) === 1) {
3449
+ return name;
3450
+ }
3451
+ return null;
3452
+ })));
3453
+ this.#names = [];
3454
+ if (this.#names == null) {
3455
+ void this.#names;
3456
+ }
3457
+ if (!wrap) {
3458
+ return;
3459
+ }
3460
+ Object.freeze(this);
3461
+ const proxy = new Proxy(this, {
3462
+ get: (target, prop, receiver) => {
3463
+ if (typeof prop === "string") {
3464
+ if (prop.match(/^[0-9]+$/)) {
3465
+ const index = getNumber(prop, "%index");
3466
+ if (index < 0 || index >= this.length) {
3467
+ throw new RangeError("out of result range");
3468
+ }
3469
+ const item = target[index];
3470
+ if (item instanceof Error) {
3471
+ throwError(`index ${index}`, item);
3472
+ }
3473
+ return item;
3474
+ }
3475
+ if (passProperties.indexOf(prop) >= 0) {
3476
+ return Reflect.get(target, prop, receiver);
3477
+ }
3478
+ const value = target[prop];
3479
+ if (value instanceof Function) {
3480
+ return function(...args2) {
3481
+ return value.apply(this === receiver ? target : this, args2);
3482
+ };
3483
+ } else if (!(prop in target)) {
3484
+ return target.getValue.apply(this === receiver ? target : this, [prop]);
3485
+ }
3486
+ }
3487
+ return Reflect.get(target, prop, receiver);
3488
+ }
3489
+ });
3490
+ setNames(proxy, getNames(this));
3491
+ return proxy;
3492
+ }
3493
+ /**
3494
+ * Returns the Result as a normal Array. If %%deep%%, any children
3495
+ * which are Result objects are also converted to a normal Array.
3496
+ *
3497
+ * This will throw if there are any outstanding deferred
3498
+ * errors.
3499
+ */
3500
+ toArray(deep) {
3501
+ const result = [];
3502
+ this.forEach((item, index) => {
3503
+ if (item instanceof Error) {
3504
+ throwError(`index ${index}`, item);
3505
+ }
3506
+ if (deep && item instanceof Result) {
3507
+ item = item.toArray(deep);
3508
+ }
3509
+ result.push(item);
3510
+ });
3511
+ return result;
3512
+ }
3513
+ /**
3514
+ * Returns the Result as an Object with each name-value pair. If
3515
+ * %%deep%%, any children which are Result objects are also
3516
+ * converted to an Object.
3517
+ *
3518
+ * This will throw if any value is unnamed, or if there are
3519
+ * any outstanding deferred errors.
3520
+ */
3521
+ toObject(deep) {
3522
+ const names = getNames(this);
3523
+ return names.reduce((accum, name, index) => {
3524
+ assert(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", {
3525
+ operation: "toObject()"
3526
+ });
3527
+ return toObject(names, this, deep);
3528
+ }, {});
3529
+ }
3530
+ /**
3531
+ * @_ignore
3532
+ */
3533
+ slice(start, end) {
3534
+ if (start == null) {
3535
+ start = 0;
3536
+ }
3537
+ if (start < 0) {
3538
+ start += this.length;
3539
+ if (start < 0) {
3540
+ start = 0;
3541
+ }
3542
+ }
3543
+ if (end == null) {
3544
+ end = this.length;
3545
+ }
3546
+ if (end < 0) {
3547
+ end += this.length;
3548
+ if (end < 0) {
3549
+ end = 0;
3550
+ }
3551
+ }
3552
+ if (end > this.length) {
3553
+ end = this.length;
3554
+ }
3555
+ const _names = getNames(this);
3556
+ const result = [], names = [];
3557
+ for (let i = start; i < end; i++) {
3558
+ result.push(this[i]);
3559
+ names.push(_names[i]);
3560
+ }
3561
+ return new Result(_guard, result, names);
3562
+ }
3563
+ /**
3564
+ * @_ignore
3565
+ */
3566
+ filter(callback, thisArg) {
3567
+ const _names = getNames(this);
3568
+ const result = [], names = [];
3569
+ for (let i = 0; i < this.length; i++) {
3570
+ const item = this[i];
3571
+ if (item instanceof Error) {
3572
+ throwError(`index ${i}`, item);
3573
+ }
3574
+ if (callback.call(thisArg, item, i, this)) {
3575
+ result.push(item);
3576
+ names.push(_names[i]);
3577
+ }
3578
+ }
3579
+ return new Result(_guard, result, names);
3580
+ }
3581
+ /**
3582
+ * @_ignore
3583
+ */
3584
+ map(callback, thisArg) {
3585
+ const result = [];
3586
+ for (let i = 0; i < this.length; i++) {
3587
+ const item = this[i];
3588
+ if (item instanceof Error) {
3589
+ throwError(`index ${i}`, item);
3590
+ }
3591
+ result.push(callback.call(thisArg, item, i, this));
3592
+ }
3593
+ return result;
3594
+ }
3595
+ /**
3596
+ * Returns the value for %%name%%.
3597
+ *
3598
+ * Since it is possible to have a key whose name conflicts with
3599
+ * a method on a [[Result]] or its superclass Array, or any
3600
+ * JavaScript keyword, this ensures all named values are still
3601
+ * accessible by name.
3602
+ */
3603
+ getValue(name) {
3604
+ const index = getNames(this).indexOf(name);
3605
+ if (index === -1) {
3606
+ return void 0;
3607
+ }
3608
+ const value = this[index];
3609
+ if (value instanceof Error) {
3610
+ throwError(`property ${JSON.stringify(name)}`, value.error);
3611
+ }
3612
+ return value;
3613
+ }
3614
+ /**
3615
+ * Creates a new [[Result]] for %%items%% with each entry
3616
+ * also accessible by its corresponding name in %%keys%%.
3617
+ */
3618
+ static fromItems(items, keys) {
3619
+ return new Result(_guard, items, keys);
3620
+ }
3621
+ };
3622
+ function getValue(value) {
3623
+ let bytes2 = toBeArray(value);
3624
+ assert(bytes2.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes2, length: WordSize, offset: bytes2.length });
3625
+ if (bytes2.length !== WordSize) {
3626
+ bytes2 = getBytesCopy(concat([Padding.slice(bytes2.length % WordSize), bytes2]));
3627
+ }
3628
+ return bytes2;
3629
+ }
3630
+ var Coder = class {
3631
+ // The coder name:
3632
+ // - address, uint256, tuple, array, etc.
3633
+ name;
3634
+ // The fully expanded type, including composite types:
3635
+ // - address, uint256, tuple(address,bytes), uint256[3][4][], etc.
3636
+ type;
3637
+ // The localName bound in the signature, in this example it is "baz":
3638
+ // - tuple(address foo, uint bar) baz
3639
+ localName;
3640
+ // Whether this type is dynamic:
3641
+ // - Dynamic: bytes, string, address[], tuple(boolean[]), etc.
3642
+ // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)
3643
+ dynamic;
3644
+ constructor(name, type, localName, dynamic) {
3645
+ defineProperties(this, { name, type, localName, dynamic }, {
3646
+ name: "string",
3647
+ type: "string",
3648
+ localName: "string",
3649
+ dynamic: "boolean"
3650
+ });
3651
+ }
3652
+ _throwError(message, value) {
3653
+ assertArgument(false, message, this.localName, value);
3654
+ }
3655
+ };
3656
+ var Writer = class {
3657
+ // An array of WordSize lengthed objects to concatenation
3658
+ #data;
3659
+ #dataLength;
3660
+ constructor() {
3661
+ this.#data = [];
3662
+ this.#dataLength = 0;
3663
+ }
3664
+ get data() {
3665
+ return concat(this.#data);
3666
+ }
3667
+ get length() {
3668
+ return this.#dataLength;
3669
+ }
3670
+ #writeData(data) {
3671
+ this.#data.push(data);
3672
+ this.#dataLength += data.length;
3673
+ return data.length;
3674
+ }
3675
+ appendWriter(writer) {
3676
+ return this.#writeData(getBytesCopy(writer.data));
3677
+ }
3678
+ // Arrayish item; pad on the right to *nearest* WordSize
3679
+ writeBytes(value) {
3680
+ let bytes2 = getBytesCopy(value);
3681
+ const paddingOffset = bytes2.length % WordSize;
3682
+ if (paddingOffset) {
3683
+ bytes2 = getBytesCopy(concat([bytes2, Padding.slice(paddingOffset)]));
3684
+ }
3685
+ return this.#writeData(bytes2);
3686
+ }
3687
+ // Numeric item; pad on the left *to* WordSize
3688
+ writeValue(value) {
3689
+ return this.#writeData(getValue(value));
3690
+ }
3691
+ // Inserts a numeric place-holder, returning a callback that can
3692
+ // be used to asjust the value later
3693
+ writeUpdatableValue() {
3694
+ const offset = this.#data.length;
3695
+ this.#data.push(Padding);
3696
+ this.#dataLength += WordSize;
3697
+ return (value) => {
3698
+ this.#data[offset] = getValue(value);
3699
+ };
3700
+ }
3701
+ };
3702
+ var Reader = class {
3703
+ // Allows incomplete unpadded data to be read; otherwise an error
3704
+ // is raised if attempting to overrun the buffer. This is required
3705
+ // to deal with an old Solidity bug, in which event data for
3706
+ // external (not public thoguh) was tightly packed.
3707
+ allowLoose;
3708
+ #data;
3709
+ #offset;
3710
+ #bytesRead;
3711
+ #parent;
3712
+ #maxInflation;
3713
+ constructor(data, allowLoose, maxInflation) {
3714
+ defineProperties(this, { allowLoose: !!allowLoose });
3715
+ this.#data = getBytesCopy(data);
3716
+ this.#bytesRead = 0;
3717
+ this.#parent = null;
3718
+ this.#maxInflation = maxInflation != null ? maxInflation : 1024;
3719
+ this.#offset = 0;
3720
+ }
3721
+ get data() {
3722
+ return hexlify(this.#data);
3723
+ }
3724
+ get dataLength() {
3725
+ return this.#data.length;
3726
+ }
3727
+ get consumed() {
3728
+ return this.#offset;
3729
+ }
3730
+ get bytes() {
3731
+ return new Uint8Array(this.#data);
3732
+ }
3733
+ #incrementBytesRead(count) {
3734
+ if (this.#parent) {
3735
+ return this.#parent.#incrementBytesRead(count);
3736
+ }
3737
+ this.#bytesRead += count;
3738
+ assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", {
3739
+ buffer: getBytesCopy(this.#data),
3740
+ offset: this.#offset,
3741
+ length: count,
3742
+ info: {
3743
+ bytesRead: this.#bytesRead,
3744
+ dataLength: this.dataLength
3745
+ }
3746
+ });
3747
+ }
3748
+ #peekBytes(offset, length, loose) {
3749
+ let alignedLength = Math.ceil(length / WordSize) * WordSize;
3750
+ if (this.#offset + alignedLength > this.#data.length) {
3751
+ if (this.allowLoose && loose && this.#offset + length <= this.#data.length) {
3752
+ alignedLength = length;
3753
+ } else {
3754
+ assert(false, "data out-of-bounds", "BUFFER_OVERRUN", {
3755
+ buffer: getBytesCopy(this.#data),
3756
+ length: this.#data.length,
3757
+ offset: this.#offset + alignedLength
3758
+ });
3759
+ }
3760
+ }
3761
+ return this.#data.slice(this.#offset, this.#offset + alignedLength);
3762
+ }
3763
+ // Create a sub-reader with the same underlying data, but offset
3764
+ subReader(offset) {
3765
+ const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation);
3766
+ reader.#parent = this;
3767
+ return reader;
3768
+ }
3769
+ // Read bytes
3770
+ readBytes(length, loose) {
3771
+ let bytes2 = this.#peekBytes(0, length, !!loose);
3772
+ this.#incrementBytesRead(length);
3773
+ this.#offset += bytes2.length;
3774
+ return bytes2.slice(0, length);
3775
+ }
3776
+ // Read a numeric values
3777
+ readValue() {
3778
+ return toBigInt(this.readBytes(WordSize));
3779
+ }
3780
+ readIndex() {
3781
+ return toNumber(this.readBytes(WordSize));
3782
+ }
3783
+ };
3784
+
3785
+ // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/crypto/crypto.js
3786
+ import { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto";
3787
+
3788
+ // ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/_assert.js
3789
+ function number(n2) {
3790
+ if (!Number.isSafeInteger(n2) || n2 < 0)
3791
+ throw new Error(`Wrong positive integer: ${n2}`);
3792
+ }
3793
+ function bytes(b2, ...lengths) {
3794
+ if (!(b2 instanceof Uint8Array))
3795
+ throw new Error("Expected Uint8Array");
3796
+ if (lengths.length > 0 && !lengths.includes(b2.length))
3797
+ throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b2.length}`);
3798
+ }
3799
+ function hash(hash2) {
3800
+ if (typeof hash2 !== "function" || typeof hash2.create !== "function")
3801
+ throw new Error("Hash should be wrapped by utils.wrapConstructor");
3802
+ number(hash2.outputLen);
3803
+ number(hash2.blockLen);
3804
+ }
3805
+ function exists(instance, checkFinished = true) {
3806
+ if (instance.destroyed)
3807
+ throw new Error("Hash instance has been destroyed");
3808
+ if (checkFinished && instance.finished)
3809
+ throw new Error("Hash#digest() has already been called");
3810
+ }
3811
+ function output(out, instance) {
3812
+ bytes(out);
3813
+ const min = instance.outputLen;
3814
+ if (out.length < min) {
3815
+ throw new Error(`digestInto() expects output buffer of length at least ${min}`);
3816
+ }
3817
+ }
3818
+
3819
+ // ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/_u64.js
3820
+ var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
3821
+ var _32n = /* @__PURE__ */ BigInt(32);
3822
+ function fromBig(n2, le = false) {
3823
+ if (le)
3824
+ return { h: Number(n2 & U32_MASK64), l: Number(n2 >> _32n & U32_MASK64) };
3825
+ return { h: Number(n2 >> _32n & U32_MASK64) | 0, l: Number(n2 & U32_MASK64) | 0 };
3826
+ }
3827
+ function split(lst, le = false) {
3828
+ let Ah = new Uint32Array(lst.length);
3829
+ let Al = new Uint32Array(lst.length);
3830
+ for (let i = 0; i < lst.length; i++) {
3609
3831
  const { h, l } = fromBig(lst[i], le);
3610
3832
  [Ah[i], Al[i]] = [h, l];
3611
3833
  }
@@ -5733,7 +5955,7 @@ var BN_2 = BigInt(2);
5733
5955
  var BN_27 = BigInt(27);
5734
5956
  var BN_28 = BigInt(28);
5735
5957
  var BN_35 = BigInt(35);
5736
- var _guard = {};
5958
+ var _guard2 = {};
5737
5959
  function toUint256(value) {
5738
5960
  return zeroPadValue(toBeArray(value), 32);
5739
5961
  }
@@ -5838,7 +6060,7 @@ var Signature = class {
5838
6060
  * @private
5839
6061
  */
5840
6062
  constructor(guard, r, s, v) {
5841
- assertPrivate(guard, _guard, "Signature");
6063
+ assertPrivate(guard, _guard2, "Signature");
5842
6064
  this.#r = r;
5843
6065
  this.#s = s;
5844
6066
  this.#v = v;
@@ -5851,7 +6073,7 @@ var Signature = class {
5851
6073
  * Returns a new identical [[Signature]].
5852
6074
  */
5853
6075
  clone() {
5854
- const clone = new Signature(_guard, this.r, this.s, this.v);
6076
+ const clone = new Signature(_guard2, this.r, this.s, this.v);
5855
6077
  if (this.networkV) {
5856
6078
  clone.#networkV = this.networkV;
5857
6079
  }
@@ -5903,813 +6125,409 @@ var Signature = class {
5903
6125
  *
5904
6126
  */
5905
6127
  static getChainIdV(chainId, v) {
5906
- return getBigInt(chainId) * BN_2 + BigInt(35 + v - 27);
5907
- }
5908
- /**
5909
- * Compute the normalized legacy transaction ``v`` from a ``yParirty``,
5910
- * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.
5911
- *
5912
- * @example:
5913
- * // The values 0 and 1 imply v is actually yParity
5914
- * Signature.getNormalizedV(0)
5915
- * //_result:
5916
- *
5917
- * // Legacy non-EIP-1559 transaction (i.e. 27 or 28)
5918
- * Signature.getNormalizedV(27)
5919
- * //_result:
5920
- *
5921
- * // Legacy EIP-155 transaction (i.e. >= 35)
5922
- * Signature.getNormalizedV(46)
5923
- * //_result:
5924
- *
5925
- * // Invalid values throw
5926
- * Signature.getNormalizedV(5)
5927
- * //_error:
5928
- */
5929
- static getNormalizedV(v) {
5930
- const bv = getBigInt(v);
5931
- if (bv === BN_03 || bv === BN_27) {
5932
- return 27;
5933
- }
5934
- if (bv === BN_12 || bv === BN_28) {
5935
- return 28;
5936
- }
5937
- assertArgument(bv >= BN_35, "invalid v", "v", v);
5938
- return bv & BN_12 ? 27 : 28;
5939
- }
5940
- /**
5941
- * Creates a new [[Signature]].
5942
- *
5943
- * If no %%sig%% is provided, a new [[Signature]] is created
5944
- * with default values.
5945
- *
5946
- * If %%sig%% is a string, it is parsed.
5947
- */
5948
- static from(sig) {
5949
- function assertError(check, message) {
5950
- assertArgument(check, message, "signature", sig);
5951
- }
5952
- ;
5953
- if (sig == null) {
5954
- return new Signature(_guard, ZeroHash, ZeroHash, 27);
5955
- }
5956
- if (typeof sig === "string") {
5957
- const bytes2 = getBytes(sig, "signature");
5958
- if (bytes2.length === 64) {
5959
- const r2 = hexlify(bytes2.slice(0, 32));
5960
- const s2 = bytes2.slice(32, 64);
5961
- const v2 = s2[0] & 128 ? 28 : 27;
5962
- s2[0] &= 127;
5963
- return new Signature(_guard, r2, hexlify(s2), v2);
5964
- }
5965
- if (bytes2.length === 65) {
5966
- const r2 = hexlify(bytes2.slice(0, 32));
5967
- const s2 = bytes2.slice(32, 64);
5968
- assertError((s2[0] & 128) === 0, "non-canonical s");
5969
- const v2 = Signature.getNormalizedV(bytes2[64]);
5970
- return new Signature(_guard, r2, hexlify(s2), v2);
5971
- }
5972
- assertError(false, "invalid raw signature length");
5973
- }
5974
- if (sig instanceof Signature) {
5975
- return sig.clone();
5976
- }
5977
- const _r = sig.r;
5978
- assertError(_r != null, "missing r");
5979
- const r = toUint256(_r);
5980
- const s = function(s2, yParityAndS) {
5981
- if (s2 != null) {
5982
- return toUint256(s2);
5983
- }
5984
- if (yParityAndS != null) {
5985
- assertError(isHexString(yParityAndS, 32), "invalid yParityAndS");
5986
- const bytes2 = getBytes(yParityAndS);
5987
- bytes2[0] &= 127;
5988
- return hexlify(bytes2);
5989
- }
5990
- assertError(false, "missing s");
5991
- }(sig.s, sig.yParityAndS);
5992
- assertError((getBytes(s)[0] & 128) == 0, "non-canonical s");
5993
- const { networkV, v } = function(_v, yParityAndS, yParity) {
5994
- if (_v != null) {
5995
- const v2 = getBigInt(_v);
5996
- return {
5997
- networkV: v2 >= BN_35 ? v2 : void 0,
5998
- v: Signature.getNormalizedV(v2)
5999
- };
6000
- }
6001
- if (yParityAndS != null) {
6002
- assertError(isHexString(yParityAndS, 32), "invalid yParityAndS");
6003
- return { v: getBytes(yParityAndS)[0] & 128 ? 28 : 27 };
6004
- }
6005
- if (yParity != null) {
6006
- switch (getNumber(yParity, "sig.yParity")) {
6007
- case 0:
6008
- return { v: 27 };
6009
- case 1:
6010
- return { v: 28 };
6011
- }
6012
- assertError(false, "invalid yParity");
6013
- }
6014
- assertError(false, "missing v");
6015
- }(sig.v, sig.yParityAndS, sig.yParity);
6016
- const result = new Signature(_guard, r, s, v);
6017
- if (networkV) {
6018
- result.#networkV = networkV;
6019
- }
6020
- assertError(sig.yParity == null || getNumber(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch");
6021
- assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, "yParityAndS mismatch");
6022
- return result;
6023
- }
6024
- };
6025
-
6026
- // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/crypto/signing-key.js
6027
- var SigningKey = class {
6028
- #privateKey;
6029
- /**
6030
- * Creates a new **SigningKey** for %%privateKey%%.
6031
- */
6032
- constructor(privateKey) {
6033
- assertArgument(dataLength(privateKey) === 32, "invalid private key", "privateKey", "[REDACTED]");
6034
- this.#privateKey = hexlify(privateKey);
6035
- }
6036
- /**
6037
- * The private key.
6038
- */
6039
- get privateKey() {
6040
- return this.#privateKey;
6041
- }
6042
- /**
6043
- * The uncompressed public key.
6044
- *
6045
- * This will always begin with the prefix ``0x04`` and be 132
6046
- * characters long (the ``0x`` prefix and 130 hexadecimal nibbles).
6047
- */
6048
- get publicKey() {
6049
- return SigningKey.computePublicKey(this.#privateKey);
6050
- }
6051
- /**
6052
- * The compressed public key.
6053
- *
6054
- * This will always begin with either the prefix ``0x02`` or ``0x03``
6055
- * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal
6056
- * nibbles)
6057
- */
6058
- get compressedPublicKey() {
6059
- return SigningKey.computePublicKey(this.#privateKey, true);
6060
- }
6061
- /**
6062
- * Return the signature of the signed %%digest%%.
6063
- */
6064
- sign(digest) {
6065
- assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest);
6066
- const sig = secp256k1.sign(getBytesCopy(digest), getBytesCopy(this.#privateKey), {
6067
- lowS: true
6068
- });
6069
- return Signature.from({
6070
- r: toBeHex(sig.r, 32),
6071
- s: toBeHex(sig.s, 32),
6072
- v: sig.recovery ? 28 : 27
6073
- });
6074
- }
6075
- /**
6076
- * Returns the [[link-wiki-ecdh]] shared secret between this
6077
- * private key and the %%other%% key.
6078
- *
6079
- * The %%other%% key may be any type of key, a raw public key,
6080
- * a compressed/uncompressed pubic key or aprivate key.
6081
- *
6082
- * Best practice is usually to use a cryptographic hash on the
6083
- * returned value before using it as a symetric secret.
6084
- *
6085
- * @example:
6086
- * sign1 = new SigningKey(id("some-secret-1"))
6087
- * sign2 = new SigningKey(id("some-secret-2"))
6088
- *
6089
- * // Notice that privA.computeSharedSecret(pubB)...
6090
- * sign1.computeSharedSecret(sign2.publicKey)
6091
- * //_result:
6092
- *
6093
- * // ...is equal to privB.computeSharedSecret(pubA).
6094
- * sign2.computeSharedSecret(sign1.publicKey)
6095
- * //_result:
6096
- */
6097
- computeSharedSecret(other) {
6098
- const pubKey = SigningKey.computePublicKey(other);
6099
- return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey), false));
6100
- }
6101
- /**
6102
- * Compute the public key for %%key%%, optionally %%compressed%%.
6103
- *
6104
- * The %%key%% may be any type of key, a raw public key, a
6105
- * compressed/uncompressed public key or private key.
6106
- *
6107
- * @example:
6108
- * sign = new SigningKey(id("some-secret"));
6109
- *
6110
- * // Compute the uncompressed public key for a private key
6111
- * SigningKey.computePublicKey(sign.privateKey)
6112
- * //_result:
6113
- *
6114
- * // Compute the compressed public key for a private key
6115
- * SigningKey.computePublicKey(sign.privateKey, true)
6116
- * //_result:
6117
- *
6118
- * // Compute the uncompressed public key
6119
- * SigningKey.computePublicKey(sign.publicKey, false);
6120
- * //_result:
6121
- *
6122
- * // Compute the Compressed a public key
6123
- * SigningKey.computePublicKey(sign.publicKey, true);
6124
- * //_result:
6125
- */
6126
- static computePublicKey(key, compressed) {
6127
- let bytes2 = getBytes(key, "key");
6128
- if (bytes2.length === 32) {
6129
- const pubKey = secp256k1.getPublicKey(bytes2, !!compressed);
6130
- return hexlify(pubKey);
6131
- }
6132
- if (bytes2.length === 64) {
6133
- const pub = new Uint8Array(65);
6134
- pub[0] = 4;
6135
- pub.set(bytes2, 1);
6136
- bytes2 = pub;
6137
- }
6138
- const point = secp256k1.ProjectivePoint.fromHex(bytes2);
6139
- return hexlify(point.toRawBytes(compressed));
6128
+ return getBigInt(chainId) * BN_2 + BigInt(35 + v - 27);
6140
6129
  }
6141
6130
  /**
6142
- * Returns the public key for the private key which produced the
6143
- * %%signature%% for the given %%digest%%.
6131
+ * Compute the normalized legacy transaction ``v`` from a ``yParirty``,
6132
+ * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.
6144
6133
  *
6145
6134
  * @example:
6146
- * key = new SigningKey(id("some-secret"))
6147
- * digest = id("hello world")
6148
- * sig = key.sign(digest)
6135
+ * // The values 0 and 1 imply v is actually yParity
6136
+ * Signature.getNormalizedV(0)
6137
+ * //_result:
6149
6138
  *
6150
- * // Notice the signer public key...
6151
- * key.publicKey
6139
+ * // Legacy non-EIP-1559 transaction (i.e. 27 or 28)
6140
+ * Signature.getNormalizedV(27)
6152
6141
  * //_result:
6153
6142
  *
6154
- * // ...is equal to the recovered public key
6155
- * SigningKey.recoverPublicKey(digest, sig)
6143
+ * // Legacy EIP-155 transaction (i.e. >= 35)
6144
+ * Signature.getNormalizedV(46)
6156
6145
  * //_result:
6157
6146
  *
6147
+ * // Invalid values throw
6148
+ * Signature.getNormalizedV(5)
6149
+ * //_error:
6158
6150
  */
6159
- static recoverPublicKey(digest, signature) {
6160
- assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest);
6161
- const sig = Signature.from(signature);
6162
- let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s])));
6163
- secpSig = secpSig.addRecoveryBit(sig.yParity);
6164
- const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest));
6165
- assertArgument(pubKey != null, "invalid signautre for digest", "signature", signature);
6166
- return "0x" + pubKey.toHex(false);
6151
+ static getNormalizedV(v) {
6152
+ const bv = getBigInt(v);
6153
+ if (bv === BN_03 || bv === BN_27) {
6154
+ return 27;
6155
+ }
6156
+ if (bv === BN_12 || bv === BN_28) {
6157
+ return 28;
6158
+ }
6159
+ assertArgument(bv >= BN_35, "invalid v", "v", v);
6160
+ return bv & BN_12 ? 27 : 28;
6167
6161
  }
6168
6162
  /**
6169
- * Returns the point resulting from adding the ellipic curve points
6170
- * %%p0%% and %%p1%%.
6163
+ * Creates a new [[Signature]].
6171
6164
  *
6172
- * This is not a common function most developers should require, but
6173
- * can be useful for certain privacy-specific techniques.
6165
+ * If no %%sig%% is provided, a new [[Signature]] is created
6166
+ * with default values.
6174
6167
  *
6175
- * For example, it is used by [[HDNodeWallet]] to compute child
6176
- * addresses from parent public keys and chain codes.
6168
+ * If %%sig%% is a string, it is parsed.
6177
6169
  */
6178
- static addPoints(p0, p1, compressed) {
6179
- const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2));
6180
- const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2));
6181
- return "0x" + pub0.add(pub1).toHex(!!compressed);
6182
- }
6183
- };
6184
-
6185
- // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/address/address.js
6186
- var BN_04 = BigInt(0);
6187
- var BN_36 = BigInt(36);
6188
- function getChecksumAddress(address) {
6189
- address = address.toLowerCase();
6190
- const chars = address.substring(2).split("");
6191
- const expanded = new Uint8Array(40);
6192
- for (let i = 0; i < 40; i++) {
6193
- expanded[i] = chars[i].charCodeAt(0);
6194
- }
6195
- const hashed = getBytes(keccak256(expanded));
6196
- for (let i = 0; i < 40; i += 2) {
6197
- if (hashed[i >> 1] >> 4 >= 8) {
6198
- chars[i] = chars[i].toUpperCase();
6199
- }
6200
- if ((hashed[i >> 1] & 15) >= 8) {
6201
- chars[i + 1] = chars[i + 1].toUpperCase();
6202
- }
6203
- }
6204
- return "0x" + chars.join("");
6205
- }
6206
- var ibanLookup = {};
6207
- for (let i = 0; i < 10; i++) {
6208
- ibanLookup[String(i)] = String(i);
6209
- }
6210
- for (let i = 0; i < 26; i++) {
6211
- ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);
6212
- }
6213
- var safeDigits = 15;
6214
- function ibanChecksum(address) {
6215
- address = address.toUpperCase();
6216
- address = address.substring(4) + address.substring(0, 2) + "00";
6217
- let expanded = address.split("").map((c) => {
6218
- return ibanLookup[c];
6219
- }).join("");
6220
- while (expanded.length >= safeDigits) {
6221
- let block = expanded.substring(0, safeDigits);
6222
- expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);
6223
- }
6224
- let checksum = String(98 - parseInt(expanded, 10) % 97);
6225
- while (checksum.length < 2) {
6226
- checksum = "0" + checksum;
6227
- }
6228
- return checksum;
6229
- }
6230
- var Base36 = function() {
6231
- ;
6232
- const result = {};
6233
- for (let i = 0; i < 36; i++) {
6234
- const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i];
6235
- result[key] = BigInt(i);
6236
- }
6237
- return result;
6238
- }();
6239
- function fromBase36(value) {
6240
- value = value.toLowerCase();
6241
- let result = BN_04;
6242
- for (let i = 0; i < value.length; i++) {
6243
- result = result * BN_36 + Base36[value[i]];
6244
- }
6245
- return result;
6246
- }
6247
- function getAddress(address) {
6248
- assertArgument(typeof address === "string", "invalid address", "address", address);
6249
- if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
6250
- if (!address.startsWith("0x")) {
6251
- address = "0x" + address;
6252
- }
6253
- const result = getChecksumAddress(address);
6254
- assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address);
6255
- return result;
6256
- }
6257
- if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
6258
- assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address);
6259
- let result = fromBase36(address.substring(4)).toString(16);
6260
- while (result.length < 40) {
6261
- result = "0" + result;
6262
- }
6263
- return getChecksumAddress("0x" + result);
6264
- }
6265
- assertArgument(false, "invalid address", "address", address);
6266
- }
6267
-
6268
- // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/address/contract-address.js
6269
- function getCreateAddress(tx) {
6270
- const from = getAddress(tx.from);
6271
- const nonce = getBigInt(tx.nonce, "tx.nonce");
6272
- let nonceHex = nonce.toString(16);
6273
- if (nonceHex === "0") {
6274
- nonceHex = "0x";
6275
- } else if (nonceHex.length % 2) {
6276
- nonceHex = "0x0" + nonceHex;
6277
- } else {
6278
- nonceHex = "0x" + nonceHex;
6279
- }
6280
- return getAddress(dataSlice(keccak256(encodeRlp([from, nonceHex])), 12));
6281
- }
6282
-
6283
- // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/address/checks.js
6284
- function isAddressable(value) {
6285
- return value && typeof value.getAddress === "function";
6286
- }
6287
- async function checkAddress(target, promise) {
6288
- const result = await promise;
6289
- if (result == null || result === "0x0000000000000000000000000000000000000000") {
6290
- assert(typeof target !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target });
6291
- assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target);
6292
- }
6293
- return getAddress(result);
6294
- }
6295
- function resolveAddress(target, resolver) {
6296
- if (typeof target === "string") {
6297
- if (target.match(/^0x[0-9a-f]{40}$/i)) {
6298
- return getAddress(target);
6299
- }
6300
- assert(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" });
6301
- return checkAddress(target, resolver.resolveName(target));
6302
- } else if (isAddressable(target)) {
6303
- return checkAddress(target, target.getAddress());
6304
- } else if (target && typeof target.then === "function") {
6305
- return checkAddress(target, target);
6306
- }
6307
- assertArgument(false, "unsupported addressable value", "target", target);
6308
- }
6309
-
6310
- // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/abstract-coder.js
6311
- var WordSize = 32;
6312
- var Padding = new Uint8Array(WordSize);
6313
- var passProperties = ["then"];
6314
- var _guard2 = {};
6315
- var resultNames = /* @__PURE__ */ new WeakMap();
6316
- function getNames(result) {
6317
- return resultNames.get(result);
6318
- }
6319
- function setNames(result, names) {
6320
- resultNames.set(result, names);
6321
- }
6322
- function throwError(name, error) {
6323
- const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`);
6324
- wrapped.error = error;
6325
- throw wrapped;
6326
- }
6327
- function toObject(names, items, deep) {
6328
- if (names.indexOf(null) >= 0) {
6329
- return items.map((item, index) => {
6330
- if (item instanceof Result) {
6331
- return toObject(getNames(item), item, deep);
6332
- }
6333
- return item;
6334
- });
6335
- }
6336
- return names.reduce((accum, name, index) => {
6337
- let item = items.getValue(name);
6338
- if (!(name in accum)) {
6339
- if (deep && item instanceof Result) {
6340
- item = toObject(getNames(item), item, deep);
6341
- }
6342
- accum[name] = item;
6170
+ static from(sig) {
6171
+ function assertError(check, message) {
6172
+ assertArgument(check, message, "signature", sig);
6343
6173
  }
6344
- return accum;
6345
- }, {});
6346
- }
6347
- var Result = class extends Array {
6348
- // No longer used; but cannot be removed as it will remove the
6349
- // #private field from the .d.ts which may break backwards
6350
- // compatibility
6351
- #names;
6352
- /**
6353
- * @private
6354
- */
6355
- constructor(...args) {
6356
- const guard = args[0];
6357
- let items = args[1];
6358
- let names = (args[2] || []).slice();
6359
- let wrap = true;
6360
- if (guard !== _guard2) {
6361
- items = args;
6362
- names = [];
6363
- wrap = false;
6174
+ ;
6175
+ if (sig == null) {
6176
+ return new Signature(_guard2, ZeroHash, ZeroHash, 27);
6364
6177
  }
6365
- super(items.length);
6366
- items.forEach((item, index) => {
6367
- this[index] = item;
6368
- });
6369
- const nameCounts = names.reduce((accum, name) => {
6370
- if (typeof name === "string") {
6371
- accum.set(name, (accum.get(name) || 0) + 1);
6372
- }
6373
- return accum;
6374
- }, /* @__PURE__ */ new Map());
6375
- setNames(this, Object.freeze(items.map((item, index) => {
6376
- const name = names[index];
6377
- if (name != null && nameCounts.get(name) === 1) {
6378
- return name;
6178
+ if (typeof sig === "string") {
6179
+ const bytes2 = getBytes(sig, "signature");
6180
+ if (bytes2.length === 64) {
6181
+ const r2 = hexlify(bytes2.slice(0, 32));
6182
+ const s2 = bytes2.slice(32, 64);
6183
+ const v2 = s2[0] & 128 ? 28 : 27;
6184
+ s2[0] &= 127;
6185
+ return new Signature(_guard2, r2, hexlify(s2), v2);
6379
6186
  }
6380
- return null;
6381
- })));
6382
- this.#names = [];
6383
- if (this.#names == null) {
6384
- void this.#names;
6187
+ if (bytes2.length === 65) {
6188
+ const r2 = hexlify(bytes2.slice(0, 32));
6189
+ const s2 = bytes2.slice(32, 64);
6190
+ assertError((s2[0] & 128) === 0, "non-canonical s");
6191
+ const v2 = Signature.getNormalizedV(bytes2[64]);
6192
+ return new Signature(_guard2, r2, hexlify(s2), v2);
6193
+ }
6194
+ assertError(false, "invalid raw signature length");
6385
6195
  }
6386
- if (!wrap) {
6387
- return;
6196
+ if (sig instanceof Signature) {
6197
+ return sig.clone();
6388
6198
  }
6389
- Object.freeze(this);
6390
- const proxy = new Proxy(this, {
6391
- get: (target, prop, receiver) => {
6392
- if (typeof prop === "string") {
6393
- if (prop.match(/^[0-9]+$/)) {
6394
- const index = getNumber(prop, "%index");
6395
- if (index < 0 || index >= this.length) {
6396
- throw new RangeError("out of result range");
6397
- }
6398
- const item = target[index];
6399
- if (item instanceof Error) {
6400
- throwError(`index ${index}`, item);
6401
- }
6402
- return item;
6403
- }
6404
- if (passProperties.indexOf(prop) >= 0) {
6405
- return Reflect.get(target, prop, receiver);
6406
- }
6407
- const value = target[prop];
6408
- if (value instanceof Function) {
6409
- return function(...args2) {
6410
- return value.apply(this === receiver ? target : this, args2);
6411
- };
6412
- } else if (!(prop in target)) {
6413
- return target.getValue.apply(this === receiver ? target : this, [prop]);
6414
- }
6199
+ const _r = sig.r;
6200
+ assertError(_r != null, "missing r");
6201
+ const r = toUint256(_r);
6202
+ const s = function(s2, yParityAndS) {
6203
+ if (s2 != null) {
6204
+ return toUint256(s2);
6205
+ }
6206
+ if (yParityAndS != null) {
6207
+ assertError(isHexString(yParityAndS, 32), "invalid yParityAndS");
6208
+ const bytes2 = getBytes(yParityAndS);
6209
+ bytes2[0] &= 127;
6210
+ return hexlify(bytes2);
6211
+ }
6212
+ assertError(false, "missing s");
6213
+ }(sig.s, sig.yParityAndS);
6214
+ assertError((getBytes(s)[0] & 128) == 0, "non-canonical s");
6215
+ const { networkV, v } = function(_v, yParityAndS, yParity) {
6216
+ if (_v != null) {
6217
+ const v2 = getBigInt(_v);
6218
+ return {
6219
+ networkV: v2 >= BN_35 ? v2 : void 0,
6220
+ v: Signature.getNormalizedV(v2)
6221
+ };
6222
+ }
6223
+ if (yParityAndS != null) {
6224
+ assertError(isHexString(yParityAndS, 32), "invalid yParityAndS");
6225
+ return { v: getBytes(yParityAndS)[0] & 128 ? 28 : 27 };
6226
+ }
6227
+ if (yParity != null) {
6228
+ switch (getNumber(yParity, "sig.yParity")) {
6229
+ case 0:
6230
+ return { v: 27 };
6231
+ case 1:
6232
+ return { v: 28 };
6415
6233
  }
6416
- return Reflect.get(target, prop, receiver);
6234
+ assertError(false, "invalid yParity");
6417
6235
  }
6418
- });
6419
- setNames(proxy, getNames(this));
6420
- return proxy;
6236
+ assertError(false, "missing v");
6237
+ }(sig.v, sig.yParityAndS, sig.yParity);
6238
+ const result = new Signature(_guard2, r, s, v);
6239
+ if (networkV) {
6240
+ result.#networkV = networkV;
6241
+ }
6242
+ assertError(sig.yParity == null || getNumber(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch");
6243
+ assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, "yParityAndS mismatch");
6244
+ return result;
6245
+ }
6246
+ };
6247
+
6248
+ // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/crypto/signing-key.js
6249
+ var SigningKey = class {
6250
+ #privateKey;
6251
+ /**
6252
+ * Creates a new **SigningKey** for %%privateKey%%.
6253
+ */
6254
+ constructor(privateKey) {
6255
+ assertArgument(dataLength(privateKey) === 32, "invalid private key", "privateKey", "[REDACTED]");
6256
+ this.#privateKey = hexlify(privateKey);
6421
6257
  }
6422
6258
  /**
6423
- * Returns the Result as a normal Array. If %%deep%%, any children
6424
- * which are Result objects are also converted to a normal Array.
6425
- *
6426
- * This will throw if there are any outstanding deferred
6427
- * errors.
6259
+ * The private key.
6428
6260
  */
6429
- toArray(deep) {
6430
- const result = [];
6431
- this.forEach((item, index) => {
6432
- if (item instanceof Error) {
6433
- throwError(`index ${index}`, item);
6434
- }
6435
- if (deep && item instanceof Result) {
6436
- item = item.toArray(deep);
6437
- }
6438
- result.push(item);
6439
- });
6440
- return result;
6261
+ get privateKey() {
6262
+ return this.#privateKey;
6441
6263
  }
6442
6264
  /**
6443
- * Returns the Result as an Object with each name-value pair. If
6444
- * %%deep%%, any children which are Result objects are also
6445
- * converted to an Object.
6265
+ * The uncompressed public key.
6446
6266
  *
6447
- * This will throw if any value is unnamed, or if there are
6448
- * any outstanding deferred errors.
6267
+ * This will always begin with the prefix ``0x04`` and be 132
6268
+ * characters long (the ``0x`` prefix and 130 hexadecimal nibbles).
6449
6269
  */
6450
- toObject(deep) {
6451
- const names = getNames(this);
6452
- return names.reduce((accum, name, index) => {
6453
- assert(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", {
6454
- operation: "toObject()"
6455
- });
6456
- return toObject(names, this, deep);
6457
- }, {});
6270
+ get publicKey() {
6271
+ return SigningKey.computePublicKey(this.#privateKey);
6458
6272
  }
6459
6273
  /**
6460
- * @_ignore
6274
+ * The compressed public key.
6275
+ *
6276
+ * This will always begin with either the prefix ``0x02`` or ``0x03``
6277
+ * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal
6278
+ * nibbles)
6461
6279
  */
6462
- slice(start, end) {
6463
- if (start == null) {
6464
- start = 0;
6465
- }
6466
- if (start < 0) {
6467
- start += this.length;
6468
- if (start < 0) {
6469
- start = 0;
6470
- }
6471
- }
6472
- if (end == null) {
6473
- end = this.length;
6474
- }
6475
- if (end < 0) {
6476
- end += this.length;
6477
- if (end < 0) {
6478
- end = 0;
6479
- }
6480
- }
6481
- if (end > this.length) {
6482
- end = this.length;
6483
- }
6484
- const _names = getNames(this);
6485
- const result = [], names = [];
6486
- for (let i = start; i < end; i++) {
6487
- result.push(this[i]);
6488
- names.push(_names[i]);
6489
- }
6490
- return new Result(_guard2, result, names);
6280
+ get compressedPublicKey() {
6281
+ return SigningKey.computePublicKey(this.#privateKey, true);
6491
6282
  }
6492
6283
  /**
6493
- * @_ignore
6284
+ * Return the signature of the signed %%digest%%.
6494
6285
  */
6495
- filter(callback, thisArg) {
6496
- const _names = getNames(this);
6497
- const result = [], names = [];
6498
- for (let i = 0; i < this.length; i++) {
6499
- const item = this[i];
6500
- if (item instanceof Error) {
6501
- throwError(`index ${i}`, item);
6502
- }
6503
- if (callback.call(thisArg, item, i, this)) {
6504
- result.push(item);
6505
- names.push(_names[i]);
6506
- }
6507
- }
6508
- return new Result(_guard2, result, names);
6286
+ sign(digest) {
6287
+ assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest);
6288
+ const sig = secp256k1.sign(getBytesCopy(digest), getBytesCopy(this.#privateKey), {
6289
+ lowS: true
6290
+ });
6291
+ return Signature.from({
6292
+ r: toBeHex(sig.r, 32),
6293
+ s: toBeHex(sig.s, 32),
6294
+ v: sig.recovery ? 28 : 27
6295
+ });
6509
6296
  }
6510
6297
  /**
6511
- * @_ignore
6298
+ * Returns the [[link-wiki-ecdh]] shared secret between this
6299
+ * private key and the %%other%% key.
6300
+ *
6301
+ * The %%other%% key may be any type of key, a raw public key,
6302
+ * a compressed/uncompressed pubic key or aprivate key.
6303
+ *
6304
+ * Best practice is usually to use a cryptographic hash on the
6305
+ * returned value before using it as a symetric secret.
6306
+ *
6307
+ * @example:
6308
+ * sign1 = new SigningKey(id("some-secret-1"))
6309
+ * sign2 = new SigningKey(id("some-secret-2"))
6310
+ *
6311
+ * // Notice that privA.computeSharedSecret(pubB)...
6312
+ * sign1.computeSharedSecret(sign2.publicKey)
6313
+ * //_result:
6314
+ *
6315
+ * // ...is equal to privB.computeSharedSecret(pubA).
6316
+ * sign2.computeSharedSecret(sign1.publicKey)
6317
+ * //_result:
6512
6318
  */
6513
- map(callback, thisArg) {
6514
- const result = [];
6515
- for (let i = 0; i < this.length; i++) {
6516
- const item = this[i];
6517
- if (item instanceof Error) {
6518
- throwError(`index ${i}`, item);
6519
- }
6520
- result.push(callback.call(thisArg, item, i, this));
6521
- }
6522
- return result;
6319
+ computeSharedSecret(other) {
6320
+ const pubKey = SigningKey.computePublicKey(other);
6321
+ return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey), false));
6523
6322
  }
6524
6323
  /**
6525
- * Returns the value for %%name%%.
6324
+ * Compute the public key for %%key%%, optionally %%compressed%%.
6325
+ *
6326
+ * The %%key%% may be any type of key, a raw public key, a
6327
+ * compressed/uncompressed public key or private key.
6328
+ *
6329
+ * @example:
6330
+ * sign = new SigningKey(id("some-secret"));
6331
+ *
6332
+ * // Compute the uncompressed public key for a private key
6333
+ * SigningKey.computePublicKey(sign.privateKey)
6334
+ * //_result:
6335
+ *
6336
+ * // Compute the compressed public key for a private key
6337
+ * SigningKey.computePublicKey(sign.privateKey, true)
6338
+ * //_result:
6339
+ *
6340
+ * // Compute the uncompressed public key
6341
+ * SigningKey.computePublicKey(sign.publicKey, false);
6342
+ * //_result:
6526
6343
  *
6527
- * Since it is possible to have a key whose name conflicts with
6528
- * a method on a [[Result]] or its superclass Array, or any
6529
- * JavaScript keyword, this ensures all named values are still
6530
- * accessible by name.
6344
+ * // Compute the Compressed a public key
6345
+ * SigningKey.computePublicKey(sign.publicKey, true);
6346
+ * //_result:
6531
6347
  */
6532
- getValue(name) {
6533
- const index = getNames(this).indexOf(name);
6534
- if (index === -1) {
6535
- return void 0;
6348
+ static computePublicKey(key, compressed) {
6349
+ let bytes2 = getBytes(key, "key");
6350
+ if (bytes2.length === 32) {
6351
+ const pubKey = secp256k1.getPublicKey(bytes2, !!compressed);
6352
+ return hexlify(pubKey);
6536
6353
  }
6537
- const value = this[index];
6538
- if (value instanceof Error) {
6539
- throwError(`property ${JSON.stringify(name)}`, value.error);
6354
+ if (bytes2.length === 64) {
6355
+ const pub = new Uint8Array(65);
6356
+ pub[0] = 4;
6357
+ pub.set(bytes2, 1);
6358
+ bytes2 = pub;
6540
6359
  }
6541
- return value;
6360
+ const point = secp256k1.ProjectivePoint.fromHex(bytes2);
6361
+ return hexlify(point.toRawBytes(compressed));
6542
6362
  }
6543
6363
  /**
6544
- * Creates a new [[Result]] for %%items%% with each entry
6545
- * also accessible by its corresponding name in %%keys%%.
6364
+ * Returns the public key for the private key which produced the
6365
+ * %%signature%% for the given %%digest%%.
6366
+ *
6367
+ * @example:
6368
+ * key = new SigningKey(id("some-secret"))
6369
+ * digest = id("hello world")
6370
+ * sig = key.sign(digest)
6371
+ *
6372
+ * // Notice the signer public key...
6373
+ * key.publicKey
6374
+ * //_result:
6375
+ *
6376
+ * // ...is equal to the recovered public key
6377
+ * SigningKey.recoverPublicKey(digest, sig)
6378
+ * //_result:
6379
+ *
6546
6380
  */
6547
- static fromItems(items, keys) {
6548
- return new Result(_guard2, items, keys);
6549
- }
6550
- };
6551
- function getValue(value) {
6552
- let bytes2 = toBeArray(value);
6553
- assert(bytes2.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes2, length: WordSize, offset: bytes2.length });
6554
- if (bytes2.length !== WordSize) {
6555
- bytes2 = getBytesCopy(concat([Padding.slice(bytes2.length % WordSize), bytes2]));
6556
- }
6557
- return bytes2;
6558
- }
6559
- var Coder = class {
6560
- // The coder name:
6561
- // - address, uint256, tuple, array, etc.
6562
- name;
6563
- // The fully expanded type, including composite types:
6564
- // - address, uint256, tuple(address,bytes), uint256[3][4][], etc.
6565
- type;
6566
- // The localName bound in the signature, in this example it is "baz":
6567
- // - tuple(address foo, uint bar) baz
6568
- localName;
6569
- // Whether this type is dynamic:
6570
- // - Dynamic: bytes, string, address[], tuple(boolean[]), etc.
6571
- // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)
6572
- dynamic;
6573
- constructor(name, type, localName, dynamic) {
6574
- defineProperties(this, { name, type, localName, dynamic }, {
6575
- name: "string",
6576
- type: "string",
6577
- localName: "string",
6578
- dynamic: "boolean"
6579
- });
6381
+ static recoverPublicKey(digest, signature) {
6382
+ assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest);
6383
+ const sig = Signature.from(signature);
6384
+ let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s])));
6385
+ secpSig = secpSig.addRecoveryBit(sig.yParity);
6386
+ const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest));
6387
+ assertArgument(pubKey != null, "invalid signautre for digest", "signature", signature);
6388
+ return "0x" + pubKey.toHex(false);
6580
6389
  }
6581
- _throwError(message, value) {
6582
- assertArgument(false, message, this.localName, value);
6390
+ /**
6391
+ * Returns the point resulting from adding the ellipic curve points
6392
+ * %%p0%% and %%p1%%.
6393
+ *
6394
+ * This is not a common function most developers should require, but
6395
+ * can be useful for certain privacy-specific techniques.
6396
+ *
6397
+ * For example, it is used by [[HDNodeWallet]] to compute child
6398
+ * addresses from parent public keys and chain codes.
6399
+ */
6400
+ static addPoints(p0, p1, compressed) {
6401
+ const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2));
6402
+ const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2));
6403
+ return "0x" + pub0.add(pub1).toHex(!!compressed);
6583
6404
  }
6584
6405
  };
6585
- var Writer = class {
6586
- // An array of WordSize lengthed objects to concatenation
6587
- #data;
6588
- #dataLength;
6589
- constructor() {
6590
- this.#data = [];
6591
- this.#dataLength = 0;
6592
- }
6593
- get data() {
6594
- return concat(this.#data);
6595
- }
6596
- get length() {
6597
- return this.#dataLength;
6598
- }
6599
- #writeData(data) {
6600
- this.#data.push(data);
6601
- this.#dataLength += data.length;
6602
- return data.length;
6603
- }
6604
- appendWriter(writer) {
6605
- return this.#writeData(getBytesCopy(writer.data));
6406
+
6407
+ // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/address/address.js
6408
+ var BN_04 = BigInt(0);
6409
+ var BN_36 = BigInt(36);
6410
+ function getChecksumAddress(address) {
6411
+ address = address.toLowerCase();
6412
+ const chars = address.substring(2).split("");
6413
+ const expanded = new Uint8Array(40);
6414
+ for (let i = 0; i < 40; i++) {
6415
+ expanded[i] = chars[i].charCodeAt(0);
6606
6416
  }
6607
- // Arrayish item; pad on the right to *nearest* WordSize
6608
- writeBytes(value) {
6609
- let bytes2 = getBytesCopy(value);
6610
- const paddingOffset = bytes2.length % WordSize;
6611
- if (paddingOffset) {
6612
- bytes2 = getBytesCopy(concat([bytes2, Padding.slice(paddingOffset)]));
6417
+ const hashed = getBytes(keccak256(expanded));
6418
+ for (let i = 0; i < 40; i += 2) {
6419
+ if (hashed[i >> 1] >> 4 >= 8) {
6420
+ chars[i] = chars[i].toUpperCase();
6421
+ }
6422
+ if ((hashed[i >> 1] & 15) >= 8) {
6423
+ chars[i + 1] = chars[i + 1].toUpperCase();
6613
6424
  }
6614
- return this.#writeData(bytes2);
6615
- }
6616
- // Numeric item; pad on the left *to* WordSize
6617
- writeValue(value) {
6618
- return this.#writeData(getValue(value));
6619
- }
6620
- // Inserts a numeric place-holder, returning a callback that can
6621
- // be used to asjust the value later
6622
- writeUpdatableValue() {
6623
- const offset = this.#data.length;
6624
- this.#data.push(Padding);
6625
- this.#dataLength += WordSize;
6626
- return (value) => {
6627
- this.#data[offset] = getValue(value);
6628
- };
6629
- }
6630
- };
6631
- var Reader = class {
6632
- // Allows incomplete unpadded data to be read; otherwise an error
6633
- // is raised if attempting to overrun the buffer. This is required
6634
- // to deal with an old Solidity bug, in which event data for
6635
- // external (not public thoguh) was tightly packed.
6636
- allowLoose;
6637
- #data;
6638
- #offset;
6639
- #bytesRead;
6640
- #parent;
6641
- #maxInflation;
6642
- constructor(data, allowLoose, maxInflation) {
6643
- defineProperties(this, { allowLoose: !!allowLoose });
6644
- this.#data = getBytesCopy(data);
6645
- this.#bytesRead = 0;
6646
- this.#parent = null;
6647
- this.#maxInflation = maxInflation != null ? maxInflation : 1024;
6648
- this.#offset = 0;
6649
- }
6650
- get data() {
6651
- return hexlify(this.#data);
6652
6425
  }
6653
- get dataLength() {
6654
- return this.#data.length;
6426
+ return "0x" + chars.join("");
6427
+ }
6428
+ var ibanLookup = {};
6429
+ for (let i = 0; i < 10; i++) {
6430
+ ibanLookup[String(i)] = String(i);
6431
+ }
6432
+ for (let i = 0; i < 26; i++) {
6433
+ ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);
6434
+ }
6435
+ var safeDigits = 15;
6436
+ function ibanChecksum(address) {
6437
+ address = address.toUpperCase();
6438
+ address = address.substring(4) + address.substring(0, 2) + "00";
6439
+ let expanded = address.split("").map((c) => {
6440
+ return ibanLookup[c];
6441
+ }).join("");
6442
+ while (expanded.length >= safeDigits) {
6443
+ let block = expanded.substring(0, safeDigits);
6444
+ expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);
6655
6445
  }
6656
- get consumed() {
6657
- return this.#offset;
6446
+ let checksum = String(98 - parseInt(expanded, 10) % 97);
6447
+ while (checksum.length < 2) {
6448
+ checksum = "0" + checksum;
6658
6449
  }
6659
- get bytes() {
6660
- return new Uint8Array(this.#data);
6450
+ return checksum;
6451
+ }
6452
+ var Base36 = function() {
6453
+ ;
6454
+ const result = {};
6455
+ for (let i = 0; i < 36; i++) {
6456
+ const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i];
6457
+ result[key] = BigInt(i);
6661
6458
  }
6662
- #incrementBytesRead(count) {
6663
- if (this.#parent) {
6664
- return this.#parent.#incrementBytesRead(count);
6665
- }
6666
- this.#bytesRead += count;
6667
- assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", {
6668
- buffer: getBytesCopy(this.#data),
6669
- offset: this.#offset,
6670
- length: count,
6671
- info: {
6672
- bytesRead: this.#bytesRead,
6673
- dataLength: this.dataLength
6674
- }
6675
- });
6459
+ return result;
6460
+ }();
6461
+ function fromBase36(value) {
6462
+ value = value.toLowerCase();
6463
+ let result = BN_04;
6464
+ for (let i = 0; i < value.length; i++) {
6465
+ result = result * BN_36 + Base36[value[i]];
6676
6466
  }
6677
- #peekBytes(offset, length, loose) {
6678
- let alignedLength = Math.ceil(length / WordSize) * WordSize;
6679
- if (this.#offset + alignedLength > this.#data.length) {
6680
- if (this.allowLoose && loose && this.#offset + length <= this.#data.length) {
6681
- alignedLength = length;
6682
- } else {
6683
- assert(false, "data out-of-bounds", "BUFFER_OVERRUN", {
6684
- buffer: getBytesCopy(this.#data),
6685
- length: this.#data.length,
6686
- offset: this.#offset + alignedLength
6687
- });
6688
- }
6467
+ return result;
6468
+ }
6469
+ function getAddress(address) {
6470
+ assertArgument(typeof address === "string", "invalid address", "address", address);
6471
+ if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
6472
+ if (!address.startsWith("0x")) {
6473
+ address = "0x" + address;
6689
6474
  }
6690
- return this.#data.slice(this.#offset, this.#offset + alignedLength);
6475
+ const result = getChecksumAddress(address);
6476
+ assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address);
6477
+ return result;
6691
6478
  }
6692
- // Create a sub-reader with the same underlying data, but offset
6693
- subReader(offset) {
6694
- const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation);
6695
- reader.#parent = this;
6696
- return reader;
6479
+ if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
6480
+ assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address);
6481
+ let result = fromBase36(address.substring(4)).toString(16);
6482
+ while (result.length < 40) {
6483
+ result = "0" + result;
6484
+ }
6485
+ return getChecksumAddress("0x" + result);
6697
6486
  }
6698
- // Read bytes
6699
- readBytes(length, loose) {
6700
- let bytes2 = this.#peekBytes(0, length, !!loose);
6701
- this.#incrementBytesRead(length);
6702
- this.#offset += bytes2.length;
6703
- return bytes2.slice(0, length);
6487
+ assertArgument(false, "invalid address", "address", address);
6488
+ }
6489
+
6490
+ // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/address/contract-address.js
6491
+ function getCreateAddress(tx) {
6492
+ const from = getAddress(tx.from);
6493
+ const nonce = getBigInt(tx.nonce, "tx.nonce");
6494
+ let nonceHex = nonce.toString(16);
6495
+ if (nonceHex === "0") {
6496
+ nonceHex = "0x";
6497
+ } else if (nonceHex.length % 2) {
6498
+ nonceHex = "0x0" + nonceHex;
6499
+ } else {
6500
+ nonceHex = "0x" + nonceHex;
6704
6501
  }
6705
- // Read a numeric values
6706
- readValue() {
6707
- return toBigInt(this.readBytes(WordSize));
6502
+ return getAddress(dataSlice(keccak256(encodeRlp([from, nonceHex])), 12));
6503
+ }
6504
+
6505
+ // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/address/checks.js
6506
+ function isAddressable(value) {
6507
+ return value && typeof value.getAddress === "function";
6508
+ }
6509
+ async function checkAddress(target, promise) {
6510
+ const result = await promise;
6511
+ if (result == null || result === "0x0000000000000000000000000000000000000000") {
6512
+ assert(typeof target !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target });
6513
+ assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target);
6708
6514
  }
6709
- readIndex() {
6710
- return toNumber(this.readBytes(WordSize));
6515
+ return getAddress(result);
6516
+ }
6517
+ function resolveAddress(target, resolver) {
6518
+ if (typeof target === "string") {
6519
+ if (target.match(/^0x[0-9a-f]{40}$/i)) {
6520
+ return getAddress(target);
6521
+ }
6522
+ assert(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" });
6523
+ return checkAddress(target, resolver.resolveName(target));
6524
+ } else if (isAddressable(target)) {
6525
+ return checkAddress(target, target.getAddress());
6526
+ } else if (target && typeof target.then === "function") {
6527
+ return checkAddress(target, target);
6711
6528
  }
6712
- };
6529
+ assertArgument(false, "unsupported addressable value", "target", target);
6530
+ }
6713
6531
 
6714
6532
  // ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/typed.js
6715
6533
  var _gaurd = {};
@@ -18723,32 +18541,215 @@ function spelunkData(value) {
18723
18541
  } catch (error) {
18724
18542
  }
18725
18543
  }
18726
- return null;
18727
- }
18728
- function _spelunkMessage(value, result) {
18729
- if (value == null) {
18730
- return;
18544
+ return null;
18545
+ }
18546
+ function _spelunkMessage(value, result) {
18547
+ if (value == null) {
18548
+ return;
18549
+ }
18550
+ if (typeof value.message === "string") {
18551
+ result.push(value.message);
18552
+ }
18553
+ if (typeof value === "object") {
18554
+ for (const key in value) {
18555
+ _spelunkMessage(value[key], result);
18556
+ }
18557
+ }
18558
+ if (typeof value === "string") {
18559
+ try {
18560
+ return _spelunkMessage(JSON.parse(value), result);
18561
+ } catch (error) {
18562
+ }
18563
+ }
18564
+ }
18565
+ function spelunkMessage(value) {
18566
+ const result = [];
18567
+ _spelunkMessage(value, result);
18568
+ return result;
18569
+ }
18570
+
18571
+ // src/eth/context.ts
18572
+ var EthContext = class extends BaseContext {
18573
+ chainId;
18574
+ address;
18575
+ log;
18576
+ block;
18577
+ trace;
18578
+ blockNumber;
18579
+ transactionHash;
18580
+ transaction;
18581
+ transactionReceipt;
18582
+ timestamp;
18583
+ preparedData;
18584
+ constructor(chainId, address, timestamp, block, log, trace2, transaction, transactionReceipt, baseLabels, preparedData) {
18585
+ super(baseLabels);
18586
+ this.chainId = chainId;
18587
+ this.log = log;
18588
+ this.block = block;
18589
+ this.trace = trace2;
18590
+ this.address = address.toLowerCase();
18591
+ this.transaction = transaction;
18592
+ this.transactionReceipt = transactionReceipt;
18593
+ this.timestamp = timestamp || /* @__PURE__ */ new Date(0);
18594
+ this.preparedData = preparedData;
18595
+ if (log) {
18596
+ this.blockNumber = log.blockNumber;
18597
+ this.transactionHash = log.transactionHash;
18598
+ } else if (block) {
18599
+ this.blockNumber = block.number;
18600
+ } else if (trace2) {
18601
+ this.blockNumber = trace2.blockNumber;
18602
+ this.transactionHash = trace2.transactionHash;
18603
+ }
18604
+ }
18605
+ getChainId() {
18606
+ return this.chainId;
18607
+ }
18608
+ getMetaDataInternal(name, labels) {
18609
+ if (this.log) {
18610
+ return {
18611
+ address: this.address,
18612
+ contractName: this.getContractName(),
18613
+ blockNumber: BigInt(this.blockNumber),
18614
+ transactionIndex: this.log.transactionIndex,
18615
+ transactionHash: this.transactionHash || "",
18616
+ logIndex: this.log.index,
18617
+ chainId: this.chainId,
18618
+ name,
18619
+ labels: normalizeLabels(labels)
18620
+ };
18621
+ }
18622
+ if (this.trace) {
18623
+ return {
18624
+ address: this.address,
18625
+ contractName: this.getContractName(),
18626
+ blockNumber: BigInt(this.blockNumber),
18627
+ transactionIndex: this.trace.transactionPosition,
18628
+ transactionHash: this.transactionHash || "",
18629
+ logIndex: -1,
18630
+ chainId: this.chainId.toString(),
18631
+ name,
18632
+ labels: normalizeLabels(labels)
18633
+ };
18634
+ }
18635
+ if (this.transaction) {
18636
+ return {
18637
+ address: this.address,
18638
+ contractName: this.getContractName(),
18639
+ blockNumber: BigInt(this.blockNumber),
18640
+ transactionIndex: this.transaction.index || 0,
18641
+ transactionHash: this.transaction.hash || "",
18642
+ logIndex: -1,
18643
+ chainId: this.chainId.toString(),
18644
+ name,
18645
+ labels: normalizeLabels(labels)
18646
+ };
18647
+ }
18648
+ if (this.block) {
18649
+ return {
18650
+ address: this.address,
18651
+ contractName: this.getContractName(),
18652
+ blockNumber: BigInt(this.blockNumber),
18653
+ transactionIndex: -1,
18654
+ transactionHash: "",
18655
+ logIndex: -1,
18656
+ chainId: this.chainId.toString(),
18657
+ name,
18658
+ labels: normalizeLabels(labels)
18659
+ };
18660
+ }
18661
+ throw new Error("Invaid ctx argument can't happen");
18662
+ }
18663
+ };
18664
+ var AccountContext = class extends EthContext {
18665
+ // constructor(chainId: number, address: string, block?: Block, log?: Log, trace?: Trace) {
18666
+ // super(chainId, address, new Date(0), block, log, trace)
18667
+ // }
18668
+ getContractName() {
18669
+ return "account";
18670
+ }
18671
+ };
18672
+ var GlobalContext = class extends EthContext {
18673
+ constructor(chainId, address, timestamp, block, log, trace2, transaction, transactionReceipt, baseLabels, preparedData) {
18674
+ super(chainId, address, timestamp, block, log, trace2, transaction, transactionReceipt, baseLabels, preparedData);
18675
+ }
18676
+ getContractName() {
18677
+ return "*";
18678
+ }
18679
+ getMetaDataInternal(name, labels) {
18680
+ const address = this.address;
18681
+ this.address = "*";
18682
+ const res = super.getMetaDataInternal(name, labels);
18683
+ this.address = address;
18684
+ return res;
18685
+ }
18686
+ };
18687
+ var ContractContext = class extends EthContext {
18688
+ contract;
18689
+ contractName;
18690
+ constructor(contractName, view, chainId, timestamp, block, log, trace2, transaction, transactionReceipt, baseLabels, preparedData) {
18691
+ super(
18692
+ chainId,
18693
+ view.address,
18694
+ timestamp,
18695
+ block,
18696
+ log,
18697
+ trace2,
18698
+ transaction,
18699
+ transactionReceipt,
18700
+ baseLabels,
18701
+ preparedData
18702
+ );
18703
+ view.context = this;
18704
+ if (view.callStatic) {
18705
+ view.callStatic.context = this;
18706
+ }
18707
+ this.contractName = contractName;
18708
+ this.contract = view;
18709
+ }
18710
+ getContractName() {
18711
+ return this.contractName;
18712
+ }
18713
+ };
18714
+ var ContractView = class {
18715
+ contract;
18716
+ constructor(contract) {
18717
+ this.contract = contract;
18718
+ }
18719
+ get rawContract() {
18720
+ return this.contract;
18721
+ }
18722
+ get provider() {
18723
+ if (this.contract.runner?.provider) {
18724
+ return this.contract.runner.provider;
18725
+ }
18726
+ throw Error("Can't find provider for contract" + this.contract.toString());
18727
+ }
18728
+ };
18729
+ var BoundContractView = class {
18730
+ view;
18731
+ address;
18732
+ // context will be set right after context creation (in context's constructor)
18733
+ // context: ContractContext<TContract, BoundContractView<TContract, TContractView>>
18734
+ context;
18735
+ callStatic;
18736
+ constructor(address, view) {
18737
+ this.address = address;
18738
+ this.view = view;
18731
18739
  }
18732
- if (typeof value.message === "string") {
18733
- result.push(value.message);
18740
+ get rawContract() {
18741
+ return this.view.rawContract;
18734
18742
  }
18735
- if (typeof value === "object") {
18736
- for (const key in value) {
18737
- _spelunkMessage(value[key], result);
18738
- }
18743
+ get provider() {
18744
+ return this.view.provider;
18739
18745
  }
18740
- if (typeof value === "string") {
18741
- try {
18742
- return _spelunkMessage(JSON.parse(value), result);
18743
- } catch (error) {
18744
- }
18746
+ get filters() {
18747
+ return this.view.rawContract.filters;
18745
18748
  }
18746
- }
18747
- function spelunkMessage(value) {
18748
- const result = [];
18749
- _spelunkMessage(value, result);
18750
- return result;
18751
- }
18749
+ };
18750
+
18751
+ // src/eth/base-processor.ts
18752
+ var import_nice_grpc = __toESM(require_lib(), 1);
18752
18753
 
18753
18754
  // src/eth/eth.ts
18754
18755
  var SimpleEthersError = class extends Error {
@@ -23533,8 +23534,26 @@ var ERC20ContractView = class extends ContractView {
23533
23534
  super(contract);
23534
23535
  this.callStatic.contract = contract;
23535
23536
  }
23536
- async allowance(owner, spender, overrides) {
23537
+ async allowance(owner, spender, overrides, preparedData, ethCallContext) {
23537
23538
  try {
23539
+ if (preparedData?.ethCallResults && ethCallContext) {
23540
+ const iface = new Interface([
23541
+ "function allowance(address,address) view returns (uint256)"
23542
+ ]);
23543
+ const calldata = iface.encodeFunctionData("allowance", [
23544
+ owner,
23545
+ spender
23546
+ ]);
23547
+ const key = makeEthCallKey({
23548
+ context: ethCallContext,
23549
+ calldata
23550
+ });
23551
+ const ret = preparedData.ethCallResults[key];
23552
+ if (ret) {
23553
+ const result = iface.decodeFunctionResult("allowance", ret).toArray();
23554
+ return result.length == 1 ? result[0] : result;
23555
+ }
23556
+ }
23538
23557
  return await this.contract.getFunction("allowance(address,address)")(
23539
23558
  owner,
23540
23559
  spender,
@@ -23545,8 +23564,23 @@ var ERC20ContractView = class extends ContractView {
23545
23564
  throw transformEtherError(e, void 0, stack);
23546
23565
  }
23547
23566
  }
23548
- async balanceOf(account, overrides) {
23567
+ async balanceOf(account, overrides, preparedData, ethCallContext) {
23549
23568
  try {
23569
+ if (preparedData?.ethCallResults && ethCallContext) {
23570
+ const iface = new Interface([
23571
+ "function balanceOf(address) view returns (uint256)"
23572
+ ]);
23573
+ const calldata = iface.encodeFunctionData("balanceOf", [account]);
23574
+ const key = makeEthCallKey({
23575
+ context: ethCallContext,
23576
+ calldata
23577
+ });
23578
+ const ret = preparedData.ethCallResults[key];
23579
+ if (ret) {
23580
+ const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
23581
+ return result.length == 1 ? result[0] : result;
23582
+ }
23583
+ }
23550
23584
  return await this.contract.getFunction("balanceOf(address)")(
23551
23585
  account,
23552
23586
  overrides || {}
@@ -23556,48 +23590,136 @@ var ERC20ContractView = class extends ContractView {
23556
23590
  throw transformEtherError(e, void 0, stack);
23557
23591
  }
23558
23592
  }
23559
- async decimals(overrides) {
23593
+ async decimals(overrides, preparedData, ethCallContext) {
23560
23594
  try {
23595
+ if (preparedData?.ethCallResults && ethCallContext) {
23596
+ const iface = new Interface([
23597
+ "function decimals() view returns (uint8)"
23598
+ ]);
23599
+ const calldata = iface.encodeFunctionData("decimals", []);
23600
+ const key = makeEthCallKey({
23601
+ context: ethCallContext,
23602
+ calldata
23603
+ });
23604
+ const ret = preparedData.ethCallResults[key];
23605
+ if (ret) {
23606
+ const result = iface.decodeFunctionResult("decimals", ret).toArray();
23607
+ return result.length == 1 ? result[0] : result;
23608
+ }
23609
+ }
23561
23610
  return await this.contract.getFunction("decimals()")(overrides || {});
23562
23611
  } catch (e) {
23563
23612
  const stack = new Error().stack;
23564
23613
  throw transformEtherError(e, void 0, stack);
23565
23614
  }
23566
23615
  }
23567
- async locker(overrides) {
23616
+ async locker(overrides, preparedData, ethCallContext) {
23568
23617
  try {
23618
+ if (preparedData?.ethCallResults && ethCallContext) {
23619
+ const iface = new Interface([
23620
+ "function locker() view returns (address)"
23621
+ ]);
23622
+ const calldata = iface.encodeFunctionData("locker", []);
23623
+ const key = makeEthCallKey({
23624
+ context: ethCallContext,
23625
+ calldata
23626
+ });
23627
+ const ret = preparedData.ethCallResults[key];
23628
+ if (ret) {
23629
+ const result = iface.decodeFunctionResult("locker", ret).toArray();
23630
+ return result.length == 1 ? result[0] : result;
23631
+ }
23632
+ }
23569
23633
  return await this.contract.getFunction("locker()")(overrides || {});
23570
23634
  } catch (e) {
23571
23635
  const stack = new Error().stack;
23572
23636
  throw transformEtherError(e, void 0, stack);
23573
23637
  }
23574
23638
  }
23575
- async name(overrides) {
23639
+ async name(overrides, preparedData, ethCallContext) {
23576
23640
  try {
23641
+ if (preparedData?.ethCallResults && ethCallContext) {
23642
+ const iface = new Interface(["function name() view returns (string)"]);
23643
+ const calldata = iface.encodeFunctionData("name", []);
23644
+ const key = makeEthCallKey({
23645
+ context: ethCallContext,
23646
+ calldata
23647
+ });
23648
+ const ret = preparedData.ethCallResults[key];
23649
+ if (ret) {
23650
+ const result = iface.decodeFunctionResult("name", ret).toArray();
23651
+ return result.length == 1 ? result[0] : result;
23652
+ }
23653
+ }
23577
23654
  return await this.contract.getFunction("name()")(overrides || {});
23578
23655
  } catch (e) {
23579
23656
  const stack = new Error().stack;
23580
23657
  throw transformEtherError(e, void 0, stack);
23581
23658
  }
23582
23659
  }
23583
- async owner(overrides) {
23660
+ async owner(overrides, preparedData, ethCallContext) {
23584
23661
  try {
23662
+ if (preparedData?.ethCallResults && ethCallContext) {
23663
+ const iface = new Interface([
23664
+ "function owner() view returns (address)"
23665
+ ]);
23666
+ const calldata = iface.encodeFunctionData("owner", []);
23667
+ const key = makeEthCallKey({
23668
+ context: ethCallContext,
23669
+ calldata
23670
+ });
23671
+ const ret = preparedData.ethCallResults[key];
23672
+ if (ret) {
23673
+ const result = iface.decodeFunctionResult("owner", ret).toArray();
23674
+ return result.length == 1 ? result[0] : result;
23675
+ }
23676
+ }
23585
23677
  return await this.contract.getFunction("owner()")(overrides || {});
23586
23678
  } catch (e) {
23587
23679
  const stack = new Error().stack;
23588
23680
  throw transformEtherError(e, void 0, stack);
23589
23681
  }
23590
23682
  }
23591
- async symbol(overrides) {
23683
+ async symbol(overrides, preparedData, ethCallContext) {
23592
23684
  try {
23685
+ if (preparedData?.ethCallResults && ethCallContext) {
23686
+ const iface = new Interface([
23687
+ "function symbol() view returns (string)"
23688
+ ]);
23689
+ const calldata = iface.encodeFunctionData("symbol", []);
23690
+ const key = makeEthCallKey({
23691
+ context: ethCallContext,
23692
+ calldata
23693
+ });
23694
+ const ret = preparedData.ethCallResults[key];
23695
+ if (ret) {
23696
+ const result = iface.decodeFunctionResult("symbol", ret).toArray();
23697
+ return result.length == 1 ? result[0] : result;
23698
+ }
23699
+ }
23593
23700
  return await this.contract.getFunction("symbol()")(overrides || {});
23594
23701
  } catch (e) {
23595
23702
  const stack = new Error().stack;
23596
23703
  throw transformEtherError(e, void 0, stack);
23597
23704
  }
23598
23705
  }
23599
- async totalSupply(overrides) {
23706
+ async totalSupply(overrides, preparedData, ethCallContext) {
23600
23707
  try {
23708
+ if (preparedData?.ethCallResults && ethCallContext) {
23709
+ const iface = new Interface([
23710
+ "function totalSupply() view returns (uint256)"
23711
+ ]);
23712
+ const calldata = iface.encodeFunctionData("totalSupply", []);
23713
+ const key = makeEthCallKey({
23714
+ context: ethCallContext,
23715
+ calldata
23716
+ });
23717
+ const ret = preparedData.ethCallResults[key];
23718
+ if (ret) {
23719
+ const result = iface.decodeFunctionResult("totalSupply", ret).toArray();
23720
+ return result.length == 1 ? result[0] : result;
23721
+ }
23722
+ }
23601
23723
  return await this.contract.getFunction("totalSupply()")(overrides || {});
23602
23724
  } catch (e) {
23603
23725
  const stack = new Error().stack;
@@ -23606,81 +23728,515 @@ var ERC20ContractView = class extends ContractView {
23606
23728
  }
23607
23729
  callStatic = {
23608
23730
  contract: this.contract,
23609
- async approve(spender, amount, overrides) {
23731
+ async approve(spender, amount, overrides, preparedData, ethCallContext) {
23610
23732
  try {
23733
+ if (preparedData?.ethCallResults && ethCallContext) {
23734
+ const iface = new Interface([
23735
+ "function approve(address,uint256) nonpayable returns (bool)"
23736
+ ]);
23737
+ const calldata = iface.encodeFunctionData("approve", [
23738
+ spender,
23739
+ amount
23740
+ ]);
23741
+ const key = makeEthCallKey({
23742
+ context: ethCallContext,
23743
+ calldata
23744
+ });
23745
+ const ret = preparedData.ethCallResults[key];
23746
+ if (ret) {
23747
+ const result = iface.decodeFunctionResult("approve", ret).toArray();
23748
+ return result.length == 1 ? result[0] : result;
23749
+ }
23750
+ }
23611
23751
  return await this.contract.getFunction("approve(address,uint256)").staticCall(spender, amount, overrides || {});
23612
23752
  } catch (e) {
23613
23753
  const stack = new Error().stack;
23614
23754
  throw transformEtherError(e, void 0, stack);
23615
23755
  }
23616
23756
  },
23617
- async burn(amount, overrides) {
23757
+ async burn(amount, overrides, preparedData, ethCallContext) {
23618
23758
  try {
23759
+ if (preparedData?.ethCallResults && ethCallContext) {
23760
+ const iface = new Interface([
23761
+ "function burn(uint256) nonpayable returns ()"
23762
+ ]);
23763
+ const calldata = iface.encodeFunctionData("burn", [amount]);
23764
+ const key = makeEthCallKey({
23765
+ context: ethCallContext,
23766
+ calldata
23767
+ });
23768
+ const ret = preparedData.ethCallResults[key];
23769
+ if (ret) {
23770
+ const result = iface.decodeFunctionResult("burn", ret).toArray();
23771
+ return result.length == 1 ? result[0] : result;
23772
+ }
23773
+ }
23619
23774
  return await this.contract.getFunction("burn(uint256)").staticCall(amount, overrides || {});
23620
23775
  } catch (e) {
23621
23776
  const stack = new Error().stack;
23622
23777
  throw transformEtherError(e, void 0, stack);
23623
23778
  }
23624
23779
  },
23625
- async burnFrom(account, amount, overrides) {
23780
+ async burnFrom(account, amount, overrides, preparedData, ethCallContext) {
23626
23781
  try {
23782
+ if (preparedData?.ethCallResults && ethCallContext) {
23783
+ const iface = new Interface([
23784
+ "function burnFrom(address,uint256) nonpayable returns ()"
23785
+ ]);
23786
+ const calldata = iface.encodeFunctionData("burnFrom", [
23787
+ account,
23788
+ amount
23789
+ ]);
23790
+ const key = makeEthCallKey({
23791
+ context: ethCallContext,
23792
+ calldata
23793
+ });
23794
+ const ret = preparedData.ethCallResults[key];
23795
+ if (ret) {
23796
+ const result = iface.decodeFunctionResult("burnFrom", ret).toArray();
23797
+ return result.length == 1 ? result[0] : result;
23798
+ }
23799
+ }
23627
23800
  return await this.contract.getFunction("burnFrom(address,uint256)").staticCall(account, amount, overrides || {});
23628
23801
  } catch (e) {
23629
23802
  const stack = new Error().stack;
23630
23803
  throw transformEtherError(e, void 0, stack);
23631
23804
  }
23632
23805
  },
23633
- async decreaseAllowance(spender, subtractedValue, overrides) {
23806
+ async decreaseAllowance(spender, subtractedValue, overrides, preparedData, ethCallContext) {
23634
23807
  try {
23808
+ if (preparedData?.ethCallResults && ethCallContext) {
23809
+ const iface = new Interface([
23810
+ "function decreaseAllowance(address,uint256) nonpayable returns (bool)"
23811
+ ]);
23812
+ const calldata = iface.encodeFunctionData("decreaseAllowance", [
23813
+ spender,
23814
+ subtractedValue
23815
+ ]);
23816
+ const key = makeEthCallKey({
23817
+ context: ethCallContext,
23818
+ calldata
23819
+ });
23820
+ const ret = preparedData.ethCallResults[key];
23821
+ if (ret) {
23822
+ const result = iface.decodeFunctionResult("decreaseAllowance", ret).toArray();
23823
+ return result.length == 1 ? result[0] : result;
23824
+ }
23825
+ }
23635
23826
  return await this.contract.getFunction("decreaseAllowance(address,uint256)").staticCall(spender, subtractedValue, overrides || {});
23636
23827
  } catch (e) {
23637
23828
  const stack = new Error().stack;
23638
23829
  throw transformEtherError(e, void 0, stack);
23639
23830
  }
23640
23831
  },
23641
- async increaseAllowance(spender, addedValue, overrides) {
23832
+ async increaseAllowance(spender, addedValue, overrides, preparedData, ethCallContext) {
23642
23833
  try {
23834
+ if (preparedData?.ethCallResults && ethCallContext) {
23835
+ const iface = new Interface([
23836
+ "function increaseAllowance(address,uint256) nonpayable returns (bool)"
23837
+ ]);
23838
+ const calldata = iface.encodeFunctionData("increaseAllowance", [
23839
+ spender,
23840
+ addedValue
23841
+ ]);
23842
+ const key = makeEthCallKey({
23843
+ context: ethCallContext,
23844
+ calldata
23845
+ });
23846
+ const ret = preparedData.ethCallResults[key];
23847
+ if (ret) {
23848
+ const result = iface.decodeFunctionResult("increaseAllowance", ret).toArray();
23849
+ return result.length == 1 ? result[0] : result;
23850
+ }
23851
+ }
23643
23852
  return await this.contract.getFunction("increaseAllowance(address,uint256)").staticCall(spender, addedValue, overrides || {});
23644
23853
  } catch (e) {
23645
23854
  const stack = new Error().stack;
23646
23855
  throw transformEtherError(e, void 0, stack);
23647
23856
  }
23648
23857
  },
23649
- async renounceOwnership(overrides) {
23858
+ async renounceOwnership(overrides, preparedData, ethCallContext) {
23650
23859
  try {
23860
+ if (preparedData?.ethCallResults && ethCallContext) {
23861
+ const iface = new Interface([
23862
+ "function renounceOwnership() nonpayable returns ()"
23863
+ ]);
23864
+ const calldata = iface.encodeFunctionData("renounceOwnership", []);
23865
+ const key = makeEthCallKey({
23866
+ context: ethCallContext,
23867
+ calldata
23868
+ });
23869
+ const ret = preparedData.ethCallResults[key];
23870
+ if (ret) {
23871
+ const result = iface.decodeFunctionResult("renounceOwnership", ret).toArray();
23872
+ return result.length == 1 ? result[0] : result;
23873
+ }
23874
+ }
23651
23875
  return await this.contract.getFunction("renounceOwnership()").staticCall(overrides || {});
23652
23876
  } catch (e) {
23653
23877
  const stack = new Error().stack;
23654
23878
  throw transformEtherError(e, void 0, stack);
23655
23879
  }
23656
23880
  },
23657
- async setLocker(_locker, overrides) {
23881
+ async setLocker(_locker, overrides, preparedData, ethCallContext) {
23658
23882
  try {
23883
+ if (preparedData?.ethCallResults && ethCallContext) {
23884
+ const iface = new Interface([
23885
+ "function setLocker(address) nonpayable returns ()"
23886
+ ]);
23887
+ const calldata = iface.encodeFunctionData("setLocker", [_locker]);
23888
+ const key = makeEthCallKey({
23889
+ context: ethCallContext,
23890
+ calldata
23891
+ });
23892
+ const ret = preparedData.ethCallResults[key];
23893
+ if (ret) {
23894
+ const result = iface.decodeFunctionResult("setLocker", ret).toArray();
23895
+ return result.length == 1 ? result[0] : result;
23896
+ }
23897
+ }
23659
23898
  return await this.contract.getFunction("setLocker(address)").staticCall(_locker, overrides || {});
23660
23899
  } catch (e) {
23661
23900
  const stack = new Error().stack;
23662
23901
  throw transformEtherError(e, void 0, stack);
23663
23902
  }
23664
23903
  },
23665
- async transfer(recipient, amount, overrides) {
23904
+ async transfer(recipient, amount, overrides, preparedData, ethCallContext) {
23905
+ try {
23906
+ if (preparedData?.ethCallResults && ethCallContext) {
23907
+ const iface = new Interface([
23908
+ "function transfer(address,uint256) nonpayable returns (bool)"
23909
+ ]);
23910
+ const calldata = iface.encodeFunctionData("transfer", [
23911
+ recipient,
23912
+ amount
23913
+ ]);
23914
+ const key = makeEthCallKey({
23915
+ context: ethCallContext,
23916
+ calldata
23917
+ });
23918
+ const ret = preparedData.ethCallResults[key];
23919
+ if (ret) {
23920
+ const result = iface.decodeFunctionResult("transfer", ret).toArray();
23921
+ return result.length == 1 ? result[0] : result;
23922
+ }
23923
+ }
23924
+ return await this.contract.getFunction("transfer(address,uint256)").staticCall(recipient, amount, overrides || {});
23925
+ } catch (e) {
23926
+ const stack = new Error().stack;
23927
+ throw transformEtherError(e, void 0, stack);
23928
+ }
23929
+ },
23930
+ async transferFrom(sender, recipient, amount, overrides, preparedData, ethCallContext) {
23931
+ try {
23932
+ if (preparedData?.ethCallResults && ethCallContext) {
23933
+ const iface = new Interface([
23934
+ "function transferFrom(address,address,uint256) nonpayable returns (bool)"
23935
+ ]);
23936
+ const calldata = iface.encodeFunctionData("transferFrom", [
23937
+ sender,
23938
+ recipient,
23939
+ amount
23940
+ ]);
23941
+ const key = makeEthCallKey({
23942
+ context: ethCallContext,
23943
+ calldata
23944
+ });
23945
+ const ret = preparedData.ethCallResults[key];
23946
+ if (ret) {
23947
+ const result = iface.decodeFunctionResult("transferFrom", ret).toArray();
23948
+ return result.length == 1 ? result[0] : result;
23949
+ }
23950
+ }
23951
+ return await this.contract.getFunction("transferFrom(address,address,uint256)").staticCall(sender, recipient, amount, overrides || {});
23952
+ } catch (e) {
23953
+ const stack = new Error().stack;
23954
+ throw transformEtherError(e, void 0, stack);
23955
+ }
23956
+ },
23957
+ async transferOwnership(newOwner, overrides, preparedData, ethCallContext) {
23958
+ try {
23959
+ if (preparedData?.ethCallResults && ethCallContext) {
23960
+ const iface = new Interface([
23961
+ "function transferOwnership(address) nonpayable returns ()"
23962
+ ]);
23963
+ const calldata = iface.encodeFunctionData("transferOwnership", [
23964
+ newOwner
23965
+ ]);
23966
+ const key = makeEthCallKey({
23967
+ context: ethCallContext,
23968
+ calldata
23969
+ });
23970
+ const ret = preparedData.ethCallResults[key];
23971
+ if (ret) {
23972
+ const result = iface.decodeFunctionResult("transferOwnership", ret).toArray();
23973
+ return result.length == 1 ? result[0] : result;
23974
+ }
23975
+ }
23976
+ return await this.contract.getFunction("transferOwnership(address)").staticCall(newOwner, overrides || {});
23977
+ } catch (e) {
23978
+ const stack = new Error().stack;
23979
+ throw transformEtherError(e, void 0, stack);
23980
+ }
23981
+ }
23982
+ };
23983
+ encodeCall = {
23984
+ allowance(owner, spender, ethCallContext) {
23985
+ try {
23986
+ const iface = new Interface(["function allowance(address,address)"]);
23987
+ const calldata = iface.encodeFunctionData("allowance", [
23988
+ owner,
23989
+ spender
23990
+ ]);
23991
+ return {
23992
+ context: ethCallContext,
23993
+ calldata
23994
+ };
23995
+ } catch (e) {
23996
+ const stack = new Error().stack;
23997
+ throw transformEtherError(e, void 0, stack);
23998
+ }
23999
+ },
24000
+ approve(spender, amount, ethCallContext) {
24001
+ try {
24002
+ const iface = new Interface(["function approve(address,uint256)"]);
24003
+ const calldata = iface.encodeFunctionData("approve", [spender, amount]);
24004
+ return {
24005
+ context: ethCallContext,
24006
+ calldata
24007
+ };
24008
+ } catch (e) {
24009
+ const stack = new Error().stack;
24010
+ throw transformEtherError(e, void 0, stack);
24011
+ }
24012
+ },
24013
+ balanceOf(account, ethCallContext) {
24014
+ try {
24015
+ const iface = new Interface(["function balanceOf(address)"]);
24016
+ const calldata = iface.encodeFunctionData("balanceOf", [account]);
24017
+ return {
24018
+ context: ethCallContext,
24019
+ calldata
24020
+ };
24021
+ } catch (e) {
24022
+ const stack = new Error().stack;
24023
+ throw transformEtherError(e, void 0, stack);
24024
+ }
24025
+ },
24026
+ burn(amount, ethCallContext) {
24027
+ try {
24028
+ const iface = new Interface(["function burn(uint256)"]);
24029
+ const calldata = iface.encodeFunctionData("burn", [amount]);
24030
+ return {
24031
+ context: ethCallContext,
24032
+ calldata
24033
+ };
24034
+ } catch (e) {
24035
+ const stack = new Error().stack;
24036
+ throw transformEtherError(e, void 0, stack);
24037
+ }
24038
+ },
24039
+ burnFrom(account, amount, ethCallContext) {
24040
+ try {
24041
+ const iface = new Interface(["function burnFrom(address,uint256)"]);
24042
+ const calldata = iface.encodeFunctionData("burnFrom", [
24043
+ account,
24044
+ amount
24045
+ ]);
24046
+ return {
24047
+ context: ethCallContext,
24048
+ calldata
24049
+ };
24050
+ } catch (e) {
24051
+ const stack = new Error().stack;
24052
+ throw transformEtherError(e, void 0, stack);
24053
+ }
24054
+ },
24055
+ decimals(ethCallContext) {
24056
+ try {
24057
+ const iface = new Interface(["function decimals()"]);
24058
+ const calldata = iface.encodeFunctionData("decimals", []);
24059
+ return {
24060
+ context: ethCallContext,
24061
+ calldata
24062
+ };
24063
+ } catch (e) {
24064
+ const stack = new Error().stack;
24065
+ throw transformEtherError(e, void 0, stack);
24066
+ }
24067
+ },
24068
+ decreaseAllowance(spender, subtractedValue, ethCallContext) {
24069
+ try {
24070
+ const iface = new Interface([
24071
+ "function decreaseAllowance(address,uint256)"
24072
+ ]);
24073
+ const calldata = iface.encodeFunctionData("decreaseAllowance", [
24074
+ spender,
24075
+ subtractedValue
24076
+ ]);
24077
+ return {
24078
+ context: ethCallContext,
24079
+ calldata
24080
+ };
24081
+ } catch (e) {
24082
+ const stack = new Error().stack;
24083
+ throw transformEtherError(e, void 0, stack);
24084
+ }
24085
+ },
24086
+ increaseAllowance(spender, addedValue, ethCallContext) {
24087
+ try {
24088
+ const iface = new Interface([
24089
+ "function increaseAllowance(address,uint256)"
24090
+ ]);
24091
+ const calldata = iface.encodeFunctionData("increaseAllowance", [
24092
+ spender,
24093
+ addedValue
24094
+ ]);
24095
+ return {
24096
+ context: ethCallContext,
24097
+ calldata
24098
+ };
24099
+ } catch (e) {
24100
+ const stack = new Error().stack;
24101
+ throw transformEtherError(e, void 0, stack);
24102
+ }
24103
+ },
24104
+ locker(ethCallContext) {
24105
+ try {
24106
+ const iface = new Interface(["function locker()"]);
24107
+ const calldata = iface.encodeFunctionData("locker", []);
24108
+ return {
24109
+ context: ethCallContext,
24110
+ calldata
24111
+ };
24112
+ } catch (e) {
24113
+ const stack = new Error().stack;
24114
+ throw transformEtherError(e, void 0, stack);
24115
+ }
24116
+ },
24117
+ name(ethCallContext) {
24118
+ try {
24119
+ const iface = new Interface(["function name()"]);
24120
+ const calldata = iface.encodeFunctionData("name", []);
24121
+ return {
24122
+ context: ethCallContext,
24123
+ calldata
24124
+ };
24125
+ } catch (e) {
24126
+ const stack = new Error().stack;
24127
+ throw transformEtherError(e, void 0, stack);
24128
+ }
24129
+ },
24130
+ owner(ethCallContext) {
24131
+ try {
24132
+ const iface = new Interface(["function owner()"]);
24133
+ const calldata = iface.encodeFunctionData("owner", []);
24134
+ return {
24135
+ context: ethCallContext,
24136
+ calldata
24137
+ };
24138
+ } catch (e) {
24139
+ const stack = new Error().stack;
24140
+ throw transformEtherError(e, void 0, stack);
24141
+ }
24142
+ },
24143
+ renounceOwnership(ethCallContext) {
24144
+ try {
24145
+ const iface = new Interface(["function renounceOwnership()"]);
24146
+ const calldata = iface.encodeFunctionData("renounceOwnership", []);
24147
+ return {
24148
+ context: ethCallContext,
24149
+ calldata
24150
+ };
24151
+ } catch (e) {
24152
+ const stack = new Error().stack;
24153
+ throw transformEtherError(e, void 0, stack);
24154
+ }
24155
+ },
24156
+ setLocker(_locker, ethCallContext) {
24157
+ try {
24158
+ const iface = new Interface(["function setLocker(address)"]);
24159
+ const calldata = iface.encodeFunctionData("setLocker", [_locker]);
24160
+ return {
24161
+ context: ethCallContext,
24162
+ calldata
24163
+ };
24164
+ } catch (e) {
24165
+ const stack = new Error().stack;
24166
+ throw transformEtherError(e, void 0, stack);
24167
+ }
24168
+ },
24169
+ symbol(ethCallContext) {
24170
+ try {
24171
+ const iface = new Interface(["function symbol()"]);
24172
+ const calldata = iface.encodeFunctionData("symbol", []);
24173
+ return {
24174
+ context: ethCallContext,
24175
+ calldata
24176
+ };
24177
+ } catch (e) {
24178
+ const stack = new Error().stack;
24179
+ throw transformEtherError(e, void 0, stack);
24180
+ }
24181
+ },
24182
+ totalSupply(ethCallContext) {
24183
+ try {
24184
+ const iface = new Interface(["function totalSupply()"]);
24185
+ const calldata = iface.encodeFunctionData("totalSupply", []);
24186
+ return {
24187
+ context: ethCallContext,
24188
+ calldata
24189
+ };
24190
+ } catch (e) {
24191
+ const stack = new Error().stack;
24192
+ throw transformEtherError(e, void 0, stack);
24193
+ }
24194
+ },
24195
+ transfer(recipient, amount, ethCallContext) {
23666
24196
  try {
23667
- return await this.contract.getFunction("transfer(address,uint256)").staticCall(recipient, amount, overrides || {});
24197
+ const iface = new Interface(["function transfer(address,uint256)"]);
24198
+ const calldata = iface.encodeFunctionData("transfer", [
24199
+ recipient,
24200
+ amount
24201
+ ]);
24202
+ return {
24203
+ context: ethCallContext,
24204
+ calldata
24205
+ };
23668
24206
  } catch (e) {
23669
24207
  const stack = new Error().stack;
23670
24208
  throw transformEtherError(e, void 0, stack);
23671
24209
  }
23672
24210
  },
23673
- async transferFrom(sender, recipient, amount, overrides) {
24211
+ transferFrom(sender, recipient, amount, ethCallContext) {
23674
24212
  try {
23675
- return await this.contract.getFunction("transferFrom(address,address,uint256)").staticCall(sender, recipient, amount, overrides || {});
24213
+ const iface = new Interface([
24214
+ "function transferFrom(address,address,uint256)"
24215
+ ]);
24216
+ const calldata = iface.encodeFunctionData("transferFrom", [
24217
+ sender,
24218
+ recipient,
24219
+ amount
24220
+ ]);
24221
+ return {
24222
+ context: ethCallContext,
24223
+ calldata
24224
+ };
23676
24225
  } catch (e) {
23677
24226
  const stack = new Error().stack;
23678
24227
  throw transformEtherError(e, void 0, stack);
23679
24228
  }
23680
24229
  },
23681
- async transferOwnership(newOwner, overrides) {
24230
+ transferOwnership(newOwner, ethCallContext) {
23682
24231
  try {
23683
- return await this.contract.getFunction("transferOwnership(address)").staticCall(newOwner, overrides || {});
24232
+ const iface = new Interface(["function transferOwnership(address)"]);
24233
+ const calldata = iface.encodeFunctionData("transferOwnership", [
24234
+ newOwner
24235
+ ]);
24236
+ return {
24237
+ context: ethCallContext,
24238
+ calldata
24239
+ };
23684
24240
  } catch (e) {
23685
24241
  const stack = new Error().stack;
23686
24242
  throw transformEtherError(e, void 0, stack);
@@ -23690,109 +24246,269 @@ var ERC20ContractView = class extends ContractView {
23690
24246
  };
23691
24247
  var ERC20BoundContractView = class extends BoundContractView {
23692
24248
  async allowance(owner, spender, overrides) {
23693
- return await this.view.allowance(owner, spender, {
23694
- blockTag: this.context.blockNumber,
23695
- ...overrides
23696
- });
24249
+ const ethCallContext = {
24250
+ chainId: this.context.chainId,
24251
+ blockTag: this.context.blockNumber.toString(16),
24252
+ address: this.context.address
24253
+ };
24254
+ return await this.view.allowance(
24255
+ owner,
24256
+ spender,
24257
+ {
24258
+ blockTag: this.context.blockNumber,
24259
+ ...overrides
24260
+ },
24261
+ this.context.preparedData,
24262
+ ethCallContext
24263
+ );
23697
24264
  }
23698
24265
  async balanceOf(account, overrides) {
23699
- return await this.view.balanceOf(account, {
23700
- blockTag: this.context.blockNumber,
23701
- ...overrides
23702
- });
24266
+ const ethCallContext = {
24267
+ chainId: this.context.chainId,
24268
+ blockTag: this.context.blockNumber.toString(16),
24269
+ address: this.context.address
24270
+ };
24271
+ return await this.view.balanceOf(
24272
+ account,
24273
+ {
24274
+ blockTag: this.context.blockNumber,
24275
+ ...overrides
24276
+ },
24277
+ this.context.preparedData,
24278
+ ethCallContext
24279
+ );
23703
24280
  }
23704
24281
  async decimals(overrides) {
23705
- return await this.view.decimals({
23706
- blockTag: this.context.blockNumber,
23707
- ...overrides
23708
- });
24282
+ const ethCallContext = {
24283
+ chainId: this.context.chainId,
24284
+ blockTag: this.context.blockNumber.toString(16),
24285
+ address: this.context.address
24286
+ };
24287
+ return await this.view.decimals(
24288
+ {
24289
+ blockTag: this.context.blockNumber,
24290
+ ...overrides
24291
+ },
24292
+ this.context.preparedData,
24293
+ ethCallContext
24294
+ );
23709
24295
  }
23710
24296
  async locker(overrides) {
23711
- return await this.view.locker({
23712
- blockTag: this.context.blockNumber,
23713
- ...overrides
23714
- });
24297
+ const ethCallContext = {
24298
+ chainId: this.context.chainId,
24299
+ blockTag: this.context.blockNumber.toString(16),
24300
+ address: this.context.address
24301
+ };
24302
+ return await this.view.locker(
24303
+ {
24304
+ blockTag: this.context.blockNumber,
24305
+ ...overrides
24306
+ },
24307
+ this.context.preparedData,
24308
+ ethCallContext
24309
+ );
23715
24310
  }
23716
24311
  async name(overrides) {
23717
- return await this.view.name({
23718
- blockTag: this.context.blockNumber,
23719
- ...overrides
23720
- });
24312
+ const ethCallContext = {
24313
+ chainId: this.context.chainId,
24314
+ blockTag: this.context.blockNumber.toString(16),
24315
+ address: this.context.address
24316
+ };
24317
+ return await this.view.name(
24318
+ {
24319
+ blockTag: this.context.blockNumber,
24320
+ ...overrides
24321
+ },
24322
+ this.context.preparedData,
24323
+ ethCallContext
24324
+ );
23721
24325
  }
23722
24326
  async owner(overrides) {
23723
- return await this.view.owner({
23724
- blockTag: this.context.blockNumber,
23725
- ...overrides
23726
- });
24327
+ const ethCallContext = {
24328
+ chainId: this.context.chainId,
24329
+ blockTag: this.context.blockNumber.toString(16),
24330
+ address: this.context.address
24331
+ };
24332
+ return await this.view.owner(
24333
+ {
24334
+ blockTag: this.context.blockNumber,
24335
+ ...overrides
24336
+ },
24337
+ this.context.preparedData,
24338
+ ethCallContext
24339
+ );
23727
24340
  }
23728
24341
  async symbol(overrides) {
23729
- return await this.view.symbol({
23730
- blockTag: this.context.blockNumber,
23731
- ...overrides
23732
- });
24342
+ const ethCallContext = {
24343
+ chainId: this.context.chainId,
24344
+ blockTag: this.context.blockNumber.toString(16),
24345
+ address: this.context.address
24346
+ };
24347
+ return await this.view.symbol(
24348
+ {
24349
+ blockTag: this.context.blockNumber,
24350
+ ...overrides
24351
+ },
24352
+ this.context.preparedData,
24353
+ ethCallContext
24354
+ );
23733
24355
  }
23734
24356
  async totalSupply(overrides) {
23735
- return await this.view.totalSupply({
23736
- blockTag: this.context.blockNumber,
23737
- ...overrides
23738
- });
24357
+ const ethCallContext = {
24358
+ chainId: this.context.chainId,
24359
+ blockTag: this.context.blockNumber.toString(16),
24360
+ address: this.context.address
24361
+ };
24362
+ return await this.view.totalSupply(
24363
+ {
24364
+ blockTag: this.context.blockNumber,
24365
+ ...overrides
24366
+ },
24367
+ this.context.preparedData,
24368
+ ethCallContext
24369
+ );
23739
24370
  }
23740
24371
  callStatic = {
23741
24372
  view: this.view,
23742
24373
  context: this.context,
23743
24374
  async approve(spender, amount, overrides) {
23744
- return await this.view.callStatic.approve(spender, amount, {
23745
- blockTag: this.context.blockNumber,
23746
- ...overrides
23747
- });
24375
+ const ethCallContext = {
24376
+ chainId: this.context.chainId,
24377
+ blockTag: this.context.blockNumber.toString(16),
24378
+ address: this.context.address
24379
+ };
24380
+ return await this.view.callStatic.approve(
24381
+ spender,
24382
+ amount,
24383
+ {
24384
+ blockTag: this.context.blockNumber,
24385
+ ...overrides
24386
+ },
24387
+ this.context.preparedData,
24388
+ ethCallContext
24389
+ );
23748
24390
  },
23749
24391
  async burn(amount, overrides) {
23750
- return await this.view.callStatic.burn(amount, {
23751
- blockTag: this.context.blockNumber,
23752
- ...overrides
23753
- });
24392
+ const ethCallContext = {
24393
+ chainId: this.context.chainId,
24394
+ blockTag: this.context.blockNumber.toString(16),
24395
+ address: this.context.address
24396
+ };
24397
+ return await this.view.callStatic.burn(
24398
+ amount,
24399
+ {
24400
+ blockTag: this.context.blockNumber,
24401
+ ...overrides
24402
+ },
24403
+ this.context.preparedData,
24404
+ ethCallContext
24405
+ );
23754
24406
  },
23755
24407
  async burnFrom(account, amount, overrides) {
23756
- return await this.view.callStatic.burnFrom(account, amount, {
23757
- blockTag: this.context.blockNumber,
23758
- ...overrides
23759
- });
24408
+ const ethCallContext = {
24409
+ chainId: this.context.chainId,
24410
+ blockTag: this.context.blockNumber.toString(16),
24411
+ address: this.context.address
24412
+ };
24413
+ return await this.view.callStatic.burnFrom(
24414
+ account,
24415
+ amount,
24416
+ {
24417
+ blockTag: this.context.blockNumber,
24418
+ ...overrides
24419
+ },
24420
+ this.context.preparedData,
24421
+ ethCallContext
24422
+ );
23760
24423
  },
23761
24424
  async decreaseAllowance(spender, subtractedValue, overrides) {
24425
+ const ethCallContext = {
24426
+ chainId: this.context.chainId,
24427
+ blockTag: this.context.blockNumber.toString(16),
24428
+ address: this.context.address
24429
+ };
23762
24430
  return await this.view.callStatic.decreaseAllowance(
23763
24431
  spender,
23764
24432
  subtractedValue,
23765
24433
  {
23766
24434
  blockTag: this.context.blockNumber,
23767
24435
  ...overrides
23768
- }
24436
+ },
24437
+ this.context.preparedData,
24438
+ ethCallContext
23769
24439
  );
23770
24440
  },
23771
24441
  async increaseAllowance(spender, addedValue, overrides) {
23772
- return await this.view.callStatic.increaseAllowance(spender, addedValue, {
23773
- blockTag: this.context.blockNumber,
23774
- ...overrides
23775
- });
24442
+ const ethCallContext = {
24443
+ chainId: this.context.chainId,
24444
+ blockTag: this.context.blockNumber.toString(16),
24445
+ address: this.context.address
24446
+ };
24447
+ return await this.view.callStatic.increaseAllowance(
24448
+ spender,
24449
+ addedValue,
24450
+ {
24451
+ blockTag: this.context.blockNumber,
24452
+ ...overrides
24453
+ },
24454
+ this.context.preparedData,
24455
+ ethCallContext
24456
+ );
23776
24457
  },
23777
24458
  async renounceOwnership(overrides) {
23778
- return await this.view.callStatic.renounceOwnership({
23779
- blockTag: this.context.blockNumber,
23780
- ...overrides
23781
- });
24459
+ const ethCallContext = {
24460
+ chainId: this.context.chainId,
24461
+ blockTag: this.context.blockNumber.toString(16),
24462
+ address: this.context.address
24463
+ };
24464
+ return await this.view.callStatic.renounceOwnership(
24465
+ {
24466
+ blockTag: this.context.blockNumber,
24467
+ ...overrides
24468
+ },
24469
+ this.context.preparedData,
24470
+ ethCallContext
24471
+ );
23782
24472
  },
23783
24473
  async setLocker(_locker, overrides) {
23784
- return await this.view.callStatic.setLocker(_locker, {
23785
- blockTag: this.context.blockNumber,
23786
- ...overrides
23787
- });
24474
+ const ethCallContext = {
24475
+ chainId: this.context.chainId,
24476
+ blockTag: this.context.blockNumber.toString(16),
24477
+ address: this.context.address
24478
+ };
24479
+ return await this.view.callStatic.setLocker(
24480
+ _locker,
24481
+ {
24482
+ blockTag: this.context.blockNumber,
24483
+ ...overrides
24484
+ },
24485
+ this.context.preparedData,
24486
+ ethCallContext
24487
+ );
23788
24488
  },
23789
24489
  async transfer(recipient, amount, overrides) {
23790
- return await this.view.callStatic.transfer(recipient, amount, {
23791
- blockTag: this.context.blockNumber,
23792
- ...overrides
23793
- });
24490
+ const ethCallContext = {
24491
+ chainId: this.context.chainId,
24492
+ blockTag: this.context.blockNumber.toString(16),
24493
+ address: this.context.address
24494
+ };
24495
+ return await this.view.callStatic.transfer(
24496
+ recipient,
24497
+ amount,
24498
+ {
24499
+ blockTag: this.context.blockNumber,
24500
+ ...overrides
24501
+ },
24502
+ this.context.preparedData,
24503
+ ethCallContext
24504
+ );
23794
24505
  },
23795
24506
  async transferFrom(sender, recipient, amount, overrides) {
24507
+ const ethCallContext = {
24508
+ chainId: this.context.chainId,
24509
+ blockTag: this.context.blockNumber.toString(16),
24510
+ address: this.context.address
24511
+ };
23796
24512
  return await this.view.callStatic.transferFrom(
23797
24513
  sender,
23798
24514
  recipient,
@@ -23800,13 +24516,181 @@ var ERC20BoundContractView = class extends BoundContractView {
23800
24516
  {
23801
24517
  blockTag: this.context.blockNumber,
23802
24518
  ...overrides
23803
- }
24519
+ },
24520
+ this.context.preparedData,
24521
+ ethCallContext
23804
24522
  );
23805
24523
  },
23806
24524
  async transferOwnership(newOwner, overrides) {
23807
- return await this.view.callStatic.transferOwnership(newOwner, {
23808
- blockTag: this.context.blockNumber,
23809
- ...overrides
24525
+ const ethCallContext = {
24526
+ chainId: this.context.chainId,
24527
+ blockTag: this.context.blockNumber.toString(16),
24528
+ address: this.context.address
24529
+ };
24530
+ return await this.view.callStatic.transferOwnership(
24531
+ newOwner,
24532
+ {
24533
+ blockTag: this.context.blockNumber,
24534
+ ...overrides
24535
+ },
24536
+ this.context.preparedData,
24537
+ ethCallContext
24538
+ );
24539
+ }
24540
+ };
24541
+ encodeCall = {
24542
+ view: this.view,
24543
+ context: this.context,
24544
+ allowance(owner, spender, overrides) {
24545
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24546
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24547
+ const address = this.context.address;
24548
+ return this.view.encodeCall.allowance(owner, spender, {
24549
+ chainId,
24550
+ address,
24551
+ blockTag
24552
+ });
24553
+ },
24554
+ approve(spender, amount, overrides) {
24555
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24556
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24557
+ const address = this.context.address;
24558
+ return this.view.encodeCall.approve(spender, amount, {
24559
+ chainId,
24560
+ address,
24561
+ blockTag
24562
+ });
24563
+ },
24564
+ balanceOf(account, overrides) {
24565
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24566
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24567
+ const address = this.context.address;
24568
+ return this.view.encodeCall.balanceOf(account, {
24569
+ chainId,
24570
+ address,
24571
+ blockTag
24572
+ });
24573
+ },
24574
+ burn(amount, overrides) {
24575
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24576
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24577
+ const address = this.context.address;
24578
+ return this.view.encodeCall.burn(amount, { chainId, address, blockTag });
24579
+ },
24580
+ burnFrom(account, amount, overrides) {
24581
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24582
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24583
+ const address = this.context.address;
24584
+ return this.view.encodeCall.burnFrom(account, amount, {
24585
+ chainId,
24586
+ address,
24587
+ blockTag
24588
+ });
24589
+ },
24590
+ decimals(overrides) {
24591
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24592
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24593
+ const address = this.context.address;
24594
+ return this.view.encodeCall.decimals({ chainId, address, blockTag });
24595
+ },
24596
+ decreaseAllowance(spender, subtractedValue, overrides) {
24597
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24598
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24599
+ const address = this.context.address;
24600
+ return this.view.encodeCall.decreaseAllowance(spender, subtractedValue, {
24601
+ chainId,
24602
+ address,
24603
+ blockTag
24604
+ });
24605
+ },
24606
+ increaseAllowance(spender, addedValue, overrides) {
24607
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24608
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24609
+ const address = this.context.address;
24610
+ return this.view.encodeCall.increaseAllowance(spender, addedValue, {
24611
+ chainId,
24612
+ address,
24613
+ blockTag
24614
+ });
24615
+ },
24616
+ locker(overrides) {
24617
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24618
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24619
+ const address = this.context.address;
24620
+ return this.view.encodeCall.locker({ chainId, address, blockTag });
24621
+ },
24622
+ name(overrides) {
24623
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24624
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24625
+ const address = this.context.address;
24626
+ return this.view.encodeCall.name({ chainId, address, blockTag });
24627
+ },
24628
+ owner(overrides) {
24629
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24630
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24631
+ const address = this.context.address;
24632
+ return this.view.encodeCall.owner({ chainId, address, blockTag });
24633
+ },
24634
+ renounceOwnership(overrides) {
24635
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24636
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24637
+ const address = this.context.address;
24638
+ return this.view.encodeCall.renounceOwnership({
24639
+ chainId,
24640
+ address,
24641
+ blockTag
24642
+ });
24643
+ },
24644
+ setLocker(_locker, overrides) {
24645
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24646
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24647
+ const address = this.context.address;
24648
+ return this.view.encodeCall.setLocker(_locker, {
24649
+ chainId,
24650
+ address,
24651
+ blockTag
24652
+ });
24653
+ },
24654
+ symbol(overrides) {
24655
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24656
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24657
+ const address = this.context.address;
24658
+ return this.view.encodeCall.symbol({ chainId, address, blockTag });
24659
+ },
24660
+ totalSupply(overrides) {
24661
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24662
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24663
+ const address = this.context.address;
24664
+ return this.view.encodeCall.totalSupply({ chainId, address, blockTag });
24665
+ },
24666
+ transfer(recipient, amount, overrides) {
24667
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24668
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24669
+ const address = this.context.address;
24670
+ return this.view.encodeCall.transfer(recipient, amount, {
24671
+ chainId,
24672
+ address,
24673
+ blockTag
24674
+ });
24675
+ },
24676
+ transferFrom(sender, recipient, amount, overrides) {
24677
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24678
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24679
+ const address = this.context.address;
24680
+ return this.view.encodeCall.transferFrom(sender, recipient, amount, {
24681
+ chainId,
24682
+ address,
24683
+ blockTag
24684
+ });
24685
+ },
24686
+ transferOwnership(newOwner, overrides) {
24687
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
24688
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
24689
+ const address = this.context.address;
24690
+ return this.view.encodeCall.transferOwnership(newOwner, {
24691
+ chainId,
24692
+ address,
24693
+ blockTag
23810
24694
  });
23811
24695
  }
23812
24696
  };
@@ -24662,7 +25546,7 @@ var EthPlugin = class extends Plugin {
24662
25546
  const promises = [];
24663
25547
  for (const handlerId of request.handlerIds) {
24664
25548
  const handler = this.handlers.eventHandlers[handlerId];
24665
- const promise = handler(ethLog).catch((e) => {
25549
+ const promise = handler(ethLog, preparedData).catch((e) => {
24666
25550
  throw new import_nice_grpc3.ServerError(
24667
25551
  import_nice_grpc3.Status.INTERNAL,
24668
25552
  "error processing log: " + JSON.stringify(ethLog.log) + "\n" + errorString(e)
@@ -24682,7 +25566,7 @@ var EthPlugin = class extends Plugin {
24682
25566
  const ethTrace = binding.data.ethTrace;
24683
25567
  const promises = [];
24684
25568
  for (const handlerId of binding.handlerIds) {
24685
- const promise = this.handlers.traceHandlers[handlerId](ethTrace).catch((e) => {
25569
+ const promise = this.handlers.traceHandlers[handlerId](ethTrace, preparedData).catch((e) => {
24686
25570
  throw new import_nice_grpc3.ServerError(
24687
25571
  import_nice_grpc3.Status.INTERNAL,
24688
25572
  "error processing trace: " + JSON.stringify(ethTrace.trace) + "\n" + errorString(e)
@@ -24702,7 +25586,7 @@ var EthPlugin = class extends Plugin {
24702
25586
  const ethBlock = binding.data.ethBlock;
24703
25587
  const promises = [];
24704
25588
  for (const handlerId of binding.handlerIds) {
24705
- const promise = this.handlers.blockHandlers[handlerId](ethBlock).catch((e) => {
25589
+ const promise = this.handlers.blockHandlers[handlerId](ethBlock, preparedData).catch((e) => {
24706
25590
  throw new import_nice_grpc3.ServerError(
24707
25591
  import_nice_grpc3.Status.INTERNAL,
24708
25592
  "error processing block: " + ethBlock.block?.number + "\n" + errorString(e)
@@ -24722,7 +25606,7 @@ var EthPlugin = class extends Plugin {
24722
25606
  const ethTransaction = binding.data.ethTransaction;
24723
25607
  const promises = [];
24724
25608
  for (const handlerId of binding.handlerIds) {
24725
- const promise = this.handlers.transactionHandlers[handlerId](ethTransaction).catch((e) => {
25609
+ const promise = this.handlers.transactionHandlers[handlerId](ethTransaction, preparedData).catch((e) => {
24726
25610
  throw new import_nice_grpc3.ServerError(
24727
25611
  import_nice_grpc3.Status.INTERNAL,
24728
25612
  "error processing transaction: " + JSON.stringify(ethTransaction.transaction) + "\n" + errorString(e)
@@ -24763,16 +25647,46 @@ var ERC721ContractView = class extends ContractView {
24763
25647
  super(contract);
24764
25648
  this.callStatic.contract = contract;
24765
25649
  }
24766
- async totalSupply(overrides) {
25650
+ async totalSupply(overrides, preparedData, ethCallContext) {
24767
25651
  try {
25652
+ if (preparedData?.ethCallResults && ethCallContext) {
25653
+ const iface = new Interface([
25654
+ "function totalSupply() view returns (uint256)"
25655
+ ]);
25656
+ const calldata = iface.encodeFunctionData("totalSupply", []);
25657
+ const key = makeEthCallKey({
25658
+ context: ethCallContext,
25659
+ calldata
25660
+ });
25661
+ const ret = preparedData.ethCallResults[key];
25662
+ if (ret) {
25663
+ const result = iface.decodeFunctionResult("totalSupply", ret).toArray();
25664
+ return result.length == 1 ? result[0] : result;
25665
+ }
25666
+ }
24768
25667
  return await this.contract.getFunction("totalSupply()")(overrides || {});
24769
25668
  } catch (e) {
24770
25669
  const stack = new Error().stack;
24771
25670
  throw transformEtherError(e, void 0, stack);
24772
25671
  }
24773
25672
  }
24774
- async balanceOf(owner, overrides) {
25673
+ async balanceOf(owner, overrides, preparedData, ethCallContext) {
24775
25674
  try {
25675
+ if (preparedData?.ethCallResults && ethCallContext) {
25676
+ const iface = new Interface([
25677
+ "function balanceOf(address) view returns (uint256)"
25678
+ ]);
25679
+ const calldata = iface.encodeFunctionData("balanceOf", [owner]);
25680
+ const key = makeEthCallKey({
25681
+ context: ethCallContext,
25682
+ calldata
25683
+ });
25684
+ const ret = preparedData.ethCallResults[key];
25685
+ if (ret) {
25686
+ const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
25687
+ return result.length == 1 ? result[0] : result;
25688
+ }
25689
+ }
24776
25690
  return await this.contract.getFunction("balanceOf(address)")(
24777
25691
  owner,
24778
25692
  overrides || {}
@@ -24782,8 +25696,23 @@ var ERC721ContractView = class extends ContractView {
24782
25696
  throw transformEtherError(e, void 0, stack);
24783
25697
  }
24784
25698
  }
24785
- async getApproved(tokenId, overrides) {
25699
+ async getApproved(tokenId, overrides, preparedData, ethCallContext) {
24786
25700
  try {
25701
+ if (preparedData?.ethCallResults && ethCallContext) {
25702
+ const iface = new Interface([
25703
+ "function getApproved(uint256) view returns (address)"
25704
+ ]);
25705
+ const calldata = iface.encodeFunctionData("getApproved", [tokenId]);
25706
+ const key = makeEthCallKey({
25707
+ context: ethCallContext,
25708
+ calldata
25709
+ });
25710
+ const ret = preparedData.ethCallResults[key];
25711
+ if (ret) {
25712
+ const result = iface.decodeFunctionResult("getApproved", ret).toArray();
25713
+ return result.length == 1 ? result[0] : result;
25714
+ }
25715
+ }
24787
25716
  return await this.contract.getFunction("getApproved(uint256)")(
24788
25717
  tokenId,
24789
25718
  overrides || {}
@@ -24793,8 +25722,26 @@ var ERC721ContractView = class extends ContractView {
24793
25722
  throw transformEtherError(e, void 0, stack);
24794
25723
  }
24795
25724
  }
24796
- async isApprovedForAll(owner, operator, overrides) {
25725
+ async isApprovedForAll(owner, operator, overrides, preparedData, ethCallContext) {
24797
25726
  try {
25727
+ if (preparedData?.ethCallResults && ethCallContext) {
25728
+ const iface = new Interface([
25729
+ "function isApprovedForAll(address,address) view returns (bool)"
25730
+ ]);
25731
+ const calldata = iface.encodeFunctionData("isApprovedForAll", [
25732
+ owner,
25733
+ operator
25734
+ ]);
25735
+ const key = makeEthCallKey({
25736
+ context: ethCallContext,
25737
+ calldata
25738
+ });
25739
+ const ret = preparedData.ethCallResults[key];
25740
+ if (ret) {
25741
+ const result = iface.decodeFunctionResult("isApprovedForAll", ret).toArray();
25742
+ return result.length == 1 ? result[0] : result;
25743
+ }
25744
+ }
24798
25745
  return await this.contract.getFunction(
24799
25746
  "isApprovedForAll(address,address)"
24800
25747
  )(owner, operator, overrides || {});
@@ -24803,16 +25750,44 @@ var ERC721ContractView = class extends ContractView {
24803
25750
  throw transformEtherError(e, void 0, stack);
24804
25751
  }
24805
25752
  }
24806
- async name(overrides) {
25753
+ async name(overrides, preparedData, ethCallContext) {
24807
25754
  try {
25755
+ if (preparedData?.ethCallResults && ethCallContext) {
25756
+ const iface = new Interface(["function name() view returns (string)"]);
25757
+ const calldata = iface.encodeFunctionData("name", []);
25758
+ const key = makeEthCallKey({
25759
+ context: ethCallContext,
25760
+ calldata
25761
+ });
25762
+ const ret = preparedData.ethCallResults[key];
25763
+ if (ret) {
25764
+ const result = iface.decodeFunctionResult("name", ret).toArray();
25765
+ return result.length == 1 ? result[0] : result;
25766
+ }
25767
+ }
24808
25768
  return await this.contract.getFunction("name()")(overrides || {});
24809
25769
  } catch (e) {
24810
25770
  const stack = new Error().stack;
24811
25771
  throw transformEtherError(e, void 0, stack);
24812
25772
  }
24813
25773
  }
24814
- async ownerOf(tokenId, overrides) {
25774
+ async ownerOf(tokenId, overrides, preparedData, ethCallContext) {
24815
25775
  try {
25776
+ if (preparedData?.ethCallResults && ethCallContext) {
25777
+ const iface = new Interface([
25778
+ "function ownerOf(uint256) view returns (address)"
25779
+ ]);
25780
+ const calldata = iface.encodeFunctionData("ownerOf", [tokenId]);
25781
+ const key = makeEthCallKey({
25782
+ context: ethCallContext,
25783
+ calldata
25784
+ });
25785
+ const ret = preparedData.ethCallResults[key];
25786
+ if (ret) {
25787
+ const result = iface.decodeFunctionResult("ownerOf", ret).toArray();
25788
+ return result.length == 1 ? result[0] : result;
25789
+ }
25790
+ }
24816
25791
  return await this.contract.getFunction("ownerOf(uint256)")(
24817
25792
  tokenId,
24818
25793
  overrides || {}
@@ -24822,8 +25797,25 @@ var ERC721ContractView = class extends ContractView {
24822
25797
  throw transformEtherError(e, void 0, stack);
24823
25798
  }
24824
25799
  }
24825
- async supportsInterface(interfaceId, overrides) {
25800
+ async supportsInterface(interfaceId, overrides, preparedData, ethCallContext) {
24826
25801
  try {
25802
+ if (preparedData?.ethCallResults && ethCallContext) {
25803
+ const iface = new Interface([
25804
+ "function supportsInterface(bytes4) view returns (bool)"
25805
+ ]);
25806
+ const calldata = iface.encodeFunctionData("supportsInterface", [
25807
+ interfaceId
25808
+ ]);
25809
+ const key = makeEthCallKey({
25810
+ context: ethCallContext,
25811
+ calldata
25812
+ });
25813
+ const ret = preparedData.ethCallResults[key];
25814
+ if (ret) {
25815
+ const result = iface.decodeFunctionResult("supportsInterface", ret).toArray();
25816
+ return result.length == 1 ? result[0] : result;
25817
+ }
25818
+ }
24827
25819
  return await this.contract.getFunction("supportsInterface(bytes4)")(
24828
25820
  interfaceId,
24829
25821
  overrides || {}
@@ -24833,16 +25825,46 @@ var ERC721ContractView = class extends ContractView {
24833
25825
  throw transformEtherError(e, void 0, stack);
24834
25826
  }
24835
25827
  }
24836
- async symbol(overrides) {
25828
+ async symbol(overrides, preparedData, ethCallContext) {
24837
25829
  try {
25830
+ if (preparedData?.ethCallResults && ethCallContext) {
25831
+ const iface = new Interface([
25832
+ "function symbol() view returns (string)"
25833
+ ]);
25834
+ const calldata = iface.encodeFunctionData("symbol", []);
25835
+ const key = makeEthCallKey({
25836
+ context: ethCallContext,
25837
+ calldata
25838
+ });
25839
+ const ret = preparedData.ethCallResults[key];
25840
+ if (ret) {
25841
+ const result = iface.decodeFunctionResult("symbol", ret).toArray();
25842
+ return result.length == 1 ? result[0] : result;
25843
+ }
25844
+ }
24838
25845
  return await this.contract.getFunction("symbol()")(overrides || {});
24839
25846
  } catch (e) {
24840
25847
  const stack = new Error().stack;
24841
25848
  throw transformEtherError(e, void 0, stack);
24842
25849
  }
24843
25850
  }
24844
- async tokenURI(tokenId, overrides) {
25851
+ async tokenURI(tokenId, overrides, preparedData, ethCallContext) {
24845
25852
  try {
25853
+ if (preparedData?.ethCallResults && ethCallContext) {
25854
+ const iface = new Interface([
25855
+ "function tokenURI(uint256) view returns (string)"
25856
+ ]);
25857
+ const calldata = iface.encodeFunctionData("tokenURI", [tokenId]);
25858
+ const key = makeEthCallKey({
25859
+ context: ethCallContext,
25860
+ calldata
25861
+ });
25862
+ const ret = preparedData.ethCallResults[key];
25863
+ if (ret) {
25864
+ const result = iface.decodeFunctionResult("tokenURI", ret).toArray();
25865
+ return result.length == 1 ? result[0] : result;
25866
+ }
25867
+ }
24846
25868
  return await this.contract.getFunction("tokenURI(uint256)")(
24847
25869
  tokenId,
24848
25870
  overrides || {}
@@ -24851,44 +25873,350 @@ var ERC721ContractView = class extends ContractView {
24851
25873
  const stack = new Error().stack;
24852
25874
  throw transformEtherError(e, void 0, stack);
24853
25875
  }
24854
- }
24855
- callStatic = {
24856
- contract: this.contract,
24857
- async approve(to, tokenId, overrides) {
25876
+ }
25877
+ callStatic = {
25878
+ contract: this.contract,
25879
+ async approve(to, tokenId, overrides, preparedData, ethCallContext) {
25880
+ try {
25881
+ if (preparedData?.ethCallResults && ethCallContext) {
25882
+ const iface = new Interface([
25883
+ "function approve(address,uint256) nonpayable returns ()"
25884
+ ]);
25885
+ const calldata = iface.encodeFunctionData("approve", [to, tokenId]);
25886
+ const key = makeEthCallKey({
25887
+ context: ethCallContext,
25888
+ calldata
25889
+ });
25890
+ const ret = preparedData.ethCallResults[key];
25891
+ if (ret) {
25892
+ const result = iface.decodeFunctionResult("approve", ret).toArray();
25893
+ return result.length == 1 ? result[0] : result;
25894
+ }
25895
+ }
25896
+ return await this.contract.getFunction("approve(address,uint256)").staticCall(to, tokenId, overrides || {});
25897
+ } catch (e) {
25898
+ const stack = new Error().stack;
25899
+ throw transformEtherError(e, void 0, stack);
25900
+ }
25901
+ },
25902
+ async safeTransferFrom_address_address_uint256(from, to, tokenId, overrides, preparedData, ethCallContext) {
25903
+ try {
25904
+ if (preparedData?.ethCallResults && ethCallContext) {
25905
+ const iface = new Interface([
25906
+ "function safeTransferFrom(address,address,uint256) nonpayable returns ()"
25907
+ ]);
25908
+ const calldata = iface.encodeFunctionData("safeTransferFrom", [
25909
+ from,
25910
+ to,
25911
+ tokenId
25912
+ ]);
25913
+ const key = makeEthCallKey({
25914
+ context: ethCallContext,
25915
+ calldata
25916
+ });
25917
+ const ret = preparedData.ethCallResults[key];
25918
+ if (ret) {
25919
+ const result = iface.decodeFunctionResult("safeTransferFrom", ret).toArray();
25920
+ return result.length == 1 ? result[0] : result;
25921
+ }
25922
+ }
25923
+ return await this.contract.getFunction("safeTransferFrom(address,address,uint256)").staticCall(from, to, tokenId, overrides || {});
25924
+ } catch (e) {
25925
+ const stack = new Error().stack;
25926
+ throw transformEtherError(e, void 0, stack);
25927
+ }
25928
+ },
25929
+ async safeTransferFrom_address_address_uint256_bytes(from, to, tokenId, data, overrides, preparedData, ethCallContext) {
25930
+ try {
25931
+ if (preparedData?.ethCallResults && ethCallContext) {
25932
+ const iface = new Interface([
25933
+ "function safeTransferFrom(address,address,uint256,bytes) nonpayable returns ()"
25934
+ ]);
25935
+ const calldata = iface.encodeFunctionData("safeTransferFrom", [
25936
+ from,
25937
+ to,
25938
+ tokenId,
25939
+ data
25940
+ ]);
25941
+ const key = makeEthCallKey({
25942
+ context: ethCallContext,
25943
+ calldata
25944
+ });
25945
+ const ret = preparedData.ethCallResults[key];
25946
+ if (ret) {
25947
+ const result = iface.decodeFunctionResult("safeTransferFrom", ret).toArray();
25948
+ return result.length == 1 ? result[0] : result;
25949
+ }
25950
+ }
25951
+ return await this.contract.getFunction("safeTransferFrom(address,address,uint256,bytes)").staticCall(from, to, tokenId, data, overrides || {});
25952
+ } catch (e) {
25953
+ const stack = new Error().stack;
25954
+ throw transformEtherError(e, void 0, stack);
25955
+ }
25956
+ },
25957
+ async setApprovalForAll(operator, _approved, overrides, preparedData, ethCallContext) {
25958
+ try {
25959
+ if (preparedData?.ethCallResults && ethCallContext) {
25960
+ const iface = new Interface([
25961
+ "function setApprovalForAll(address,bool) nonpayable returns ()"
25962
+ ]);
25963
+ const calldata = iface.encodeFunctionData("setApprovalForAll", [
25964
+ operator,
25965
+ _approved
25966
+ ]);
25967
+ const key = makeEthCallKey({
25968
+ context: ethCallContext,
25969
+ calldata
25970
+ });
25971
+ const ret = preparedData.ethCallResults[key];
25972
+ if (ret) {
25973
+ const result = iface.decodeFunctionResult("setApprovalForAll", ret).toArray();
25974
+ return result.length == 1 ? result[0] : result;
25975
+ }
25976
+ }
25977
+ return await this.contract.getFunction("setApprovalForAll(address,bool)").staticCall(operator, _approved, overrides || {});
25978
+ } catch (e) {
25979
+ const stack = new Error().stack;
25980
+ throw transformEtherError(e, void 0, stack);
25981
+ }
25982
+ },
25983
+ async transferFrom(from, to, tokenId, overrides, preparedData, ethCallContext) {
25984
+ try {
25985
+ if (preparedData?.ethCallResults && ethCallContext) {
25986
+ const iface = new Interface([
25987
+ "function transferFrom(address,address,uint256) nonpayable returns ()"
25988
+ ]);
25989
+ const calldata = iface.encodeFunctionData("transferFrom", [
25990
+ from,
25991
+ to,
25992
+ tokenId
25993
+ ]);
25994
+ const key = makeEthCallKey({
25995
+ context: ethCallContext,
25996
+ calldata
25997
+ });
25998
+ const ret = preparedData.ethCallResults[key];
25999
+ if (ret) {
26000
+ const result = iface.decodeFunctionResult("transferFrom", ret).toArray();
26001
+ return result.length == 1 ? result[0] : result;
26002
+ }
26003
+ }
26004
+ return await this.contract.getFunction("transferFrom(address,address,uint256)").staticCall(from, to, tokenId, overrides || {});
26005
+ } catch (e) {
26006
+ const stack = new Error().stack;
26007
+ throw transformEtherError(e, void 0, stack);
26008
+ }
26009
+ }
26010
+ };
26011
+ encodeCall = {
26012
+ approve(to, tokenId, ethCallContext) {
24858
26013
  try {
24859
- return await this.contract.getFunction("approve(address,uint256)").staticCall(to, tokenId, overrides || {});
26014
+ const iface = new Interface(["function approve(address,uint256)"]);
26015
+ const calldata = iface.encodeFunctionData("approve", [to, tokenId]);
26016
+ return {
26017
+ context: ethCallContext,
26018
+ calldata
26019
+ };
24860
26020
  } catch (e) {
24861
26021
  const stack = new Error().stack;
24862
26022
  throw transformEtherError(e, void 0, stack);
24863
26023
  }
24864
26024
  },
24865
- async safeTransferFrom_address_address_uint256(from, to, tokenId, overrides) {
26025
+ totalSupply(ethCallContext) {
24866
26026
  try {
24867
- return await this.contract.getFunction("safeTransferFrom(address,address,uint256)").staticCall(from, to, tokenId, overrides || {});
26027
+ const iface = new Interface(["function totalSupply()"]);
26028
+ const calldata = iface.encodeFunctionData("totalSupply", []);
26029
+ return {
26030
+ context: ethCallContext,
26031
+ calldata
26032
+ };
24868
26033
  } catch (e) {
24869
26034
  const stack = new Error().stack;
24870
26035
  throw transformEtherError(e, void 0, stack);
24871
26036
  }
24872
26037
  },
24873
- async safeTransferFrom_address_address_uint256_bytes(from, to, tokenId, data, overrides) {
26038
+ balanceOf(owner, ethCallContext) {
24874
26039
  try {
24875
- return await this.contract.getFunction("safeTransferFrom(address,address,uint256,bytes)").staticCall(from, to, tokenId, data, overrides || {});
26040
+ const iface = new Interface(["function balanceOf(address)"]);
26041
+ const calldata = iface.encodeFunctionData("balanceOf", [owner]);
26042
+ return {
26043
+ context: ethCallContext,
26044
+ calldata
26045
+ };
24876
26046
  } catch (e) {
24877
26047
  const stack = new Error().stack;
24878
26048
  throw transformEtherError(e, void 0, stack);
24879
26049
  }
24880
26050
  },
24881
- async setApprovalForAll(operator, _approved, overrides) {
26051
+ getApproved(tokenId, ethCallContext) {
24882
26052
  try {
24883
- return await this.contract.getFunction("setApprovalForAll(address,bool)").staticCall(operator, _approved, overrides || {});
26053
+ const iface = new Interface(["function getApproved(uint256)"]);
26054
+ const calldata = iface.encodeFunctionData("getApproved", [tokenId]);
26055
+ return {
26056
+ context: ethCallContext,
26057
+ calldata
26058
+ };
24884
26059
  } catch (e) {
24885
26060
  const stack = new Error().stack;
24886
26061
  throw transformEtherError(e, void 0, stack);
24887
26062
  }
24888
26063
  },
24889
- async transferFrom(from, to, tokenId, overrides) {
26064
+ isApprovedForAll(owner, operator, ethCallContext) {
24890
26065
  try {
24891
- return await this.contract.getFunction("transferFrom(address,address,uint256)").staticCall(from, to, tokenId, overrides || {});
26066
+ const iface = new Interface([
26067
+ "function isApprovedForAll(address,address)"
26068
+ ]);
26069
+ const calldata = iface.encodeFunctionData("isApprovedForAll", [
26070
+ owner,
26071
+ operator
26072
+ ]);
26073
+ return {
26074
+ context: ethCallContext,
26075
+ calldata
26076
+ };
26077
+ } catch (e) {
26078
+ const stack = new Error().stack;
26079
+ throw transformEtherError(e, void 0, stack);
26080
+ }
26081
+ },
26082
+ name(ethCallContext) {
26083
+ try {
26084
+ const iface = new Interface(["function name()"]);
26085
+ const calldata = iface.encodeFunctionData("name", []);
26086
+ return {
26087
+ context: ethCallContext,
26088
+ calldata
26089
+ };
26090
+ } catch (e) {
26091
+ const stack = new Error().stack;
26092
+ throw transformEtherError(e, void 0, stack);
26093
+ }
26094
+ },
26095
+ ownerOf(tokenId, ethCallContext) {
26096
+ try {
26097
+ const iface = new Interface(["function ownerOf(uint256)"]);
26098
+ const calldata = iface.encodeFunctionData("ownerOf", [tokenId]);
26099
+ return {
26100
+ context: ethCallContext,
26101
+ calldata
26102
+ };
26103
+ } catch (e) {
26104
+ const stack = new Error().stack;
26105
+ throw transformEtherError(e, void 0, stack);
26106
+ }
26107
+ },
26108
+ safeTransferFrom_address_address_uint256(from, to, tokenId, ethCallContext) {
26109
+ try {
26110
+ const iface = new Interface([
26111
+ "function safeTransferFrom(address,address,uint256)"
26112
+ ]);
26113
+ const calldata = iface.encodeFunctionData("safeTransferFrom", [
26114
+ from,
26115
+ to,
26116
+ tokenId
26117
+ ]);
26118
+ return {
26119
+ context: ethCallContext,
26120
+ calldata
26121
+ };
26122
+ } catch (e) {
26123
+ const stack = new Error().stack;
26124
+ throw transformEtherError(e, void 0, stack);
26125
+ }
26126
+ },
26127
+ safeTransferFrom_address_address_uint256_bytes(from, to, tokenId, data, ethCallContext) {
26128
+ try {
26129
+ const iface = new Interface([
26130
+ "function safeTransferFrom(address,address,uint256,bytes)"
26131
+ ]);
26132
+ const calldata = iface.encodeFunctionData("safeTransferFrom", [
26133
+ from,
26134
+ to,
26135
+ tokenId,
26136
+ data
26137
+ ]);
26138
+ return {
26139
+ context: ethCallContext,
26140
+ calldata
26141
+ };
26142
+ } catch (e) {
26143
+ const stack = new Error().stack;
26144
+ throw transformEtherError(e, void 0, stack);
26145
+ }
26146
+ },
26147
+ setApprovalForAll(operator, _approved, ethCallContext) {
26148
+ try {
26149
+ const iface = new Interface([
26150
+ "function setApprovalForAll(address,bool)"
26151
+ ]);
26152
+ const calldata = iface.encodeFunctionData("setApprovalForAll", [
26153
+ operator,
26154
+ _approved
26155
+ ]);
26156
+ return {
26157
+ context: ethCallContext,
26158
+ calldata
26159
+ };
26160
+ } catch (e) {
26161
+ const stack = new Error().stack;
26162
+ throw transformEtherError(e, void 0, stack);
26163
+ }
26164
+ },
26165
+ supportsInterface(interfaceId, ethCallContext) {
26166
+ try {
26167
+ const iface = new Interface(["function supportsInterface(bytes4)"]);
26168
+ const calldata = iface.encodeFunctionData("supportsInterface", [
26169
+ interfaceId
26170
+ ]);
26171
+ return {
26172
+ context: ethCallContext,
26173
+ calldata
26174
+ };
26175
+ } catch (e) {
26176
+ const stack = new Error().stack;
26177
+ throw transformEtherError(e, void 0, stack);
26178
+ }
26179
+ },
26180
+ symbol(ethCallContext) {
26181
+ try {
26182
+ const iface = new Interface(["function symbol()"]);
26183
+ const calldata = iface.encodeFunctionData("symbol", []);
26184
+ return {
26185
+ context: ethCallContext,
26186
+ calldata
26187
+ };
26188
+ } catch (e) {
26189
+ const stack = new Error().stack;
26190
+ throw transformEtherError(e, void 0, stack);
26191
+ }
26192
+ },
26193
+ tokenURI(tokenId, ethCallContext) {
26194
+ try {
26195
+ const iface = new Interface(["function tokenURI(uint256)"]);
26196
+ const calldata = iface.encodeFunctionData("tokenURI", [tokenId]);
26197
+ return {
26198
+ context: ethCallContext,
26199
+ calldata
26200
+ };
26201
+ } catch (e) {
26202
+ const stack = new Error().stack;
26203
+ throw transformEtherError(e, void 0, stack);
26204
+ }
26205
+ },
26206
+ transferFrom(from, to, tokenId, ethCallContext) {
26207
+ try {
26208
+ const iface = new Interface([
26209
+ "function transferFrom(address,address,uint256)"
26210
+ ]);
26211
+ const calldata = iface.encodeFunctionData("transferFrom", [
26212
+ from,
26213
+ to,
26214
+ tokenId
26215
+ ]);
26216
+ return {
26217
+ context: ethCallContext,
26218
+ calldata
26219
+ };
24892
26220
  } catch (e) {
24893
26221
  const stack = new Error().stack;
24894
26222
  throw transformEtherError(e, void 0, stack);
@@ -24898,69 +26226,173 @@ var ERC721ContractView = class extends ContractView {
24898
26226
  };
24899
26227
  var ERC721BoundContractView = class extends BoundContractView {
24900
26228
  async totalSupply(overrides) {
24901
- return await this.view.totalSupply({
24902
- blockTag: this.context.blockNumber,
24903
- ...overrides
24904
- });
26229
+ const ethCallContext = {
26230
+ chainId: this.context.chainId,
26231
+ blockTag: this.context.blockNumber.toString(16),
26232
+ address: this.context.address
26233
+ };
26234
+ return await this.view.totalSupply(
26235
+ {
26236
+ blockTag: this.context.blockNumber,
26237
+ ...overrides
26238
+ },
26239
+ this.context.preparedData,
26240
+ ethCallContext
26241
+ );
24905
26242
  }
24906
26243
  async balanceOf(owner, overrides) {
24907
- return await this.view.balanceOf(owner, {
24908
- blockTag: this.context.blockNumber,
24909
- ...overrides
24910
- });
26244
+ const ethCallContext = {
26245
+ chainId: this.context.chainId,
26246
+ blockTag: this.context.blockNumber.toString(16),
26247
+ address: this.context.address
26248
+ };
26249
+ return await this.view.balanceOf(
26250
+ owner,
26251
+ {
26252
+ blockTag: this.context.blockNumber,
26253
+ ...overrides
26254
+ },
26255
+ this.context.preparedData,
26256
+ ethCallContext
26257
+ );
24911
26258
  }
24912
26259
  async getApproved(tokenId, overrides) {
24913
- return await this.view.getApproved(tokenId, {
24914
- blockTag: this.context.blockNumber,
24915
- ...overrides
24916
- });
26260
+ const ethCallContext = {
26261
+ chainId: this.context.chainId,
26262
+ blockTag: this.context.blockNumber.toString(16),
26263
+ address: this.context.address
26264
+ };
26265
+ return await this.view.getApproved(
26266
+ tokenId,
26267
+ {
26268
+ blockTag: this.context.blockNumber,
26269
+ ...overrides
26270
+ },
26271
+ this.context.preparedData,
26272
+ ethCallContext
26273
+ );
24917
26274
  }
24918
26275
  async isApprovedForAll(owner, operator, overrides) {
24919
- return await this.view.isApprovedForAll(owner, operator, {
24920
- blockTag: this.context.blockNumber,
24921
- ...overrides
24922
- });
26276
+ const ethCallContext = {
26277
+ chainId: this.context.chainId,
26278
+ blockTag: this.context.blockNumber.toString(16),
26279
+ address: this.context.address
26280
+ };
26281
+ return await this.view.isApprovedForAll(
26282
+ owner,
26283
+ operator,
26284
+ {
26285
+ blockTag: this.context.blockNumber,
26286
+ ...overrides
26287
+ },
26288
+ this.context.preparedData,
26289
+ ethCallContext
26290
+ );
24923
26291
  }
24924
26292
  async name(overrides) {
24925
- return await this.view.name({
24926
- blockTag: this.context.blockNumber,
24927
- ...overrides
24928
- });
26293
+ const ethCallContext = {
26294
+ chainId: this.context.chainId,
26295
+ blockTag: this.context.blockNumber.toString(16),
26296
+ address: this.context.address
26297
+ };
26298
+ return await this.view.name(
26299
+ {
26300
+ blockTag: this.context.blockNumber,
26301
+ ...overrides
26302
+ },
26303
+ this.context.preparedData,
26304
+ ethCallContext
26305
+ );
24929
26306
  }
24930
26307
  async ownerOf(tokenId, overrides) {
24931
- return await this.view.ownerOf(tokenId, {
24932
- blockTag: this.context.blockNumber,
24933
- ...overrides
24934
- });
26308
+ const ethCallContext = {
26309
+ chainId: this.context.chainId,
26310
+ blockTag: this.context.blockNumber.toString(16),
26311
+ address: this.context.address
26312
+ };
26313
+ return await this.view.ownerOf(
26314
+ tokenId,
26315
+ {
26316
+ blockTag: this.context.blockNumber,
26317
+ ...overrides
26318
+ },
26319
+ this.context.preparedData,
26320
+ ethCallContext
26321
+ );
24935
26322
  }
24936
26323
  async supportsInterface(interfaceId, overrides) {
24937
- return await this.view.supportsInterface(interfaceId, {
24938
- blockTag: this.context.blockNumber,
24939
- ...overrides
24940
- });
26324
+ const ethCallContext = {
26325
+ chainId: this.context.chainId,
26326
+ blockTag: this.context.blockNumber.toString(16),
26327
+ address: this.context.address
26328
+ };
26329
+ return await this.view.supportsInterface(
26330
+ interfaceId,
26331
+ {
26332
+ blockTag: this.context.blockNumber,
26333
+ ...overrides
26334
+ },
26335
+ this.context.preparedData,
26336
+ ethCallContext
26337
+ );
24941
26338
  }
24942
26339
  async symbol(overrides) {
24943
- return await this.view.symbol({
24944
- blockTag: this.context.blockNumber,
24945
- ...overrides
24946
- });
26340
+ const ethCallContext = {
26341
+ chainId: this.context.chainId,
26342
+ blockTag: this.context.blockNumber.toString(16),
26343
+ address: this.context.address
26344
+ };
26345
+ return await this.view.symbol(
26346
+ {
26347
+ blockTag: this.context.blockNumber,
26348
+ ...overrides
26349
+ },
26350
+ this.context.preparedData,
26351
+ ethCallContext
26352
+ );
24947
26353
  }
24948
26354
  async tokenURI(tokenId, overrides) {
24949
- return await this.view.tokenURI(tokenId, {
24950
- blockTag: this.context.blockNumber,
24951
- ...overrides
24952
- });
26355
+ const ethCallContext = {
26356
+ chainId: this.context.chainId,
26357
+ blockTag: this.context.blockNumber.toString(16),
26358
+ address: this.context.address
26359
+ };
26360
+ return await this.view.tokenURI(
26361
+ tokenId,
26362
+ {
26363
+ blockTag: this.context.blockNumber,
26364
+ ...overrides
26365
+ },
26366
+ this.context.preparedData,
26367
+ ethCallContext
26368
+ );
24953
26369
  }
24954
26370
  callStatic = {
24955
26371
  view: this.view,
24956
26372
  context: this.context,
24957
26373
  async approve(to, tokenId, overrides) {
24958
- return await this.view.callStatic.approve(to, tokenId, {
24959
- blockTag: this.context.blockNumber,
24960
- ...overrides
24961
- });
26374
+ const ethCallContext = {
26375
+ chainId: this.context.chainId,
26376
+ blockTag: this.context.blockNumber.toString(16),
26377
+ address: this.context.address
26378
+ };
26379
+ return await this.view.callStatic.approve(
26380
+ to,
26381
+ tokenId,
26382
+ {
26383
+ blockTag: this.context.blockNumber,
26384
+ ...overrides
26385
+ },
26386
+ this.context.preparedData,
26387
+ ethCallContext
26388
+ );
24962
26389
  },
24963
26390
  async safeTransferFrom_address_address_uint256(from, to, tokenId, overrides) {
26391
+ const ethCallContext = {
26392
+ chainId: this.context.chainId,
26393
+ blockTag: this.context.blockNumber.toString(16),
26394
+ address: this.context.address
26395
+ };
24964
26396
  return await this.view.callStatic.safeTransferFrom_address_address_uint256(
24965
26397
  from,
24966
26398
  to,
@@ -24968,10 +26400,17 @@ var ERC721BoundContractView = class extends BoundContractView {
24968
26400
  {
24969
26401
  blockTag: this.context.blockNumber,
24970
26402
  ...overrides
24971
- }
26403
+ },
26404
+ this.context.preparedData,
26405
+ ethCallContext
24972
26406
  );
24973
26407
  },
24974
26408
  async safeTransferFrom_address_address_uint256_bytes(from, to, tokenId, data, overrides) {
26409
+ const ethCallContext = {
26410
+ chainId: this.context.chainId,
26411
+ blockTag: this.context.blockNumber.toString(16),
26412
+ address: this.context.address
26413
+ };
24975
26414
  return await this.view.callStatic.safeTransferFrom_address_address_uint256_bytes(
24976
26415
  from,
24977
26416
  to,
@@ -24980,19 +26419,179 @@ var ERC721BoundContractView = class extends BoundContractView {
24980
26419
  {
24981
26420
  blockTag: this.context.blockNumber,
24982
26421
  ...overrides
24983
- }
26422
+ },
26423
+ this.context.preparedData,
26424
+ ethCallContext
24984
26425
  );
24985
26426
  },
24986
26427
  async setApprovalForAll(operator, _approved, overrides) {
24987
- return await this.view.callStatic.setApprovalForAll(operator, _approved, {
24988
- blockTag: this.context.blockNumber,
24989
- ...overrides
24990
- });
26428
+ const ethCallContext = {
26429
+ chainId: this.context.chainId,
26430
+ blockTag: this.context.blockNumber.toString(16),
26431
+ address: this.context.address
26432
+ };
26433
+ return await this.view.callStatic.setApprovalForAll(
26434
+ operator,
26435
+ _approved,
26436
+ {
26437
+ blockTag: this.context.blockNumber,
26438
+ ...overrides
26439
+ },
26440
+ this.context.preparedData,
26441
+ ethCallContext
26442
+ );
24991
26443
  },
24992
26444
  async transferFrom(from, to, tokenId, overrides) {
24993
- return await this.view.callStatic.transferFrom(from, to, tokenId, {
24994
- blockTag: this.context.blockNumber,
24995
- ...overrides
26445
+ const ethCallContext = {
26446
+ chainId: this.context.chainId,
26447
+ blockTag: this.context.blockNumber.toString(16),
26448
+ address: this.context.address
26449
+ };
26450
+ return await this.view.callStatic.transferFrom(
26451
+ from,
26452
+ to,
26453
+ tokenId,
26454
+ {
26455
+ blockTag: this.context.blockNumber,
26456
+ ...overrides
26457
+ },
26458
+ this.context.preparedData,
26459
+ ethCallContext
26460
+ );
26461
+ }
26462
+ };
26463
+ encodeCall = {
26464
+ view: this.view,
26465
+ context: this.context,
26466
+ approve(to, tokenId, overrides) {
26467
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26468
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26469
+ const address = this.context.address;
26470
+ return this.view.encodeCall.approve(to, tokenId, {
26471
+ chainId,
26472
+ address,
26473
+ blockTag
26474
+ });
26475
+ },
26476
+ totalSupply(overrides) {
26477
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26478
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26479
+ const address = this.context.address;
26480
+ return this.view.encodeCall.totalSupply({ chainId, address, blockTag });
26481
+ },
26482
+ balanceOf(owner, overrides) {
26483
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26484
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26485
+ const address = this.context.address;
26486
+ return this.view.encodeCall.balanceOf(owner, {
26487
+ chainId,
26488
+ address,
26489
+ blockTag
26490
+ });
26491
+ },
26492
+ getApproved(tokenId, overrides) {
26493
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26494
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26495
+ const address = this.context.address;
26496
+ return this.view.encodeCall.getApproved(tokenId, {
26497
+ chainId,
26498
+ address,
26499
+ blockTag
26500
+ });
26501
+ },
26502
+ isApprovedForAll(owner, operator, overrides) {
26503
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26504
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26505
+ const address = this.context.address;
26506
+ return this.view.encodeCall.isApprovedForAll(owner, operator, {
26507
+ chainId,
26508
+ address,
26509
+ blockTag
26510
+ });
26511
+ },
26512
+ name(overrides) {
26513
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26514
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26515
+ const address = this.context.address;
26516
+ return this.view.encodeCall.name({ chainId, address, blockTag });
26517
+ },
26518
+ ownerOf(tokenId, overrides) {
26519
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26520
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26521
+ const address = this.context.address;
26522
+ return this.view.encodeCall.ownerOf(tokenId, {
26523
+ chainId,
26524
+ address,
26525
+ blockTag
26526
+ });
26527
+ },
26528
+ safeTransferFrom_address_address_uint256(from, to, tokenId, overrides) {
26529
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26530
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26531
+ const address = this.context.address;
26532
+ return this.view.encodeCall.safeTransferFrom_address_address_uint256(
26533
+ from,
26534
+ to,
26535
+ tokenId,
26536
+ { chainId, address, blockTag }
26537
+ );
26538
+ },
26539
+ safeTransferFrom_address_address_uint256_bytes(from, to, tokenId, data, overrides) {
26540
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26541
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26542
+ const address = this.context.address;
26543
+ return this.view.encodeCall.safeTransferFrom_address_address_uint256_bytes(
26544
+ from,
26545
+ to,
26546
+ tokenId,
26547
+ data,
26548
+ { chainId, address, blockTag }
26549
+ );
26550
+ },
26551
+ setApprovalForAll(operator, _approved, overrides) {
26552
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26553
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26554
+ const address = this.context.address;
26555
+ return this.view.encodeCall.setApprovalForAll(operator, _approved, {
26556
+ chainId,
26557
+ address,
26558
+ blockTag
26559
+ });
26560
+ },
26561
+ supportsInterface(interfaceId, overrides) {
26562
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26563
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26564
+ const address = this.context.address;
26565
+ return this.view.encodeCall.supportsInterface(interfaceId, {
26566
+ chainId,
26567
+ address,
26568
+ blockTag
26569
+ });
26570
+ },
26571
+ symbol(overrides) {
26572
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26573
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26574
+ const address = this.context.address;
26575
+ return this.view.encodeCall.symbol({ chainId, address, blockTag });
26576
+ },
26577
+ tokenURI(tokenId, overrides) {
26578
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26579
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26580
+ const address = this.context.address;
26581
+ return this.view.encodeCall.tokenURI(tokenId, {
26582
+ chainId,
26583
+ address,
26584
+ blockTag
26585
+ });
26586
+ },
26587
+ transferFrom(from, to, tokenId, overrides) {
26588
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
26589
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
26590
+ const address = this.context.address;
26591
+ return this.view.encodeCall.transferFrom(from, to, tokenId, {
26592
+ chainId,
26593
+ address,
26594
+ blockTag
24996
26595
  });
24997
26596
  }
24998
26597
  };
@@ -25301,13 +26900,14 @@ function mockTransferLog2(contractAddress, event) {
25301
26900
  export {
25302
26901
  esm_exports,
25303
26902
  init_esm,
26903
+ decodeBytes32String,
26904
+ Interface,
25304
26905
  EthContext,
25305
26906
  AccountContext,
25306
26907
  GlobalContext,
25307
26908
  ContractContext,
25308
26909
  ContractView,
25309
26910
  BoundContractView,
25310
- decodeBytes32String,
25311
26911
  SimpleEthersError,
25312
26912
  transformEtherError,
25313
26913
  fixEmptyKey,