punkkit-sdk 1.0.14 → 1.0.17

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 (3) hide show
  1. package/dist/index.js +246 -249
  2. package/dist/index.mjs +246 -249
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1903,6 +1903,10 @@ var require_bn = __commonJS({
1903
1903
  var mask = 67108863 ^ 67108863 >>> r3 << r3;
1904
1904
  this.words[this.length - 1] &= mask;
1905
1905
  }
1906
+ if (this.length === 0) {
1907
+ this.words[0] = 0;
1908
+ this.length = 1;
1909
+ }
1906
1910
  return this._strip();
1907
1911
  };
1908
1912
  BN5.prototype.maskn = function maskn(bits) {
@@ -4363,11 +4367,11 @@ var init_lib4 = __esm({
4363
4367
  init_version4();
4364
4368
  __awaiter = function(thisArg, _arguments, P, generator) {
4365
4369
  function adopt(value) {
4366
- return value instanceof P ? value : new P(function(resolve2) {
4367
- resolve2(value);
4370
+ return value instanceof P ? value : new P(function(resolve) {
4371
+ resolve(value);
4368
4372
  });
4369
4373
  }
4370
- return new (P || (P = Promise))(function(resolve2, reject) {
4374
+ return new (P || (P = Promise))(function(resolve, reject) {
4371
4375
  function fulfilled(value) {
4372
4376
  try {
4373
4377
  step(generator.next(value));
@@ -4383,7 +4387,7 @@ var init_lib4 = __esm({
4383
4387
  }
4384
4388
  }
4385
4389
  function step(result) {
4386
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
4390
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
4387
4391
  }
4388
4392
  step((generator = generator.apply(thisArg, _arguments || [])).next());
4389
4393
  });
@@ -5231,12 +5235,12 @@ var init_fragments = __esm({
5231
5235
  // node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js
5232
5236
  function checkResultErrors(result) {
5233
5237
  const errors = [];
5234
- const checkErrors = function(path2, object) {
5238
+ const checkErrors = function(path, object) {
5235
5239
  if (!Array.isArray(object)) {
5236
5240
  return;
5237
5241
  }
5238
5242
  for (let key3 in object) {
5239
- const childPath = path2.slice();
5243
+ const childPath = path.slice();
5240
5244
  childPath.push(key3);
5241
5245
  try {
5242
5246
  checkErrors(childPath, object[key3]);
@@ -7695,11 +7699,11 @@ var init_typed_data = __esm({
7695
7699
  init_id();
7696
7700
  __awaiter2 = function(thisArg, _arguments, P, generator) {
7697
7701
  function adopt(value) {
7698
- return value instanceof P ? value : new P(function(resolve2) {
7699
- resolve2(value);
7702
+ return value instanceof P ? value : new P(function(resolve) {
7703
+ resolve(value);
7700
7704
  });
7701
7705
  }
7702
- return new (P || (P = Promise))(function(resolve2, reject) {
7706
+ return new (P || (P = Promise))(function(resolve, reject) {
7703
7707
  function fulfilled(value) {
7704
7708
  try {
7705
7709
  step(generator.next(value));
@@ -7715,7 +7719,7 @@ var init_typed_data = __esm({
7715
7719
  }
7716
7720
  }
7717
7721
  function step(result) {
7718
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
7722
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
7719
7723
  }
7720
7724
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7721
7725
  });
@@ -8656,11 +8660,11 @@ var init_lib14 = __esm({
8656
8660
  init_version10();
8657
8661
  __awaiter3 = function(thisArg, _arguments, P, generator) {
8658
8662
  function adopt(value) {
8659
- return value instanceof P ? value : new P(function(resolve2) {
8660
- resolve2(value);
8663
+ return value instanceof P ? value : new P(function(resolve) {
8664
+ resolve(value);
8661
8665
  });
8662
8666
  }
8663
- return new (P || (P = Promise))(function(resolve2, reject) {
8667
+ return new (P || (P = Promise))(function(resolve, reject) {
8664
8668
  function fulfilled(value) {
8665
8669
  try {
8666
8670
  step(generator.next(value));
@@ -8676,7 +8680,7 @@ var init_lib14 = __esm({
8676
8680
  }
8677
8681
  }
8678
8682
  function step(result) {
8679
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
8683
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
8680
8684
  }
8681
8685
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8682
8686
  });
@@ -8743,11 +8747,11 @@ var init_lib15 = __esm({
8743
8747
  init_version11();
8744
8748
  __awaiter4 = function(thisArg, _arguments, P, generator) {
8745
8749
  function adopt(value) {
8746
- return value instanceof P ? value : new P(function(resolve2) {
8747
- resolve2(value);
8750
+ return value instanceof P ? value : new P(function(resolve) {
8751
+ resolve(value);
8748
8752
  });
8749
8753
  }
8750
- return new (P || (P = Promise))(function(resolve2, reject) {
8754
+ return new (P || (P = Promise))(function(resolve, reject) {
8751
8755
  function fulfilled(value) {
8752
8756
  try {
8753
8757
  step(generator.next(value));
@@ -8763,7 +8767,7 @@ var init_lib15 = __esm({
8763
8767
  }
8764
8768
  }
8765
8769
  function step(result) {
8766
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
8770
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
8767
8771
  }
8768
8772
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8769
8773
  });
@@ -10738,8 +10742,8 @@ function createCommonjsModule(fn, basedir, module2) {
10738
10742
  return module2 = {
10739
10743
  path: basedir,
10740
10744
  exports: {},
10741
- require: function(path2, base3) {
10742
- 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);
10743
10747
  }
10744
10748
  }, fn(module2, module2.exports), module2.exports;
10745
10749
  }
@@ -13432,11 +13436,11 @@ var init_lib18 = __esm({
13432
13436
  init_version14();
13433
13437
  __awaiter5 = function(thisArg, _arguments, P, generator) {
13434
13438
  function adopt(value) {
13435
- return value instanceof P ? value : new P(function(resolve2) {
13436
- resolve2(value);
13439
+ return value instanceof P ? value : new P(function(resolve) {
13440
+ resolve(value);
13437
13441
  });
13438
13442
  }
13439
- return new (P || (P = Promise))(function(resolve2, reject) {
13443
+ return new (P || (P = Promise))(function(resolve, reject) {
13440
13444
  function fulfilled(value) {
13441
13445
  try {
13442
13446
  step(generator.next(value));
@@ -13452,7 +13456,7 @@ var init_lib18 = __esm({
13452
13456
  }
13453
13457
  }
13454
13458
  function step(result) {
13455
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
13459
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
13456
13460
  }
13457
13461
  step((generator = generator.apply(thisArg, _arguments || [])).next());
13458
13462
  });
@@ -15528,11 +15532,11 @@ var init_lib22 = __esm({
15528
15532
  init_version18();
15529
15533
  __awaiter6 = function(thisArg, _arguments, P, generator) {
15530
15534
  function adopt(value) {
15531
- return value instanceof P ? value : new P(function(resolve2) {
15532
- resolve2(value);
15535
+ return value instanceof P ? value : new P(function(resolve) {
15536
+ resolve(value);
15533
15537
  });
15534
15538
  }
15535
- return new (P || (P = Promise))(function(resolve2, reject) {
15539
+ return new (P || (P = Promise))(function(resolve, reject) {
15536
15540
  function fulfilled(value) {
15537
15541
  try {
15538
15542
  step(generator.next(value));
@@ -15548,7 +15552,7 @@ var init_lib22 = __esm({
15548
15552
  }
15549
15553
  }
15550
15554
  function step(result) {
15551
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
15555
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
15552
15556
  }
15553
15557
  step((generator = generator.apply(thisArg, _arguments || [])).next());
15554
15558
  });
@@ -15584,11 +15588,11 @@ var init_lib23 = __esm({
15584
15588
  init_version19();
15585
15589
  __awaiter7 = function(thisArg, _arguments, P, generator) {
15586
15590
  function adopt(value) {
15587
- return value instanceof P ? value : new P(function(resolve2) {
15588
- resolve2(value);
15591
+ return value instanceof P ? value : new P(function(resolve) {
15592
+ resolve(value);
15589
15593
  });
15590
15594
  }
15591
- return new (P || (P = Promise))(function(resolve2, reject) {
15595
+ return new (P || (P = Promise))(function(resolve, reject) {
15592
15596
  function fulfilled(value) {
15593
15597
  try {
15594
15598
  step(generator.next(value));
@@ -15604,7 +15608,7 @@ var init_lib23 = __esm({
15604
15608
  }
15605
15609
  }
15606
15610
  function step(result) {
15607
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
15611
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
15608
15612
  }
15609
15613
  step((generator = generator.apply(thisArg, _arguments || [])).next());
15610
15614
  });
@@ -16389,9 +16393,9 @@ var init_lib28 = __esm({
16389
16393
  if (index > 4294967295) {
16390
16394
  throw new Error("invalid index - " + String(index));
16391
16395
  }
16392
- let path2 = this.path;
16393
- if (path2) {
16394
- path2 += "/" + (index & ~HardenedBit);
16396
+ let path = this.path;
16397
+ if (path) {
16398
+ path += "/" + (index & ~HardenedBit);
16395
16399
  }
16396
16400
  const data = new Uint8Array(37);
16397
16401
  if (index & HardenedBit) {
@@ -16399,8 +16403,8 @@ var init_lib28 = __esm({
16399
16403
  throw new Error("cannot derive child of neutered node");
16400
16404
  }
16401
16405
  data.set(arrayify(this.privateKey), 1);
16402
- if (path2) {
16403
- path2 += "'";
16406
+ if (path) {
16407
+ path += "'";
16404
16408
  }
16405
16409
  } else {
16406
16410
  data.set(arrayify(this.publicKey));
@@ -16419,21 +16423,21 @@ var init_lib28 = __esm({
16419
16423
  const ek = new SigningKey(hexlify(IL));
16420
16424
  Ki = ek._addPoint(this.publicKey);
16421
16425
  }
16422
- let mnemonicOrPath = path2;
16426
+ let mnemonicOrPath = path;
16423
16427
  const srcMnemonic = this.mnemonic;
16424
16428
  if (srcMnemonic) {
16425
16429
  mnemonicOrPath = Object.freeze({
16426
16430
  phrase: srcMnemonic.phrase,
16427
- path: path2,
16431
+ path,
16428
16432
  locale: srcMnemonic.locale || "en"
16429
16433
  });
16430
16434
  }
16431
16435
  return new _HDNode(_constructorGuard6, ki, Ki, this.fingerprint, bytes32(IR), index, this.depth + 1, mnemonicOrPath);
16432
16436
  }
16433
- derivePath(path2) {
16434
- const components = path2.split("/");
16437
+ derivePath(path) {
16438
+ const components = path.split("/");
16435
16439
  if (components.length === 0 || components[0] === "m" && this.depth !== 0) {
16436
- throw new Error("invalid path - " + path2);
16440
+ throw new Error("invalid path - " + path);
16437
16441
  }
16438
16442
  if (components[0] === "m") {
16439
16443
  components.shift();
@@ -17168,9 +17172,9 @@ function getPassword(password) {
17168
17172
  }
17169
17173
  return arrayify(password);
17170
17174
  }
17171
- function searchPath(object, path2) {
17175
+ function searchPath(object, path) {
17172
17176
  let currentChild = object;
17173
- const comps = path2.toLowerCase().split("/");
17177
+ const comps = path.toLowerCase().split("/");
17174
17178
  for (let i = 0; i < comps.length; i++) {
17175
17179
  let matchingChild = null;
17176
17180
  for (const key3 in currentChild) {
@@ -17734,7 +17738,7 @@ var require_scrypt = __commonJS({
17734
17738
  }
17735
17739
  const lib = {
17736
17740
  scrypt: function(password, salt, N2, r3, p, dkLen, progressCallback) {
17737
- return new Promise(function(resolve2, reject) {
17741
+ return new Promise(function(resolve, reject) {
17738
17742
  let lastProgress = 0;
17739
17743
  if (progressCallback) {
17740
17744
  progressCallback(0);
@@ -17746,7 +17750,7 @@ var require_scrypt = __commonJS({
17746
17750
  if (progressCallback && lastProgress !== 1) {
17747
17751
  progressCallback(1);
17748
17752
  }
17749
- resolve2(new Uint8Array(key3));
17753
+ resolve(new Uint8Array(key3));
17750
17754
  } else if (progressCallback && progress !== lastProgress) {
17751
17755
  lastProgress = progress;
17752
17756
  return progressCallback(progress);
@@ -17819,12 +17823,12 @@ function _getAccount(data, key3) {
17819
17823
  const mnemonicIv = looseArrayify(searchPath(data, "x-ethers/mnemonicCounter"));
17820
17824
  const mnemonicCounter = new import_aes_js2.default.Counter(mnemonicIv);
17821
17825
  const mnemonicAesCtr = new import_aes_js2.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);
17822
- const path2 = searchPath(data, "x-ethers/path") || defaultPath;
17826
+ const path = searchPath(data, "x-ethers/path") || defaultPath;
17823
17827
  const locale = searchPath(data, "x-ethers/locale") || "en";
17824
17828
  const entropy = arrayify(mnemonicAesCtr.decrypt(mnemonicCiphertext));
17825
17829
  try {
17826
17830
  const mnemonic = entropyToMnemonic(entropy, locale);
17827
- const node = HDNode.fromMnemonic(mnemonic, null, locale).derivePath(path2);
17831
+ const node = HDNode.fromMnemonic(mnemonic, null, locale).derivePath(path);
17828
17832
  if (node.privateKey != account.privateKey) {
17829
17833
  throw new Error("mnemonic mismatch");
17830
17834
  }
@@ -17924,12 +17928,12 @@ function encrypt(account, password, options, progressCallback) {
17924
17928
  const privateKey = arrayify(account.privateKey);
17925
17929
  const passwordBytes = getPassword(password);
17926
17930
  let entropy = null;
17927
- let path2 = null;
17931
+ let path = null;
17928
17932
  let locale = null;
17929
17933
  if (hasMnemonic(account)) {
17930
17934
  const srcMnemonic = account.mnemonic;
17931
17935
  entropy = arrayify(mnemonicToEntropy(srcMnemonic.phrase, srcMnemonic.locale || "en"));
17932
- path2 = srcMnemonic.path || defaultPath;
17936
+ path = srcMnemonic.path || defaultPath;
17933
17937
  locale = srcMnemonic.locale || "en";
17934
17938
  }
17935
17939
  let client = options.client;
@@ -18015,7 +18019,7 @@ function encrypt(account, password, options, progressCallback) {
18015
18019
  gethFilename: "UTC--" + timestamp + "--" + data.address,
18016
18020
  mnemonicCounter: hexlify(mnemonicIv).substring(2),
18017
18021
  mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2),
18018
- path: path2,
18022
+ path,
18019
18023
  locale,
18020
18024
  version: "0.1"
18021
18025
  };
@@ -18042,11 +18046,11 @@ var init_keystore = __esm({
18042
18046
  init_version24();
18043
18047
  __awaiter8 = function(thisArg, _arguments, P, generator) {
18044
18048
  function adopt(value) {
18045
- return value instanceof P ? value : new P(function(resolve2) {
18046
- resolve2(value);
18049
+ return value instanceof P ? value : new P(function(resolve) {
18050
+ resolve(value);
18047
18051
  });
18048
18052
  }
18049
- return new (P || (P = Promise))(function(resolve2, reject) {
18053
+ return new (P || (P = Promise))(function(resolve, reject) {
18050
18054
  function fulfilled(value) {
18051
18055
  try {
18052
18056
  step(generator.next(value));
@@ -18062,7 +18066,7 @@ var init_keystore = __esm({
18062
18066
  }
18063
18067
  }
18064
18068
  function step(result) {
18065
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
18069
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18066
18070
  }
18067
18071
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18068
18072
  });
@@ -18154,11 +18158,11 @@ var init_lib31 = __esm({
18154
18158
  init_version25();
18155
18159
  __awaiter9 = function(thisArg, _arguments, P, generator) {
18156
18160
  function adopt(value) {
18157
- return value instanceof P ? value : new P(function(resolve2) {
18158
- resolve2(value);
18161
+ return value instanceof P ? value : new P(function(resolve) {
18162
+ resolve(value);
18159
18163
  });
18160
18164
  }
18161
- return new (P || (P = Promise))(function(resolve2, reject) {
18165
+ return new (P || (P = Promise))(function(resolve, reject) {
18162
18166
  function fulfilled(value) {
18163
18167
  try {
18164
18168
  step(generator.next(value));
@@ -18174,7 +18178,7 @@ var init_lib31 = __esm({
18174
18178
  }
18175
18179
  }
18176
18180
  function step(result) {
18177
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
18181
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18178
18182
  }
18179
18183
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18180
18184
  });
@@ -18309,11 +18313,11 @@ var init_lib31 = __esm({
18309
18313
  static fromEncryptedJsonSync(json, password) {
18310
18314
  return new _Wallet(decryptJsonWalletSync(json, password));
18311
18315
  }
18312
- static fromMnemonic(mnemonic, path2, wordlist2) {
18313
- if (!path2) {
18314
- path2 = defaultPath;
18316
+ static fromMnemonic(mnemonic, path, wordlist2) {
18317
+ if (!path) {
18318
+ path = defaultPath;
18315
18319
  }
18316
- return new _Wallet(HDNode.fromMnemonic(mnemonic, null, wordlist2).derivePath(path2));
18320
+ return new _Wallet(HDNode.fromMnemonic(mnemonic, null, wordlist2).derivePath(path));
18317
18321
  }
18318
18322
  };
18319
18323
  }
@@ -18722,11 +18726,11 @@ var init_geturl = __esm({
18722
18726
  init_lib2();
18723
18727
  __awaiter10 = function(thisArg, _arguments, P, generator) {
18724
18728
  function adopt(value) {
18725
- return value instanceof P ? value : new P(function(resolve2) {
18726
- resolve2(value);
18729
+ return value instanceof P ? value : new P(function(resolve) {
18730
+ resolve(value);
18727
18731
  });
18728
18732
  }
18729
- return new (P || (P = Promise))(function(resolve2, reject) {
18733
+ return new (P || (P = Promise))(function(resolve, reject) {
18730
18734
  function fulfilled(value) {
18731
18735
  try {
18732
18736
  step(generator.next(value));
@@ -18742,7 +18746,7 @@ var init_geturl = __esm({
18742
18746
  }
18743
18747
  }
18744
18748
  function step(result) {
18745
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
18749
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18746
18750
  }
18747
18751
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18748
18752
  });
@@ -18752,8 +18756,8 @@ var init_geturl = __esm({
18752
18756
 
18753
18757
  // node_modules/@ethersproject/web/lib.esm/index.js
18754
18758
  function staller(duration) {
18755
- return new Promise((resolve2) => {
18756
- setTimeout(resolve2, duration);
18759
+ return new Promise((resolve) => {
18760
+ setTimeout(resolve, duration);
18757
18761
  });
18758
18762
  }
18759
18763
  function bodyify(value, type) {
@@ -18873,7 +18877,7 @@ function _fetchData(connection, body, processFunc) {
18873
18877
  options.headers = flatHeaders;
18874
18878
  const runningTimeout = (function() {
18875
18879
  let timer2 = null;
18876
- const promise = new Promise(function(resolve2, reject) {
18880
+ const promise = new Promise(function(resolve, reject) {
18877
18881
  if (timeout) {
18878
18882
  timer2 = setTimeout(() => {
18879
18883
  if (timer2 == null) {
@@ -19043,7 +19047,7 @@ function poll(func, options) {
19043
19047
  if (options.interval == null) {
19044
19048
  options.interval = 250;
19045
19049
  }
19046
- return new Promise(function(resolve2, reject) {
19050
+ return new Promise(function(resolve, reject) {
19047
19051
  let timer2 = null;
19048
19052
  let done = false;
19049
19053
  const cancel = () => {
@@ -19069,7 +19073,7 @@ function poll(func, options) {
19069
19073
  return func().then(function(result) {
19070
19074
  if (result !== void 0) {
19071
19075
  if (cancel()) {
19072
- resolve2(result);
19076
+ resolve(result);
19073
19077
  }
19074
19078
  } else if (options.oncePoll) {
19075
19079
  options.oncePoll.once("poll", check);
@@ -19115,11 +19119,11 @@ var init_lib34 = __esm({
19115
19119
  init_geturl();
19116
19120
  __awaiter11 = function(thisArg, _arguments, P, generator) {
19117
19121
  function adopt(value) {
19118
- return value instanceof P ? value : new P(function(resolve2) {
19119
- resolve2(value);
19122
+ return value instanceof P ? value : new P(function(resolve) {
19123
+ resolve(value);
19120
19124
  });
19121
19125
  }
19122
- return new (P || (P = Promise))(function(resolve2, reject) {
19126
+ return new (P || (P = Promise))(function(resolve, reject) {
19123
19127
  function fulfilled(value) {
19124
19128
  try {
19125
19129
  step(generator.next(value));
@@ -19135,7 +19139,7 @@ var init_lib34 = __esm({
19135
19139
  }
19136
19140
  }
19137
19141
  function step(result) {
19138
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
19142
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
19139
19143
  }
19140
19144
  step((generator = generator.apply(thisArg, _arguments || [])).next());
19141
19145
  });
@@ -19801,8 +19805,8 @@ function getTime() {
19801
19805
  return (/* @__PURE__ */ new Date()).getTime();
19802
19806
  }
19803
19807
  function stall(duration) {
19804
- return new Promise((resolve2) => {
19805
- setTimeout(resolve2, duration);
19808
+ return new Promise((resolve) => {
19809
+ setTimeout(resolve, duration);
19806
19810
  });
19807
19811
  }
19808
19812
  function bytes32ify(value) {
@@ -19891,11 +19895,11 @@ var init_base_provider = __esm({
19891
19895
  init_formatter();
19892
19896
  __awaiter12 = function(thisArg, _arguments, P, generator) {
19893
19897
  function adopt(value) {
19894
- return value instanceof P ? value : new P(function(resolve2) {
19895
- resolve2(value);
19898
+ return value instanceof P ? value : new P(function(resolve) {
19899
+ resolve(value);
19896
19900
  });
19897
19901
  }
19898
- return new (P || (P = Promise))(function(resolve2, reject) {
19902
+ return new (P || (P = Promise))(function(resolve, reject) {
19899
19903
  function fulfilled(value) {
19900
19904
  try {
19901
19905
  step(generator.next(value));
@@ -19911,7 +19915,7 @@ var init_base_provider = __esm({
19911
19915
  }
19912
19916
  }
19913
19917
  function step(result) {
19914
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
19918
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
19915
19919
  }
19916
19920
  step((generator = generator.apply(thisArg, _arguments || [])).next());
19917
19921
  });
@@ -20704,7 +20708,7 @@ var init_base_provider = __esm({
20704
20708
  if ((receipt ? receipt.confirmations : 0) >= confirmations) {
20705
20709
  return receipt;
20706
20710
  }
20707
- return new Promise((resolve2, reject) => {
20711
+ return new Promise((resolve, reject) => {
20708
20712
  const cancelFuncs = [];
20709
20713
  let done = false;
20710
20714
  const alreadyDone = function() {
@@ -20724,7 +20728,7 @@ var init_base_provider = __esm({
20724
20728
  if (alreadyDone()) {
20725
20729
  return;
20726
20730
  }
20727
- resolve2(receipt2);
20731
+ resolve(receipt2);
20728
20732
  };
20729
20733
  this.on(transactionHash, minedHandler);
20730
20734
  cancelFuncs.push(() => {
@@ -21673,8 +21677,8 @@ function checkError(method, error, params) {
21673
21677
  throw error;
21674
21678
  }
21675
21679
  function timer(timeout) {
21676
- return new Promise(function(resolve2) {
21677
- setTimeout(resolve2, timeout);
21680
+ return new Promise(function(resolve) {
21681
+ setTimeout(resolve, timeout);
21678
21682
  });
21679
21683
  }
21680
21684
  function getResult(payload) {
@@ -21709,11 +21713,11 @@ var init_json_rpc_provider = __esm({
21709
21713
  init_base_provider();
21710
21714
  __awaiter13 = function(thisArg, _arguments, P, generator) {
21711
21715
  function adopt(value) {
21712
- return value instanceof P ? value : new P(function(resolve2) {
21713
- resolve2(value);
21716
+ return value instanceof P ? value : new P(function(resolve) {
21717
+ resolve(value);
21714
21718
  });
21715
21719
  }
21716
- return new (P || (P = Promise))(function(resolve2, reject) {
21720
+ return new (P || (P = Promise))(function(resolve, reject) {
21717
21721
  function fulfilled(value) {
21718
21722
  try {
21719
21723
  step(generator.next(value));
@@ -21729,7 +21733,7 @@ var init_json_rpc_provider = __esm({
21729
21733
  }
21730
21734
  }
21731
21735
  function step(result) {
21732
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
21736
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
21733
21737
  }
21734
21738
  step((generator = generator.apply(thisArg, _arguments || [])).next());
21735
21739
  });
@@ -21955,10 +21959,10 @@ var init_json_rpc_provider = __esm({
21955
21959
  constructor(url, network) {
21956
21960
  let networkOrReady = network;
21957
21961
  if (networkOrReady == null) {
21958
- networkOrReady = new Promise((resolve2, reject) => {
21962
+ networkOrReady = new Promise((resolve, reject) => {
21959
21963
  setTimeout(() => {
21960
21964
  this.detectNetwork().then((network2) => {
21961
- resolve2(network2);
21965
+ resolve(network2);
21962
21966
  }, (error) => {
21963
21967
  reject(error);
21964
21968
  });
@@ -22285,11 +22289,11 @@ var init_websocket_provider = __esm({
22285
22289
  init_version28();
22286
22290
  __awaiter14 = function(thisArg, _arguments, P, generator) {
22287
22291
  function adopt(value) {
22288
- return value instanceof P ? value : new P(function(resolve2) {
22289
- resolve2(value);
22292
+ return value instanceof P ? value : new P(function(resolve) {
22293
+ resolve(value);
22290
22294
  });
22291
22295
  }
22292
- return new (P || (P = Promise))(function(resolve2, reject) {
22296
+ return new (P || (P = Promise))(function(resolve, reject) {
22293
22297
  function fulfilled(value) {
22294
22298
  try {
22295
22299
  step(generator.next(value));
@@ -22305,7 +22309,7 @@ var init_websocket_provider = __esm({
22305
22309
  }
22306
22310
  }
22307
22311
  function step(result) {
22308
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
22312
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
22309
22313
  }
22310
22314
  step((generator = generator.apply(thisArg, _arguments || [])).next());
22311
22315
  });
@@ -22425,12 +22429,12 @@ var init_websocket_provider = __esm({
22425
22429
  }
22426
22430
  send(method, params) {
22427
22431
  const rid = NextId++;
22428
- return new Promise((resolve2, reject) => {
22432
+ return new Promise((resolve, reject) => {
22429
22433
  function callback(error, result) {
22430
22434
  if (error) {
22431
22435
  return reject(error);
22432
22436
  }
22433
- return resolve2(result);
22437
+ return resolve(result);
22434
22438
  }
22435
22439
  const payload = JSON.stringify({
22436
22440
  method,
@@ -22541,12 +22545,12 @@ var init_websocket_provider = __esm({
22541
22545
  destroy() {
22542
22546
  return __awaiter14(this, void 0, void 0, function* () {
22543
22547
  if (this.websocket.readyState === WS.CONNECTING) {
22544
- yield new Promise((resolve2) => {
22548
+ yield new Promise((resolve) => {
22545
22549
  this.websocket.onopen = function() {
22546
- resolve2(true);
22550
+ resolve(true);
22547
22551
  };
22548
22552
  this.websocket.onerror = function() {
22549
- resolve2(false);
22553
+ resolve(false);
22550
22554
  };
22551
22555
  });
22552
22556
  }
@@ -22568,11 +22572,11 @@ var init_url_json_rpc_provider = __esm({
22568
22572
  init_json_rpc_provider();
22569
22573
  __awaiter15 = function(thisArg, _arguments, P, generator) {
22570
22574
  function adopt(value) {
22571
- return value instanceof P ? value : new P(function(resolve2) {
22572
- resolve2(value);
22575
+ return value instanceof P ? value : new P(function(resolve) {
22576
+ resolve(value);
22573
22577
  });
22574
22578
  }
22575
- return new (P || (P = Promise))(function(resolve2, reject) {
22579
+ return new (P || (P = Promise))(function(resolve, reject) {
22576
22580
  function fulfilled(value) {
22577
22581
  try {
22578
22582
  step(generator.next(value));
@@ -22588,7 +22592,7 @@ var init_url_json_rpc_provider = __esm({
22588
22592
  }
22589
22593
  }
22590
22594
  function step(result) {
22591
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
22595
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
22592
22596
  }
22593
22597
  step((generator = generator.apply(thisArg, _arguments || [])).next());
22594
22598
  });
@@ -22815,11 +22819,11 @@ var init_cloudflare_provider = __esm({
22815
22819
  init_version28();
22816
22820
  __awaiter16 = function(thisArg, _arguments, P, generator) {
22817
22821
  function adopt(value) {
22818
- return value instanceof P ? value : new P(function(resolve2) {
22819
- resolve2(value);
22822
+ return value instanceof P ? value : new P(function(resolve) {
22823
+ resolve(value);
22820
22824
  });
22821
22825
  }
22822
- return new (P || (P = Promise))(function(resolve2, reject) {
22826
+ return new (P || (P = Promise))(function(resolve, reject) {
22823
22827
  function fulfilled(value) {
22824
22828
  try {
22825
22829
  step(generator.next(value));
@@ -22835,7 +22839,7 @@ var init_cloudflare_provider = __esm({
22835
22839
  }
22836
22840
  }
22837
22841
  function step(result) {
22838
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
22842
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
22839
22843
  }
22840
22844
  step((generator = generator.apply(thisArg, _arguments || [])).next());
22841
22845
  });
@@ -23018,11 +23022,11 @@ var init_etherscan_provider = __esm({
23018
23022
  init_base_provider();
23019
23023
  __awaiter17 = function(thisArg, _arguments, P, generator) {
23020
23024
  function adopt(value) {
23021
- return value instanceof P ? value : new P(function(resolve2) {
23022
- resolve2(value);
23025
+ return value instanceof P ? value : new P(function(resolve) {
23026
+ resolve(value);
23023
23027
  });
23024
23028
  }
23025
- return new (P || (P = Promise))(function(resolve2, reject) {
23029
+ return new (P || (P = Promise))(function(resolve, reject) {
23026
23030
  function fulfilled(value) {
23027
23031
  try {
23028
23032
  step(generator.next(value));
@@ -23038,7 +23042,7 @@ var init_etherscan_provider = __esm({
23038
23042
  }
23039
23043
  }
23040
23044
  function step(result) {
23041
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
23045
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
23042
23046
  }
23043
23047
  step((generator = generator.apply(thisArg, _arguments || [])).next());
23044
23048
  });
@@ -23370,13 +23374,13 @@ function serialize2(value) {
23370
23374
  function stall2(duration) {
23371
23375
  let cancel = null;
23372
23376
  let timer2 = null;
23373
- let promise = new Promise((resolve2) => {
23377
+ let promise = new Promise((resolve) => {
23374
23378
  cancel = function() {
23375
23379
  if (timer2) {
23376
23380
  clearTimeout(timer2);
23377
23381
  timer2 = null;
23378
23382
  }
23379
- resolve2();
23383
+ resolve();
23380
23384
  };
23381
23385
  timer2 = setTimeout(cancel, duration);
23382
23386
  });
@@ -23389,22 +23393,22 @@ function stall2(duration) {
23389
23393
  }
23390
23394
  return { cancel, getPromise, wait };
23391
23395
  }
23392
- function exposeDebugConfig(config3, now2) {
23396
+ function exposeDebugConfig(config2, now2) {
23393
23397
  const result = {
23394
- weight: config3.weight
23398
+ weight: config2.weight
23395
23399
  };
23396
- Object.defineProperty(result, "provider", { get: () => config3.provider });
23397
- if (config3.start) {
23398
- result.start = config3.start;
23400
+ Object.defineProperty(result, "provider", { get: () => config2.provider });
23401
+ if (config2.start) {
23402
+ result.start = config2.start;
23399
23403
  }
23400
23404
  if (now2) {
23401
- result.duration = now2 - config3.start;
23405
+ result.duration = now2 - config2.start;
23402
23406
  }
23403
- if (config3.done) {
23404
- if (config3.error) {
23405
- result.error = config3.error;
23407
+ if (config2.done) {
23408
+ if (config2.error) {
23409
+ result.error = config2.error;
23406
23410
  } else {
23407
- result.result = config3.result || null;
23411
+ result.result = config2.result || null;
23408
23412
  }
23409
23413
  }
23410
23414
  return result;
@@ -23508,30 +23512,30 @@ function getProcessFunc(provider, method, params) {
23508
23512
  }
23509
23513
  return normalizedTally(normalize3, provider.quorum);
23510
23514
  }
23511
- function waitForSync(config3, blockNumber) {
23515
+ function waitForSync(config2, blockNumber) {
23512
23516
  return __awaiter18(this, void 0, void 0, function* () {
23513
- const provider = config3.provider;
23517
+ const provider = config2.provider;
23514
23518
  if (provider.blockNumber != null && provider.blockNumber >= blockNumber || blockNumber === -1) {
23515
23519
  return provider;
23516
23520
  }
23517
23521
  return poll(() => {
23518
- return new Promise((resolve2, reject) => {
23522
+ return new Promise((resolve, reject) => {
23519
23523
  setTimeout(function() {
23520
23524
  if (provider.blockNumber >= blockNumber) {
23521
- return resolve2(provider);
23525
+ return resolve(provider);
23522
23526
  }
23523
- if (config3.cancelled) {
23524
- return resolve2(null);
23527
+ if (config2.cancelled) {
23528
+ return resolve(null);
23525
23529
  }
23526
- return resolve2(void 0);
23530
+ return resolve(void 0);
23527
23531
  }, 0);
23528
23532
  });
23529
23533
  }, { oncePoll: provider });
23530
23534
  });
23531
23535
  }
23532
- function getRunner(config3, currentBlockNumber, method, params) {
23536
+ function getRunner(config2, currentBlockNumber, method, params) {
23533
23537
  return __awaiter18(this, void 0, void 0, function* () {
23534
- let provider = config3.provider;
23538
+ let provider = config2.provider;
23535
23539
  switch (method) {
23536
23540
  case "getBlockNumber":
23537
23541
  case "getGasPrice":
@@ -23545,23 +23549,23 @@ function getRunner(config3, currentBlockNumber, method, params) {
23545
23549
  case "getTransactionCount":
23546
23550
  case "getCode":
23547
23551
  if (params.blockTag && isHexString(params.blockTag)) {
23548
- provider = yield waitForSync(config3, currentBlockNumber);
23552
+ provider = yield waitForSync(config2, currentBlockNumber);
23549
23553
  }
23550
23554
  return provider[method](params.address, params.blockTag || "latest");
23551
23555
  case "getStorageAt":
23552
23556
  if (params.blockTag && isHexString(params.blockTag)) {
23553
- provider = yield waitForSync(config3, currentBlockNumber);
23557
+ provider = yield waitForSync(config2, currentBlockNumber);
23554
23558
  }
23555
23559
  return provider.getStorageAt(params.address, params.position, params.blockTag || "latest");
23556
23560
  case "getBlock":
23557
23561
  if (params.blockTag && isHexString(params.blockTag)) {
23558
- provider = yield waitForSync(config3, currentBlockNumber);
23562
+ provider = yield waitForSync(config2, currentBlockNumber);
23559
23563
  }
23560
23564
  return provider[params.includeTransactions ? "getBlockWithTransactions" : "getBlock"](params.blockTag || params.blockHash);
23561
23565
  case "call":
23562
23566
  case "estimateGas":
23563
23567
  if (params.blockTag && isHexString(params.blockTag)) {
23564
- provider = yield waitForSync(config3, currentBlockNumber);
23568
+ provider = yield waitForSync(config2, currentBlockNumber);
23565
23569
  }
23566
23570
  if (method === "call" && params.blockTag) {
23567
23571
  return provider[method](params.transaction, params.blockTag);
@@ -23573,7 +23577,7 @@ function getRunner(config3, currentBlockNumber, method, params) {
23573
23577
  case "getLogs": {
23574
23578
  let filter = params.filter;
23575
23579
  if (filter.fromBlock && isHexString(filter.fromBlock) || filter.toBlock && isHexString(filter.toBlock)) {
23576
- provider = yield waitForSync(config3, currentBlockNumber);
23580
+ provider = yield waitForSync(config2, currentBlockNumber);
23577
23581
  }
23578
23582
  return provider.getLogs(filter);
23579
23583
  }
@@ -23600,11 +23604,11 @@ var init_fallback_provider = __esm({
23600
23604
  init_version28();
23601
23605
  __awaiter18 = function(thisArg, _arguments, P, generator) {
23602
23606
  function adopt(value) {
23603
- return value instanceof P ? value : new P(function(resolve2) {
23604
- resolve2(value);
23607
+ return value instanceof P ? value : new P(function(resolve) {
23608
+ resolve(value);
23605
23609
  });
23606
23610
  }
23607
- return new (P || (P = Promise))(function(resolve2, reject) {
23611
+ return new (P || (P = Promise))(function(resolve, reject) {
23608
23612
  function fulfilled(value) {
23609
23613
  try {
23610
23614
  step(generator.next(value));
@@ -23620,7 +23624,7 @@ var init_fallback_provider = __esm({
23620
23624
  }
23621
23625
  }
23622
23626
  function step(result) {
23623
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
23627
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
23624
23628
  }
23625
23629
  step((generator = generator.apply(thisArg, _arguments || [])).next());
23626
23630
  });
@@ -23653,21 +23657,21 @@ var init_fallback_provider = __esm({
23653
23657
  const priority = 1;
23654
23658
  return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout, priority });
23655
23659
  }
23656
- const config3 = shallowCopy(configOrProvider);
23657
- if (config3.priority == null) {
23658
- config3.priority = 1;
23660
+ const config2 = shallowCopy(configOrProvider);
23661
+ if (config2.priority == null) {
23662
+ config2.priority = 1;
23659
23663
  }
23660
- if (config3.stallTimeout == null) {
23661
- config3.stallTimeout = isCommunityResource(configOrProvider) ? 2e3 : 750;
23664
+ if (config2.stallTimeout == null) {
23665
+ config2.stallTimeout = isCommunityResource(configOrProvider) ? 2e3 : 750;
23662
23666
  }
23663
- if (config3.weight == null) {
23664
- config3.weight = 1;
23667
+ if (config2.weight == null) {
23668
+ config2.weight = 1;
23665
23669
  }
23666
- const weight = config3.weight;
23670
+ const weight = config2.weight;
23667
23671
  if (weight % 1 || weight > 512 || weight < 1) {
23668
23672
  logger43.throwArgumentError("invalid weight; must be integer in [1, 512]", `providers[${index}].weight`, weight);
23669
23673
  }
23670
- return Object.freeze(config3);
23674
+ return Object.freeze(config2);
23671
23675
  });
23672
23676
  const total = providerConfigs.reduce((accum, c) => accum + c.weight, 0);
23673
23677
  if (quorum == null) {
@@ -23677,9 +23681,9 @@ var init_fallback_provider = __esm({
23677
23681
  }
23678
23682
  let networkOrReady = checkNetworks(providerConfigs.map((c) => c.provider.network));
23679
23683
  if (networkOrReady == null) {
23680
- networkOrReady = new Promise((resolve2, reject) => {
23684
+ networkOrReady = new Promise((resolve, reject) => {
23681
23685
  setTimeout(() => {
23682
- this.detectNetwork().then(resolve2, reject);
23686
+ this.detectNetwork().then(resolve, reject);
23683
23687
  }, 0);
23684
23688
  });
23685
23689
  }
@@ -23725,33 +23729,33 @@ var init_fallback_provider = __esm({
23725
23729
  const t0 = now();
23726
23730
  let inflightWeight = configs.filter((c) => c.runner && t0 - c.start < c.stallTimeout).reduce((accum, c) => accum + c.weight, 0);
23727
23731
  while (inflightWeight < this.quorum && i < configs.length) {
23728
- const config3 = configs[i++];
23732
+ const config2 = configs[i++];
23729
23733
  const rid = nextRid++;
23730
- config3.start = now();
23731
- config3.staller = stall2(config3.stallTimeout);
23732
- config3.staller.wait(() => {
23733
- config3.staller = null;
23734
+ config2.start = now();
23735
+ config2.staller = stall2(config2.stallTimeout);
23736
+ config2.staller.wait(() => {
23737
+ config2.staller = null;
23734
23738
  });
23735
- config3.runner = getRunner(config3, currentBlockNumber, method, params).then((result) => {
23736
- config3.done = true;
23737
- config3.result = result;
23739
+ config2.runner = getRunner(config2, currentBlockNumber, method, params).then((result) => {
23740
+ config2.done = true;
23741
+ config2.result = result;
23738
23742
  if (this.listenerCount("debug")) {
23739
23743
  this.emit("debug", {
23740
23744
  action: "request",
23741
23745
  rid,
23742
- backend: exposeDebugConfig(config3, now()),
23746
+ backend: exposeDebugConfig(config2, now()),
23743
23747
  request: { method, params: deepCopy(params) },
23744
23748
  provider: this
23745
23749
  });
23746
23750
  }
23747
23751
  }, (error) => {
23748
- config3.done = true;
23749
- config3.error = error;
23752
+ config2.done = true;
23753
+ config2.error = error;
23750
23754
  if (this.listenerCount("debug")) {
23751
23755
  this.emit("debug", {
23752
23756
  action: "request",
23753
23757
  rid,
23754
- backend: exposeDebugConfig(config3, now()),
23758
+ backend: exposeDebugConfig(config2, now()),
23755
23759
  request: { method, params: deepCopy(params) },
23756
23760
  provider: this
23757
23761
  });
@@ -23761,12 +23765,12 @@ var init_fallback_provider = __esm({
23761
23765
  this.emit("debug", {
23762
23766
  action: "request",
23763
23767
  rid,
23764
- backend: exposeDebugConfig(config3, null),
23768
+ backend: exposeDebugConfig(config2, null),
23765
23769
  request: { method, params: deepCopy(params) },
23766
23770
  provider: this
23767
23771
  });
23768
23772
  }
23769
- inflightWeight += config3.weight;
23773
+ inflightWeight += config2.weight;
23770
23774
  }
23771
23775
  const waiting = [];
23772
23776
  configs.forEach((c) => {
@@ -24002,8 +24006,8 @@ var init_json_rpc_batch_provider = __esm({
24002
24006
  this._pendingBatch = [];
24003
24007
  }
24004
24008
  const inflightRequest = { request, resolve: null, reject: null };
24005
- const promise = new Promise((resolve2, reject) => {
24006
- inflightRequest.resolve = resolve2;
24009
+ const promise = new Promise((resolve, reject) => {
24010
+ inflightRequest.resolve = resolve;
24007
24011
  inflightRequest.reject = reject;
24008
24012
  });
24009
24013
  this._pendingBatch.push(inflightRequest);
@@ -24186,7 +24190,7 @@ function buildWeb3LegacyFetcher(provider, sendFunc) {
24186
24190
  id: _nextId++,
24187
24191
  jsonrpc: "2.0"
24188
24192
  };
24189
- return new Promise((resolve2, reject) => {
24193
+ return new Promise((resolve, reject) => {
24190
24194
  this.emit("debug", {
24191
24195
  action: "request",
24192
24196
  fetcher,
@@ -24217,7 +24221,7 @@ function buildWeb3LegacyFetcher(provider, sendFunc) {
24217
24221
  error2.data = response.error.data;
24218
24222
  return reject(error2);
24219
24223
  }
24220
- resolve2(response.result);
24224
+ resolve(response.result);
24221
24225
  });
24222
24226
  });
24223
24227
  };
@@ -24270,21 +24274,21 @@ var init_web3_provider = __esm({
24270
24274
  if (provider == null) {
24271
24275
  logger47.throwArgumentError("missing provider", "provider", provider);
24272
24276
  }
24273
- let path2 = null;
24277
+ let path = null;
24274
24278
  let jsonRpcFetchFunc = null;
24275
24279
  let subprovider = null;
24276
24280
  if (typeof provider === "function") {
24277
- path2 = "unknown:";
24281
+ path = "unknown:";
24278
24282
  jsonRpcFetchFunc = provider;
24279
24283
  } else {
24280
- path2 = provider.host || provider.path || "";
24281
- if (!path2 && provider.isMetaMask) {
24282
- path2 = "metamask";
24284
+ path = provider.host || provider.path || "";
24285
+ if (!path && provider.isMetaMask) {
24286
+ path = "metamask";
24283
24287
  }
24284
24288
  subprovider = provider;
24285
24289
  if (provider.request) {
24286
- if (path2 === "") {
24287
- path2 = "eip-1193:";
24290
+ if (path === "") {
24291
+ path = "eip-1193:";
24288
24292
  }
24289
24293
  jsonRpcFetchFunc = buildEip1193Fetcher(provider);
24290
24294
  } else if (provider.sendAsync) {
@@ -24294,11 +24298,11 @@ var init_web3_provider = __esm({
24294
24298
  } else {
24295
24299
  logger47.throwArgumentError("unsupported provider", "provider", provider);
24296
24300
  }
24297
- if (!path2) {
24298
- path2 = "unknown:";
24301
+ if (!path) {
24302
+ path = "unknown:";
24299
24303
  }
24300
24304
  }
24301
- super(path2, network);
24305
+ super(path, network);
24302
24306
  defineReadOnly(this, "jsonRpcFetchFunc", jsonRpcFetchFunc);
24303
24307
  defineReadOnly(this, "provider", subprovider);
24304
24308
  }
@@ -25239,12 +25243,12 @@ var init_fragments2 = __esm({
25239
25243
  // node_modules/ethers/node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js
25240
25244
  function checkResultErrors2(result) {
25241
25245
  const errors = [];
25242
- const checkErrors = function(path2, object) {
25246
+ const checkErrors = function(path, object) {
25243
25247
  if (!Array.isArray(object)) {
25244
25248
  return;
25245
25249
  }
25246
25250
  for (let key3 in object) {
25247
- const childPath = path2.slice();
25251
+ const childPath = path.slice();
25248
25252
  childPath.push(key3);
25249
25253
  try {
25250
25254
  checkErrors(childPath, object[key3]);
@@ -27298,11 +27302,11 @@ var init_typed_data2 = __esm({
27298
27302
  init_id2();
27299
27303
  __awaiter19 = function(thisArg, _arguments, P, generator) {
27300
27304
  function adopt(value) {
27301
- return value instanceof P ? value : new P(function(resolve2) {
27302
- resolve2(value);
27305
+ return value instanceof P ? value : new P(function(resolve) {
27306
+ resolve(value);
27303
27307
  });
27304
27308
  }
27305
- return new (P || (P = Promise))(function(resolve2, reject) {
27309
+ return new (P || (P = Promise))(function(resolve, reject) {
27306
27310
  function fulfilled(value) {
27307
27311
  try {
27308
27312
  step(generator.next(value));
@@ -27318,7 +27322,7 @@ var init_typed_data2 = __esm({
27318
27322
  }
27319
27323
  }
27320
27324
  function step(result) {
27321
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
27325
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27322
27326
  }
27323
27327
  step((generator = generator.apply(thisArg, _arguments || [])).next());
27324
27328
  });
@@ -28350,8 +28354,8 @@ function createCommonjsModule2(fn, basedir, module2) {
28350
28354
  return module2 = {
28351
28355
  path: basedir,
28352
28356
  exports: {},
28353
- require: function(path2, base3) {
28354
- 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);
28355
28359
  }
28356
28360
  }, fn(module2, module2.exports), module2.exports;
28357
28361
  }
@@ -30864,11 +30868,11 @@ var init_geturl2 = __esm({
30864
30868
  init_lib20();
30865
30869
  __awaiter20 = function(thisArg, _arguments, P, generator) {
30866
30870
  function adopt(value) {
30867
- return value instanceof P ? value : new P(function(resolve2) {
30868
- resolve2(value);
30871
+ return value instanceof P ? value : new P(function(resolve) {
30872
+ resolve(value);
30869
30873
  });
30870
30874
  }
30871
- return new (P || (P = Promise))(function(resolve2, reject) {
30875
+ return new (P || (P = Promise))(function(resolve, reject) {
30872
30876
  function fulfilled(value) {
30873
30877
  try {
30874
30878
  step(generator.next(value));
@@ -30884,7 +30888,7 @@ var init_geturl2 = __esm({
30884
30888
  }
30885
30889
  }
30886
30890
  function step(result) {
30887
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
30891
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
30888
30892
  }
30889
30893
  step((generator = generator.apply(thisArg, _arguments || [])).next());
30890
30894
  });
@@ -30894,8 +30898,8 @@ var init_geturl2 = __esm({
30894
30898
 
30895
30899
  // node_modules/ethers/node_modules/@ethersproject/web/lib.esm/index.js
30896
30900
  function staller2(duration) {
30897
- return new Promise((resolve2) => {
30898
- setTimeout(resolve2, duration);
30901
+ return new Promise((resolve) => {
30902
+ setTimeout(resolve, duration);
30899
30903
  });
30900
30904
  }
30901
30905
  function bodyify2(value, type) {
@@ -31015,7 +31019,7 @@ function _fetchData2(connection, body, processFunc) {
31015
31019
  options.headers = flatHeaders;
31016
31020
  const runningTimeout = (function() {
31017
31021
  let timer2 = null;
31018
- const promise = new Promise(function(resolve2, reject) {
31022
+ const promise = new Promise(function(resolve, reject) {
31019
31023
  if (timeout) {
31020
31024
  timer2 = setTimeout(() => {
31021
31025
  if (timer2 == null) {
@@ -31185,7 +31189,7 @@ function poll2(func, options) {
31185
31189
  if (options.interval == null) {
31186
31190
  options.interval = 250;
31187
31191
  }
31188
- return new Promise(function(resolve2, reject) {
31192
+ return new Promise(function(resolve, reject) {
31189
31193
  let timer2 = null;
31190
31194
  let done = false;
31191
31195
  const cancel = () => {
@@ -31211,7 +31215,7 @@ function poll2(func, options) {
31211
31215
  return func().then(function(result) {
31212
31216
  if (result !== void 0) {
31213
31217
  if (cancel()) {
31214
- resolve2(result);
31218
+ resolve(result);
31215
31219
  }
31216
31220
  } else if (options.oncePoll) {
31217
31221
  options.oncePoll.once("poll", check);
@@ -31257,11 +31261,11 @@ var init_lib48 = __esm({
31257
31261
  init_geturl2();
31258
31262
  __awaiter21 = function(thisArg, _arguments, P, generator) {
31259
31263
  function adopt(value) {
31260
- return value instanceof P ? value : new P(function(resolve2) {
31261
- resolve2(value);
31264
+ return value instanceof P ? value : new P(function(resolve) {
31265
+ resolve(value);
31262
31266
  });
31263
31267
  }
31264
- return new (P || (P = Promise))(function(resolve2, reject) {
31268
+ return new (P || (P = Promise))(function(resolve, reject) {
31265
31269
  function fulfilled(value) {
31266
31270
  try {
31267
31271
  step(generator.next(value));
@@ -31277,7 +31281,7 @@ var init_lib48 = __esm({
31277
31281
  }
31278
31282
  }
31279
31283
  function step(result) {
31280
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
31284
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
31281
31285
  }
31282
31286
  step((generator = generator.apply(thisArg, _arguments || [])).next());
31283
31287
  });
@@ -31485,14 +31489,9 @@ var init_lib49 = __esm({
31485
31489
 
31486
31490
  // config/env.config.ts
31487
31491
  function getEnvValue(key3, defaultValue) {
31488
- const envDefine = Object.keys(env).reduce((acc, curr) => {
31489
- acc[`process.env.${curr}`] = JSON.stringify(env[curr] || process.env[curr]);
31490
- return acc;
31491
- }, {});
31492
- console.log(`Loaded environment variables: ${JSON.stringify(envDefine)}`);
31493
31492
  const value = process.env[key3];
31494
31493
  if (value === void 0 || value === "") {
31495
- 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}`);
31496
31495
  return defaultValue;
31497
31496
  }
31498
31497
  return value;
@@ -31535,20 +31534,20 @@ function loadConfig() {
31535
31534
  )
31536
31535
  },
31537
31536
  contracts: {
31538
- mutiVoucher: getEnvValue("MutiVoucher", ""),
31537
+ mutiVoucher: getEnvValue("MutiVoucher", "0x0000000000000000000000000000000000000044"),
31539
31538
  auction: {
31540
- chainYVaultV2: getEnvValue("ChainYVaultV2", ""),
31541
- chainXAuctionV2: getEnvValue("ChainXAuctionV2", ""),
31542
- coinbase: getEnvValue("Coinbase", "")
31539
+ chainYVaultV2: getEnvValue("ChainYVaultV2", "0xAa9e62EB6d74d66Ff6720D1A8143c8237067Ff58"),
31540
+ chainXAuctionV2: getEnvValue("ChainXAuctionV2", "0x88566F811b751Fa527A0816d99d6968E00f2eBef"),
31541
+ coinbase: getEnvValue("Coinbase", "0xAa9e62EB6d74d66Ff6720D1A8143c8237067Ff58")
31543
31542
  },
31544
31543
  uniswap: {
31545
- create2: getEnvValue("Create2", "0x5FbDB2315678afecb367f032d93F642f64180aa3"),
31546
- token0: getEnvValue("Token0", "0x3e7B83B8bb8eE2D4d74ec805aeb1465e65E15E24"),
31547
- token1: getEnvValue("Token1", "0xF4DB8B5cC187B286Eb54Bf76c6b041286a46E4Ee"),
31548
- poolManager: getEnvValue("PoolManager", "0xDB0412DaB8210ccA6d9875eE0be7b580A3c12046"),
31549
- liquidPool: getEnvValue("LiquidPool", "0xBFd16A06062060FA08EFca22e3b6d334EcF3E2f0"),
31550
- limitOrder: getEnvValue("LimitOrder", "0x7982Cd1B4162c145e6c1a0f7fD3De4676950D040"),
31551
- dynamicFee: getEnvValue("DynamicFee", "0x541eEcD8E9A59476E436A766123B27330e149040")
31544
+ create2: getEnvValue("Create2", "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853"),
31545
+ token0: getEnvValue("Token0", "0x3E8d9Ad590542AE8731960202CE0334B5c7c317D"),
31546
+ token1: getEnvValue("Token1", "0xF8407E61094a14601a7224AB628152B309788659"),
31547
+ poolManager: getEnvValue("PoolManager", "0x58a9D1fC9a29C82769B8166a11d26d46Cc3cd95B"),
31548
+ liquidPool: getEnvValue("LiquidPool", "0x4bB1cD7b8bdebb062317E0751D6B386b1904B41c"),
31549
+ limitOrder: getEnvValue("LimitOrder", "0x2Ca71973EDA040187098A11377459c68cadE5040"),
31550
+ dynamicFee: getEnvValue("DynamicFee", "0x603c0F84139fDc3B95600c56aB843306eBFdD040")
31552
31551
  }
31553
31552
  },
31554
31553
  abiPaths: {
@@ -31582,18 +31581,15 @@ function loadConfig() {
31582
31581
  }
31583
31582
  };
31584
31583
  }
31585
- var dotenv, path, env, config2, RPC_URL, PRIVATE_KEY, ACCOUNT_ADDR;
31584
+ var config, RPC_URL, PRIVATE_KEY, ACCOUNT_ADDR;
31586
31585
  var init_env_config = __esm({
31587
31586
  "config/env.config.ts"() {
31588
31587
  "use strict";
31589
- dotenv = __toESM(require("dotenv"));
31590
31588
  init_lib49();
31591
- path = __toESM(require("path"));
31592
- env = dotenv.config({ path: path.resolve(__dirname, "../.env") }).parsed || {};
31593
- config2 = loadConfig();
31594
- RPC_URL = config2.rpc.url;
31595
- PRIVATE_KEY = config2.wallet.privateKey;
31596
- 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;
31597
31593
  }
31598
31594
  });
31599
31595
 
@@ -35280,13 +35276,13 @@ var init_uniswap_config = __esm({
35280
35276
  init_Create2();
35281
35277
  init_Example();
35282
35278
  CONTRACT_ADDRESSES = {
35283
- Create2: config2.contracts.uniswap.create2,
35284
- Token0: config2.contracts.uniswap.token0,
35285
- Token1: config2.contracts.uniswap.token1,
35286
- PoolManager: config2.contracts.uniswap.poolManager,
35287
- LiquidPool: config2.contracts.uniswap.liquidPool,
35288
- LimitOrder: config2.contracts.uniswap.limitOrder,
35289
- 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
35290
35286
  };
35291
35287
  CONTRACTS_ABI = {
35292
35288
  PoolManager: PoolManager_default,
@@ -35297,13 +35293,13 @@ var init_uniswap_config = __esm({
35297
35293
  Create2: Create2_default,
35298
35294
  Example: Example_default
35299
35295
  };
35300
- SALT = config2.pool.salt;
35301
- SALT_LIMITORDER = config2.pool.saltLimitOrder;
35302
- PRICE_INIT = config2.pool.priceInit;
35303
- PRICE_LIMIT = config2.pool.priceLimit;
35304
- INITIAL_LIQUIDITY = config2.pool.initialLiquidity;
35305
- INITIAL_SUPPLY = config2.pool.initialSupply;
35306
- 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;
35307
35303
  POOL_KEYS = {
35308
35304
  limitOrderPoolKey: {
35309
35305
  currency0: CONTRACT_ADDRESSES.Token0,
@@ -35513,7 +35509,7 @@ function calculateLiqDelta(ticklow, sqrt_cur, tickupp, amt0, amt1) {
35513
35509
  } else {
35514
35510
  const liq0 = liquidity0(amt0, sqrt_cur, sqrt_upp);
35515
35511
  const liq1 = liquidity1(amt1, sqrt_cur, sqrt_low);
35516
- const liq = liq0 < liq1 ? liq1 : liq0;
35512
+ const liq = liq0 < liq1 ? liq0 : liq1;
35517
35513
  return [liq, amount0(liq, sqrt_cur, sqrt_upp), amount1(liq, sqrt_low, sqrt_cur)];
35518
35514
  }
35519
35515
  }
@@ -35534,6 +35530,7 @@ function getAbi(artifact) {
35534
35530
  return artifact.abi ? artifact.abi : artifact;
35535
35531
  }
35536
35532
  async function getContract(wallet, name) {
35533
+ console.log(`Getting contract `, name, CONTRACT_ADDRESSES.LiquidPool);
35537
35534
  switch (name) {
35538
35535
  case "Token0":
35539
35536
  return new ethers_exports.Contract(CONTRACT_ADDRESSES.Token0, getAbi(CONTRACTS_ABI.MockERC20), wallet);
@@ -35569,9 +35566,9 @@ var require_place = __commonJS({
35569
35566
  const tx = await contract.place(poolKey, tickLower, zeroForOne, liquidity);
35570
35567
  await tx.wait();
35571
35568
  console.log("Limit order set successfully:");
35572
- return new Promise((resolve2, reject) => {
35569
+ return new Promise((resolve, reject) => {
35573
35570
  contract.once("Place", (owner, epoch, key3, tickLower2, zeroForOne2, liquidity2) => {
35574
- resolve2({
35571
+ resolve({
35575
35572
  owner,
35576
35573
  epoch: epoch.toString(),
35577
35574
  key: key3,
@@ -37581,9 +37578,9 @@ var ChainYVaultV2_default = {
37581
37578
  };
37582
37579
 
37583
37580
  // config/auction.config.ts
37584
- var chainXAuctionV2Addr = config2.contracts.auction.chainXAuctionV2;
37585
- var chainYVaultV2Addr = config2.contracts.auction.chainYVaultV2;
37586
- var coinbaseAddr = config2.contracts.auction.coinbase;
37581
+ var chainXAuctionV2Addr = config.contracts.auction.chainXAuctionV2;
37582
+ var chainYVaultV2Addr = config.contracts.auction.chainYVaultV2;
37583
+ var coinbaseAddr = config.contracts.auction.coinbase;
37587
37584
  var AUCTION_ADDR = {
37588
37585
  chainXAuction: chainXAuctionV2Addr,
37589
37586
  chainYVault: chainYVaultV2Addr,
@@ -38261,7 +38258,7 @@ var MutiVoucher_default = {
38261
38258
  };
38262
38259
 
38263
38260
  // config/voucher.config.ts
38264
- var MUTI_VOUCHER_ADDR = config2.contracts.mutiVoucher;
38261
+ var MUTI_VOUCHER_ADDR = config.contracts.mutiVoucher;
38265
38262
  var MUTI_VOUCHER_ABI = MutiVoucher_default;
38266
38263
 
38267
38264
  // src/voucher.ts