@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.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createDrift as createDrift$1 } from '@delvtech/drift';
2
- import { zeroAddress, parseEther, encodeAbiParameters as encodeAbiParameters$1, maxUint256 as maxUint256$1, encodeFunctionData, maxUint160, maxUint48, parseUnits, hexToBigInt as hexToBigInt$1, pad as pad$1, keccak256 as keccak256$1, encodePacked, stringToHex as stringToHex$1, concat as concat$1, toHex as toHex$1, zeroHash, formatUnits as formatUnits$1, parseEventLogs, decodeEventLog, erc721Abi, erc20Abi, parseAbi, createWalletClient, http, decodeFunctionData } from 'viem';
2
+ import { zeroAddress, parseEther, encodeAbiParameters as encodeAbiParameters$1, maxUint256 as maxUint256$1, encodeFunctionData, maxUint160, maxUint48, parseUnits, hexToBigInt as hexToBigInt$1, pad as pad$1, keccak256 as keccak256$1, encodePacked, stringToHex as stringToHex$1, concat as concat$1, toHex as toHex$1, zeroHash, getAddress, formatUnits as formatUnits$1, parseEventLogs, decodeEventLog, erc721Abi, erc20Abi, parseAbi, createWalletClient, http, decodeFunctionData } from 'viem';
3
3
  import axios from 'axios';
4
4
  import { viemAdapter } from '@delvtech/drift-viem';
5
5
 
@@ -12,7 +12,7 @@ function defineChain(chain) {
12
12
  };
13
13
  }
14
14
 
15
- const version = '2.29.2';
15
+ const version = '2.37.12';
16
16
 
