@flaunch/sdk 0.9.16 → 0.9.19

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.cjs.js CHANGED
@@ -20,7 +20,7 @@ function defineChain(chain) {
20
20
  };
21
21
  }
22
22
 
23
- const version = '2.29.2';
23
+ const version = '2.37.12';
24
24
 
25
25
  let errorConfig = {
26
26
  getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
@@ -620,8 +620,8 @@ function defineFormatter(type, format) {
620
620
  return ({ exclude, format: overrides, }) => {
621
621
  return {
622
622
  exclude,
623
- format: (args) => {
624
- const formatted = format(args);
623
+ format: (args, action) => {
624
+ const formatted = format(args, action);
625
625
  if (exclude) {
626
626
  for (const key of exclude) {
627
627
  delete formatted[key];
@@ -629,7 +629,7 @@ function defineFormatter(type, format) {
629
629
  }
630
630
  return {
631
631
  ...formatted,
632
- ...overrides(args),
632
+ ...overrides(args, action),
633
633
  };
634
634
  },
635
635
  type,
@@ -644,7 +644,7 @@ const transactionType = {
644
644
  '0x3': 'eip4844',
645
645
  '0x4': 'eip7702',
646
646
  };
647
- function formatTransaction(transaction) {
647
+ function formatTransaction(transaction, _) {
648
648
  const transaction_ = {
649
649
  ...transaction,
650
650
  blockHash: transaction.blockHash ? transaction.blockHash : null,
@@ -722,7 +722,7 @@ function formatAuthorizationList$1(authorizationList) {
722
722
  }));
723
723
  }
724
724
 
725
- function formatBlock(block) {
725
+ function formatBlock(block, _) {
726
726
  const transactions = (block.transactions ?? []).map((transaction) => {
727
727
  if (typeof transaction === 'string')
728
728
  return transaction;
@@ -770,7 +770,7 @@ const receiptStatuses = {
770
770
  '0x0': 'reverted',
771
771
  '0x1': 'success',
772
772
  };
773
- function formatTransactionReceipt(transactionReceipt) {
773
+ function formatTransactionReceipt(transactionReceipt, _) {
774
774
  const receipt = {
775
775
  ...transactionReceipt,
776
776
  blockNumber: transactionReceipt.blockNumber
@@ -817,7 +817,7 @@ const rpcTransactionType = {
817
817
  eip4844: '0x3',
818
818
  eip7702: '0x4',
819
819
  };
820
- function formatTransactionRequest(request) {
820
+ function formatTransactionRequest(request, _) {
821
821
  const rpcRequest = {};
822
822
  if (typeof request.authorizationList !== 'undefined')
823
823
  rpcRequest.authorizationList = formatAuthorizationList(request.authorizationList);
@@ -1354,19 +1354,21 @@ function blobsToProofs(parameters) {
1354
1354
  : proofs.map((x) => bytesToHex$1(x)));
1355
1355
  }
1356
1356
 
1357
+ const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
1358
+
1357
1359
  /**
1358
- * Internal assertion helpers.
1360
+ * Utilities for hex, bytes, CSPRNG.
1359
1361
  * @module
1360
1362
  */
1363
+ /** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
1364
+ function isBytes$2(a) {
1365
+ return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
1366
+ }
1361
1367
  /** Asserts something is positive integer. */
1362
1368
  function anumber$1(n) {
1363
1369
  if (!Number.isSafeInteger(n) || n < 0)
1364
1370
  throw new Error('positive integer expected, got ' + n);
1365
1371
  }
1366
- /** Is number an Uint8Array? Copied from utils for perf. */
1367
- function isBytes$2(a) {
1368
- return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
1369
- }
1370
1372
  /** Asserts something is Uint8Array. */
1371
1373
  function abytes$2(b, ...lengths) {
1372
1374
  if (!isBytes$2(b))
@@ -1377,7 +1379,7 @@ function abytes$2(b, ...lengths) {
1377
1379
  /** Asserts something is hash */
1378
1380
  function ahash(h) {
1379
1381
  if (typeof h !== 'function' || typeof h.create !== 'function')
1380
- throw new Error('Hash should be wrapped by utils.wrapConstructor');
1382
+ throw new Error('Hash should be wrapped by utils.createHasher');
1381
1383
  anumber$1(h.outputLen);
1382
1384
  anumber$1(h.blockLen);
1383
1385
  }
@@ -1396,17 +1398,17 @@ function aoutput(out, instance) {
1396
1398
  throw new Error('digestInto() expects output buffer of length at least ' + min);
1397
1399
  }
1398
1400
  }
1399
-
1400
- const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
1401
-
1402
- /**
1403
- * Utilities for hex, bytes, CSPRNG.
1404
- * @module
1405
- */
1401
+ /** Cast u8 / u16 / u32 to u32. */
1406
1402
  function u32(arr) {
1407
1403
  return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
1408
1404
  }
1409
- // Cast array to view
1405
+ /** Zeroize a byte array. Warning: JS provides no guarantees. */
1406
+ function clean(...arrays) {
1407
+ for (let i = 0; i < arrays.length; i++) {
1408
+ arrays[i].fill(0);
1409
+ }
1410
+ }
1411
+ /** Create DataView of an array for easy byte-level manipulation. */
1410
1412
  function createView(arr) {
1411
1413
  return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
1412
1414
  }
@@ -1416,7 +1418,7 @@ function rotr(word, shift) {
1416
1418
  }
1417
1419
  /** Is current platform little-endian? Most are. Big-Endian platform: IBM */
1418
1420
  const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
1419
- // The byte swap operation for uint32
1421
+ /** The byte swap operation for uint32 */
1420
1422
  function byteSwap(word) {
1421
1423
  return (((word << 24) & 0xff000000) |
1422
1424
  ((word << 8) & 0xff0000) |
@@ -1428,17 +1430,18 @@ function byteSwap32(arr) {
1428
1430
  for (let i = 0; i < arr.length; i++) {
1429
1431
  arr[i] = byteSwap(arr[i]);
1430
1432
  }
1433
+ return arr;
1431
1434
  }
1432
- // Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
1433
- // @ts-ignore
1434
- typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function';
1435
+ const swap32IfBE = isLE
1436
+ ? (u) => u
1437
+ : byteSwap32;
1435
1438
  /**
1436
- * Convert JS string to byte array.
1437
- * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
1439
+ * Converts string to bytes using UTF8 encoding.
1440
+ * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
1438
1441
  */
1439
1442
  function utf8ToBytes(str) {
1440
1443
  if (typeof str !== 'string')
1441
- throw new Error('utf8ToBytes expected string, got ' + typeof str);
1444
+ throw new Error('string expected');
1442
1445
  return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
1443
1446
  }
1444
1447
  /**
@@ -1452,9 +1455,7 @@ function toBytes(data) {
1452
1455
  abytes$2(data);
1453
1456
  return data;
1454
1457
  }
1455
- /**
1456
- * Copies several Uint8Arrays into one.
1457
- */
1458
+ /** Copies several Uint8Arrays into one. */
1458
1459
  function concatBytes$1(...arrays) {
1459
1460
  let sum = 0;
1460
1461
  for (let i = 0; i < arrays.length; i++) {
@@ -1472,13 +1473,9 @@ function concatBytes$1(...arrays) {
1472
1473
  }
1473
1474
  /** For runtime check if class implements interface */
1474
1475
  class Hash {
1475
- // Safe version that clones internal state
1476
- clone() {
1477
- return this._cloneInto();
1478
- }
1479
1476
  }
1480
1477
  /** Wraps hash function, creating an interface on top of it */
1481
- function wrapConstructor(hashCons) {
1478
+ function createHasher(hashCons) {
1482
1479
  const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
1483
1480
  const tmp = hashCons();
1484
1481
  hashC.outputLen = tmp.outputLen;
@@ -1543,8 +1540,9 @@ class HashMD extends Hash {
1543
1540
  }
1544
1541
  update(data) {
1545
1542
  aexists(this);
1546
- const { view, buffer, blockLen } = this;
1547
1543
  data = toBytes(data);
1544
+ abytes$2(data);
1545
+ const { view, buffer, blockLen } = this;
1548
1546
  const len = data.length;
1549
1547
  for (let pos = 0; pos < len;) {
1550
1548
  const take = Math.min(blockLen - this.pos, len - pos);
@@ -1578,7 +1576,7 @@ class HashMD extends Hash {
1578
1576
  let { pos } = this;
1579
1577
  // append the bit '1' to the message
1580
1578
  buffer[pos++] = 0b10000000;
1581
- this.buffer.subarray(pos).fill(0);
1579
+ clean(this.buffer.subarray(pos));
1582
1580
  // we have less than padOffset left in buffer, so we cannot put length in
1583
1581
  // current block, need process it and pad again
1584
1582
  if (this.padOffset > blockLen - pos) {
@@ -1616,28 +1614,69 @@ class HashMD extends Hash {
1616
1614
  to || (to = new this.constructor());
1617
1615
  to.set(...this.get());
1618
1616
  const { blockLen, buffer, length, finished, destroyed, pos } = this;
1617
+ to.destroyed = destroyed;
1618
+ to.finished = finished;
1619
1619
  to.length = length;
1620
1620
  to.pos = pos;
1621
- to.finished = finished;
1622
- to.destroyed = destroyed;
1623
1621
  if (length % blockLen)
1624
1622
  to.buffer.set(buffer);
1625
1623
  return to;
1626
1624
  }
1625
+ clone() {
1626
+ return this._cloneInto();
1627
+ }
1627
1628
  }
1629
+ /**
1630
+ * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
1631
+ * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
1632
+ */
1633
+ /** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
1634
+ const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
1635
+ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
1636
+ ]);
1628
1637
 
1629
1638
  /**
1630
- * SHA2-256 a.k.a. sha256. In JS, it is the fastest hash, even faster than Blake3.
1631
- *
1632
- * To break sha256 using birthday attack, attackers need to try 2^128 hashes.
1633
- * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
1634
- *
1635
- * Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
1639
+ * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
1640
+ * @todo re-check https://issues.chromium.org/issues/42212588
1636
1641
  * @module
1637
1642
  */
1638
- /** Round constants: first 32 bits of fractional parts of the cube roots of the first 64 primes 2..311). */
1643
+ const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
1644
+ const _32n = /* @__PURE__ */ BigInt(32);
1645
+ function fromBig(n, le = false) {
1646
+ if (le)
1647
+ return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
1648
+ return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
1649
+ }
1650
+ function split(lst, le = false) {
1651
+ const len = lst.length;
1652
+ let Ah = new Uint32Array(len);
1653
+ let Al = new Uint32Array(len);
1654
+ for (let i = 0; i < len; i++) {
1655
+ const { h, l } = fromBig(lst[i], le);
1656
+ [Ah[i], Al[i]] = [h, l];
1657
+ }
1658
+ return [Ah, Al];
1659
+ }
1660
+ // Left rotate for Shift in [1, 32)
1661
+ const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
1662
+ const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
1663
+ // Left rotate for Shift in (32, 64), NOTE: 32 is special case.
1664
+ const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
1665
+ const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
1666
+
1667
+ /**
1668
+ * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
1669
+ * SHA256 is the fastest hash implementable in JS, even faster than Blake3.
1670
+ * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and
1671
+ * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
1672
+ * @module
1673
+ */
1674
+ /**
1675
+ * Round constants:
1676
+ * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
1677
+ */
1639
1678
  // prettier-ignore
1640
- const SHA256_K = /* @__PURE__ */ new Uint32Array([
1679
+ const SHA256_K = /* @__PURE__ */ Uint32Array.from([
1641
1680
  0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
1642
1681
  0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
1643
1682
  0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
@@ -1647,15 +1686,7 @@ const SHA256_K = /* @__PURE__ */ new Uint32Array([
1647
1686
  0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
1648
1687
  0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
1649
1688
  ]);
1650
- /** Initial state: first 32 bits of fractional parts of the square roots of the first 8 primes 2..19. */
1651
- // prettier-ignore
1652
- const SHA256_IV = /* @__PURE__ */ new Uint32Array([
1653
- 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
1654
- ]);
1655
- /**
1656
- * Temporary buffer, not used to store anything between runs.
1657
- * Named this way because it matches specification.
1658
- */
1689
+ /** Reusable temporary buffer. "W" comes straight from spec. */
1659
1690
  const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
1660
1691
  class SHA256 extends HashMD {
1661
1692
  constructor(outputLen = 32) {
@@ -1725,15 +1756,34 @@ class SHA256 extends HashMD {
1725
1756
  this.set(A, B, C, D, E, F, G, H);
1726
1757
  }
1727
1758
  roundClean() {
1728
- SHA256_W.fill(0);
1759
+ clean(SHA256_W);
1729
1760
  }
1730
1761
  destroy() {
1731
1762
  this.set(0, 0, 0, 0, 0, 0, 0, 0);
1732
- this.buffer.fill(0);
1763
+ clean(this.buffer);
1733
1764
  }
1734
1765
  }
1735
- /** SHA2-256 hash function */
1736
- const sha256$1 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
1766
+ /**
1767
+ * SHA2-256 hash function from RFC 4634.
1768
+ *
1769
+ * It is the fastest JS hash, even faster than Blake3.
1770
+ * To break sha256 using birthday attack, attackers need to try 2^128 hashes.
1771
+ * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
1772
+ */
1773
+ const sha256$2 = /* @__PURE__ */ createHasher(() => new SHA256());
1774
+
1775
+ /**
1776
+ * SHA2-256 a.k.a. sha256. In JS, it is the fastest hash, even faster than Blake3.
1777
+ *
1778
+ * To break sha256 using birthday attack, attackers need to try 2^128 hashes.
1779
+ * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
1780
+ *
1781
+ * Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
1782
+ * @module
1783
+ * @deprecated
1784
+ */
1785
+ /** @deprecated Use import from `noble/hashes/sha2` module */
1786
+ const sha256$1 = sha256$2;
1737
1787
 
1738
1788
  function sha256(value, to_) {
1739
1789
  const to = to_ || 'hex';
@@ -2033,34 +2083,6 @@ class LruMap extends Map {
2033
2083
  }
2034
2084
  }
2035
2085
 
2036
- /**
2037
- * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
2038
- * @todo re-check https://issues.chromium.org/issues/42212588
2039
- * @module
2040
- */
2041
- const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
2042
- const _32n = /* @__PURE__ */ BigInt(32);
2043
- function fromBig(n, le = false) {
2044
- if (le)
2045
- return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
2046
- return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
2047
- }
2048
- function split(lst, le = false) {
2049
- let Ah = new Uint32Array(lst.length);
2050
- let Al = new Uint32Array(lst.length);
2051
- for (let i = 0; i < lst.length; i++) {
2052
- const { h, l } = fromBig(lst[i], le);
2053
- [Ah[i], Al[i]] = [h, l];
2054
- }
2055
- return [Ah, Al];
2056
- }
2057
- // Left rotate for Shift in [1, 32)
2058
- const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
2059
- const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
2060
- // Left rotate for Shift in (32, 64), NOTE: 32 is special case.
2061
- const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
2062
- const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
2063
-
2064
2086
  /**
2065
2087
  * SHA3 (keccak) hash function, based on a new "Sponge function" design.
2066
2088
  * Different from older hashes, the internal state is bigger than output size.
@@ -2072,16 +2094,18 @@ const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
2072
2094
  * Check out `sha3-addons` module for cSHAKE, k12, and others.
2073
2095
  * @module
2074
2096
  */
2097
+ // No __PURE__ annotations in sha3 header:
2098
+ // EVERYTHING is in fact used on every export.
2075
2099
  // Various per round constants calculations
2100
+ const _0n$5 = BigInt(0);
2101
+ const _1n$5 = BigInt(1);
2102
+ const _2n$2 = BigInt(2);
2103
+ const _7n = BigInt(7);
2104
+ const _256n = BigInt(256);
2105
+ const _0x71n = BigInt(0x71);
2076
2106
  const SHA3_PI = [];
2077
2107
  const SHA3_ROTL = [];
2078
2108
  const _SHA3_IOTA = [];
2079
- const _0n$4 = /* @__PURE__ */ BigInt(0);
2080
- const _1n$5 = /* @__PURE__ */ BigInt(1);
2081
- const _2n$2 = /* @__PURE__ */ BigInt(2);
2082
- const _7n = /* @__PURE__ */ BigInt(7);
2083
- const _256n = /* @__PURE__ */ BigInt(256);
2084
- const _0x71n = /* @__PURE__ */ BigInt(0x71);
2085
2109
  for (let round = 0, R = _1n$5, x = 1, y = 0; round < 24; round++) {
2086
2110
  // Pi
2087
2111
  [x, y] = [y, (2 * x + 3 * y) % 5];
@@ -2089,7 +2113,7 @@ for (let round = 0, R = _1n$5, x = 1, y = 0; round < 24; round++) {
2089
2113
  // Rotational
2090
2114
  SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);
2091
2115
  // Iota
2092
- let t = _0n$4;
2116
+ let t = _0n$5;
2093
2117
  for (let j = 0; j < 7; j++) {
2094
2118
  R = ((R << _1n$5) ^ ((R >> _7n) * _0x71n)) % _256n;
2095
2119
  if (R & _2n$2)
@@ -2097,7 +2121,9 @@ for (let round = 0, R = _1n$5, x = 1, y = 0; round < 24; round++) {
2097
2121
  }
2098
2122
  _SHA3_IOTA.push(t);
2099
2123
  }
2100
- const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
2124
+ const IOTAS = split(_SHA3_IOTA, true);
2125
+ const SHA3_IOTA_H = IOTAS[0];
2126
+ const SHA3_IOTA_L = IOTAS[1];
2101
2127
  // Left rotation (without 0, 32, 64)
2102
2128
  const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
2103
2129
  const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
@@ -2145,7 +2171,7 @@ function keccakP(s, rounds = 24) {
2145
2171
  s[0] ^= SHA3_IOTA_H[round];
2146
2172
  s[1] ^= SHA3_IOTA_L[round];
2147
2173
  }
2148
- B.fill(0);
2174
+ clean(B);
2149
2175
  }
2150
2176
  /** Keccak sponge function. */
2151
2177
  class Keccak extends Hash {
@@ -2166,24 +2192,26 @@ class Keccak extends Hash {
2166
2192
  anumber$1(outputLen);
2167
2193
  // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
2168
2194
  // 0 < blockLen < 200
2169
- if (0 >= this.blockLen || this.blockLen >= 200)
2170
- throw new Error('Sha3 supports only keccak-f1600 function');
2195
+ if (!(0 < blockLen && blockLen < 200))
2196
+ throw new Error('only keccak-f1600 function is supported');
2171
2197
  this.state = new Uint8Array(200);
2172
2198
  this.state32 = u32(this.state);
2173
2199
  }
2200
+ clone() {
2201
+ return this._cloneInto();
2202
+ }
2174
2203
  keccak() {
2175
- if (!isLE)
2176
- byteSwap32(this.state32);
2204
+ swap32IfBE(this.state32);
2177
2205
  keccakP(this.state32, this.rounds);
2178
- if (!isLE)
2179
- byteSwap32(this.state32);
2206
+ swap32IfBE(this.state32);
2180
2207
  this.posOut = 0;
2181
2208
  this.pos = 0;
2182
2209
  }
2183
2210
  update(data) {
2184
2211
  aexists(this);
2185
- const { blockLen, state } = this;
2186
2212
  data = toBytes(data);
2213
+ abytes$2(data);
2214
+ const { blockLen, state } = this;
2187
2215
  const len = data.length;
2188
2216
  for (let pos = 0; pos < len;) {
2189
2217
  const take = Math.min(blockLen - this.pos, len - pos);
@@ -2245,7 +2273,7 @@ class Keccak extends Hash {
2245
2273
  }
2246
2274
  destroy() {
2247
2275
  this.destroyed = true;
2248
- this.state.fill(0);
2276
+ clean(this.state);
2249
2277
  }
2250
2278
  _cloneInto(to) {
2251
2279
  const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
@@ -2263,9 +2291,9 @@ class Keccak extends Hash {
2263
2291
  return to;
2264
2292
  }
2265
2293
  }
2266
- const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
2294
+ const gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen));
2267
2295
  /** keccak-256 hash function. Different from SHA3-256. */
2268
- const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);
2296
+ const keccak_256 = /* @__PURE__ */ (() => gen(0x01, 136, 256 / 8))();
2269
2297
 
2270
2298
  function keccak256(value, to_) {
2271
2299
  const to = to_ || 'hex';
@@ -2534,13 +2562,13 @@ function serializeTransactionEIP7702(transaction, signature) {
2534
2562
  return concatHex([
2535
2563
  '0x04',
2536
2564
  toRlp([
2537
- toHex(chainId),
2538
- nonce ? toHex(nonce) : '0x',
2539
- maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : '0x',
2540
- maxFeePerGas ? toHex(maxFeePerGas) : '0x',
2541
- gas ? toHex(gas) : '0x',
2565
+ numberToHex(chainId),
2566
+ nonce ? numberToHex(nonce) : '0x',
2567
+ maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : '0x',
2568
+ maxFeePerGas ? numberToHex(maxFeePerGas) : '0x',
2569
+ gas ? numberToHex(gas) : '0x',
2542
2570
  to ?? '0x',
2543
- value ? toHex(value) : '0x',
2571
+ value ? numberToHex(value) : '0x',
2544
2572
  data ?? '0x',
2545
2573
  serializedAccessList,
2546
2574
  serializedAuthorizationList,
@@ -2576,16 +2604,16 @@ function serializeTransactionEIP4844(transaction, signature) {
2576
2604
  }
2577
2605
  const serializedAccessList = serializeAccessList(accessList);
2578
2606
  const serializedTransaction = [
2579
- toHex(chainId),
2580
- nonce ? toHex(nonce) : '0x',
2581
- maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : '0x',
2582
- maxFeePerGas ? toHex(maxFeePerGas) : '0x',
2583
- gas ? toHex(gas) : '0x',
2607
+ numberToHex(chainId),
2608
+ nonce ? numberToHex(nonce) : '0x',
2609
+ maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : '0x',
2610
+ maxFeePerGas ? numberToHex(maxFeePerGas) : '0x',
2611
+ gas ? numberToHex(gas) : '0x',
2584
2612
  to ?? '0x',
2585
- value ? toHex(value) : '0x',
2613
+ value ? numberToHex(value) : '0x',
2586
2614
  data ?? '0x',
2587
2615
  serializedAccessList,
2588
- maxFeePerBlobGas ? toHex(maxFeePerBlobGas) : '0x',
2616
+ maxFeePerBlobGas ? numberToHex(maxFeePerBlobGas) : '0x',
2589
2617
  blobVersionedHashes ?? [],
2590
2618
  ...toYParitySignatureArray(transaction, signature),
2591
2619
  ];
@@ -2613,13 +2641,13 @@ function serializeTransactionEIP1559(transaction, signature) {
2613
2641
  assertTransactionEIP1559(transaction);
2614
2642
  const serializedAccessList = serializeAccessList(accessList);
2615
2643
  const serializedTransaction = [
2616
- toHex(chainId),
2617
- nonce ? toHex(nonce) : '0x',
2618
- maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : '0x',
2619
- maxFeePerGas ? toHex(maxFeePerGas) : '0x',
2620
- gas ? toHex(gas) : '0x',
2644
+ numberToHex(chainId),
2645
+ nonce ? numberToHex(nonce) : '0x',
2646
+ maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : '0x',
2647
+ maxFeePerGas ? numberToHex(maxFeePerGas) : '0x',
2648
+ gas ? numberToHex(gas) : '0x',
2621
2649
  to ?? '0x',
2622
- value ? toHex(value) : '0x',
2650
+ value ? numberToHex(value) : '0x',
2623
2651
  data ?? '0x',
2624
2652
  serializedAccessList,
2625
2653
  ...toYParitySignatureArray(transaction, signature),
@@ -2634,12 +2662,12 @@ function serializeTransactionEIP2930(transaction, signature) {
2634
2662
  assertTransactionEIP2930(transaction);
2635
2663
  const serializedAccessList = serializeAccessList(accessList);
2636
2664
  const serializedTransaction = [
2637
- toHex(chainId),
2638
- nonce ? toHex(nonce) : '0x',
2639
- gasPrice ? toHex(gasPrice) : '0x',
2640
- gas ? toHex(gas) : '0x',
2665
+ numberToHex(chainId),
2666
+ nonce ? numberToHex(nonce) : '0x',
2667
+ gasPrice ? numberToHex(gasPrice) : '0x',
2668
+ gas ? numberToHex(gas) : '0x',
2641
2669
  to ?? '0x',
2642
- value ? toHex(value) : '0x',
2670
+ value ? numberToHex(value) : '0x',
2643
2671
  data ?? '0x',
2644
2672
  serializedAccessList,
2645
2673
  ...toYParitySignatureArray(transaction, signature),
@@ -2653,11 +2681,11 @@ function serializeTransactionLegacy(transaction, signature) {
2653
2681
  const { chainId = 0, gas, data, nonce, to, value, gasPrice } = transaction;
2654
2682
  assertTransactionLegacy(transaction);
2655
2683
  let serializedTransaction = [
2656
- nonce ? toHex(nonce) : '0x',
2657
- gasPrice ? toHex(gasPrice) : '0x',
2658
- gas ? toHex(gas) : '0x',
2684
+ nonce ? numberToHex(nonce) : '0x',
2685
+ gasPrice ? numberToHex(gasPrice) : '0x',
2686
+ gas ? numberToHex(gas) : '0x',
2659
2687
  to ?? '0x',
2660
- value ? toHex(value) : '0x',
2688
+ value ? numberToHex(value) : '0x',
2661
2689
  data ?? '0x',
2662
2690
  ];
2663
2691
  if (signature) {
@@ -2682,7 +2710,7 @@ function serializeTransactionLegacy(transaction, signature) {
2682
2710
  const s = trim(signature.s);
2683
2711
  serializedTransaction = [
2684
2712
  ...serializedTransaction,
2685
- toHex(v),
2713
+ numberToHex(v),
2686
2714
  r === '0x00' ? '0x' : r,
2687
2715
  s === '0x00' ? '0x' : s,
2688
2716
  ];
@@ -2690,7 +2718,7 @@ function serializeTransactionLegacy(transaction, signature) {
2690
2718
  else if (chainId > 0) {
2691
2719
  serializedTransaction = [
2692
2720
  ...serializedTransaction,
2693
- toHex(chainId),
2721
+ numberToHex(chainId),
2694
2722
  '0x',
2695
2723
  '0x',
2696
2724
  ];
@@ -2710,12 +2738,12 @@ function toYParitySignatureArray(transaction, signature_) {
2710
2738
  const s = trim(signature.s);
2711
2739
  const yParity_ = (() => {
2712
2740
  if (typeof yParity === 'number')
2713
- return yParity ? toHex(1) : '0x';
2741
+ return yParity ? numberToHex(1) : '0x';
2714
2742
  if (v === 0n)
2715
2743
  return '0x';
2716
2744
  if (v === 1n)
2717
- return toHex(1);
2718
- return v === 27n ? '0x' : toHex(1);
2745
+ return numberToHex(1);
2746
+ return v === 27n ? '0x' : numberToHex(1);
2719
2747
  })();
2720
2748
  return [yParity_, r === '0x00' ? '0x' : r, s === '0x00' ? '0x' : s];
2721
2749
  }
@@ -2826,12 +2854,13 @@ function assertTransactionDeposit(transaction) {
2826
2854
  }
2827
2855
 
2828
2856
  const chainConfig$1 = {
2857
+ blockTime: 2_000,
2829
2858
  contracts,
2830
2859
  formatters: formatters$1,
2831
2860
  serializers: serializers$1,
2832
2861
  };
2833
2862
 
2834
- const sourceId$K = 1; // mainnet
2863
+ const sourceId$M = 1; // mainnet
2835
2864
  /*#__PURE__*/ defineChain({
2836
2865
  ...chainConfig$1,
2837
2866
  id: 888888888,
@@ -2852,27 +2881,27 @@ const sourceId$K = 1; // mainnet
2852
2881
  contracts: {
2853
2882
  ...chainConfig$1.contracts,
2854
2883
  l2OutputOracle: {
2855
- [sourceId$K]: {
2884
+ [sourceId$M]: {
2856
2885
  address: '0xB09DC08428C8b4EFB4ff9C0827386CDF34277996',
2857
2886
  },
2858
2887
  },
2859
2888
  portal: {
2860
- [sourceId$K]: {
2889
+ [sourceId$M]: {
2861
2890
  address: '0x639F2AECE398Aa76b07e59eF6abe2cFe32bacb68',
2862
2891
  blockCreated: 19070571,
2863
2892
  },
2864
2893
  },
2865
2894
  l1StandardBridge: {
2866
- [sourceId$K]: {
2895
+ [sourceId$M]: {
2867
2896
  address: '0xd5e3eDf5b68135D559D572E26bF863FBC1950033',
2868
2897
  blockCreated: 19070571,
2869
2898
  },
2870
2899
  },
2871
2900
  },
2872
- sourceId: sourceId$K,
2901
+ sourceId: sourceId$M,
2873
2902
  });
2874
2903
 
2875
- const sourceId$J = 11_155_111; // sepolia
2904
+ const sourceId$L = 11_155_111; // sepolia
2876
2905
  /*#__PURE__*/ defineChain({
2877
2906
  ...chainConfig$1,
2878
2907
  id: 28122024,
@@ -2893,27 +2922,27 @@ const sourceId$J = 11_155_111; // sepolia
2893
2922
  contracts: {
2894
2923
  ...chainConfig$1.contracts,
2895
2924
  l2OutputOracle: {
2896
- [sourceId$J]: {
2925
+ [sourceId$L]: {
2897
2926
  address: '0x942fD5017c0F60575930D8574Eaca13BEcD6e1bB',
2898
2927
  },
2899
2928
  },
2900
2929
  portal: {
2901
- [sourceId$J]: {
2930
+ [sourceId$L]: {
2902
2931
  address: '0xfa1d9E26A6aCD7b22115D27572c1221B9803c960',
2903
2932
  blockCreated: 4972908,
2904
2933
  },
2905
2934
  },
2906
2935
  l1StandardBridge: {
2907
- [sourceId$J]: {
2936
+ [sourceId$L]: {
2908
2937
  address: '0xF6Bc0146d3c74D48306e79Ae134A260E418C9335',
2909
2938
  blockCreated: 4972908,
2910
2939
  },
2911
2940
  },
2912
2941
  },
2913
- sourceId: sourceId$J,
2942
+ sourceId: sourceId$L,
2914
2943
  });
2915
2944
 
2916
- const sourceId$I = 1; // mainnet
2945
+ const sourceId$K = 1; // mainnet
2917
2946
  const base = /*#__PURE__*/ defineChain({
2918
2947
  ...chainConfig$1,
2919
2948
  id: 8453,
@@ -2934,12 +2963,12 @@ const base = /*#__PURE__*/ defineChain({
2934
2963
  contracts: {
2935
2964
  ...chainConfig$1.contracts,
2936
2965
  disputeGameFactory: {
2937
- [sourceId$I]: {
2966
+ [sourceId$K]: {
2938
2967
  address: '0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e',
2939
2968
  },
2940
2969
  },
2941
2970
  l2OutputOracle: {
2942
- [sourceId$I]: {
2971
+ [sourceId$K]: {
2943
2972
  address: '0x56315b90c40730925ec5485cf004d835058518A0',
2944
2973
  },
2945
2974
  },
@@ -2948,22 +2977,22 @@ const base = /*#__PURE__*/ defineChain({
2948
2977
  blockCreated: 5022,
2949
2978
  },
2950
2979
  portal: {
2951
- [sourceId$I]: {
2980
+ [sourceId$K]: {
2952
2981
  address: '0x49048044D57e1C92A77f79988d21Fa8fAF74E97e',
2953
2982
  blockCreated: 17482143,
2954
2983
  },
2955
2984
  },
2956
2985
  l1StandardBridge: {
2957
- [sourceId$I]: {
2986
+ [sourceId$K]: {
2958
2987
  address: '0x3154Cf16ccdb4C6d922629664174b904d80F2C35',
2959
2988
  blockCreated: 17482143,
2960
2989
  },
2961
2990
  },
2962
2991
  },
2963
- sourceId: sourceId$I,
2992
+ sourceId: sourceId$K,
2964
2993
  });
2965
2994
 
2966
- const sourceId$H = 5; // goerli
2995
+ const sourceId$J = 5; // goerli
2967
2996
  /*#__PURE__*/ defineChain({
2968
2997
  ...chainConfig$1,
2969
2998
  id: 84531,
@@ -2982,7 +3011,7 @@ const sourceId$H = 5; // goerli
2982
3011
  contracts: {
2983
3012
  ...chainConfig$1.contracts,
2984
3013
  l2OutputOracle: {
2985
- [sourceId$H]: {
3014
+ [sourceId$J]: {
2986
3015
  address: '0x2A35891ff30313CcFa6CE88dcf3858bb075A2298',
2987
3016
  },
2988
3017
  },
@@ -2991,21 +3020,21 @@ const sourceId$H = 5; // goerli
2991
3020
  blockCreated: 1376988,
2992
3021
  },
2993
3022
  portal: {
2994
- [sourceId$H]: {
3023
+ [sourceId$J]: {
2995
3024
  address: '0xe93c8cD0D409341205A592f8c4Ac1A5fe5585cfA',
2996
3025
  },
2997
3026
  },
2998
3027
  l1StandardBridge: {
2999
- [sourceId$H]: {
3028
+ [sourceId$J]: {
3000
3029
  address: '0xfA6D8Ee5BE770F84FC001D098C4bD604Fe01284a',
3001
3030
  },
3002
3031
  },
3003
3032
  },
3004
3033
  testnet: true,
3005
- sourceId: sourceId$H,
3034
+ sourceId: sourceId$J,
3006
3035
  });
3007
3036
 
3008
- const sourceId$G = 11_155_111; // sepolia
3037
+ const sourceId$I = 11_155_111; // sepolia
3009
3038
  const baseSepolia = /*#__PURE__*/ defineChain({
3010
3039
  ...chainConfig$1,
3011
3040
  id: 84532,
@@ -3027,23 +3056,23 @@ const baseSepolia = /*#__PURE__*/ defineChain({
3027
3056
  contracts: {
3028
3057
  ...chainConfig$1.contracts,
3029
3058
  disputeGameFactory: {
3030
- [sourceId$G]: {
3059
+ [sourceId$I]: {
3031
3060
  address: '0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1',
3032
3061
  },
3033
3062
  },
3034
3063
  l2OutputOracle: {
3035
- [sourceId$G]: {
3064
+ [sourceId$I]: {
3036
3065
  address: '0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254',
3037
3066
  },
3038
3067
  },
3039
3068
  portal: {
3040
- [sourceId$G]: {
3069
+ [sourceId$I]: {
3041
3070
  address: '0x49f53e41452c74589e85ca1677426ba426459e85',
3042
3071
  blockCreated: 4446677,
3043
3072
  },
3044
3073
  },
3045
3074
  l1StandardBridge: {
3046
- [sourceId$G]: {
3075
+ [sourceId$I]: {
3047
3076
  address: '0xfd0Bf71F60660E2f608ed56e1659C450eB113120',
3048
3077
  blockCreated: 4446677,
3049
3078
  },
@@ -3054,7 +3083,7 @@ const baseSepolia = /*#__PURE__*/ defineChain({
3054
3083
  },
3055
3084
  },
3056
3085
  testnet: true,
3057
- sourceId: sourceId$G,
3086
+ sourceId: sourceId$I,
3058
3087
  });
3059
3088
 
3060
3089
  defineChain({
@@ -3075,7 +3104,7 @@ defineChain({
3075
3104
  },
3076
3105
  });
3077
3106
 
3078
- const sourceId$F = 1; // mainnet
3107
+ const sourceId$H = 1; // mainnet
3079
3108
  /*#__PURE__*/ defineChain({
3080
3109
  ...chainConfig$1,
3081
3110
  id: 81457,
@@ -3101,11 +3130,29 @@ const sourceId$F = 1; // mainnet
3101
3130
  address: '0xcA11bde05977b3631167028862bE2a173976CA11',
3102
3131
  blockCreated: 212929,
3103
3132
  },
3133
+ l2OutputOracle: {
3134
+ [sourceId$H]: {
3135
+ address: '0x826D1B0D4111Ad9146Eb8941D7Ca2B6a44215c76',
3136
+ blockCreated: 19300358,
3137
+ },
3138
+ },
3139
+ portal: {
3140
+ [sourceId$H]: {
3141
+ address: '0x0Ec68c5B10F21EFFb74f2A5C61DFe6b08C0Db6Cb',
3142
+ blockCreated: 19300357,
3143
+ },
3144
+ },
3145
+ l1StandardBridge: {
3146
+ [sourceId$H]: {
3147
+ address: '0x697402166Fbf2F22E970df8a6486Ef171dbfc524',
3148
+ blockCreated: 19300360,
3149
+ },
3150
+ },
3104
3151
  },
3105
- sourceId: sourceId$F,
3152
+ sourceId: sourceId$H,
3106
3153
  });
3107
3154
 
3108
- const sourceId$E = 1; // mainnet
3155
+ const sourceId$G = 1; // mainnet
3109
3156
  defineChain({
3110
3157
  ...chainConfig$1,
3111
3158
  id: 60808,
@@ -3134,22 +3181,22 @@ defineChain({
3134
3181
  blockCreated: 23131,
3135
3182
  },
3136
3183
  l2OutputOracle: {
3137
- [sourceId$E]: {
3184
+ [sourceId$G]: {
3138
3185
  address: '0xdDa53E23f8a32640b04D7256e651C1db98dB11C1',
3139
3186
  blockCreated: 4462615,
3140
3187
  },
3141
3188
  },
3142
3189
  portal: {
3143
- [sourceId$E]: {
3190
+ [sourceId$G]: {
3144
3191
  address: '0x8AdeE124447435fE03e3CD24dF3f4cAE32E65a3E',
3145
3192
  blockCreated: 4462615,
3146
3193
  },
3147
3194
  },
3148
3195
  },
3149
- sourceId: sourceId$E,
3196
+ sourceId: sourceId$G,
3150
3197
  });
3151
3198
 
3152
- const sourceId$D = 11_155_111; // sepolia
3199
+ const sourceId$F = 11_155_111; // sepolia
3153
3200
  defineChain({
3154
3201
  ...chainConfig$1,
3155
3202
  id: 808813,
@@ -3178,20 +3225,20 @@ defineChain({
3178
3225
  blockCreated: 35677,
3179
3226
  },
3180
3227
  l2OutputOracle: {
3181
- [sourceId$D]: {
3228
+ [sourceId$F]: {
3182
3229
  address: '0x14D0069452b4AE2b250B395b8adAb771E4267d2f',
3183
3230
  blockCreated: 4462615,
3184
3231
  },
3185
3232
  },
3186
3233
  portal: {
3187
- [sourceId$D]: {
3234
+ [sourceId$F]: {
3188
3235
  address: '0x867B1Aa872b9C8cB5E9F7755feDC45BB24Ad0ae4',
3189
3236
  blockCreated: 4462615,
3190
3237
  },
3191
3238
  },
3192
3239
  },
3193
3240
  testnet: true,
3194
- sourceId: sourceId$D,
3241
+ sourceId: sourceId$F,
3195
3242
  });
3196
3243
 
3197
3244
  const fees = {
@@ -3400,13 +3447,14 @@ function assertTransactionCIP64(transaction) {
3400
3447
  }
3401
3448
 
3402
3449
  const chainConfig = {
3450
+ blockTime: 1_000,
3403
3451
  contracts,
3404
3452
  formatters,
3405
3453
  serializers,
3406
3454
  fees,
3407
3455
  };
3408
3456
 
3409
- const sourceId$C = 17000; // holsky
3457
+ const sourceId$E = 17000; // holsky
3410
3458
  // source https://storage.googleapis.com/cel2-rollup-files/alfajores/deployment-l1.json
3411
3459
  /*#__PURE__*/ defineChain({
3412
3460
  ...chainConfig,
@@ -3436,25 +3484,25 @@ const sourceId$C = 17000; // holsky
3436
3484
  blockCreated: 14569001,
3437
3485
  },
3438
3486
  portal: {
3439
- [sourceId$C]: {
3487
+ [sourceId$E]: {
3440
3488
  address: '0x82527353927d8D069b3B452904c942dA149BA381',
3441
3489
  blockCreated: 2411324,
3442
3490
  },
3443
3491
  },
3444
3492
  disputeGameFactory: {
3445
- [sourceId$C]: {
3493
+ [sourceId$E]: {
3446
3494
  address: '0xE28AAdcd9883746c0e5068F58f9ea06027b214cb',
3447
3495
  blockCreated: 2411324,
3448
3496
  },
3449
3497
  },
3450
3498
  l2OutputOracle: {
3451
- [sourceId$C]: {
3499
+ [sourceId$E]: {
3452
3500
  address: '0x4a2635e9e4f6e45817b1D402ac4904c1d1752438',
3453
3501
  blockCreated: 2411324,
3454
3502
  },
3455
3503
  },
3456
3504
  l1StandardBridge: {
3457
- [sourceId$C]: {
3505
+ [sourceId$E]: {
3458
3506
  address: '0xD1B0E0581973c9eB7f886967A606b9441A897037',
3459
3507
  blockCreated: 2411324,
3460
3508
  },
@@ -3463,6 +3511,57 @@ const sourceId$C = 17000; // holsky
3463
3511
  testnet: true,
3464
3512
  });
3465
3513
 
3514
+ const sourceId$D = 11_155_111; // sepolia
3515
+ // source https://storage.googleapis.com/cel2-rollup-files/celo-sepolia/deployment-l1.json
3516
+ /*#__PURE__*/ defineChain({
3517
+ ...chainConfig,
3518
+ id: 11_142_220,
3519
+ name: 'Celo Sepolia Testnet',
3520
+ nativeCurrency: {
3521
+ decimals: 18,
3522
+ name: 'CELO',
3523
+ symbol: 'S-CELO',
3524
+ },
3525
+ rpcUrls: {
3526
+ default: {
3527
+ http: ['https://forno.celo-sepolia.celo-testnet.org'],
3528
+ },
3529
+ },
3530
+ blockExplorers: {
3531
+ default: {
3532
+ name: 'Celo Sepolia Explorer',
3533
+ url: 'https://celo-sepolia.blockscout.com/',
3534
+ apiUrl: 'https://celo-sepolia.blockscout.com/api',
3535
+ },
3536
+ },
3537
+ contracts: {
3538
+ ...chainConfig.contracts,
3539
+ multicall3: {
3540
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
3541
+ blockCreated: 1,
3542
+ },
3543
+ portal: {
3544
+ [sourceId$D]: {
3545
+ address: '0x44ae3d41a335a7d05eb533029917aad35662dcc2',
3546
+ blockCreated: 8825790,
3547
+ },
3548
+ },
3549
+ disputeGameFactory: {
3550
+ [sourceId$D]: {
3551
+ address: '0x57c45d82d1a995f1e135b8d7edc0a6bb5211cfaa',
3552
+ blockCreated: 8825790,
3553
+ },
3554
+ },
3555
+ l1StandardBridge: {
3556
+ [sourceId$D]: {
3557
+ address: '0xec18a3c30131a0db4246e785355fbc16e2eaf408',
3558
+ blockCreated: 8825790,
3559
+ },
3560
+ },
3561
+ },
3562
+ testnet: true,
3563
+ });
3564
+
3466
3565
  defineChain({
3467
3566
  id: 44,
3468
3567
  name: 'Crab Network',
@@ -3577,7 +3676,7 @@ defineChain({
3577
3676
  testnet: true,
3578
3677
  });
3579
3678
 
3580
- const sourceId$B = 1; // mainnet
3679
+ const sourceId$C = 1; // mainnet
3581
3680
  /*#__PURE__*/ defineChain({
3582
3681
  id: 478,
3583
3682
  name: 'Form Network',
@@ -3601,27 +3700,27 @@ const sourceId$B = 1; // mainnet
3601
3700
  contracts: {
3602
3701
  ...chainConfig$1.contracts,
3603
3702
  addressManager: {
3604
- [sourceId$B]: {
3703
+ [sourceId$C]: {
3605
3704
  address: '0x15c249E46A2F924C2dB3A1560CF86729bAD1f07B',
3606
3705
  },
3607
3706
  },
3608
3707
  l1CrossDomainMessenger: {
3609
- [sourceId$B]: {
3708
+ [sourceId$C]: {
3610
3709
  address: '0xF333158DCCad1dF6C3F0a3aEe8BC31fA94d9eD5c',
3611
3710
  },
3612
3711
  },
3613
3712
  l2OutputOracle: {
3614
- [sourceId$B]: {
3713
+ [sourceId$C]: {
3615
3714
  address: '0x4ccAAF69F41c5810cA875183648B577CaCf1F67E',
3616
3715
  },
3617
3716
  },
3618
3717
  portal: {
3619
- [sourceId$B]: {
3718
+ [sourceId$C]: {
3620
3719
  address: '0x4E259Ee5F4136408908160dD32295A5031Fa426F',
3621
3720
  },
3622
3721
  },
3623
3722
  l1StandardBridge: {
3624
- [sourceId$B]: {
3723
+ [sourceId$C]: {
3625
3724
  address: '0xdc20aA63D3DE59574E065957190D8f24e0F7B8Ba',
3626
3725
  },
3627
3726
  },
@@ -3629,10 +3728,10 @@ const sourceId$B = 1; // mainnet
3629
3728
  address: '0xcA11bde05977b3631167028862bE2a173976CA11',
3630
3729
  },
3631
3730
  },
3632
- sourceId: sourceId$B,
3731
+ sourceId: sourceId$C,
3633
3732
  });
3634
3733
 
3635
- const sourceId$A = 11_155_111; // sepolia
3734
+ const sourceId$B = 11_155_111; // sepolia
3636
3735
  /*#__PURE__*/ defineChain({
3637
3736
  id: 132_902,
3638
3737
  name: 'Form Testnet',
@@ -3656,27 +3755,27 @@ const sourceId$A = 11_155_111; // sepolia
3656
3755
  contracts: {
3657
3756
  ...chainConfig$1.contracts,
3658
3757
  addressManager: {
3659
- [sourceId$A]: {
3758
+ [sourceId$B]: {
3660
3759
  address: '0xd5C38fa934f7fd7477D4800F4f38a1c5BFdF1373',
3661
3760
  },
3662
3761
  },
3663
3762
  l1CrossDomainMessenger: {
3664
- [sourceId$A]: {
3763
+ [sourceId$B]: {
3665
3764
  address: '0x37A68565c4BE9700b3E3Ec60cC4416cAC3052FAa',
3666
3765
  },
3667
3766
  },
3668
3767
  l2OutputOracle: {
3669
- [sourceId$A]: {
3768
+ [sourceId$B]: {
3670
3769
  address: '0x9eA2239E65a59EC9C7F1ED4C116dD58Da71Fc1e2',
3671
3770
  },
3672
3771
  },
3673
3772
  portal: {
3674
- [sourceId$A]: {
3773
+ [sourceId$B]: {
3675
3774
  address: '0x60377e3cE15dF4CCA24c4beF076b60314240b032',
3676
3775
  },
3677
3776
  },
3678
3777
  l1StandardBridge: {
3679
- [sourceId$A]: {
3778
+ [sourceId$B]: {
3680
3779
  address: '0xD4531f633942b2725896F47cD2aFd260b44Ab1F7',
3681
3780
  },
3682
3781
  },
@@ -3685,10 +3784,10 @@ const sourceId$A = 11_155_111; // sepolia
3685
3784
  },
3686
3785
  },
3687
3786
  testnet: true,
3688
- sourceId: sourceId$A,
3787
+ sourceId: sourceId$B,
3689
3788
  });
3690
3789
 
3691
- const sourceId$z = 1; // mainnet
3790
+ const sourceId$A = 1; // mainnet
3692
3791
  /*#__PURE__*/ defineChain({
3693
3792
  ...chainConfig$1,
3694
3793
  id: 252,
@@ -3709,7 +3808,7 @@ const sourceId$z = 1; // mainnet
3709
3808
  contracts: {
3710
3809
  ...chainConfig$1.contracts,
3711
3810
  l2OutputOracle: {
3712
- [sourceId$z]: {
3811
+ [sourceId$A]: {
3713
3812
  address: '0x66CC916Ed5C6C2FA97014f7D1cD141528Ae171e4',
3714
3813
  },
3715
3814
  },
@@ -3717,22 +3816,22 @@ const sourceId$z = 1; // mainnet
3717
3816
  address: '0xca11bde05977b3631167028862be2a173976ca11',
3718
3817
  },
3719
3818
  portal: {
3720
- [sourceId$z]: {
3819
+ [sourceId$A]: {
3721
3820
  address: '0x36cb65c1967A0Fb0EEE11569C51C2f2aA1Ca6f6D',
3722
3821
  blockCreated: 19135323,
3723
3822
  },
3724
3823
  },
3725
3824
  l1StandardBridge: {
3726
- [sourceId$z]: {
3825
+ [sourceId$A]: {
3727
3826
  address: '0x34C0bD5877A5Ee7099D0f5688D65F4bB9158BDE2',
3728
3827
  blockCreated: 19135323,
3729
3828
  },
3730
3829
  },
3731
3830
  },
3732
- sourceId: sourceId$z,
3831
+ sourceId: sourceId$A,
3733
3832
  });
3734
3833
 
3735
- const sourceId$y = 17000; // holesky
3834
+ const sourceId$z = 17000; // holesky
3736
3835
  /*#__PURE__*/ defineChain({
3737
3836
  ...chainConfig$1,
3738
3837
  id: 2522,
@@ -3753,7 +3852,7 @@ const sourceId$y = 17000; // holesky
3753
3852
  contracts: {
3754
3853
  ...chainConfig$1.contracts,
3755
3854
  l2OutputOracle: {
3756
- [sourceId$y]: {
3855
+ [sourceId$z]: {
3757
3856
  address: '0x715EA64DA13F4d0831ece4Ad3E8c1aa013167F32',
3758
3857
  },
3759
3858
  },
@@ -3761,22 +3860,22 @@ const sourceId$y = 17000; // holesky
3761
3860
  address: '0xca11bde05977b3631167028862be2a173976ca11',
3762
3861
  },
3763
3862
  portal: {
3764
- [sourceId$y]: {
3863
+ [sourceId$z]: {
3765
3864
  address: '0xB9c64BfA498d5b9a8398Ed6f46eb76d90dE5505d',
3766
3865
  blockCreated: 318416,
3767
3866
  },
3768
3867
  },
3769
3868
  l1StandardBridge: {
3770
- [sourceId$y]: {
3869
+ [sourceId$z]: {
3771
3870
  address: '0x0BaafC217162f64930909aD9f2B27125121d6332',
3772
3871
  blockCreated: 318416,
3773
3872
  },
3774
3873
  },
3775
3874
  },
3776
- sourceId: sourceId$y,
3875
+ sourceId: sourceId$z,
3777
3876
  });
3778
3877
 
3779
- const sourceId$x = 1; // mainnet
3878
+ const sourceId$y = 1; // mainnet
3780
3879
  /*#__PURE__*/ defineChain({
3781
3880
  ...chainConfig$1,
3782
3881
  id: 33979,
@@ -3796,10 +3895,10 @@ const sourceId$x = 1; // mainnet
3796
3895
  contracts: {
3797
3896
  ...chainConfig$1.contracts,
3798
3897
  },
3799
- sourceId: sourceId$x,
3898
+ sourceId: sourceId$y,
3800
3899
  });
3801
3900
 
3802
- const sourceId$w = 11_155_111; // sepolia
3901
+ const sourceId$x = 11_155_111; // sepolia
3803
3902
  defineChain({
3804
3903
  ...chainConfig$1,
3805
3904
  id: 3397901,
@@ -3825,16 +3924,16 @@ defineChain({
3825
3924
  blockCreated: 1620204,
3826
3925
  },
3827
3926
  },
3828
- sourceId: sourceId$w,
3927
+ sourceId: sourceId$x,
3829
3928
  });
3830
3929
 
3831
- const sourceId$v = 17000; // Holesky testnet
3930
+ const sourceId$w = 17000; // Holesky testnet
3832
3931
  defineChain({
3833
3932
  ...chainConfig$1,
3834
3933
  name: 'Garnet Testnet',
3835
3934
  testnet: true,
3836
3935
  id: 17069,
3837
- sourceId: sourceId$v,
3936
+ sourceId: sourceId$w,
3838
3937
  nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
3839
3938
  rpcUrls: {
3840
3939
  default: {
@@ -3854,19 +3953,19 @@ defineChain({
3854
3953
  address: '0xca11bde05977b3631167028862be2a173976ca11',
3855
3954
  },
3856
3955
  portal: {
3857
- [sourceId$v]: {
3956
+ [sourceId$w]: {
3858
3957
  address: '0x57ee40586fbE286AfC75E67cb69511A6D9aF5909',
3859
3958
  blockCreated: 1274684,
3860
3959
  },
3861
3960
  },
3862
3961
  l2OutputOracle: {
3863
- [sourceId$v]: {
3962
+ [sourceId$w]: {
3864
3963
  address: '0xCb8E7AC561b8EF04F2a15865e9fbc0766FEF569B',
3865
3964
  blockCreated: 1274684,
3866
3965
  },
3867
3966
  },
3868
3967
  l1StandardBridge: {
3869
- [sourceId$v]: {
3968
+ [sourceId$w]: {
3870
3969
  address: '0x09bcDd311FE398F80a78BE37E489f5D440DB95DE',
3871
3970
  blockCreated: 1274684,
3872
3971
  },
@@ -3874,6 +3973,52 @@ defineChain({
3874
3973
  },
3875
3974
  });
3876
3975
 
3976
+ const sourceId$v = 11_155_111; // sepolia
3977
+ /*#__PURE__*/ defineChain({
3978
+ ...chainConfig$1,
3979
+ id: 91342,
3980
+ network: 'giwa-sepolia',
3981
+ name: 'GIWA Sepolia',
3982
+ nativeCurrency: { name: 'Sepolia Ether', symbol: 'ETH', decimals: 18 },
3983
+ blockTime: 1_000,
3984
+ rpcUrls: {
3985
+ default: {
3986
+ http: ['https://sepolia-rpc.giwa.io'],
3987
+ },
3988
+ },
3989
+ blockExplorers: {
3990
+ default: {
3991
+ name: 'Blockscout',
3992
+ url: 'https://sepolia-explorer.giwa.io',
3993
+ apiUrl: 'https://sepolia-explorer.giwa.io/api',
3994
+ },
3995
+ },
3996
+ contracts: {
3997
+ ...chainConfig$1.contracts,
3998
+ multicall3: {
3999
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
4000
+ blockCreated: 0,
4001
+ },
4002
+ disputeGameFactory: {
4003
+ [sourceId$v]: {
4004
+ address: '0x37347caB2afaa49B776372279143D71ad1f354F6',
4005
+ },
4006
+ },
4007
+ portal: {
4008
+ [sourceId$v]: {
4009
+ address: '0x956962C34687A954e611A83619ABaA37Ce6bC78A',
4010
+ },
4011
+ },
4012
+ l1StandardBridge: {
4013
+ [sourceId$v]: {
4014
+ address: '0x77b2ffc0F57598cAe1DB76cb398059cF5d10A7E7',
4015
+ },
4016
+ },
4017
+ },
4018
+ testnet: true,
4019
+ sourceId: sourceId$v,
4020
+ });
4021
+
3877
4022
  const sourceId$u = 1; // mainnet
3878
4023
  /*#__PURE__*/ defineChain({
3879
4024
  ...chainConfig$1,
@@ -4226,9 +4371,9 @@ function encodeBytes(value, { param }) {
4226
4371
  encoded: concat([padHex(numberToHex(bytesSize, { size: 32 })), value_]),
4227
4372
  };
4228
4373
  }
4229
- if (bytesSize !== Number.parseInt(paramSize))
4374
+ if (bytesSize !== Number.parseInt(paramSize, 10))
4230
4375
  throw new AbiEncodingBytesSizeMismatchError({
4231
- expectedSize: Number.parseInt(paramSize),
4376
+ expectedSize: Number.parseInt(paramSize, 10),
4232
4377
  value,
4233
4378
  });
4234
4379
  return { dynamic: false, encoded: padHex(value, { dir: 'right' }) };
@@ -4538,6 +4683,25 @@ const sourceId$o = 11_155_111; // sepolia
4538
4683
  sourceId: sourceId$o,
4539
4684
  });
4540
4685
 
4686
+ defineChain({
4687
+ id: 166,
4688
+ name: 'Omni',
4689
+ nativeCurrency: { name: 'Omni', symbol: 'OMNI', decimals: 18 },
4690
+ rpcUrls: {
4691
+ default: {
4692
+ http: ['https://mainnet.omni.network'],
4693
+ webSocket: ['wss://mainnet.omni.network'],
4694
+ },
4695
+ },
4696
+ blockExplorers: {
4697
+ default: {
4698
+ name: 'OmniScan',
4699
+ url: 'https://omniscan.network',
4700
+ },
4701
+ },
4702
+ testnet: false,
4703
+ });
4704
+
4541
4705
  const sourceId$n = 56; // bsc mainnet
4542
4706
  /*#__PURE__*/ defineChain({
4543
4707
  id: 204,
@@ -5357,6 +5521,7 @@ const sourceId$6 = 1; // mainnet
5357
5521
  id: 130,
5358
5522
  name: 'Unichain',
5359
5523
  nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
5524
+ blockTime: 1_000,
5360
5525
  rpcUrls: {
5361
5526
  default: {
5362
5527
  http: ['https://mainnet.unichain.org/'],
@@ -5404,6 +5569,7 @@ const sourceId$5 = 11_155_111; // sepolia
5404
5569
  symbol: 'ETH',
5405
5570
  decimals: 18,
5406
5571
  },
5572
+ blockTime: 1_000,
5407
5573
  rpcUrls: {
5408
5574
  default: {
5409
5575
  http: ['https://sepolia.unichain.org'],
@@ -5686,8 +5852,8 @@ const sourceId = 5; // goerli
5686
5852
  });
5687
5853
 
5688
5854
  const FlaunchZapAddress = {
5689
- [base.id]: "0xe52dE1801C10cF709cc8e62d43D783AFe984b510",
5690
- [baseSepolia.id]: "0xf0Fd8Bb98c050607d999D6fFF9C617edD6673b75",
5855
+ [base.id]: "0x39112541720078c70164EA4Deb61F0A4811910F9",
5856
+ [baseSepolia.id]: "0x25b747aeca2612b9804b5c3bb272a3daefdc6eaa",
5691
5857
  };
5692
5858
  // only old V1.0: doesn't use FeeEscrow
5693
5859
  const FlaunchPositionManagerAddress = {
@@ -5756,13 +5922,17 @@ const AddressFeeSplitManagerAddress = {
5756
5922
  [base.id]: "0xfAB4BA48a322Efc8b25815448BE6018D211e89f3",
5757
5923
  [baseSepolia.id]: "0x0A3AF63cd86E68a852A1D4923FEfC4e855D8499d",
5758
5924
  };
5925
+ const DynamicAddressFeeSplitManagerAddress = {
5926
+ [base.id]: "0x9b332EA14a99B74cAB03A3D3178964eD9CE35fc8",
5927
+ [baseSepolia.id]: "0x4882075542626721C8743D80DC9528e2f54d8A46",
5928
+ };
5759
5929
  const StakingManagerAddress = {
5760
5930
  [base.id]: "0xec0069F8DBbbC94058dc895000dd38ef40b3125d",
5761
5931
  [baseSepolia.id]: "0xB8f1cb6B4Ff8f07149276bbfA617aed7bd32d20D",
5762
5932
  };
5763
5933
  const BuyBackManagerAddress = {
5764
- [base.id]: "0x3AAF3b1D8cD5b61C77f99bA7cdf41E9eC0Ba8a3f",
5765
- [baseSepolia.id]: "0xc3947EC9d687053bBA72b36Fd6b2567e775E82C7",
5934
+ [base.id]: "0x18713855492A778363e23e2CdE325344b8fd6F8d",
5935
+ [baseSepolia.id]: "0xA4A1a2Ca68151565d5200243a52EEBbCb2C878E0",
5766
5936
  };
5767
5937
  /** Verifiers */
5768
5938
  const TokenImporterAddress = {
@@ -5809,7 +5979,7 @@ const FeeEscrowAddress = {
5809
5979
  [baseSepolia.id]: "0x73E27908b7d35A9251a54799A8ef4C17e4ED9FF9",
5810
5980
  };
5811
5981
  const ReferralEscrowAddress = {
5812
- [base.id]: "0xBD39c7Be6D98BD1a3e4Ad482baF99d738947fE55",
5982
+ [base.id]: "0xd381f8ea57df43c57cfe6e5b19a0a4700396f28c",
5813
5983
  [baseSepolia.id]: "0xd3d9047CaBE3346C70b510435866565176e8CE12",
5814
5984
  };
5815
5985
  const FLETHAddress = {
@@ -14399,6 +14569,92 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
14399
14569
  tokenUri,
14400
14570
  });
14401
14571
  }
14572
+ /**
14573
+ * Flaunches a new token with the Dynamic Address Fee Split manager.
14574
+ * Unlike static splits, recipient shares are mutable post-deployment.
14575
+ * @param params - Parameters for the flaunch with dynamic split manager
14576
+ * @returns Transaction response for the flaunch creation
14577
+ */
14578
+ async flaunchWithDynamicSplitManager(params) {
14579
+ const VALID_SHARE_TOTAL = 10000000n;
14580
+ if (params.moderator === viem.zeroAddress) {
14581
+ throw new Error("Dynamic split moderator cannot be zero address");
14582
+ }
14583
+ if (params.creatorShare < 0n || params.managerOwnerShare < 0n) {
14584
+ throw new Error("Creator and manager owner shares cannot be negative");
14585
+ }
14586
+ if (params.creatorShare + params.managerOwnerShare > VALID_SHARE_TOTAL) {
14587
+ throw new Error("Creator and manager owner shares must be less than or equal to 100_00000");
14588
+ }
14589
+ const duplicateRecipients = new Set();
14590
+ const recipientShares = params.splitReceivers.map((receiver) => {
14591
+ if (receiver.address === viem.zeroAddress) {
14592
+ throw new Error("Recipient address cannot be zero address");
14593
+ }
14594
+ if (receiver.share <= 0n) {
14595
+ throw new Error("Recipient share must be greater than zero");
14596
+ }
14597
+ const normalizedAddress = viem.getAddress(receiver.address);
14598
+ if (duplicateRecipients.has(normalizedAddress)) {
14599
+ throw new Error("Duplicate recipient found in split receivers");
14600
+ }
14601
+ duplicateRecipients.add(normalizedAddress);
14602
+ return {
14603
+ recipient: normalizedAddress,
14604
+ share: receiver.share,
14605
+ };
14606
+ });
14607
+ const initializeData = viem.encodeAbiParameters([
14608
+ {
14609
+ type: "tuple",
14610
+ name: "params",
14611
+ components: [
14612
+ { type: "uint256", name: "creatorShare" },
14613
+ { type: "uint256", name: "ownerShare" },
14614
+ { type: "address", name: "moderator" },
14615
+ {
14616
+ type: "tuple[]",
14617
+ name: "recipientShares",
14618
+ components: [
14619
+ { type: "address", name: "recipient" },
14620
+ { type: "uint256", name: "share" },
14621
+ ],
14622
+ },
14623
+ ],
14624
+ },
14625
+ ], [
14626
+ {
14627
+ creatorShare: params.creatorShare,
14628
+ ownerShare: params.managerOwnerShare,
14629
+ moderator: params.moderator,
14630
+ recipientShares,
14631
+ },
14632
+ ]);
14633
+ return this.flaunch({
14634
+ ...params,
14635
+ treasuryManagerParams: {
14636
+ manager: DynamicAddressFeeSplitManagerAddress[this.chainId],
14637
+ permissions: params.treasuryManagerParams?.permissions ?? exports.Permissions.OPEN,
14638
+ initializeData,
14639
+ depositData: "0x",
14640
+ },
14641
+ });
14642
+ }
14643
+ /**
14644
+ * Flaunches a new token with dynamic split manager and stores metadata on IPFS.
14645
+ * @param params - Parameters for dynamic split manager flow including IPFS metadata
14646
+ * @returns Transaction response for the flaunch creation
14647
+ */
14648
+ async flaunchIPFSWithDynamicSplitManager(params) {
14649
+ const tokenUri = await generateTokenUri(params.name, params.symbol, {
14650
+ metadata: params.metadata,
14651
+ pinataConfig: params.pinataConfig,
14652
+ });
14653
+ return this.flaunchWithDynamicSplitManager({
14654
+ ...params,
14655
+ tokenUri,
14656
+ });
14657
+ }
14402
14658
  /**
14403
14659
  * Deploys a new revenue manager
14404
14660
  * @param params - Parameters for deploying the revenue manager
@@ -26309,278 +26565,1770 @@ const chainIdToChain = {
26309
26565
  [baseSepolia.id]: baseSepolia,
26310
26566
  };
26311
26567
 
26312
- const FastFlaunchZapAbi = [
26568
+ const DynamicAddressFeeSplitManagerAbi = [
26313
26569
  {
26314
- inputs: [
26570
+ "type": "constructor",
26571
+ "inputs": [
26315
26572
  {
26316
- internalType: "contract PositionManager",
26317
- name: "_positionManager",
26318
- type: "address",
26573
+ "name": "_treasuryManagerFactory",
26574
+ "type": "address",
26575
+ "internalType": "address"
26319
26576
  },
26577
+ {
26578
+ "name": "_feeEscrowRegistry",
26579
+ "type": "address",
26580
+ "internalType": "address"
26581
+ }
26320
26582
  ],
26321
- stateMutability: "nonpayable",
26322
- type: "constructor",
26323
- },
26324
- {
26325
- inputs: [],
26326
- name: "CREATOR_FEE_ALLOCATION",
26327
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
26328
- stateMutability: "view",
26329
- type: "function",
26330
- },
26331
- {
26332
- inputs: [],
26333
- name: "FAIR_LAUNCH_SUPPLY",
26334
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
26335
- stateMutability: "view",
26336
- type: "function",
26583
+ "stateMutability": "nonpayable"
26337
26584
  },
26338
26585
  {
26339
- inputs: [],
26340
- name: "USDC_MARKET_CAP",
26341
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
26342
- stateMutability: "view",
26343
- type: "function",
26586
+ "type": "receive",
26587
+ "stateMutability": "payable"
26344
26588
  },
26345
26589
  {
26346
- inputs: [
26590
+ "type": "function",
26591
+ "name": "MAX_CREATOR_SHARE",
26592
+ "inputs": [],
26593
+ "outputs": [
26347
26594
  {
26348
- components: [
26349
- { internalType: "string", name: "name", type: "string" },
26350
- { internalType: "string", name: "symbol", type: "string" },
26351
- { internalType: "string", name: "tokenUri", type: "string" },
26352
- { internalType: "address", name: "creator", type: "address" },
26353
- ],
26354
- internalType: "struct FastFlaunchZap.FastFlaunchParams",
26355
- name: "_params",
26356
- type: "tuple",
26357
- },
26595
+ "name": "",
26596
+ "type": "uint256",
26597
+ "internalType": "uint256"
26598
+ }
26358
26599
  ],
26359
- name: "flaunch",
26360
- outputs: [{ internalType: "address", name: "memecoin_", type: "address" }],
26361
- stateMutability: "nonpayable",
26362
- type: "function",
26600
+ "stateMutability": "view"
26363
26601
  },
26364
26602
  {
26365
- inputs: [],
26366
- name: "positionManager",
26367
- outputs: [
26368
- { internalType: "contract PositionManager", name: "", type: "address" },
26603
+ "type": "function",
26604
+ "name": "MAX_OWNER_SHARE",
26605
+ "inputs": [],
26606
+ "outputs": [
26607
+ {
26608
+ "name": "",
26609
+ "type": "uint256",
26610
+ "internalType": "uint256"
26611
+ }
26369
26612
  ],
26370
- stateMutability: "view",
26371
- type: "function",
26372
- },
26373
- ];
26374
-
26375
- const FLETHAbi = [
26376
- {
26377
- inputs: [{ internalType: "uint256", name: "wethAmount", type: "uint256" }],
26378
- name: "deposit",
26379
- outputs: [],
26380
- stateMutability: "payable",
26381
- type: "function",
26382
- },
26383
- {
26384
- inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
26385
- name: "withdraw",
26386
- outputs: [],
26387
- stateMutability: "nonpayable",
26388
- type: "function",
26389
- },
26390
- {
26391
- inputs: [{ internalType: "address", name: "account", type: "address" }],
26392
- name: "balanceOf",
26393
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
26394
- stateMutability: "view",
26395
- type: "function",
26396
- },
26397
- {
26398
- inputs: [],
26399
- name: "totalSupply",
26400
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
26401
- stateMutability: "view",
26402
- type: "function",
26403
- },
26404
- {
26405
- inputs: [],
26406
- name: "name",
26407
- outputs: [{ internalType: "string", name: "", type: "string" }],
26408
- stateMutability: "view",
26409
- type: "function",
26410
- },
26411
- {
26412
- inputs: [],
26413
- name: "symbol",
26414
- outputs: [{ internalType: "string", name: "", type: "string" }],
26415
- stateMutability: "view",
26416
- type: "function",
26613
+ "stateMutability": "view"
26417
26614
  },
26418
26615
  {
26419
- inputs: [],
26420
- name: "decimals",
26421
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
26422
- stateMutability: "view",
26423
- type: "function",
26616
+ "type": "function",
26617
+ "name": "VALID_SHARE_TOTAL",
26618
+ "inputs": [],
26619
+ "outputs": [
26620
+ {
26621
+ "name": "",
26622
+ "type": "uint256",
26623
+ "internalType": "uint256"
26624
+ }
26625
+ ],
26626
+ "stateMutability": "view"
26424
26627
  },
26425
- ];
26426
-
26427
- const TrustedSignerFeeCalculatorAbi = [
26428
26628
  {
26429
- inputs: [
26430
- { internalType: "address", name: "_nativeToken", type: "address" },
26431
- { internalType: "address", name: "_positionManager", type: "address" },
26629
+ "type": "function",
26630
+ "name": "accumulatorPerShare",
26631
+ "inputs": [],
26632
+ "outputs": [
26633
+ {
26634
+ "name": "",
26635
+ "type": "uint256",
26636
+ "internalType": "uint256"
26637
+ }
26432
26638
  ],
26433
- stateMutability: "nonpayable",
26434
- type: "constructor",
26639
+ "stateMutability": "view"
26435
26640
  },
26436
- { inputs: [], name: "AlreadyInitialized", type: "error" },
26437
- { inputs: [], name: "CallerNotPositionManager", type: "error" },
26438
26641
  {
26439
- inputs: [{ internalType: "uint256", name: "_deadline", type: "uint256" }],
26440
- name: "DeadlineExpired",
26441
- type: "error",
26642
+ "type": "function",
26643
+ "name": "balances",
26644
+ "inputs": [
26645
+ {
26646
+ "name": "_recipient",
26647
+ "type": "address",
26648
+ "internalType": "address"
26649
+ }
26650
+ ],
26651
+ "outputs": [
26652
+ {
26653
+ "name": "balance_",
26654
+ "type": "uint256",
26655
+ "internalType": "uint256"
26656
+ }
26657
+ ],
26658
+ "stateMutability": "view"
26442
26659
  },
26443
- { inputs: [], name: "InvalidPoolKey", type: "error" },
26444
26660
  {
26445
- inputs: [
26446
- { internalType: "address", name: "_invalidSigner", type: "address" },
26661
+ "type": "function",
26662
+ "name": "claim",
26663
+ "inputs": [],
26664
+ "outputs": [
26665
+ {
26666
+ "name": "",
26667
+ "type": "uint256",
26668
+ "internalType": "uint256"
26669
+ }
26447
26670
  ],
26448
- name: "InvalidSigner",
26449
- type: "error",
26671
+ "stateMutability": "nonpayable"
26450
26672
  },
26451
- { inputs: [], name: "NewOwnerIsZeroAddress", type: "error" },
26452
- { inputs: [], name: "NoHandoverRequest", type: "error" },
26453
- { inputs: [], name: "Reentrancy", type: "error" },
26454
- { inputs: [], name: "SignatureAlreadyUsed", type: "error" },
26455
26673
  {
26456
- inputs: [{ internalType: "address", name: "_signer", type: "address" }],
26457
- name: "SignerAlreadyAdded",
26458
- type: "error",
26674
+ "type": "function",
26675
+ "name": "claim",
26676
+ "inputs": [
26677
+ {
26678
+ "name": "_data",
26679
+ "type": "bytes",
26680
+ "internalType": "bytes"
26681
+ }
26682
+ ],
26683
+ "outputs": [
26684
+ {
26685
+ "name": "",
26686
+ "type": "uint256",
26687
+ "internalType": "uint256"
26688
+ }
26689
+ ],
26690
+ "stateMutability": "nonpayable"
26459
26691
  },
26460
26692
  {
26461
- inputs: [{ internalType: "address", name: "_signer", type: "address" }],
26462
- name: "SignerDoesNotExist",
26463
- type: "error",
26693
+ "type": "function",
26694
+ "name": "claimableOwnerFees",
26695
+ "inputs": [],
26696
+ "outputs": [
26697
+ {
26698
+ "name": "",
26699
+ "type": "uint256",
26700
+ "internalType": "uint256"
26701
+ }
26702
+ ],
26703
+ "stateMutability": "view"
26464
26704
  },
26465
26705
  {
26466
- inputs: [
26467
- { internalType: "uint256", name: "_requestedAmount", type: "uint256" },
26468
- { internalType: "uint256", name: "_maxTokensOut", type: "uint256" },
26706
+ "type": "function",
26707
+ "name": "creator",
26708
+ "inputs": [
26709
+ {
26710
+ "name": "_flaunch",
26711
+ "type": "address",
26712
+ "internalType": "address"
26713
+ },
26714
+ {
26715
+ "name": "_tokenId",
26716
+ "type": "uint256",
26717
+ "internalType": "uint256"
26718
+ }
26469
26719
  ],
26470
- name: "TransactionCapExceeded",
26471
- type: "error",
26720
+ "outputs": [
26721
+ {
26722
+ "name": "_creator",
26723
+ "type": "address",
26724
+ "internalType": "address"
26725
+ }
26726
+ ],
26727
+ "stateMutability": "view"
26472
26728
  },
26473
- { inputs: [], name: "Unauthorized", type: "error" },
26474
26729
  {
26475
- anonymous: false,
26476
- inputs: [
26730
+ "type": "function",
26731
+ "name": "creatorFees",
26732
+ "inputs": [],
26733
+ "outputs": [
26477
26734
  {
26478
- indexed: true,
26479
- internalType: "address",
26480
- name: "pendingOwner",
26481
- type: "address",
26482
- },
26735
+ "name": "",
26736
+ "type": "uint256",
26737
+ "internalType": "uint256"
26738
+ }
26483
26739
  ],
26484
- name: "OwnershipHandoverCanceled",
26485
- type: "event",
26740
+ "stateMutability": "view"
26486
26741
  },
26487
26742
  {
26488
- anonymous: false,
26489
- inputs: [
26743
+ "type": "function",
26744
+ "name": "creatorShare",
26745
+ "inputs": [],
26746
+ "outputs": [
26490
26747
  {
26491
- indexed: true,
26492
- internalType: "address",
26493
- name: "pendingOwner",
26494
- type: "address",
26495
- },
26748
+ "name": "",
26749
+ "type": "uint256",
26750
+ "internalType": "uint256"
26751
+ }
26496
26752
  ],
26497
- name: "OwnershipHandoverRequested",
26498
- type: "event",
26753
+ "stateMutability": "view"
26499
26754
  },
26500
26755
  {
26501
- anonymous: false,
26502
- inputs: [
26756
+ "type": "function",
26757
+ "name": "creatorTotalClaimed",
26758
+ "inputs": [
26503
26759
  {
26504
- indexed: true,
26505
- internalType: "address",
26506
- name: "oldOwner",
26507
- type: "address",
26508
- },
26760
+ "name": "_creator",
26761
+ "type": "address",
26762
+ "internalType": "address"
26763
+ }
26764
+ ],
26765
+ "outputs": [
26509
26766
  {
26510
- indexed: true,
26511
- internalType: "address",
26512
- name: "newOwner",
26513
- type: "address",
26514
- },
26767
+ "name": "_claimed",
26768
+ "type": "uint256",
26769
+ "internalType": "uint256"
26770
+ }
26515
26771
  ],
26516
- name: "OwnershipTransferred",
26517
- type: "event",
26772
+ "stateMutability": "view"
26518
26773
  },
26519
26774
  {
26520
- anonymous: false,
26521
- inputs: [
26775
+ "type": "function",
26776
+ "name": "deposit",
26777
+ "inputs": [
26522
26778
  {
26523
- indexed: false,
26524
- internalType: "PoolId",
26525
- name: "_poolId",
26526
- type: "bytes32",
26779
+ "name": "_flaunchToken",
26780
+ "type": "tuple",
26781
+ "internalType": "struct ITreasuryManager.FlaunchToken",
26782
+ "components": [
26783
+ {
26784
+ "name": "flaunch",
26785
+ "type": "address",
26786
+ "internalType": "contract Flaunch"
26787
+ },
26788
+ {
26789
+ "name": "tokenId",
26790
+ "type": "uint256",
26791
+ "internalType": "uint256"
26792
+ }
26793
+ ]
26527
26794
  },
26528
26795
  {
26529
- components: [
26530
- { internalType: "bool", name: "enabled", type: "bool" },
26531
- { internalType: "uint256", name: "walletCap", type: "uint256" },
26532
- { internalType: "uint256", name: "txCap", type: "uint256" },
26533
- ],
26534
- indexed: false,
26535
- internalType: "struct TrustedSignerFeeCalculator.FairLaunchSettings",
26536
- name: "_settings",
26537
- type: "tuple",
26796
+ "name": "_creator",
26797
+ "type": "address",
26798
+ "internalType": "address"
26538
26799
  },
26800
+ {
26801
+ "name": "_data",
26802
+ "type": "bytes",
26803
+ "internalType": "bytes"
26804
+ }
26539
26805
  ],
26540
- name: "PoolKeyFairLaunchSettingsUpdated",
26541
- type: "event",
26806
+ "outputs": [],
26807
+ "stateMutability": "nonpayable"
26542
26808
  },
26543
26809
  {
26544
- anonymous: false,
26545
- inputs: [
26546
- {
26547
- indexed: false,
26548
- internalType: "PoolId",
26549
- name: "_poolId",
26550
- type: "bytes32",
26551
- },
26810
+ "type": "function",
26811
+ "name": "feeEscrowRegistry",
26812
+ "inputs": [],
26813
+ "outputs": [
26552
26814
  {
26553
- indexed: true,
26554
- internalType: "address",
26555
- name: "_signer",
26556
- type: "address",
26557
- },
26815
+ "name": "",
26816
+ "type": "address",
26817
+ "internalType": "contract IFeeEscrowRegistry"
26818
+ }
26558
26819
  ],
26559
- name: "PoolKeySignerUpdated",
26560
- type: "event",
26820
+ "stateMutability": "view"
26561
26821
  },
26562
26822
  {
26563
- anonymous: false,
26564
- inputs: [
26823
+ "type": "function",
26824
+ "name": "flaunchTokenInternalIds",
26825
+ "inputs": [
26565
26826
  {
26566
- indexed: true,
26567
- internalType: "address",
26568
- name: "_signer",
26569
- type: "address",
26827
+ "name": "_flaunch",
26828
+ "type": "address",
26829
+ "internalType": "address"
26570
26830
  },
26571
26831
  {
26572
- indexed: false,
26573
- internalType: "bool",
26574
- name: "_isTrusted",
26575
- type: "bool",
26576
- },
26832
+ "name": "_tokenId",
26833
+ "type": "uint256",
26834
+ "internalType": "uint256"
26835
+ }
26577
26836
  ],
26578
- name: "TrustedSignerUpdated",
26579
- type: "event",
26580
- },
26581
- {
26582
- inputs: [{ internalType: "address", name: "_signer", type: "address" }],
26583
- name: "addTrustedSigner",
26837
+ "outputs": [
26838
+ {
26839
+ "name": "_internalId",
26840
+ "type": "uint256",
26841
+ "internalType": "uint256"
26842
+ }
26843
+ ],
26844
+ "stateMutability": "view"
26845
+ },
26846
+ {
26847
+ "type": "function",
26848
+ "name": "getCreatorFee",
26849
+ "inputs": [
26850
+ {
26851
+ "name": "_amount",
26852
+ "type": "uint256",
26853
+ "internalType": "uint256"
26854
+ }
26855
+ ],
26856
+ "outputs": [
26857
+ {
26858
+ "name": "creatorFee_",
26859
+ "type": "uint256",
26860
+ "internalType": "uint256"
26861
+ }
26862
+ ],
26863
+ "stateMutability": "view"
26864
+ },
26865
+ {
26866
+ "type": "function",
26867
+ "name": "getOwnerFee",
26868
+ "inputs": [
26869
+ {
26870
+ "name": "_amount",
26871
+ "type": "uint256",
26872
+ "internalType": "uint256"
26873
+ }
26874
+ ],
26875
+ "outputs": [
26876
+ {
26877
+ "name": "ownerFee_",
26878
+ "type": "uint256",
26879
+ "internalType": "uint256"
26880
+ }
26881
+ ],
26882
+ "stateMutability": "view"
26883
+ },
26884
+ {
26885
+ "type": "function",
26886
+ "name": "getPoolId",
26887
+ "inputs": [
26888
+ {
26889
+ "name": "_flaunchToken",
26890
+ "type": "tuple",
26891
+ "internalType": "struct ITreasuryManager.FlaunchToken",
26892
+ "components": [
26893
+ {
26894
+ "name": "flaunch",
26895
+ "type": "address",
26896
+ "internalType": "contract Flaunch"
26897
+ },
26898
+ {
26899
+ "name": "tokenId",
26900
+ "type": "uint256",
26901
+ "internalType": "uint256"
26902
+ }
26903
+ ]
26904
+ }
26905
+ ],
26906
+ "outputs": [
26907
+ {
26908
+ "name": "poolId_",
26909
+ "type": "bytes32",
26910
+ "internalType": "PoolId"
26911
+ }
26912
+ ],
26913
+ "stateMutability": "view"
26914
+ },
26915
+ {
26916
+ "type": "function",
26917
+ "name": "initialize",
26918
+ "inputs": [
26919
+ {
26920
+ "name": "_owner",
26921
+ "type": "address",
26922
+ "internalType": "address"
26923
+ },
26924
+ {
26925
+ "name": "_data",
26926
+ "type": "bytes",
26927
+ "internalType": "bytes"
26928
+ }
26929
+ ],
26930
+ "outputs": [],
26931
+ "stateMutability": "nonpayable"
26932
+ },
26933
+ {
26934
+ "type": "function",
26935
+ "name": "initialized",
26936
+ "inputs": [],
26937
+ "outputs": [
26938
+ {
26939
+ "name": "",
26940
+ "type": "bool",
26941
+ "internalType": "bool"
26942
+ }
26943
+ ],
26944
+ "stateMutability": "view"
26945
+ },
26946
+ {
26947
+ "type": "function",
26948
+ "name": "internalIds",
26949
+ "inputs": [
26950
+ {
26951
+ "name": "_internalId",
26952
+ "type": "uint256",
26953
+ "internalType": "uint256"
26954
+ }
26955
+ ],
26956
+ "outputs": [
26957
+ {
26958
+ "name": "flaunch",
26959
+ "type": "address",
26960
+ "internalType": "contract Flaunch"
26961
+ },
26962
+ {
26963
+ "name": "tokenId",
26964
+ "type": "uint256",
26965
+ "internalType": "uint256"
26966
+ }
26967
+ ],
26968
+ "stateMutability": "view"
26969
+ },
26970
+ {
26971
+ "type": "function",
26972
+ "name": "isValidCreator",
26973
+ "inputs": [
26974
+ {
26975
+ "name": "_creator",
26976
+ "type": "address",
26977
+ "internalType": "address"
26978
+ },
26979
+ {
26980
+ "name": "_data",
26981
+ "type": "bytes",
26982
+ "internalType": "bytes"
26983
+ }
26984
+ ],
26985
+ "outputs": [
26986
+ {
26987
+ "name": "",
26988
+ "type": "bool",
26989
+ "internalType": "bool"
26990
+ }
26991
+ ],
26992
+ "stateMutability": "view"
26993
+ },
26994
+ {
26995
+ "type": "function",
26996
+ "name": "isValidRecipient",
26997
+ "inputs": [
26998
+ {
26999
+ "name": "_recipient",
27000
+ "type": "address",
27001
+ "internalType": "address"
27002
+ },
27003
+ {
27004
+ "name": "",
27005
+ "type": "bytes",
27006
+ "internalType": "bytes"
27007
+ }
27008
+ ],
27009
+ "outputs": [
27010
+ {
27011
+ "name": "",
27012
+ "type": "bool",
27013
+ "internalType": "bool"
27014
+ }
27015
+ ],
27016
+ "stateMutability": "view"
27017
+ },
27018
+ {
27019
+ "type": "function",
27020
+ "name": "lastProcessedManagerFees",
27021
+ "inputs": [],
27022
+ "outputs": [
27023
+ {
27024
+ "name": "",
27025
+ "type": "uint256",
27026
+ "internalType": "uint256"
27027
+ }
27028
+ ],
27029
+ "stateMutability": "view"
27030
+ },
27031
+ {
27032
+ "type": "function",
27033
+ "name": "managerFees",
27034
+ "inputs": [],
27035
+ "outputs": [
27036
+ {
27037
+ "name": "",
27038
+ "type": "uint256",
27039
+ "internalType": "uint256"
27040
+ }
27041
+ ],
27042
+ "stateMutability": "view"
27043
+ },
27044
+ {
27045
+ "type": "function",
27046
+ "name": "managerOwner",
27047
+ "inputs": [],
27048
+ "outputs": [
27049
+ {
27050
+ "name": "",
27051
+ "type": "address",
27052
+ "internalType": "address"
27053
+ }
27054
+ ],
27055
+ "stateMutability": "view"
27056
+ },
27057
+ {
27058
+ "type": "function",
27059
+ "name": "moderator",
27060
+ "inputs": [],
27061
+ "outputs": [
27062
+ {
27063
+ "name": "",
27064
+ "type": "address",
27065
+ "internalType": "address"
27066
+ }
27067
+ ],
27068
+ "stateMutability": "view"
27069
+ },
27070
+ {
27071
+ "type": "function",
27072
+ "name": "nextInternalId",
27073
+ "inputs": [],
27074
+ "outputs": [
27075
+ {
27076
+ "name": "",
27077
+ "type": "uint256",
27078
+ "internalType": "uint256"
27079
+ }
27080
+ ],
27081
+ "stateMutability": "view"
27082
+ },
27083
+ {
27084
+ "type": "function",
27085
+ "name": "ownerFees",
27086
+ "inputs": [],
27087
+ "outputs": [
27088
+ {
27089
+ "name": "",
27090
+ "type": "uint256",
27091
+ "internalType": "uint256"
27092
+ }
27093
+ ],
27094
+ "stateMutability": "view"
27095
+ },
27096
+ {
27097
+ "type": "function",
27098
+ "name": "ownerShare",
27099
+ "inputs": [],
27100
+ "outputs": [
27101
+ {
27102
+ "name": "",
27103
+ "type": "uint256",
27104
+ "internalType": "uint256"
27105
+ }
27106
+ ],
27107
+ "stateMutability": "view"
27108
+ },
27109
+ {
27110
+ "type": "function",
27111
+ "name": "pendingCreatorFees",
27112
+ "inputs": [
27113
+ {
27114
+ "name": "_recipient",
27115
+ "type": "address",
27116
+ "internalType": "address"
27117
+ }
27118
+ ],
27119
+ "outputs": [
27120
+ {
27121
+ "name": "balance_",
27122
+ "type": "uint256",
27123
+ "internalType": "uint256"
27124
+ }
27125
+ ],
27126
+ "stateMutability": "view"
27127
+ },
27128
+ {
27129
+ "type": "function",
27130
+ "name": "pendingOwnerFees",
27131
+ "inputs": [],
27132
+ "outputs": [
27133
+ {
27134
+ "name": "",
27135
+ "type": "uint256",
27136
+ "internalType": "uint256"
27137
+ }
27138
+ ],
27139
+ "stateMutability": "view"
27140
+ },
27141
+ {
27142
+ "type": "function",
27143
+ "name": "permissions",
27144
+ "inputs": [],
27145
+ "outputs": [
27146
+ {
27147
+ "name": "",
27148
+ "type": "address",
27149
+ "internalType": "contract IManagerPermissions"
27150
+ }
27151
+ ],
27152
+ "stateMutability": "view"
27153
+ },
27154
+ {
27155
+ "type": "function",
27156
+ "name": "recipientAt",
27157
+ "inputs": [
27158
+ {
27159
+ "name": "_index",
27160
+ "type": "uint256",
27161
+ "internalType": "uint256"
27162
+ }
27163
+ ],
27164
+ "outputs": [
27165
+ {
27166
+ "name": "",
27167
+ "type": "address",
27168
+ "internalType": "address"
27169
+ }
27170
+ ],
27171
+ "stateMutability": "view"
27172
+ },
27173
+ {
27174
+ "type": "function",
27175
+ "name": "recipientCount",
27176
+ "inputs": [],
27177
+ "outputs": [
27178
+ {
27179
+ "name": "",
27180
+ "type": "uint256",
27181
+ "internalType": "uint256"
27182
+ }
27183
+ ],
27184
+ "stateMutability": "view"
27185
+ },
27186
+ {
27187
+ "type": "function",
27188
+ "name": "recipientShare",
27189
+ "inputs": [
27190
+ {
27191
+ "name": "_recipient",
27192
+ "type": "address",
27193
+ "internalType": "address"
27194
+ },
27195
+ {
27196
+ "name": "",
27197
+ "type": "bytes",
27198
+ "internalType": "bytes"
27199
+ }
27200
+ ],
27201
+ "outputs": [
27202
+ {
27203
+ "name": "",
27204
+ "type": "uint256",
27205
+ "internalType": "uint256"
27206
+ }
27207
+ ],
27208
+ "stateMutability": "view"
27209
+ },
27210
+ {
27211
+ "type": "function",
27212
+ "name": "recipients",
27213
+ "inputs": [
27214
+ {
27215
+ "name": "_recipient",
27216
+ "type": "address",
27217
+ "internalType": "address"
27218
+ }
27219
+ ],
27220
+ "outputs": [
27221
+ {
27222
+ "name": "share",
27223
+ "type": "uint256",
27224
+ "internalType": "uint256"
27225
+ },
27226
+ {
27227
+ "name": "debtPerShare",
27228
+ "type": "uint256",
27229
+ "internalType": "uint256"
27230
+ },
27231
+ {
27232
+ "name": "snapshotBalance",
27233
+ "type": "uint256",
27234
+ "internalType": "uint256"
27235
+ },
27236
+ {
27237
+ "name": "claimed",
27238
+ "type": "uint256",
27239
+ "internalType": "uint256"
27240
+ }
27241
+ ],
27242
+ "stateMutability": "view"
27243
+ },
27244
+ {
27245
+ "type": "function",
27246
+ "name": "rescue",
27247
+ "inputs": [
27248
+ {
27249
+ "name": "_flaunchToken",
27250
+ "type": "tuple",
27251
+ "internalType": "struct ITreasuryManager.FlaunchToken",
27252
+ "components": [
27253
+ {
27254
+ "name": "flaunch",
27255
+ "type": "address",
27256
+ "internalType": "contract Flaunch"
27257
+ },
27258
+ {
27259
+ "name": "tokenId",
27260
+ "type": "uint256",
27261
+ "internalType": "uint256"
27262
+ }
27263
+ ]
27264
+ },
27265
+ {
27266
+ "name": "_recipient",
27267
+ "type": "address",
27268
+ "internalType": "address"
27269
+ }
27270
+ ],
27271
+ "outputs": [],
27272
+ "stateMutability": "nonpayable"
27273
+ },
27274
+ {
27275
+ "type": "function",
27276
+ "name": "setCreator",
27277
+ "inputs": [
27278
+ {
27279
+ "name": "_flaunchToken",
27280
+ "type": "tuple",
27281
+ "internalType": "struct ITreasuryManager.FlaunchToken",
27282
+ "components": [
27283
+ {
27284
+ "name": "flaunch",
27285
+ "type": "address",
27286
+ "internalType": "contract Flaunch"
27287
+ },
27288
+ {
27289
+ "name": "tokenId",
27290
+ "type": "uint256",
27291
+ "internalType": "uint256"
27292
+ }
27293
+ ]
27294
+ },
27295
+ {
27296
+ "name": "_creator",
27297
+ "type": "address",
27298
+ "internalType": "address payable"
27299
+ }
27300
+ ],
27301
+ "outputs": [],
27302
+ "stateMutability": "nonpayable"
27303
+ },
27304
+ {
27305
+ "type": "function",
27306
+ "name": "setModerator",
27307
+ "inputs": [
27308
+ {
27309
+ "name": "_moderator",
27310
+ "type": "address",
27311
+ "internalType": "address"
27312
+ }
27313
+ ],
27314
+ "outputs": [],
27315
+ "stateMutability": "nonpayable"
27316
+ },
27317
+ {
27318
+ "type": "function",
27319
+ "name": "setPermissions",
27320
+ "inputs": [
27321
+ {
27322
+ "name": "_permissions",
27323
+ "type": "address",
27324
+ "internalType": "address"
27325
+ }
27326
+ ],
27327
+ "outputs": [],
27328
+ "stateMutability": "nonpayable"
27329
+ },
27330
+ {
27331
+ "type": "function",
27332
+ "name": "splitFees",
27333
+ "inputs": [],
27334
+ "outputs": [
27335
+ {
27336
+ "name": "",
27337
+ "type": "uint256",
27338
+ "internalType": "uint256"
27339
+ }
27340
+ ],
27341
+ "stateMutability": "view"
27342
+ },
27343
+ {
27344
+ "type": "function",
27345
+ "name": "tokenPoolId",
27346
+ "inputs": [
27347
+ {
27348
+ "name": "_internalId",
27349
+ "type": "uint256",
27350
+ "internalType": "uint256"
27351
+ }
27352
+ ],
27353
+ "outputs": [
27354
+ {
27355
+ "name": "_poolId",
27356
+ "type": "bytes32",
27357
+ "internalType": "PoolId"
27358
+ }
27359
+ ],
27360
+ "stateMutability": "view"
27361
+ },
27362
+ {
27363
+ "type": "function",
27364
+ "name": "tokenTimelock",
27365
+ "inputs": [
27366
+ {
27367
+ "name": "_flaunch",
27368
+ "type": "address",
27369
+ "internalType": "address"
27370
+ },
27371
+ {
27372
+ "name": "_tokenId",
27373
+ "type": "uint256",
27374
+ "internalType": "uint256"
27375
+ }
27376
+ ],
27377
+ "outputs": [
27378
+ {
27379
+ "name": "_unlockedAt",
27380
+ "type": "uint256",
27381
+ "internalType": "uint256"
27382
+ }
27383
+ ],
27384
+ "stateMutability": "view"
27385
+ },
27386
+ {
27387
+ "type": "function",
27388
+ "name": "tokenTotalClaimed",
27389
+ "inputs": [
27390
+ {
27391
+ "name": "_flaunch",
27392
+ "type": "address",
27393
+ "internalType": "address"
27394
+ },
27395
+ {
27396
+ "name": "_tokenId",
27397
+ "type": "uint256",
27398
+ "internalType": "uint256"
27399
+ }
27400
+ ],
27401
+ "outputs": [
27402
+ {
27403
+ "name": "_claimed",
27404
+ "type": "uint256",
27405
+ "internalType": "uint256"
27406
+ }
27407
+ ],
27408
+ "stateMutability": "view"
27409
+ },
27410
+ {
27411
+ "type": "function",
27412
+ "name": "tokens",
27413
+ "inputs": [
27414
+ {
27415
+ "name": "_creator",
27416
+ "type": "address",
27417
+ "internalType": "address"
27418
+ }
27419
+ ],
27420
+ "outputs": [
27421
+ {
27422
+ "name": "flaunchTokens_",
27423
+ "type": "tuple[]",
27424
+ "internalType": "struct ITreasuryManager.FlaunchToken[]",
27425
+ "components": [
27426
+ {
27427
+ "name": "flaunch",
27428
+ "type": "address",
27429
+ "internalType": "contract Flaunch"
27430
+ },
27431
+ {
27432
+ "name": "tokenId",
27433
+ "type": "uint256",
27434
+ "internalType": "uint256"
27435
+ }
27436
+ ]
27437
+ }
27438
+ ],
27439
+ "stateMutability": "view"
27440
+ },
27441
+ {
27442
+ "type": "function",
27443
+ "name": "totalActiveShares",
27444
+ "inputs": [],
27445
+ "outputs": [
27446
+ {
27447
+ "name": "",
27448
+ "type": "uint256",
27449
+ "internalType": "uint256"
27450
+ }
27451
+ ],
27452
+ "stateMutability": "view"
27453
+ },
27454
+ {
27455
+ "type": "function",
27456
+ "name": "transferManagerOwnership",
27457
+ "inputs": [
27458
+ {
27459
+ "name": "_newManagerOwner",
27460
+ "type": "address",
27461
+ "internalType": "address"
27462
+ }
27463
+ ],
27464
+ "outputs": [],
27465
+ "stateMutability": "nonpayable"
27466
+ },
27467
+ {
27468
+ "type": "function",
27469
+ "name": "transferRecipientShare",
27470
+ "inputs": [
27471
+ {
27472
+ "name": "_newRecipient",
27473
+ "type": "address",
27474
+ "internalType": "address"
27475
+ }
27476
+ ],
27477
+ "outputs": [],
27478
+ "stateMutability": "nonpayable"
27479
+ },
27480
+ {
27481
+ "type": "function",
27482
+ "name": "treasuryManagerFactory",
27483
+ "inputs": [],
27484
+ "outputs": [
27485
+ {
27486
+ "name": "",
27487
+ "type": "address",
27488
+ "internalType": "contract TreasuryManagerFactory"
27489
+ }
27490
+ ],
27491
+ "stateMutability": "view"
27492
+ },
27493
+ {
27494
+ "type": "function",
27495
+ "name": "updateRecipients",
27496
+ "inputs": [
27497
+ {
27498
+ "name": "_recipients",
27499
+ "type": "tuple[]",
27500
+ "internalType": "struct DynamicAddressFeeSplitManager.RecipientShare[]",
27501
+ "components": [
27502
+ {
27503
+ "name": "recipient",
27504
+ "type": "address",
27505
+ "internalType": "address"
27506
+ },
27507
+ {
27508
+ "name": "share",
27509
+ "type": "uint256",
27510
+ "internalType": "uint256"
27511
+ }
27512
+ ]
27513
+ }
27514
+ ],
27515
+ "outputs": [],
27516
+ "stateMutability": "nonpayable"
27517
+ },
27518
+ {
27519
+ "type": "event",
27520
+ "name": "CreatorShareInitialized",
27521
+ "inputs": [
27522
+ {
27523
+ "name": "_creatorShare",
27524
+ "type": "uint256",
27525
+ "indexed": false,
27526
+ "internalType": "uint256"
27527
+ }
27528
+ ],
27529
+ "anonymous": false
27530
+ },
27531
+ {
27532
+ "type": "event",
27533
+ "name": "CreatorUpdated",
27534
+ "inputs": [
27535
+ {
27536
+ "name": "_flaunch",
27537
+ "type": "address",
27538
+ "indexed": true,
27539
+ "internalType": "address"
27540
+ },
27541
+ {
27542
+ "name": "_tokenId",
27543
+ "type": "uint256",
27544
+ "indexed": true,
27545
+ "internalType": "uint256"
27546
+ },
27547
+ {
27548
+ "name": "_creator",
27549
+ "type": "address",
27550
+ "indexed": false,
27551
+ "internalType": "address"
27552
+ }
27553
+ ],
27554
+ "anonymous": false
27555
+ },
27556
+ {
27557
+ "type": "event",
27558
+ "name": "ETHReceivedFromUnknownSource",
27559
+ "inputs": [
27560
+ {
27561
+ "name": "_sender",
27562
+ "type": "address",
27563
+ "indexed": true,
27564
+ "internalType": "address"
27565
+ },
27566
+ {
27567
+ "name": "_amount",
27568
+ "type": "uint256",
27569
+ "indexed": false,
27570
+ "internalType": "uint256"
27571
+ }
27572
+ ],
27573
+ "anonymous": false
27574
+ },
27575
+ {
27576
+ "type": "event",
27577
+ "name": "ManagerInitialized",
27578
+ "inputs": [
27579
+ {
27580
+ "name": "_owner",
27581
+ "type": "address",
27582
+ "indexed": false,
27583
+ "internalType": "address"
27584
+ },
27585
+ {
27586
+ "name": "_params",
27587
+ "type": "tuple",
27588
+ "indexed": false,
27589
+ "internalType": "struct DynamicAddressFeeSplitManager.InitializeParams",
27590
+ "components": [
27591
+ {
27592
+ "name": "creatorShare",
27593
+ "type": "uint256",
27594
+ "internalType": "uint256"
27595
+ },
27596
+ {
27597
+ "name": "ownerShare",
27598
+ "type": "uint256",
27599
+ "internalType": "uint256"
27600
+ },
27601
+ {
27602
+ "name": "moderator",
27603
+ "type": "address",
27604
+ "internalType": "address"
27605
+ },
27606
+ {
27607
+ "name": "recipientShares",
27608
+ "type": "tuple[]",
27609
+ "internalType": "struct DynamicAddressFeeSplitManager.RecipientShare[]",
27610
+ "components": [
27611
+ {
27612
+ "name": "recipient",
27613
+ "type": "address",
27614
+ "internalType": "address"
27615
+ },
27616
+ {
27617
+ "name": "share",
27618
+ "type": "uint256",
27619
+ "internalType": "uint256"
27620
+ }
27621
+ ]
27622
+ }
27623
+ ]
27624
+ }
27625
+ ],
27626
+ "anonymous": false
27627
+ },
27628
+ {
27629
+ "type": "event",
27630
+ "name": "ManagerOwnershipTransferred",
27631
+ "inputs": [
27632
+ {
27633
+ "name": "_previousOwner",
27634
+ "type": "address",
27635
+ "indexed": true,
27636
+ "internalType": "address"
27637
+ },
27638
+ {
27639
+ "name": "_newOwner",
27640
+ "type": "address",
27641
+ "indexed": true,
27642
+ "internalType": "address"
27643
+ }
27644
+ ],
27645
+ "anonymous": false
27646
+ },
27647
+ {
27648
+ "type": "event",
27649
+ "name": "ModeratorUpdated",
27650
+ "inputs": [
27651
+ {
27652
+ "name": "_oldModerator",
27653
+ "type": "address",
27654
+ "indexed": true,
27655
+ "internalType": "address"
27656
+ },
27657
+ {
27658
+ "name": "_newModerator",
27659
+ "type": "address",
27660
+ "indexed": true,
27661
+ "internalType": "address"
27662
+ }
27663
+ ],
27664
+ "anonymous": false
27665
+ },
27666
+ {
27667
+ "type": "event",
27668
+ "name": "OwnerShareInitialized",
27669
+ "inputs": [
27670
+ {
27671
+ "name": "_ownerShare",
27672
+ "type": "uint256",
27673
+ "indexed": false,
27674
+ "internalType": "uint256"
27675
+ }
27676
+ ],
27677
+ "anonymous": false
27678
+ },
27679
+ {
27680
+ "type": "event",
27681
+ "name": "PermissionsUpdated",
27682
+ "inputs": [
27683
+ {
27684
+ "name": "_permissions",
27685
+ "type": "address",
27686
+ "indexed": false,
27687
+ "internalType": "address"
27688
+ }
27689
+ ],
27690
+ "anonymous": false
27691
+ },
27692
+ {
27693
+ "type": "event",
27694
+ "name": "RecipientAdded",
27695
+ "inputs": [
27696
+ {
27697
+ "name": "_recipient",
27698
+ "type": "address",
27699
+ "indexed": true,
27700
+ "internalType": "address"
27701
+ },
27702
+ {
27703
+ "name": "_share",
27704
+ "type": "uint256",
27705
+ "indexed": false,
27706
+ "internalType": "uint256"
27707
+ }
27708
+ ],
27709
+ "anonymous": false
27710
+ },
27711
+ {
27712
+ "type": "event",
27713
+ "name": "RecipientRemoved",
27714
+ "inputs": [
27715
+ {
27716
+ "name": "_recipient",
27717
+ "type": "address",
27718
+ "indexed": true,
27719
+ "internalType": "address"
27720
+ },
27721
+ {
27722
+ "name": "_snapshotBalance",
27723
+ "type": "uint256",
27724
+ "indexed": false,
27725
+ "internalType": "uint256"
27726
+ }
27727
+ ],
27728
+ "anonymous": false
27729
+ },
27730
+ {
27731
+ "type": "event",
27732
+ "name": "RecipientShareTransferred",
27733
+ "inputs": [
27734
+ {
27735
+ "name": "_oldRecipient",
27736
+ "type": "address",
27737
+ "indexed": true,
27738
+ "internalType": "address"
27739
+ },
27740
+ {
27741
+ "name": "_newRecipient",
27742
+ "type": "address",
27743
+ "indexed": true,
27744
+ "internalType": "address"
27745
+ },
27746
+ {
27747
+ "name": "_share",
27748
+ "type": "uint256",
27749
+ "indexed": false,
27750
+ "internalType": "uint256"
27751
+ }
27752
+ ],
27753
+ "anonymous": false
27754
+ },
27755
+ {
27756
+ "type": "event",
27757
+ "name": "RecipientShareUpdated",
27758
+ "inputs": [
27759
+ {
27760
+ "name": "_recipient",
27761
+ "type": "address",
27762
+ "indexed": true,
27763
+ "internalType": "address"
27764
+ },
27765
+ {
27766
+ "name": "_oldShare",
27767
+ "type": "uint256",
27768
+ "indexed": false,
27769
+ "internalType": "uint256"
27770
+ },
27771
+ {
27772
+ "name": "_newShare",
27773
+ "type": "uint256",
27774
+ "indexed": false,
27775
+ "internalType": "uint256"
27776
+ }
27777
+ ],
27778
+ "anonymous": false
27779
+ },
27780
+ {
27781
+ "type": "event",
27782
+ "name": "RevenueClaimed",
27783
+ "inputs": [
27784
+ {
27785
+ "name": "_recipient",
27786
+ "type": "address",
27787
+ "indexed": true,
27788
+ "internalType": "address"
27789
+ },
27790
+ {
27791
+ "name": "_amountClaimed",
27792
+ "type": "uint256",
27793
+ "indexed": false,
27794
+ "internalType": "uint256"
27795
+ }
27796
+ ],
27797
+ "anonymous": false
27798
+ },
27799
+ {
27800
+ "type": "event",
27801
+ "name": "RoundingDustAllocated",
27802
+ "inputs": [
27803
+ {
27804
+ "name": "_recipient",
27805
+ "type": "address",
27806
+ "indexed": true,
27807
+ "internalType": "address"
27808
+ },
27809
+ {
27810
+ "name": "_amount",
27811
+ "type": "uint256",
27812
+ "indexed": false,
27813
+ "internalType": "uint256"
27814
+ }
27815
+ ],
27816
+ "anonymous": false
27817
+ },
27818
+ {
27819
+ "type": "event",
27820
+ "name": "TreasuryEscrowed",
27821
+ "inputs": [
27822
+ {
27823
+ "name": "_flaunch",
27824
+ "type": "address",
27825
+ "indexed": true,
27826
+ "internalType": "address"
27827
+ },
27828
+ {
27829
+ "name": "_tokenId",
27830
+ "type": "uint256",
27831
+ "indexed": true,
27832
+ "internalType": "uint256"
27833
+ },
27834
+ {
27835
+ "name": "_owner",
27836
+ "type": "address",
27837
+ "indexed": false,
27838
+ "internalType": "address"
27839
+ },
27840
+ {
27841
+ "name": "_sender",
27842
+ "type": "address",
27843
+ "indexed": false,
27844
+ "internalType": "address"
27845
+ }
27846
+ ],
27847
+ "anonymous": false
27848
+ },
27849
+ {
27850
+ "type": "event",
27851
+ "name": "TreasuryReclaimed",
27852
+ "inputs": [
27853
+ {
27854
+ "name": "_flaunch",
27855
+ "type": "address",
27856
+ "indexed": true,
27857
+ "internalType": "address"
27858
+ },
27859
+ {
27860
+ "name": "_tokenId",
27861
+ "type": "uint256",
27862
+ "indexed": true,
27863
+ "internalType": "uint256"
27864
+ },
27865
+ {
27866
+ "name": "_sender",
27867
+ "type": "address",
27868
+ "indexed": false,
27869
+ "internalType": "address"
27870
+ },
27871
+ {
27872
+ "name": "_recipient",
27873
+ "type": "address",
27874
+ "indexed": false,
27875
+ "internalType": "address"
27876
+ }
27877
+ ],
27878
+ "anonymous": false
27879
+ },
27880
+ {
27881
+ "type": "event",
27882
+ "name": "TreasuryTimelocked",
27883
+ "inputs": [
27884
+ {
27885
+ "name": "_flaunch",
27886
+ "type": "address",
27887
+ "indexed": true,
27888
+ "internalType": "address"
27889
+ },
27890
+ {
27891
+ "name": "_tokenId",
27892
+ "type": "uint256",
27893
+ "indexed": true,
27894
+ "internalType": "uint256"
27895
+ },
27896
+ {
27897
+ "name": "_unlockedAt",
27898
+ "type": "uint256",
27899
+ "indexed": false,
27900
+ "internalType": "uint256"
27901
+ }
27902
+ ],
27903
+ "anonymous": false
27904
+ },
27905
+ {
27906
+ "type": "error",
27907
+ "name": "AlreadyDeposited",
27908
+ "inputs": []
27909
+ },
27910
+ {
27911
+ "type": "error",
27912
+ "name": "AlreadyInitialized",
27913
+ "inputs": []
27914
+ },
27915
+ {
27916
+ "type": "error",
27917
+ "name": "CreatorShareAlreadyInitialized",
27918
+ "inputs": []
27919
+ },
27920
+ {
27921
+ "type": "error",
27922
+ "name": "FlaunchContractNotValid",
27923
+ "inputs": []
27924
+ },
27925
+ {
27926
+ "type": "error",
27927
+ "name": "InsufficientSharesToTransfer",
27928
+ "inputs": []
27929
+ },
27930
+ {
27931
+ "type": "error",
27932
+ "name": "InvalidClaimer",
27933
+ "inputs": []
27934
+ },
27935
+ {
27936
+ "type": "error",
27937
+ "name": "InvalidCreator",
27938
+ "inputs": []
27939
+ },
27940
+ {
27941
+ "type": "error",
27942
+ "name": "InvalidCreatorAddress",
27943
+ "inputs": []
27944
+ },
27945
+ {
27946
+ "type": "error",
27947
+ "name": "InvalidCreatorShare",
27948
+ "inputs": []
27949
+ },
27950
+ {
27951
+ "type": "error",
27952
+ "name": "InvalidOwnerShare",
27953
+ "inputs": []
27954
+ },
27955
+ {
27956
+ "type": "error",
27957
+ "name": "InvalidRecipient",
27958
+ "inputs": []
27959
+ },
27960
+ {
27961
+ "type": "error",
27962
+ "name": "InvalidRecipientShareTotal",
27963
+ "inputs": [
27964
+ {
27965
+ "name": "_share",
27966
+ "type": "uint256",
27967
+ "internalType": "uint256"
27968
+ },
27969
+ {
27970
+ "name": "_validShare",
27971
+ "type": "uint256",
27972
+ "internalType": "uint256"
27973
+ }
27974
+ ]
27975
+ },
27976
+ {
27977
+ "type": "error",
27978
+ "name": "InvalidShareAmount",
27979
+ "inputs": []
27980
+ },
27981
+ {
27982
+ "type": "error",
27983
+ "name": "InvalidShareTotal",
27984
+ "inputs": []
27985
+ },
27986
+ {
27987
+ "type": "error",
27988
+ "name": "InvalidShareTransferRecipient",
27989
+ "inputs": []
27990
+ },
27991
+ {
27992
+ "type": "error",
27993
+ "name": "NotInitialized",
27994
+ "inputs": []
27995
+ },
27996
+ {
27997
+ "type": "error",
27998
+ "name": "NotManagerOwner",
27999
+ "inputs": []
28000
+ },
28001
+ {
28002
+ "type": "error",
28003
+ "name": "NotOwnerOrModerator",
28004
+ "inputs": []
28005
+ },
28006
+ {
28007
+ "type": "error",
28008
+ "name": "OwnerShareAlreadyInitialized",
28009
+ "inputs": []
28010
+ },
28011
+ {
28012
+ "type": "error",
28013
+ "name": "RecipientAlreadyActive",
28014
+ "inputs": []
28015
+ },
28016
+ {
28017
+ "type": "error",
28018
+ "name": "RecipientNotActive",
28019
+ "inputs": []
28020
+ },
28021
+ {
28022
+ "type": "error",
28023
+ "name": "Reentrancy",
28024
+ "inputs": []
28025
+ },
28026
+ {
28027
+ "type": "error",
28028
+ "name": "TokenTimelocked",
28029
+ "inputs": [
28030
+ {
28031
+ "name": "_unlockedAt",
28032
+ "type": "uint256",
28033
+ "internalType": "uint256"
28034
+ }
28035
+ ]
28036
+ },
28037
+ {
28038
+ "type": "error",
28039
+ "name": "UnableToSendRevenue",
28040
+ "inputs": [
28041
+ {
28042
+ "name": "_reason",
28043
+ "type": "bytes",
28044
+ "internalType": "bytes"
28045
+ }
28046
+ ]
28047
+ },
28048
+ {
28049
+ "type": "error",
28050
+ "name": "UnknownFlaunchToken",
28051
+ "inputs": []
28052
+ },
28053
+ {
28054
+ "type": "error",
28055
+ "name": "UnknownPoolId",
28056
+ "inputs": []
28057
+ }
28058
+ ];
28059
+
28060
+ const FastFlaunchZapAbi = [
28061
+ {
28062
+ inputs: [
28063
+ {
28064
+ internalType: "contract PositionManager",
28065
+ name: "_positionManager",
28066
+ type: "address",
28067
+ },
28068
+ ],
28069
+ stateMutability: "nonpayable",
28070
+ type: "constructor",
28071
+ },
28072
+ {
28073
+ inputs: [],
28074
+ name: "CREATOR_FEE_ALLOCATION",
28075
+ outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
28076
+ stateMutability: "view",
28077
+ type: "function",
28078
+ },
28079
+ {
28080
+ inputs: [],
28081
+ name: "FAIR_LAUNCH_SUPPLY",
28082
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
28083
+ stateMutability: "view",
28084
+ type: "function",
28085
+ },
28086
+ {
28087
+ inputs: [],
28088
+ name: "USDC_MARKET_CAP",
28089
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
28090
+ stateMutability: "view",
28091
+ type: "function",
28092
+ },
28093
+ {
28094
+ inputs: [
28095
+ {
28096
+ components: [
28097
+ { internalType: "string", name: "name", type: "string" },
28098
+ { internalType: "string", name: "symbol", type: "string" },
28099
+ { internalType: "string", name: "tokenUri", type: "string" },
28100
+ { internalType: "address", name: "creator", type: "address" },
28101
+ ],
28102
+ internalType: "struct FastFlaunchZap.FastFlaunchParams",
28103
+ name: "_params",
28104
+ type: "tuple",
28105
+ },
28106
+ ],
28107
+ name: "flaunch",
28108
+ outputs: [{ internalType: "address", name: "memecoin_", type: "address" }],
28109
+ stateMutability: "nonpayable",
28110
+ type: "function",
28111
+ },
28112
+ {
28113
+ inputs: [],
28114
+ name: "positionManager",
28115
+ outputs: [
28116
+ { internalType: "contract PositionManager", name: "", type: "address" },
28117
+ ],
28118
+ stateMutability: "view",
28119
+ type: "function",
28120
+ },
28121
+ ];
28122
+
28123
+ const FLETHAbi = [
28124
+ {
28125
+ inputs: [{ internalType: "uint256", name: "wethAmount", type: "uint256" }],
28126
+ name: "deposit",
28127
+ outputs: [],
28128
+ stateMutability: "payable",
28129
+ type: "function",
28130
+ },
28131
+ {
28132
+ inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
28133
+ name: "withdraw",
28134
+ outputs: [],
28135
+ stateMutability: "nonpayable",
28136
+ type: "function",
28137
+ },
28138
+ {
28139
+ inputs: [{ internalType: "address", name: "account", type: "address" }],
28140
+ name: "balanceOf",
28141
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
28142
+ stateMutability: "view",
28143
+ type: "function",
28144
+ },
28145
+ {
28146
+ inputs: [],
28147
+ name: "totalSupply",
28148
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
28149
+ stateMutability: "view",
28150
+ type: "function",
28151
+ },
28152
+ {
28153
+ inputs: [],
28154
+ name: "name",
28155
+ outputs: [{ internalType: "string", name: "", type: "string" }],
28156
+ stateMutability: "view",
28157
+ type: "function",
28158
+ },
28159
+ {
28160
+ inputs: [],
28161
+ name: "symbol",
28162
+ outputs: [{ internalType: "string", name: "", type: "string" }],
28163
+ stateMutability: "view",
28164
+ type: "function",
28165
+ },
28166
+ {
28167
+ inputs: [],
28168
+ name: "decimals",
28169
+ outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
28170
+ stateMutability: "view",
28171
+ type: "function",
28172
+ },
28173
+ ];
28174
+
28175
+ const TrustedSignerFeeCalculatorAbi = [
28176
+ {
28177
+ inputs: [
28178
+ { internalType: "address", name: "_nativeToken", type: "address" },
28179
+ { internalType: "address", name: "_positionManager", type: "address" },
28180
+ ],
28181
+ stateMutability: "nonpayable",
28182
+ type: "constructor",
28183
+ },
28184
+ { inputs: [], name: "AlreadyInitialized", type: "error" },
28185
+ { inputs: [], name: "CallerNotPositionManager", type: "error" },
28186
+ {
28187
+ inputs: [{ internalType: "uint256", name: "_deadline", type: "uint256" }],
28188
+ name: "DeadlineExpired",
28189
+ type: "error",
28190
+ },
28191
+ { inputs: [], name: "InvalidPoolKey", type: "error" },
28192
+ {
28193
+ inputs: [
28194
+ { internalType: "address", name: "_invalidSigner", type: "address" },
28195
+ ],
28196
+ name: "InvalidSigner",
28197
+ type: "error",
28198
+ },
28199
+ { inputs: [], name: "NewOwnerIsZeroAddress", type: "error" },
28200
+ { inputs: [], name: "NoHandoverRequest", type: "error" },
28201
+ { inputs: [], name: "Reentrancy", type: "error" },
28202
+ { inputs: [], name: "SignatureAlreadyUsed", type: "error" },
28203
+ {
28204
+ inputs: [{ internalType: "address", name: "_signer", type: "address" }],
28205
+ name: "SignerAlreadyAdded",
28206
+ type: "error",
28207
+ },
28208
+ {
28209
+ inputs: [{ internalType: "address", name: "_signer", type: "address" }],
28210
+ name: "SignerDoesNotExist",
28211
+ type: "error",
28212
+ },
28213
+ {
28214
+ inputs: [
28215
+ { internalType: "uint256", name: "_requestedAmount", type: "uint256" },
28216
+ { internalType: "uint256", name: "_maxTokensOut", type: "uint256" },
28217
+ ],
28218
+ name: "TransactionCapExceeded",
28219
+ type: "error",
28220
+ },
28221
+ { inputs: [], name: "Unauthorized", type: "error" },
28222
+ {
28223
+ anonymous: false,
28224
+ inputs: [
28225
+ {
28226
+ indexed: true,
28227
+ internalType: "address",
28228
+ name: "pendingOwner",
28229
+ type: "address",
28230
+ },
28231
+ ],
28232
+ name: "OwnershipHandoverCanceled",
28233
+ type: "event",
28234
+ },
28235
+ {
28236
+ anonymous: false,
28237
+ inputs: [
28238
+ {
28239
+ indexed: true,
28240
+ internalType: "address",
28241
+ name: "pendingOwner",
28242
+ type: "address",
28243
+ },
28244
+ ],
28245
+ name: "OwnershipHandoverRequested",
28246
+ type: "event",
28247
+ },
28248
+ {
28249
+ anonymous: false,
28250
+ inputs: [
28251
+ {
28252
+ indexed: true,
28253
+ internalType: "address",
28254
+ name: "oldOwner",
28255
+ type: "address",
28256
+ },
28257
+ {
28258
+ indexed: true,
28259
+ internalType: "address",
28260
+ name: "newOwner",
28261
+ type: "address",
28262
+ },
28263
+ ],
28264
+ name: "OwnershipTransferred",
28265
+ type: "event",
28266
+ },
28267
+ {
28268
+ anonymous: false,
28269
+ inputs: [
28270
+ {
28271
+ indexed: false,
28272
+ internalType: "PoolId",
28273
+ name: "_poolId",
28274
+ type: "bytes32",
28275
+ },
28276
+ {
28277
+ components: [
28278
+ { internalType: "bool", name: "enabled", type: "bool" },
28279
+ { internalType: "uint256", name: "walletCap", type: "uint256" },
28280
+ { internalType: "uint256", name: "txCap", type: "uint256" },
28281
+ ],
28282
+ indexed: false,
28283
+ internalType: "struct TrustedSignerFeeCalculator.FairLaunchSettings",
28284
+ name: "_settings",
28285
+ type: "tuple",
28286
+ },
28287
+ ],
28288
+ name: "PoolKeyFairLaunchSettingsUpdated",
28289
+ type: "event",
28290
+ },
28291
+ {
28292
+ anonymous: false,
28293
+ inputs: [
28294
+ {
28295
+ indexed: false,
28296
+ internalType: "PoolId",
28297
+ name: "_poolId",
28298
+ type: "bytes32",
28299
+ },
28300
+ {
28301
+ indexed: true,
28302
+ internalType: "address",
28303
+ name: "_signer",
28304
+ type: "address",
28305
+ },
28306
+ ],
28307
+ name: "PoolKeySignerUpdated",
28308
+ type: "event",
28309
+ },
28310
+ {
28311
+ anonymous: false,
28312
+ inputs: [
28313
+ {
28314
+ indexed: true,
28315
+ internalType: "address",
28316
+ name: "_signer",
28317
+ type: "address",
28318
+ },
28319
+ {
28320
+ indexed: false,
28321
+ internalType: "bool",
28322
+ name: "_isTrusted",
28323
+ type: "bool",
28324
+ },
28325
+ ],
28326
+ name: "TrustedSignerUpdated",
28327
+ type: "event",
28328
+ },
28329
+ {
28330
+ inputs: [{ internalType: "address", name: "_signer", type: "address" }],
28331
+ name: "addTrustedSigner",
26584
28332
  outputs: [],
26585
28333
  stateMutability: "nonpayable",
26586
28334
  type: "function",
@@ -28291,6 +30039,22 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
28291
30039
  flaunchIPFSWithSplitManager(params) {
28292
30040
  return this.readWriteFlaunchZap.flaunchIPFSWithSplitManager(params);
28293
30041
  }
30042
+ /**
30043
+ * Creates a new Flaunch with dynamic split manager configuration.
30044
+ * @param params - Parameters for creating the Flaunch with dynamic split manager
30045
+ * @returns Transaction response
30046
+ */
30047
+ flaunchWithDynamicSplitManager(params) {
30048
+ return this.readWriteFlaunchZap.flaunchWithDynamicSplitManager(params);
30049
+ }
30050
+ /**
30051
+ * Creates a new Flaunch with dynamic split manager configuration and IPFS metadata.
30052
+ * @param params - Parameters for creating the Flaunch with dynamic split manager and IPFS data
30053
+ * @returns Transaction response
30054
+ */
30055
+ flaunchIPFSWithDynamicSplitManager(params) {
30056
+ return this.readWriteFlaunchZap.flaunchIPFSWithDynamicSplitManager(params);
30057
+ }
28294
30058
  /**
28295
30059
  * Creates a new Flaunch with AnyPositionManager for external coins
28296
30060
  * @param params - Parameters for creating the Flaunch with AnyPositionManager
@@ -29271,6 +31035,148 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
29271
31035
  }
29272
31036
  }
29273
31037
 
31038
+ class ReadDynamicAddressFeeSplitManager {
31039
+ constructor(address, drift$1 = drift.createDrift()) {
31040
+ if (!address) {
31041
+ throw new Error("Address is required");
31042
+ }
31043
+ this.contract = drift$1.contract({
31044
+ abi: DynamicAddressFeeSplitManagerAbi,
31045
+ address,
31046
+ });
31047
+ }
31048
+ permissions() {
31049
+ return this.contract.read("permissions");
31050
+ }
31051
+ managerOwner() {
31052
+ return this.contract.read("managerOwner");
31053
+ }
31054
+ moderator() {
31055
+ return this.contract.read("moderator");
31056
+ }
31057
+ creatorShare() {
31058
+ return this.contract.read("creatorShare");
31059
+ }
31060
+ ownerShare() {
31061
+ return this.contract.read("ownerShare");
31062
+ }
31063
+ totalActiveShares() {
31064
+ return this.contract.read("totalActiveShares");
31065
+ }
31066
+ accumulatorPerShare() {
31067
+ return this.contract.read("accumulatorPerShare");
31068
+ }
31069
+ lastProcessedManagerFees() {
31070
+ return this.contract.read("lastProcessedManagerFees");
31071
+ }
31072
+ recipientCount() {
31073
+ return this.contract.read("recipientCount");
31074
+ }
31075
+ recipientAt(index) {
31076
+ return this.contract.read("recipientAt", {
31077
+ _index: index,
31078
+ });
31079
+ }
31080
+ recipients(recipient) {
31081
+ return this.contract.read("recipients", {
31082
+ _recipient: recipient,
31083
+ });
31084
+ }
31085
+ balances(recipient) {
31086
+ return this.contract.read("balances", {
31087
+ _recipient: recipient,
31088
+ });
31089
+ }
31090
+ recipientShare(recipient, data = "0x") {
31091
+ return this.contract.read("recipientShare", {
31092
+ _recipient: recipient,
31093
+ 1: data,
31094
+ });
31095
+ }
31096
+ pendingCreatorFees(recipient) {
31097
+ return this.contract.read("pendingCreatorFees", {
31098
+ _recipient: recipient,
31099
+ });
31100
+ }
31101
+ pendingOwnerFees() {
31102
+ return this.contract.read("pendingOwnerFees");
31103
+ }
31104
+ claimableOwnerFees() {
31105
+ return this.contract.read("claimableOwnerFees");
31106
+ }
31107
+ async allRecipients(includeInactive = false) {
31108
+ const count = await this.recipientCount();
31109
+ const recipients = await Promise.all(Array.from({ length: Number(count) }, (_, i) => this.recipientAt(BigInt(i))));
31110
+ if (includeInactive) {
31111
+ return recipients;
31112
+ }
31113
+ const recipientData = await Promise.all(recipients.map(async (recipient) => ({
31114
+ recipient,
31115
+ data: await this.recipients(recipient),
31116
+ })));
31117
+ return recipientData
31118
+ .filter(({ data }) => data.share > 0n)
31119
+ .map(({ recipient }) => recipient);
31120
+ }
31121
+ }
31122
+ class ReadWriteDynamicAddressFeeSplitManager extends ReadDynamicAddressFeeSplitManager {
31123
+ constructor(address, drift$1 = drift.createDrift()) {
31124
+ super(address, drift$1);
31125
+ }
31126
+ setPermissions(permissions) {
31127
+ return this.contract.write("setPermissions", {
31128
+ _permissions: permissions,
31129
+ });
31130
+ }
31131
+ transferManagerOwnership(newManagerOwner) {
31132
+ return this.contract.write("transferManagerOwnership", {
31133
+ _newManagerOwner: newManagerOwner,
31134
+ });
31135
+ }
31136
+ setModerator(moderator) {
31137
+ return this.contract.write("setModerator", {
31138
+ _moderator: moderator,
31139
+ });
31140
+ }
31141
+ updateRecipients(recipients) {
31142
+ return this.contract.write("updateRecipients", {
31143
+ _recipients: recipients,
31144
+ });
31145
+ }
31146
+ transferRecipientShare(newRecipient) {
31147
+ return this.contract.write("transferRecipientShare", {
31148
+ _newRecipient: newRecipient,
31149
+ });
31150
+ }
31151
+ claim() {
31152
+ return this.contract.write("claim", {});
31153
+ }
31154
+ claimForData(data) {
31155
+ return this.contract.write("claim", {
31156
+ _data: data,
31157
+ });
31158
+ }
31159
+ deposit(flaunchToken, creator, data) {
31160
+ return this.contract.write("deposit", {
31161
+ _flaunchToken: flaunchToken,
31162
+ _creator: creator,
31163
+ _data: data,
31164
+ });
31165
+ }
31166
+ setCreator(flaunchToken, creator) {
31167
+ return this.contract.write("setCreator", {
31168
+ _flaunchToken: flaunchToken,
31169
+ _creator: creator,
31170
+ });
31171
+ }
31172
+ rescue(flaunchToken, recipient) {
31173
+ return this.contract.write("rescue", {
31174
+ _flaunchToken: flaunchToken,
31175
+ _recipient: recipient,
31176
+ });
31177
+ }
31178
+ }
31179
+
29274
31180
  /**
29275
31181
  * Creates a Drift instance with the provided clients
29276
31182
  * @param params - Parameters for creating the Drift instance
@@ -29441,103 +31347,6 @@ async function parseCall(sdkMethod) {
29441
31347
  return decodeCallData(encodedCall);
29442
31348
  }
29443
31349
 
29444
- /**
29445
- * HMAC: RFC2104 message authentication code.
29446
- * @module
29447
- */
29448
- class HMAC extends Hash {
29449
- constructor(hash, _key) {
29450
- super();
29451
- this.finished = false;
29452
- this.destroyed = false;
29453
- ahash(hash);
29454
- const key = toBytes(_key);
29455
- this.iHash = hash.create();
29456
- if (typeof this.iHash.update !== 'function')
29457
- throw new Error('Expected instance of class which extends utils.Hash');
29458
- this.blockLen = this.iHash.blockLen;
29459
- this.outputLen = this.iHash.outputLen;
29460
- const blockLen = this.blockLen;
29461
- const pad = new Uint8Array(blockLen);
29462
- // blockLen can be bigger than outputLen
29463
- pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
29464
- for (let i = 0; i < pad.length; i++)
29465
- pad[i] ^= 0x36;
29466
- this.iHash.update(pad);
29467
- // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
29468
- this.oHash = hash.create();
29469
- // Undo internal XOR && apply outer XOR
29470
- for (let i = 0; i < pad.length; i++)
29471
- pad[i] ^= 0x36 ^ 0x5c;
29472
- this.oHash.update(pad);
29473
- pad.fill(0);
29474
- }
29475
- update(buf) {
29476
- aexists(this);
29477
- this.iHash.update(buf);
29478
- return this;
29479
- }
29480
- digestInto(out) {
29481
- aexists(this);
29482
- abytes$2(out, this.outputLen);
29483
- this.finished = true;
29484
- this.iHash.digestInto(out);
29485
- this.oHash.update(out);
29486
- this.oHash.digestInto(out);
29487
- this.destroy();
29488
- }
29489
- digest() {
29490
- const out = new Uint8Array(this.oHash.outputLen);
29491
- this.digestInto(out);
29492
- return out;
29493
- }
29494
- _cloneInto(to) {
29495
- // Create new instance without calling constructor since key already in state and we don't know it.
29496
- to || (to = Object.create(Object.getPrototypeOf(this), {}));
29497
- const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
29498
- to = to;
29499
- to.finished = finished;
29500
- to.destroyed = destroyed;
29501
- to.blockLen = blockLen;
29502
- to.outputLen = outputLen;
29503
- to.oHash = oHash._cloneInto(to.oHash);
29504
- to.iHash = iHash._cloneInto(to.iHash);
29505
- return to;
29506
- }
29507
- destroy() {
29508
- this.destroyed = true;
29509
- this.oHash.destroy();
29510
- this.iHash.destroy();
29511
- }
29512
- }
29513
- /**
29514
- * HMAC: RFC2104 message authentication code.
29515
- * @param hash - function that would be used e.g. sha256
29516
- * @param key - message key
29517
- * @param message - message data
29518
- * @example
29519
- * import { hmac } from '@noble/hashes/hmac';
29520
- * import { sha256 } from '@noble/hashes/sha2';
29521
- * const mac1 = hmac(sha256, 'key', 'message');
29522
- */
29523
- const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
29524
- hmac.create = (hash, key) => new HMAC(hash, key);
29525
-
29526
- /**
29527
- * RIPEMD-160 legacy hash function.
29528
- * https://homes.esat.kuleuven.be/~bosselae/ripemd160.html
29529
- * https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf
29530
- * @module
29531
- */
29532
- const Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
29533
- const Id = /* @__PURE__ */ new Uint8Array(new Array(16).fill(0).map((_, i) => i));
29534
- const Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);
29535
- let idxL = [Id];
29536
- let idxR = [Pi];
29537
- for (let i = 0; i < 4; i++)
29538
- for (let j of [idxL, idxR])
29539
- j.push(j[i].map((k) => Rho[k]));
29540
-
29541
31350
  /**
29542
31351
  * Hex, bytes and number utilities.
29543
31352
  * @module
@@ -29547,7 +31356,7 @@ for (let i = 0; i < 4; i++)
29547
31356
  // This is OK: `abstract` directory does not use noble-hashes.
29548
31357
  // User may opt-in into using different hashing library. This way, noble-hashes
29549
31358
  // won't be included into their bundle.
29550
- const _0n$3 = /* @__PURE__ */ BigInt(0);
31359
+ const _0n$4 = /* @__PURE__ */ BigInt(0);
29551
31360
  const _1n$4 = /* @__PURE__ */ BigInt(1);
29552
31361
  function isBytes$1(a) {
29553
31362
  return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
@@ -29560,6 +31369,7 @@ function abool(title, value) {
29560
31369
  if (typeof value !== 'boolean')
29561
31370
  throw new Error(title + ' boolean expected, got ' + value);
29562
31371
  }
31372
+ // Used in weierstrass, der
29563
31373
  function numberToHexUnpadded(num) {
29564
31374
  const hex = num.toString(16);
29565
31375
  return hex.length & 1 ? '0' + hex : hex;
@@ -29567,7 +31377,7 @@ function numberToHexUnpadded(num) {
29567
31377
  function hexToNumber(hex) {
29568
31378
  if (typeof hex !== 'string')
29569
31379
  throw new Error('hex string expected, got ' + typeof hex);
29570
- return hex === '' ? _0n$3 : BigInt('0x' + hex); // Big Endian
31380
+ return hex === '' ? _0n$4 : BigInt('0x' + hex); // Big Endian
29571
31381
  }
29572
31382
  // Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
29573
31383
  const hasHexBuiltin$1 =
@@ -29693,7 +31503,7 @@ function concatBytes(...arrays) {
29693
31503
  return res;
29694
31504
  }
29695
31505
  // Is positive bigint
29696
- const isPosBig = (n) => typeof n === 'bigint' && _0n$3 <= n;
31506
+ const isPosBig = (n) => typeof n === 'bigint' && _0n$4 <= n;
29697
31507
  function inRange(n, min, max) {
29698
31508
  return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
29699
31509
  }
@@ -29715,10 +31525,11 @@ function aInRange(title, n, min, max) {
29715
31525
  /**
29716
31526
  * Calculates amount of bits in a bigint.
29717
31527
  * Same as `n.toString(2).length`
31528
+ * TODO: merge with nLength in modular
29718
31529
  */
29719
31530
  function bitLen(n) {
29720
31531
  let len;
29721
- for (len = 0; n > _0n$3; n >>= _1n$4, len += 1)
31532
+ for (len = 0; n > _0n$4; n >>= _1n$4, len += 1)
29722
31533
  ;
29723
31534
  return len;
29724
31535
  }
@@ -29842,41 +31653,18 @@ function memoized(fn) {
29842
31653
  * @module
29843
31654
  */
29844
31655
  // prettier-ignore
29845
- const _0n$2 = BigInt(0), _1n$3 = BigInt(1), _2n$1 = /* @__PURE__ */ BigInt(2), _3n$1 = /* @__PURE__ */ BigInt(3);
31656
+ const _0n$3 = BigInt(0), _1n$3 = BigInt(1), _2n$1 = /* @__PURE__ */ BigInt(2), _3n$1 = /* @__PURE__ */ BigInt(3);
29846
31657
  // prettier-ignore
29847
- const _4n = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5), _8n = /* @__PURE__ */ BigInt(8);
31658
+ const _4n$1 = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5), _8n = /* @__PURE__ */ BigInt(8);
29848
31659
  // Calculates a modulo b
29849
31660
  function mod(a, b) {
29850
31661
  const result = a % b;
29851
- return result >= _0n$2 ? result : b + result;
29852
- }
29853
- /**
29854
- * Efficiently raise num to power and do modular division.
29855
- * Unsafe in some contexts: uses ladder, so can expose bigint bits.
29856
- * @todo use field version && remove
29857
- * @example
29858
- * pow(2n, 6n, 11n) // 64n % 11n == 9n
29859
- */
29860
- function pow(num, power, modulo) {
29861
- if (power < _0n$2)
29862
- throw new Error('invalid exponent, negatives unsupported');
29863
- if (modulo <= _0n$2)
29864
- throw new Error('invalid modulus');
29865
- if (modulo === _1n$3)
29866
- return _0n$2;
29867
- let res = _1n$3;
29868
- while (power > _0n$2) {
29869
- if (power & _1n$3)
29870
- res = (res * num) % modulo;
29871
- num = (num * num) % modulo;
29872
- power >>= _1n$3;
29873
- }
29874
- return res;
31662
+ return result >= _0n$3 ? result : b + result;
29875
31663
  }
29876
31664
  /** Does `x^(2^power)` mod p. `pow2(30, 4)` == `30^(2^4)` */
29877
31665
  function pow2(x, power, modulo) {
29878
31666
  let res = x;
29879
- while (power-- > _0n$2) {
31667
+ while (power-- > _0n$3) {
29880
31668
  res *= res;
29881
31669
  res %= modulo;
29882
31670
  }
@@ -29887,16 +31675,16 @@ function pow2(x, power, modulo) {
29887
31675
  * Implemented using [Euclidean GCD](https://brilliant.org/wiki/extended-euclidean-algorithm/).
29888
31676
  */
29889
31677
  function invert(number, modulo) {
29890
- if (number === _0n$2)
31678
+ if (number === _0n$3)
29891
31679
  throw new Error('invert: expected non-zero number');
29892
- if (modulo <= _0n$2)
31680
+ if (modulo <= _0n$3)
29893
31681
  throw new Error('invert: expected positive modulus, got ' + modulo);
29894
31682
  // Fermat's little theorem "CT-like" version inv(n) = n^(m-2) mod m is 30x slower.
29895
31683
  let a = mod(number, modulo);
29896
31684
  let b = modulo;
29897
31685
  // prettier-ignore
29898
- let x = _0n$2, u = _1n$3;
29899
- while (a !== _0n$2) {
31686
+ let x = _0n$3, u = _1n$3;
31687
+ while (a !== _0n$3) {
29900
31688
  // JIT applies optimization if those two lines follow each other
29901
31689
  const q = b / a;
29902
31690
  const r = b % a;
@@ -29909,116 +31697,141 @@ function invert(number, modulo) {
29909
31697
  throw new Error('invert: does not exist');
29910
31698
  return mod(x, modulo);
29911
31699
  }
31700
+ // Not all roots are possible! Example which will throw:
31701
+ // const NUM =
31702
+ // n = 72057594037927816n;
31703
+ // Fp = Field(BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab'));
31704
+ function sqrt3mod4(Fp, n) {
31705
+ const p1div4 = (Fp.ORDER + _1n$3) / _4n$1;
31706
+ const root = Fp.pow(n, p1div4);
31707
+ // Throw if root^2 != n
31708
+ if (!Fp.eql(Fp.sqr(root), n))
31709
+ throw new Error('Cannot find square root');
31710
+ return root;
31711
+ }
31712
+ function sqrt5mod8(Fp, n) {
31713
+ const p5div8 = (Fp.ORDER - _5n) / _8n;
31714
+ const n2 = Fp.mul(n, _2n$1);
31715
+ const v = Fp.pow(n2, p5div8);
31716
+ const nv = Fp.mul(n, v);
31717
+ const i = Fp.mul(Fp.mul(nv, _2n$1), v);
31718
+ const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
31719
+ if (!Fp.eql(Fp.sqr(root), n))
31720
+ throw new Error('Cannot find square root');
31721
+ return root;
31722
+ }
31723
+ // TODO: Commented-out for now. Provide test vectors.
31724
+ // Tonelli is too slow for extension fields Fp2.
31725
+ // That means we can't use sqrt (c1, c2...) even for initialization constants.
31726
+ // if (P % _16n === _9n) return sqrt9mod16;
31727
+ // // prettier-ignore
31728
+ // function sqrt9mod16<T>(Fp: IField<T>, n: T, p7div16?: bigint) {
31729
+ // if (p7div16 === undefined) p7div16 = (Fp.ORDER + BigInt(7)) / _16n;
31730
+ // const c1 = Fp.sqrt(Fp.neg(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F
31731
+ // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F
31732
+ // const c3 = Fp.sqrt(Fp.neg(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F
31733
+ // const c4 = p7div16; // 4. c4 = (q + 7) / 16 # Integer arithmetic
31734
+ // let tv1 = Fp.pow(n, c4); // 1. tv1 = x^c4
31735
+ // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1
31736
+ // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1
31737
+ // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1
31738
+ // const e1 = Fp.eql(Fp.sqr(tv2), n); // 5. e1 = (tv2^2) == x
31739
+ // const e2 = Fp.eql(Fp.sqr(tv3), n); // 6. e2 = (tv3^2) == x
31740
+ // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x
31741
+ // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x
31742
+ // const e3 = Fp.eql(Fp.sqr(tv2), n); // 9. e3 = (tv2^2) == x
31743
+ // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2
31744
+ // }
29912
31745
  /**
29913
31746
  * Tonelli-Shanks square root search algorithm.
29914
31747
  * 1. https://eprint.iacr.org/2012/685.pdf (page 12)
29915
31748
  * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks
29916
- * Will start an infinite loop if field order P is not prime.
29917
31749
  * @param P field order
29918
31750
  * @returns function that takes field Fp (created from P) and number n
29919
31751
  */
29920
31752
  function tonelliShanks(P) {
29921
- // Legendre constant: used to calculate Legendre symbol (a | p),
29922
- // which denotes the value of a^((p-1)/2) (mod p).
29923
- // (a | p) 1 if a is a square (mod p)
29924
- // (a | p) ≡ -1 if a is not a square (mod p)
29925
- // (a | p) 0 if a ≡ 0 (mod p)
29926
- const legendreC = (P - _1n$3) / _2n$1;
29927
- let Q, S, Z;
29928
- // Step 1: By factoring out powers of 2 from p - 1,
29929
- // find q and s such that p - 1 = q*(2^s) with q odd
29930
- for (Q = P - _1n$3, S = 0; Q % _2n$1 === _0n$2; Q /= _2n$1, S++)
29931
- ;
29932
- // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq
29933
- for (Z = _2n$1; Z < P && pow(Z, legendreC, P) !== P - _1n$3; Z++) {
29934
- // Crash instead of infinity loop, we cannot reasonable count until P.
29935
- if (Z > 1000)
29936
- throw new Error('Cannot find square root: likely non-prime P');
29937
- }
29938
- // Fast-path
29939
- if (S === 1) {
29940
- const p1div4 = (P + _1n$3) / _4n;
29941
- return function tonelliFast(Fp, n) {
29942
- const root = Fp.pow(n, p1div4);
29943
- if (!Fp.eql(Fp.sqr(root), n))
29944
- throw new Error('Cannot find square root');
29945
- return root;
29946
- };
29947
- }
31753
+ // Initialization (precomputation).
31754
+ if (P < BigInt(3))
31755
+ throw new Error('sqrt is not defined for small field');
31756
+ // Factor P - 1 = Q * 2^S, where Q is odd
31757
+ let Q = P - _1n$3;
31758
+ let S = 0;
31759
+ while (Q % _2n$1 === _0n$3) {
31760
+ Q /= _2n$1;
31761
+ S++;
31762
+ }
31763
+ // Find the first quadratic non-residue Z >= 2
31764
+ let Z = _2n$1;
31765
+ const _Fp = Field(P);
31766
+ while (FpLegendre(_Fp, Z) === 1) {
31767
+ // Basic primality test for P. After x iterations, chance of
31768
+ // not finding quadratic non-residue is 2^x, so 2^1000.
31769
+ if (Z++ > 1000)
31770
+ throw new Error('Cannot find square root: probably non-prime P');
31771
+ }
31772
+ // Fast-path; usually done before Z, but we do "primality test".
31773
+ if (S === 1)
31774
+ return sqrt3mod4;
29948
31775
  // Slow-path
31776
+ // TODO: test on Fp2 and others
31777
+ let cc = _Fp.pow(Z, Q); // c = z^Q
29949
31778
  const Q1div2 = (Q + _1n$3) / _2n$1;
29950
31779
  return function tonelliSlow(Fp, n) {
29951
- // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1
29952
- if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE))
31780
+ if (Fp.is0(n))
31781
+ return n;
31782
+ // Check if n is a quadratic residue using Legendre symbol
31783
+ if (FpLegendre(Fp, n) !== 1)
29953
31784
  throw new Error('Cannot find square root');
29954
- let r = S;
29955
- // TODO: will fail at Fp2/etc
29956
- let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b
29957
- let x = Fp.pow(n, Q1div2); // first guess at the square root
29958
- let b = Fp.pow(n, Q); // first guess at the fudge factor
29959
- while (!Fp.eql(b, Fp.ONE)) {
29960
- if (Fp.eql(b, Fp.ZERO))
29961
- return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0)
29962
- // Find m such b^(2^m)==1
29963
- let m = 1;
29964
- for (let t2 = Fp.sqr(b); m < r; m++) {
29965
- if (Fp.eql(t2, Fp.ONE))
29966
- break;
29967
- t2 = Fp.sqr(t2); // t2 *= t2
31785
+ // Initialize variables for the main loop
31786
+ let M = S;
31787
+ let c = Fp.mul(Fp.ONE, cc); // c = z^Q, move cc from field _Fp into field Fp
31788
+ let t = Fp.pow(n, Q); // t = n^Q, first guess at the fudge factor
31789
+ let R = Fp.pow(n, Q1div2); // R = n^((Q+1)/2), first guess at the square root
31790
+ // Main loop
31791
+ // while t != 1
31792
+ while (!Fp.eql(t, Fp.ONE)) {
31793
+ if (Fp.is0(t))
31794
+ return Fp.ZERO; // if t=0 return R=0
31795
+ let i = 1;
31796
+ // Find the smallest i >= 1 such that t^(2^i) ≡ 1 (mod P)
31797
+ let t_tmp = Fp.sqr(t); // t^(2^1)
31798
+ while (!Fp.eql(t_tmp, Fp.ONE)) {
31799
+ i++;
31800
+ t_tmp = Fp.sqr(t_tmp); // t^(2^2)...
31801
+ if (i === M)
31802
+ throw new Error('Cannot find square root');
29968
31803
  }
29969
- // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow
29970
- const ge = Fp.pow(g, _1n$3 << BigInt(r - m - 1)); // ge = 2^(r-m-1)
29971
- g = Fp.sqr(ge); // g = ge * ge
29972
- x = Fp.mul(x, ge); // x *= ge
29973
- b = Fp.mul(b, g); // b *= g
29974
- r = m;
31804
+ // Calculate the exponent for b: 2^(M - i - 1)
31805
+ const exponent = _1n$3 << BigInt(M - i - 1); // bigint is important
31806
+ const b = Fp.pow(c, exponent); // b = 2^(M - i - 1)
31807
+ // Update variables
31808
+ M = i;
31809
+ c = Fp.sqr(b); // c = b^2
31810
+ t = Fp.mul(t, c); // t = (t * b^2)
31811
+ R = Fp.mul(R, b); // R = R*b
29975
31812
  }
29976
- return x;
31813
+ return R;
29977
31814
  };
29978
31815
  }
29979
31816
  /**
29980
- * Square root for a finite field. It will try to check if optimizations are applicable and fall back to 4:
31817
+ * Square root for a finite field. Will try optimized versions first:
29981
31818
  *
29982
31819
  * 1. P ≡ 3 (mod 4)
29983
31820
  * 2. P ≡ 5 (mod 8)
29984
- * 3. P ≡ 9 (mod 16)
29985
- * 4. Tonelli-Shanks algorithm
31821
+ * 3. Tonelli-Shanks algorithm
29986
31822
  *
29987
31823
  * Different algorithms can give different roots, it is up to user to decide which one they want.
29988
31824
  * For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve).
29989
31825
  */
29990
31826
  function FpSqrt(P) {
29991
- // P ≡ 3 (mod 4)
29992
- // √n = n^((P+1)/4)
29993
- if (P % _4n === _3n$1) {
29994
- // Not all roots possible!
29995
- // const ORDER =
29996
- // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn;
29997
- // const NUM = 72057594037927816n;
29998
- const p1div4 = (P + _1n$3) / _4n;
29999
- return function sqrt3mod4(Fp, n) {
30000
- const root = Fp.pow(n, p1div4);
30001
- // Throw if root**2 != n
30002
- if (!Fp.eql(Fp.sqr(root), n))
30003
- throw new Error('Cannot find square root');
30004
- return root;
30005
- };
30006
- }
30007
- // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10)
30008
- if (P % _8n === _5n) {
30009
- const c1 = (P - _5n) / _8n;
30010
- return function sqrt5mod8(Fp, n) {
30011
- const n2 = Fp.mul(n, _2n$1);
30012
- const v = Fp.pow(n2, c1);
30013
- const nv = Fp.mul(n, v);
30014
- const i = Fp.mul(Fp.mul(nv, _2n$1), v);
30015
- const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
30016
- if (!Fp.eql(Fp.sqr(root), n))
30017
- throw new Error('Cannot find square root');
30018
- return root;
30019
- };
30020
- }
30021
- // Other cases: Tonelli-Shanks algorithm
31827
+ // P ≡ 3 (mod 4) => √n = n^((P+1)/4)
31828
+ if (P % _4n$1 === _3n$1)
31829
+ return sqrt3mod4;
31830
+ // P 5 (mod 8) => Atkin algorithm, page 10 of https://eprint.iacr.org/2012/685.pdf
31831
+ if (P % _8n === _5n)
31832
+ return sqrt5mod8;
31833
+ // P 9 (mod 16) not implemented, see above
31834
+ // Tonelli-Shanks algorithm
30022
31835
  return tonelliShanks(P);
30023
31836
  }
30024
31837
  // prettier-ignore
@@ -30045,52 +31858,74 @@ function validateField(field) {
30045
31858
  * Same as `pow` but for Fp: non-constant-time.
30046
31859
  * Unsafe in some contexts: uses ladder, so can expose bigint bits.
30047
31860
  */
30048
- function FpPow(f, num, power) {
30049
- // Should have same speed as pow for bigints
30050
- // TODO: benchmark!
30051
- if (power < _0n$2)
31861
+ function FpPow(Fp, num, power) {
31862
+ if (power < _0n$3)
30052
31863
  throw new Error('invalid exponent, negatives unsupported');
30053
- if (power === _0n$2)
30054
- return f.ONE;
31864
+ if (power === _0n$3)
31865
+ return Fp.ONE;
30055
31866
  if (power === _1n$3)
30056
31867
  return num;
30057
- let p = f.ONE;
31868
+ let p = Fp.ONE;
30058
31869
  let d = num;
30059
- while (power > _0n$2) {
31870
+ while (power > _0n$3) {
30060
31871
  if (power & _1n$3)
30061
- p = f.mul(p, d);
30062
- d = f.sqr(d);
31872
+ p = Fp.mul(p, d);
31873
+ d = Fp.sqr(d);
30063
31874
  power >>= _1n$3;
30064
31875
  }
30065
31876
  return p;
30066
31877
  }
30067
31878
  /**
30068
31879
  * Efficiently invert an array of Field elements.
30069
- * `inv(0)` will return `undefined` here: make sure to throw an error.
31880
+ * Exception-free. Will return `undefined` for 0 elements.
31881
+ * @param passZero map 0 to 0 (instead of undefined)
30070
31882
  */
30071
- function FpInvertBatch(f, nums) {
30072
- const tmp = new Array(nums.length);
31883
+ function FpInvertBatch(Fp, nums, passZero = false) {
31884
+ const inverted = new Array(nums.length).fill(passZero ? Fp.ZERO : undefined);
30073
31885
  // Walk from first to last, multiply them by each other MOD p
30074
- const lastMultiplied = nums.reduce((acc, num, i) => {
30075
- if (f.is0(num))
31886
+ const multipliedAcc = nums.reduce((acc, num, i) => {
31887
+ if (Fp.is0(num))
30076
31888
  return acc;
30077
- tmp[i] = acc;
30078
- return f.mul(acc, num);
30079
- }, f.ONE);
31889
+ inverted[i] = acc;
31890
+ return Fp.mul(acc, num);
31891
+ }, Fp.ONE);
30080
31892
  // Invert last element
30081
- const inverted = f.inv(lastMultiplied);
31893
+ const invertedAcc = Fp.inv(multipliedAcc);
30082
31894
  // Walk from last to first, multiply them by inverted each other MOD p
30083
31895
  nums.reduceRight((acc, num, i) => {
30084
- if (f.is0(num))
31896
+ if (Fp.is0(num))
30085
31897
  return acc;
30086
- tmp[i] = f.mul(acc, tmp[i]);
30087
- return f.mul(acc, num);
30088
- }, inverted);
30089
- return tmp;
31898
+ inverted[i] = Fp.mul(acc, inverted[i]);
31899
+ return Fp.mul(acc, num);
31900
+ }, invertedAcc);
31901
+ return inverted;
31902
+ }
31903
+ /**
31904
+ * Legendre symbol.
31905
+ * Legendre constant is used to calculate Legendre symbol (a | p)
31906
+ * which denotes the value of a^((p-1)/2) (mod p).
31907
+ *
31908
+ * * (a | p) ≡ 1 if a is a square (mod p), quadratic residue
31909
+ * * (a | p) ≡ -1 if a is not a square (mod p), quadratic non residue
31910
+ * * (a | p) ≡ 0 if a ≡ 0 (mod p)
31911
+ */
31912
+ function FpLegendre(Fp, n) {
31913
+ // We can use 3rd argument as optional cache of this value
31914
+ // but seems unneeded for now. The operation is very fast.
31915
+ const p1mod2 = (Fp.ORDER - _1n$3) / _2n$1;
31916
+ const powered = Fp.pow(n, p1mod2);
31917
+ const yes = Fp.eql(powered, Fp.ONE);
31918
+ const zero = Fp.eql(powered, Fp.ZERO);
31919
+ const no = Fp.eql(powered, Fp.neg(Fp.ONE));
31920
+ if (!yes && !zero && !no)
31921
+ throw new Error('invalid Legendre symbol result');
31922
+ return yes ? 1 : zero ? 0 : -1;
30090
31923
  }
30091
31924
  // CURVE.n lengths
30092
31925
  function nLength(n, nBitLength) {
30093
31926
  // Bit size, byte size of CURVE.n
31927
+ if (nBitLength !== undefined)
31928
+ anumber$1(nBitLength);
30094
31929
  const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;
30095
31930
  const nByteLength = Math.ceil(_nBitLength / 8);
30096
31931
  return { nBitLength: _nBitLength, nByteLength };
@@ -30111,7 +31946,7 @@ function nLength(n, nBitLength) {
30111
31946
  * @param redef optional faster redefinitions of sqrt and other methods
30112
31947
  */
30113
31948
  function Field(ORDER, bitLen, isLE = false, redef = {}) {
30114
- if (ORDER <= _0n$2)
31949
+ if (ORDER <= _0n$3)
30115
31950
  throw new Error('invalid field: expected ORDER > 0, got ' + ORDER);
30116
31951
  const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen);
30117
31952
  if (BYTES > 2048)
@@ -30123,15 +31958,15 @@ function Field(ORDER, bitLen, isLE = false, redef = {}) {
30123
31958
  BITS,
30124
31959
  BYTES,
30125
31960
  MASK: bitMask(BITS),
30126
- ZERO: _0n$2,
31961
+ ZERO: _0n$3,
30127
31962
  ONE: _1n$3,
30128
31963
  create: (num) => mod(num, ORDER),
30129
31964
  isValid: (num) => {
30130
31965
  if (typeof num !== 'bigint')
30131
31966
  throw new Error('invalid field element: expected bigint, got ' + typeof num);
30132
- return _0n$2 <= num && num < ORDER; // 0 is valid element, but it's not invertible
31967
+ return _0n$3 <= num && num < ORDER; // 0 is valid element, but it's not invertible
30133
31968
  },
30134
- is0: (num) => num === _0n$2,
31969
+ is0: (num) => num === _0n$3,
30135
31970
  isOdd: (num) => (num & _1n$3) === _1n$3,
30136
31971
  neg: (num) => mod(-num, ORDER),
30137
31972
  eql: (lhs, rhs) => lhs === rhs,
@@ -30153,16 +31988,17 @@ function Field(ORDER, bitLen, isLE = false, redef = {}) {
30153
31988
  sqrtP = FpSqrt(ORDER);
30154
31989
  return sqrtP(f, n);
30155
31990
  }),
30156
- invertBatch: (lst) => FpInvertBatch(f, lst),
30157
- // TODO: do we really need constant cmov?
30158
- // We don't have const-time bigints anyway, so probably will be not very useful
30159
- cmov: (a, b, c) => (c ? b : a),
30160
31991
  toBytes: (num) => (isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)),
30161
31992
  fromBytes: (bytes) => {
30162
31993
  if (bytes.length !== BYTES)
30163
31994
  throw new Error('Field.fromBytes: expected ' + BYTES + ' bytes, got ' + bytes.length);
30164
31995
  return isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes);
30165
31996
  },
31997
+ // TODO: we don't need it here, move out to separate fn
31998
+ invertBatch: (lst) => FpInvertBatch(f, lst),
31999
+ // We can't move this out because Fp6, Fp12 implement it
32000
+ // and it's unclear what to return in there.
32001
+ cmov: (a, b, c) => (c ? b : a),
30166
32002
  });
30167
32003
  return Object.freeze(f);
30168
32004
  }
@@ -30215,12 +32051,97 @@ function mapHashToField(key, fieldOrder, isLE = false) {
30215
32051
  return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
30216
32052
  }
30217
32053
 
32054
+ /**
32055
+ * HMAC: RFC2104 message authentication code.
32056
+ * @module
32057
+ */
32058
+ class HMAC extends Hash {
32059
+ constructor(hash, _key) {
32060
+ super();
32061
+ this.finished = false;
32062
+ this.destroyed = false;
32063
+ ahash(hash);
32064
+ const key = toBytes(_key);
32065
+ this.iHash = hash.create();
32066
+ if (typeof this.iHash.update !== 'function')
32067
+ throw new Error('Expected instance of class which extends utils.Hash');
32068
+ this.blockLen = this.iHash.blockLen;
32069
+ this.outputLen = this.iHash.outputLen;
32070
+ const blockLen = this.blockLen;
32071
+ const pad = new Uint8Array(blockLen);
32072
+ // blockLen can be bigger than outputLen
32073
+ pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
32074
+ for (let i = 0; i < pad.length; i++)
32075
+ pad[i] ^= 0x36;
32076
+ this.iHash.update(pad);
32077
+ // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
32078
+ this.oHash = hash.create();
32079
+ // Undo internal XOR && apply outer XOR
32080
+ for (let i = 0; i < pad.length; i++)
32081
+ pad[i] ^= 0x36 ^ 0x5c;
32082
+ this.oHash.update(pad);
32083
+ clean(pad);
32084
+ }
32085
+ update(buf) {
32086
+ aexists(this);
32087
+ this.iHash.update(buf);
32088
+ return this;
32089
+ }
32090
+ digestInto(out) {
32091
+ aexists(this);
32092
+ abytes$2(out, this.outputLen);
32093
+ this.finished = true;
32094
+ this.iHash.digestInto(out);
32095
+ this.oHash.update(out);
32096
+ this.oHash.digestInto(out);
32097
+ this.destroy();
32098
+ }
32099
+ digest() {
32100
+ const out = new Uint8Array(this.oHash.outputLen);
32101
+ this.digestInto(out);
32102
+ return out;
32103
+ }
32104
+ _cloneInto(to) {
32105
+ // Create new instance without calling constructor since key already in state and we don't know it.
32106
+ to || (to = Object.create(Object.getPrototypeOf(this), {}));
32107
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
32108
+ to = to;
32109
+ to.finished = finished;
32110
+ to.destroyed = destroyed;
32111
+ to.blockLen = blockLen;
32112
+ to.outputLen = outputLen;
32113
+ to.oHash = oHash._cloneInto(to.oHash);
32114
+ to.iHash = iHash._cloneInto(to.iHash);
32115
+ return to;
32116
+ }
32117
+ clone() {
32118
+ return this._cloneInto();
32119
+ }
32120
+ destroy() {
32121
+ this.destroyed = true;
32122
+ this.oHash.destroy();
32123
+ this.iHash.destroy();
32124
+ }
32125
+ }
32126
+ /**
32127
+ * HMAC: RFC2104 message authentication code.
32128
+ * @param hash - function that would be used e.g. sha256
32129
+ * @param key - message key
32130
+ * @param message - message data
32131
+ * @example
32132
+ * import { hmac } from '@noble/hashes/hmac';
32133
+ * import { sha256 } from '@noble/hashes/sha2';
32134
+ * const mac1 = hmac(sha256, 'key', 'message');
32135
+ */
32136
+ const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
32137
+ hmac.create = (hash, key) => new HMAC(hash, key);
32138
+
30218
32139
  /**
30219
32140
  * Methods for elliptic curve multiplication by scalars.
30220
32141
  * Contains wNAF, pippenger
30221
32142
  * @module
30222
32143
  */
30223
- const _0n$1 = BigInt(0);
32144
+ const _0n$2 = BigInt(0);
30224
32145
  const _1n$2 = BigInt(1);
30225
32146
  function constTimeNegate(condition, item) {
30226
32147
  const neg = item.negate();
@@ -30308,7 +32229,7 @@ function wNAF(c, bits) {
30308
32229
  // non-const time multiplication ladder
30309
32230
  unsafeLadder(elm, n, p = c.ZERO) {
30310
32231
  let d = elm;
30311
- while (n > _0n$1) {
32232
+ while (n > _0n$2) {
30312
32233
  if (n & _1n$2)
30313
32234
  p = p.add(d);
30314
32235
  d = d.double();
@@ -30397,7 +32318,7 @@ function wNAF(c, bits) {
30397
32318
  wNAFUnsafe(W, precomputes, n, acc = c.ZERO) {
30398
32319
  const wo = calcWOpts(W, bits);
30399
32320
  for (let window = 0; window < wo.windows; window++) {
30400
- if (n === _0n$1)
32321
+ if (n === _0n$2)
30401
32322
  break; // Early-exit, skip 0 value
30402
32323
  const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo);
30403
32324
  n = nextN;
@@ -30462,18 +32383,27 @@ function pippenger(c, fieldN, points, scalars) {
30462
32383
  // 0 is accepted in scalars
30463
32384
  validateMSMPoints(points, c);
30464
32385
  validateMSMScalars(scalars, fieldN);
30465
- if (points.length !== scalars.length)
32386
+ const plength = points.length;
32387
+ const slength = scalars.length;
32388
+ if (plength !== slength)
30466
32389
  throw new Error('arrays of points and scalars must have equal length');
32390
+ // if (plength === 0) throw new Error('array must be of length >= 2');
30467
32391
  const zero = c.ZERO;
30468
- const wbits = bitLen(BigInt(points.length));
30469
- const windowSize = wbits > 12 ? wbits - 3 : wbits > 4 ? wbits - 2 : wbits ? 2 : 1; // in bits
32392
+ const wbits = bitLen(BigInt(plength));
32393
+ let windowSize = 1; // bits
32394
+ if (wbits > 12)
32395
+ windowSize = wbits - 3;
32396
+ else if (wbits > 4)
32397
+ windowSize = wbits - 2;
32398
+ else if (wbits > 0)
32399
+ windowSize = 2;
30470
32400
  const MASK = bitMask(windowSize);
30471
32401
  const buckets = new Array(Number(MASK) + 1).fill(zero); // +1 for zero array
30472
32402
  const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize;
30473
32403
  let sum = zero;
30474
32404
  for (let i = lastBits; i >= 0; i -= windowSize) {
30475
32405
  buckets.fill(zero);
30476
- for (let j = 0; j < scalars.length; j++) {
32406
+ for (let j = 0; j < slength; j++) {
30477
32407
  const scalar = scalars[j];
30478
32408
  const wbits = Number((scalar >> BigInt(i)) & MASK);
30479
32409
  buckets[wbits] = buckets[wbits].add(points[j]);
@@ -30519,9 +32449,9 @@ function validateBasic(curve) {
30519
32449
  *
30520
32450
  * * a: formula param
30521
32451
  * * b: formula param
30522
- * * Fp: finite Field over which we'll do calculations. Can be complex (Fp2, Fp12)
30523
- * * n: Curve prime subgroup order, total count of valid points in the field
30524
- * * Gx: Base point (x, y) aka generator point x coordinate
32452
+ * * Fp: finite field of prime characteristic P; may be complex (Fp2). Arithmetics is done in field
32453
+ * * n: order of prime subgroup a.k.a total amount of valid curve points
32454
+ * * Gx: Base point (x, y) aka generator point. Gx = x coordinate
30525
32455
  * * Gy: ...y coordinate
30526
32456
  * * h: cofactor, usually 1. h*n = curve group order (n is only subgroup order)
30527
32457
  * * lowS: whether to enable (default) or disable "low-s" non-malleable signatures
@@ -30561,23 +32491,23 @@ function validatePointOpts(curve) {
30561
32491
  a: 'field',
30562
32492
  b: 'field',
30563
32493
  }, {
32494
+ allowInfinityPoint: 'boolean',
30564
32495
  allowedPrivateKeyLengths: 'array',
30565
- wrapPrivateKey: 'boolean',
30566
- isTorsionFree: 'function',
30567
32496
  clearCofactor: 'function',
30568
- allowInfinityPoint: 'boolean',
30569
32497
  fromBytes: 'function',
32498
+ isTorsionFree: 'function',
30570
32499
  toBytes: 'function',
32500
+ wrapPrivateKey: 'boolean',
30571
32501
  });
30572
32502
  const { endo, Fp, a } = opts;
30573
32503
  if (endo) {
30574
32504
  if (!Fp.eql(a, Fp.ZERO)) {
30575
- throw new Error('invalid endomorphism, can only be defined for Koblitz curves that have a=0');
32505
+ throw new Error('invalid endo: CURVE.a must be 0');
30576
32506
  }
30577
32507
  if (typeof endo !== 'object' ||
30578
32508
  typeof endo.beta !== 'bigint' ||
30579
32509
  typeof endo.splitScalar !== 'function') {
30580
- throw new Error('invalid endomorphism, expected beta: bigint and splitScalar: function');
32510
+ throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');
30581
32511
  }
30582
32512
  }
30583
32513
  return Object.freeze({ ...opts });
@@ -30658,7 +32588,7 @@ const DER = {
30658
32588
  _int: {
30659
32589
  encode(num) {
30660
32590
  const { Err: E } = DER;
30661
- if (num < _0n)
32591
+ if (num < _0n$1)
30662
32592
  throw new E('integer: negative integers are not allowed');
30663
32593
  let hex = numberToHexUnpadded(num);
30664
32594
  // Pad with zero byte if negative flag is present
@@ -30698,9 +32628,12 @@ const DER = {
30698
32628
  return tlv.encode(0x30, seq);
30699
32629
  },
30700
32630
  };
32631
+ function numToSizedHex(num, size) {
32632
+ return bytesToHex(numberToBytesBE(num, size));
32633
+ }
30701
32634
  // Be friendly to bad ECMAScript parsers by not using bigint literals
30702
32635
  // prettier-ignore
30703
- const _0n = BigInt(0), _1n$1 = BigInt(1); BigInt(2); const _3n = BigInt(3); BigInt(4);
32636
+ const _0n$1 = BigInt(0), _1n$1 = BigInt(1); BigInt(2); const _3n = BigInt(3), _4n = BigInt(4);
30704
32637
  function weierstrassPoints(opts) {
30705
32638
  const CURVE = validatePointOpts(opts);
30706
32639
  const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ
@@ -30726,15 +32659,24 @@ function weierstrassPoints(opts) {
30726
32659
  function weierstrassEquation(x) {
30727
32660
  const { a, b } = CURVE;
30728
32661
  const x2 = Fp.sqr(x); // x * x
30729
- const x3 = Fp.mul(x2, x); // x2 * x
30730
- return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b
32662
+ const x3 = Fp.mul(x2, x); // * x
32663
+ return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // + a * x + b
32664
+ }
32665
+ function isValidXY(x, y) {
32666
+ const left = Fp.sqr(y); // y²
32667
+ const right = weierstrassEquation(x); // x³ + ax + b
32668
+ return Fp.eql(left, right);
30731
32669
  }
30732
32670
  // Validate whether the passed curve params are valid.
30733
- // We check if curve equation works for generator point.
30734
- // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381.
30735
- // ProjectivePoint class has not been initialized yet.
30736
- if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))
30737
- throw new Error('bad generator point: equation left != right');
32671
+ // Test 1: equation = + ax + b should work for generator point.
32672
+ if (!isValidXY(CURVE.Gx, CURVE.Gy))
32673
+ throw new Error('bad curve params: generator point');
32674
+ // Test 2: discriminant Δ part should be non-zero: 4a³ + 27b² != 0.
32675
+ // Guarantees curve is genus-1, smooth (non-singular).
32676
+ const _4a3 = Fp.mul(Fp.pow(CURVE.a, _3n), _4n);
32677
+ const _27b2 = Fp.mul(Fp.sqr(CURVE.b), BigInt(27));
32678
+ if (Fp.is0(Fp.add(_4a3, _27b2)))
32679
+ throw new Error('bad curve params: a or b');
30738
32680
  // Valid group elements reside in range 1..n-1
30739
32681
  function isWithinCurveOrder(num) {
30740
32682
  return inRange(num, _1n$1, CURVE.n);
@@ -30773,7 +32715,7 @@ function weierstrassPoints(opts) {
30773
32715
  // Memoized toAffine / validity check. They are heavy. Points are immutable.
30774
32716
  // Converts Projective point to affine (x, y) coordinates.
30775
32717
  // Can accept precomputed Z^-1 - for example, from invertBatch.
30776
- // (x, y, z) ∋ (x=x/z, y=y/z)
32718
+ // (X, Y, Z) ∋ (x=X/Z, y=Y/Z)
30777
32719
  const toAffineMemo = memoized((p, iz) => {
30778
32720
  const { px: x, py: y, pz: z } = p;
30779
32721
  // Fast-path for normalized points
@@ -30809,16 +32751,14 @@ function weierstrassPoints(opts) {
30809
32751
  // Check if x, y are valid field elements
30810
32752
  if (!Fp.isValid(x) || !Fp.isValid(y))
30811
32753
  throw new Error('bad point: x or y not FE');
30812
- const left = Fp.sqr(y); // y²
30813
- const right = weierstrassEquation(x); // x³ + ax + b
30814
- if (!Fp.eql(left, right))
32754
+ if (!isValidXY(x, y))
30815
32755
  throw new Error('bad point: equation left != right');
30816
32756
  if (!p.isTorsionFree())
30817
32757
  throw new Error('bad point: not in prime-order subgroup');
30818
32758
  return true;
30819
32759
  });
30820
32760
  /**
30821
- * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z)
32761
+ * Projective Point works in 3d / projective (homogeneous) coordinates: (X, Y, Z) ∋ (x=X/Z, y=Y/Z)
30822
32762
  * Default Point works in 2d / affine coordinates: (x, y)
30823
32763
  * We're doing calculations in projective, because its operations don't require costly inversion.
30824
32764
  */
@@ -30826,7 +32766,7 @@ function weierstrassPoints(opts) {
30826
32766
  constructor(px, py, pz) {
30827
32767
  if (px == null || !Fp.isValid(px))
30828
32768
  throw new Error('x required');
30829
- if (py == null || !Fp.isValid(py))
32769
+ if (py == null || !Fp.isValid(py) || Fp.is0(py))
30830
32770
  throw new Error('y required');
30831
32771
  if (pz == null || !Fp.isValid(pz))
30832
32772
  throw new Error('z required');
@@ -30862,7 +32802,7 @@ function weierstrassPoints(opts) {
30862
32802
  * Optimization: converts a list of projective points to a list of identical points with Z=1.
30863
32803
  */
30864
32804
  static normalizeZ(points) {
30865
- const toInv = Fp.invertBatch(points.map((p) => p.pz));
32805
+ const toInv = FpInvertBatch(Fp, points.map((p) => p.pz));
30866
32806
  return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);
30867
32807
  }
30868
32808
  /**
@@ -31024,9 +32964,9 @@ function weierstrassPoints(opts) {
31024
32964
  */
31025
32965
  multiplyUnsafe(sc) {
31026
32966
  const { endo, n: N } = CURVE;
31027
- aInRange('scalar', sc, _0n, N);
32967
+ aInRange('scalar', sc, _0n$1, N);
31028
32968
  const I = Point.ZERO;
31029
- if (sc === _0n)
32969
+ if (sc === _0n$1)
31030
32970
  return I;
31031
32971
  if (this.is0() || sc === _1n$1)
31032
32972
  return this;
@@ -31034,11 +32974,12 @@ function weierstrassPoints(opts) {
31034
32974
  if (!endo || wnaf.hasPrecomputes(this))
31035
32975
  return wnaf.wNAFCachedUnsafe(this, sc, Point.normalizeZ);
31036
32976
  // Case c: endomorphism
32977
+ /** See docs for {@link EndomorphismOpts} */
31037
32978
  let { k1neg, k1, k2neg, k2 } = endo.splitScalar(sc);
31038
32979
  let k1p = I;
31039
32980
  let k2p = I;
31040
32981
  let d = this;
31041
- while (k1 > _0n || k2 > _0n) {
32982
+ while (k1 > _0n$1 || k2 > _0n$1) {
31042
32983
  if (k1 & _1n$1)
31043
32984
  k1p = k1p.add(d);
31044
32985
  if (k2 & _1n$1)
@@ -31067,6 +33008,7 @@ function weierstrassPoints(opts) {
31067
33008
  const { endo, n: N } = CURVE;
31068
33009
  aInRange('scalar', scalar, _1n$1, N);
31069
33010
  let point, fake; // Fake point is used to const-time mult
33011
+ /** See docs for {@link EndomorphismOpts} */
31070
33012
  if (endo) {
31071
33013
  const { k1neg, k1, k2neg, k2 } = endo.splitScalar(scalar);
31072
33014
  let { p: k1p, f: f1p } = this.wNAF(k1);
@@ -31094,7 +33036,7 @@ function weierstrassPoints(opts) {
31094
33036
  multiplyAndAddUnsafe(Q, a, b) {
31095
33037
  const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes
31096
33038
  const mul = (P, a // Select faster multiply() method
31097
- ) => (a === _0n || a === _1n$1 || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a));
33039
+ ) => (a === _0n$1 || a === _1n$1 || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a));
31098
33040
  const sum = mul(this, a).add(mul(Q, b));
31099
33041
  return sum.is0() ? undefined : sum;
31100
33042
  }
@@ -31130,11 +33072,12 @@ function weierstrassPoints(opts) {
31130
33072
  return bytesToHex(this.toRawBytes(isCompressed));
31131
33073
  }
31132
33074
  }
33075
+ // base / generator point
31133
33076
  Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);
31134
- Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO);
31135
- const _bits = CURVE.nBitLength;
31136
- const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);
31137
- // Validate if generator point is on curve
33077
+ // zero / infinity / identity point
33078
+ Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); // 0, 1, 0
33079
+ const { endo, nBitLength } = CURVE;
33080
+ const wnaf = wNAF(Point, endo ? Math.ceil(nBitLength / 2) : nBitLength);
31138
33081
  return {
31139
33082
  CURVE,
31140
33083
  ProjectivePoint: Point,
@@ -31165,7 +33108,7 @@ function validateOpts(curve) {
31165
33108
  */
31166
33109
  function weierstrass(curveDef) {
31167
33110
  const CURVE = validateOpts(curveDef);
31168
- const { Fp, n: CURVE_ORDER } = CURVE;
33111
+ const { Fp, n: CURVE_ORDER, nByteLength, nBitLength } = CURVE;
31169
33112
  const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32
31170
33113
  const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32
31171
33114
  function modN(a) {
@@ -31225,7 +33168,6 @@ function weierstrass(curveDef) {
31225
33168
  }
31226
33169
  },
31227
33170
  });
31228
- const numToNByteHex = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
31229
33171
  function isBiggerThanHalfOrder(number) {
31230
33172
  const HALF = CURVE_ORDER >> _1n$1;
31231
33173
  return number > HALF;
@@ -31250,7 +33192,7 @@ function weierstrass(curveDef) {
31250
33192
  }
31251
33193
  // pair (bytes of r, bytes of s)
31252
33194
  static fromCompact(hex) {
31253
- const l = CURVE.nByteLength;
33195
+ const l = nByteLength;
31254
33196
  hex = ensureBytes('compactSignature', hex, l * 2);
31255
33197
  return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));
31256
33198
  }
@@ -31277,7 +33219,7 @@ function weierstrass(curveDef) {
31277
33219
  if (radj >= Fp.ORDER)
31278
33220
  throw new Error('recovery id 2 or 3 invalid');
31279
33221
  const prefix = (rec & 1) === 0 ? '02' : '03';
31280
- const R = Point.fromHex(prefix + numToNByteHex(radj));
33222
+ const R = Point.fromHex(prefix + numToSizedHex(radj, Fp.BYTES));
31281
33223
  const ir = invN(radj); // r^-1
31282
33224
  const u1 = modN(-h * ir); // -hr^-1
31283
33225
  const u2 = modN(s * ir); // sr^-1
@@ -31299,14 +33241,15 @@ function weierstrass(curveDef) {
31299
33241
  return hexToBytes(this.toDERHex());
31300
33242
  }
31301
33243
  toDERHex() {
31302
- return DER.hexFromSig({ r: this.r, s: this.s });
33244
+ return DER.hexFromSig(this);
31303
33245
  }
31304
33246
  // padded bytes of r, then padded bytes of s
31305
33247
  toCompactRawBytes() {
31306
33248
  return hexToBytes(this.toCompactHex());
31307
33249
  }
31308
33250
  toCompactHex() {
31309
- return numToNByteHex(this.r) + numToNByteHex(this.s);
33251
+ const l = nByteLength;
33252
+ return numToSizedHex(this.r, l) + numToSizedHex(this.s, l);
31310
33253
  }
31311
33254
  }
31312
33255
  const utils = {
@@ -31355,16 +33298,21 @@ function weierstrass(curveDef) {
31355
33298
  * Quick and dirty check for item being public key. Does not validate hex, or being on-curve.
31356
33299
  */
31357
33300
  function isProbPub(item) {
31358
- const arr = isBytes$1(item);
31359
- const str = typeof item === 'string';
31360
- const len = (arr || str) && item.length;
31361
- if (arr)
31362
- return len === compressedLen || len === uncompressedLen;
31363
- if (str)
31364
- return len === 2 * compressedLen || len === 2 * uncompressedLen;
33301
+ if (typeof item === 'bigint')
33302
+ return false;
31365
33303
  if (item instanceof Point)
31366
33304
  return true;
31367
- return false;
33305
+ const arr = ensureBytes('key', item);
33306
+ const len = arr.length;
33307
+ const fpl = Fp.BYTES;
33308
+ const compLen = fpl + 1; // e.g. 33 for 32
33309
+ const uncompLen = 2 * fpl + 1; // e.g. 65 for 32
33310
+ if (CURVE.allowedPrivateKeyLengths || nByteLength === compLen) {
33311
+ return undefined;
33312
+ }
33313
+ else {
33314
+ return len === compLen || len === uncompLen;
33315
+ }
31368
33316
  }
31369
33317
  /**
31370
33318
  * ECDH (Elliptic Curve Diffie Hellman).
@@ -31377,9 +33325,9 @@ function weierstrass(curveDef) {
31377
33325
  * @returns shared public key
31378
33326
  */
31379
33327
  function getSharedSecret(privateA, publicB, isCompressed = true) {
31380
- if (isProbPub(privateA))
33328
+ if (isProbPub(privateA) === true)
31381
33329
  throw new Error('first arg must be private key');
31382
- if (!isProbPub(publicB))
33330
+ if (isProbPub(publicB) === false)
31383
33331
  throw new Error('second arg must be public key');
31384
33332
  const b = Point.fromHex(publicB); // check for being on-curve
31385
33333
  return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
@@ -31390,13 +33338,13 @@ function weierstrass(curveDef) {
31390
33338
  // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors
31391
33339
  const bits2int = CURVE.bits2int ||
31392
33340
  function (bytes) {
31393
- // Our custom check "just in case"
33341
+ // Our custom check "just in case", for protection against DoS
31394
33342
  if (bytes.length > 8192)
31395
33343
  throw new Error('input is too large');
31396
33344
  // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)
31397
33345
  // for some cases, since bytes.length * 8 is not actual bitLength.
31398
33346
  const num = bytesToNumberBE(bytes); // check for == u8 done here
31399
- const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits
33347
+ const delta = bytes.length * 8 - nBitLength; // truncate to nBitLength leftmost bits
31400
33348
  return delta > 0 ? num >> BigInt(delta) : num;
31401
33349
  };
31402
33350
  const bits2int_modN = CURVE.bits2int_modN ||
@@ -31404,14 +33352,14 @@ function weierstrass(curveDef) {
31404
33352
  return modN(bits2int(bytes)); // can't use bytesToNumberBE here
31405
33353
  };
31406
33354
  // NOTE: pads output with zero as per spec
31407
- const ORDER_MASK = bitMask(CURVE.nBitLength);
33355
+ const ORDER_MASK = bitMask(nBitLength);
31408
33356
  /**
31409
33357
  * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`.
31410
33358
  */
31411
33359
  function int2octets(num) {
31412
- aInRange('num < 2^' + CURVE.nBitLength, num, _0n, ORDER_MASK);
33360
+ aInRange('num < 2^' + nBitLength, num, _0n$1, ORDER_MASK);
31413
33361
  // works with order, can have different size than numToField!
31414
- return numberToBytesBE(num, CURVE.nByteLength);
33362
+ return numberToBytesBE(num, nByteLength);
31415
33363
  }
31416
33364
  // Steps A, D of RFC6979 3.2
31417
33365
  // Creates RFC6979 seed; converts msg/privKey to numbers.
@@ -31452,13 +33400,13 @@ function weierstrass(curveDef) {
31452
33400
  const ik = invN(k); // k^-1 mod n
31453
33401
  const q = Point.BASE.multiply(k).toAffine(); // q = Gk
31454
33402
  const r = modN(q.x); // r = q.x mod n
31455
- if (r === _0n)
33403
+ if (r === _0n$1)
31456
33404
  return;
31457
33405
  // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to
31458
33406
  // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it:
31459
33407
  // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT
31460
33408
  const s = modN(ik * modN(m + r * d)); // Not using blinding here
31461
- if (s === _0n)
33409
+ if (s === _0n$1)
31462
33410
  return;
31463
33411
  let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n$1); // recovery bit (2 or 3, when q.x > n)
31464
33412
  let normS = s;
@@ -31611,6 +33559,7 @@ function createCurve(curveDef, defHash) {
31611
33559
  */
31612
33560
  const secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f');
31613
33561
  const secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141');
33562
+ const _0n = BigInt(0);
31614
33563
  const _1n = BigInt(1);
31615
33564
  const _2n = BigInt(2);
31616
33565
  const divNearest = (a, b) => (a + b / _2n) / b;
@@ -31659,13 +33608,13 @@ const Fpk1 = Field(secp256k1P, undefined, undefined, { sqrt: sqrtMod });
31659
33608
  * ```
31660
33609
  */
31661
33610
  const secp256k1 = createCurve({
31662
- a: BigInt(0),
33611
+ a: _0n,
31663
33612
  b: BigInt(7),
31664
33613
  Fp: Fpk1,
31665
33614
  n: secp256k1N,
31666
33615
  Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'),
31667
33616
  Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'),
31668
- h: BigInt(1), // Cofactor
33617
+ h: BigInt(1),
31669
33618
  lowS: true, // Allow only low-S signatures by default in sign() and verify()
31670
33619
  endo: {
31671
33620
  // Endomorphism, see above
@@ -31693,11 +33642,7 @@ const secp256k1 = createCurve({
31693
33642
  return { k1neg, k1, k2neg, k2 };
31694
33643
  },
31695
33644
  },
31696
- }, sha256$1);
31697
- // Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code.
31698
- // https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
31699
- BigInt(0);
31700
- secp256k1.ProjectivePoint;
33645
+ }, sha256$2);
31701
33646
 
31702
33647
  /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
31703
33648
  function isBytes(a) {
@@ -32100,10 +34045,17 @@ chain(radix2(5), alphabet('0123456789ABCDEFGHIJKLMNOPQRSTUV'), join(''));
32100
34045
  */
32101
34046
  chain(radix2(5), alphabet('0123456789ABCDEFGHJKMNPQRSTVWXYZ'), join(''), normalize((s) => s.toUpperCase().replace(/O/g, '0').replace(/[IL]/g, '1')));
32102
34047
  // Built-in base64 conversion https://caniuse.com/mdn-javascript_builtins_uint8array_frombase64
32103
- // TODO: temporarily set to false, trying to understand bugs
32104
34048
  // prettier-ignore
32105
34049
  const hasBase64Builtin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toBase64 === 'function' &&
32106
34050
  typeof Uint8Array.fromBase64 === 'function')();
34051
+ const decodeBase64Builtin = (s, isUrl) => {
34052
+ astr('base64', s);
34053
+ const re = isUrl ? /^[A-Za-z0-9=_-]+$/ : /^[A-Za-z0-9=+/]+$/;
34054
+ const alphabet = isUrl ? 'base64url' : 'base64';
34055
+ if (s.length > 0 && !re.test(s))
34056
+ throw new Error('invalid base64');
34057
+ return Uint8Array.fromBase64(s, { alphabet, lastChunkHandling: 'strict' });
34058
+ };
32107
34059
  /**
32108
34060
  * base64 from RFC 4648. Padded.
32109
34061
  * Use `base64nopad` for unpadded version.
@@ -32120,10 +34072,7 @@ const hasBase64Builtin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toBas
32120
34072
  // prettier-ignore
32121
34073
  hasBase64Builtin ? {
32122
34074
  encode(b) { abytes(b); return b.toBase64(); },
32123
- decode(s) {
32124
- astr('base64', s);
32125
- return Uint8Array.fromBase64(s, { lastChunkHandling: 'strict' });
32126
- },
34075
+ decode(s) { return decodeBase64Builtin(s, false); },
32127
34076
  } : chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'), padding(6), join(''));
32128
34077
  /**
32129
34078
  * base64 from RFC 4648. No padding.
@@ -32152,7 +34101,7 @@ chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0
32152
34101
  // prettier-ignore
32153
34102
  hasBase64Builtin ? {
32154
34103
  encode(b) { abytes(b); return b.toBase64({ alphabet: 'base64url' }); },
32155
- decode(s) { astr('base64', s); return Uint8Array.fromBase64(s, { alphabet: 'base64url' }); },
34104
+ decode(s) { return decodeBase64Builtin(s, true); },
32156
34105
  } : chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'), padding(6), join(''));
32157
34106
  /**
32158
34107
  * base64 from RFC 4648, using URL-safe alphabet. No padding.
@@ -32343,9 +34292,37 @@ hasHexBuiltin
32343
34292
  * ```
32344
34293
  */
32345
34294
  secp256k1.ProjectivePoint;
32346
- createBase58check(sha256$1);
34295
+ createBase58check(sha256$2);
32347
34296
  utf8ToBytes('Bitcoin seed');
32348
34297
 
34298
+ /**
34299
+ * @description Converts a signature into hex format.
34300
+ *
34301
+ * @param signature The signature to convert.
34302
+ * @returns The signature in hex format.
34303
+ *
34304
+ * @example
34305
+ * serializeSignature({
34306
+ * r: '0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf',
34307
+ * s: '0x4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db8',
34308
+ * yParity: 1
34309
+ * })
34310
+ * // "0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c"
34311
+ */
34312
+ function serializeSignature({ r, s, to = 'hex', v, yParity, }) {
34313
+ const yParity_ = (() => {
34314
+ if (yParity === 0 || yParity === 1)
34315
+ return yParity;
34316
+ if (v && (v === 27n || v === 28n || v >= 35n))
34317
+ return v % 2n === 0n ? 1 : 0;
34318
+ throw new Error('Invalid `v` or `yParity` value');
34319
+ })();
34320
+ const signature = `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).toCompactHex()}${yParity_ === 0 ? '1b' : '1c'}`;
34321
+ if (to === 'hex')
34322
+ return signature;
34323
+ return hexToBytes$1(signature);
34324
+ }
34325
+
32349
34326
  // TODO(v3): Rename to `toLocalAccount` + add `source` property to define source (privateKey, mnemonic, hdKey, etc).
32350
34327
  /**
32351
34328
  * @description Creates an Account from a custom signing implementation.
@@ -32388,34 +34365,6 @@ function publicKeyToAddress(publicKey) {
32388
34365
  return checksumAddress(`0x${address}`);
32389
34366
  }
32390
34367
 
32391
- /**
32392
- * @description Converts a signature into hex format.
32393
- *
32394
- * @param signature The signature to convert.
32395
- * @returns The signature in hex format.
32396
- *
32397
- * @example
32398
- * serializeSignature({
32399
- * r: '0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf',
32400
- * s: '0x4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db8',
32401
- * yParity: 1
32402
- * })
32403
- * // "0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c"
32404
- */
32405
- function serializeSignature({ r, s, to = 'hex', v, yParity, }) {
32406
- const yParity_ = (() => {
32407
- if (yParity === 0 || yParity === 1)
32408
- return yParity;
32409
- if (v && (v === 27n || v === 28n || v >= 35n))
32410
- return v % 2n === 0n ? 1 : 0;
32411
- throw new Error('Invalid `v` or `yParity` value');
32412
- })();
32413
- const signature = `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).toCompactHex()}${yParity_ === 0 ? '1b' : '1c'}`;
32414
- if (to === 'hex')
32415
- return signature;
32416
- return hexToBytes$1(signature);
32417
- }
32418
-
32419
34368
  // TODO(v3): Convert to sync.
32420
34369
  let extraEntropy = false;
32421
34370
  /**
@@ -32427,7 +34376,12 @@ let extraEntropy = false;
32427
34376
  * @returns The signature.
32428
34377
  */
32429
34378
  async function sign({ hash, privateKey, to = 'object', }) {
32430
- const { r, s, recovery } = secp256k1.sign(hash.slice(2), privateKey.slice(2), { lowS: true, extraEntropy });
34379
+ const { r, s, recovery } = secp256k1.sign(hash.slice(2), privateKey.slice(2), {
34380
+ lowS: true,
34381
+ extraEntropy: isHex(extraEntropy, { strict: false })
34382
+ ? hexToBytes$1(extraEntropy)
34383
+ : extraEntropy,
34384
+ });
32431
34385
  const signature = {
32432
34386
  r: numberToHex(r, { size: 32 }),
32433
34387
  s: numberToHex(s, { size: 32 }),
@@ -32522,10 +34476,10 @@ async function signTransaction(parameters) {
32522
34476
  return transaction;
32523
34477
  })();
32524
34478
  const signature = await sign({
32525
- hash: keccak256(serializer(signableTransaction)),
34479
+ hash: keccak256(await serializer(signableTransaction)),
32526
34480
  privateKey,
32527
34481
  });
32528
- return serializer(transaction, signature);
34482
+ return (await serializer(transaction, signature));
32529
34483
  }
32530
34484
 
32531
34485
  class InvalidDomainError extends BaseError {
@@ -32566,7 +34520,7 @@ function validateTypedData(parameters) {
32566
34520
  // and will throw.
32567
34521
  numberToHex(value, {
32568
34522
  signed: base === 'int',
32569
- size: Number.parseInt(size_) / 8,
34523
+ size: Number.parseInt(size_, 10) / 8,
32570
34524
  });
32571
34525
  }
32572
34526
  if (type === 'address' && typeof value === 'string' && !isAddress(value))
@@ -32574,9 +34528,9 @@ function validateTypedData(parameters) {
32574
34528
  const bytesMatch = type.match(bytesRegex);
32575
34529
  if (bytesMatch) {
32576
34530
  const [_type, size_] = bytesMatch;
32577
- if (size_ && size(value) !== Number.parseInt(size_))
34531
+ if (size_ && size(value) !== Number.parseInt(size_, 10))
32578
34532
  throw new BytesSizeMismatchError({
32579
- expectedSize: Number.parseInt(size_),
34533
+ expectedSize: Number.parseInt(size_, 10),
32580
34534
  givenSize: size(value),
32581
34535
  });
32582
34536
  }
@@ -32922,6 +34876,8 @@ exports.BuyBackManagerAddress = BuyBackManagerAddress;
32922
34876
  exports.ClankerWorldVerifierAddress = ClankerWorldVerifierAddress;
32923
34877
  exports.ClosedPermissionsAddress = ClosedPermissionsAddress;
32924
34878
  exports.DopplerVerifierAddress = DopplerVerifierAddress;
34879
+ exports.DynamicAddressFeeSplitManagerAbi = DynamicAddressFeeSplitManagerAbi;
34880
+ exports.DynamicAddressFeeSplitManagerAddress = DynamicAddressFeeSplitManagerAddress;
32925
34881
  exports.FLETHAddress = FLETHAddress;
32926
34882
  exports.FLETHHooksAddress = FLETHHooksAddress;
32927
34883
  exports.FairLaunchAbi = FairLaunchAbi;
@@ -32959,7 +34915,9 @@ exports.Q192 = Q192;
32959
34915
  exports.Q96 = Q96;
32960
34916
  exports.QuoterAbi = QuoterAbi;
32961
34917
  exports.QuoterAddress = QuoterAddress;
34918
+ exports.ReadDynamicAddressFeeSplitManager = ReadDynamicAddressFeeSplitManager;
32962
34919
  exports.ReadFlaunchSDK = ReadFlaunchSDK;
34920
+ exports.ReadWriteDynamicAddressFeeSplitManager = ReadWriteDynamicAddressFeeSplitManager;
32963
34921
  exports.ReadWriteFlaunchSDK = ReadWriteFlaunchSDK;
32964
34922
  exports.ReferralEscrowAbi = ReferralEscrowAbi;
32965
34923
  exports.ReferralEscrowAddress = ReferralEscrowAddress;