punkkit-sdk 1.0.13 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4367,11 +4367,11 @@ var init_lib4 = __esm({
4367
4367
  init_version4();
4368
4368
  __awaiter = function(thisArg, _arguments, P, generator) {
4369
4369
  function adopt(value) {
4370
- return value instanceof P ? value : new P(function(resolve2) {
4371
- resolve2(value);
4370
+ return value instanceof P ? value : new P(function(resolve) {
4371
+ resolve(value);
4372
4372
  });
4373
4373
  }
4374
- return new (P || (P = Promise))(function(resolve2, reject) {
4374
+ return new (P || (P = Promise))(function(resolve, reject) {
4375
4375
  function fulfilled(value) {
4376
4376
  try {
4377
4377
  step(generator.next(value));
@@ -4387,7 +4387,7 @@ var init_lib4 = __esm({
4387
4387
  }
4388
4388
  }
4389
4389
  function step(result) {
4390
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
4390
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
4391
4391
  }
4392
4392
  step((generator = generator.apply(thisArg, _arguments || [])).next());
4393
4393
  });
@@ -5235,12 +5235,12 @@ var init_fragments = __esm({
5235
5235
  // node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js
5236
5236
  function checkResultErrors(result) {
5237
5237
  const errors = [];
5238
- const checkErrors = function(path2, object) {
5238
+ const checkErrors = function(path, object) {
5239
5239
  if (!Array.isArray(object)) {
5240
5240
  return;
5241
5241
  }
5242
5242
  for (let key3 in object) {
5243
- const childPath = path2.slice();
5243
+ const childPath = path.slice();
5244
5244
  childPath.push(key3);
5245
5245
  try {
5246
5246
  checkErrors(childPath, object[key3]);
@@ -7699,11 +7699,11 @@ var init_typed_data = __esm({
7699
7699
  init_id();
7700
7700
  __awaiter2 = function(thisArg, _arguments, P, generator) {
7701
7701
  function adopt(value) {
7702
- return value instanceof P ? value : new P(function(resolve2) {
7703
- resolve2(value);
7702
+ return value instanceof P ? value : new P(function(resolve) {
7703
+ resolve(value);
7704
7704
  });
7705
7705
  }
7706
- return new (P || (P = Promise))(function(resolve2, reject) {
7706
+ return new (P || (P = Promise))(function(resolve, reject) {
7707
7707
  function fulfilled(value) {
7708
7708
  try {
7709
7709
  step(generator.next(value));
@@ -7719,7 +7719,7 @@ var init_typed_data = __esm({
7719
7719
  }
7720
7720
  }
7721
7721
  function step(result) {
7722
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
7722
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
7723
7723
  }
7724
7724
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7725
7725
  });
@@ -8660,11 +8660,11 @@ var init_lib14 = __esm({
8660
8660
  init_version10();
8661
8661
  __awaiter3 = function(thisArg, _arguments, P, generator) {
8662
8662
  function adopt(value) {
8663
- return value instanceof P ? value : new P(function(resolve2) {
8664
- resolve2(value);
8663
+ return value instanceof P ? value : new P(function(resolve) {
8664
+ resolve(value);
8665
8665
  });
8666
8666
  }
8667
- return new (P || (P = Promise))(function(resolve2, reject) {
8667
+ return new (P || (P = Promise))(function(resolve, reject) {
8668
8668
  function fulfilled(value) {
8669
8669
  try {
8670
8670
  step(generator.next(value));
@@ -8680,7 +8680,7 @@ var init_lib14 = __esm({
8680
8680
  }
8681
8681
  }
8682
8682
  function step(result) {
8683
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
8683
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
8684
8684
  }
8685
8685
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8686
8686
  });
@@ -8747,11 +8747,11 @@ var init_lib15 = __esm({
8747
8747
  init_version11();
8748
8748
  __awaiter4 = function(thisArg, _arguments, P, generator) {
8749
8749
  function adopt(value) {
8750
- return value instanceof P ? value : new P(function(resolve2) {
8751
- resolve2(value);
8750
+ return value instanceof P ? value : new P(function(resolve) {
8751
+ resolve(value);
8752
8752
  });
8753
8753
  }
8754
- return new (P || (P = Promise))(function(resolve2, reject) {
8754
+ return new (P || (P = Promise))(function(resolve, reject) {
8755
8755
  function fulfilled(value) {
8756
8756
  try {
8757
8757
  step(generator.next(value));
@@ -8767,7 +8767,7 @@ var init_lib15 = __esm({
8767
8767
  }
8768
8768
  }
8769
8769
  function step(result) {
8770
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
8770
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
8771
8771
  }
8772
8772
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8773
8773
  });
@@ -10742,8 +10742,8 @@ function createCommonjsModule(fn, basedir, module2) {
10742
10742
  return module2 = {
10743
10743
  path: basedir,
10744
10744
  exports: {},
10745
- require: function(path2, base3) {
10746
- return commonjsRequire(path2, base3 === void 0 || base3 === null ? module2.path : base3);
10745
+ require: function(path, base3) {
10746
+ return commonjsRequire(path, base3 === void 0 || base3 === null ? module2.path : base3);
10747
10747
  }
10748
10748
  }, fn(module2, module2.exports), module2.exports;
10749
10749
  }
@@ -13436,11 +13436,11 @@ var init_lib18 = __esm({
13436
13436
  init_version14();
13437
13437
  __awaiter5 = function(thisArg, _arguments, P, generator) {
13438
13438
  function adopt(value) {
13439
- return value instanceof P ? value : new P(function(resolve2) {
13440
- resolve2(value);
13439
+ return value instanceof P ? value : new P(function(resolve) {
13440
+ resolve(value);
13441
13441
  });
13442
13442
  }
13443
- return new (P || (P = Promise))(function(resolve2, reject) {
13443
+ return new (P || (P = Promise))(function(resolve, reject) {
13444
13444
  function fulfilled(value) {
13445
13445
  try {
13446
13446
  step(generator.next(value));
@@ -13456,7 +13456,7 @@ var init_lib18 = __esm({
13456
13456
  }
13457
13457
  }
13458
13458
  function step(result) {
13459
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
13459
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
13460
13460
  }
13461
13461
  step((generator = generator.apply(thisArg, _arguments || [])).next());
13462
13462
  });
@@ -15532,11 +15532,11 @@ var init_lib22 = __esm({
15532
15532
  init_version18();
15533
15533
  __awaiter6 = function(thisArg, _arguments, P, generator) {
15534
15534
  function adopt(value) {
15535
- return value instanceof P ? value : new P(function(resolve2) {
15536
- resolve2(value);
15535
+ return value instanceof P ? value : new P(function(resolve) {
15536
+ resolve(value);
15537
15537
  });
15538
15538
  }
15539
- return new (P || (P = Promise))(function(resolve2, reject) {
15539
+ return new (P || (P = Promise))(function(resolve, reject) {
15540
15540
  function fulfilled(value) {
15541
15541
  try {
15542
15542
  step(generator.next(value));
@@ -15552,7 +15552,7 @@ var init_lib22 = __esm({
15552
15552
  }
15553
15553
  }
15554
15554
  function step(result) {
15555
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
15555
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
15556
15556
  }
15557
15557
  step((generator = generator.apply(thisArg, _arguments || [])).next());
15558
15558
  });
@@ -15588,11 +15588,11 @@ var init_lib23 = __esm({
15588
15588
  init_version19();
15589
15589
  __awaiter7 = function(thisArg, _arguments, P, generator) {
15590
15590
  function adopt(value) {
15591
- return value instanceof P ? value : new P(function(resolve2) {
15592
- resolve2(value);
15591
+ return value instanceof P ? value : new P(function(resolve) {
15592
+ resolve(value);
15593
15593
  });
15594
15594
  }
15595
- return new (P || (P = Promise))(function(resolve2, reject) {
15595
+ return new (P || (P = Promise))(function(resolve, reject) {
15596
15596
  function fulfilled(value) {
15597
15597
  try {
15598
15598
  step(generator.next(value));
@@ -15608,7 +15608,7 @@ var init_lib23 = __esm({
15608
15608
  }
15609
15609
  }
15610
15610
  function step(result) {
15611
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
15611
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
15612
15612
  }
15613
15613
  step((generator = generator.apply(thisArg, _arguments || [])).next());
15614
15614
  });
@@ -16393,9 +16393,9 @@ var init_lib28 = __esm({
16393
16393
  if (index > 4294967295) {
16394
16394
  throw new Error("invalid index - " + String(index));
16395
16395
  }
16396
- let path2 = this.path;
16397
- if (path2) {
16398
- path2 += "/" + (index & ~HardenedBit);
16396
+ let path = this.path;
16397
+ if (path) {
16398
+ path += "/" + (index & ~HardenedBit);
16399
16399
  }
16400
16400
  const data = new Uint8Array(37);
16401
16401
  if (index & HardenedBit) {
@@ -16403,8 +16403,8 @@ var init_lib28 = __esm({
16403
16403
  throw new Error("cannot derive child of neutered node");
16404
16404
  }
16405
16405
  data.set(arrayify(this.privateKey), 1);
16406
- if (path2) {
16407
- path2 += "'";
16406
+ if (path) {
16407
+ path += "'";
16408
16408
  }
16409
16409
  } else {
16410
16410
  data.set(arrayify(this.publicKey));
@@ -16423,21 +16423,21 @@ var init_lib28 = __esm({
16423
16423
  const ek = new SigningKey(hexlify(IL));
16424
16424
  Ki = ek._addPoint(this.publicKey);
16425
16425
  }
16426
- let mnemonicOrPath = path2;
16426
+ let mnemonicOrPath = path;
16427
16427
  const srcMnemonic = this.mnemonic;
16428
16428
  if (srcMnemonic) {
16429
16429
  mnemonicOrPath = Object.freeze({
16430
16430
  phrase: srcMnemonic.phrase,
16431
- path: path2,
16431
+ path,
16432
16432
  locale: srcMnemonic.locale || "en"
16433
16433
  });
16434
16434
  }
16435
16435
  return new _HDNode(_constructorGuard6, ki, Ki, this.fingerprint, bytes32(IR), index, this.depth + 1, mnemonicOrPath);
16436
16436
  }
16437
- derivePath(path2) {
16438
- const components = path2.split("/");
16437
+ derivePath(path) {
16438
+ const components = path.split("/");
16439
16439
  if (components.length === 0 || components[0] === "m" && this.depth !== 0) {
16440
- throw new Error("invalid path - " + path2);
16440
+ throw new Error("invalid path - " + path);
16441
16441
  }
16442
16442
  if (components[0] === "m") {
16443
16443
  components.shift();
@@ -17172,9 +17172,9 @@ function getPassword(password) {
17172
17172
  }
17173
17173
  return arrayify(password);
17174
17174
  }
17175
- function searchPath(object, path2) {
17175
+ function searchPath(object, path) {
17176
17176
  let currentChild = object;
17177
- const comps = path2.toLowerCase().split("/");
17177
+ const comps = path.toLowerCase().split("/");
17178
17178
  for (let i = 0; i < comps.length; i++) {
17179
17179
  let matchingChild = null;
17180
17180
  for (const key3 in currentChild) {
@@ -17738,7 +17738,7 @@ var require_scrypt = __commonJS({
17738
17738
  }
17739
17739
  const lib = {
17740
17740
  scrypt: function(password, salt, N2, r3, p, dkLen, progressCallback) {
17741
- return new Promise(function(resolve2, reject) {
17741
+ return new Promise(function(resolve, reject) {
17742
17742
  let lastProgress = 0;
17743
17743
  if (progressCallback) {
17744
17744
  progressCallback(0);
@@ -17750,7 +17750,7 @@ var require_scrypt = __commonJS({
17750
17750
  if (progressCallback && lastProgress !== 1) {
17751
17751
  progressCallback(1);
17752
17752
  }
17753
- resolve2(new Uint8Array(key3));
17753
+ resolve(new Uint8Array(key3));
17754
17754
  } else if (progressCallback && progress !== lastProgress) {
17755
17755
  lastProgress = progress;
17756
17756
  return progressCallback(progress);
@@ -17823,12 +17823,12 @@ function _getAccount(data, key3) {
17823
17823
  const mnemonicIv = looseArrayify(searchPath(data, "x-ethers/mnemonicCounter"));
17824
17824
  const mnemonicCounter = new import_aes_js2.default.Counter(mnemonicIv);
17825
17825
  const mnemonicAesCtr = new import_aes_js2.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);
17826
- const path2 = searchPath(data, "x-ethers/path") || defaultPath;
17826
+ const path = searchPath(data, "x-ethers/path") || defaultPath;
17827
17827
  const locale = searchPath(data, "x-ethers/locale") || "en";
17828
17828
  const entropy = arrayify(mnemonicAesCtr.decrypt(mnemonicCiphertext));
17829
17829
  try {
17830
17830
  const mnemonic = entropyToMnemonic(entropy, locale);
17831
- const node = HDNode.fromMnemonic(mnemonic, null, locale).derivePath(path2);
17831
+ const node = HDNode.fromMnemonic(mnemonic, null, locale).derivePath(path);
17832
17832
  if (node.privateKey != account.privateKey) {
17833
17833
  throw new Error("mnemonic mismatch");
17834
17834
  }
@@ -17928,12 +17928,12 @@ function encrypt(account, password, options, progressCallback) {
17928
17928
  const privateKey = arrayify(account.privateKey);
17929
17929
  const passwordBytes = getPassword(password);
17930
17930
  let entropy = null;
17931
- let path2 = null;
17931
+ let path = null;
17932
17932
  let locale = null;
17933
17933
  if (hasMnemonic(account)) {
17934
17934
  const srcMnemonic = account.mnemonic;
17935
17935
  entropy = arrayify(mnemonicToEntropy(srcMnemonic.phrase, srcMnemonic.locale || "en"));
17936
- path2 = srcMnemonic.path || defaultPath;
17936
+ path = srcMnemonic.path || defaultPath;
17937
17937
  locale = srcMnemonic.locale || "en";
17938
17938
  }
17939
17939
  let client = options.client;
@@ -18019,7 +18019,7 @@ function encrypt(account, password, options, progressCallback) {
18019
18019
  gethFilename: "UTC--" + timestamp + "--" + data.address,
18020
18020
  mnemonicCounter: hexlify(mnemonicIv).substring(2),
18021
18021
  mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2),
18022
- path: path2,
18022
+ path,
18023
18023
  locale,
18024
18024
  version: "0.1"
18025
18025
  };
@@ -18046,11 +18046,11 @@ var init_keystore = __esm({
18046
18046
  init_version24();
18047
18047
  __awaiter8 = function(thisArg, _arguments, P, generator) {
18048
18048
  function adopt(value) {
18049
- return value instanceof P ? value : new P(function(resolve2) {
18050
- resolve2(value);
18049
+ return value instanceof P ? value : new P(function(resolve) {
18050
+ resolve(value);
18051
18051
  });
18052
18052
  }
18053
- return new (P || (P = Promise))(function(resolve2, reject) {
18053
+ return new (P || (P = Promise))(function(resolve, reject) {
18054
18054
  function fulfilled(value) {
18055
18055
  try {
18056
18056
  step(generator.next(value));
@@ -18066,7 +18066,7 @@ var init_keystore = __esm({
18066
18066
  }
18067
18067
  }
18068
18068
  function step(result) {
18069
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
18069
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18070
18070
  }
18071
18071
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18072
18072
  });
@@ -18158,11 +18158,11 @@ var init_lib31 = __esm({
18158
18158
  init_version25();
18159
18159
  __awaiter9 = function(thisArg, _arguments, P, generator) {
18160
18160
  function adopt(value) {
18161
- return value instanceof P ? value : new P(function(resolve2) {
18162
- resolve2(value);
18161
+ return value instanceof P ? value : new P(function(resolve) {
18162
+ resolve(value);
18163
18163
  });
18164
18164
  }
18165
- return new (P || (P = Promise))(function(resolve2, reject) {
18165
+ return new (P || (P = Promise))(function(resolve, reject) {
18166
18166
  function fulfilled(value) {
18167
18167
  try {
18168
18168
  step(generator.next(value));
@@ -18178,7 +18178,7 @@ var init_lib31 = __esm({
18178
18178
  }
18179
18179
  }
18180
18180
  function step(result) {
18181
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
18181
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18182
18182
  }
18183
18183
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18184
18184
  });
@@ -18313,11 +18313,11 @@ var init_lib31 = __esm({
18313
18313
  static fromEncryptedJsonSync(json, password) {
18314
18314
  return new _Wallet(decryptJsonWalletSync(json, password));
18315
18315
  }
18316
- static fromMnemonic(mnemonic, path2, wordlist2) {
18317
- if (!path2) {
18318
- path2 = defaultPath;
18316
+ static fromMnemonic(mnemonic, path, wordlist2) {
18317
+ if (!path) {
18318
+ path = defaultPath;
18319
18319
  }
18320
- return new _Wallet(HDNode.fromMnemonic(mnemonic, null, wordlist2).derivePath(path2));
18320
+ return new _Wallet(HDNode.fromMnemonic(mnemonic, null, wordlist2).derivePath(path));
18321
18321
  }
18322
18322
  };
18323
18323
  }
@@ -18726,11 +18726,11 @@ var init_geturl = __esm({
18726
18726
  init_lib2();
18727
18727
  __awaiter10 = function(thisArg, _arguments, P, generator) {
18728
18728
  function adopt(value) {
18729
- return value instanceof P ? value : new P(function(resolve2) {
18730
- resolve2(value);
18729
+ return value instanceof P ? value : new P(function(resolve) {
18730
+ resolve(value);
18731
18731
  });
18732
18732
  }
18733
- return new (P || (P = Promise))(function(resolve2, reject) {
18733
+ return new (P || (P = Promise))(function(resolve, reject) {
18734
18734
  function fulfilled(value) {
18735
18735
  try {
18736
18736
  step(generator.next(value));
@@ -18746,7 +18746,7 @@ var init_geturl = __esm({
18746
18746
  }
18747
18747
  }
18748
18748
  function step(result) {
18749
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
18749
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18750
18750
  }
18751
18751
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18752
18752
  });
@@ -18756,8 +18756,8 @@ var init_geturl = __esm({
18756
18756
 
18757
18757
  // node_modules/@ethersproject/web/lib.esm/index.js
18758
18758
  function staller(duration) {
18759
- return new Promise((resolve2) => {
18760
- setTimeout(resolve2, duration);
18759
+ return new Promise((resolve) => {
18760
+ setTimeout(resolve, duration);
18761
18761
  });
18762
18762
  }
18763
18763
  function bodyify(value, type) {
@@ -18877,7 +18877,7 @@ function _fetchData(connection, body, processFunc) {
18877
18877
  options.headers = flatHeaders;
18878
18878
  const runningTimeout = (function() {
18879
18879
  let timer2 = null;
18880
- const promise = new Promise(function(resolve2, reject) {
18880
+ const promise = new Promise(function(resolve, reject) {
18881
18881
  if (timeout) {
18882
18882
  timer2 = setTimeout(() => {
18883
18883
  if (timer2 == null) {
@@ -19047,7 +19047,7 @@ function poll(func, options) {
19047
19047
  if (options.interval == null) {
19048
19048
  options.interval = 250;
19049
19049
  }
19050
- return new Promise(function(resolve2, reject) {
19050
+ return new Promise(function(resolve, reject) {
19051
19051
  let timer2 = null;
19052
19052
  let done = false;
19053
19053
  const cancel = () => {
@@ -19073,7 +19073,7 @@ function poll(func, options) {
19073
19073
  return func().then(function(result) {
19074
19074
  if (result !== void 0) {
19075
19075
  if (cancel()) {
19076
- resolve2(result);
19076
+ resolve(result);
19077
19077
  }
19078
19078
  } else if (options.oncePoll) {
19079
19079
  options.oncePoll.once("poll", check);
@@ -19119,11 +19119,11 @@ var init_lib34 = __esm({
19119
19119
  init_geturl();
19120
19120
  __awaiter11 = function(thisArg, _arguments, P, generator) {
19121
19121
  function adopt(value) {
19122
- return value instanceof P ? value : new P(function(resolve2) {
19123
- resolve2(value);
19122
+ return value instanceof P ? value : new P(function(resolve) {
19123
+ resolve(value);
19124
19124
  });
19125
19125
  }
19126
- return new (P || (P = Promise))(function(resolve2, reject) {
19126
+ return new (P || (P = Promise))(function(resolve, reject) {
19127
19127
  function fulfilled(value) {
19128
19128
  try {
19129
19129
  step(generator.next(value));
@@ -19139,7 +19139,7 @@ var init_lib34 = __esm({
19139
19139
  }
19140
19140
  }
19141
19141
  function step(result) {
19142
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
19142
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
19143
19143
  }
19144
19144
  step((generator = generator.apply(thisArg, _arguments || [])).next());
19145
19145
  });
@@ -19805,8 +19805,8 @@ function getTime() {
19805
19805
  return (/* @__PURE__ */ new Date()).getTime();
19806
19806
  }
19807
19807
  function stall(duration) {
19808
- return new Promise((resolve2) => {
19809
- setTimeout(resolve2, duration);
19808
+ return new Promise((resolve) => {
19809
+ setTimeout(resolve, duration);
19810
19810
  });
19811
19811
  }
19812
19812
  function bytes32ify(value) {
@@ -19895,11 +19895,11 @@ var init_base_provider = __esm({
19895
19895
  init_formatter();
19896
19896
  __awaiter12 = function(thisArg, _arguments, P, generator) {
19897
19897
  function adopt(value) {
19898
- return value instanceof P ? value : new P(function(resolve2) {
19899
- resolve2(value);
19898
+ return value instanceof P ? value : new P(function(resolve) {
19899
+ resolve(value);
19900
19900
  });
19901
19901
  }
19902
- return new (P || (P = Promise))(function(resolve2, reject) {
19902
+ return new (P || (P = Promise))(function(resolve, reject) {
19903
19903
  function fulfilled(value) {
19904
19904
  try {
19905
19905
  step(generator.next(value));
@@ -19915,7 +19915,7 @@ var init_base_provider = __esm({
19915
19915
  }
19916
19916
  }
19917
19917
  function step(result) {
19918
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
19918
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
19919
19919
  }
19920
19920
  step((generator = generator.apply(thisArg, _arguments || [])).next());
19921
19921
  });
@@ -20708,7 +20708,7 @@ var init_base_provider = __esm({
20708
20708
  if ((receipt ? receipt.confirmations : 0) >= confirmations) {
20709
20709
  return receipt;
20710
20710
  }
20711
- return new Promise((resolve2, reject) => {
20711
+ return new Promise((resolve, reject) => {
20712
20712
  const cancelFuncs = [];
20713
20713
  let done = false;
20714
20714
  const alreadyDone = function() {
@@ -20728,7 +20728,7 @@ var init_base_provider = __esm({
20728
20728
  if (alreadyDone()) {
20729
20729
  return;
20730
20730
  }
20731
- resolve2(receipt2);
20731
+ resolve(receipt2);
20732
20732
  };
20733
20733
  this.on(transactionHash, minedHandler);
20734
20734
  cancelFuncs.push(() => {
@@ -21677,8 +21677,8 @@ function checkError(method, error, params) {
21677
21677
  throw error;
21678
21678
  }
21679
21679
  function timer(timeout) {
21680
- return new Promise(function(resolve2) {
21681
- setTimeout(resolve2, timeout);
21680
+ return new Promise(function(resolve) {
21681
+ setTimeout(resolve, timeout);
21682
21682
  });
21683
21683
  }
21684
21684
  function getResult(payload) {
@@ -21713,11 +21713,11 @@ var init_json_rpc_provider = __esm({
21713
21713
  init_base_provider();
21714
21714
  __awaiter13 = function(thisArg, _arguments, P, generator) {
21715
21715
  function adopt(value) {
21716
- return value instanceof P ? value : new P(function(resolve2) {
21717
- resolve2(value);
21716
+ return value instanceof P ? value : new P(function(resolve) {
21717
+ resolve(value);
21718
21718
  });
21719
21719
  }
21720
- return new (P || (P = Promise))(function(resolve2, reject) {
21720
+ return new (P || (P = Promise))(function(resolve, reject) {
21721
21721
  function fulfilled(value) {
21722
21722
  try {
21723
21723
  step(generator.next(value));
@@ -21733,7 +21733,7 @@ var init_json_rpc_provider = __esm({
21733
21733
  }
21734
21734
  }
21735
21735
  function step(result) {
21736
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
21736
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
21737
21737
  }
21738
21738
  step((generator = generator.apply(thisArg, _arguments || [])).next());
21739
21739
  });
@@ -21959,10 +21959,10 @@ var init_json_rpc_provider = __esm({
21959
21959
  constructor(url, network) {
21960
21960
  let networkOrReady = network;
21961
21961
  if (networkOrReady == null) {
21962
- networkOrReady = new Promise((resolve2, reject) => {
21962
+ networkOrReady = new Promise((resolve, reject) => {
21963
21963
  setTimeout(() => {
21964
21964
  this.detectNetwork().then((network2) => {
21965
- resolve2(network2);
21965
+ resolve(network2);
21966
21966
  }, (error) => {
21967
21967
  reject(error);
21968
21968
  });
@@ -22289,11 +22289,11 @@ var init_websocket_provider = __esm({
22289
22289
  init_version28();
22290
22290
  __awaiter14 = function(thisArg, _arguments, P, generator) {
22291
22291
  function adopt(value) {
22292
- return value instanceof P ? value : new P(function(resolve2) {
22293
- resolve2(value);
22292
+ return value instanceof P ? value : new P(function(resolve) {
22293
+ resolve(value);
22294
22294
  });
22295
22295
  }
22296
- return new (P || (P = Promise))(function(resolve2, reject) {
22296
+ return new (P || (P = Promise))(function(resolve, reject) {
22297
22297
  function fulfilled(value) {
22298
22298
  try {
22299
22299
  step(generator.next(value));
@@ -22309,7 +22309,7 @@ var init_websocket_provider = __esm({
22309
22309
  }
22310
22310
  }
22311
22311
  function step(result) {
22312
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
22312
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
22313
22313
  }
22314
22314
  step((generator = generator.apply(thisArg, _arguments || [])).next());
22315
22315
  });
@@ -22429,12 +22429,12 @@ var init_websocket_provider = __esm({
22429
22429
  }
22430
22430
  send(method, params) {
22431
22431
  const rid = NextId++;
22432
- return new Promise((resolve2, reject) => {
22432
+ return new Promise((resolve, reject) => {
22433
22433
  function callback(error, result) {
22434
22434
  if (error) {
22435
22435
  return reject(error);
22436
22436
  }
22437
- return resolve2(result);
22437
+ return resolve(result);
22438
22438
  }
22439
22439
  const payload = JSON.stringify({
22440
22440
  method,
@@ -22545,12 +22545,12 @@ var init_websocket_provider = __esm({
22545
22545
  destroy() {
22546
22546
  return __awaiter14(this, void 0, void 0, function* () {
22547
22547
  if (this.websocket.readyState === WS.CONNECTING) {
22548
- yield new Promise((resolve2) => {
22548
+ yield new Promise((resolve) => {
22549
22549
  this.websocket.onopen = function() {
22550
- resolve2(true);
22550
+ resolve(true);
22551
22551
  };
22552
22552
  this.websocket.onerror = function() {
22553
- resolve2(false);
22553
+ resolve(false);
22554
22554
  };
22555
22555
  });
22556
22556
  }
@@ -22572,11 +22572,11 @@ var init_url_json_rpc_provider = __esm({
22572
22572
  init_json_rpc_provider();
22573
22573
  __awaiter15 = function(thisArg, _arguments, P, generator) {
22574
22574
  function adopt(value) {
22575
- return value instanceof P ? value : new P(function(resolve2) {
22576
- resolve2(value);
22575
+ return value instanceof P ? value : new P(function(resolve) {
22576
+ resolve(value);
22577
22577
  });
22578
22578
  }
22579
- return new (P || (P = Promise))(function(resolve2, reject) {
22579
+ return new (P || (P = Promise))(function(resolve, reject) {
22580
22580
  function fulfilled(value) {
22581
22581
  try {
22582
22582
  step(generator.next(value));
@@ -22592,7 +22592,7 @@ var init_url_json_rpc_provider = __esm({
22592
22592
  }
22593
22593
  }
22594
22594
  function step(result) {
22595
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
22595
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
22596
22596
  }
22597
22597
  step((generator = generator.apply(thisArg, _arguments || [])).next());
22598
22598
  });
@@ -22819,11 +22819,11 @@ var init_cloudflare_provider = __esm({
22819
22819
  init_version28();
22820
22820
  __awaiter16 = function(thisArg, _arguments, P, generator) {
22821
22821
  function adopt(value) {
22822
- return value instanceof P ? value : new P(function(resolve2) {
22823
- resolve2(value);
22822
+ return value instanceof P ? value : new P(function(resolve) {
22823
+ resolve(value);
22824
22824
  });
22825
22825
  }
22826
- return new (P || (P = Promise))(function(resolve2, reject) {
22826
+ return new (P || (P = Promise))(function(resolve, reject) {
22827
22827
  function fulfilled(value) {
22828
22828
  try {
22829
22829
  step(generator.next(value));
@@ -22839,7 +22839,7 @@ var init_cloudflare_provider = __esm({
22839
22839
  }
22840
22840
  }
22841
22841
  function step(result) {
22842
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
22842
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
22843
22843
  }
22844
22844
  step((generator = generator.apply(thisArg, _arguments || [])).next());
22845
22845
  });
@@ -23022,11 +23022,11 @@ var init_etherscan_provider = __esm({
23022
23022
  init_base_provider();
23023
23023
  __awaiter17 = function(thisArg, _arguments, P, generator) {
23024
23024
  function adopt(value) {
23025
- return value instanceof P ? value : new P(function(resolve2) {
23026
- resolve2(value);
23025
+ return value instanceof P ? value : new P(function(resolve) {
23026
+ resolve(value);
23027
23027
  });
23028
23028
  }
23029
- return new (P || (P = Promise))(function(resolve2, reject) {
23029
+ return new (P || (P = Promise))(function(resolve, reject) {
23030
23030
  function fulfilled(value) {
23031
23031
  try {
23032
23032
  step(generator.next(value));
@@ -23042,7 +23042,7 @@ var init_etherscan_provider = __esm({
23042
23042
  }
23043
23043
  }
23044
23044
  function step(result) {
23045
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
23045
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
23046
23046
  }
23047
23047
  step((generator = generator.apply(thisArg, _arguments || [])).next());
23048
23048
  });
@@ -23374,13 +23374,13 @@ function serialize2(value) {
23374
23374
  function stall2(duration) {
23375
23375
  let cancel = null;
23376
23376
  let timer2 = null;
23377
- let promise = new Promise((resolve2) => {
23377
+ let promise = new Promise((resolve) => {
23378
23378
  cancel = function() {
23379
23379
  if (timer2) {
23380
23380
  clearTimeout(timer2);
23381
23381
  timer2 = null;
23382
23382
  }
23383
- resolve2();
23383
+ resolve();
23384
23384
  };
23385
23385
  timer2 = setTimeout(cancel, duration);
23386
23386
  });
@@ -23393,22 +23393,22 @@ function stall2(duration) {
23393
23393
  }
23394
23394
  return { cancel, getPromise, wait };
23395
23395
  }
23396
- function exposeDebugConfig(config3, now2) {
23396
+ function exposeDebugConfig(config2, now2) {
23397
23397
  const result = {
23398
- weight: config3.weight
23398
+ weight: config2.weight
23399
23399
  };
23400
- Object.defineProperty(result, "provider", { get: () => config3.provider });
23401
- if (config3.start) {
23402
- result.start = config3.start;
23400
+ Object.defineProperty(result, "provider", { get: () => config2.provider });
23401
+ if (config2.start) {
23402
+ result.start = config2.start;
23403
23403
  }
23404
23404
  if (now2) {
23405
- result.duration = now2 - config3.start;
23405
+ result.duration = now2 - config2.start;
23406
23406
  }
23407
- if (config3.done) {
23408
- if (config3.error) {
23409
- result.error = config3.error;
23407
+ if (config2.done) {
23408
+ if (config2.error) {
23409
+ result.error = config2.error;
23410
23410
  } else {
23411
- result.result = config3.result || null;
23411
+ result.result = config2.result || null;
23412
23412
  }
23413
23413
  }
23414
23414
  return result;
@@ -23512,30 +23512,30 @@ function getProcessFunc(provider, method, params) {
23512
23512
  }
23513
23513
  return normalizedTally(normalize3, provider.quorum);
23514
23514
  }
23515
- function waitForSync(config3, blockNumber) {
23515
+ function waitForSync(config2, blockNumber) {
23516
23516
  return __awaiter18(this, void 0, void 0, function* () {
23517
- const provider = config3.provider;
23517
+ const provider = config2.provider;
23518
23518
  if (provider.blockNumber != null && provider.blockNumber >= blockNumber || blockNumber === -1) {
23519
23519
  return provider;
23520
23520
  }
23521
23521
  return poll(() => {
23522
- return new Promise((resolve2, reject) => {
23522
+ return new Promise((resolve, reject) => {
23523
23523
  setTimeout(function() {
23524
23524
  if (provider.blockNumber >= blockNumber) {
23525
- return resolve2(provider);
23525
+ return resolve(provider);
23526
23526
  }
23527
- if (config3.cancelled) {
23528
- return resolve2(null);
23527
+ if (config2.cancelled) {
23528
+ return resolve(null);
23529
23529
  }
23530
- return resolve2(void 0);
23530
+ return resolve(void 0);
23531
23531
  }, 0);
23532
23532
  });
23533
23533
  }, { oncePoll: provider });
23534
23534
  });
23535
23535
  }
23536
- function getRunner(config3, currentBlockNumber, method, params) {
23536
+ function getRunner(config2, currentBlockNumber, method, params) {
23537
23537
  return __awaiter18(this, void 0, void 0, function* () {
23538
- let provider = config3.provider;
23538
+ let provider = config2.provider;
23539
23539
  switch (method) {
23540
23540
  case "getBlockNumber":
23541
23541
  case "getGasPrice":
@@ -23549,23 +23549,23 @@ function getRunner(config3, currentBlockNumber, method, params) {
23549
23549
  case "getTransactionCount":
23550
23550
  case "getCode":
23551
23551
  if (params.blockTag && isHexString(params.blockTag)) {
23552
- provider = yield waitForSync(config3, currentBlockNumber);
23552
+ provider = yield waitForSync(config2, currentBlockNumber);
23553
23553
  }
23554
23554
  return provider[method](params.address, params.blockTag || "latest");
23555
23555
  case "getStorageAt":
23556
23556
  if (params.blockTag && isHexString(params.blockTag)) {
23557
- provider = yield waitForSync(config3, currentBlockNumber);
23557
+ provider = yield waitForSync(config2, currentBlockNumber);
23558
23558
  }
23559
23559
  return provider.getStorageAt(params.address, params.position, params.blockTag || "latest");
23560
23560
  case "getBlock":
23561
23561
  if (params.blockTag && isHexString(params.blockTag)) {
23562
- provider = yield waitForSync(config3, currentBlockNumber);
23562
+ provider = yield waitForSync(config2, currentBlockNumber);
23563
23563
  }
23564
23564
  return provider[params.includeTransactions ? "getBlockWithTransactions" : "getBlock"](params.blockTag || params.blockHash);
23565
23565
  case "call":
23566
23566
  case "estimateGas":
23567
23567
  if (params.blockTag && isHexString(params.blockTag)) {
23568
- provider = yield waitForSync(config3, currentBlockNumber);
23568
+ provider = yield waitForSync(config2, currentBlockNumber);
23569
23569
  }
23570
23570
  if (method === "call" && params.blockTag) {
23571
23571
  return provider[method](params.transaction, params.blockTag);
@@ -23577,7 +23577,7 @@ function getRunner(config3, currentBlockNumber, method, params) {
23577
23577
  case "getLogs": {
23578
23578
  let filter = params.filter;
23579
23579
  if (filter.fromBlock && isHexString(filter.fromBlock) || filter.toBlock && isHexString(filter.toBlock)) {
23580
- provider = yield waitForSync(config3, currentBlockNumber);
23580
+ provider = yield waitForSync(config2, currentBlockNumber);
23581
23581
  }
23582
23582
  return provider.getLogs(filter);
23583
23583
  }
@@ -23604,11 +23604,11 @@ var init_fallback_provider = __esm({
23604
23604
  init_version28();
23605
23605
  __awaiter18 = function(thisArg, _arguments, P, generator) {
23606
23606
  function adopt(value) {
23607
- return value instanceof P ? value : new P(function(resolve2) {
23608
- resolve2(value);
23607
+ return value instanceof P ? value : new P(function(resolve) {
23608
+ resolve(value);
23609
23609
  });
23610
23610
  }
23611
- return new (P || (P = Promise))(function(resolve2, reject) {
23611
+ return new (P || (P = Promise))(function(resolve, reject) {
23612
23612
  function fulfilled(value) {
23613
23613
  try {
23614
23614
  step(generator.next(value));
@@ -23624,7 +23624,7 @@ var init_fallback_provider = __esm({
23624
23624
  }
23625
23625
  }
23626
23626
  function step(result) {
23627
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
23627
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
23628
23628
  }
23629
23629
  step((generator = generator.apply(thisArg, _arguments || [])).next());
23630
23630
  });
@@ -23657,21 +23657,21 @@ var init_fallback_provider = __esm({
23657
23657
  const priority = 1;
23658
23658
  return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout, priority });
23659
23659
  }
23660
- const config3 = shallowCopy(configOrProvider);
23661
- if (config3.priority == null) {
23662
- config3.priority = 1;
23660
+ const config2 = shallowCopy(configOrProvider);
23661
+ if (config2.priority == null) {
23662
+ config2.priority = 1;
23663
23663
  }
23664
- if (config3.stallTimeout == null) {
23665
- config3.stallTimeout = isCommunityResource(configOrProvider) ? 2e3 : 750;
23664
+ if (config2.stallTimeout == null) {
23665
+ config2.stallTimeout = isCommunityResource(configOrProvider) ? 2e3 : 750;
23666
23666
  }
23667
- if (config3.weight == null) {
23668
- config3.weight = 1;
23667
+ if (config2.weight == null) {
23668
+ config2.weight = 1;
23669
23669
  }
23670
- const weight = config3.weight;
23670
+ const weight = config2.weight;
23671
23671
  if (weight % 1 || weight > 512 || weight < 1) {
23672
23672
  logger43.throwArgumentError("invalid weight; must be integer in [1, 512]", `providers[${index}].weight`, weight);
23673
23673
  }
23674
- return Object.freeze(config3);
23674
+ return Object.freeze(config2);
23675
23675
  });
23676
23676
  const total = providerConfigs.reduce((accum, c) => accum + c.weight, 0);
23677
23677
  if (quorum == null) {
@@ -23681,9 +23681,9 @@ var init_fallback_provider = __esm({
23681
23681
  }
23682
23682
  let networkOrReady = checkNetworks(providerConfigs.map((c) => c.provider.network));
23683
23683
  if (networkOrReady == null) {
23684
- networkOrReady = new Promise((resolve2, reject) => {
23684
+ networkOrReady = new Promise((resolve, reject) => {
23685
23685
  setTimeout(() => {
23686
- this.detectNetwork().then(resolve2, reject);
23686
+ this.detectNetwork().then(resolve, reject);
23687
23687
  }, 0);
23688
23688
  });
23689
23689
  }
@@ -23729,33 +23729,33 @@ var init_fallback_provider = __esm({
23729
23729
  const t0 = now();
23730
23730
  let inflightWeight = configs.filter((c) => c.runner && t0 - c.start < c.stallTimeout).reduce((accum, c) => accum + c.weight, 0);
23731
23731
  while (inflightWeight < this.quorum && i < configs.length) {
23732
- const config3 = configs[i++];
23732
+ const config2 = configs[i++];
23733
23733
  const rid = nextRid++;
23734
- config3.start = now();
23735
- config3.staller = stall2(config3.stallTimeout);
23736
- config3.staller.wait(() => {
23737
- config3.staller = null;
23734
+ config2.start = now();
23735
+ config2.staller = stall2(config2.stallTimeout);
23736
+ config2.staller.wait(() => {
23737
+ config2.staller = null;
23738
23738
  });
23739
- config3.runner = getRunner(config3, currentBlockNumber, method, params).then((result) => {
23740
- config3.done = true;
23741
- config3.result = result;
23739
+ config2.runner = getRunner(config2, currentBlockNumber, method, params).then((result) => {
23740
+ config2.done = true;
23741
+ config2.result = result;
23742
23742
  if (this.listenerCount("debug")) {
23743
23743
  this.emit("debug", {
23744
23744
  action: "request",
23745
23745
  rid,
23746
- backend: exposeDebugConfig(config3, now()),
23746
+ backend: exposeDebugConfig(config2, now()),
23747
23747
  request: { method, params: deepCopy(params) },
23748
23748
  provider: this
23749
23749
  });
23750
23750
  }
23751
23751
  }, (error) => {
23752
- config3.done = true;
23753
- config3.error = error;
23752
+ config2.done = true;
23753
+ config2.error = error;
23754
23754
  if (this.listenerCount("debug")) {
23755
23755
  this.emit("debug", {
23756
23756
  action: "request",
23757
23757
  rid,
23758
- backend: exposeDebugConfig(config3, now()),
23758
+ backend: exposeDebugConfig(config2, now()),
23759
23759
  request: { method, params: deepCopy(params) },
23760
23760
  provider: this
23761
23761
  });
@@ -23765,12 +23765,12 @@ var init_fallback_provider = __esm({
23765
23765
  this.emit("debug", {
23766
23766
  action: "request",
23767
23767
  rid,
23768
- backend: exposeDebugConfig(config3, null),
23768
+ backend: exposeDebugConfig(config2, null),
23769
23769
  request: { method, params: deepCopy(params) },
23770
23770
  provider: this
23771
23771
  });
23772
23772
  }
23773
- inflightWeight += config3.weight;
23773
+ inflightWeight += config2.weight;
23774
23774
  }
23775
23775
  const waiting = [];
23776
23776
  configs.forEach((c) => {
@@ -24006,8 +24006,8 @@ var init_json_rpc_batch_provider = __esm({
24006
24006
  this._pendingBatch = [];
24007
24007
  }
24008
24008
  const inflightRequest = { request, resolve: null, reject: null };
24009
- const promise = new Promise((resolve2, reject) => {
24010
- inflightRequest.resolve = resolve2;
24009
+ const promise = new Promise((resolve, reject) => {
24010
+ inflightRequest.resolve = resolve;
24011
24011
  inflightRequest.reject = reject;
24012
24012
  });
24013
24013
  this._pendingBatch.push(inflightRequest);
@@ -24190,7 +24190,7 @@ function buildWeb3LegacyFetcher(provider, sendFunc) {
24190
24190
  id: _nextId++,
24191
24191
  jsonrpc: "2.0"
24192
24192
  };
24193
- return new Promise((resolve2, reject) => {
24193
+ return new Promise((resolve, reject) => {
24194
24194
  this.emit("debug", {
24195
24195
  action: "request",
24196
24196
  fetcher,
@@ -24221,7 +24221,7 @@ function buildWeb3LegacyFetcher(provider, sendFunc) {
24221
24221
  error2.data = response.error.data;
24222
24222
  return reject(error2);
24223
24223
  }
24224
- resolve2(response.result);
24224
+ resolve(response.result);
24225
24225
  });
24226
24226
  });
24227
24227
  };
@@ -24274,21 +24274,21 @@ var init_web3_provider = __esm({
24274
24274
  if (provider == null) {
24275
24275
  logger47.throwArgumentError("missing provider", "provider", provider);
24276
24276
  }
24277
- let path2 = null;
24277
+ let path = null;
24278
24278
  let jsonRpcFetchFunc = null;
24279
24279
  let subprovider = null;
24280
24280
  if (typeof provider === "function") {
24281
- path2 = "unknown:";
24281
+ path = "unknown:";
24282
24282
  jsonRpcFetchFunc = provider;
24283
24283
  } else {
24284
- path2 = provider.host || provider.path || "";
24285
- if (!path2 && provider.isMetaMask) {
24286
- path2 = "metamask";
24284
+ path = provider.host || provider.path || "";
24285
+ if (!path && provider.isMetaMask) {
24286
+ path = "metamask";
24287
24287
  }
24288
24288
  subprovider = provider;
24289
24289
  if (provider.request) {
24290
- if (path2 === "") {
24291
- path2 = "eip-1193:";
24290
+ if (path === "") {
24291
+ path = "eip-1193:";
24292
24292
  }
24293
24293
  jsonRpcFetchFunc = buildEip1193Fetcher(provider);
24294
24294
  } else if (provider.sendAsync) {
@@ -24298,11 +24298,11 @@ var init_web3_provider = __esm({
24298
24298
  } else {
24299
24299
  logger47.throwArgumentError("unsupported provider", "provider", provider);
24300
24300
  }
24301
- if (!path2) {
24302
- path2 = "unknown:";
24301
+ if (!path) {
24302
+ path = "unknown:";
24303
24303
  }
24304
24304
  }
24305
- super(path2, network);
24305
+ super(path, network);
24306
24306
  defineReadOnly(this, "jsonRpcFetchFunc", jsonRpcFetchFunc);
24307
24307
  defineReadOnly(this, "provider", subprovider);
24308
24308
  }
@@ -25243,12 +25243,12 @@ var init_fragments2 = __esm({
25243
25243
  // node_modules/ethers/node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js
25244
25244
  function checkResultErrors2(result) {
25245
25245
  const errors = [];
25246
- const checkErrors = function(path2, object) {
25246
+ const checkErrors = function(path, object) {
25247
25247
  if (!Array.isArray(object)) {
25248
25248
  return;
25249
25249
  }
25250
25250
  for (let key3 in object) {
25251
- const childPath = path2.slice();
25251
+ const childPath = path.slice();
25252
25252
  childPath.push(key3);
25253
25253
  try {
25254
25254
  checkErrors(childPath, object[key3]);
@@ -27302,11 +27302,11 @@ var init_typed_data2 = __esm({
27302
27302
  init_id2();
27303
27303
  __awaiter19 = function(thisArg, _arguments, P, generator) {
27304
27304
  function adopt(value) {
27305
- return value instanceof P ? value : new P(function(resolve2) {
27306
- resolve2(value);
27305
+ return value instanceof P ? value : new P(function(resolve) {
27306
+ resolve(value);
27307
27307
  });
27308
27308
  }
27309
- return new (P || (P = Promise))(function(resolve2, reject) {
27309
+ return new (P || (P = Promise))(function(resolve, reject) {
27310
27310
  function fulfilled(value) {
27311
27311
  try {
27312
27312
  step(generator.next(value));
@@ -27322,7 +27322,7 @@ var init_typed_data2 = __esm({
27322
27322
  }
27323
27323
  }
27324
27324
  function step(result) {
27325
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
27325
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27326
27326
  }
27327
27327
  step((generator = generator.apply(thisArg, _arguments || [])).next());
27328
27328
  });
@@ -28354,8 +28354,8 @@ function createCommonjsModule2(fn, basedir, module2) {
28354
28354
  return module2 = {
28355
28355
  path: basedir,
28356
28356
  exports: {},
28357
- require: function(path2, base3) {
28358
- return commonjsRequire2(path2, base3 === void 0 || base3 === null ? module2.path : base3);
28357
+ require: function(path, base3) {
28358
+ return commonjsRequire2(path, base3 === void 0 || base3 === null ? module2.path : base3);
28359
28359
  }
28360
28360
  }, fn(module2, module2.exports), module2.exports;
28361
28361
  }
@@ -30868,11 +30868,11 @@ var init_geturl2 = __esm({
30868
30868
  init_lib20();
30869
30869
  __awaiter20 = function(thisArg, _arguments, P, generator) {
30870
30870
  function adopt(value) {
30871
- return value instanceof P ? value : new P(function(resolve2) {
30872
- resolve2(value);
30871
+ return value instanceof P ? value : new P(function(resolve) {
30872
+ resolve(value);
30873
30873
  });
30874
30874
  }
30875
- return new (P || (P = Promise))(function(resolve2, reject) {
30875
+ return new (P || (P = Promise))(function(resolve, reject) {
30876
30876
  function fulfilled(value) {
30877
30877
  try {
30878
30878
  step(generator.next(value));
@@ -30888,7 +30888,7 @@ var init_geturl2 = __esm({
30888
30888
  }
30889
30889
  }
30890
30890
  function step(result) {
30891
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
30891
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
30892
30892
  }
30893
30893
  step((generator = generator.apply(thisArg, _arguments || [])).next());
30894
30894
  });
@@ -30898,8 +30898,8 @@ var init_geturl2 = __esm({
30898
30898
 
30899
30899
  // node_modules/ethers/node_modules/@ethersproject/web/lib.esm/index.js
30900
30900
  function staller2(duration) {
30901
- return new Promise((resolve2) => {
30902
- setTimeout(resolve2, duration);
30901
+ return new Promise((resolve) => {
30902
+ setTimeout(resolve, duration);
30903
30903
  });
30904
30904
  }
30905
30905
  function bodyify2(value, type) {
@@ -31019,7 +31019,7 @@ function _fetchData2(connection, body, processFunc) {
31019
31019
  options.headers = flatHeaders;
31020
31020
  const runningTimeout = (function() {
31021
31021
  let timer2 = null;
31022
- const promise = new Promise(function(resolve2, reject) {
31022
+ const promise = new Promise(function(resolve, reject) {
31023
31023
  if (timeout) {
31024
31024
  timer2 = setTimeout(() => {
31025
31025
  if (timer2 == null) {
@@ -31189,7 +31189,7 @@ function poll2(func, options) {
31189
31189
  if (options.interval == null) {
31190
31190
  options.interval = 250;
31191
31191
  }
31192
- return new Promise(function(resolve2, reject) {
31192
+ return new Promise(function(resolve, reject) {
31193
31193
  let timer2 = null;
31194
31194
  let done = false;
31195
31195
  const cancel = () => {
@@ -31215,7 +31215,7 @@ function poll2(func, options) {
31215
31215
  return func().then(function(result) {
31216
31216
  if (result !== void 0) {
31217
31217
  if (cancel()) {
31218
- resolve2(result);
31218
+ resolve(result);
31219
31219
  }
31220
31220
  } else if (options.oncePoll) {
31221
31221
  options.oncePoll.once("poll", check);
@@ -31261,11 +31261,11 @@ var init_lib48 = __esm({
31261
31261
  init_geturl2();
31262
31262
  __awaiter21 = function(thisArg, _arguments, P, generator) {
31263
31263
  function adopt(value) {
31264
- return value instanceof P ? value : new P(function(resolve2) {
31265
- resolve2(value);
31264
+ return value instanceof P ? value : new P(function(resolve) {
31265
+ resolve(value);
31266
31266
  });
31267
31267
  }
31268
- return new (P || (P = Promise))(function(resolve2, reject) {
31268
+ return new (P || (P = Promise))(function(resolve, reject) {
31269
31269
  function fulfilled(value) {
31270
31270
  try {
31271
31271
  step(generator.next(value));
@@ -31281,7 +31281,7 @@ var init_lib48 = __esm({
31281
31281
  }
31282
31282
  }
31283
31283
  function step(result) {
31284
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
31284
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
31285
31285
  }
31286
31286
  step((generator = generator.apply(thisArg, _arguments || [])).next());
31287
31287
  });
@@ -31488,17 +31488,10 @@ var init_lib49 = __esm({
31488
31488
  });
31489
31489
 
31490
31490
  // config/env.config.ts
31491
- import * as dotenv from "dotenv";
31492
- import * as path from "path";
31493
31491
  function getEnvValue(key3, defaultValue) {
31494
- const envDefine = Object.keys(env).reduce((acc, curr) => {
31495
- acc[`process.env.${curr}`] = JSON.stringify(env[curr] || process.env[curr]);
31496
- return acc;
31497
- }, {});
31498
- console.log(`Loaded environment variables: ${JSON.stringify(envDefine)}`);
31499
31492
  const value = process.env[key3];
31500
31493
  if (value === void 0 || value === "") {
31501
- console.log(`Environment variable ${key3} is not set, using default value: ${defaultValue}`);
31494
+ console.warn(`Environment variable ${key3} is not set, using default value: ${defaultValue}`);
31502
31495
  return defaultValue;
31503
31496
  }
31504
31497
  return value;
@@ -31541,20 +31534,20 @@ function loadConfig() {
31541
31534
  )
31542
31535
  },
31543
31536
  contracts: {
31544
- mutiVoucher: getEnvValue("MutiVoucher", ""),
31537
+ mutiVoucher: getEnvValue("MutiVoucher", "0x0000000000000000000000000000000000000044"),
31545
31538
  auction: {
31546
- chainYVaultV2: getEnvValue("ChainYVaultV2", ""),
31547
- chainXAuctionV2: getEnvValue("ChainXAuctionV2", ""),
31548
- coinbase: getEnvValue("Coinbase", "")
31539
+ chainYVaultV2: getEnvValue("ChainYVaultV2", "0xAa9e62EB6d74d66Ff6720D1A8143c8237067Ff58"),
31540
+ chainXAuctionV2: getEnvValue("ChainXAuctionV2", "0x88566F811b751Fa527A0816d99d6968E00f2eBef"),
31541
+ coinbase: getEnvValue("Coinbase", "0xAa9e62EB6d74d66Ff6720D1A8143c8237067Ff58")
31549
31542
  },
31550
31543
  uniswap: {
31551
- create2: getEnvValue("Create2", "0x5FbDB2315678afecb367f032d93F642f64180aa3"),
31552
- token0: getEnvValue("Token0", "0x3e7B83B8bb8eE2D4d74ec805aeb1465e65E15E24"),
31553
- token1: getEnvValue("Token1", "0xF4DB8B5cC187B286Eb54Bf76c6b041286a46E4Ee"),
31554
- poolManager: getEnvValue("PoolManager", "0xDB0412DaB8210ccA6d9875eE0be7b580A3c12046"),
31555
- liquidPool: getEnvValue("LiquidPool", "0xBFd16A06062060FA08EFca22e3b6d334EcF3E2f0"),
31556
- limitOrder: getEnvValue("LimitOrder", "0x7982Cd1B4162c145e6c1a0f7fD3De4676950D040"),
31557
- dynamicFee: getEnvValue("DynamicFee", "0x541eEcD8E9A59476E436A766123B27330e149040")
31544
+ create2: getEnvValue("Create2", "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e"),
31545
+ token0: getEnvValue("Token0", "0x3E8d9Ad590542AE8731960202CE0334B5c7c317D"),
31546
+ token1: getEnvValue("Token1", "0xF8407E61094a14601a7224AB628152B309788659"),
31547
+ poolManager: getEnvValue("PoolManager", "0xEEB0F62083f9bcF1e161ABb1889E9c4C14b74D46"),
31548
+ liquidPool: getEnvValue("LiquidPool", "0x6E454E4110Cb7FD3D77e43Fb02D52f8D49fa78e6"),
31549
+ limitOrder: getEnvValue("LimitOrder", "0x865d655032B0532a6D15EC26cBC23B9F49121040"),
31550
+ dynamicFee: getEnvValue("DynamicFee", "0x69dbAac488aa6cA7e023316D610c9B9327e85040")
31558
31551
  }
31559
31552
  },
31560
31553
  abiPaths: {
@@ -31588,16 +31581,15 @@ function loadConfig() {
31588
31581
  }
31589
31582
  };
31590
31583
  }
31591
- var env, config2, RPC_URL, PRIVATE_KEY, ACCOUNT_ADDR;
31584
+ var config, RPC_URL, PRIVATE_KEY, ACCOUNT_ADDR;
31592
31585
  var init_env_config = __esm({
31593
31586
  "config/env.config.ts"() {
31594
31587
  "use strict";
31595
31588
  init_lib49();
31596
- env = dotenv.config({ path: path.resolve(__dirname, "../.env") }).parsed || {};
31597
- config2 = loadConfig();
31598
- RPC_URL = config2.rpc.url;
31599
- PRIVATE_KEY = config2.wallet.privateKey;
31600
- ACCOUNT_ADDR = config2.wallet.address;
31589
+ config = loadConfig();
31590
+ RPC_URL = config.rpc.url;
31591
+ PRIVATE_KEY = config.wallet.privateKey;
31592
+ ACCOUNT_ADDR = config.wallet.address;
31601
31593
  }
31602
31594
  });
31603
31595
 
@@ -35284,13 +35276,13 @@ var init_uniswap_config = __esm({
35284
35276
  init_Create2();
35285
35277
  init_Example();
35286
35278
  CONTRACT_ADDRESSES = {
35287
- Create2: config2.contracts.uniswap.create2,
35288
- Token0: config2.contracts.uniswap.token0,
35289
- Token1: config2.contracts.uniswap.token1,
35290
- PoolManager: config2.contracts.uniswap.poolManager,
35291
- LiquidPool: config2.contracts.uniswap.liquidPool,
35292
- LimitOrder: config2.contracts.uniswap.limitOrder,
35293
- DynamicFee: config2.contracts.uniswap.dynamicFee
35279
+ Create2: config.contracts.uniswap.create2,
35280
+ Token0: config.contracts.uniswap.token0,
35281
+ Token1: config.contracts.uniswap.token1,
35282
+ PoolManager: config.contracts.uniswap.poolManager,
35283
+ LiquidPool: config.contracts.uniswap.liquidPool,
35284
+ LimitOrder: config.contracts.uniswap.limitOrder,
35285
+ DynamicFee: config.contracts.uniswap.dynamicFee
35294
35286
  };
35295
35287
  CONTRACTS_ABI = {
35296
35288
  PoolManager: PoolManager_default,
@@ -35301,13 +35293,13 @@ var init_uniswap_config = __esm({
35301
35293
  Create2: Create2_default,
35302
35294
  Example: Example_default
35303
35295
  };
35304
- SALT = config2.pool.salt;
35305
- SALT_LIMITORDER = config2.pool.saltLimitOrder;
35306
- PRICE_INIT = config2.pool.priceInit;
35307
- PRICE_LIMIT = config2.pool.priceLimit;
35308
- INITIAL_LIQUIDITY = config2.pool.initialLiquidity;
35309
- INITIAL_SUPPLY = config2.pool.initialSupply;
35310
- DYNAMIC_FEE_FLAG = config2.pool.dynamicFeeFlag;
35296
+ SALT = config.pool.salt;
35297
+ SALT_LIMITORDER = config.pool.saltLimitOrder;
35298
+ PRICE_INIT = config.pool.priceInit;
35299
+ PRICE_LIMIT = config.pool.priceLimit;
35300
+ INITIAL_LIQUIDITY = config.pool.initialLiquidity;
35301
+ INITIAL_SUPPLY = config.pool.initialSupply;
35302
+ DYNAMIC_FEE_FLAG = config.pool.dynamicFeeFlag;
35311
35303
  POOL_KEYS = {
35312
35304
  limitOrderPoolKey: {
35313
35305
  currency0: CONTRACT_ADDRESSES.Token0,
@@ -35538,6 +35530,7 @@ function getAbi(artifact) {
35538
35530
  return artifact.abi ? artifact.abi : artifact;
35539
35531
  }
35540
35532
  async function getContract(wallet, name) {
35533
+ console.log(`Getting contract `, name, CONTRACT_ADDRESSES.LiquidPool);
35541
35534
  switch (name) {
35542
35535
  case "Token0":
35543
35536
  return new ethers_exports.Contract(CONTRACT_ADDRESSES.Token0, getAbi(CONTRACTS_ABI.MockERC20), wallet);
@@ -35573,9 +35566,9 @@ var require_place = __commonJS({
35573
35566
  const tx = await contract.place(poolKey, tickLower, zeroForOne, liquidity);
35574
35567
  await tx.wait();
35575
35568
  console.log("Limit order set successfully:");
35576
- return new Promise((resolve2, reject) => {
35569
+ return new Promise((resolve, reject) => {
35577
35570
  contract.once("Place", (owner, epoch, key3, tickLower2, zeroForOne2, liquidity2) => {
35578
- resolve2({
35571
+ resolve({
35579
35572
  owner,
35580
35573
  epoch: epoch.toString(),
35581
35574
  key: key3,
@@ -35649,9 +35642,15 @@ var index_exports = {};
35649
35642
  __export(index_exports, {
35650
35643
  BuildUseVoucherTx: () => BuildUseVoucherTx,
35651
35644
  addLiq: () => addLiq,
35645
+ amount0: () => amount0,
35646
+ amount1: () => amount1,
35652
35647
  balanceOf: () => balanceOf,
35653
35648
  buyVoucher: () => buyVoucher,
35654
35649
  buyVoucherWithEth: () => buyVoucherWithEth,
35650
+ calculateLiqDelta: () => calculateLiqDelta,
35651
+ calculatePriceFromTick: () => calculatePriceFromTick,
35652
+ calculateTickFromPrice: () => calculateTickFromPrice,
35653
+ calculateTickFromPriceWithSpacing: () => calculateTickFromPriceWithSpacing,
35655
35654
  createAuction: () => createAuction,
35656
35655
  createAuctionConfig: () => createAuctionConfig,
35657
35656
  createAuctionOnVault: () => createAuction2,
@@ -35670,12 +35669,16 @@ __export(index_exports, {
35670
35669
  getPoolPrice: () => getPoolPrice,
35671
35670
  getPoolSqrtPrice: () => getPoolSqrtPrice,
35672
35671
  getProvider: () => getProvider,
35672
+ getSqrtPriceAtTick: () => getSqrtPriceAtTick,
35673
35673
  getVoucherContract: () => getVoucherContract,
35674
35674
  getVoucherInfo: () => getVoucherInfo,
35675
+ liquidity0: () => liquidity0,
35676
+ liquidity1: () => liquidity1,
35675
35677
  main: () => main,
35676
35678
  modifyPosition: () => modifyPosition,
35677
35679
  mutiVoucherABI: () => mutiVoucherABI,
35678
35680
  placeBid: () => placeBid,
35681
+ priceToSqrtPrice: () => priceToSqrtPrice,
35679
35682
  revealBid: () => revealBid,
35680
35683
  revealLock: () => revealLock,
35681
35684
  submitMatchResults: () => submitMatchResults,
@@ -37574,9 +37577,9 @@ var ChainYVaultV2_default = {
37574
37577
  };
37575
37578
 
37576
37579
  // config/auction.config.ts
37577
- var chainXAuctionV2Addr = config2.contracts.auction.chainXAuctionV2;
37578
- var chainYVaultV2Addr = config2.contracts.auction.chainYVaultV2;
37579
- var coinbaseAddr = config2.contracts.auction.coinbase;
37580
+ var chainXAuctionV2Addr = config.contracts.auction.chainXAuctionV2;
37581
+ var chainYVaultV2Addr = config.contracts.auction.chainYVaultV2;
37582
+ var coinbaseAddr = config.contracts.auction.coinbase;
37580
37583
  var AUCTION_ADDR = {
37581
37584
  chainXAuction: chainXAuctionV2Addr,
37582
37585
  chainYVault: chainYVaultV2Addr,
@@ -38058,6 +38061,7 @@ if (typeof __require !== "undefined" && typeof module !== "undefined" && __requi
38058
38061
  __reExport(index_exports, __toESM(require_place()));
38059
38062
  init_contract();
38060
38063
  init_pool();
38064
+ init_liqCalculation();
38061
38065
 
38062
38066
  // src/voucher.ts
38063
38067
  init_lib49();
@@ -38253,7 +38257,7 @@ var MutiVoucher_default = {
38253
38257
  };
38254
38258
 
38255
38259
  // config/voucher.config.ts
38256
- var MUTI_VOUCHER_ADDR = config2.contracts.mutiVoucher;
38260
+ var MUTI_VOUCHER_ADDR = config.contracts.mutiVoucher;
38257
38261
  var MUTI_VOUCHER_ABI = MutiVoucher_default;
38258
38262
 
38259
38263
  // src/voucher.ts
@@ -38314,9 +38318,15 @@ function BuildUseVoucherTx(tx, voucherName) {
38314
38318
  export {
38315
38319
  BuildUseVoucherTx,
38316
38320
  addLiq,
38321
+ amount0,
38322
+ amount1,
38317
38323
  balanceOf,
38318
38324
  buyVoucher,
38319
38325
  buyVoucherWithEth,
38326
+ calculateLiqDelta,
38327
+ calculatePriceFromTick,
38328
+ calculateTickFromPrice,
38329
+ calculateTickFromPriceWithSpacing,
38320
38330
  createAuction,
38321
38331
  createAuctionConfig,
38322
38332
  createAuction2 as createAuctionOnVault,
@@ -38335,12 +38345,16 @@ export {
38335
38345
  getPoolPrice,
38336
38346
  getPoolSqrtPrice,
38337
38347
  getProvider,
38348
+ getSqrtPriceAtTick,
38338
38349
  getVoucherContract,
38339
38350
  getVoucherInfo,
38351
+ liquidity0,
38352
+ liquidity1,
38340
38353
  main,
38341
38354
  modifyPosition,
38342
38355
  mutiVoucherABI,
38343
38356
  placeBid,
38357
+ priceToSqrtPrice,
38344
38358
  revealBid,
38345
38359
  revealLock,
38346
38360
  submitMatchResults,