17
17
  let errorConfig = {
18
18
  getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
@@ -612,8 +612,8 @@ function defineFormatter(type, format) {
612
612
  return ({ exclude, format: overrides, }) => {
613
613
  return {
614
614
  exclude,
615
- format: (args) => {
616
- const formatted = format(args);
615
+ format: (args, action) => {
616
+ const formatted = format(args, action);
617
617
  if (exclude) {
618
618
  for (const key of exclude) {
619
619
  delete formatted[key];
@@ -621,7 +621,7 @@ function defineFormatter(type, format) {
621
621
  }
622
622
  return {
623
623
  ...formatted,
624
- ...overrides(args),
624
+ ...overrides(args, action),
625
625
  };
626
626
  },
627
627
  type,
@@ -636,7 +636,7 @@ const transactionType = {
636
636
  '0x3': 'eip4844',
637
637
  '0x4': 'eip7702',
638
638
  };
639
- function formatTransaction(transaction) {
639
+ function formatTransaction(transaction, _) {
640
640
  const transaction_ = {
641
641
  ...transaction,
642
642
  blockHash: transaction.blockHash ? transaction.blockHash : null,
@@ -714,7 +714,7 @@ function formatAuthorizationList$1(authorizationList) {
714
714
  }));
715
715
  }
716
716
 
717
- function formatBlock(block) {
717
+ function formatBlock(block, _) {
718
718
  const transactions = (block.transactions ?? []).map((transaction) => {
719
719
  if (typeof transaction === 'string')
720
720
  return transaction;
@@ -762,7 +762,7 @@ const receiptStatuses = {
762
762
  '0x0': 'reverted',
763
763
  '0x1': 'success',
764
764
  };
765
- function formatTransactionReceipt(transactionReceipt) {
765
+ function formatTransactionReceipt(transactionReceipt, _) {
766
766
  const receipt = {
767
767
  ...transactionReceipt,
768
768
  blockNumber: transactionReceipt.blockNumber
@@ -809,7 +809,7 @@ const rpcTransactionType = {
809
809
  eip4844: '0x3',
810
810
  eip7702: '0x4',
811
811
  };
812
- function formatTransactionRequest(request) {
812
+ function formatTransactionRequest(request, _) {
813
813
  const rpcRequest = {};
814
814
  if (typeof request.authorizationList !== 'undefined')
815
815
  rpcRequest.authorizationList = formatAuthorizationList(request.authorizationList);
@@ -1346,19 +1346,21 @@ function blobsToProofs(parameters) {
1346
1346
  : proofs.map((x) => bytesToHex$1(x)));
1347
1347
  }
1348
1348
 
1349
+ const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
1350
+
1349
1351
  /**
1350
- * Internal assertion helpers.
1352
+ * Utilities for hex, bytes, CSPRNG.
1351
1353
  * @module
1352
1354
  */
1355
+ /** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
1356
+ function isBytes$2(a) {
1357
+ return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
1358
+ }
1353
1359
  /** Asserts something is positive integer. */
1354
1360
  function anumber$1(n) {
1355
1361
  if (!Number.isSafeInteger(n) || n < 0)
1356
1362
  throw new Error('positive integer expected, got ' + n);
1357
1363
  }
1358
- /** Is number an Uint8Array? Copied from utils for perf. */
1359
- function isBytes$2(a) {
1360
- return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
1361
- }
1362
1364
  /** Asserts something is Uint8Array. */
1363
1365
  function abytes$2(b, ...lengths) {
1364
1366
  if (!isBytes$2(b))
@@ -1369,7 +1371,7 @@ function abytes$2(b, ...lengths) {
1369
1371
  /** Asserts something is hash */
1370
1372
  function ahash(h) {
1371
1373
  if (typeof h !== 'function' || typeof h.create !== 'function')
1372
- throw new Error('Hash should be wrapped by utils.wrapConstructor');
1374
+ throw new Error('Hash should be wrapped by utils.createHasher');
1373
1375
  anumber$1(h.outputLen);
1374
1376
  anumber$1(h.blockLen);
1375
1377
  }
@@ -1388,17 +1390,17 @@ function aoutput(out, instance) {
1388
1390
  throw new Error('digestInto() expects output buffer of length at least ' + min);
1389
1391
  }
1390
1392
  }
1391
-
1392
- const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
1393
-
1394
- /**
1395
- * Utilities for hex, bytes, CSPRNG.
1396
- * @module
1397
- */
1393
+ /** Cast u8 / u16 / u32 to u32. */
1398
1394
  function u32(arr) {
1399
1395
  return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
1400
1396
  }
1401
- // Cast array to view
1397
+ /** Zeroize a byte array. Warning: JS provides no guarantees. */
1398
+ function clean(...arrays) {
1399
+ for (let i = 0; i < arrays.length; i++) {
1400
+ arrays[i].fill(0);
1401
+ }
1402
+ }
1403
+ /** Create DataView of an array for easy byte-level manipulation. */
1402
1404
  function createView(arr) {
1403
1405
  return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
1404
1406
  }
@@ -1408,7 +1410,7 @@ function rotr(word, shift) {
1408
1410
  }
1409
1411
  /** Is current platform little-endian? Most are. Big-Endian platform: IBM */
1410
1412
  const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
1411
- // The byte swap operation for uint32
1413
+ /** The byte swap operation for uint32 */
1412
1414
  function byteSwap(word) {
1413
1415
  return (((word << 24) & 0xff000000) |
1414
1416
  ((word << 8) & 0xff0000) |
@@ -1420,17 +1422,18 @@ function byteSwap32(arr) {
1420
1422
  for (let i = 0; i < arr.length; i++) {
1421
1423
  arr[i] = byteSwap(arr[i]);
1422
1424
  }
1425
+ return arr;
1423
1426
  }
1424
- // Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
1425
- // @ts-ignore
1426
- typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function';
1427
+ const swap32IfBE = isLE
1428
+ ? (u) => u
1429
+ : byteSwap32;
1427
1430
  /**
1428
- * Convert JS string to byte array.
1429
- * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
1431
+ * Converts string to bytes using UTF8 encoding.
1432
+ * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
1430
1433
  */
1431
1434
  function utf8ToBytes(str) {
1432
1435
  if (typeof str !== 'string')
1433
- throw new Error('utf8ToBytes expected string, got ' + typeof str);
1436
+ throw new Error('string expected');
1434
1437
  return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
1435
1438
  }
1436
1439
  /**
@@ -1444,9 +1447,7 @@ function toBytes(data) {
1444
1447
  abytes$2(data);
1445
1448
  return data;
1446
1449
  }
1447
- /**
1448
- * Copies several Uint8Arrays into one.
1449
- */
1450
+ /** Copies several Uint8Arrays into one. */
1450
1451
  function concatBytes$1(...arrays) {
1451
1452
  let sum = 0;
1452
1453
  for (let i = 0; i < arrays.length; i++) {
@@ -1464,13 +1465,9 @@ function concatBytes$1(...arrays) {
1464
1465
  }
1465
1466
  /** For runtime check if class implements interface */
1466
1467
  class Hash {
1467
- // Safe version that clones internal state
1468
- clone() {
1469
- return this._cloneInto();
1470
- }
1471
1468
  }
1472
1469
  /** Wraps hash function, creating an interface on top of it */
1473
- function wrapConstructor(hashCons) {
1470
+ function createHasher(hashCons) {
1474
1471
  const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
1475
1472
  const tmp = hashCons();
1476
1473
  hashC.outputLen = tmp.outputLen;
@@ -1535,8 +1532,9 @@ class HashMD extends Hash {
1535
1532
  }
1536
1533
  update(data) {
1537
1534
  aexists(this);
1538
- const { view, buffer, blockLen } = this;
1539
1535
  data = toBytes(data);
1536
+ abytes$2(data);
1537
+ const { view, buffer, blockLen } = this;
1540
1538
  const len = data.length;
1541
1539
  for (let pos = 0; pos < len;) {
1542
1540
  const take = Math.min(blockLen - this.pos, len - pos);
@@ -1570,7 +1568,7 @@ class HashMD extends Hash {
1570
1568
  let { pos } = this;
1571
1569
  // append the bit '1' to the message
1572
1570
  buffer[pos++] = 0b10000000;
1573
- this.buffer.subarray(pos).fill(0);
1571
+ clean(this.buffer.subarray(pos));
1574
1572
  // we have less than padOffset left in buffer, so we cannot put length in
1575
1573
  // current block, need process it and pad again
1576
1574
  if (this.padOffset > blockLen - pos) {
@@ -1608,28 +1606,69 @@ class HashMD extends Hash {
1608
1606
  to || (to = new this.constructor());
1609
1607
  to.set(...this.get());
1610
1608
  const { blockLen, buffer, length, finished, destroyed, pos } = this;
1609
+ to.destroyed = destroyed;
1610
+ to.finished = finished;
1611
1611
  to.length = length;
1612
1612
  to.pos = pos;
1613
- to.finished = finished;
1614
- to.destroyed = destroyed;
1615
1613
  if (length % blockLen)
1616
1614
  to.buffer.set(buffer);
1617
1615
  return to;
1618
1616
  }
1617
+ clone() {
1618
+ return this._cloneInto();
1619
+ }
1619
1620
  }
1621
+ /**
1622
+ * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
1623
+ * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
1624
+ */
1625
+ /** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
1626
+ const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
1627
+ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
1628
+ ]);
1620
1629
 
1621
1630
  /**
1622
- * SHA2-256 a.k.a. sha256. In JS, it is the fastest hash, even faster than Blake3.
1623
- *
1624
- * To break sha256 using birthday attack, attackers need to try 2^128 hashes.
1625
- * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
1626
- *
1627
- * Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
1631
+ * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
1632
+ * @todo re-check https://issues.chromium.org/issues/42212588
1628
1633
  * @module
1629
1634
  */
1630
- /** Round constants: first 32 bits of fractional parts of the cube roots of the first 64 primes 2..311). */
1635
+ const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
1636
+ const _32n = /* @__PURE__ */ BigInt(32);
1637
+ function fromBig(n, le = false) {
1638
+ if (le)
1639
+ return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
1640
+ return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
1641
+ }
1642
+ function split(lst, le = false) {
1643
+ const len = lst.length;
1644
+ let Ah = new Uint32Array(len);
1645
+ let Al = new Uint32Array(len);
1646
+ for (let i = 0; i < len; i++) {
1647
+ const { h, l } = fromBig(lst[i], le);
1648
+ [Ah[i], Al[i]] = [h, l];
1649
+ }
1650
+ return [Ah, Al];
1651
+ }
1652
+ // Left rotate for Shift in [1, 32)
1653
+ const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
1654
+ const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
1655
+ // Left rotate for Shift in (32, 64), NOTE: 32 is special case.
1656
+ const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
1657
+ const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
1658
+
1659
+ /**
1660
+ * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
1661
+ * SHA256 is the fastest hash implementable in JS, even faster than Blake3.
1662
+ * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and
1663
+ * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
1664
+ * @module
1665
+ */
1666
+ /**
1667
+ * Round constants:
1668
+ * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
1669
+ */
1631
1670
  // prettier-ignore
1632
- const SHA256_K = /* @__PURE__ */ new Uint32Array([
1671
+ const SHA256_K = /* @__PURE__ */ Uint32Array.from([
1633
1672
  0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
1634
1673
  0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
1635
1674
  0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
@@ -1639,15 +1678,7 @@ const SHA256_K = /* @__PURE__ */ new Uint32Array([
1639
1678
  0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
1640
1679
  0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
1641
1680
  ]);
1642
- /** Initial state: first 32 bits of fractional parts of the square roots of the first 8 primes 2..19. */
1643
- // prettier-ignore
1644
- const SHA256_IV = /* @__PURE__ */ new Uint32Array([
1645
- 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
1646
- ]);
1647
- /**
1648
- * Temporary buffer, not used to store anything between runs.
1649
- * Named this way because it matches specification.
1650
- */
1681
+ /** Reusable temporary buffer. "W" comes straight from spec. */
1651
1682
  const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
1652
1683
  class SHA256 extends HashMD {
1653
1684
  constructor(outputLen = 32) {
@@ -1717,15 +1748,34 @@ class SHA256 extends HashMD {
1717
1748
  this.set(A, B, C, D, E, F, G, H);
1718
1749
  }
1719
1750
  roundClean() {
1720
- SHA256_W.fill(0);
1751
+ clean(SHA256_W);
1721
1752
  }
1722
1753
  destroy() {
1723
1754
  this.set(0, 0, 0, 0, 0, 0, 0, 0);
1724
- this.buffer.fill(0);
1755
+ clean(this.buffer);
1725
1756
  }
1726
1757
  }
1727
- /** SHA2-256 hash function */
1728
- const sha256$1 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
1758
+ /**
1759
+ * SHA2-256 hash function from RFC 4634.
1760
+ *
1761
+ * It is the fastest JS hash, even faster than Blake3.
1762
+ * To break sha256 using birthday attack, attackers need to try 2^128 hashes.
1763
+ * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
1764
+ */
1765
+ const sha256$2 = /* @__PURE__ */ createHasher(() => new SHA256());
1766
+
1767
+ /**
1768
+ * SHA2-256 a.k.a. sha256. In JS, it is the fastest hash, even faster than Blake3.
1769
+ *
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
+ * Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
1774
+ * @module
1775
+ * @deprecated
1776
+ */
1777
+ /** @deprecated Use import from `noble/hashes/sha2` module */
1778
+ const sha256$1 = sha256$2;
1729
1779
 
1730
1780
  function sha256(value, to_) {
1731
1781
  const to = to_ || 'hex';
@@ -2025,34 +2075,6 @@ class LruMap extends Map {
2025
2075
  }
2026
2076
  }
2027
2077
 
2028
- /**
2029
- * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
2030
- * @todo re-check https://issues.chromium.org/issues/42212588
2031
- * @module
2032
- */
2033
- const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
2034
- const _32n = /* @__PURE__ */ BigInt(32);
2035
- function fromBig(n, le = false) {
2036
- if (le)
2037
- return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
2038
- return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
2039
- }
2040
- function split(lst, le = false) {
2041
- let Ah = new Uint32Array(lst.length);
2042
- let Al = new Uint32Array(lst.length);
2043
- for (let i = 0; i < lst.length; i++) {
2044
- const { h, l } = fromBig(lst[i], le);
2045
- [Ah[i], Al[i]] = [h, l];
2046
- }
2047
- return [Ah, Al];
2048
- }
2049
- // Left rotate for Shift in [1, 32)
2050
- const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
2051
- const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
2052
- // Left rotate for Shift in (32, 64), NOTE: 32 is special case.
2053
- const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
2054
- const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
2055
-
2056
2078
  /**
2057
2079
  * SHA3 (keccak) hash function, based on a new "Sponge function" design.
2058
2080
  * Different from older hashes, the internal state is bigger than output size.
@@ -2064,16 +2086,18 @@ const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
2064
2086
  * Check out `sha3-addons` module for cSHAKE, k12, and others.
2065
2087
  * @module
2066
2088
  */
2089
+ // No __PURE__ annotations in sha3 header:
2090
+ // EVERYTHING is in fact used on every export.
2067
2091
  // Various per round constants calculations
2092
+ const _0n$5 = BigInt(0);
2093
+ const _1n$5 = BigInt(1);
2094
+ const _2n$2 = BigInt(2);
2095
+ const _7n = BigInt(7);
2096
+ const _256n = BigInt(256);
2097
+ const _0x71n = BigInt(0x71);
2068
2098
  const SHA3_PI = [];
2069
2099
  const SHA3_ROTL = [];
2070
2100
  const _SHA3_IOTA = [];
2071
- const _0n$4 = /* @__PURE__ */ BigInt(0);
2072
- const _1n$5 = /* @__PURE__ */ BigInt(1);
2073
- const _2n$2 = /* @__PURE__ */ BigInt(2);
2074
- const _7n = /* @__PURE__ */ BigInt(7);
2075
- const _256n = /* @__PURE__ */ BigInt(256);
2076
- const _0x71n = /* @__PURE__ */ BigInt(0x71);
2077
2101
  for (let round = 0, R = _1n$5, x = 1, y = 0; round < 24; round++) {
2078
2102
  // Pi
2079
2103
  [x, y] = [y, (2 * x + 3 * y) % 5];
@@ -2081,7 +2105,7 @@ for (let round = 0, R = _1n$5, x = 1, y = 0; round < 24; round++) {
2081
2105
  // Rotational
2082
2106
  SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);
2083
2107
  // Iota
2084
- let t = _0n$4;
2108
+ let t = _0n$5;
2085
2109
  for (let j = 0; j < 7; j++) {
2086
2110
  R = ((R << _1n$5) ^ ((R >> _7n) * _0x71n)) % _256n;
2087
2111
  if (R & _2n$2)
@@ -2089,7 +2113,9 @@ for (let round = 0, R = _1n$5, x = 1, y = 0; round < 24; round++) {
2089
2113
  }
2090
2114
  _SHA3_IOTA.push(t);
2091
2115
  }
2092
- const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
2116
+ const IOTAS = split(_SHA3_IOTA, true);
2117
+ const SHA3_IOTA_H = IOTAS[0];
2118
+ const SHA3_IOTA_L = IOTAS[1];
2093
2119
  // Left rotation (without 0, 32, 64)
2094
2120
  const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
2095
2121
  const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
@@ -2137,7 +2163,7 @@ function keccakP(s, rounds = 24) {
2137
2163
  s[0] ^= SHA3_IOTA_H[round];
2138
2164
  s[1] ^= SHA3_IOTA_L[round];
2139
2165
  }
2140
- B.fill(0);
2166
+ clean(B);
2141
2167
  }
2142
2168
  /** Keccak sponge function. */
2143
2169
  class Keccak extends Hash {
@@ -2158,24 +2184,26 @@ class Keccak extends Hash {
2158
2184
  anumber$1(outputLen);
2159
2185
  // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
2160
2186
  // 0 < blockLen < 200
2161
- if (0 >= this.blockLen || this.blockLen >= 200)
2162
- throw new Error('Sha3 supports only keccak-f1600 function');
2187
+ if (!(0 < blockLen && blockLen < 200))
2188
+ throw new Error('only keccak-f1600 function is supported');
2163
2189
  this.state = new Uint8Array(200);
2164
2190
  this.state32 = u32(this.state);
2165
2191
  }
2192
+ clone() {
2193
+ return this._cloneInto();
2194
+ }
2166
2195
  keccak() {
2167
- if (!isLE)
2168
- byteSwap32(this.state32);
2196
+ swap32IfBE(this.state32);
2169
2197
  keccakP(this.state32, this.rounds);
2170
- if (!isLE)
2171
- byteSwap32(this.state32);
2198
+ swap32IfBE(this.state32);
2172
2199
  this.posOut = 0;
2173
2200
  this.pos = 0;
2174
2201
  }
2175
2202
  update(data) {
2176
2203
  aexists(this);
2177
- const { blockLen, state } = this;
2178
2204
  data = toBytes(data);
2205
+ abytes$2(data);
2206
+ const { blockLen, state } = this;
2179
2207
  const len = data.length;
2180
2208
  for (let pos = 0; pos < len;) {
2181
2209
  const take = Math.min(blockLen - this.pos, len - pos);
@@ -2237,7 +2265,7 @@ class Keccak extends Hash {
2237
2265
  }
2238
2266
  destroy() {
2239
2267
  this.destroyed = true;
2240
- this.state.fill(0);
2268
+ clean(this.state);
2241
2269
  }
2242
2270
  _cloneInto(to) {
2243
2271
  const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
@@ -2255,9 +2283,9 @@ class Keccak extends Hash {
2255
2283
  return to;
2256
2284
  }
2257
2285
  }
2258
- const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
2286
+ const gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen));
2259
2287
  /** keccak-256 hash function. Different from SHA3-256. */
2260
- const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);
2288
+ const keccak_256 = /* @__PURE__ */ (() => gen(0x01, 136, 256 / 8))();
2261
2289
 
2262
2290
  function keccak256(value, to_) {
2263
2291
  const to = to_ || 'hex';
@@ -2526,13 +2554,13 @@ function serializeTransactionEIP7702(transaction, signature) {
2526
2554
  return concatHex([
2527
2555
  '0x04',
2528
2556
  toRlp([
2529
- toHex(chainId),
2530
- nonce ? toHex(nonce) : '0x',
2531
- maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : '0x',
2532
- maxFeePerGas ? toHex(maxFeePerGas) : '0x',
2533
- gas ? toHex(gas) : '0x',
2557
+ numberToHex(chainId),
2558
+ nonce ? numberToHex(nonce) : '0x',
2559
+ maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : '0x',
2560
+ maxFeePerGas ? numberToHex(maxFeePerGas) : '0x',
2561
+ gas ? numberToHex(gas) : '0x',
2534
2562
  to ?? '0x',
2535
- value ? toHex(value) : '0x',
2563
+ value ? numberToHex(value) : '0x',
2536
2564
  data ?? '0x',
2537
2565
  serializedAccessList,
2538
2566
  serializedAuthorizationList,
@@ -2568,16 +2596,16 @@ function serializeTransactionEIP4844(transaction, signature) {
2568
2596
  }
2569
2597
  const serializedAccessList = serializeAccessList(accessList);
2570
2598
  const serializedTransaction = [
2571
- toHex(chainId),
2572
- nonce ? toHex(nonce) : '0x',
2573
- maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : '0x',
2574
- maxFeePerGas ? toHex(maxFeePerGas) : '0x',
2575
- gas ? toHex(gas) : '0x',
2599
+ numberToHex(chainId),
2600
+ nonce ? numberToHex(nonce) : '0x',
2601
+ maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : '0x',
2602
+ maxFeePerGas ? numberToHex(maxFeePerGas) : '0x',
2603
+ gas ? numberToHex(gas) : '0x',
2576
2604
  to ?? '0x',
2577
- value ? toHex(value) : '0x',
2605
+ value ? numberToHex(value) : '0x',
2578
2606
  data ?? '0x',
2579
2607
  serializedAccessList,
2580
- maxFeePerBlobGas ? toHex(maxFeePerBlobGas) : '0x',
2608
+ maxFeePerBlobGas ? numberToHex(maxFeePerBlobGas) : '0x',
2581
2609
  blobVersionedHashes ?? [],
2582
2610
  ...toYParitySignatureArray(transaction, signature),
2583
2611
  ];
@@ -2605,13 +2633,13 @@ function serializeTransactionEIP1559(transaction, signature) {
2605
2633
  assertTransactionEIP1559(transaction);
2606
2634
  const serializedAccessList = serializeAccessList(accessList);
2607
2635
  const serializedTransaction = [
2608
- toHex(chainId),
2609
- nonce ? toHex(nonce) : '0x',
2610
- maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : '0x',
2611
- maxFeePerGas ? toHex(maxFeePerGas) : '0x',
2612
- gas ? toHex(gas) : '0x',
2636
+ numberToHex(chainId),
2637
+ nonce ? numberToHex(nonce) : '0x',
2638
+ maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : '0x',
2639
+ maxFeePerGas ? numberToHex(maxFeePerGas) : '0x',
2640
+ gas ? numberToHex(gas) : '0x',
2613
2641
  to ?? '0x',
2614
- value ? toHex(value) : '0x',
2642
+ value ? numberToHex(value) : '0x',
2615
2643
  data ?? '0x',
2616
2644
  serializedAccessList,
2617
2645
  ...toYParitySignatureArray(transaction, signature),
@@ -2626,12 +2654,12 @@ function serializeTransactionEIP2930(transaction, signature) {
2626
2654
  assertTransactionEIP2930(transaction);
2627
2655
  const serializedAccessList = serializeAccessList(accessList);
2628
2656
  const serializedTransaction = [
2629
- toHex(chainId),
2630
- nonce ? toHex(nonce) : '0x',
2631
- gasPrice ? toHex(gasPrice) : '0x',
2632
- gas ? toHex(gas) : '0x',
2657
+ numberToHex(chainId),
2658
+ nonce ? numberToHex(nonce) : '0x',
2659
+ gasPrice ? numberToHex(gasPrice) : '0x',
2660
+ gas ? numberToHex(gas) : '0x',
2633
2661
  to ?? '0x',
2634
- value ? toHex(value) : '0x',
2662
+ value ? numberToHex(value) : '0x',
2635
2663
  data ?? '0x',
2636
2664
  serializedAccessList,
2637
2665
  ...toYParitySignatureArray(transaction, signature),
@@ -2645,11 +2673,11 @@ function serializeTransactionLegacy(transaction, signature) {
2645
2673
  const { chainId = 0, gas, data, nonce, to, value, gasPrice } = transaction;
2646
2674
  assertTransactionLegacy(transaction);
2647
2675
  let serializedTransaction = [
2648
- nonce ? toHex(nonce) : '0x',
2649
- gasPrice ? toHex(gasPrice) : '0x',
2650
- gas ? toHex(gas) : '0x',
2676
+ nonce ? numberToHex(nonce) : '0x',
2677
+ gasPrice ? numberToHex(gasPrice) : '0x',
2678
+ gas ? numberToHex(gas) : '0x',
2651
2679
  to ?? '0x',
2652
- value ? toHex(value) : '0x',
2680
+ value ? numberToHex(value) : '0x',
2653
2681
  data ?? '0x',
2654
2682
  ];
2655
2683
  if (signature) {
@@ -2674,7 +2702,7 @@ function serializeTransactionLegacy(transaction, signature) {
2674
2702
  const s = trim(signature.s);
2675
2703
  serializedTransaction = [
2676
2704
  ...serializedTransaction,
2677
- toHex(v),
2705
+ numberToHex(v),
2678
2706
  r === '0x00' ? '0x' : r,
2679
2707
  s === '0x00' ? '0x' : s,
2680
2708
  ];
@@ -2682,7 +2710,7 @@ function serializeTransactionLegacy(transaction, signature) {
2682
2710
  else if (chainId > 0) {
2683
2711
  serializedTransaction = [
2684
2712
  ...serializedTransaction,
2685
- toHex(chainId),
2713
+ numberToHex(chainId),
2686
2714
  '0x',
2687
2715
  '0x',
2688
2716
  ];
@@ -2702,12 +2730,12 @@ function toYParitySignatureArray(transaction, signature_) {
2702
2730
  const s = trim(signature.s);
2703
2731
  const yParity_ = (() => {
2704
2732
  if (typeof yParity === 'number')
2705
- return yParity ? toHex(1) : '0x';
2733
+ return yParity ? numberToHex(1) : '0x';
2706
2734
  if (v === 0n)
2707
2735
  return '0x';
2708
2736
  if (v === 1n)
2709
- return toHex(1);
2710
- return v === 27n ? '0x' : toHex(1);
2737
+ return numberToHex(1);
2738
+ return v === 27n ? '0x' : numberToHex(1);
2711
2739
  })();
2712
2740
  return [yParity_, r === '0x00' ? '0x' : r, s === '0x00' ? '0x' : s];
2713
2741
  }
@@ -2818,12 +2846,13 @@ function assertTransactionDeposit(transaction) {
2818
2846
  }
2819
2847
 
2820
2848
  const chainConfig$1 = {
2849
+ blockTime: 2_000,
2821
2850
  contracts,
2822
2851
  formatters: formatters$1,
2823
2852
  serializers: serializers$1,
2824
2853
  };
2825
2854
 
2826
- const sourceId$K = 1; // mainnet
2855
+ const sourceId$M = 1; // mainnet
2827
2856
  /*#__PURE__*/ defineChain({
2828
2857
  ...chainConfig$1,
2829
2858
  id: 888888888,
@@ -2844,27 +2873,27 @@ const sourceId$K = 1; // mainnet
2844
2873
  contracts: {
2845
2874
  ...chainConfig$1.contracts,
2846
2875
  l2OutputOracle: {
2847
- [sourceId$K]: {
2876
+ [sourceId$M]: {
2848
2877
  address: '0xB09DC08428C8b4EFB4ff9C0827386CDF34277996',
2849
2878
  },
2850
2879
  },
2851
2880
  portal: {
2852
- [sourceId$K]: {
2881
+ [sourceId$M]: {
2853
2882
  address: '0x639F2AECE398Aa76b07e59eF6abe2cFe32bacb68',
2854
2883
  blockCreated: 19070571,
2855
2884
  },
2856
2885
  },
2857
2886
  l1StandardBridge: {
2858
- [sourceId$K]: {
2887
+ [sourceId$M]: {
2859
2888
  address: '0xd5e3eDf5b68135D559D572E26bF863FBC1950033',
2860
2889
  blockCreated: 19070571,
2861
2890
  },
2862
2891
  },
2863
2892
  },
2864
- sourceId: sourceId$K,
2893
+ sourceId: sourceId$M,
2865
2894
  });
2866
2895
 
2867
- const sourceId$J = 11_155_111; // sepolia
2896
+ const sourceId$L = 11_155_111; // sepolia
2868
2897
  /*#__PURE__*/ defineChain({
2869
2898
  ...chainConfig$1,
2870
2899
  id: 28122024,
@@ -2885,27 +2914,27 @@ const sourceId$J = 11_155_111; // sepolia
2885
2914
  contracts: {
2886
2915
  ...chainConfig$1.contracts,
2887
2916
  l2OutputOracle: {
2888
- [sourceId$J]: {
2917
+ [sourceId$L]: {
2889
2918
  address: '0x942fD5017c0F60575930D8574Eaca13BEcD6e1bB',
2890
2919
  },
2891
2920
  },
2892
2921
  portal: {
2893
- [sourceId$J]: {
2922
+ [sourceId$L]: {
2894
2923
  address: '0xfa1d9E26A6aCD7b22115D27572c1221B9803c960',
2895
2924
  blockCreated: 4972908,
2896
2925
  },
2897
2926
  },
2898
2927
  l1StandardBridge: {
2899
- [sourceId$J]: {
2928
+ [sourceId$L]: {
2900
2929
  address: '0xF6Bc0146d3c74D48306e79Ae134A260E418C9335',
2901
2930
  blockCreated: 4972908,
2902
2931
  },
2903
2932
  },
2904
2933
  },
2905
- sourceId: sourceId$J,
2934
+ sourceId: sourceId$L,
2906
2935
  });
2907
2936
 
2908
- const sourceId$I = 1; // mainnet
2937
+ const sourceId$K = 1; // mainnet
2909
2938
  const base = /*#__PURE__*/ defineChain({
2910
2939
  ...chainConfig$1,
2911
2940
  id: 8453,
@@ -2926,12 +2955,12 @@ const base = /*#__PURE__*/ defineChain({
2926
2955
  contracts: {
2927
2956
  ...chainConfig$1.contracts,
2928
2957
  disputeGameFactory: {
2929
- [sourceId$I]: {
2958
+ [sourceId$K]: {
2930
2959
  address: '0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e',
2931
2960
  },
2932
2961
  },
2933
2962
  l2OutputOracle: {
2934
- [sourceId$I]: {
2963
+ [sourceId$K]: {
2935
2964
  address: '0x56315b90c40730925ec5485cf004d835058518A0',
2936
2965
  },
2937
2966
  },
@@ -2940,22 +2969,22 @@ const base = /*#__PURE__*/ defineChain({
2940
2969
  blockCreated: 5022,
2941
2970
  },
2942
2971
  portal: {
2943
- [sourceId$I]: {
2972
+ [sourceId$K]: {
2944
2973
  address: '0x49048044D57e1C92A77f79988d21Fa8fAF74E97e',
2945
2974
  blockCreated: 17482143,
2946
2975
  },
2947
2976
  },
2948
2977
  l1StandardBridge: {
2949
- [sourceId$I]: {
2978
+ [sourceId$K]: {
2950
2979
  address: '0x3154Cf16ccdb4C6d922629664174b904d80F2C35',
2951
2980
  blockCreated: 17482143,
2952
2981
  },
2953
2982
  },
2954
2983
  },
2955
- sourceId: sourceId$I,
2984
+ sourceId: sourceId$K,
2956
2985
  });
2957
2986
 
2958
- const sourceId$H = 5; // goerli
2987
+ const sourceId$J = 5; // goerli
2959
2988
  /*#__PURE__*/ defineChain({
2960
2989
  ...chainConfig$1,
2961
2990
  id: 84531,
@@ -2974,7 +3003,7 @@ const sourceId$H = 5; // goerli
2974
3003
  contracts: {
2975
3004
  ...chainConfig$1.contracts,
2976
3005
  l2OutputOracle: {
2977
- [sourceId$H]: {
3006
+ [sourceId$J]: {
2978
3007
  address: '0x2A35891ff30313CcFa6CE88dcf3858bb075A2298',
2979
3008
  },
2980
3009
  },
@@ -2983,21 +3012,21 @@ const sourceId$H = 5; // goerli
2983
3012
  blockCreated: 1376988,
2984
3013
  },
2985
3014
  portal: {
2986
- [sourceId$H]: {
3015
+ [sourceId$J]: {
2987
3016
  address: '0xe93c8cD0D409341205A592f8c4Ac1A5fe5585cfA',
2988
3017
  },
2989
3018
  },
2990
3019
  l1StandardBridge: {
2991
- [sourceId$H]: {
3020
+ [sourceId$J]: {
2992
3021
  address: '0xfA6D8Ee5BE770F84FC001D098C4bD604Fe01284a',
2993
3022
  },
2994
3023
  },
2995
3024
  },
2996
3025
  testnet: true,
2997
- sourceId: sourceId$H,
3026
+ sourceId: sourceId$J,
2998
3027
  });
2999
3028
 
3000
- const sourceId$G = 11_155_111; // sepolia
3029
+ const sourceId$I = 11_155_111; // sepolia
3001
3030
  const baseSepolia = /*#__PURE__*/ defineChain({
3002
3031
  ...chainConfig$1,
3003
3032
  id: 84532,
@@ -3019,23 +3048,23 @@ const baseSepolia = /*#__PURE__*/ defineChain({
3019
3048
  contracts: {
3020
3049
  ...chainConfig$1.contracts,
3021
3050
  disputeGameFactory: {
3022
- [sourceId$G]: {
3051
+ [sourceId$I]: {
3023
3052
  address: '0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1',
3024
3053
  },
3025
3054
  },
3026
3055
  l2OutputOracle: {
3027
- [sourceId$G]: {
3056
+ [sourceId$I]: {
3028
3057
  address: '0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254',
3029
3058
  },
3030
3059
  },
3031
3060
  portal: {
3032
- [sourceId$G]: {
3061
+ [sourceId$I]: {
3033
3062
  address: '0x49f53e41452c74589e85ca1677426ba426459e85',
3034
3063
  blockCreated: 4446677,
3035
3064
  },
3036
3065
  },
3037
3066
  l1StandardBridge: {
3038
- [sourceId$G]: {
3067
+ [sourceId$I]: {
3039
3068
  address: '0xfd0Bf71F60660E2f608ed56e1659C450eB113120',
3040
3069
  blockCreated: 4446677,
3041
3070
  },
@@ -3046,7 +3075,7 @@ const baseSepolia = /*#__PURE__*/ defineChain({
3046
3075
  },
3047
3076
  },
3048
3077
  testnet: true,
3049
- sourceId: sourceId$G,
3078
+ sourceId: sourceId$I,
3050
3079
  });
3051
3080
 
3052
3081
  defineChain({
@@ -3067,7 +3096,7 @@ defineChain({
3067
3096
  },
3068
3097
  });
3069
3098
 
3070
- const sourceId$F = 1; // mainnet
3099
+ const sourceId$H = 1; // mainnet
3071
3100
  /*#__PURE__*/ defineChain({
3072
3101
  ...chainConfig$1,
3073
3102
  id: 81457,
@@ -3093,11 +3122,29 @@ const sourceId$F = 1; // mainnet
3093
3122
  address: '0xcA11bde05977b3631167028862bE2a173976CA11',
3094
3123
  blockCreated: 212929,
3095
3124
  },
3125
+ l2OutputOracle: {
3126
+ [sourceId$H]: {
3127
+ address: '0x826D1B0D4111Ad9146Eb8941D7Ca2B6a44215c76',
3128
+ blockCreated: 19300358,
3129
+ },
3130
+ },
3131
+ portal: {
3132
+ [sourceId$H]: {
3133
+ address: '0x0Ec68c5B10F21EFFb74f2A5C61DFe6b08C0Db6Cb',
3134
+ blockCreated: 19300357,
3135
+ },
3136
+ },
3137
+ l1StandardBridge: {
3138
+ [sourceId$H]: {
3139
+ address: '0x697402166Fbf2F22E970df8a6486Ef171dbfc524',
3140
+ blockCreated: 19300360,
3141
+ },
3142
+ },
3096
3143
  },
3097
- sourceId: sourceId$F,
3144
+ sourceId: sourceId$H,
3098
3145
  });
3099
3146
 
3100
- const sourceId$E = 1; // mainnet
3147
+ const sourceId$G = 1; // mainnet
3101
3148
  defineChain({
3102
3149
  ...chainConfig$1,
3103
3150
  id: 60808,
@@ -3126,22 +3173,22 @@ defineChain({
3126
3173
  blockCreated: 23131,
3127
3174
  },
3128
3175
  l2OutputOracle: {
3129
- [sourceId$E]: {
3176
+ [sourceId$G]: {
3130
3177
  address: '0xdDa53E23f8a32640b04D7256e651C1db98dB11C1',
3131
3178
  blockCreated: 4462615,
3132
3179
  },
3133
3180
  },
3134
3181
  portal: {
3135
- [sourceId$E]: {
3182
+ [sourceId$G]: {
3136
3183
  address: '0x8AdeE124447435fE03e3CD24dF3f4cAE32E65a3E',
3137
3184
  blockCreated: 4462615,
3138
3185
  },
3139
3186
  },
3140
3187
  },
3141
- sourceId: sourceId$E,
3188
+ sourceId: sourceId$G,
3142
3189
  });
3143
3190
 
3144
- const sourceId$D = 11_155_111; // sepolia
3191
+ const sourceId$F = 11_155_111; // sepolia
3145
3192
  defineChain({
3146
3193
  ...chainConfig$1,
3147
3194
  id: 808813,
@@ -3170,20 +3217,20 @@ defineChain({
3170
3217
  blockCreated: 35677,
3171
3218
  },
3172
3219
  l2OutputOracle: {
3173
- [sourceId$D]: {
3220
+ [sourceId$F]: {
3174
3221
  address: '0x14D0069452b4AE2b250B395b8adAb771E4267d2f',
3175
3222
  blockCreated: 4462615,
3176
3223
  },
3177
3224
  },
3178
3225
  portal: {
3179
- [sourceId$D]: {
3226
+ [sourceId$F]: {
3180
3227
  address: '0x867B1Aa872b9C8cB5E9F7755feDC45BB24Ad0ae4',
3181
3228
  blockCreated: 4462615,
3182
3229
  },
3183
3230
  },
3184
3231
  },
3185
3232
  testnet: true,
3186
- sourceId: sourceId$D,
3233
+ sourceId: sourceId$F,
3187
3234
  });
3188
3235
 
3189
3236
  const fees = {
@@ -3392,13 +3439,14 @@ function assertTransactionCIP64(transaction) {
3392
3439
  }
3393
3440
 
3394
3441
  const chainConfig = {
3442
+ blockTime: 1_000,
3395
3443
  contracts,
3396
3444
  formatters,
3397
3445
  serializers,
3398
3446
  fees,
3399
3447
  };
3400
3448
 
3401
- const sourceId$C = 17000; // holsky
3449
+ const sourceId$E = 17000; // holsky
3402
3450
  // source https://storage.googleapis.com/cel2-rollup-files/alfajores/deployment-l1.json
3403
3451
  /*#__PURE__*/ defineChain({
3404
3452
  ...chainConfig,
@@ -3428,25 +3476,25 @@ const sourceId$C = 17000; // holsky
3428
3476
  blockCreated: 14569001,
3429
3477
  },
3430
3478
  portal: {
3431
- [sourceId$C]: {
3479
+ [sourceId$E]: {
3432
3480
  address: '0x82527353927d8D069b3B452904c942dA149BA381',
3433
3481
  blockCreated: 2411324,
3434
3482
  },
3435
3483
  },
3436
3484
  disputeGameFactory: {
3437
- [sourceId$C]: {
3485
+ [sourceId$E]: {
3438
3486
  address: '0xE28AAdcd9883746c0e5068F58f9ea06027b214cb',
3439
3487
  blockCreated: 2411324,
3440
3488
  },
3441
3489
  },
3442
3490
  l2OutputOracle: {
3443
- [sourceId$C]: {
3491
+ [sourceId$E]: {
3444
3492
  address: '0x4a2635e9e4f6e45817b1D402ac4904c1d1752438',
3445
3493
  blockCreated: 2411324,
3446
3494
  },
3447
3495
  },
3448
3496
  l1StandardBridge: {
3449
- [sourceId$C]: {
3497
+ [sourceId$E]: {
3450
3498
  address: '0xD1B0E0581973c9eB7f886967A606b9441A897037',
3451
3499
  blockCreated: 2411324,
3452
3500
  },
@@ -3455,6 +3503,57 @@ const sourceId$C = 17000; // holsky
3455
3503
  testnet: true,
3456
3504
  });
3457
3505
 
3506
+ const sourceId$D = 11_155_111; // sepolia
3507
+ // source https://storage.googleapis.com/cel2-rollup-files/celo-sepolia/deployment-l1.json
3508
+ /*#__PURE__*/ defineChain({
3509
+ ...chainConfig,
3510
+ id: 11_142_220,
3511
+ name: 'Celo Sepolia Testnet',
3512
+ nativeCurrency: {
3513
+ decimals: 18,
3514
+ name: 'CELO',
3515
+ symbol: 'S-CELO',
3516
+ },
3517
+ rpcUrls: {
3518
+ default: {
3519
+ http: ['https://forno.celo-sepolia.celo-testnet.org'],
3520
+ },
3521
+ },
3522
+ blockExplorers: {
3523
+ default: {
3524
+ name: 'Celo Sepolia Explorer',
3525
+ url: 'https://celo-sepolia.blockscout.com/',
3526
+ apiUrl: 'https://celo-sepolia.blockscout.com/api',
3527
+ },
3528
+ },
3529
+ contracts: {
3530
+ ...chainConfig.contracts,
3531
+ multicall3: {
3532
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
3533
+ blockCreated: 1,
3534
+ },
3535
+ portal: {
3536
+ [sourceId$D]: {
3537
+ address: '0x44ae3d41a335a7d05eb533029917aad35662dcc2',
3538
+ blockCreated: 8825790,
3539
+ },
3540
+ },
3541
+ disputeGameFactory: {
3542
+ [sourceId$D]: {
3543
+ address: '0x57c45d82d1a995f1e135b8d7edc0a6bb5211cfaa',
3544
+ blockCreated: 8825790,
3545
+ },
3546
+ },
3547
+ l1StandardBridge: {
3548
+ [sourceId$D]: {
3549
+ address: '0xec18a3c30131a0db4246e785355fbc16e2eaf408',
3550
+ blockCreated: 8825790,
3551
+ },
3552
+ },
3553
+ },
3554
+ testnet: true,
3555
+ });
3556
+
3458
3557
  defineChain({
3459
3558
  id: 44,
3460
3559
  name: 'Crab Network',
@@ -3569,7 +3668,7 @@ defineChain({
3569
3668
  testnet: true,
3570
3669
  });
3571
3670
 
3572
- const sourceId$B = 1; // mainnet
3671
+ const sourceId$C = 1; // mainnet
3573
3672
  /*#__PURE__*/ defineChain({
3574
3673
  id: 478,
3575
3674
  name: 'Form Network',
@@ -3593,27 +3692,27 @@ const sourceId$B = 1; // mainnet
3593
3692
  contracts: {
3594
3693
  ...chainConfig$1.contracts,
3595
3694
  addressManager: {
3596
- [sourceId$B]: {
3695
+ [sourceId$C]: {
3597
3696
  address: '0x15c249E46A2F924C2dB3A1560CF86729bAD1f07B',
3598
3697
  },
3599
3698
  },
3600
3699
  l1CrossDomainMessenger: {
3601
- [sourceId$B]: {
3700
+ [sourceId$C]: {
3602
3701
  address: '0xF333158DCCad1dF6C3F0a3aEe8BC31fA94d9eD5c',
3603
3702
  },
3604
3703
  },
3605
3704
  l2OutputOracle: {
3606
- [sourceId$B]: {
3705
+ [sourceId$C]: {
3607
3706
  address: '0x4ccAAF69F41c5810cA875183648B577CaCf1F67E',
3608
3707
  },
3609
3708
  },
3610
3709
  portal: {
3611
- [sourceId$B]: {
3710
+ [sourceId$C]: {
3612
3711
  address: '0x4E259Ee5F4136408908160dD32295A5031Fa426F',
3613
3712
  },
3614
3713
  },
3615
3714
  l1StandardBridge: {
3616
- [sourceId$B]: {
3715
+ [sourceId$C]: {
3617
3716
  address: '0xdc20aA63D3DE59574E065957190D8f24e0F7B8Ba',
3618
3717
  },
3619
3718
  },
@@ -3621,10 +3720,10 @@ const sourceId$B = 1; // mainnet
3621
3720
  address: '0xcA11bde05977b3631167028862bE2a173976CA11',
3622
3721
  },
3623
3722
  },
3624
- sourceId: sourceId$B,
3723
+ sourceId: sourceId$C,
3625
3724
  });
3626
3725
 
3627
- const sourceId$A = 11_155_111; // sepolia
3726
+ const sourceId$B = 11_155_111; // sepolia
3628
3727
  /*#__PURE__*/ defineChain({
3629
3728
  id: 132_902,
3630
3729
  name: 'Form Testnet',
@@ -3648,27 +3747,27 @@ const sourceId$A = 11_155_111; // sepolia
3648
3747
  contracts: {
3649
3748
  ...chainConfig$1.contracts,
3650
3749
  addressManager: {
3651
- [sourceId$A]: {
3750
+ [sourceId$B]: {
3652
3751
  address: '0xd5C38fa934f7fd7477D4800F4f38a1c5BFdF1373',
3653
3752
  },
3654
3753
  },
3655
3754
  l1CrossDomainMessenger: {
3656
- [sourceId$A]: {
3755
+ [sourceId$B]: {
3657
3756
  address: '0x37A68565c4BE9700b3E3Ec60cC4416cAC3052FAa',
3658
3757
  },
3659
3758
  },
3660
3759
  l2OutputOracle: {
3661
- [sourceId$A]: {
3760
+ [sourceId$B]: {
3662
3761
  address: '0x9eA2239E65a59EC9C7F1ED4C116dD58Da71Fc1e2',
3663
3762
  },
3664
3763
  },
3665
3764
  portal: {
3666
- [sourceId$A]: {
3765
+ [sourceId$B]: {
3667
3766
  address: '0x60377e3cE15dF4CCA24c4beF076b60314240b032',
3668
3767
  },
3669
3768
  },
3670
3769
  l1StandardBridge: {
3671
- [sourceId$A]: {
3770
+ [sourceId$B]: {
3672
3771
  address: '0xD4531f633942b2725896F47cD2aFd260b44Ab1F7',
3673
3772
  },
3674
3773
  },
@@ -3677,10 +3776,10 @@ const sourceId$A = 11_155_111; // sepolia
3677
3776
  },
3678
3777
  },
3679
3778
  testnet: true,
3680
- sourceId: sourceId$A,
3779
+ sourceId: sourceId$B,
3681
3780
  });
3682
3781
 
3683
- const sourceId$z = 1; // mainnet
3782
+ const sourceId$A = 1; // mainnet
3684
3783
  /*#__PURE__*/ defineChain({
3685
3784
  ...chainConfig$1,
3686
3785
  id: 252,
@@ -3701,7 +3800,7 @@ const sourceId$z = 1; // mainnet
3701
3800
  contracts: {
3702
3801
  ...chainConfig$1.contracts,
3703
3802
  l2OutputOracle: {
3704
- [sourceId$z]: {
3803
+ [sourceId$A]: {
3705
3804
  address: '0x66CC916Ed5C6C2FA97014f7D1cD141528Ae171e4',
3706
3805
  },
3707
3806
  },
@@ -3709,22 +3808,22 @@ const sourceId$z = 1; // mainnet
3709
3808
  address: '0xca11bde05977b3631167028862be2a173976ca11',
3710
3809
  },
3711
3810
  portal: {
3712
- [sourceId$z]: {
3811
+ [sourceId$A]: {
3713
3812
  address: '0x36cb65c1967A0Fb0EEE11569C51C2f2aA1Ca6f6D',
3714
3813
  blockCreated: 19135323,
3715
3814
  },
3716
3815
  },
3717
3816
  l1StandardBridge: {
3718
- [sourceId$z]: {
3817
+ [sourceId$A]: {
3719
3818
  address: '0x34C0bD5877A5Ee7099D0f5688D65F4bB9158BDE2',
3720
3819
  blockCreated: 19135323,
3721
3820
  },
3722
3821
  },
3723
3822
  },
3724
- sourceId: sourceId$z,
3823
+ sourceId: sourceId$A,
3725
3824
  });
3726
3825
 
3727
- const sourceId$y = 17000; // holesky
3826
+ const sourceId$z = 17000; // holesky
3728
3827
  /*#__PURE__*/ defineChain({
3729
3828
  ...chainConfig$1,
3730
3829
  id: 2522,
@@ -3745,7 +3844,7 @@ const sourceId$y = 17000; // holesky
3745
3844
  contracts: {
3746
3845
  ...chainConfig$1.contracts,
3747
3846
  l2OutputOracle: {
3748
- [sourceId$y]: {
3847
+ [sourceId$z]: {
3749
3848
  address: '0x715EA64DA13F4d0831ece4Ad3E8c1aa013167F32',
3750
3849
  },
3751
3850
  },
@@ -3753,22 +3852,22 @@ const sourceId$y = 17000; // holesky
3753
3852
  address: '0xca11bde05977b3631167028862be2a173976ca11',
3754
3853
  },
3755
3854
  portal: {
3756
- [sourceId$y]: {
3855
+ [sourceId$z]: {
3757
3856
  address: '0xB9c64BfA498d5b9a8398Ed6f46eb76d90dE5505d',
3758
3857
  blockCreated: 318416,
3759
3858
  },
3760
3859
  },
3761
3860
  l1StandardBridge: {
3762
- [sourceId$y]: {
3861
+ [sourceId$z]: {
3763
3862
  address: '0x0BaafC217162f64930909aD9f2B27125121d6332',
3764
3863
  blockCreated: 318416,
3765
3864
  },
3766
3865
  },
3767
3866
  },
3768
- sourceId: sourceId$y,
3867
+ sourceId: sourceId$z,
3769
3868
  });
3770
3869
 
3771
- const sourceId$x = 1; // mainnet
3870
+ const sourceId$y = 1; // mainnet
3772
3871
  /*#__PURE__*/ defineChain({
3773
3872
  ...chainConfig$1,
3774
3873
  id: 33979,
@@ -3788,10 +3887,10 @@ const sourceId$x = 1; // mainnet
3788
3887
  contracts: {
3789
3888
  ...chainConfig$1.contracts,
3790
3889
  },
3791
- sourceId: sourceId$x,
3890
+ sourceId: sourceId$y,
3792
3891
  });
3793
3892
 
3794
- const sourceId$w = 11_155_111; // sepolia
3893
+ const sourceId$x = 11_155_111; // sepolia
3795
3894
  defineChain({
3796
3895
  ...chainConfig$1,
3797
3896
  id: 3397901,
@@ -3817,16 +3916,16 @@ defineChain({
3817
3916
  blockCreated: 1620204,
3818
3917
  },
3819
3918
  },
3820
- sourceId: sourceId$w,
3919
+ sourceId: sourceId$x,
3821
3920
  });
3822
3921
 
3823
- const sourceId$v = 17000; // Holesky testnet
3922
+ const sourceId$w = 17000; // Holesky testnet
3824
3923
  defineChain({
3825
3924
  ...chainConfig$1,
3826
3925
  name: 'Garnet Testnet',
3827
3926
  testnet: true,
3828
3927
  id: 17069,
3829
- sourceId: sourceId$v,
3928
+ sourceId: sourceId$w,
3830
3929
  nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
3831
3930
  rpcUrls: {
3832
3931
  default: {
@@ -3846,19 +3945,19 @@ defineChain({
3846
3945
  address: '0xca11bde05977b3631167028862be2a173976ca11',
3847
3946
  },
3848
3947
  portal: {
3849
- [sourceId$v]: {
3948
+ [sourceId$w]: {
3850
3949
  address: '0x57ee40586fbE286AfC75E67cb69511A6D9aF5909',
3851
3950
  blockCreated: 1274684,
3852
3951
  },
3853
3952
  },
3854
3953
  l2OutputOracle: {
3855
- [sourceId$v]: {
3954
+ [sourceId$w]: {
3856
3955
  address: '0xCb8E7AC561b8EF04F2a15865e9fbc0766FEF569B',
3857
3956
  blockCreated: 1274684,
3858
3957
  },
3859
3958
  },
3860
3959
  l1StandardBridge: {
3861
- [sourceId$v]: {
3960
+ [sourceId$w]: {
3862
3961
  address: '0x09bcDd311FE398F80a78BE37E489f5D440DB95DE',
3863
3962
  blockCreated: 1274684,
3864
3963
  },
@@ -3866,6 +3965,52 @@ defineChain({
3866
3965
  },
3867
3966
  });
3868
3967
 
3968
+ const sourceId$v = 11_155_111; // sepolia
3969
+ /*#__PURE__*/ defineChain({
3970
+ ...chainConfig$1,
3971
+ id: 91342,
3972
+ network: 'giwa-sepolia',
3973
+ name: 'GIWA Sepolia',
3974
+ nativeCurrency: { name: 'Sepolia Ether', symbol: 'ETH', decimals: 18 },
3975
+ blockTime: 1_000,
3976
+ rpcUrls: {
3977
+ default: {
3978
+ http: ['https://sepolia-rpc.giwa.io'],
3979
+ },
3980
+ },
3981
+ blockExplorers: {
3982
+ default: {
3983
+ name: 'Blockscout',
3984
+ url: 'https://sepolia-explorer.giwa.io',
3985
+ apiUrl: 'https://sepolia-explorer.giwa.io/api',
3986
+ },
3987
+ },
3988
+ contracts: {
3989
+ ...chainConfig$1.contracts,
3990
+ multicall3: {
3991
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
3992
+ blockCreated: 0,
3993
+ },
3994
+ disputeGameFactory: {
3995
+ [sourceId$v]: {
3996
+ address: '0x37347caB2afaa49B776372279143D71ad1f354F6',
3997
+ },
3998
+ },
3999
+ portal: {
4000
+ [sourceId$v]: {
4001
+ address: '0x956962C34687A954e611A83619ABaA37Ce6bC78A',
4002
+ },
4003
+ },
4004
+ l1StandardBridge: {
4005
+ [sourceId$v]: {
4006
+ address: '0x77b2ffc0F57598cAe1DB76cb398059cF5d10A7E7',
4007
+ },
4008
+ },
4009
+ },
4010
+ testnet: true,
4011
+ sourceId: sourceId$v,
4012
+ });
4013
+
3869
4014
  const sourceId$u = 1; // mainnet
3870
4015
  /*#__PURE__*/ defineChain({
3871
4016
  ...chainConfig$1,
@@ -4218,9 +4363,9 @@ function encodeBytes(value, { param }) {
4218
4363
  encoded: concat([padHex(numberToHex(bytesSize, { size: 32 })), value_]),
4219
4364
  };
4220
4365
  }
4221
- if (bytesSize !== Number.parseInt(paramSize))
4366
+ if (bytesSize !== Number.parseInt(paramSize, 10))
4222
4367
  throw new AbiEncodingBytesSizeMismatchError({
4223
- expectedSize: Number.parseInt(paramSize),
4368
+ expectedSize: Number.parseInt(paramSize, 10),
4224
4369
  value,
4225
4370
  });
4226
4371
  return { dynamic: false, encoded: padHex(value, { dir: 'right' }) };
@@ -4530,6 +4675,25 @@ const sourceId$o = 11_155_111; // sepolia
4530
4675
  sourceId: sourceId$o,
4531
4676
  });
4532
4677
 
4678
+ defineChain({
4679
+ id: 166,
4680
+ name: 'Omni',
4681
+ nativeCurrency: { name: 'Omni', symbol: 'OMNI', decimals: 18 },
4682
+ rpcUrls: {
4683
+ default: {
4684
+ http: ['https://mainnet.omni.network'],
4685
+ webSocket: ['wss://mainnet.omni.network'],
4686
+ },
4687
+ },
4688
+ blockExplorers: {
4689
+ default: {
4690
+ name: 'OmniScan',
4691
+ url: 'https://omniscan.network',
4692
+ },
4693
+ },
4694
+ testnet: false,
4695
+ });
4696
+
4533
4697
  const sourceId$n = 56; // bsc mainnet
4534
4698
  /*#__PURE__*/ defineChain({
4535
4699
  id: 204,
@@ -5349,6 +5513,7 @@ const sourceId$6 = 1; // mainnet
5349
5513
  id: 130,
5350
5514
  name: 'Unichain',
5351
5515
  nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
5516
+ blockTime: 1_000,
5352
5517
  rpcUrls: {
5353
5518
  default: {
5354
5519
  http: ['https://mainnet.unichain.org/'],
@@ -5396,6 +5561,7 @@ const sourceId$5 = 11_155_111; // sepolia
5396
5561
  symbol: 'ETH',
5397
5562
  decimals: 18,
5398
5563
  },
5564
+ blockTime: 1_000,
5399
5565
  rpcUrls: {
5400
5566
  default: {
5401
5567
  http: ['https://sepolia.unichain.org'],
@@ -5678,8 +5844,8 @@ const sourceId = 5; // goerli
5678
5844
  });
5679
5845
 
5680
5846
  const FlaunchZapAddress = {
5681
- [base.id]: "0xe52dE1801C10cF709cc8e62d43D783AFe984b510",
5682
- [baseSepolia.id]: "0xf0Fd8Bb98c050607d999D6fFF9C617edD6673b75",
5847
+ [base.id]: "0x39112541720078c70164EA4Deb61F0A4811910F9",
5848
+ [baseSepolia.id]: "0x25b747aeca2612b9804b5c3bb272a3daefdc6eaa",
5683
5849
  };
5684
5850
  // only old V1.0: doesn't use FeeEscrow
5685
5851
  const FlaunchPositionManagerAddress = {
@@ -5748,13 +5914,17 @@ const AddressFeeSplitManagerAddress = {
5748
5914
  [base.id]: "0xfAB4BA48a322Efc8b25815448BE6018D211e89f3",
5749
5915
  [baseSepolia.id]: "0x0A3AF63cd86E68a852A1D4923FEfC4e855D8499d",
5750
5916
  };
5917
+ const DynamicAddressFeeSplitManagerAddress = {
5918
+ [base.id]: "0x9b332EA14a99B74cAB03A3D3178964eD9CE35fc8",
5919
+ [baseSepolia.id]: "0x4882075542626721C8743D80DC9528e2f54d8A46",
5920
+ };
5751
5921
  const StakingManagerAddress = {
5752
5922
  [base.id]: "0xec0069F8DBbbC94058dc895000dd38ef40b3125d",
5753
5923
  [baseSepolia.id]: "0xB8f1cb6B4Ff8f07149276bbfA617aed7bd32d20D",
5754
5924
  };
5755
5925
  const BuyBackManagerAddress = {
5756
- [base.id]: "0x3AAF3b1D8cD5b61C77f99bA7cdf41E9eC0Ba8a3f",
5757
- [baseSepolia.id]: "0xc3947EC9d687053bBA72b36Fd6b2567e775E82C7",
5926
+ [base.id]: "0x18713855492A778363e23e2CdE325344b8fd6F8d",
5927
+ [baseSepolia.id]: "0xA4A1a2Ca68151565d5200243a52EEBbCb2C878E0",
5758
5928
  };
5759
5929
  /** Verifiers */
5760
5930
  const TokenImporterAddress = {
@@ -5801,7 +5971,7 @@ const FeeEscrowAddress = {
5801
5971
  [baseSepolia.id]: "0x73E27908b7d35A9251a54799A8ef4C17e4ED9FF9",
5802
5972
  };
5803
5973
  const ReferralEscrowAddress = {
5804
- [base.id]: "0xBD39c7Be6D98BD1a3e4Ad482baF99d738947fE55",
5974
+ [base.id]: "0xd381f8ea57df43c57cfe6e5b19a0a4700396f28c",
5805
5975
  [baseSepolia.id]: "0xd3d9047CaBE3346C70b510435866565176e8CE12",
5806
5976
  };
5807
5977
  const FLETHAddress = {
@@ -14391,6 +14561,92 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
14391
14561
  tokenUri,
14392
14562
  });
14393
14563
  }
14564
+ /**
14565
+ * Flaunches a new token with the Dynamic Address Fee Split manager.
14566
+ * Unlike static splits, recipient shares are mutable post-deployment.
14567
+ * @param params - Parameters for the flaunch with dynamic split manager
14568
+ * @returns Transaction response for the flaunch creation
14569
+ */
14570
+ async flaunchWithDynamicSplitManager(params) {
14571
+ const VALID_SHARE_TOTAL = 10000000n;
14572
+ if (params.moderator === zeroAddress) {
14573
+ throw new Error("Dynamic split moderator cannot be zero address");
14574
+ }
14575
+ if (params.creatorShare < 0n || params.managerOwnerShare < 0n) {
14576
+ throw new Error("Creator and manager owner shares cannot be negative");
14577
+ }
14578
+ if (params.creatorShare + params.managerOwnerShare > VALID_SHARE_TOTAL) {
14579
+ throw new Error("Creator and manager owner shares must be less than or equal to 100_00000");
14580
+ }
14581
+ const duplicateRecipients = new Set();
14582
+ const recipientShares = params.splitReceivers.map((receiver) => {
14583
+ if (receiver.address === zeroAddress) {
14584
+ throw new Error("Recipient address cannot be zero address");
14585
+ }
14586
+ if (receiver.share <= 0n) {
14587
+ throw new Error("Recipient share must be greater than zero");
14588
+ }
14589
+ const normalizedAddress = getAddress(receiver.address);
14590
+ if (duplicateRecipients.has(normalizedAddress)) {
14591
+ throw new Error("Duplicate recipient found in split receivers");
14592
+ }
14593
+ duplicateRecipients.add(normalizedAddress);
14594
+ return {
14595
+ recipient: normalizedAddress,
14596
+ share: receiver.share,
14597
+ };
14598
+ });
14599
+ const initializeData = encodeAbiParameters$1([
14600
+ {
14601
+ type: "tuple",
14602
+ name: "params",
14603
+ components: [
14604
+ { type: "uint256", name: "creatorShare" },
14605
+ { type: "uint256", name: "ownerShare" },
14606
+ { type: "address", name: "moderator" },
14607
+ {
14608
+ type: "tuple[]",
14609
+ name: "recipientShares",
14610
+ components: [
14611
+ { type: "address", name: "recipient" },
14612
+ { type: "uint256", name: "share" },
14613
+ ],
14614
+ },
14615
+ ],
14616
+ },
14617
+ ], [
14618
+ {
14619
+ creatorShare: params.creatorShare,
14620
+ ownerShare: params.managerOwnerShare,
14621
+ moderator: params.moderator,
14622
+ recipientShares,
14623
+ },
14624
+ ]);
14625
+ return this.flaunch({
14626
+ ...params,
14627
+ treasuryManagerParams: {
14628
+ manager: DynamicAddressFeeSplitManagerAddress[this.chainId],
14629
+ permissions: params.treasuryManagerParams?.permissions ?? Permissions.OPEN,
14630
+ initializeData,
14631
+ depositData: "0x",
14632
+ },
14633
+ });
14634
+ }
14635
+ /**
14636
+ * Flaunches a new token with dynamic split manager and stores metadata on IPFS.
14637
+ * @param params - Parameters for dynamic split manager flow including IPFS metadata
14638
+ * @returns Transaction response for the flaunch creation
14639
+ */
14640
+ async flaunchIPFSWithDynamicSplitManager(params) {
14641
+ const tokenUri = await generateTokenUri(params.name, params.symbol, {
14642
+ metadata: params.metadata,
14643
+ pinataConfig: params.pinataConfig,
14644
+ });
14645
+ return this.flaunchWithDynamicSplitManager({
14646
+ ...params,
14647
+ tokenUri,
14648
+ });
14649
+ }
14394
14650
  /**
14395
14651
  * Deploys a new revenue manager
14396
14652
  * @param params - Parameters for deploying the revenue manager
@@ -26301,278 +26557,1770 @@ const chainIdToChain = {
26301
26557
  [baseSepolia.id]: baseSepolia,
26302
26558
  };
26303
26559
 
26304
- const FastFlaunchZapAbi = [
26560
+ const DynamicAddressFeeSplitManagerAbi = [
26305
26561
  {
26306
- inputs: [
26562
+ "type": "constructor",
26563
+ "inputs": [
26307
26564
  {
26308
- internalType: "contract PositionManager",
26309
- name: "_positionManager",
26310
- type: "address",
26565
+ "name": "_treasuryManagerFactory",
26566
+ "type": "address",
26567
+ "internalType": "address"
26311
26568
  },
26569
+ {
26570
+ "name": "_feeEscrowRegistry",
26571
+ "type": "address",
26572
+ "internalType": "address"
26573
+ }
26312
26574
  ],
26313
- stateMutability: "nonpayable",
26314
- type: "constructor",
26315
- },
26316
- {
26317
- inputs: [],
26318
- name: "CREATOR_FEE_ALLOCATION",
26319
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
26320
- stateMutability: "view",
26321
- type: "function",
26322
- },
26323
- {
26324
- inputs: [],
26325
- name: "FAIR_LAUNCH_SUPPLY",
26326
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
26327
- stateMutability: "view",
26328
- type: "function",
26575
+ "stateMutability": "nonpayable"
26329
26576
  },
26330
26577
  {
26331
- inputs: [],
26332
- name: "USDC_MARKET_CAP",
26333
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
26334
- stateMutability: "view",
26335
- type: "function",
26578
+ "type": "receive",
26579
+ "stateMutability": "payable"
26336
26580
  },
26337
26581
  {
26338
- inputs: [
26582
+ "type": "function",
26583
+ "name": "MAX_CREATOR_SHARE",
26584
+ "inputs": [],
26585
+ "outputs": [
26339
26586
  {
26340
- components: [
26341
- { internalType: "string", name: "name", type: "string" },
26342
- { internalType: "string", name: "symbol", type: "string" },
26343
- { internalType: "string", name: "tokenUri", type: "string" },
26344
- { internalType: "address", name: "creator", type: "address" },
26345
- ],
26346
- internalType: "struct FastFlaunchZap.FastFlaunchParams",
26347
- name: "_params",
26348
- type: "tuple",
26349
- },
26587
+ "name": "",
26588
+ "type": "uint256",
26589
+ "internalType": "uint256"
26590
+ }
26350
26591
  ],
26351
- name: "flaunch",
26352
- outputs: [{ internalType: "address", name: "memecoin_", type: "address" }],
26353
- stateMutability: "nonpayable",
26354
- type: "function",
26592
+ "stateMutability": "view"
26355
26593
  },
26356
26594
  {
26357
- inputs: [],
26358
- name: "positionManager",
26359
- outputs: [
26360
- { internalType: "contract PositionManager", name: "", type: "address" },
26595
+ "type": "function",
26596
+ "name": "MAX_OWNER_SHARE",
26597
+ "inputs": [],
26598
+ "outputs": [
26599
+ {
26600
+ "name": "",
26601
+ "type": "uint256",
26602
+ "internalType": "uint256"
26603
+ }
26361
26604
  ],
26362
- stateMutability: "view",
26363
- type: "function",
26364
- },
26365
- ];
26366
-
26367
- const FLETHAbi = [
26368
- {
26369
- inputs: [{ internalType: "uint256", name: "wethAmount", type: "uint256" }],
26370
- name: "deposit",
26371
- outputs: [],
26372
- stateMutability: "payable",
26373
- type: "function",
26374
- },
26375
- {
26376
- inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
26377
- name: "withdraw",
26378
- outputs: [],
26379
- stateMutability: "nonpayable",
26380
- type: "function",
26381
- },
26382
- {
26383
- inputs: [{ internalType: "address", name: "account", type: "address" }],
26384
- name: "balanceOf",
26385
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
26386
- stateMutability: "view",
26387
- type: "function",
26388
- },
26389
- {
26390
- inputs: [],
26391
- name: "totalSupply",
26392
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
26393
- stateMutability: "view",
26394
- type: "function",
26395
- },
26396
- {
26397
- inputs: [],
26398
- name: "name",
26399
- outputs: [{ internalType: "string", name: "", type: "string" }],
26400
- stateMutability: "view",
26401
- type: "function",
26402
- },
26403
- {
26404
- inputs: [],
26405
- name: "symbol",
26406
- outputs: [{ internalType: "string", name: "", type: "string" }],
26407
- stateMutability: "view",
26408
- type: "function",
26605
+ "stateMutability": "view"
26409
26606
  },
26410
26607
  {
26411
- inputs: [],
26412
- name: "decimals",
26413
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
26414
- stateMutability: "view",
26415
- type: "function",
26608
+ "type": "function",
26609
+ "name": "VALID_SHARE_TOTAL",
26610
+ "inputs": [],
26611
+ "outputs": [
26612
+ {
26613
+ "name": "",
26614
+ "type": "uint256",
26615
+ "internalType": "uint256"
26616
+ }
26617
+ ],
26618
+ "stateMutability": "view"
26416
26619
  },
26417
- ];
26418
-
26419
- const TrustedSignerFeeCalculatorAbi = [
26420
26620
  {
26421
- inputs: [
26422
- { internalType: "address", name: "_nativeToken", type: "address" },
26423
- { internalType: "address", name: "_positionManager", type: "address" },
26621
+ "type": "function",
26622
+ "name": "accumulatorPerShare",
26623
+ "inputs": [],
26624
+ "outputs": [
26625
+ {
26626
+ "name": "",
26627
+ "type": "uint256",
26628
+ "internalType": "uint256"
26629
+ }
26424
26630
  ],
26425
- stateMutability: "nonpayable",
26426
- type: "constructor",
26631
+ "stateMutability": "view"
26427
26632
  },
26428
- { inputs: [], name: "AlreadyInitialized", type: "error" },
26429
- { inputs: [], name: "CallerNotPositionManager", type: "error" },
26430
26633
  {
26431
- inputs: [{ internalType: "uint256", name: "_deadline", type: "uint256" }],
26432
- name: "DeadlineExpired",
26433
- type: "error",
26634
+ "type": "function",
26635
+ "name": "balances",
26636
+ "inputs": [
26637
+ {
26638
+ "name": "_recipient",
26639
+ "type": "address",
26640
+ "internalType": "address"
26641
+ }
26642
+ ],
26643
+ "outputs": [
26644
+ {
26645
+ "name": "balance_",
26646
+ "type": "uint256",
26647
+ "internalType": "uint256"
26648
+ }
26649
+ ],
26650
+ "stateMutability": "view"
26434
26651
  },
26435
- { inputs: [], name: "InvalidPoolKey", type: "error" },
26436
26652
  {
26437
- inputs: [
26438
- { internalType: "address", name: "_invalidSigner", type: "address" },
26653
+ "type": "function",
26654
+ "name": "claim",
26655
+ "inputs": [],
26656
+ "outputs": [
26657
+ {
26658
+ "name": "",
26659
+ "type": "uint256",
26660
+ "internalType": "uint256"
26661
+ }
26439
26662
  ],
26440
- name: "InvalidSigner",
26441
- type: "error",
26663
+ "stateMutability": "nonpayable"
26442
26664
  },
26443
- { inputs: [], name: "NewOwnerIsZeroAddress", type: "error" },
26444
- { inputs: [], name: "NoHandoverRequest", type: "error" },
26445
- { inputs: [], name: "Reentrancy", type: "error" },
26446
- { inputs: [], name: "SignatureAlreadyUsed", type: "error" },
26447
26665
  {
26448
- inputs: [{ internalType: "address", name: "_signer", type: "address" }],
26449
- name: "SignerAlreadyAdded",
26450
- type: "error",
26666
+ "type": "function",
26667
+ "name": "claim",
26668
+ "inputs": [
26669
+ {
26670
+ "name": "_data",
26671
+ "type": "bytes",
26672
+ "internalType": "bytes"
26673
+ }
26674
+ ],
26675
+ "outputs": [
26676
+ {
26677
+ "name": "",
26678
+ "type": "uint256",
26679
+ "internalType": "uint256"
26680
+ }
26681
+ ],
26682
+ "stateMutability": "nonpayable"
26451
26683
  },
26452
26684
  {
26453
- inputs: [{ internalType: "address", name: "_signer", type: "address" }],
26454
- name: "SignerDoesNotExist",
26455
- type: "error",
26685
+ "type": "function",
26686
+ "name": "claimableOwnerFees",
26687
+ "inputs": [],
26688
+ "outputs": [
26689
+ {
26690
+ "name": "",
26691
+ "type": "uint256",
26692
+ "internalType": "uint256"
26693
+ }
26694
+ ],
26695
+ "stateMutability": "view"
26456
26696
  },
26457
26697
  {
26458
- inputs: [
26459
- { internalType: "uint256", name: "_requestedAmount", type: "uint256" },
26460
- { internalType: "uint256", name: "_maxTokensOut", type: "uint256" },
26698
+ "type": "function",
26699
+ "name": "creator",
26700
+ "inputs": [
26701
+ {
26702
+ "name": "_flaunch",
26703
+ "type": "address",
26704
+ "internalType": "address"
26705
+ },
26706
+ {
26707
+ "name": "_tokenId",
26708
+ "type": "uint256",
26709
+ "internalType": "uint256"
26710
+ }
26461
26711
  ],
26462
- name: "TransactionCapExceeded",
26463
- type: "error",
26712
+ "outputs": [
26713
+ {
26714
+ "name": "_creator",
26715
+ "type": "address",
26716
+ "internalType": "address"
26717
+ }
26718
+ ],
26719
+ "stateMutability": "view"
26464
26720
  },
26465
- { inputs: [], name: "Unauthorized", type: "error" },
26466
26721
  {
26467
- anonymous: false,
26468
- inputs: [
26722
+ "type": "function",
26723
+ "name": "creatorFees",
26724
+ "inputs": [],
26725
+ "outputs": [
26469
26726
  {
26470
- indexed: true,
26471
- internalType: "address",
26472
- name: "pendingOwner",
26473
- type: "address",
26474
- },
26727
+ "name": "",
26728
+ "type": "uint256",
26729
+ "internalType": "uint256"
26730
+ }
26475
26731
  ],
26476
- name: "OwnershipHandoverCanceled",
26477
- type: "event",
26732
+ "stateMutability": "view"
26478
26733
  },
26479
26734
  {
26480
- anonymous: false,
26481
- inputs: [
26735
+ "type": "function",
26736
+ "name": "creatorShare",
26737
+ "inputs": [],
26738
+ "outputs": [
26482
26739
  {
26483
- indexed: true,
26484
- internalType: "address",
26485
- name: "pendingOwner",
26486
- type: "address",
26487
- },
26740
+ "name": "",
26741
+ "type": "uint256",
26742
+ "internalType": "uint256"
26743
+ }
26488
26744
  ],
26489
- name: "OwnershipHandoverRequested",
26490
- type: "event",
26745
+ "stateMutability": "view"
26491
26746
  },
26492
26747
  {
26493
- anonymous: false,
26494
- inputs: [
26748
+ "type": "function",
26749
+ "name": "creatorTotalClaimed",
26750
+ "inputs": [
26495
26751
  {
26496
- indexed: true,
26497
- internalType: "address",
26498
- name: "oldOwner",
26499
- type: "address",
26500
- },
26752
+ "name": "_creator",
26753
+ "type": "address",
26754
+ "internalType": "address"
26755
+ }
26756
+ ],
26757
+ "outputs": [
26501
26758
  {
26502
- indexed: true,
26503
- internalType: "address",
26504
- name: "newOwner",
26505
- type: "address",
26506
- },
26759
+ "name": "_claimed",
26760
+ "type": "uint256",
26761
+ "internalType": "uint256"
26762
+ }
26507
26763
  ],
26508
- name: "OwnershipTransferred",
26509
- type: "event",
26764
+ "stateMutability": "view"
26510
26765
  },
26511
26766
  {
26512
- anonymous: false,
26513
- inputs: [
26767
+ "type": "function",
26768
+ "name": "deposit",
26769
+ "inputs": [
26514
26770
  {
26515
- indexed: false,
26516
- internalType: "PoolId",
26517
- name: "_poolId",
26518
- type: "bytes32",
26771
+ "name": "_flaunchToken",
26772
+ "type": "tuple",
26773
+ "internalType": "struct ITreasuryManager.FlaunchToken",
26774
+ "components": [
26775
+ {
26776
+ "name": "flaunch",
26777
+ "type": "address",
26778
+ "internalType": "contract Flaunch"
26779
+ },
26780
+ {
26781
+ "name": "tokenId",
26782
+ "type": "uint256",
26783
+ "internalType": "uint256"
26784
+ }
26785
+ ]
26519
26786
  },
26520
26787
  {
26521
- components: [
26522
- { internalType: "bool", name: "enabled", type: "bool" },
26523
- { internalType: "uint256", name: "walletCap", type: "uint256" },
26524
- { internalType: "uint256", name: "txCap", type: "uint256" },
26525
- ],
26526
- indexed: false,
26527
- internalType: "struct TrustedSignerFeeCalculator.FairLaunchSettings",
26528
- name: "_settings",
26529
- type: "tuple",
26788
+ "name": "_creator",
26789
+ "type": "address",
26790
+ "internalType": "address"
26530
26791
  },
26792
+ {
26793
+ "name": "_data",
26794
+ "type": "bytes",
26795
+ "internalType": "bytes"
26796
+ }
26531
26797
  ],
26532
- name: "PoolKeyFairLaunchSettingsUpdated",
26533
- type: "event",
26798
+ "outputs": [],
26799
+ "stateMutability": "nonpayable"
26534
26800
  },
26535
26801
  {
26536
- anonymous: false,
26537
- inputs: [
26538
- {
26539
- indexed: false,
26540
- internalType: "PoolId",
26541
- name: "_poolId",
26542
- type: "bytes32",
26543
- },
26802
+ "type": "function",
26803
+ "name": "feeEscrowRegistry",
26804
+ "inputs": [],
26805
+ "outputs": [
26544
26806
  {
26545
- indexed: true,
26546
- internalType: "address",
26547
- name: "_signer",
26548
- type: "address",
26549
- },
26807
+ "name": "",
26808
+ "type": "address",
26809
+ "internalType": "contract IFeeEscrowRegistry"
26810
+ }
26550
26811
  ],
26551
- name: "PoolKeySignerUpdated",
26552
- type: "event",
26812
+ "stateMutability": "view"
26553
26813
  },
26554
26814
  {
26555
- anonymous: false,
26556
- inputs: [
26815
+ "type": "function",
26816
+ "name": "flaunchTokenInternalIds",
26817
+ "inputs": [
26557
26818
  {
26558
- indexed: true,
26559
- internalType: "address",
26560
- name: "_signer",
26561
- type: "address",
26819
+ "name": "_flaunch",
26820
+ "type": "address",
26821
+ "internalType": "address"
26562
26822
  },
26563
26823
  {
26564
- indexed: false,
26565
- internalType: "bool",
26566
- name: "_isTrusted",
26567
- type: "bool",
26568
- },
26824
+ "name": "_tokenId",
26825
+ "type": "uint256",
26826
+ "internalType": "uint256"
26827
+ }
26569
26828
  ],
26570
- name: "TrustedSignerUpdated",
26571
- type: "event",
26572
- },
26573
- {
26574
- inputs: [{ internalType: "address", name: "_signer", type: "address" }],
26575
- name: "addTrustedSigner",
26829
+ "outputs": [
26830
+ {
26831
+ "name": "_internalId",
26832
+ "type": "uint256",
26833
+ "internalType": "uint256"
26834
+ }
26835
+ ],
26836
+ "stateMutability": "view"
26837
+ },
26838
+ {
26839
+ "type": "function",
26840
+ "name": "getCreatorFee",
26841
+ "inputs": [
26842
+ {
26843
+ "name": "_amount",
26844
+ "type": "uint256",
26845
+ "internalType": "uint256"
26846
+ }
26847
+ ],
26848
+ "outputs": [
26849
+ {
26850
+ "name": "creatorFee_",
26851
+ "type": "uint256",
26852
+ "internalType": "uint256"
26853
+ }
26854
+ ],
26855
+ "stateMutability": "view"
26856
+ },
26857
+ {
26858
+ "type": "function",
26859
+ "name": "getOwnerFee",
26860
+ "inputs": [
26861
+ {
26862
+ "name": "_amount",
26863
+ "type": "uint256",
26864
+ "internalType": "uint256"
26865
+ }
26866
+ ],
26867
+ "outputs": [
26868
+ {
26869
+ "name": "ownerFee_",
26870
+ "type": "uint256",
26871
+ "internalType": "uint256"
26872
+ }
26873
+ ],
26874
+ "stateMutability": "view"
26875
+ },
26876
+ {
26877
+ "type": "function",
26878
+ "name": "getPoolId",
26879
+ "inputs": [
26880
+ {
26881
+ "name": "_flaunchToken",
26882
+ "type": "tuple",
26883
+ "internalType": "struct ITreasuryManager.FlaunchToken",
26884
+ "components": [
26885
+ {
26886
+ "name": "flaunch",
26887
+ "type": "address",
26888
+ "internalType": "contract Flaunch"
26889
+ },
26890
+ {
26891
+ "name": "tokenId",
26892
+ "type": "uint256",
26893
+ "internalType": "uint256"
26894
+ }
26895
+ ]
26896
+ }
26897
+ ],
26898
+ "outputs": [
26899
+ {
26900
+ "name": "poolId_",
26901
+ "type": "bytes32",
26902
+ "internalType": "PoolId"
26903
+ }
26904
+ ],
26905
+ "stateMutability": "view"
26906
+ },
26907
+ {
26908
+ "type": "function",
26909
+ "name": "initialize",
26910
+ "inputs": [
26911
+ {
26912
+ "name": "_owner",
26913
+ "type": "address",
26914
+ "internalType": "address"
26915
+ },
26916
+ {
26917
+ "name": "_data",
26918
+ "type": "bytes",
26919
+ "internalType": "bytes"
26920
+ }
26921
+ ],
26922
+ "outputs": [],
26923
+ "stateMutability": "nonpayable"
26924
+ },
26925
+ {
26926
+ "type": "function",
26927
+ "name": "initialized",
26928
+ "inputs": [],
26929
+ "outputs": [
26930
+ {
26931
+ "name": "",
26932
+ "type": "bool",
26933
+ "internalType": "bool"
26934
+ }
26935
+ ],
26936
+ "stateMutability": "view"
26937
+ },
26938
+ {
26939
+ "type": "function",
26940
+ "name": "internalIds",
26941
+ "inputs": [
26942
+ {
26943
+ "name": "_internalId",
26944
+ "type": "uint256",
26945
+ "internalType": "uint256"
26946
+ }
26947
+ ],
26948
+ "outputs": [
26949
+ {
26950
+ "name": "flaunch",
26951
+ "type": "address",
26952
+ "internalType": "contract Flaunch"
26953
+ },
26954
+ {
26955
+ "name": "tokenId",
26956
+ "type": "uint256",
26957
+ "internalType": "uint256"
26958
+ }
26959
+ ],
26960
+ "stateMutability": "view"
26961
+ },
26962
+ {
26963
+ "type": "function",
26964
+ "name": "isValidCreator",
26965
+ "inputs": [
26966
+ {
26967
+ "name": "_creator",
26968
+ "type": "address",
26969
+ "internalType": "address"
26970
+ },
26971
+ {
26972
+ "name": "_data",
26973
+ "type": "bytes",
26974
+ "internalType": "bytes"
26975
+ }
26976
+ ],
26977
+ "outputs": [
26978
+ {
26979
+ "name": "",
26980
+ "type": "bool",
26981
+ "internalType": "bool"
26982
+ }
26983
+ ],
26984
+ "stateMutability": "view"
26985
+ },
26986
+ {
26987
+ "type": "function",
26988
+ "name": "isValidRecipient",
26989
+ "inputs": [
26990
+ {
26991
+ "name": "_recipient",
26992
+ "type": "address",
26993
+ "internalType": "address"
26994
+ },
26995
+ {
26996
+ "name": "",
26997
+ "type": "bytes",
26998
+ "internalType": "bytes"
26999
+ }
27000
+ ],
27001
+ "outputs": [
27002
+ {
27003
+ "name": "",
27004
+ "type": "bool",
27005
+ "internalType": "bool"
27006
+ }
27007
+ ],
27008
+ "stateMutability": "view"
27009
+ },
27010
+ {
27011
+ "type": "function",
27012
+ "name": "lastProcessedManagerFees",
27013
+ "inputs": [],
27014
+ "outputs": [
27015
+ {
27016
+ "name": "",
27017
+ "type": "uint256",
27018
+ "internalType": "uint256"
27019
+ }
27020
+ ],
27021
+ "stateMutability": "view"
27022
+ },
27023
+ {
27024
+ "type": "function",
27025
+ "name": "managerFees",
27026
+ "inputs": [],
27027
+ "outputs": [
27028
+ {
27029
+ "name": "",
27030
+ "type": "uint256",
27031
+ "internalType": "uint256"
27032
+ }
27033
+ ],
27034
+ "stateMutability": "view"
27035
+ },
27036
+ {
27037
+ "type": "function",
27038
+ "name": "managerOwner",
27039
+ "inputs": [],
27040
+ "outputs": [
27041
+ {
27042
+ "name": "",
27043
+ "type": "address",
27044
+ "internalType": "address"
27045
+ }
27046
+ ],
27047
+ "stateMutability": "view"
27048
+ },
27049
+ {
27050
+ "type": "function",
27051
+ "name": "moderator",
27052
+ "inputs": [],
27053
+ "outputs": [
27054
+ {
27055
+ "name": "",
27056
+ "type": "address",
27057
+ "internalType": "address"
27058
+ }
27059
+ ],
27060
+ "stateMutability": "view"
27061
+ },
27062
+ {
27063
+ "type": "function",
27064
+ "name": "nextInternalId",
27065
+ "inputs": [],
27066
+ "outputs": [
27067
+ {
27068
+ "name": "",
27069
+ "type": "uint256",
27070
+ "internalType": "uint256"
27071
+ }
27072
+ ],
27073
+ "stateMutability": "view"
27074
+ },
27075
+ {
27076
+ "type": "function",
27077
+ "name": "ownerFees",
27078
+ "inputs": [],
27079
+ "outputs": [
27080
+ {
27081
+ "name": "",
27082
+ "type": "uint256",
27083
+ "internalType": "uint256"
27084
+ }
27085
+ ],
27086
+ "stateMutability": "view"
27087
+ },
27088
+ {
27089
+ "type": "function",
27090
+ "name": "ownerShare",
27091
+ "inputs": [],
27092
+ "outputs": [
27093
+ {
27094
+ "name": "",
27095
+ "type": "uint256",
27096
+ "internalType": "uint256"
27097
+ }
27098
+ ],
27099
+ "stateMutability": "view"
27100
+ },
27101
+ {
27102
+ "type": "function",
27103
+ "name": "pendingCreatorFees",
27104
+ "inputs": [
27105
+ {
27106
+ "name": "_recipient",
27107
+ "type": "address",
27108
+ "internalType": "address"
27109
+ }
27110
+ ],
27111
+ "outputs": [
27112
+ {
27113
+ "name": "balance_",
27114
+ "type": "uint256",
27115
+ "internalType": "uint256"
27116
+ }
27117
+ ],
27118
+ "stateMutability": "view"
27119
+ },
27120
+ {
27121
+ "type": "function",
27122
+ "name": "pendingOwnerFees",
27123
+ "inputs": [],
27124
+ "outputs": [
27125
+ {
27126
+ "name": "",
27127
+ "type": "uint256",
27128
+ "internalType": "uint256"
27129
+ }
27130
+ ],
27131
+ "stateMutability": "view"
27132
+ },
27133
+ {
27134
+ "type": "function",
27135
+ "name": "permissions",
27136
+ "inputs": [],
27137
+ "outputs": [
27138
+ {
27139
+ "name": "",
27140
+ "type": "address",
27141
+ "internalType": "contract IManagerPermissions"
27142
+ }
27143
+ ],
27144
+ "stateMutability": "view"
27145
+ },
27146
+ {
27147
+ "type": "function",
27148
+ "name": "recipientAt",
27149
+ "inputs": [
27150
+ {
27151
+ "name": "_index",
27152
+ "type": "uint256",
27153
+ "internalType": "uint256"
27154
+ }
27155
+ ],
27156
+ "outputs": [
27157
+ {
27158
+ "name": "",
27159
+ "type": "address",
27160
+ "internalType": "address"
27161
+ }
27162
+ ],
27163
+ "stateMutability": "view"
27164
+ },
27165
+ {
27166
+ "type": "function",
27167
+ "name": "recipientCount",
27168
+ "inputs": [],
27169
+ "outputs": [
27170
+ {
27171
+ "name": "",
27172
+ "type": "uint256",
27173
+ "internalType": "uint256"
27174
+ }
27175
+ ],
27176
+ "stateMutability": "view"
27177
+ },
27178
+ {
27179
+ "type": "function",
27180
+ "name": "recipientShare",
27181
+ "inputs": [
27182
+ {
27183
+ "name": "_recipient",
27184
+ "type": "address",
27185
+ "internalType": "address"
27186
+ },
27187
+ {
27188
+ "name": "",
27189
+ "type": "bytes",
27190
+ "internalType": "bytes"
27191
+ }
27192
+ ],
27193
+ "outputs": [
27194
+ {
27195
+ "name": "",
27196
+ "type": "uint256",
27197
+ "internalType": "uint256"
27198
+ }
27199
+ ],
27200
+ "stateMutability": "view"
27201
+ },
27202
+ {
27203
+ "type": "function",
27204
+ "name": "recipients",
27205
+ "inputs": [
27206
+ {
27207
+ "name": "_recipient",
27208
+ "type": "address",
27209
+ "internalType": "address"
27210
+ }
27211
+ ],
27212
+ "outputs": [
27213
+ {
27214
+ "name": "share",
27215
+ "type": "uint256",
27216
+ "internalType": "uint256"
27217
+ },
27218
+ {
27219
+ "name": "debtPerShare",
27220
+ "type": "uint256",
27221
+ "internalType": "uint256"
27222
+ },
27223
+ {
27224
+ "name": "snapshotBalance",
27225
+ "type": "uint256",
27226
+ "internalType": "uint256"
27227
+ },
27228
+ {
27229
+ "name": "claimed",
27230
+ "type": "uint256",
27231
+ "internalType": "uint256"
27232
+ }
27233
+ ],
27234
+ "stateMutability": "view"
27235
+ },
27236
+ {
27237
+ "type": "function",
27238
+ "name": "rescue",
27239
+ "inputs": [
27240
+ {
27241
+ "name": "_flaunchToken",
27242
+ "type": "tuple",
27243
+ "internalType": "struct ITreasuryManager.FlaunchToken",
27244
+ "components": [
27245
+ {
27246
+ "name": "flaunch",
27247
+ "type": "address",
27248
+ "internalType": "contract Flaunch"
27249
+ },
27250
+ {
27251
+ "name": "tokenId",
27252
+ "type": "uint256",
27253
+ "internalType": "uint256"
27254
+ }
27255
+ ]
27256
+ },
27257
+ {
27258
+ "name": "_recipient",
27259
+ "type": "address",
27260
+ "internalType": "address"
27261
+ }
27262
+ ],
27263
+ "outputs": [],
27264
+ "stateMutability": "nonpayable"
27265
+ },
27266
+ {
27267
+ "type": "function",
27268
+ "name": "setCreator",
27269
+ "inputs": [
27270
+ {
27271
+ "name": "_flaunchToken",
27272
+ "type": "tuple",
27273
+ "internalType": "struct ITreasuryManager.FlaunchToken",
27274
+ "components": [
27275
+ {
27276
+ "name": "flaunch",
27277
+ "type": "address",
27278
+ "internalType": "contract Flaunch"
27279
+ },
27280
+ {
27281
+ "name": "tokenId",
27282
+ "type": "uint256",
27283
+ "internalType": "uint256"
27284
+ }
27285
+ ]
27286
+ },
27287
+ {
27288
+ "name": "_creator",
27289
+ "type": "address",
27290
+ "internalType": "address payable"
27291
+ }
27292
+ ],
27293
+ "outputs": [],
27294
+ "stateMutability": "nonpayable"
27295
+ },
27296
+ {
27297
+ "type": "function",
27298
+ "name": "setModerator",
27299
+ "inputs": [
27300
+ {
27301
+ "name": "_moderator",
27302
+ "type": "address",
27303
+ "internalType": "address"
27304
+ }
27305
+ ],
27306
+ "outputs": [],
27307
+ "stateMutability": "nonpayable"
27308
+ },
27309
+ {
27310
+ "type": "function",
27311
+ "name": "setPermissions",
27312
+ "inputs": [
27313
+ {
27314
+ "name": "_permissions",
27315
+ "type": "address",
27316
+ "internalType": "address"
27317
+ }
27318
+ ],
27319
+ "outputs": [],
27320
+ "stateMutability": "nonpayable"
27321
+ },
27322
+ {
27323
+ "type": "function",
27324
+ "name": "splitFees",
27325
+ "inputs": [],
27326
+ "outputs": [
27327
+ {
27328
+ "name": "",
27329
+ "type": "uint256",
27330
+ "internalType": "uint256"
27331
+ }
27332
+ ],
27333
+ "stateMutability": "view"
27334
+ },
27335
+ {
27336
+ "type": "function",
27337
+ "name": "tokenPoolId",
27338
+ "inputs": [
27339
+ {
27340
+ "name": "_internalId",
27341
+ "type": "uint256",
27342
+ "internalType": "uint256"
27343
+ }
27344
+ ],
27345
+ "outputs": [
27346
+ {
27347
+ "name": "_poolId",
27348
+ "type": "bytes32",
27349
+ "internalType": "PoolId"
27350
+ }
27351
+ ],
27352
+ "stateMutability": "view"
27353
+ },
27354
+ {
27355
+ "type": "function",
27356
+ "name": "tokenTimelock",
27357
+ "inputs": [
27358
+ {
27359
+ "name": "_flaunch",
27360
+ "type": "address",
27361
+ "internalType": "address"
27362
+ },
27363
+ {
27364
+ "name": "_tokenId",
27365
+ "type": "uint256",
27366
+ "internalType": "uint256"
27367
+ }
27368
+ ],
27369
+ "outputs": [
27370
+ {
27371
+ "name": "_unlockedAt",
27372
+ "type": "uint256",
27373
+ "internalType": "uint256"
27374
+ }
27375
+ ],
27376
+ "stateMutability": "view"
27377
+ },
27378
+ {
27379
+ "type": "function",
27380
+ "name": "tokenTotalClaimed",
27381
+ "inputs": [
27382
+ {
27383
+ "name": "_flaunch",
27384
+ "type": "address",
27385
+ "internalType": "address"
27386
+ },
27387
+ {
27388
+ "name": "_tokenId",
27389
+ "type": "uint256",
27390
+ "internalType": "uint256"
27391
+ }
27392
+ ],
27393
+ "outputs": [
27394
+ {
27395
+ "name": "_claimed",
27396
+ "type": "uint256",
27397
+ "internalType": "uint256"
27398
+ }
27399
+ ],
27400
+ "stateMutability": "view"
27401
+ },
27402
+ {
27403
+ "type": "function",
27404
+ "name": "tokens",
27405
+ "inputs": [
27406
+ {
27407
+ "name": "_creator",
27408
+ "type": "address",
27409
+ "internalType": "address"
27410
+ }
27411
+ ],
27412
+ "outputs": [
27413
+ {
27414
+ "name": "flaunchTokens_",
27415
+ "type": "tuple[]",
27416
+ "internalType": "struct ITreasuryManager.FlaunchToken[]",
27417
+ "components": [
27418
+ {
27419
+ "name": "flaunch",
27420
+ "type": "address",
27421
+ "internalType": "contract Flaunch"
27422
+ },
27423
+ {
27424
+ "name": "tokenId",
27425
+ "type": "uint256",
27426
+ "internalType": "uint256"
27427
+ }
27428
+ ]
27429
+ }
27430
+ ],
27431
+ "stateMutability": "view"
27432
+ },
27433
+ {
27434
+ "type": "function",
27435
+ "name": "totalActiveShares",
27436
+ "inputs": [],
27437
+ "outputs": [
27438
+ {
27439
+ "name": "",
27440
+ "type": "uint256",
27441
+ "internalType": "uint256"
27442
+ }
27443
+ ],
27444
+ "stateMutability": "view"
27445
+ },
27446
+ {
27447
+ "type": "function",
27448
+ "name": "transferManagerOwnership",
27449
+ "inputs": [
27450
+ {
27451
+ "name": "_newManagerOwner",
27452
+ "type": "address",
27453
+ "internalType": "address"
27454
+ }
27455
+ ],
27456
+ "outputs": [],
27457
+ "stateMutability": "nonpayable"
27458
+ },
27459
+ {
27460
+ "type": "function",
27461
+ "name": "transferRecipientShare",
27462
+ "inputs": [
27463
+ {
27464
+ "name": "_newRecipient",
27465
+ "type": "address",
27466
+ "internalType": "address"
27467
+ }
27468
+ ],
27469
+ "outputs": [],
27470
+ "stateMutability": "nonpayable"
27471
+ },
27472
+ {
27473
+ "type": "function",
27474
+ "name": "treasuryManagerFactory",
27475
+ "inputs": [],
27476
+ "outputs": [
27477
+ {
27478
+ "name": "",
27479
+ "type": "address",
27480
+ "internalType": "contract TreasuryManagerFactory"
27481
+ }
27482
+ ],
27483
+ "stateMutability": "view"
27484
+ },
27485
+ {
27486
+ "type": "function",
27487
+ "name": "updateRecipients",
27488
+ "inputs": [
27489
+ {
27490
+ "name": "_recipients",
27491
+ "type": "tuple[]",
27492
+ "internalType": "struct DynamicAddressFeeSplitManager.RecipientShare[]",
27493
+ "components": [
27494
+ {
27495
+ "name": "recipient",
27496
+ "type": "address",
27497
+ "internalType": "address"
27498
+ },
27499
+ {
27500
+ "name": "share",
27501
+ "type": "uint256",
27502
+ "internalType": "uint256"
27503
+ }
27504
+ ]
27505
+ }
27506
+ ],
27507
+ "outputs": [],
27508
+ "stateMutability": "nonpayable"
27509
+ },
27510
+ {
27511
+ "type": "event",
27512
+ "name": "CreatorShareInitialized",
27513
+ "inputs": [
27514
+ {
27515
+ "name": "_creatorShare",
27516
+ "type": "uint256",
27517
+ "indexed": false,
27518
+ "internalType": "uint256"
27519
+ }
27520
+ ],
27521
+ "anonymous": false
27522
+ },
27523
+ {
27524
+ "type": "event",
27525
+ "name": "CreatorUpdated",
27526
+ "inputs": [
27527
+ {
27528
+ "name": "_flaunch",
27529
+ "type": "address",
27530
+ "indexed": true,
27531
+ "internalType": "address"
27532
+ },
27533
+ {
27534
+ "name": "_tokenId",
27535
+ "type": "uint256",
27536
+ "indexed": true,
27537
+ "internalType": "uint256"
27538
+ },
27539
+ {
27540
+ "name": "_creator",
27541
+ "type": "address",
27542
+ "indexed": false,
27543
+ "internalType": "address"
27544
+ }
27545
+ ],
27546
+ "anonymous": false
27547
+ },
27548
+ {
27549
+ "type": "event",
27550
+ "name": "ETHReceivedFromUnknownSource",
27551
+ "inputs": [
27552
+ {
27553
+ "name": "_sender",
27554
+ "type": "address",
27555
+ "indexed": true,
27556
+ "internalType": "address"
27557
+ },
27558
+ {
27559
+ "name": "_amount",
27560
+ "type": "uint256",
27561
+ "indexed": false,
27562
+ "internalType": "uint256"
27563
+ }
27564
+ ],
27565
+ "anonymous": false
27566
+ },
27567
+ {
27568
+ "type": "event",
27569
+ "name": "ManagerInitialized",
27570
+ "inputs": [
27571
+ {
27572
+ "name": "_owner",
27573
+ "type": "address",
27574
+ "indexed": false,
27575
+ "internalType": "address"
27576
+ },
27577
+ {
27578
+ "name": "_params",
27579
+ "type": "tuple",
27580
+ "indexed": false,
27581
+ "internalType": "struct DynamicAddressFeeSplitManager.InitializeParams",
27582
+ "components": [
27583
+ {
27584
+ "name": "creatorShare",
27585
+ "type": "uint256",
27586
+ "internalType": "uint256"
27587
+ },
27588
+ {
27589
+ "name": "ownerShare",
27590
+ "type": "uint256",
27591
+ "internalType": "uint256"
27592
+ },
27593
+ {
27594
+ "name": "moderator",
27595
+ "type": "address",
27596
+ "internalType": "address"
27597
+ },
27598
+ {
27599
+ "name": "recipientShares",
27600
+ "type": "tuple[]",
27601
+ "internalType": "struct DynamicAddressFeeSplitManager.RecipientShare[]",
27602
+ "components": [
27603
+ {
27604
+ "name": "recipient",
27605
+ "type": "address",
27606
+ "internalType": "address"
27607
+ },
27608
+ {
27609
+ "name": "share",
27610
+ "type": "uint256",
27611
+ "internalType": "uint256"
27612
+ }
27613
+ ]
27614
+ }
27615
+ ]
27616
+ }
27617
+ ],
27618
+ "anonymous": false
27619
+ },
27620
+ {
27621
+ "type": "event",
27622
+ "name": "ManagerOwnershipTransferred",
27623
+ "inputs": [
27624
+ {
27625
+ "name": "_previousOwner",
27626
+ "type": "address",
27627
+ "indexed": true,
27628
+ "internalType": "address"
27629
+ },
27630
+ {
27631
+ "name": "_newOwner",
27632
+ "type": "address",
27633
+ "indexed": true,
27634
+ "internalType": "address"
27635
+ }
27636
+ ],
27637
+ "anonymous": false
27638
+ },
27639
+ {
27640
+ "type": "event",
27641
+ "name": "ModeratorUpdated",
27642
+ "inputs": [
27643
+ {
27644
+ "name": "_oldModerator",
27645
+ "type": "address",
27646
+ "indexed": true,
27647
+ "internalType": "address"
27648
+ },
27649
+ {
27650
+ "name": "_newModerator",
27651
+ "type": "address",
27652
+ "indexed": true,
27653
+ "internalType": "address"
27654
+ }
27655
+ ],
27656
+ "anonymous": false
27657
+ },
27658
+ {
27659
+ "type": "event",
27660
+ "name": "OwnerShareInitialized",
27661
+ "inputs": [
27662
+ {
27663
+ "name": "_ownerShare",
27664
+ "type": "uint256",
27665
+ "indexed": false,
27666
+ "internalType": "uint256"
27667
+ }
27668
+ ],
27669
+ "anonymous": false
27670
+ },
27671
+ {
27672
+ "type": "event",
27673
+ "name": "PermissionsUpdated",
27674
+ "inputs": [
27675
+ {
27676
+ "name": "_permissions",
27677
+ "type": "address",
27678
+ "indexed": false,
27679
+ "internalType": "address"
27680
+ }
27681
+ ],
27682
+ "anonymous": false
27683
+ },
27684
+ {
27685
+ "type": "event",
27686
+ "name": "RecipientAdded",
27687
+ "inputs": [
27688
+ {
27689
+ "name": "_recipient",
27690
+ "type": "address",
27691
+ "indexed": true,
27692
+ "internalType": "address"
27693
+ },
27694
+ {
27695
+ "name": "_share",
27696
+ "type": "uint256",
27697
+ "indexed": false,
27698
+ "internalType": "uint256"
27699
+ }
27700
+ ],
27701
+ "anonymous": false
27702
+ },
27703
+ {
27704
+ "type": "event",
27705
+ "name": "RecipientRemoved",
27706
+ "inputs": [
27707
+ {
27708
+ "name": "_recipient",
27709
+ "type": "address",
27710
+ "indexed": true,
27711
+ "internalType": "address"
27712
+ },
27713
+ {
27714
+ "name": "_snapshotBalance",
27715
+ "type": "uint256",
27716
+ "indexed": false,
27717
+ "internalType": "uint256"
27718
+ }
27719
+ ],
27720
+ "anonymous": false
27721
+ },
27722
+ {
27723
+ "type": "event",
27724
+ "name": "RecipientShareTransferred",
27725
+ "inputs": [
27726
+ {
27727
+ "name": "_oldRecipient",
27728
+ "type": "address",
27729
+ "indexed": true,
27730
+ "internalType": "address"
27731
+ },
27732
+ {
27733
+ "name": "_newRecipient",
27734
+ "type": "address",
27735
+ "indexed": true,
27736
+ "internalType": "address"
27737
+ },
27738
+ {
27739
+ "name": "_share",
27740
+ "type": "uint256",
27741
+ "indexed": false,
27742
+ "internalType": "uint256"
27743
+ }
27744
+ ],
27745
+ "anonymous": false
27746
+ },
27747
+ {
27748
+ "type": "event",
27749
+ "name": "RecipientShareUpdated",
27750
+ "inputs": [
27751
+ {
27752
+ "name": "_recipient",
27753
+ "type": "address",
27754
+ "indexed": true,
27755
+ "internalType": "address"
27756
+ },
27757
+ {
27758
+ "name": "_oldShare",
27759
+ "type": "uint256",
27760
+ "indexed": false,
27761
+ "internalType": "uint256"
27762
+ },
27763
+ {
27764
+ "name": "_newShare",
27765
+ "type": "uint256",
27766
+ "indexed": false,
27767
+ "internalType": "uint256"
27768
+ }
27769
+ ],
27770
+ "anonymous": false
27771
+ },
27772
+ {
27773
+ "type": "event",
27774
+ "name": "RevenueClaimed",
27775
+ "inputs": [
27776
+ {
27777
+ "name": "_recipient",
27778
+ "type": "address",
27779
+ "indexed": true,
27780
+ "internalType": "address"
27781
+ },
27782
+ {
27783
+ "name": "_amountClaimed",
27784
+ "type": "uint256",
27785
+ "indexed": false,
27786
+ "internalType": "uint256"
27787
+ }
27788
+ ],
27789
+ "anonymous": false
27790
+ },
27791
+ {
27792
+ "type": "event",
27793
+ "name": "RoundingDustAllocated",
27794
+ "inputs": [
27795
+ {
27796
+ "name": "_recipient",
27797
+ "type": "address",
27798
+ "indexed": true,
27799
+ "internalType": "address"
27800
+ },
27801
+ {
27802
+ "name": "_amount",
27803
+ "type": "uint256",
27804
+ "indexed": false,
27805
+ "internalType": "uint256"
27806
+ }
27807
+ ],
27808
+ "anonymous": false
27809
+ },
27810
+ {
27811
+ "type": "event",
27812
+ "name": "TreasuryEscrowed",
27813
+ "inputs": [
27814
+ {
27815
+ "name": "_flaunch",
27816
+ "type": "address",
27817
+ "indexed": true,
27818
+ "internalType": "address"
27819
+ },
27820
+ {
27821
+ "name": "_tokenId",
27822
+ "type": "uint256",
27823
+ "indexed": true,
27824
+ "internalType": "uint256"
27825
+ },
27826
+ {
27827
+ "name": "_owner",
27828
+ "type": "address",
27829
+ "indexed": false,
27830
+ "internalType": "address"
27831
+ },
27832
+ {
27833
+ "name": "_sender",
27834
+ "type": "address",
27835
+ "indexed": false,
27836
+ "internalType": "address"
27837
+ }
27838
+ ],
27839
+ "anonymous": false
27840
+ },
27841
+ {
27842
+ "type": "event",
27843
+ "name": "TreasuryReclaimed",
27844
+ "inputs": [
27845
+ {
27846
+ "name": "_flaunch",
27847
+ "type": "address",
27848
+ "indexed": true,
27849
+ "internalType": "address"
27850
+ },
27851
+ {
27852
+ "name": "_tokenId",
27853
+ "type": "uint256",
27854
+ "indexed": true,
27855
+ "internalType": "uint256"
27856
+ },
27857
+ {
27858
+ "name": "_sender",
27859
+ "type": "address",
27860
+ "indexed": false,
27861
+ "internalType": "address"
27862
+ },
27863
+ {
27864
+ "name": "_recipient",
27865
+ "type": "address",
27866
+ "indexed": false,
27867
+ "internalType": "address"
27868
+ }
27869
+ ],
27870
+ "anonymous": false
27871
+ },
27872
+ {
27873
+ "type": "event",
27874
+ "name": "TreasuryTimelocked",
27875
+ "inputs": [
27876
+ {
27877
+ "name": "_flaunch",
27878
+ "type": "address",
27879
+ "indexed": true,
27880
+ "internalType": "address"
27881
+ },
27882
+ {
27883
+ "name": "_tokenId",
27884
+ "type": "uint256",
27885
+ "indexed": true,
27886
+ "internalType": "uint256"
27887
+ },
27888
+ {
27889
+ "name": "_unlockedAt",
27890
+ "type": "uint256",
27891
+ "indexed": false,
27892
+ "internalType": "uint256"
27893
+ }
27894
+ ],
27895
+ "anonymous": false
27896
+ },
27897
+ {
27898
+ "type": "error",
27899
+ "name": "AlreadyDeposited",
27900
+ "inputs": []
27901
+ },
27902
+ {
27903
+ "type": "error",
27904
+ "name": "AlreadyInitialized",
27905
+ "inputs": []
27906
+ },
27907
+ {
27908
+ "type": "error",
27909
+ "name": "CreatorShareAlreadyInitialized",
27910
+ "inputs": []
27911
+ },
27912
+ {
27913
+ "type": "error",
27914
+ "name": "FlaunchContractNotValid",
27915
+ "inputs": []
27916
+ },
27917
+ {
27918
+ "type": "error",
27919
+ "name": "InsufficientSharesToTransfer",
27920
+ "inputs": []
27921
+ },
27922
+ {
27923
+ "type": "error",
27924
+ "name": "InvalidClaimer",
27925
+ "inputs": []
27926
+ },
27927
+ {
27928
+ "type": "error",
27929
+ "name": "InvalidCreator",
27930
+ "inputs": []
27931
+ },
27932
+ {
27933
+ "type": "error",
27934
+ "name": "InvalidCreatorAddress",
27935
+ "inputs": []
27936
+ },
27937
+ {
27938
+ "type": "error",
27939
+ "name": "InvalidCreatorShare",
27940
+ "inputs": []
27941
+ },
27942
+ {
27943
+ "type": "error",
27944
+ "name": "InvalidOwnerShare",
27945
+ "inputs": []
27946
+ },
27947
+ {
27948
+ "type": "error",
27949
+ "name": "InvalidRecipient",
27950
+ "inputs": []
27951
+ },
27952
+ {
27953
+ "type": "error",
27954
+ "name": "InvalidRecipientShareTotal",
27955
+ "inputs": [
27956
+ {
27957
+ "name": "_share",
27958
+ "type": "uint256",
27959
+ "internalType": "uint256"
27960
+ },
27961
+ {
27962
+ "name": "_validShare",
27963
+ "type": "uint256",
27964
+ "internalType": "uint256"
27965
+ }
27966
+ ]
27967
+ },
27968
+ {
27969
+ "type": "error",
27970
+ "name": "InvalidShareAmount",
27971
+ "inputs": []
27972
+ },
27973
+ {
27974
+ "type": "error",
27975
+ "name": "InvalidShareTotal",
27976
+ "inputs": []
27977
+ },
27978
+ {
27979
+ "type": "error",
27980
+ "name": "InvalidShareTransferRecipient",
27981
+ "inputs": []
27982
+ },
27983
+ {
27984
+ "type": "error",
27985
+ "name": "NotInitialized",
27986
+ "inputs": []
27987
+ },
27988
+ {
27989
+ "type": "error",
27990
+ "name": "NotManagerOwner",
27991
+ "inputs": []
27992
+ },
27993
+ {
27994
+ "type": "error",
27995
+ "name": "NotOwnerOrModerator",
27996
+ "inputs": []
27997
+ },
27998
+ {
27999
+ "type": "error",
28000
+ "name": "OwnerShareAlreadyInitialized",
28001
+ "inputs": []
28002
+ },
28003
+ {
28004
+ "type": "error",
28005
+ "name": "RecipientAlreadyActive",
28006
+ "inputs": []
28007
+ },
28008
+ {
28009
+ "type": "error",
28010
+ "name": "RecipientNotActive",
28011
+ "inputs": []
28012
+ },
28013
+ {
28014
+ "type": "error",
28015
+ "name": "Reentrancy",
28016
+ "inputs": []
28017
+ },
28018
+ {
28019
+ "type": "error",
28020
+ "name": "TokenTimelocked",
28021
+ "inputs": [
28022
+ {
28023
+ "name": "_unlockedAt",
28024
+ "type": "uint256",
28025
+ "internalType": "uint256"
28026
+ }
28027
+ ]
28028
+ },
28029
+ {
28030
+ "type": "error",
28031
+ "name": "UnableToSendRevenue",
28032
+ "inputs": [
28033
+ {
28034
+ "name": "_reason",
28035
+ "type": "bytes",
28036
+ "internalType": "bytes"
28037
+ }
28038
+ ]
28039
+ },
28040
+ {
28041
+ "type": "error",
28042
+ "name": "UnknownFlaunchToken",
28043
+ "inputs": []
28044
+ },
28045
+ {
28046
+ "type": "error",
28047
+ "name": "UnknownPoolId",
28048
+ "inputs": []
28049
+ }
28050
+ ];
28051
+
28052
+ const FastFlaunchZapAbi = [
28053
+ {
28054
+ inputs: [
28055
+ {
28056
+ internalType: "contract PositionManager",
28057
+ name: "_positionManager",
28058
+ type: "address",
28059
+ },
28060
+ ],
28061
+ stateMutability: "nonpayable",
28062
+ type: "constructor",
28063
+ },
28064
+ {
28065
+ inputs: [],
28066
+ name: "CREATOR_FEE_ALLOCATION",
28067
+ outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
28068
+ stateMutability: "view",
28069
+ type: "function",
28070
+ },
28071
+ {
28072
+ inputs: [],
28073
+ name: "FAIR_LAUNCH_SUPPLY",
28074
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
28075
+ stateMutability: "view",
28076
+ type: "function",
28077
+ },
28078
+ {
28079
+ inputs: [],
28080
+ name: "USDC_MARKET_CAP",
28081
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
28082
+ stateMutability: "view",
28083
+ type: "function",
28084
+ },
28085
+ {
28086
+ inputs: [
28087
+ {
28088
+ components: [
28089
+ { internalType: "string", name: "name", type: "string" },
28090
+ { internalType: "string", name: "symbol", type: "string" },
28091
+ { internalType: "string", name: "tokenUri", type: "string" },
28092
+ { internalType: "address", name: "creator", type: "address" },
28093
+ ],
28094
+ internalType: "struct FastFlaunchZap.FastFlaunchParams",
28095
+ name: "_params",
28096
+ type: "tuple",
28097
+ },
28098
+ ],
28099
+ name: "flaunch",
28100
+ outputs: [{ internalType: "address", name: "memecoin_", type: "address" }],
28101
+ stateMutability: "nonpayable",
28102
+ type: "function",
28103
+ },
28104
+ {
28105
+ inputs: [],
28106
+ name: "positionManager",
28107
+ outputs: [
28108
+ { internalType: "contract PositionManager", name: "", type: "address" },
28109
+ ],
28110
+ stateMutability: "view",
28111
+ type: "function",
28112
+ },
28113
+ ];
28114
+
28115
+ const FLETHAbi = [
28116
+ {
28117
+ inputs: [{ internalType: "uint256", name: "wethAmount", type: "uint256" }],
28118
+ name: "deposit",
28119
+ outputs: [],
28120
+ stateMutability: "payable",
28121
+ type: "function",
28122
+ },
28123
+ {
28124
+ inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
28125
+ name: "withdraw",
28126
+ outputs: [],
28127
+ stateMutability: "nonpayable",
28128
+ type: "function",
28129
+ },
28130
+ {
28131
+ inputs: [{ internalType: "address", name: "account", type: "address" }],
28132
+ name: "balanceOf",
28133
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
28134
+ stateMutability: "view",
28135
+ type: "function",
28136
+ },
28137
+ {
28138
+ inputs: [],
28139
+ name: "totalSupply",
28140
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
28141
+ stateMutability: "view",
28142
+ type: "function",
28143
+ },
28144
+ {
28145
+ inputs: [],
28146
+ name: "name",
28147
+ outputs: [{ internalType: "string", name: "", type: "string" }],
28148
+ stateMutability: "view",
28149
+ type: "function",
28150
+ },
28151
+ {
28152
+ inputs: [],
28153
+ name: "symbol",
28154
+ outputs: [{ internalType: "string", name: "", type: "string" }],
28155
+ stateMutability: "view",
28156
+ type: "function",
28157
+ },
28158
+ {
28159
+ inputs: [],
28160
+ name: "decimals",
28161
+ outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
28162
+ stateMutability: "view",
28163
+ type: "function",
28164
+ },
28165
+ ];
28166
+
28167
+ const TrustedSignerFeeCalculatorAbi = [
28168
+ {
28169
+ inputs: [
28170
+ { internalType: "address", name: "_nativeToken", type: "address" },
28171
+ { internalType: "address", name: "_positionManager", type: "address" },
28172
+ ],
28173
+ stateMutability: "nonpayable",
28174
+ type: "constructor",
28175
+ },
28176
+ { inputs: [], name: "AlreadyInitialized", type: "error" },
28177
+ { inputs: [], name: "CallerNotPositionManager", type: "error" },
28178
+ {
28179
+ inputs: [{ internalType: "uint256", name: "_deadline", type: "uint256" }],
28180
+ name: "DeadlineExpired",
28181
+ type: "error",
28182
+ },
28183
+ { inputs: [], name: "InvalidPoolKey", type: "error" },
28184
+ {
28185
+ inputs: [
28186
+ { internalType: "address", name: "_invalidSigner", type: "address" },
28187
+ ],
28188
+ name: "InvalidSigner",
28189
+ type: "error",
28190
+ },
28191
+ { inputs: [], name: "NewOwnerIsZeroAddress", type: "error" },
28192
+ { inputs: [], name: "NoHandoverRequest", type: "error" },
28193
+ { inputs: [], name: "Reentrancy", type: "error" },
28194
+ { inputs: [], name: "SignatureAlreadyUsed", type: "error" },
28195
+ {
28196
+ inputs: [{ internalType: "address", name: "_signer", type: "address" }],
28197
+ name: "SignerAlreadyAdded",
28198
+ type: "error",
28199
+ },
28200
+ {
28201
+ inputs: [{ internalType: "address", name: "_signer", type: "address" }],
28202
+ name: "SignerDoesNotExist",
28203
+ type: "error",
28204
+ },
28205
+ {
28206
+ inputs: [
28207
+ { internalType: "uint256", name: "_requestedAmount", type: "uint256" },
28208
+ { internalType: "uint256", name: "_maxTokensOut", type: "uint256" },
28209
+ ],
28210
+ name: "TransactionCapExceeded",
28211
+ type: "error",
28212
+ },
28213
+ { inputs: [], name: "Unauthorized", type: "error" },
28214
+ {
28215
+ anonymous: false,
28216
+ inputs: [
28217
+ {
28218
+ indexed: true,
28219
+ internalType: "address",
28220
+ name: "pendingOwner",
28221
+ type: "address",
28222
+ },
28223
+ ],
28224
+ name: "OwnershipHandoverCanceled",
28225
+ type: "event",
28226
+ },
28227
+ {
28228
+ anonymous: false,
28229
+ inputs: [
28230
+ {
28231
+ indexed: true,
28232
+ internalType: "address",
28233
+ name: "pendingOwner",
28234
+ type: "address",
28235
+ },
28236
+ ],
28237
+ name: "OwnershipHandoverRequested",
28238
+ type: "event",
28239
+ },
28240
+ {
28241
+ anonymous: false,
28242
+ inputs: [
28243
+ {
28244
+ indexed: true,
28245
+ internalType: "address",
28246
+ name: "oldOwner",
28247
+ type: "address",
28248
+ },
28249
+ {
28250
+ indexed: true,
28251
+ internalType: "address",
28252
+ name: "newOwner",
28253
+ type: "address",
28254
+ },
28255
+ ],
28256
+ name: "OwnershipTransferred",
28257
+ type: "event",
28258
+ },
28259
+ {
28260
+ anonymous: false,
28261
+ inputs: [
28262
+ {
28263
+ indexed: false,
28264
+ internalType: "PoolId",
28265
+ name: "_poolId",
28266
+ type: "bytes32",
28267
+ },
28268
+ {
28269
+ components: [
28270
+ { internalType: "bool", name: "enabled", type: "bool" },
28271
+ { internalType: "uint256", name: "walletCap", type: "uint256" },
28272
+ { internalType: "uint256", name: "txCap", type: "uint256" },
28273
+ ],
28274
+ indexed: false,
28275
+ internalType: "struct TrustedSignerFeeCalculator.FairLaunchSettings",
28276
+ name: "_settings",
28277
+ type: "tuple",
28278
+ },
28279
+ ],
28280
+ name: "PoolKeyFairLaunchSettingsUpdated",
28281
+ type: "event",
28282
+ },
28283
+ {
28284
+ anonymous: false,
28285
+ inputs: [
28286
+ {
28287
+ indexed: false,
28288
+ internalType: "PoolId",
28289
+ name: "_poolId",
28290
+ type: "bytes32",
28291
+ },
28292
+ {
28293
+ indexed: true,
28294
+ internalType: "address",
28295
+ name: "_signer",
28296
+ type: "address",
28297
+ },
28298
+ ],
28299
+ name: "PoolKeySignerUpdated",
28300
+ type: "event",
28301
+ },
28302
+ {
28303
+ anonymous: false,
28304
+ inputs: [
28305
+ {
28306
+ indexed: true,
28307
+ internalType: "address",
28308
+ name: "_signer",
28309
+ type: "address",
28310
+ },
28311
+ {
28312
+ indexed: false,
28313
+ internalType: "bool",
28314
+ name: "_isTrusted",
28315
+ type: "bool",
28316
+ },
28317
+ ],
28318
+ name: "TrustedSignerUpdated",
28319
+ type: "event",
28320
+ },
28321
+ {
28322
+ inputs: [{ internalType: "address", name: "_signer", type: "address" }],
28323
+ name: "addTrustedSigner",
26576
28324
  outputs: [],
26577
28325
  stateMutability: "nonpayable",
26578
28326
  type: "function",
@@ -28283,6 +30031,22 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
28283
30031
  flaunchIPFSWithSplitManager(params) {
28284
30032
  return this.readWriteFlaunchZap.flaunchIPFSWithSplitManager(params);
28285
30033
  }
30034
+ /**
30035
+ * Creates a new Flaunch with dynamic split manager configuration.
30036
+ * @param params - Parameters for creating the Flaunch with dynamic split manager
30037
+ * @returns Transaction response
30038
+ */
30039
+ flaunchWithDynamicSplitManager(params) {
30040
+ return this.readWriteFlaunchZap.flaunchWithDynamicSplitManager(params);
30041
+ }
30042
+ /**
30043
+ * Creates a new Flaunch with dynamic split manager configuration and IPFS metadata.
30044
+ * @param params - Parameters for creating the Flaunch with dynamic split manager and IPFS data
30045
+ * @returns Transaction response
30046
+ */
30047
+ flaunchIPFSWithDynamicSplitManager(params) {
30048
+ return this.readWriteFlaunchZap.flaunchIPFSWithDynamicSplitManager(params);
30049
+ }
28286
30050
  /**
28287
30051
  * Creates a new Flaunch with AnyPositionManager for external coins
28288
30052
  * @param params - Parameters for creating the Flaunch with AnyPositionManager
@@ -29263,6 +31027,148 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
29263
31027
  }
29264
31028
  }
29265
31029
 
31030
+ class ReadDynamicAddressFeeSplitManager {
31031
+ constructor(address, drift = createDrift$1()) {
31032
+ if (!address) {
31033
+ throw new Error("Address is required");
31034
+ }
31035
+ this.contract = drift.contract({
31036
+ abi: DynamicAddressFeeSplitManagerAbi,
31037
+ address,
31038
+ });
31039
+ }
31040
+ permissions() {
31041
+ return this.contract.read("permissions");
31042
+ }
31043
+ managerOwner() {
31044
+ return this.contract.read("managerOwner");
31045
+ }
31046
+ moderator() {
31047
+ return this.contract.read("moderator");
31048
+ }
31049
+ creatorShare() {
31050
+ return this.contract.read("creatorShare");
31051
+ }
31052
+ ownerShare() {
31053
+ return this.contract.read("ownerShare");
31054
+ }
31055
+ totalActiveShares() {
31056
+ return this.contract.read("totalActiveShares");
31057
+ }
31058
+ accumulatorPerShare() {
31059
+ return this.contract.read("accumulatorPerShare");
31060
+ }
31061
+ lastProcessedManagerFees() {
31062
+ return this.contract.read("lastProcessedManagerFees");
31063
+ }
31064
+ recipientCount() {
31065
+ return this.contract.read("recipientCount");
31066
+ }
31067
+ recipientAt(index) {
31068
+ return this.contract.read("recipientAt", {
31069
+ _index: index,
31070
+ });
31071
+ }
31072
+ recipients(recipient) {
31073
+ return this.contract.read("recipients", {
31074
+ _recipient: recipient,
31075
+ });
31076
+ }
31077
+ balances(recipient) {
31078
+ return this.contract.read("balances", {
31079
+ _recipient: recipient,
31080
+ });
31081
+ }
31082
+ recipientShare(recipient, data = "0x") {
31083
+ return this.contract.read("recipientShare", {
31084
+ _recipient: recipient,
31085
+ 1: data,
31086
+ });
31087
+ }
31088
+ pendingCreatorFees(recipient) {
31089
+ return this.contract.read("pendingCreatorFees", {
31090
+ _recipient: recipient,
31091
+ });
31092
+ }
31093
+ pendingOwnerFees() {
31094
+ return this.contract.read("pendingOwnerFees");
31095
+ }
31096
+ claimableOwnerFees() {
31097
+ return this.contract.read("claimableOwnerFees");
31098
+ }
31099
+ async allRecipients(includeInactive = false) {
31100
+ const count = await this.recipientCount();
31101
+ const recipients = await Promise.all(Array.from({ length: Number(count) }, (_, i) => this.recipientAt(BigInt(i))));
31102
+ if (includeInactive) {
31103
+ return recipients;
31104
+ }
31105
+ const recipientData = await Promise.all(recipients.map(async (recipient) => ({
31106
+ recipient,
31107
+ data: await this.recipients(recipient),
31108
+ })));
31109
+ return recipientData
31110
+ .filter(({ data }) => data.share > 0n)
31111
+ .map(({ recipient }) => recipient);
31112
+ }
31113
+ }
31114
+ class ReadWriteDynamicAddressFeeSplitManager extends ReadDynamicAddressFeeSplitManager {
31115
+ constructor(address, drift = createDrift$1()) {
31116
+ super(address, drift);
31117
+ }
31118
+ setPermissions(permissions) {
31119
+ return this.contract.write("setPermissions", {
31120
+ _permissions: permissions,
31121
+ });
31122
+ }
31123
+ transferManagerOwnership(newManagerOwner) {
31124
+ return this.contract.write("transferManagerOwnership", {
31125
+ _newManagerOwner: newManagerOwner,
31126
+ });
31127
+ }
31128
+ setModerator(moderator) {
31129
+ return this.contract.write("setModerator", {
31130
+ _moderator: moderator,
31131
+ });
31132
+ }
31133
+ updateRecipients(recipients) {
31134
+ return this.contract.write("updateRecipients", {
31135
+ _recipients: recipients,
31136
+ });
31137
+ }
31138
+ transferRecipientShare(newRecipient) {
31139
+ return this.contract.write("transferRecipientShare", {
31140
+ _newRecipient: newRecipient,
31141
+ });
31142
+ }
31143
+ claim() {
31144
+ return this.contract.write("claim", {});
31145
+ }
31146
+ claimForData(data) {
31147
+ return this.contract.write("claim", {
31148
+ _data: data,
31149
+ });
31150
+ }
31151
+ deposit(flaunchToken, creator, data) {
31152
+ return this.contract.write("deposit", {
31153
+ _flaunchToken: flaunchToken,
31154
+ _creator: creator,
31155
+ _data: data,
31156
+ });
31157
+ }
31158
+ setCreator(flaunchToken, creator) {
31159
+ return this.contract.write("setCreator", {
31160
+ _flaunchToken: flaunchToken,
31161
+ _creator: creator,
31162
+ });
31163
+ }
31164
+ rescue(flaunchToken, recipient) {
31165
+ return this.contract.write("rescue", {
31166
+ _flaunchToken: flaunchToken,
31167
+ _recipient: recipient,
31168
+ });
31169
+ }
31170
+ }
31171
+
29266
31172
  /**
29267
31173
  * Creates a Drift instance with the provided clients
29268
31174
  * @param params - Parameters for creating the Drift instance
@@ -29433,103 +31339,6 @@ async function parseCall(sdkMethod) {
29433
31339
  return decodeCallData(encodedCall);
29434
31340
  }
29435
31341
 
29436
- /**
29437
- * HMAC: RFC2104 message authentication code.
29438
- * @module
29439
- */
29440
- class HMAC extends Hash {
29441
- constructor(hash, _key) {
29442
- super();
29443
- this.finished = false;
29444
- this.destroyed = false;
29445
- ahash(hash);
29446
- const key = toBytes(_key);
29447
- this.iHash = hash.create();
29448
- if (typeof this.iHash.update !== 'function')
29449
- throw new Error('Expected instance of class which extends utils.Hash');
29450
- this.blockLen = this.iHash.blockLen;
29451
- this.outputLen = this.iHash.outputLen;
29452
- const blockLen = this.blockLen;
29453
- const pad = new Uint8Array(blockLen);
29454
- // blockLen can be bigger than outputLen
29455
- pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
29456
- for (let i = 0; i < pad.length; i++)
29457
- pad[i] ^= 0x36;
29458
- this.iHash.update(pad);
29459
- // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
29460
- this.oHash = hash.create();
29461
- // Undo internal XOR && apply outer XOR
29462
- for (let i = 0; i < pad.length; i++)
29463
- pad[i] ^= 0x36 ^ 0x5c;
29464
- this.oHash.update(pad);
29465
- pad.fill(0);
29466
- }
29467
- update(buf) {
29468
- aexists(this);
29469
- this.iHash.update(buf);
29470
- return this;
29471
- }
29472
- digestInto(out) {
29473
- aexists(this);
29474
- abytes$2(out, this.outputLen);
29475
- this.finished = true;
29476
- this.iHash.digestInto(out);
29477
- this.oHash.update(out);
29478
- this.oHash.digestInto(out);
29479
- this.destroy();
29480
- }
29481
- digest() {
29482
- const out = new Uint8Array(this.oHash.outputLen);
29483
- this.digestInto(out);
29484
- return out;
29485
- }
29486
- _cloneInto(to) {
29487
- // Create new instance without calling constructor since key already in state and we don't know it.
29488
- to || (to = Object.create(Object.getPrototypeOf(this), {}));
29489
- const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
29490
- to = to;
29491
- to.finished = finished;
29492
- to.destroyed = destroyed;
29493
- to.blockLen = blockLen;
29494
- to.outputLen = outputLen;
29495
- to.oHash = oHash._cloneInto(to.oHash);
29496
- to.iHash = iHash._cloneInto(to.iHash);
29497
- return to;
29498
- }
29499
- destroy() {
29500
- this.destroyed = true;
29501
- this.oHash.destroy();
29502
- this.iHash.destroy();
29503
- }
29504
- }
29505
- /**
29506
- * HMAC: RFC2104 message authentication code.
29507
- * @param hash - function that would be used e.g. sha256
29508
- * @param key - message key
29509
- * @param message - message data
29510
- * @example
29511
- * import { hmac } from '@noble/hashes/hmac';
29512
- * import { sha256 } from '@noble/hashes/sha2';
29513
- * const mac1 = hmac(sha256, 'key', 'message');
29514
- */
29515
- const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
29516
- hmac.create = (hash, key) => new HMAC(hash, key);
29517
-
29518
- /**
29519
- * RIPEMD-160 legacy hash function.
29520
- * https://homes.esat.kuleuven.be/~bosselae/ripemd160.html
29521
- * https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf
29522
- * @module
29523
- */
29524
- const Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
29525
- const Id = /* @__PURE__ */ new Uint8Array(new Array(16).fill(0).map((_, i) => i));
29526
- const Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);
29527
- let idxL = [Id];
29528
- let idxR = [Pi];
29529
- for (let i = 0; i < 4; i++)
29530
- for (let j of [idxL, idxR])
29531
- j.push(j[i].map((k) => Rho[k]));
29532
-
29533
31342
  /**
29534
31343
  * Hex, bytes and number utilities.
29535
31344
  * @module
@@ -29539,7 +31348,7 @@ for (let i = 0; i < 4; i++)
29539
31348
  // This is OK: `abstract` directory does not use noble-hashes.
29540
31349
  // User may opt-in into using different hashing library. This way, noble-hashes
29541
31350
  // won't be included into their bundle.
29542
- const _0n$3 = /* @__PURE__ */ BigInt(0);
31351
+ const _0n$4 = /* @__PURE__ */ BigInt(0);
29543
31352
  const _1n$4 = /* @__PURE__ */ BigInt(1);
29544
31353
  function isBytes$1(a) {
29545
31354
  return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
@@ -29552,6 +31361,7 @@ function abool(title, value) {
29552
31361
  if (typeof value !== 'boolean')
29553
31362
  throw new Error(title + ' boolean expected, got ' + value);
29554
31363
  }
31364
+ // Used in weierstrass, der
29555
31365
  function numberToHexUnpadded(num) {
29556
31366
  const hex = num.toString(16);
29557
31367
  return hex.length & 1 ? '0' + hex : hex;
@@ -29559,7 +31369,7 @@ function numberToHexUnpadded(num) {
29559
31369
  function hexToNumber(hex) {
29560
31370
  if (typeof hex !== 'string')
29561
31371
  throw new Error('hex string expected, got ' + typeof hex);
29562
- return hex === '' ? _0n$3 : BigInt('0x' + hex); // Big Endian
31372
+ return hex === '' ? _0n$4 : BigInt('0x' + hex); // Big Endian
29563
31373
  }
29564
31374
  // Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
29565
31375
  const hasHexBuiltin$1 =
@@ -29685,7 +31495,7 @@ function concatBytes(...arrays) {
29685
31495
  return res;
29686
31496
  }
29687
31497
  // Is positive bigint
29688
- const isPosBig = (n) => typeof n === 'bigint' && _0n$3 <= n;
31498
+ const isPosBig = (n) => typeof n === 'bigint' && _0n$4 <= n;
29689
31499
  function inRange(n, min, max) {
29690
31500
  return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
29691
31501
  }
@@ -29707,10 +31517,11 @@ function aInRange(title, n, min, max) {
29707
31517
  /**
29708
31518
  * Calculates amount of bits in a bigint.
29709
31519
  * Same as `n.toString(2).length`
31520
+ * TODO: merge with nLength in modular
29710
31521
  */
29711
31522
  function bitLen(n) {
29712
31523
  let len;
29713
- for (len = 0; n > _0n$3; n >>= _1n$4, len += 1)
31524
+ for (len = 0; n > _0n$4; n >>= _1n$4, len += 1)
29714
31525
  ;
29715
31526
  return len;
29716
31527
  }
@@ -29834,41 +31645,18 @@ function memoized(fn) {
29834
31645
  * @module
29835
31646
  */
29836
31647
  // prettier-ignore
29837
- const _0n$2 = BigInt(0), _1n$3 = BigInt(1), _2n$1 = /* @__PURE__ */ BigInt(2), _3n$1 = /* @__PURE__ */ BigInt(3);
31648
+ const _0n$3 = BigInt(0), _1n$3 = BigInt(1), _2n$1 = /* @__PURE__ */ BigInt(2), _3n$1 = /* @__PURE__ */ BigInt(3);
29838
31649
  // prettier-ignore
29839
- const _4n = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5), _8n = /* @__PURE__ */ BigInt(8);
31650
+ const _4n$1 = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5), _8n = /* @__PURE__ */ BigInt(8);
29840
31651
  // Calculates a modulo b
29841
31652
  function mod(a, b) {
29842
31653
  const result = a % b;
29843
- return result >= _0n$2 ? result : b + result;
29844
- }
29845
- /**
29846
- * Efficiently raise num to power and do modular division.
29847
- * Unsafe in some contexts: uses ladder, so can expose bigint bits.
29848
- * @todo use field version && remove
29849
- * @example
29850
- * pow(2n, 6n, 11n) // 64n % 11n == 9n
29851
- */
29852
- function pow(num, power, modulo) {
29853
- if (power < _0n$2)
29854
- throw new Error('invalid exponent, negatives unsupported');
29855
- if (modulo <= _0n$2)
29856
- throw new Error('invalid modulus');
29857
- if (modulo === _1n$3)
29858
- return _0n$2;
29859
- let res = _1n$3;
29860
- while (power > _0n$2) {
29861
- if (power & _1n$3)
29862
- res = (res * num) % modulo;
29863
- num = (num * num) % modulo;
29864
- power >>= _1n$3;
29865
- }
29866
- return res;
31654
+ return result >= _0n$3 ? result : b + result;
29867
31655
  }
29868
31656
  /** Does `x^(2^power)` mod p. `pow2(30, 4)` == `30^(2^4)` */
29869
31657
  function pow2(x, power, modulo) {
29870
31658
  let res = x;
29871
- while (power-- > _0n$2) {
31659
+ while (power-- > _0n$3) {
29872
31660
  res *= res;
29873
31661
  res %= modulo;
29874
31662
  }
@@ -29879,16 +31667,16 @@ function pow2(x, power, modulo) {
29879
31667
  * Implemented using [Euclidean GCD](https://brilliant.org/wiki/extended-euclidean-algorithm/).
29880
31668
  */
29881
31669
  function invert(number, modulo) {
29882
- if (number === _0n$2)
31670
+ if (number === _0n$3)
29883
31671
  throw new Error('invert: expected non-zero number');
29884
- if (modulo <= _0n$2)
31672
+ if (modulo <= _0n$3)
29885
31673
  throw new Error('invert: expected positive modulus, got ' + modulo);
29886
31674
  // Fermat's little theorem "CT-like" version inv(n) = n^(m-2) mod m is 30x slower.
29887
31675
  let a = mod(number, modulo);
29888
31676
  let b = modulo;
29889
31677
  // prettier-ignore
29890
- let x = _0n$2, u = _1n$3;
29891
- while (a !== _0n$2) {
31678
+ let x = _0n$3, u = _1n$3;
31679
+ while (a !== _0n$3) {
29892
31680
  // JIT applies optimization if those two lines follow each other
29893
31681
  const q = b / a;
29894
31682
  const r = b % a;
@@ -29901,116 +31689,141 @@ function invert(number, modulo) {
29901
31689
  throw new Error('invert: does not exist');
29902
31690
  return mod(x, modulo);
29903
31691
  }
31692
+ // Not all roots are possible! Example which will throw:
31693
+ // const NUM =
31694
+ // n = 72057594037927816n;
31695
+ // Fp = Field(BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab'));
31696
+ function sqrt3mod4(Fp, n) {
31697
+ const p1div4 = (Fp.ORDER + _1n$3) / _4n$1;
31698
+ const root = Fp.pow(n, p1div4);
31699
+ // Throw if root^2 != n
31700
+ if (!Fp.eql(Fp.sqr(root), n))
31701
+ throw new Error('Cannot find square root');
31702
+ return root;
31703
+ }
31704
+ function sqrt5mod8(Fp, n) {
31705
+ const p5div8 = (Fp.ORDER - _5n) / _8n;
31706
+ const n2 = Fp.mul(n, _2n$1);
31707
+ const v = Fp.pow(n2, p5div8);
31708
+ const nv = Fp.mul(n, v);
31709
+ const i = Fp.mul(Fp.mul(nv, _2n$1), v);
31710
+ const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
31711
+ if (!Fp.eql(Fp.sqr(root), n))
31712
+ throw new Error('Cannot find square root');
31713
+ return root;
31714
+ }
31715
+ // TODO: Commented-out for now. Provide test vectors.
31716
+ // Tonelli is too slow for extension fields Fp2.
31717
+ // That means we can't use sqrt (c1, c2...) even for initialization constants.
31718
+ // if (P % _16n === _9n) return sqrt9mod16;
31719
+ // // prettier-ignore
31720
+ // function sqrt9mod16<T>(Fp: IField<T>, n: T, p7div16?: bigint) {
31721
+ // if (p7div16 === undefined) p7div16 = (Fp.ORDER + BigInt(7)) / _16n;
31722
+ // const c1 = Fp.sqrt(Fp.neg(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F
31723
+ // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F
31724
+ // const c3 = Fp.sqrt(Fp.neg(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F
31725
+ // const c4 = p7div16; // 4. c4 = (q + 7) / 16 # Integer arithmetic
31726
+ // let tv1 = Fp.pow(n, c4); // 1. tv1 = x^c4
31727
+ // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1
31728
+ // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1
31729
+ // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1
31730
+ // const e1 = Fp.eql(Fp.sqr(tv2), n); // 5. e1 = (tv2^2) == x
31731
+ // const e2 = Fp.eql(Fp.sqr(tv3), n); // 6. e2 = (tv3^2) == x
31732
+ // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x
31733
+ // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x
31734
+ // const e3 = Fp.eql(Fp.sqr(tv2), n); // 9. e3 = (tv2^2) == x
31735
+ // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2
31736
+ // }
29904
31737
  /**
29905
31738
  * Tonelli-Shanks square root search algorithm.
29906
31739
  * 1. https://eprint.iacr.org/2012/685.pdf (page 12)
29907
31740
  * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks
29908
- * Will start an infinite loop if field order P is not prime.
29909
31741
  * @param P field order
29910
31742
  * @returns function that takes field Fp (created from P) and number n
29911
31743
  */
29912
31744
  function tonelliShanks(P) {
29913
- // Legendre constant: used to calculate Legendre symbol (a | p),
29914
- // which denotes the value of a^((p-1)/2) (mod p).
29915
- // (a | p) 1 if a is a square (mod p)
29916
- // (a | p) ≡ -1 if a is not a square (mod p)
29917
- // (a | p) 0 if a ≡ 0 (mod p)
29918
- const legendreC = (P - _1n$3) / _2n$1;
29919
- let Q, S, Z;
29920
- // Step 1: By factoring out powers of 2 from p - 1,
29921
- // find q and s such that p - 1 = q*(2^s) with q odd
29922
- for (Q = P - _1n$3, S = 0; Q % _2n$1 === _0n$2; Q /= _2n$1, S++)
29923
- ;
29924
- // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq
29925
- for (Z = _2n$1; Z < P && pow(Z, legendreC, P) !== P - _1n$3; Z++) {
29926
- // Crash instead of infinity loop, we cannot reasonable count until P.
29927
- if (Z > 1000)
29928
- throw new Error('Cannot find square root: likely non-prime P');
29929
- }
29930
- // Fast-path
29931
- if (S === 1) {
29932
- const p1div4 = (P + _1n$3) / _4n;
29933
- return function tonelliFast(Fp, n) {
29934
- const root = Fp.pow(n, p1div4);
29935
- if (!Fp.eql(Fp.sqr(root), n))
29936
- throw new Error('Cannot find square root');
29937
- return root;
29938
- };
29939
- }
31745
+ // Initialization (precomputation).
31746
+ if (P < BigInt(3))
31747
+ throw new Error('sqrt is not defined for small field');
31748
+ // Factor P - 1 = Q * 2^S, where Q is odd
31749
+ let Q = P - _1n$3;
31750
+ let S = 0;
31751
+ while (Q % _2n$1 === _0n$3) {
31752
+ Q /= _2n$1;
31753
+ S++;
31754
+ }
31755
+ // Find the first quadratic non-residue Z >= 2
31756
+ let Z = _2n$1;
31757
+ const _Fp = Field(P);
31758
+ while (FpLegendre(_Fp, Z) === 1) {
31759
+ // Basic primality test for P. After x iterations, chance of
31760
+ // not finding quadratic non-residue is 2^x, so 2^1000.
31761
+ if (Z++ > 1000)
31762
+ throw new Error('Cannot find square root: probably non-prime P');
31763
+ }
31764
+ // Fast-path; usually done before Z, but we do "primality test".
31765
+ if (S === 1)
31766
+ return sqrt3mod4;
29940
31767
  // Slow-path
31768
+ // TODO: test on Fp2 and others
31769
+ let cc = _Fp.pow(Z, Q); // c = z^Q
29941
31770
  const Q1div2 = (Q + _1n$3) / _2n$1;
29942
31771
  return function tonelliSlow(Fp, n) {
29943
- // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1
29944
- if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE))
31772
+ if (Fp.is0(n))
31773
+ return n;
31774
+ // Check if n is a quadratic residue using Legendre symbol
31775
+ if (FpLegendre(Fp, n) !== 1)
29945
31776
  throw new Error('Cannot find square root');
29946
- let r = S;
29947
- // TODO: will fail at Fp2/etc
29948
- let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b
29949
- let x = Fp.pow(n, Q1div2); // first guess at the square root
29950
- let b = Fp.pow(n, Q); // first guess at the fudge factor
29951
- while (!Fp.eql(b, Fp.ONE)) {
29952
- if (Fp.eql(b, Fp.ZERO))
29953
- return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0)
29954
- // Find m such b^(2^m)==1
29955
- let m = 1;
29956
- for (let t2 = Fp.sqr(b); m < r; m++) {
29957
- if (Fp.eql(t2, Fp.ONE))
29958
- break;
29959
- t2 = Fp.sqr(t2); // t2 *= t2
31777
+ // Initialize variables for the main loop
31778
+ let M = S;
31779
+ let c = Fp.mul(Fp.ONE, cc); // c = z^Q, move cc from field _Fp into field Fp
31780
+ let t = Fp.pow(n, Q); // t = n^Q, first guess at the fudge factor
31781
+ let R = Fp.pow(n, Q1div2); // R = n^((Q+1)/2), first guess at the square root
31782
+ // Main loop
31783
+ // while t != 1
31784
+ while (!Fp.eql(t, Fp.ONE)) {
31785
+ if (Fp.is0(t))
31786
+ return Fp.ZERO; // if t=0 return R=0
31787
+ let i = 1;
31788
+ // Find the smallest i >= 1 such that t^(2^i) ≡ 1 (mod P)
31789
+ let t_tmp = Fp.sqr(t); // t^(2^1)
31790
+ while (!Fp.eql(t_tmp, Fp.ONE)) {
31791
+ i++;
31792
+ t_tmp = Fp.sqr(t_tmp); // t^(2^2)...
31793
+ if (i === M)
31794
+ throw new Error('Cannot find square root');
29960
31795
  }
29961
- // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow
29962
- const ge = Fp.pow(g, _1n$3 << BigInt(r - m - 1)); // ge = 2^(r-m-1)
29963
- g = Fp.sqr(ge); // g = ge * ge
29964
- x = Fp.mul(x, ge); // x *= ge
29965
- b = Fp.mul(b, g); // b *= g
29966
- r = m;
31796
+ // Calculate the exponent for b: 2^(M - i - 1)
31797
+ const exponent = _1n$3 << BigInt(M - i - 1); // bigint is important
31798
+ const b = Fp.pow(c, exponent); // b = 2^(M - i - 1)
31799
+ // Update variables
31800
+ M = i;
31801
+ c = Fp.sqr(b); // c = b^2
31802
+ t = Fp.mul(t, c); // t = (t * b^2)
31803
+ R = Fp.mul(R, b); // R = R*b
29967
31804
  }
29968
- return x;
31805
+ return R;
29969
31806
  };
29970
31807
  }
29971
31808
  /**
29972
- * Square root for a finite field. It will try to check if optimizations are applicable and fall back to 4:
31809
+ * Square root for a finite field. Will try optimized versions first:
29973
31810
  *
29974
31811
  * 1. P ≡ 3 (mod 4)
29975
31812
  * 2. P ≡ 5 (mod 8)
29976
- * 3. P ≡ 9 (mod 16)
29977
- * 4. Tonelli-Shanks algorithm
31813
+ * 3. Tonelli-Shanks algorithm
29978
31814
  *
29979
31815
  * Different algorithms can give different roots, it is up to user to decide which one they want.
29980
31816
  * For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve).
29981
31817
  */
29982
31818
  function FpSqrt(P) {
29983
- // P ≡ 3 (mod 4)
29984
- // √n = n^((P+1)/4)
29985
- if (P % _4n === _3n$1) {
29986
- // Not all roots possible!
29987
- // const ORDER =
29988
- // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn;
29989
- // const NUM = 72057594037927816n;
29990
- const p1div4 = (P + _1n$3) / _4n;
29991
- return function sqrt3mod4(Fp, n) {
29992
- const root = Fp.pow(n, p1div4);
29993
- // Throw if root**2 != n
29994
- if (!Fp.eql(Fp.sqr(root), n))
29995
- throw new Error('Cannot find square root');
29996
- return root;
29997
- };
29998
- }
29999
- // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10)
30000
- if (P % _8n === _5n) {
30001
- const c1 = (P - _5n) / _8n;
30002
- return function sqrt5mod8(Fp, n) {
30003
- const n2 = Fp.mul(n, _2n$1);
30004
- const v = Fp.pow(n2, c1);
30005
- const nv = Fp.mul(n, v);
30006
- const i = Fp.mul(Fp.mul(nv, _2n$1), v);
30007
- const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
30008
- if (!Fp.eql(Fp.sqr(root), n))
30009
- throw new Error('Cannot find square root');
30010
- return root;
30011
- };
30012
- }
30013
- // Other cases: Tonelli-Shanks algorithm
31819
+ // P ≡ 3 (mod 4) => √n = n^((P+1)/4)
31820
+ if (P % _4n$1 === _3n$1)
31821
+ return sqrt3mod4;
31822
+ // P 5 (mod 8) => Atkin algorithm, page 10 of https://eprint.iacr.org/2012/685.pdf
31823
+ if (P % _8n === _5n)
31824
+ return sqrt5mod8;
31825
+ // P 9 (mod 16) not implemented, see above
31826
+ // Tonelli-Shanks algorithm
30014
31827
  return tonelliShanks(P);
30015
31828
  }
30016
31829
  // prettier-ignore
@@ -30037,52 +31850,74 @@ function validateField(field) {
30037
31850
  * Same as `pow` but for Fp: non-constant-time.
30038
31851
  * Unsafe in some contexts: uses ladder, so can expose bigint bits.
30039
31852
  */
30040
- function FpPow(f, num, power) {
30041
- // Should have same speed as pow for bigints
30042
- // TODO: benchmark!
30043
- if (power < _0n$2)
31853
+ function FpPow(Fp, num, power) {
31854
+ if (power < _0n$3)
30044
31855
  throw new Error('invalid exponent, negatives unsupported');
30045
- if (power === _0n$2)
30046
- return f.ONE;
31856
+ if (power === _0n$3)
31857
+ return Fp.ONE;
30047
31858
  if (power === _1n$3)
30048
31859
  return num;
30049
- let p = f.ONE;
31860
+ let p = Fp.ONE;
30050
31861
  let d = num;
30051
- while (power > _0n$2) {
31862
+ while (power > _0n$3) {
30052
31863
  if (power & _1n$3)
30053
- p = f.mul(p, d);
30054
- d = f.sqr(d);
31864
+ p = Fp.mul(p, d);
31865
+ d = Fp.sqr(d);
30055
31866
  power >>= _1n$3;
30056
31867
  }
30057
31868
  return p;
30058
31869
  }
30059
31870
  /**
30060
31871
  * Efficiently invert an array of Field elements.
30061
- * `inv(0)` will return `undefined` here: make sure to throw an error.
31872
+ * Exception-free. Will return `undefined` for 0 elements.
31873
+ * @param passZero map 0 to 0 (instead of undefined)
30062
31874
  */
30063
- function FpInvertBatch(f, nums) {
30064
- const tmp = new Array(nums.length);
31875
+ function FpInvertBatch(Fp, nums, passZero = false) {
31876
+ const inverted = new Array(nums.length).fill(passZero ? Fp.ZERO : undefined);
30065
31877
  // Walk from first to last, multiply them by each other MOD p
30066
- const lastMultiplied = nums.reduce((acc, num, i) => {
30067
- if (f.is0(num))
31878
+ const multipliedAcc = nums.reduce((acc, num, i) => {
31879
+ if (Fp.is0(num))
30068
31880
  return acc;
30069
- tmp[i] = acc;
30070
- return f.mul(acc, num);
30071
- }, f.ONE);
31881
+ inverted[i] = acc;
31882
+ return Fp.mul(acc, num);
31883
+ }, Fp.ONE);
30072
31884
  // Invert last element
30073
- const inverted = f.inv(lastMultiplied);
31885
+ const invertedAcc = Fp.inv(multipliedAcc);
30074
31886
  // Walk from last to first, multiply them by inverted each other MOD p
30075
31887
  nums.reduceRight((acc, num, i) => {
30076
- if (f.is0(num))
31888
+ if (Fp.is0(num))
30077
31889
  return acc;
30078
- tmp[i] = f.mul(acc, tmp[i]);
30079
- return f.mul(acc, num);
30080
- }, inverted);
30081
- return tmp;
31890
+ inverted[i] = Fp.mul(acc, inverted[i]);
31891
+ return Fp.mul(acc, num);
31892
+ }, invertedAcc);
31893
+ return inverted;
31894
+ }
31895
+ /**
31896
+ * Legendre symbol.
31897
+ * Legendre constant is used to calculate Legendre symbol (a | p)
31898
+ * which denotes the value of a^((p-1)/2) (mod p).
31899
+ *
31900
+ * * (a | p) ≡ 1 if a is a square (mod p), quadratic residue
31901
+ * * (a | p) ≡ -1 if a is not a square (mod p), quadratic non residue
31902
+ * * (a | p) ≡ 0 if a ≡ 0 (mod p)
31903
+ */
31904
+ function FpLegendre(Fp, n) {
31905
+ // We can use 3rd argument as optional cache of this value
31906
+ // but seems unneeded for now. The operation is very fast.
31907
+ const p1mod2 = (Fp.ORDER - _1n$3) / _2n$1;
31908
+ const powered = Fp.pow(n, p1mod2);
31909
+ const yes = Fp.eql(powered, Fp.ONE);
31910
+ const zero = Fp.eql(powered, Fp.ZERO);
31911
+ const no = Fp.eql(powered, Fp.neg(Fp.ONE));
31912
+ if (!yes && !zero && !no)
31913
+ throw new Error('invalid Legendre symbol result');
31914
+ return yes ? 1 : zero ? 0 : -1;
30082
31915
  }
30083
31916
  // CURVE.n lengths
30084
31917
  function nLength(n, nBitLength) {
30085
31918
  // Bit size, byte size of CURVE.n
31919
+ if (nBitLength !== undefined)
31920
+ anumber$1(nBitLength);
30086
31921
  const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;
30087
31922
  const nByteLength = Math.ceil(_nBitLength / 8);
30088
31923
  return { nBitLength: _nBitLength, nByteLength };
@@ -30103,7 +31938,7 @@ function nLength(n, nBitLength) {
30103
31938
  * @param redef optional faster redefinitions of sqrt and other methods
30104
31939
  */
30105
31940
  function Field(ORDER, bitLen, isLE = false, redef = {}) {
30106
- if (ORDER <= _0n$2)
31941
+ if (ORDER <= _0n$3)
30107
31942
  throw new Error('invalid field: expected ORDER > 0, got ' + ORDER);
30108
31943
  const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen);
30109
31944
  if (BYTES > 2048)
@@ -30115,15 +31950,15 @@ function Field(ORDER, bitLen, isLE = false, redef = {}) {
30115
31950
  BITS,
30116
31951
  BYTES,
30117
31952
  MASK: bitMask(BITS),
30118
- ZERO: _0n$2,
31953
+ ZERO: _0n$3,
30119
31954
  ONE: _1n$3,
30120
31955
  create: (num) => mod(num, ORDER),
30121
31956
  isValid: (num) => {
30122
31957
  if (typeof num !== 'bigint')
30123
31958
  throw new Error('invalid field element: expected bigint, got ' + typeof num);
30124
- return _0n$2 <= num && num < ORDER; // 0 is valid element, but it's not invertible
31959
+ return _0n$3 <= num && num < ORDER; // 0 is valid element, but it's not invertible
30125
31960
  },
30126
- is0: (num) => num === _0n$2,
31961
+ is0: (num) => num === _0n$3,
30127
31962
  isOdd: (num) => (num & _1n$3) === _1n$3,
30128
31963
  neg: (num) => mod(-num, ORDER),
30129
31964
  eql: (lhs, rhs) => lhs === rhs,
@@ -30145,16 +31980,17 @@ function Field(ORDER, bitLen, isLE = false, redef = {}) {
30145
31980
  sqrtP = FpSqrt(ORDER);
30146
31981
  return sqrtP(f, n);
30147
31982
  }),
30148
- invertBatch: (lst) => FpInvertBatch(f, lst),
30149
- // TODO: do we really need constant cmov?
30150
- // We don't have const-time bigints anyway, so probably will be not very useful
30151
- cmov: (a, b, c) => (c ? b : a),
30152
31983
  toBytes: (num) => (isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)),
30153
31984
  fromBytes: (bytes) => {
30154
31985
  if (bytes.length !== BYTES)
30155
31986
  throw new Error('Field.fromBytes: expected ' + BYTES + ' bytes, got ' + bytes.length);
30156
31987
  return isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes);
30157
31988
  },
31989
+ // TODO: we don't need it here, move out to separate fn
31990
+ invertBatch: (lst) => FpInvertBatch(f, lst),
31991
+ // We can't move this out because Fp6, Fp12 implement it
31992
+ // and it's unclear what to return in there.
31993
+ cmov: (a, b, c) => (c ? b : a),
30158
31994
  });
30159
31995
  return Object.freeze(f);
30160
31996
  }
@@ -30207,12 +32043,97 @@ function mapHashToField(key, fieldOrder, isLE = false) {
30207
32043
  return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
30208
32044
  }
30209
32045
 
32046
+ /**
32047
+ * HMAC: RFC2104 message authentication code.
32048
+ * @module
32049
+ */
32050
+ class HMAC extends Hash {
32051
+ constructor(hash, _key) {
32052
+ super();
32053
+ this.finished = false;
32054
+ this.destroyed = false;
32055
+ ahash(hash);
32056
+ const key = toBytes(_key);
32057
+ this.iHash = hash.create();
32058
+ if (typeof this.iHash.update !== 'function')
32059
+ throw new Error('Expected instance of class which extends utils.Hash');
32060
+ this.blockLen = this.iHash.blockLen;
32061
+ this.outputLen = this.iHash.outputLen;
32062
+ const blockLen = this.blockLen;
32063
+ const pad = new Uint8Array(blockLen);
32064
+ // blockLen can be bigger than outputLen
32065
+ pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
32066
+ for (let i = 0; i < pad.length; i++)
32067
+ pad[i] ^= 0x36;
32068
+ this.iHash.update(pad);
32069
+ // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
32070
+ this.oHash = hash.create();
32071
+ // Undo internal XOR && apply outer XOR
32072
+ for (let i = 0; i < pad.length; i++)
32073
+ pad[i] ^= 0x36 ^ 0x5c;
32074
+ this.oHash.update(pad);
32075
+ clean(pad);
32076
+ }
32077
+ update(buf) {
32078
+ aexists(this);
32079
+ this.iHash.update(buf);
32080
+ return this;
32081
+ }
32082
+ digestInto(out) {
32083
+ aexists(this);
32084
+ abytes$2(out, this.outputLen);
32085
+ this.finished = true;
32086
+ this.iHash.digestInto(out);
32087
+ this.oHash.update(out);
32088
+ this.oHash.digestInto(out);
32089
+ this.destroy();
32090
+ }
32091
+ digest() {
32092
+ const out = new Uint8Array(this.oHash.outputLen);
32093
+ this.digestInto(out);
32094
+ return out;
32095
+ }
32096
+ _cloneInto(to) {
32097
+ // Create new instance without calling constructor since key already in state and we don't know it.
32098
+ to || (to = Object.create(Object.getPrototypeOf(this), {}));
32099
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
32100
+ to = to;
32101
+ to.finished = finished;
32102
+ to.destroyed = destroyed;
32103
+ to.blockLen = blockLen;
32104
+ to.outputLen = outputLen;
32105
+ to.oHash = oHash._cloneInto(to.oHash);
32106
+ to.iHash = iHash._cloneInto(to.iHash);
32107
+ return to;
32108
+ }
32109
+ clone() {
32110
+ return this._cloneInto();
32111
+ }
32112
+ destroy() {
32113
+ this.destroyed = true;
32114
+ this.oHash.destroy();
32115
+ this.iHash.destroy();
32116
+ }
32117
+ }
32118
+ /**
32119
+ * HMAC: RFC2104 message authentication code.
32120
+ * @param hash - function that would be used e.g. sha256
32121
+ * @param key - message key
32122
+ * @param message - message data
32123
+ * @example
32124
+ * import { hmac } from '@noble/hashes/hmac';
32125
+ * import { sha256 } from '@noble/hashes/sha2';
32126
+ * const mac1 = hmac(sha256, 'key', 'message');
32127
+ */
32128
+ const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
32129
+ hmac.create = (hash, key) => new HMAC(hash, key);
32130
+
30210
32131
  /**
30211
32132
  * Methods for elliptic curve multiplication by scalars.
30212
32133
  * Contains wNAF, pippenger
30213
32134
  * @module
30214
32135
  */
30215
- const _0n$1 = BigInt(0);
32136
+ const _0n$2 = BigInt(0);
30216
32137
  const _1n$2 = BigInt(1);
30217
32138
  function constTimeNegate(condition, item) {
30218
32139
  const neg = item.negate();
@@ -30300,7 +32221,7 @@ function wNAF(c, bits) {
30300
32221
  // non-const time multiplication ladder
30301
32222
  unsafeLadder(elm, n, p = c.ZERO) {
30302
32223
  let d = elm;
30303
- while (n > _0n$1) {
32224
+ while (n > _0n$2) {
30304
32225
  if (n & _1n$2)
30305
32226
  p = p.add(d);
30306
32227
  d = d.double();
@@ -30389,7 +32310,7 @@ function wNAF(c, bits) {
30389
32310
  wNAFUnsafe(W, precomputes, n, acc = c.ZERO) {
30390
32311
  const wo = calcWOpts(W, bits);
30391
32312
  for (let window = 0; window < wo.windows; window++) {
30392
- if (n === _0n$1)
32313
+ if (n === _0n$2)
30393
32314
  break; // Early-exit, skip 0 value
30394
32315
  const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo);
30395
32316
  n = nextN;
@@ -30454,18 +32375,27 @@ function pippenger(c, fieldN, points, scalars) {
30454
32375
  // 0 is accepted in scalars
30455
32376
  validateMSMPoints(points, c);
30456
32377
  validateMSMScalars(scalars, fieldN);
30457
- if (points.length !== scalars.length)
32378
+ const plength = points.length;
32379
+ const slength = scalars.length;
32380
+ if (plength !== slength)
30458
32381
  throw new Error('arrays of points and scalars must have equal length');
32382
+ // if (plength === 0) throw new Error('array must be of length >= 2');
30459
32383
  const zero = c.ZERO;
30460
- const wbits = bitLen(BigInt(points.length));
30461
- const windowSize = wbits > 12 ? wbits - 3 : wbits > 4 ? wbits - 2 : wbits ? 2 : 1; // in bits
32384
+ const wbits = bitLen(BigInt(plength));
32385
+ let windowSize = 1; // bits
32386
+ if (wbits > 12)
32387
+ windowSize = wbits - 3;
32388
+ else if (wbits > 4)
32389
+ windowSize = wbits - 2;
32390
+ else if (wbits > 0)
32391
+ windowSize = 2;
30462
32392
  const MASK = bitMask(windowSize);
30463
32393
  const buckets = new Array(Number(MASK) + 1).fill(zero); // +1 for zero array
30464
32394
  const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize;
30465
32395
  let sum = zero;
30466
32396
  for (let i = lastBits; i >= 0; i -= windowSize) {
30467
32397
  buckets.fill(zero);
30468
- for (let j = 0; j < scalars.length; j++) {
32398
+ for (let j = 0; j < slength; j++) {
30469
32399
  const scalar = scalars[j];
30470
32400
  const wbits = Number((scalar >> BigInt(i)) & MASK);
30471
32401
  buckets[wbits] = buckets[wbits].add(points[j]);
@@ -30511,9 +32441,9 @@ function validateBasic(curve) {
30511
32441
  *
30512
32442
  * * a: formula param
30513
32443
  * * b: formula param
30514
- * * Fp: finite Field over which we'll do calculations. Can be complex (Fp2, Fp12)
30515
- * * n: Curve prime subgroup order, total count of valid points in the field
30516
- * * Gx: Base point (x, y) aka generator point x coordinate
32444
+ * * Fp: finite field of prime characteristic P; may be complex (Fp2). Arithmetics is done in field
32445
+ * * n: order of prime subgroup a.k.a total amount of valid curve points
32446
+ * * Gx: Base point (x, y) aka generator point. Gx = x coordinate
30517
32447
  * * Gy: ...y coordinate
30518
32448
  * * h: cofactor, usually 1. h*n = curve group order (n is only subgroup order)
30519
32449
  * * lowS: whether to enable (default) or disable "low-s" non-malleable signatures
@@ -30553,23 +32483,23 @@ function validatePointOpts(curve) {
30553
32483
  a: 'field',
30554
32484
  b: 'field',
30555
32485
  }, {
32486
+ allowInfinityPoint: 'boolean',
30556
32487
  allowedPrivateKeyLengths: 'array',
30557
- wrapPrivateKey: 'boolean',
30558
- isTorsionFree: 'function',
30559
32488
  clearCofactor: 'function',
30560
- allowInfinityPoint: 'boolean',
30561
32489
  fromBytes: 'function',
32490
+ isTorsionFree: 'function',
30562
32491
  toBytes: 'function',
32492
+ wrapPrivateKey: 'boolean',
30563
32493
  });
30564
32494
  const { endo, Fp, a } = opts;
30565
32495
  if (endo) {
30566
32496
  if (!Fp.eql(a, Fp.ZERO)) {
30567
- throw new Error('invalid endomorphism, can only be defined for Koblitz curves that have a=0');
32497
+ throw new Error('invalid endo: CURVE.a must be 0');
30568
32498
  }
30569
32499
  if (typeof endo !== 'object' ||
30570
32500
  typeof endo.beta !== 'bigint' ||
30571
32501
  typeof endo.splitScalar !== 'function') {
30572
- throw new Error('invalid endomorphism, expected beta: bigint and splitScalar: function');
32502
+ throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');
30573
32503
  }
30574
32504
  }
30575
32505
  return Object.freeze({ ...opts });
@@ -30650,7 +32580,7 @@ const DER = {
30650
32580
  _int: {
30651
32581
  encode(num) {
30652
32582
  const { Err: E } = DER;
30653
- if (num < _0n)
32583
+ if (num < _0n$1)
30654
32584
  throw new E('integer: negative integers are not allowed');
30655
32585
  let hex = numberToHexUnpadded(num);
30656
32586
  // Pad with zero byte if negative flag is present
@@ -30690,9 +32620,12 @@ const DER = {
30690
32620
  return tlv.encode(0x30, seq);
30691
32621
  },
30692
32622
  };
32623
+ function numToSizedHex(num, size) {
32624
+ return bytesToHex(numberToBytesBE(num, size));
32625
+ }
30693
32626
  // Be friendly to bad ECMAScript parsers by not using bigint literals
30694
32627
  // prettier-ignore
30695
- const _0n = BigInt(0), _1n$1 = BigInt(1); BigInt(2); const _3n = BigInt(3); BigInt(4);
32628
+ const _0n$1 = BigInt(0), _1n$1 = BigInt(1); BigInt(2); const _3n = BigInt(3), _4n = BigInt(4);
30696
32629
  function weierstrassPoints(opts) {
30697
32630
  const CURVE = validatePointOpts(opts);
30698
32631
  const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ
@@ -30718,15 +32651,24 @@ function weierstrassPoints(opts) {
30718
32651
  function weierstrassEquation(x) {
30719
32652
  const { a, b } = CURVE;
30720
32653
  const x2 = Fp.sqr(x); // x * x
30721
- const x3 = Fp.mul(x2, x); // x2 * x
30722
- return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b
32654
+ const x3 = Fp.mul(x2, x); // * x
32655
+ return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // + a * x + b
32656
+ }
32657
+ function isValidXY(x, y) {
32658
+ const left = Fp.sqr(y); // y²
32659
+ const right = weierstrassEquation(x); // x³ + ax + b
32660
+ return Fp.eql(left, right);
30723
32661
  }
30724
32662
  // Validate whether the passed curve params are valid.
30725
- // We check if curve equation works for generator point.
30726
- // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381.
30727
- // ProjectivePoint class has not been initialized yet.
30728
- if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))
30729
- throw new Error('bad generator point: equation left != right');
32663
+ // Test 1: equation = + ax + b should work for generator point.
32664
+ if (!isValidXY(CURVE.Gx, CURVE.Gy))
32665
+ throw new Error('bad curve params: generator point');
32666
+ // Test 2: discriminant Δ part should be non-zero: 4a³ + 27b² != 0.
32667
+ // Guarantees curve is genus-1, smooth (non-singular).
32668
+ const _4a3 = Fp.mul(Fp.pow(CURVE.a, _3n), _4n);
32669
+ const _27b2 = Fp.mul(Fp.sqr(CURVE.b), BigInt(27));
32670
+ if (Fp.is0(Fp.add(_4a3, _27b2)))
32671
+ throw new Error('bad curve params: a or b');
30730
32672
  // Valid group elements reside in range 1..n-1
30731
32673
  function isWithinCurveOrder(num) {
30732
32674
  return inRange(num, _1n$1, CURVE.n);
@@ -30765,7 +32707,7 @@ function weierstrassPoints(opts) {
30765
32707
  // Memoized toAffine / validity check. They are heavy. Points are immutable.
30766
32708
  // Converts Projective point to affine (x, y) coordinates.
30767
32709
  // Can accept precomputed Z^-1 - for example, from invertBatch.
30768
- // (x, y, z) ∋ (x=x/z, y=y/z)
32710
+ // (X, Y, Z) ∋ (x=X/Z, y=Y/Z)
30769
32711
  const toAffineMemo = memoized((p, iz) => {
30770
32712
  const { px: x, py: y, pz: z } = p;
30771
32713
  // Fast-path for normalized points
@@ -30801,16 +32743,14 @@ function weierstrassPoints(opts) {
30801
32743
  // Check if x, y are valid field elements
30802
32744
  if (!Fp.isValid(x) || !Fp.isValid(y))
30803
32745
  throw new Error('bad point: x or y not FE');
30804
- const left = Fp.sqr(y); // y²
30805
- const right = weierstrassEquation(x); // x³ + ax + b
30806
- if (!Fp.eql(left, right))
32746
+ if (!isValidXY(x, y))
30807
32747
  throw new Error('bad point: equation left != right');
30808
32748
  if (!p.isTorsionFree())
30809
32749
  throw new Error('bad point: not in prime-order subgroup');
30810
32750
  return true;
30811
32751
  });
30812
32752
  /**
30813
- * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z)
32753
+ * Projective Point works in 3d / projective (homogeneous) coordinates: (X, Y, Z) ∋ (x=X/Z, y=Y/Z)
30814
32754
  * Default Point works in 2d / affine coordinates: (x, y)
30815
32755
  * We're doing calculations in projective, because its operations don't require costly inversion.
30816
32756
  */
@@ -30818,7 +32758,7 @@ function weierstrassPoints(opts) {
30818
32758
  constructor(px, py, pz) {
30819
32759
  if (px == null || !Fp.isValid(px))
30820
32760
  throw new Error('x required');
30821
- if (py == null || !Fp.isValid(py))
32761
+ if (py == null || !Fp.isValid(py) || Fp.is0(py))
30822
32762
  throw new Error('y required');
30823
32763
  if (pz == null || !Fp.isValid(pz))
30824
32764
  throw new Error('z required');
@@ -30854,7 +32794,7 @@ function weierstrassPoints(opts) {
30854
32794
  * Optimization: converts a list of projective points to a list of identical points with Z=1.
30855
32795
  */
30856
32796
  static normalizeZ(points) {
30857
- const toInv = Fp.invertBatch(points.map((p) => p.pz));
32797
+ const toInv = FpInvertBatch(Fp, points.map((p) => p.pz));
30858
32798
  return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);
30859
32799
  }
30860
32800
  /**
@@ -31016,9 +32956,9 @@ function weierstrassPoints(opts) {
31016
32956
  */
31017
32957
  multiplyUnsafe(sc) {
31018
32958
  const { endo, n: N } = CURVE;
31019
- aInRange('scalar', sc, _0n, N);
32959
+ aInRange('scalar', sc, _0n$1, N);
31020
32960
  const I = Point.ZERO;
31021
- if (sc === _0n)
32961
+ if (sc === _0n$1)
31022
32962
  return I;
31023
32963
  if (this.is0() || sc === _1n$1)
31024
32964
  return this;
@@ -31026,11 +32966,12 @@ function weierstrassPoints(opts) {
31026
32966
  if (!endo || wnaf.hasPrecomputes(this))
31027
32967
  return wnaf.wNAFCachedUnsafe(this, sc, Point.normalizeZ);
31028
32968
  // Case c: endomorphism
32969
+ /** See docs for {@link EndomorphismOpts} */
31029
32970
  let { k1neg, k1, k2neg, k2 } = endo.splitScalar(sc);
31030
32971
  let k1p = I;
31031
32972
  let k2p = I;
31032
32973
  let d = this;
31033
- while (k1 > _0n || k2 > _0n) {
32974
+ while (k1 > _0n$1 || k2 > _0n$1) {
31034
32975
  if (k1 & _1n$1)
31035
32976
  k1p = k1p.add(d);
31036
32977
  if (k2 & _1n$1)
@@ -31059,6 +33000,7 @@ function weierstrassPoints(opts) {
31059
33000
  const { endo, n: N } = CURVE;
31060
33001
  aInRange('scalar', scalar, _1n$1, N);
31061
33002
  let point, fake; // Fake point is used to const-time mult
33003
+ /** See docs for {@link EndomorphismOpts} */
31062
33004
  if (endo) {
31063
33005
  const { k1neg, k1, k2neg, k2 } = endo.splitScalar(scalar);
31064
33006
  let { p: k1p, f: f1p } = this.wNAF(k1);
@@ -31086,7 +33028,7 @@ function weierstrassPoints(opts) {
31086
33028
  multiplyAndAddUnsafe(Q, a, b) {
31087
33029
  const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes
31088
33030
  const mul = (P, a // Select faster multiply() method
31089
- ) => (a === _0n || a === _1n$1 || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a));
33031
+ ) => (a === _0n$1 || a === _1n$1 || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a));
31090
33032
  const sum = mul(this, a).add(mul(Q, b));
31091
33033
  return sum.is0() ? undefined : sum;
31092
33034
  }
@@ -31122,11 +33064,12 @@ function weierstrassPoints(opts) {
31122
33064
  return bytesToHex(this.toRawBytes(isCompressed));
31123
33065
  }
31124
33066
  }
33067
+ // base / generator point
31125
33068
  Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);
31126
- Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO);
31127
- const _bits = CURVE.nBitLength;
31128
- const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);
31129
- // Validate if generator point is on curve
33069
+ // zero / infinity / identity point
33070
+ Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); // 0, 1, 0
33071
+ const { endo, nBitLength } = CURVE;
33072
+ const wnaf = wNAF(Point, endo ? Math.ceil(nBitLength / 2) : nBitLength);
31130
33073
  return {
31131
33074
  CURVE,
31132
33075
  ProjectivePoint: Point,
@@ -31157,7 +33100,7 @@ function validateOpts(curve) {
31157
33100
  */
31158
33101
  function weierstrass(curveDef) {
31159
33102
  const CURVE = validateOpts(curveDef);
31160
- const { Fp, n: CURVE_ORDER } = CURVE;
33103
+ const { Fp, n: CURVE_ORDER, nByteLength, nBitLength } = CURVE;
31161
33104
  const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32
31162
33105
  const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32
31163
33106
  function modN(a) {
@@ -31217,7 +33160,6 @@ function weierstrass(curveDef) {
31217
33160
  }
31218
33161
  },
31219
33162
  });
31220
- const numToNByteHex = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
31221
33163
  function isBiggerThanHalfOrder(number) {
31222
33164
  const HALF = CURVE_ORDER >> _1n$1;
31223
33165
  return number > HALF;
@@ -31242,7 +33184,7 @@ function weierstrass(curveDef) {
31242
33184
  }
31243
33185
  // pair (bytes of r, bytes of s)
31244
33186
  static fromCompact(hex) {
31245
- const l = CURVE.nByteLength;
33187
+ const l = nByteLength;
31246
33188
  hex = ensureBytes('compactSignature', hex, l * 2);
31247
33189
  return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));
31248
33190
  }
@@ -31269,7 +33211,7 @@ function weierstrass(curveDef) {
31269
33211
  if (radj >= Fp.ORDER)
31270
33212
  throw new Error('recovery id 2 or 3 invalid');
31271
33213
  const prefix = (rec & 1) === 0 ? '02' : '03';
31272
- const R = Point.fromHex(prefix + numToNByteHex(radj));
33214
+ const R = Point.fromHex(prefix + numToSizedHex(radj, Fp.BYTES));
31273
33215
  const ir = invN(radj); // r^-1
31274
33216
  const u1 = modN(-h * ir); // -hr^-1
31275
33217
  const u2 = modN(s * ir); // sr^-1
@@ -31291,14 +33233,15 @@ function weierstrass(curveDef) {
31291
33233
  return hexToBytes(this.toDERHex());
31292
33234
  }
31293
33235
  toDERHex() {
31294
- return DER.hexFromSig({ r: this.r, s: this.s });
33236
+ return DER.hexFromSig(this);
31295
33237
  }
31296
33238
  // padded bytes of r, then padded bytes of s
31297
33239
  toCompactRawBytes() {
31298
33240
  return hexToBytes(this.toCompactHex());
31299
33241
  }
31300
33242
  toCompactHex() {
31301
- return numToNByteHex(this.r) + numToNByteHex(this.s);
33243
+ const l = nByteLength;
33244
+ return numToSizedHex(this.r, l) + numToSizedHex(this.s, l);
31302
33245
  }
31303
33246
  }
31304
33247
  const utils = {
@@ -31347,16 +33290,21 @@ function weierstrass(curveDef) {
31347
33290
  * Quick and dirty check for item being public key. Does not validate hex, or being on-curve.
31348
33291
  */
31349
33292
  function isProbPub(item) {
31350
- const arr = isBytes$1(item);
31351
- const str = typeof item === 'string';
31352
- const len = (arr || str) && item.length;
31353
- if (arr)
31354
- return len === compressedLen || len === uncompressedLen;
31355
- if (str)
31356
- return len === 2 * compressedLen || len === 2 * uncompressedLen;
33293
+ if (typeof item === 'bigint')
33294
+ return false;
31357
33295
  if (item instanceof Point)
31358
33296
  return true;
31359
- return false;
33297
+ const arr = ensureBytes('key', item);
33298
+ const len = arr.length;
33299
+ const fpl = Fp.BYTES;
33300
+ const compLen = fpl + 1; // e.g. 33 for 32
33301
+ const uncompLen = 2 * fpl + 1; // e.g. 65 for 32
33302
+ if (CURVE.allowedPrivateKeyLengths || nByteLength === compLen) {
33303
+ return undefined;
33304
+ }
33305
+ else {
33306
+ return len === compLen || len === uncompLen;
33307
+ }
31360
33308
  }
31361
33309
  /**
31362
33310
  * ECDH (Elliptic Curve Diffie Hellman).
@@ -31369,9 +33317,9 @@ function weierstrass(curveDef) {
31369
33317
  * @returns shared public key
31370
33318
  */
31371
33319
  function getSharedSecret(privateA, publicB, isCompressed = true) {
31372
- if (isProbPub(privateA))
33320
+ if (isProbPub(privateA) === true)
31373
33321
  throw new Error('first arg must be private key');
31374
- if (!isProbPub(publicB))
33322
+ if (isProbPub(publicB) === false)
31375
33323
  throw new Error('second arg must be public key');
31376
33324
  const b = Point.fromHex(publicB); // check for being on-curve
31377
33325
  return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
@@ -31382,13 +33330,13 @@ function weierstrass(curveDef) {
31382
33330
  // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors
31383
33331
  const bits2int = CURVE.bits2int ||
31384
33332
  function (bytes) {
31385
- // Our custom check "just in case"
33333
+ // Our custom check "just in case", for protection against DoS
31386
33334
  if (bytes.length > 8192)
31387
33335
  throw new Error('input is too large');
31388
33336
  // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)
31389
33337
  // for some cases, since bytes.length * 8 is not actual bitLength.
31390
33338
  const num = bytesToNumberBE(bytes); // check for == u8 done here
31391
- const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits
33339
+ const delta = bytes.length * 8 - nBitLength; // truncate to nBitLength leftmost bits
31392
33340
  return delta > 0 ? num >> BigInt(delta) : num;
31393
33341
  };
31394
33342
  const bits2int_modN = CURVE.bits2int_modN ||
@@ -31396,14 +33344,14 @@ function weierstrass(curveDef) {
31396
33344
  return modN(bits2int(bytes)); // can't use bytesToNumberBE here
31397
33345
  };
31398
33346
  // NOTE: pads output with zero as per spec
31399
- const ORDER_MASK = bitMask(CURVE.nBitLength);
33347
+ const ORDER_MASK = bitMask(nBitLength);
31400
33348
  /**
31401
33349
  * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`.
31402
33350
  */
31403
33351
  function int2octets(num) {
31404
- aInRange('num < 2^' + CURVE.nBitLength, num, _0n, ORDER_MASK);
33352
+ aInRange('num < 2^' + nBitLength, num, _0n$1, ORDER_MASK);
31405
33353
  // works with order, can have different size than numToField!
31406
- return numberToBytesBE(num, CURVE.nByteLength);
33354
+ return numberToBytesBE(num, nByteLength);
31407
33355
  }
31408
33356
  // Steps A, D of RFC6979 3.2
31409
33357
  // Creates RFC6979 seed; converts msg/privKey to numbers.
@@ -31444,13 +33392,13 @@ function weierstrass(curveDef) {
31444
33392
  const ik = invN(k); // k^-1 mod n
31445
33393
  const q = Point.BASE.multiply(k).toAffine(); // q = Gk
31446
33394
  const r = modN(q.x); // r = q.x mod n
31447
- if (r === _0n)
33395
+ if (r === _0n$1)
31448
33396
  return;
31449
33397
  // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to
31450
33398
  // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it:
31451
33399
  // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT
31452
33400
  const s = modN(ik * modN(m + r * d)); // Not using blinding here
31453
- if (s === _0n)
33401
+ if (s === _0n$1)
31454
33402
  return;
31455
33403
  let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n$1); // recovery bit (2 or 3, when q.x > n)
31456
33404
  let normS = s;
@@ -31603,6 +33551,7 @@ function createCurve(curveDef, defHash) {
31603
33551
  */
31604
33552
  const secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f');
31605
33553
  const secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141');
33554
+ const _0n = BigInt(0);
31606
33555
  const _1n = BigInt(1);
31607
33556
  const _2n = BigInt(2);
31608
33557
  const divNearest = (a, b) => (a + b / _2n) / b;
@@ -31651,13 +33600,13 @@ const Fpk1 = Field(secp256k1P, undefined, undefined, { sqrt: sqrtMod });
31651
33600
  * ```
31652
33601
  */
31653
33602
  const secp256k1 = createCurve({
31654
- a: BigInt(0),
33603
+ a: _0n,
31655
33604
  b: BigInt(7),
31656
33605
  Fp: Fpk1,
31657
33606
  n: secp256k1N,
31658
33607
  Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'),
31659
33608
  Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'),
31660
- h: BigInt(1), // Cofactor
33609
+ h: BigInt(1),
31661
33610
  lowS: true, // Allow only low-S signatures by default in sign() and verify()
31662
33611
  endo: {
31663
33612
  // Endomorphism, see above
@@ -31685,11 +33634,7 @@ const secp256k1 = createCurve({
31685
33634
  return { k1neg, k1, k2neg, k2 };
31686
33635
  },
31687
33636
  },
31688
- }, sha256$1);
31689
- // Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code.
31690
- // https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
31691
- BigInt(0);
31692
- secp256k1.ProjectivePoint;
33637
+ }, sha256$2);
31693
33638
 
31694
33639
  /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
31695
33640
  function isBytes(a) {
@@ -32092,10 +34037,17 @@ chain(radix2(5), alphabet('0123456789ABCDEFGHIJKLMNOPQRSTUV'), join(''));
32092
34037
  */
32093
34038
  chain(radix2(5), alphabet('0123456789ABCDEFGHJKMNPQRSTVWXYZ'), join(''), normalize((s) => s.toUpperCase().replace(/O/g, '0').replace(/[IL]/g, '1')));
32094
34039
  // Built-in base64 conversion https://caniuse.com/mdn-javascript_builtins_uint8array_frombase64
32095
- // TODO: temporarily set to false, trying to understand bugs
32096
34040
  // prettier-ignore
32097
34041
  const hasBase64Builtin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toBase64 === 'function' &&
32098
34042
  typeof Uint8Array.fromBase64 === 'function')();
34043
+ const decodeBase64Builtin = (s, isUrl) => {
34044
+ astr('base64', s);
34045
+ const re = isUrl ? /^[A-Za-z0-9=_-]+$/ : /^[A-Za-z0-9=+/]+$/;
34046
+ const alphabet = isUrl ? 'base64url' : 'base64';
34047
+ if (s.length > 0 && !re.test(s))
34048
+ throw new Error('invalid base64');
34049
+ return Uint8Array.fromBase64(s, { alphabet, lastChunkHandling: 'strict' });
34050
+ };
32099
34051
  /**
32100
34052
  * base64 from RFC 4648. Padded.
32101
34053
  * Use `base64nopad` for unpadded version.
@@ -32112,10 +34064,7 @@ const hasBase64Builtin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toBas
32112
34064
  // prettier-ignore
32113
34065
  hasBase64Builtin ? {
32114
34066
  encode(b) { abytes(b); return b.toBase64(); },
32115
- decode(s) {
32116
- astr('base64', s);
32117
- return Uint8Array.fromBase64(s, { lastChunkHandling: 'strict' });
32118
- },
34067
+ decode(s) { return decodeBase64Builtin(s, false); },
32119
34068
  } : chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'), padding(6), join(''));
32120
34069
  /**
32121
34070
  * base64 from RFC 4648. No padding.
@@ -32144,7 +34093,7 @@ chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0
32144
34093
  // prettier-ignore
32145
34094
  hasBase64Builtin ? {
32146
34095
  encode(b) { abytes(b); return b.toBase64({ alphabet: 'base64url' }); },
32147
- decode(s) { astr('base64', s); return Uint8Array.fromBase64(s, { alphabet: 'base64url' }); },
34096
+ decode(s) { return decodeBase64Builtin(s, true); },
32148
34097
  } : chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'), padding(6), join(''));
32149
34098
  /**
32150
34099
  * base64 from RFC 4648, using URL-safe alphabet. No padding.
@@ -32335,9 +34284,37 @@ hasHexBuiltin
32335
34284
  * ```
32336
34285
  */
32337
34286
  secp256k1.ProjectivePoint;
32338
- createBase58check(sha256$1);
34287
+ createBase58check(sha256$2);
32339
34288
  utf8ToBytes('Bitcoin seed');
32340
34289
 
34290
+ /**
34291
+ * @description Converts a signature into hex format.
34292
+ *
34293
+ * @param signature The signature to convert.
34294
+ * @returns The signature in hex format.
34295
+ *
34296
+ * @example
34297
+ * serializeSignature({
34298
+ * r: '0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf',
34299
+ * s: '0x4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db8',
34300
+ * yParity: 1
34301
+ * })
34302
+ * // "0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c"
34303
+ */
34304
+ function serializeSignature({ r, s, to = 'hex', v, yParity, }) {
34305
+ const yParity_ = (() => {
34306
+ if (yParity === 0 || yParity === 1)
34307
+ return yParity;
34308
+ if (v && (v === 27n || v === 28n || v >= 35n))
34309
+ return v % 2n === 0n ? 1 : 0;
34310
+ throw new Error('Invalid `v` or `yParity` value');
34311
+ })();
34312
+ const signature = `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).toCompactHex()}${yParity_ === 0 ? '1b' : '1c'}`;
34313
+ if (to === 'hex')
34314
+ return signature;
34315
+ return hexToBytes$1(signature);
34316
+ }
34317
+
32341
34318
  // TODO(v3): Rename to `toLocalAccount` + add `source` property to define source (privateKey, mnemonic, hdKey, etc).
32342
34319
  /**
32343
34320
  * @description Creates an Account from a custom signing implementation.
@@ -32380,34 +34357,6 @@ function publicKeyToAddress(publicKey) {
32380
34357
  return checksumAddress(`0x${address}`);
32381
34358
  }
32382
34359
 
32383
- /**
32384
- * @description Converts a signature into hex format.
32385
- *
32386
- * @param signature The signature to convert.
32387
- * @returns The signature in hex format.
32388
- *
32389
- * @example
32390
- * serializeSignature({
32391
- * r: '0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf',
32392
- * s: '0x4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db8',
32393
- * yParity: 1
32394
- * })
32395
- * // "0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c"
32396
- */
32397
- function serializeSignature({ r, s, to = 'hex', v, yParity, }) {
32398
- const yParity_ = (() => {
32399
- if (yParity === 0 || yParity === 1)
32400
- return yParity;
32401
- if (v && (v === 27n || v === 28n || v >= 35n))
32402
- return v % 2n === 0n ? 1 : 0;
32403
- throw new Error('Invalid `v` or `yParity` value');
32404
- })();
32405
- const signature = `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).toCompactHex()}${yParity_ === 0 ? '1b' : '1c'}`;
32406
- if (to === 'hex')
32407
- return signature;
32408
- return hexToBytes$1(signature);
32409
- }
32410
-
32411
34360
  // TODO(v3): Convert to sync.
32412
34361
  let extraEntropy = false;
32413
34362
  /**
@@ -32419,7 +34368,12 @@ let extraEntropy = false;
32419
34368
  * @returns The signature.
32420
34369
  */
32421
34370
  async function sign({ hash, privateKey, to = 'object', }) {
32422
- const { r, s, recovery } = secp256k1.sign(hash.slice(2), privateKey.slice(2), { lowS: true, extraEntropy });
34371
+ const { r, s, recovery } = secp256k1.sign(hash.slice(2), privateKey.slice(2), {
34372
+ lowS: true,
34373
+ extraEntropy: isHex(extraEntropy, { strict: false })
34374
+ ? hexToBytes$1(extraEntropy)
34375
+ : extraEntropy,
34376
+ });
32423
34377
  const signature = {
32424
34378
  r: numberToHex(r, { size: 32 }),
32425
34379
  s: numberToHex(s, { size: 32 }),
@@ -32514,10 +34468,10 @@ async function signTransaction(parameters) {
32514
34468
  return transaction;
32515
34469
  })();
32516
34470
  const signature = await sign({
32517
- hash: keccak256(serializer(signableTransaction)),
34471
+ hash: keccak256(await serializer(signableTransaction)),
32518
34472
  privateKey,
32519
34473
  });
32520
- return serializer(transaction, signature);
34474
+ return (await serializer(transaction, signature));
32521
34475
  }
32522
34476
 
32523
34477
  class InvalidDomainError extends BaseError {
@@ -32558,7 +34512,7 @@ function validateTypedData(parameters) {
32558
34512
  // and will throw.
32559
34513
  numberToHex(value, {
32560
34514
  signed: base === 'int',
32561
- size: Number.parseInt(size_) / 8,
34515
+ size: Number.parseInt(size_, 10) / 8,
32562
34516
  });
32563
34517
  }
32564
34518
  if (type === 'address' && typeof value === 'string' && !isAddress(value))
@@ -32566,9 +34520,9 @@ function validateTypedData(parameters) {
32566
34520
  const bytesMatch = type.match(bytesRegex);
32567
34521
  if (bytesMatch) {
32568
34522
  const [_type, size_] = bytesMatch;
32569
- if (size_ && size(value) !== Number.parseInt(size_))
34523
+ if (size_ && size(value) !== Number.parseInt(size_, 10))
32570
34524
  throw new BytesSizeMismatchError({
32571
- expectedSize: Number.parseInt(size_),
34525
+ expectedSize: Number.parseInt(size_, 10),
32572
34526
  givenSize: size(value),
32573
34527
  });
32574
34528
  }
@@ -32901,5 +34855,5 @@ const FlaunchSDK = {
32901
34855
  ReadWriteFlaunchSDK,
32902
34856
  };
32903
34857
 
32904
- export { AddressFeeSplitManagerAddress, AnyBidWallAddress, AnyFlaunchAddress, AnyPositionManagerAbi, AnyPositionManagerAddress, BidWallAddress, BidWallV1_1Abi, BidWallV1_1Address, BidwallAbi, BuyBackManagerAddress, ClankerWorldVerifierAddress, ClosedPermissionsAddress, DopplerVerifierAddress, FLETHAddress, FLETHHooksAddress, FairLaunchAbi, FairLaunchAddress, FairLaunchV1_1Abi, FairLaunchV1_1Address, FastFlaunchZapAbi, FastFlaunchZapAddress, FeeEscrowAbi, FeeEscrowAddress, FlaunchAbi, FlaunchAddress, FlaunchBackend, FlaunchPositionManagerAbi, FlaunchPositionManagerAddress, FlaunchPositionManagerV1_1Abi, FlaunchPositionManagerV1_1Address, FlaunchPositionManagerV1_2Address, FlaunchSDK, FlaunchV1_1Abi, FlaunchV1_1Address, FlaunchV1_2Address, FlaunchVersion, FlaunchZapAbi, FlaunchZapAddress, InitialPriceAbi, LiquidityMode, MemecoinAbi, MulticallAbi, PERMIT_DETAILS, PERMIT_TYPES, Permissions, Permit2Abi, Permit2Address, PoolManagerAbi, PoolManagerAddress, Q192, Q96, QuoterAbi, QuoterAddress, ReadFlaunchSDK, ReadWriteFlaunchSDK, ReferralEscrowAbi, ReferralEscrowAddress, RevenueManagerAbi, RevenueManagerAddress, SolanaVerifierAddress, StakingManagerAddress, StateViewAbi, StateViewAddress, TICK_SPACING, TickFinder, TokenImporterAddress, TreasuryManagerFactoryAbi, TreasuryManagerFactoryAddress, USDCETHPoolKeys, UniV4PositionManagerAddress, UniversalRouterAbi, UniversalRouterAddress, Verifier, VirtualsVerifierAddress, WhitelistVerifierAddress, WhitelistedPermissionsAddress, ZoraVerifierAddress, buyMemecoin, bytes32ToUint256, calculateUnderlyingTokenBalances, chainIdToChain, createCallDataWalletClient, createDrift, createFlaunch, createFlaunchCalldata, decodeCallData, encodedCallAbi, generateTokenUri, getAmountWithSlippage, getAmountsForLiquidity, getLiquidityFromAmounts, getNearestUsableTick, getPermissionsAddress, getPermit2TypedData, getPoolId, getSqrtPriceX96FromTick, getValidTick, maxLiquidityForAmount0Precise, maxLiquidityForAmount1, orderPoolKey, parseCall, parseSwapData, priceRatioToTick, resolveIPFS, sellMemecoinWithPermit2, uint256ToBytes32, uploadFileToIPFS, uploadImageToFlaunchAPI, uploadImageToIPFS, uploadJsonToIPFS, uploadMetadataToFlaunchAPI };
34858
+ export { AddressFeeSplitManagerAddress, AnyBidWallAddress, AnyFlaunchAddress, AnyPositionManagerAbi, AnyPositionManagerAddress, BidWallAddress, BidWallV1_1Abi, BidWallV1_1Address, BidwallAbi, BuyBackManagerAddress, ClankerWorldVerifierAddress, ClosedPermissionsAddress, DopplerVerifierAddress, DynamicAddressFeeSplitManagerAbi, DynamicAddressFeeSplitManagerAddress, FLETHAddress, FLETHHooksAddress, FairLaunchAbi, FairLaunchAddress, FairLaunchV1_1Abi, FairLaunchV1_1Address, FastFlaunchZapAbi, FastFlaunchZapAddress, FeeEscrowAbi, FeeEscrowAddress, FlaunchAbi, FlaunchAddress, FlaunchBackend, FlaunchPositionManagerAbi, FlaunchPositionManagerAddress, FlaunchPositionManagerV1_1Abi, FlaunchPositionManagerV1_1Address, FlaunchPositionManagerV1_2Address, FlaunchSDK, FlaunchV1_1Abi, FlaunchV1_1Address, FlaunchV1_2Address, FlaunchVersion, FlaunchZapAbi, FlaunchZapAddress, InitialPriceAbi, LiquidityMode, MemecoinAbi, MulticallAbi, PERMIT_DETAILS, PERMIT_TYPES, Permissions, Permit2Abi, Permit2Address, PoolManagerAbi, PoolManagerAddress, Q192, Q96, QuoterAbi, QuoterAddress, ReadDynamicAddressFeeSplitManager, ReadFlaunchSDK, ReadWriteDynamicAddressFeeSplitManager, ReadWriteFlaunchSDK, ReferralEscrowAbi, ReferralEscrowAddress, RevenueManagerAbi, RevenueManagerAddress, SolanaVerifierAddress, StakingManagerAddress, StateViewAbi, StateViewAddress, TICK_SPACING, TickFinder, TokenImporterAddress, TreasuryManagerFactoryAbi, TreasuryManagerFactoryAddress, USDCETHPoolKeys, UniV4PositionManagerAddress, UniversalRouterAbi, UniversalRouterAddress, Verifier, VirtualsVerifierAddress, WhitelistVerifierAddress, WhitelistedPermissionsAddress, ZoraVerifierAddress, buyMemecoin, bytes32ToUint256, calculateUnderlyingTokenBalances, chainIdToChain, createCallDataWalletClient, createDrift, createFlaunch, createFlaunchCalldata, decodeCallData, encodedCallAbi, generateTokenUri, getAmountWithSlippage, getAmountsForLiquidity, getLiquidityFromAmounts, getNearestUsableTick, getPermissionsAddress, getPermit2TypedData, getPoolId, getSqrtPriceX96FromTick, getValidTick, maxLiquidityForAmount0Precise, maxLiquidityForAmount1, orderPoolKey, parseCall, parseSwapData, priceRatioToTick, resolveIPFS, sellMemecoinWithPermit2, uint256ToBytes32, uploadFileToIPFS, uploadImageToFlaunchAPI, uploadImageToIPFS, uploadJsonToIPFS, uploadMetadataToFlaunchAPI };
32905
34859
  //# sourceMappingURL=index.esm.js.map