@aboutcircles/sdk 0.1.37 → 0.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +594 -605
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1025,9 +1025,9 @@ class Profiles {
1025
1025
  }
1026
1026
 
1027
1027
  // ../invitations/dist/index.js
1028
- var u8 = (J) => BigInt(J);
1028
+ var v8 = (J) => BigInt(J);
1029
1029
  var Q$ = (J) => parseInt(J, 16);
1030
- var s0 = (J) => {
1030
+ var a0 = (J) => {
1031
1031
  if (J.startsWith("0x"))
1032
1032
  J = J.slice(2);
1033
1033
  if (J.length % 2 !== 0)
@@ -1037,16 +1037,16 @@ var s0 = (J) => {
1037
1037
  $[Q / 2] = parseInt(J.substr(Q, 2), 16);
1038
1038
  return $;
1039
1039
  };
1040
- function r0(J, $) {
1040
+ function s0(J, $) {
1041
1041
  if (typeof $ === "string" && $.startsWith("0x")) {
1042
1042
  let Q = $.slice(2);
1043
1043
  if (Q.length === 40)
1044
1044
  return $;
1045
1045
  if (Q.length === 64) {
1046
1046
  if (J.toLowerCase().includes("digest") || J.toLowerCase().includes("data") || J.toLowerCase().includes("bytes"))
1047
- return s0($);
1047
+ return a0($);
1048
1048
  try {
1049
- return u8($);
1049
+ return v8($);
1050
1050
  } catch {
1051
1051
  return $;
1052
1052
  }
@@ -1055,7 +1055,7 @@ function r0(J, $) {
1055
1055
  let G = Q$($);
1056
1056
  if (G < Number.MAX_SAFE_INTEGER)
1057
1057
  return G;
1058
- return u8($);
1058
+ return v8($);
1059
1059
  } catch {
1060
1060
  return $;
1061
1061
  }
@@ -1071,15 +1071,15 @@ function d$(J) {
1071
1071
  for (let [Y2, M2] of Object.entries(Q)) {
1072
1072
  if (["blockNumber", "timestamp", "transactionIndex", "logIndex", "transactionHash"].includes(Y2))
1073
1073
  continue;
1074
- G[Y2] = r0(Y2, M2);
1074
+ G[Y2] = s0(Y2, M2);
1075
1075
  }
1076
1076
  return G;
1077
1077
  }
1078
- function L$(J) {
1078
+ function B$(J) {
1079
1079
  return J.map(d$);
1080
1080
  }
1081
1081
 
1082
- class lJ {
1082
+ class mJ {
1083
1083
  _subscribers = [];
1084
1084
  subscribe(J) {
1085
1085
  return this._subscribers.push(J), () => {
@@ -1095,7 +1095,7 @@ class lJ {
1095
1095
  this._subscribers.forEach(($) => $(J));
1096
1096
  }
1097
1097
  static create() {
1098
- let J = new lJ;
1098
+ let J = new mJ;
1099
1099
  return { property: J, emit: ($) => J.emit($) };
1100
1100
  }
1101
1101
  }
@@ -1257,35 +1257,35 @@ class zJ {
1257
1257
  let $ = J?.toLowerCase();
1258
1258
  if (!this.websocketConnected)
1259
1259
  await this.connect();
1260
- let Q = lJ.create(), G = $ ? { address: $ } : {}, M2 = (await this.sendMessage("circles_subscribe", G)).result;
1260
+ let Q = mJ.create(), G = $ ? { address: $ } : {}, M2 = (await this.sendMessage("circles_subscribe", G)).result;
1261
1261
  if (!this.subscriptionListeners[M2])
1262
1262
  this.subscriptionListeners[M2] = [];
1263
1263
  return this.subscriptionListeners[M2].push((Z) => {
1264
- L$(Z).forEach((K) => Q.emit(K));
1264
+ B$(Z).forEach((K) => Q.emit(K));
1265
1265
  }), this.activeSubscriptions.push({ id: M2, address: $ }), Q.property;
1266
1266
  }
1267
1267
  }
1268
1268
  var H$ = BigInt(4294967295);
1269
- var m8 = BigInt(32);
1270
- function JQ(J, $ = false) {
1269
+ var u8 = BigInt(32);
1270
+ function e0(J, $ = false) {
1271
1271
  if ($)
1272
- return { h: Number(J & H$), l: Number(J >> m8 & H$) };
1273
- return { h: Number(J >> m8 & H$) | 0, l: Number(J & H$) | 0 };
1272
+ return { h: Number(J & H$), l: Number(J >> u8 & H$) };
1273
+ return { h: Number(J >> u8 & H$) | 0, l: Number(J & H$) | 0 };
1274
1274
  }
1275
- function h8(J, $ = false) {
1275
+ function m8(J, $ = false) {
1276
1276
  let Q = J.length, G = new Uint32Array(Q), Y2 = new Uint32Array(Q);
1277
1277
  for (let M2 = 0;M2 < Q; M2++) {
1278
- let { h: Z, l: K } = JQ(J[M2], $);
1278
+ let { h: Z, l: K } = e0(J[M2], $);
1279
1279
  [G[M2], Y2[M2]] = [Z, K];
1280
1280
  }
1281
1281
  return [G, Y2];
1282
1282
  }
1283
- var l8 = (J, $, Q) => J << Q | $ >>> 32 - Q;
1284
- var c8 = (J, $, Q) => $ << Q | J >>> 32 - Q;
1285
- var p8 = (J, $, Q) => $ << Q - 32 | J >>> 64 - Q;
1286
- var d8 = (J, $, Q) => J << Q - 32 | $ >>> 64 - Q;
1283
+ var h8 = (J, $, Q) => J << Q | $ >>> 32 - Q;
1284
+ var l8 = (J, $, Q) => $ << Q | J >>> 32 - Q;
1285
+ var c8 = (J, $, Q) => $ << Q - 32 | J >>> 64 - Q;
1286
+ var p8 = (J, $, Q) => J << Q - 32 | $ >>> 64 - Q;
1287
1287
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1288
- function $Q(J) {
1288
+ function JQ(J) {
1289
1289
  return J instanceof Uint8Array || ArrayBuffer.isView(J) && J.constructor.name === "Uint8Array";
1290
1290
  }
1291
1291
  function n$(J, $ = "") {
@@ -1295,7 +1295,7 @@ function n$(J, $ = "") {
1295
1295
  }
1296
1296
  }
1297
1297
  function S$(J, $, Q = "") {
1298
- let G = $Q(J), Y2 = J?.length, M2 = $ !== undefined;
1298
+ let G = JQ(J), Y2 = J?.length, M2 = $ !== undefined;
1299
1299
  if (!G || M2 && Y2 !== $) {
1300
1300
  let Z = Q && `"${Q}" `, K = M2 ? ` of length ${$}` : "", X2 = G ? `length=${Y2}` : `type=${typeof J}`;
1301
1301
  throw Error(Z + "expected Uint8Array" + K + ", got " + X2);
@@ -1308,68 +1308,68 @@ function i$(J, $ = true) {
1308
1308
  if ($ && J.finished)
1309
1309
  throw Error("Hash#digest() has already been called");
1310
1310
  }
1311
- function n8(J, $) {
1311
+ function d8(J, $) {
1312
1312
  S$(J, undefined, "digestInto() output");
1313
1313
  let Q = $.outputLen;
1314
1314
  if (J.length < Q)
1315
1315
  throw Error('"digestInto() output" expected to be of length >=' + Q);
1316
1316
  }
1317
- function i8(J) {
1317
+ function n8(J) {
1318
1318
  return new Uint32Array(J.buffer, J.byteOffset, Math.floor(J.byteLength / 4));
1319
1319
  }
1320
1320
  function t$(...J) {
1321
1321
  for (let $ = 0;$ < J.length; $++)
1322
1322
  J[$].fill(0);
1323
1323
  }
1324
- var QQ = (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
1325
- function GQ(J) {
1324
+ var $Q = (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
1325
+ function QQ(J) {
1326
1326
  return J << 24 & 4278190080 | J << 8 & 16711680 | J >>> 8 & 65280 | J >>> 24 & 255;
1327
1327
  }
1328
- function YQ(J) {
1328
+ function GQ(J) {
1329
1329
  for (let $ = 0;$ < J.length; $++)
1330
- J[$] = GQ(J[$]);
1330
+ J[$] = QQ(J[$]);
1331
1331
  return J;
1332
1332
  }
1333
- var o$ = QQ ? (J) => J : YQ;
1334
- function t8(J, $ = {}) {
1333
+ var o$ = $Q ? (J) => J : GQ;
1334
+ function i8(J, $ = {}) {
1335
1335
  let Q = (Y2, M2) => J(M2).update(Y2).digest(), G = J(undefined);
1336
1336
  return Q.outputLen = G.outputLen, Q.blockLen = G.blockLen, Q.create = (Y2) => J(Y2), Object.assign(Q, $), Object.freeze(Q);
1337
1337
  }
1338
- var MQ = BigInt(0);
1338
+ var YQ = BigInt(0);
1339
1339
  var Y$ = BigInt(1);
1340
- var ZQ = BigInt(2);
1341
- var XQ = BigInt(7);
1342
- var KQ = BigInt(256);
1343
- var qQ = BigInt(113);
1340
+ var MQ = BigInt(2);
1341
+ var ZQ = BigInt(7);
1342
+ var XQ = BigInt(256);
1343
+ var KQ = BigInt(113);
1344
+ var a8 = [];
1344
1345
  var s8 = [];
1345
1346
  var r8 = [];
1346
- var e8 = [];
1347
1347
  for (let J = 0, $ = Y$, Q = 1, G = 0;J < 24; J++) {
1348
- [Q, G] = [G, (2 * Q + 3 * G) % 5], s8.push(2 * (5 * G + Q)), r8.push((J + 1) * (J + 2) / 2 % 64);
1349
- let Y2 = MQ;
1348
+ [Q, G] = [G, (2 * Q + 3 * G) % 5], a8.push(2 * (5 * G + Q)), s8.push((J + 1) * (J + 2) / 2 % 64);
1349
+ let Y2 = YQ;
1350
1350
  for (let M2 = 0;M2 < 7; M2++)
1351
- if ($ = ($ << Y$ ^ ($ >> XQ) * qQ) % KQ, $ & ZQ)
1351
+ if ($ = ($ << Y$ ^ ($ >> ZQ) * KQ) % XQ, $ & MQ)
1352
1352
  Y2 ^= Y$ << (Y$ << BigInt(M2)) - Y$;
1353
- e8.push(Y2);
1353
+ r8.push(Y2);
1354
1354
  }
1355
- var J0 = h8(e8, true);
1356
- var UQ = J0[0];
1357
- var WQ = J0[1];
1355
+ var e8 = m8(r8, true);
1356
+ var qQ = e8[0];
1357
+ var UQ = e8[1];
1358
+ var t8 = (J, $, Q) => Q > 32 ? c8(J, $, Q) : h8(J, $, Q);
1358
1359
  var o8 = (J, $, Q) => Q > 32 ? p8(J, $, Q) : l8(J, $, Q);
1359
- var a8 = (J, $, Q) => Q > 32 ? d8(J, $, Q) : c8(J, $, Q);
1360
- function NQ(J, $ = 24) {
1360
+ function WQ(J, $ = 24) {
1361
1361
  let Q = new Uint32Array(10);
1362
1362
  for (let G = 24 - $;G < 24; G++) {
1363
1363
  for (let Z = 0;Z < 10; Z++)
1364
1364
  Q[Z] = J[Z] ^ J[Z + 10] ^ J[Z + 20] ^ J[Z + 30] ^ J[Z + 40];
1365
1365
  for (let Z = 0;Z < 10; Z += 2) {
1366
- let K = (Z + 8) % 10, X2 = (Z + 2) % 10, q = Q[X2], U2 = Q[X2 + 1], j = o8(q, U2, 1) ^ Q[K], z2 = a8(q, U2, 1) ^ Q[K + 1];
1366
+ let K = (Z + 8) % 10, X2 = (Z + 2) % 10, q = Q[X2], U2 = Q[X2 + 1], j = t8(q, U2, 1) ^ Q[K], z2 = o8(q, U2, 1) ^ Q[K + 1];
1367
1367
  for (let V2 = 0;V2 < 50; V2 += 10)
1368
1368
  J[Z + V2] ^= j, J[Z + V2 + 1] ^= z2;
1369
1369
  }
1370
1370
  let Y2 = J[2], M2 = J[3];
1371
1371
  for (let Z = 0;Z < 24; Z++) {
1372
- let K = r8[Z], X2 = o8(Y2, M2, K), q = a8(Y2, M2, K), U2 = s8[Z];
1372
+ let K = s8[Z], X2 = t8(Y2, M2, K), q = o8(Y2, M2, K), U2 = a8[Z];
1373
1373
  Y2 = J[U2], M2 = J[U2 + 1], J[U2] = X2, J[U2 + 1] = q;
1374
1374
  }
1375
1375
  for (let Z = 0;Z < 50; Z += 10) {
@@ -1378,7 +1378,7 @@ function NQ(J, $ = 24) {
1378
1378
  for (let K = 0;K < 10; K++)
1379
1379
  J[Z + K] ^= ~Q[(K + 2) % 10] & Q[(K + 4) % 10];
1380
1380
  }
1381
- J[0] ^= UQ[G], J[1] ^= WQ[G];
1381
+ J[0] ^= qQ[G], J[1] ^= UQ[G];
1382
1382
  }
1383
1383
  t$(Q);
1384
1384
  }
@@ -1398,13 +1398,13 @@ class a$ {
1398
1398
  constructor(J, $, Q, G = false, Y2 = 24) {
1399
1399
  if (this.blockLen = J, this.suffix = $, this.outputLen = Q, this.enableXOF = G, this.rounds = Y2, n$(Q, "outputLen"), !(0 < J && J < 200))
1400
1400
  throw Error("only keccak-f1600 function is supported");
1401
- this.state = new Uint8Array(200), this.state32 = i8(this.state);
1401
+ this.state = new Uint8Array(200), this.state32 = n8(this.state);
1402
1402
  }
1403
1403
  clone() {
1404
1404
  return this._cloneInto();
1405
1405
  }
1406
1406
  keccak() {
1407
- o$(this.state32), NQ(this.state32, this.rounds), o$(this.state32), this.posOut = 0, this.pos = 0;
1407
+ o$(this.state32), WQ(this.state32, this.rounds), o$(this.state32), this.posOut = 0, this.pos = 0;
1408
1408
  }
1409
1409
  update(J) {
1410
1410
  i$(this), S$(J);
@@ -1447,7 +1447,7 @@ class a$ {
1447
1447
  return n$(J), this.xofInto(new Uint8Array(J));
1448
1448
  }
1449
1449
  digestInto(J) {
1450
- if (n8(J, this), this.finished)
1450
+ if (d8(J, this), this.finished)
1451
1451
  throw Error("digest() was already called");
1452
1452
  return this.writeInto(J), this.destroy(), J;
1453
1453
  }
@@ -1462,15 +1462,15 @@ class a$ {
1462
1462
  return J ||= new a$($, Q, G, M2, Y2), J.state32.set(this.state32), J.pos = this.pos, J.posOut = this.posOut, J.finished = this.finished, J.rounds = Y2, J.suffix = Q, J.outputLen = G, J.enableXOF = M2, J.destroyed = this.destroyed, J;
1463
1463
  }
1464
1464
  }
1465
- var OQ = (J, $, Q, G = {}) => t8(() => new a$($, J, Q), G);
1466
- var cJ = OQ(1, 136, 32);
1467
- var $0 = [];
1465
+ var NQ = (J, $, Q, G = {}) => i8(() => new a$($, J, Q), G);
1466
+ var hJ = NQ(1, 136, 32);
1467
+ var J0 = [];
1468
1468
  for (let J = 0;J < 256; J++)
1469
- $0[J] = J.toString(16).padStart(2, "0");
1469
+ J0[J] = J.toString(16).padStart(2, "0");
1470
1470
  function _$(J) {
1471
1471
  let $ = "0x";
1472
1472
  for (let Q = 0;Q < J.length; Q++)
1473
- $ += $0[J[Q]];
1473
+ $ += J0[J[Q]];
1474
1474
  return $;
1475
1475
  }
1476
1476
  function A$(J) {
@@ -1479,12 +1479,12 @@ function A$(J) {
1479
1479
  Q[G / 2] = parseInt($.slice(G, G + 2), 16);
1480
1480
  return Q;
1481
1481
  }
1482
- var g3 = 64;
1483
- var E$ = 32;
1484
- var y$ = (J) => J.startsWith("0x") ? J.slice(2) : J;
1485
- var MJ = (J) => J.toString(16).padStart(g3, "0");
1482
+ var v3 = 64;
1483
+ var y$ = 32;
1484
+ var E$ = (J) => J.startsWith("0x") ? J.slice(2) : J;
1485
+ var MJ = (J) => J.toString(16).padStart(v3, "0");
1486
1486
  function VJ(J) {
1487
- let $ = J.toLowerCase().replace("0x", ""), Q = _$(cJ(new TextEncoder().encode($))).slice(2), G = "0x";
1487
+ let $ = J.toLowerCase().replace("0x", ""), Q = _$(hJ(new TextEncoder().encode($))).slice(2), G = "0x";
1488
1488
  for (let Y2 = 0;Y2 < $.length; Y2++)
1489
1489
  G += parseInt(Q[Y2], 16) >= 8 ? $[Y2].toUpperCase() : $[Y2];
1490
1490
  return G;
@@ -1497,15 +1497,15 @@ function s$(J, $) {
1497
1497
  return `${s$("tuple", $)}${Q[1]}`;
1498
1498
  return J;
1499
1499
  }
1500
- function jQ(J) {
1500
+ function OQ(J) {
1501
1501
  let Q = (J.inputs || []).map((G) => s$(G.type, G.components));
1502
1502
  return `${J.name}(${Q.join(",")})`;
1503
1503
  }
1504
- function zQ(J) {
1505
- let $ = jQ(J), Q = cJ(new TextEncoder().encode($));
1504
+ function jQ(J) {
1505
+ let $ = OQ(J), Q = hJ(new TextEncoder().encode($));
1506
1506
  return _$(Q.slice(0, 4));
1507
1507
  }
1508
- function pJ(J, $) {
1508
+ function lJ(J, $) {
1509
1509
  if (J === "string" || J === "bytes")
1510
1510
  return true;
1511
1511
  if (J.includes("[")) {
@@ -1513,27 +1513,27 @@ function pJ(J, $) {
1513
1513
  if (J.endsWith("[]"))
1514
1514
  return true;
1515
1515
  if (Q === "tuple")
1516
- return Q0($);
1517
- return pJ(Q);
1516
+ return $0($);
1517
+ return lJ(Q);
1518
1518
  }
1519
1519
  if (J === "tuple")
1520
- return Q0($);
1520
+ return $0($);
1521
1521
  return false;
1522
1522
  }
1523
- function Q0(J) {
1524
- return J?.some(($) => pJ($.type, $.components)) ?? false;
1523
+ function $0(J) {
1524
+ return J?.some(($) => lJ($.type, $.components)) ?? false;
1525
1525
  }
1526
1526
  function DJ(J, $, Q) {
1527
1527
  if (J === "tuple" && Q)
1528
- return VQ(Q, $);
1528
+ return DQ(Q, $);
1529
1529
  if (J.includes("["))
1530
- return DQ(J, $, Q);
1531
- return IQ(J, $);
1530
+ return zQ(J, $, Q);
1531
+ return VQ(J, $);
1532
1532
  }
1533
- function DQ(J, $, Q) {
1534
- let G = J.slice(0, J.indexOf("[")), Y2 = J.endsWith("[]"), M2 = pJ(G, Q), Z;
1533
+ function zQ(J, $, Q) {
1534
+ let G = J.slice(0, J.indexOf("[")), Y2 = J.endsWith("[]"), M2 = lJ(G, Q), Z;
1535
1535
  if (M2) {
1536
- let K = $.map((U2) => DJ(G, U2, Q)), X2 = $.length * E$;
1536
+ let K = $.map((U2) => DJ(G, U2, Q)), X2 = $.length * y$;
1537
1537
  Z = K.map((U2) => {
1538
1538
  let j = X2;
1539
1539
  return X2 += U2.length / 2, MJ(j);
@@ -1542,17 +1542,17 @@ function DQ(J, $, Q) {
1542
1542
  Z = $.map((K) => DJ(G, K, Q)).join("");
1543
1543
  return Y2 ? MJ($.length) + Z : Z;
1544
1544
  }
1545
- function VQ(J, $) {
1545
+ function DQ(J, $) {
1546
1546
  let Q = Array.isArray($), G = [], Y2 = [], M2 = [];
1547
1547
  for (let Z = 0;Z < J.length; Z++) {
1548
- let K = J[Z], X2 = Q ? $[Z] : $[K.name || ""], q = pJ(K.type, K.components);
1548
+ let K = J[Z], X2 = Q ? $[Z] : $[K.name || ""], q = lJ(K.type, K.components);
1549
1549
  if (M2.push(q), q)
1550
1550
  G.push(""), Y2.push(DJ(K.type, X2, K.components));
1551
1551
  else
1552
1552
  G.push(DJ(K.type, X2, K.components));
1553
1553
  }
1554
1554
  if (Y2.length > 0) {
1555
- let Z = G.reduce((q, U2, j) => q + (M2[j] ? E$ : U2.length / 2), 0), K = "", X2 = 0;
1555
+ let Z = G.reduce((q, U2, j) => q + (M2[j] ? y$ : U2.length / 2), 0), K = "", X2 = 0;
1556
1556
  for (let q = 0;q < J.length; q++)
1557
1557
  if (M2[q])
1558
1558
  K += MJ(Z), Z += Y2[X2].length / 2, X2++;
@@ -1562,9 +1562,9 @@ function VQ(J, $) {
1562
1562
  }
1563
1563
  return G.join("");
1564
1564
  }
1565
- function IQ(J, $) {
1565
+ function VQ(J, $) {
1566
1566
  if (J === "address")
1567
- return y$($).toLowerCase().padStart(g3, "0");
1567
+ return E$($).toLowerCase().padStart(v3, "0");
1568
1568
  if (J === "bool")
1569
1569
  return MJ($ ? 1 : 0);
1570
1570
  if (J.startsWith("uint")) {
@@ -1580,13 +1580,13 @@ function IQ(J, $) {
1580
1580
  return MJ(Q);
1581
1581
  }
1582
1582
  if (J.startsWith("bytes") && J !== "bytes")
1583
- return y$($).padEnd(g3, "0");
1583
+ return E$($).padEnd(v3, "0");
1584
1584
  if (J === "bytes") {
1585
- let Q = y$($), G = MJ(Q.length / 2), Y2 = Q.padEnd(Math.ceil(Q.length / g3) * g3, "0");
1585
+ let Q = E$($), G = MJ(Q.length / 2), Y2 = Q.padEnd(Math.ceil(Q.length / v3) * v3, "0");
1586
1586
  return G + Y2;
1587
1587
  }
1588
1588
  if (J === "string") {
1589
- let Q = Array.from(new TextEncoder().encode($)).map((M2) => M2.toString(16).padStart(2, "0")).join(""), G = MJ(Q.length / 2), Y2 = Q.padEnd(Math.ceil(Q.length / g3) * g3, "0");
1589
+ let Q = Array.from(new TextEncoder().encode($)).map((M2) => M2.toString(16).padStart(2, "0")).join(""), G = MJ(Q.length / 2), Y2 = Q.padEnd(Math.ceil(Q.length / v3) * v3, "0");
1590
1590
  return G + Y2;
1591
1591
  }
1592
1592
  throw Error(`Unsupported type: ${J}`);
@@ -1595,18 +1595,18 @@ function M$(J, $, Q = 0, G) {
1595
1595
  if (J === "tuple" && G)
1596
1596
  return TQ(G, $, Q);
1597
1597
  if (J.includes("["))
1598
- return RQ(J, $, Q, G);
1599
- return PQ(J, $, Q);
1598
+ return IQ(J, $, Q, G);
1599
+ return RQ(J, $, Q);
1600
1600
  }
1601
- function RQ(J, $, Q, G) {
1602
- let Y2 = J.slice(0, J.indexOf("[")), M2 = $.slice(Q, Q + g3);
1601
+ function IQ(J, $, Q, G) {
1602
+ let Y2 = J.slice(0, J.indexOf("[")), M2 = $.slice(Q, Q + v3);
1603
1603
  if (J.endsWith("[]")) {
1604
- let K = parseInt(M2, 16) * 2, X2 = parseInt($.slice(K, K + g3), 16), q = [], U2 = K + g3;
1604
+ let K = parseInt(M2, 16) * 2, X2 = parseInt($.slice(K, K + v3), 16), q = [], U2 = K + v3;
1605
1605
  for (let j = 0;j < X2; j++) {
1606
1606
  let z2 = M$(Y2, $, U2, G);
1607
1607
  q.push(z2.value), U2 += z2.consumed;
1608
1608
  }
1609
- return { value: q, consumed: g3 };
1609
+ return { value: q, consumed: v3 };
1610
1610
  }
1611
1611
  let Z = J.match(/\[(\d+)\]$/);
1612
1612
  if (Z) {
@@ -1627,44 +1627,44 @@ function TQ(J, $, Q) {
1627
1627
  }
1628
1628
  return { value: G, consumed: Y2 - Q };
1629
1629
  }
1630
- function PQ(J, $, Q) {
1631
- let G = $.slice(Q, Q + g3);
1630
+ function RQ(J, $, Q) {
1631
+ let G = $.slice(Q, Q + v3);
1632
1632
  if (J === "address")
1633
- return { value: VJ("0x" + G.slice(24)), consumed: g3 };
1633
+ return { value: VJ("0x" + G.slice(24)), consumed: v3 };
1634
1634
  if (J === "bool")
1635
- return { value: parseInt(G, 16) !== 0, consumed: g3 };
1635
+ return { value: parseInt(G, 16) !== 0, consumed: v3 };
1636
1636
  if (J.startsWith("uint"))
1637
- return { value: BigInt("0x" + G), consumed: g3 };
1637
+ return { value: BigInt("0x" + G), consumed: v3 };
1638
1638
  if (J.startsWith("int")) {
1639
1639
  let Y2 = BigInt("0x" + G), M2 = J === "int" ? 256 : parseInt(J.slice(3)), Z = 1n << BigInt(M2 - 1);
1640
- return { value: Y2 >= Z ? Y2 - (1n << BigInt(M2)) : Y2, consumed: g3 };
1640
+ return { value: Y2 >= Z ? Y2 - (1n << BigInt(M2)) : Y2, consumed: v3 };
1641
1641
  }
1642
1642
  if (J.startsWith("bytes") && J !== "bytes") {
1643
1643
  let Y2 = parseInt(J.match(/^bytes(\d+)$/)[1]);
1644
- return { value: "0x" + G.slice(0, Y2 * 2), consumed: g3 };
1644
+ return { value: "0x" + G.slice(0, Y2 * 2), consumed: v3 };
1645
1645
  }
1646
1646
  if (J === "bytes") {
1647
- let Y2 = parseInt(G, 16) * 2, M2 = parseInt($.slice(Y2, Y2 + g3), 16) * 2;
1648
- return { value: "0x" + $.slice(Y2 + g3, Y2 + g3 + M2), consumed: g3 };
1647
+ let Y2 = parseInt(G, 16) * 2, M2 = parseInt($.slice(Y2, Y2 + v3), 16) * 2;
1648
+ return { value: "0x" + $.slice(Y2 + v3, Y2 + v3 + M2), consumed: v3 };
1649
1649
  }
1650
1650
  if (J === "string") {
1651
- let Y2 = parseInt(G, 16) * 2, M2 = parseInt($.slice(Y2, Y2 + g3), 16) * 2, Z = $.slice(Y2 + g3, Y2 + g3 + M2), K = new Uint8Array(Z.match(/.{2}/g)?.map((X2) => parseInt(X2, 16)) || []);
1652
- return { value: new TextDecoder().decode(K), consumed: g3 };
1651
+ let Y2 = parseInt(G, 16) * 2, M2 = parseInt($.slice(Y2, Y2 + v3), 16) * 2, Z = $.slice(Y2 + v3, Y2 + v3 + M2), K = new Uint8Array(Z.match(/.{2}/g)?.map((X2) => parseInt(X2, 16)) || []);
1652
+ return { value: new TextDecoder().decode(K), consumed: v3 };
1653
1653
  }
1654
1654
  throw Error(`Unsupported type: ${J}`);
1655
1655
  }
1656
- function BJ(J) {
1656
+ function LJ(J) {
1657
1657
  let { abi: $, functionName: Q, args: G = [] } = J, Y2 = $.find((V2) => V2.type === "function" && V2.name === Q);
1658
1658
  if (!Y2)
1659
1659
  throw Error(`Function "${Q}" not found in ABI`);
1660
- let M2 = zQ(Y2), Z = Y2.inputs || [];
1660
+ let M2 = jQ(Y2), Z = Y2.inputs || [];
1661
1661
  if (Z.length === 0)
1662
1662
  return M2;
1663
1663
  if (G.length !== Z.length)
1664
1664
  throw Error(`Expected ${Z.length} arguments, got ${G.length}`);
1665
1665
  let K = [], X2 = [], q = [];
1666
1666
  for (let V2 = 0;V2 < Z.length; V2++) {
1667
- let C3 = Z[V2], D3 = C3.components, f3 = pJ(C3.type, D3);
1667
+ let C3 = Z[V2], D3 = C3.components, f3 = lJ(C3.type, D3);
1668
1668
  if (q.push(f3), f3)
1669
1669
  K.push(""), X2.push(DJ(C3.type, G[V2], D3));
1670
1670
  else
@@ -1672,7 +1672,7 @@ function BJ(J) {
1672
1672
  }
1673
1673
  if (X2.length === 0)
1674
1674
  return M2 + K.join("");
1675
- let U2 = K.reduce((V2, C3, D3) => V2 + (q[D3] ? E$ : C3.length / 2), 0), j = "", z2 = 0;
1675
+ let U2 = K.reduce((V2, C3, D3) => V2 + (q[D3] ? y$ : C3.length / 2), 0), j = "", z2 = 0;
1676
1676
  for (let V2 = 0;V2 < Z.length; V2++)
1677
1677
  if (q[V2])
1678
1678
  j += MJ(U2), U2 += X2[z2].length / 2, z2++;
@@ -1687,7 +1687,7 @@ function Z$(J) {
1687
1687
  let M2 = Y2.outputs || [];
1688
1688
  if (M2.length === 0)
1689
1689
  return;
1690
- let Z = y$(G);
1690
+ let Z = E$(G);
1691
1691
  if (M2.length === 1)
1692
1692
  return M$(M2[0].type, Z, 0, M2[0].components).value;
1693
1693
  let K = [], X2 = 0;
@@ -1697,12 +1697,12 @@ function Z$(J) {
1697
1697
  }
1698
1698
  return K;
1699
1699
  }
1700
- function r3(J, $) {
1700
+ function $J(J, $) {
1701
1701
  if (J.length !== $.length)
1702
1702
  throw Error(`Type/value length mismatch: ${J.length} types, ${$.length} values`);
1703
1703
  let Q = [], G = [], Y2 = [];
1704
1704
  for (let X2 = 0;X2 < J.length; X2++) {
1705
- let q = J[X2], U2 = pJ(q);
1705
+ let q = J[X2], U2 = lJ(q);
1706
1706
  if (Y2.push(U2), U2)
1707
1707
  Q.push(""), G.push(DJ(q, $[X2]));
1708
1708
  else
@@ -1710,7 +1710,7 @@ function r3(J, $) {
1710
1710
  }
1711
1711
  if (G.length === 0)
1712
1712
  return "0x" + Q.join("");
1713
- let M2 = Q.reduce((X2, q, U2) => X2 + (Y2[U2] ? E$ : q.length / 2), 0), Z = "", K = 0;
1713
+ let M2 = Q.reduce((X2, q, U2) => X2 + (Y2[U2] ? y$ : q.length / 2), 0), Z = "", K = 0;
1714
1714
  for (let X2 = 0;X2 < J.length; X2++)
1715
1715
  if (Y2[X2])
1716
1716
  Z += MJ(M2), M2 += G[K].length / 2, K++;
@@ -1721,10 +1721,10 @@ function r3(J, $) {
1721
1721
  function I(J) {
1722
1722
  return J.toLowerCase();
1723
1723
  }
1724
- function CQ(J) {
1724
+ function PQ(J) {
1725
1725
  return VJ(J);
1726
1726
  }
1727
- function BQ(J) {
1727
+ function CQ(J) {
1728
1728
  if (typeof J !== "string")
1729
1729
  return false;
1730
1730
  let $ = J.replace("0x", "");
@@ -1733,8 +1733,8 @@ function BQ(J) {
1733
1733
  function H(J) {
1734
1734
  if (J === null || J === undefined)
1735
1735
  return J;
1736
- if (BQ(J))
1737
- return CQ(J);
1736
+ if (CQ(J))
1737
+ return PQ(J);
1738
1738
  if (Array.isArray(J))
1739
1739
  return J.map(($) => H($));
1740
1740
  if (typeof J === "object" && J !== null) {
@@ -1746,7 +1746,7 @@ function H(J) {
1746
1746
  }
1747
1747
  return J;
1748
1748
  }
1749
- function G0(J) {
1749
+ function Q0(J) {
1750
1750
  return { Source: I(J.from), Sink: I(J.to), TargetFlow: J.targetFlow.toString(), WithWrap: J.useWrappedBalances, FromTokens: J.fromTokens?.map(I), ToTokens: J.toTokens?.map(I), ExcludedFromTokens: J.excludeFromTokens?.map(I), ExcludedToTokens: J.excludeToTokens?.map(I), SimulatedBalances: J.simulatedBalances?.map(($) => ({ Holder: I($.holder), Token: I($.token), Amount: $.amount.toString(), IsWrapped: $.isWrapped, IsStatic: $.isStatic })), SimulatedTrusts: J.simulatedTrusts?.map(($) => ({ Truster: I($.truster), Trustee: I($.trustee) })), MaxTransfers: J.maxTransfers };
1751
1751
  }
1752
1752
  function XJ(J) {
@@ -1766,14 +1766,14 @@ function XJ(J) {
1766
1766
  }
1767
1767
  return $;
1768
1768
  }
1769
- var LJ = "0x0000000000000000000000000000000000000000";
1769
+ var BJ = "0x0000000000000000000000000000000000000000";
1770
1770
  var m2 = BigInt(96) * BigInt(1000000000000000000);
1771
1771
  var X$ = BigInt("9999999999999999999999999999999999999");
1772
1772
  var r$ = "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67";
1773
1773
  var e$ = "0x89867a67674bd4bf33165a653cde826b696ab7d050166b71066dfa0b9b6f90f4";
1774
1774
  var J8 = "0xe298282cefe913ab5d282047161268a8222e4bd4ed106300c547894bbefd31ee";
1775
- var dJ = "0xc19bc204eb1c1d5b3fe500e5e5dfabab625f286c";
1776
- var HJ = "0x9Eb51E6A39B3F17bB1883B80748b56170039ff1d";
1775
+ var cJ = "0xc19bc204eb1c1d5b3fe500e5e5dfabab625f286c";
1776
+ var pJ = "0x9Eb51E6A39B3F17bB1883B80748b56170039ff1d";
1777
1777
 
1778
1778
  class KJ {
1779
1779
  client;
@@ -1781,7 +1781,7 @@ class KJ {
1781
1781
  this.client = J;
1782
1782
  }
1783
1783
  async findPath(J) {
1784
- let $ = G0(J), Q = await this.client.call("circlesV2_findPath", [$]), G = XJ(Q);
1784
+ let $ = Q0(J), Q = await this.client.call("circlesV2_findPath", [$]), G = XJ(Q);
1785
1785
  return H(G);
1786
1786
  }
1787
1787
  async findMaxFlow(J) {
@@ -1814,7 +1814,7 @@ class K$ {
1814
1814
  }
1815
1815
  var LQ = [{ name: "blockNumber", sortOrder: "DESC" }, { name: "transactionIndex", sortOrder: "DESC" }, { name: "logIndex", sortOrder: "DESC" }];
1816
1816
 
1817
- class SJ {
1817
+ class HJ {
1818
1818
  params;
1819
1819
  client;
1820
1820
  rowTransformer;
@@ -1856,7 +1856,7 @@ class SJ {
1856
1856
  }
1857
1857
  }
1858
1858
 
1859
- class _J {
1859
+ class SJ {
1860
1860
  client;
1861
1861
  constructor(J) {
1862
1862
  this.client = J;
@@ -1876,7 +1876,7 @@ class _J {
1876
1876
  }
1877
1877
  getTrustRelations(J, $ = 100, Q = "DESC") {
1878
1878
  let G = I(J), Y2 = [{ Type: "Conjunction", ConjunctionType: "And", Predicates: [{ Type: "FilterPredicate", FilterType: "Equals", Column: "version", Value: 2 }, { Type: "Conjunction", ConjunctionType: "Or", Predicates: [{ Type: "FilterPredicate", FilterType: "Equals", Column: "trustee", Value: G }, { Type: "FilterPredicate", FilterType: "Equals", Column: "truster", Value: G }] }] }];
1879
- return new SJ(this.client, { namespace: "V_Crc", table: "TrustRelations", sortOrder: Q, columns: ["blockNumber", "timestamp", "transactionIndex", "logIndex", "transactionHash", "version", "trustee", "truster", "expiryTime"], filter: Y2, limit: $ }, (M2) => H(M2));
1879
+ return new HJ(this.client, { namespace: "V_Crc", table: "TrustRelations", sortOrder: Q, columns: ["blockNumber", "timestamp", "transactionIndex", "logIndex", "transactionHash", "version", "trustee", "truster", "expiryTime"], filter: Y2, limit: $ }, (M2) => H(M2));
1880
1880
  }
1881
1881
  async getAggregatedTrustRelations(J) {
1882
1882
  let $ = I(J), Q = await this.client.call("circles_getAggregatedTrustRelations", [$]);
@@ -1908,7 +1908,7 @@ class _J {
1908
1908
  }
1909
1909
  }
1910
1910
 
1911
- class nJ {
1911
+ class dJ {
1912
1912
  static ONE_64 = 1n << 64n;
1913
1913
  static GAMMA_64 = 18443079296116538654n;
1914
1914
  static BETA_64 = 18450409579521241655n;
@@ -2021,14 +2021,14 @@ class nJ {
2021
2021
  }
2022
2022
  }
2023
2023
 
2024
- class AJ {
2024
+ class _J {
2025
2025
  client;
2026
2026
  constructor(J) {
2027
2027
  this.client = J;
2028
2028
  }
2029
2029
  async getTotalBalance(J, $ = true) {
2030
2030
  let Q = await this.client.call("circlesV2_getTotalBalance", [I(J), $]);
2031
- return nJ.circlesToAttoCircles(Q);
2031
+ return dJ.circlesToAttoCircles(Q);
2032
2032
  }
2033
2033
  async getTokenBalances(J) {
2034
2034
  let Q = (await this.client.call("circles_getTokenBalances", [I(J)])).map((G) => XJ(G));
@@ -2085,7 +2085,7 @@ class U$ {
2085
2085
  }
2086
2086
  }
2087
2087
 
2088
- class yJ {
2088
+ class AJ {
2089
2089
  client;
2090
2090
  constructor(J) {
2091
2091
  this.client = J;
@@ -2222,11 +2222,11 @@ class EJ {
2222
2222
  G.push({ Type: "FilterPredicate", FilterType: "Equals", Column: "treasury", Value: I($.treasuryEquals) });
2223
2223
  }
2224
2224
  let Y2 = G.length > 1 ? [{ Type: "Conjunction", ConjunctionType: "And", Predicates: G }] : G;
2225
- return new SJ(this.client, { namespace: "V_CrcV2", table: "Groups", sortOrder: Q, columns: ["blockNumber", "timestamp", "transactionIndex", "logIndex", "transactionHash", "group", "type", "owner", "mintPolicy", "mintHandler", "treasury", "service", "feeCollection", "memberCount", "name", "symbol", "cidV0Digest", "erc20WrapperDemurraged", "erc20WrapperStatic"], filter: Y2, limit: J }, (M2) => H(M2));
2225
+ return new HJ(this.client, { namespace: "V_CrcV2", table: "Groups", sortOrder: Q, columns: ["blockNumber", "timestamp", "transactionIndex", "logIndex", "transactionHash", "group", "type", "owner", "mintPolicy", "mintHandler", "treasury", "service", "feeCollection", "memberCount", "name", "symbol", "cidV0Digest", "erc20WrapperDemurraged", "erc20WrapperStatic"], filter: Y2, limit: J }, (M2) => H(M2));
2226
2226
  }
2227
2227
  getGroupHolders(J, $ = 100) {
2228
2228
  let Q = I(J);
2229
- return new SJ(this.client, { namespace: "V_Crc", table: "TokenBalances", sortOrder: "DESC", columns: ["blockNumber", "timestamp", "transactionIndex", "logIndex", "transactionHash", "token", "account", "balance", "lastChangedAt"], filter: [{ Type: "FilterPredicate", FilterType: "Equals", Column: "token", Value: Q }], limit: $ }, (G) => H(G));
2229
+ return new HJ(this.client, { namespace: "V_Crc", table: "TokenBalances", sortOrder: "DESC", columns: ["blockNumber", "timestamp", "transactionIndex", "logIndex", "transactionHash", "token", "account", "balance", "lastChangedAt"], filter: [{ Type: "FilterPredicate", FilterType: "Equals", Column: "token", Value: Q }], limit: $ }, (G) => H(G));
2230
2230
  }
2231
2231
  }
2232
2232
 
@@ -2288,12 +2288,12 @@ class k$ {
2288
2288
  }
2289
2289
  get trust() {
2290
2290
  if (!this._trust)
2291
- this._trust = new _J(this.client);
2291
+ this._trust = new SJ(this.client);
2292
2292
  return this._trust;
2293
2293
  }
2294
2294
  get balance() {
2295
2295
  if (!this._balance)
2296
- this._balance = new AJ(this.client);
2296
+ this._balance = new _J(this.client);
2297
2297
  return this._balance;
2298
2298
  }
2299
2299
  get avatar() {
@@ -2308,7 +2308,7 @@ class k$ {
2308
2308
  }
2309
2309
  get token() {
2310
2310
  if (!this._token)
2311
- this._token = new yJ(this.client);
2311
+ this._token = new AJ(this.client);
2312
2312
  return this._token;
2313
2313
  }
2314
2314
  get invitation() {
@@ -2347,7 +2347,7 @@ class h2 {
2347
2347
  this.address = J.address, this.abi = J.abi, this.rpcUrl = J.rpcUrl;
2348
2348
  }
2349
2349
  async read(J, $, Q) {
2350
- let G = BJ({ abi: this.abi, functionName: J, args: $ }), Y2 = { to: this.address, data: G, ...Q?.from && { from: Q.from } }, Z = await (await fetch(this.rpcUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "eth_call", params: [Y2, "latest"] }) })).json();
2350
+ let G = LJ({ abi: this.abi, functionName: J, args: $ }), Y2 = { to: this.address, data: G, ...Q?.from && { from: Q.from } }, Z = await (await fetch(this.rpcUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "eth_call", params: [Y2, "latest"] }) })).json();
2351
2351
  if (Z.error)
2352
2352
  throw Error(`RPC Error: ${Z.error.message}`);
2353
2353
  if (!Z.result)
@@ -2355,14 +2355,14 @@ class h2 {
2355
2355
  return Z$({ abi: this.abi, functionName: J, data: Z.result });
2356
2356
  }
2357
2357
  encodeWrite(J, $) {
2358
- return BJ({ abi: this.abi, functionName: J, args: $ });
2358
+ return LJ({ abi: this.abi, functionName: J, args: $ });
2359
2359
  }
2360
2360
  }
2361
- var Y0 = [{ type: "function", name: "operateFlowMatrix", inputs: [{ name: "_flowVertices", type: "address[]" }, { name: "_flow", type: "tuple[]", components: [{ name: "streamSinkId", type: "uint16" }, { name: "amount", type: "uint192" }] }, { name: "_streams", type: "tuple[]", components: [{ name: "sourceCoordinate", type: "uint16" }, { name: "flowEdgeIds", type: "uint16[]" }, { name: "data", type: "bytes" }] }, { name: "_packedCoordinates", type: "bytes" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "isApprovedForAll", inputs: [{ name: "_account", type: "address" }, { name: "_operator", type: "address" }], outputs: [{ type: "bool" }], stateMutability: "view" }, { type: "function", name: "setApprovalForAll", inputs: [{ name: "_operator", type: "address" }, { name: "_approved", type: "bool" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "wrap", inputs: [{ name: "_avatar", type: "address" }, { name: "_amount", type: "uint256" }, { name: "_type", type: "uint8" }], outputs: [{ type: "address" }], stateMutability: "nonpayable" }, { type: "function", name: "trust", inputs: [{ name: "_trustReceiver", type: "address" }, { name: "_expiry", type: "uint96" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "isTrusted", inputs: [{ name: "_truster", type: "address" }, { name: "_trustee", type: "address" }], outputs: [{ type: "bool" }], stateMutability: "view" }, { type: "function", name: "toTokenId", inputs: [{ name: "_avatar", type: "address" }], outputs: [{ type: "uint256" }], stateMutability: "pure" }, { type: "function", name: "safeTransferFrom", inputs: [{ name: "_from", type: "address" }, { name: "_to", type: "address" }, { name: "_id", type: "uint256" }, { name: "_value", type: "uint256" }, { name: "_data", type: "bytes" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "isHuman", inputs: [{ name: "_human", type: "address" }], outputs: [{ type: "bool" }], stateMutability: "view" }, { type: "function", name: "safeBatchTransferFrom", inputs: [{ name: "_from", type: "address" }, { name: "_to", type: "address" }, { name: "_ids", type: "uint256[]" }, { name: "_values", type: "uint256[]" }, { name: "_data", type: "bytes" }], outputs: [], stateMutability: "nonpayable" }];
2361
+ var G0 = [{ type: "function", name: "operateFlowMatrix", inputs: [{ name: "_flowVertices", type: "address[]" }, { name: "_flow", type: "tuple[]", components: [{ name: "streamSinkId", type: "uint16" }, { name: "amount", type: "uint192" }] }, { name: "_streams", type: "tuple[]", components: [{ name: "sourceCoordinate", type: "uint16" }, { name: "flowEdgeIds", type: "uint16[]" }, { name: "data", type: "bytes" }] }, { name: "_packedCoordinates", type: "bytes" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "isApprovedForAll", inputs: [{ name: "_account", type: "address" }, { name: "_operator", type: "address" }], outputs: [{ type: "bool" }], stateMutability: "view" }, { type: "function", name: "setApprovalForAll", inputs: [{ name: "_operator", type: "address" }, { name: "_approved", type: "bool" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "wrap", inputs: [{ name: "_avatar", type: "address" }, { name: "_amount", type: "uint256" }, { name: "_type", type: "uint8" }], outputs: [{ type: "address" }], stateMutability: "nonpayable" }, { type: "function", name: "trust", inputs: [{ name: "_trustReceiver", type: "address" }, { name: "_expiry", type: "uint96" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "isTrusted", inputs: [{ name: "_truster", type: "address" }, { name: "_trustee", type: "address" }], outputs: [{ type: "bool" }], stateMutability: "view" }, { type: "function", name: "toTokenId", inputs: [{ name: "_avatar", type: "address" }], outputs: [{ type: "uint256" }], stateMutability: "pure" }, { type: "function", name: "safeTransferFrom", inputs: [{ name: "_from", type: "address" }, { name: "_to", type: "address" }, { name: "_id", type: "uint256" }, { name: "_value", type: "uint256" }, { name: "_data", type: "bytes" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "isHuman", inputs: [{ name: "_human", type: "address" }], outputs: [{ type: "bool" }], stateMutability: "view" }, { type: "function", name: "safeBatchTransferFrom", inputs: [{ name: "_from", type: "address" }, { name: "_to", type: "address" }, { name: "_ids", type: "uint256[]" }, { name: "_values", type: "uint256[]" }, { name: "_data", type: "bytes" }], outputs: [], stateMutability: "nonpayable" }];
2362
2362
 
2363
2363
  class IJ extends h2 {
2364
2364
  constructor(J) {
2365
- super({ address: J.address, abi: Y0, rpcUrl: J.rpcUrl });
2365
+ super({ address: J.address, abi: G0, rpcUrl: J.rpcUrl });
2366
2366
  }
2367
2367
  async isTrusted(J, $) {
2368
2368
  return this.read("isTrusted", [J, $]);
@@ -2395,11 +2395,11 @@ class IJ extends h2 {
2395
2395
  return { to: this.address, data: this.encodeWrite("safeBatchTransferFrom", [J, $, Q, G, Y2]), value: 0n };
2396
2396
  }
2397
2397
  }
2398
- var M0 = [{ type: "function", name: "erc20Circles", inputs: [{ name: "_circlesType", type: "uint8" }, { name: "_avatar", type: "address" }], outputs: [{ type: "address" }], stateMutability: "view" }];
2398
+ var Y0 = [{ type: "function", name: "erc20Circles", inputs: [{ name: "_circlesType", type: "uint8" }, { name: "_avatar", type: "address" }], outputs: [{ type: "address" }], stateMutability: "view" }];
2399
2399
 
2400
2400
  class x$ extends h2 {
2401
2401
  constructor(J) {
2402
- super({ address: J.address, abi: M0, rpcUrl: J.rpcUrl });
2402
+ super({ address: J.address, abi: Y0, rpcUrl: J.rpcUrl });
2403
2403
  }
2404
2404
  async erc20Circles(J, $) {
2405
2405
  return this.read("erc20Circles", [J, $]);
@@ -2430,7 +2430,7 @@ var Y8 = [{ type: "function", name: "isModuleEnabled", inputs: [{ name: "module"
2430
2430
  var M8 = [{ type: "function", name: "trustInviter", inputs: [{ name: "inviter", type: "address" }], outputs: [], stateMutability: "nonpayable" }];
2431
2431
  var Z8 = [{ type: "function", name: "claimableFreeInvites", inputs: [{ name: "inviter", type: "address" }], outputs: [{ type: "uint256" }], stateMutability: "view" }, { type: "function", name: "claimFreeInvite", inputs: [], outputs: [], stateMutability: "nonpayable" }];
2432
2432
 
2433
- class iJ extends h2 {
2433
+ class nJ extends h2 {
2434
2434
  constructor(J) {
2435
2435
  super({ address: J.address, abi: Q8, rpcUrl: J.rpcUrl });
2436
2436
  }
@@ -2442,7 +2442,7 @@ class iJ extends h2 {
2442
2442
  }
2443
2443
  }
2444
2444
 
2445
- class tJ extends h2 {
2445
+ class iJ extends h2 {
2446
2446
  constructor(J) {
2447
2447
  super({ address: J.address, abi: G8, rpcUrl: J.rpcUrl });
2448
2448
  }
@@ -2463,7 +2463,7 @@ class tJ extends h2 {
2463
2463
  }
2464
2464
  }
2465
2465
 
2466
- class b$ extends h2 {
2466
+ class F$ extends h2 {
2467
2467
  constructor(J) {
2468
2468
  super({ address: J.address, abi: Y8, rpcUrl: J.rpcUrl });
2469
2469
  }
@@ -2475,7 +2475,7 @@ class b$ extends h2 {
2475
2475
  }
2476
2476
  }
2477
2477
 
2478
- class F$ extends h2 {
2478
+ class b$ extends h2 {
2479
2479
  constructor(J) {
2480
2480
  super({ address: J.address, abi: M8, rpcUrl: J.rpcUrl });
2481
2481
  }
@@ -2520,39 +2520,39 @@ Context: ${JSON.stringify(this.context, null, 2)}`;
2520
2520
  return J;
2521
2521
  }
2522
2522
  }
2523
- var wJ = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : undefined;
2523
+ var yJ = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : undefined;
2524
2524
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2525
- function HQ(J) {
2525
+ function BQ(J) {
2526
2526
  return J instanceof Uint8Array || ArrayBuffer.isView(J) && J.constructor.name === "Uint8Array";
2527
2527
  }
2528
2528
  function g$(J) {
2529
2529
  if (!Number.isSafeInteger(J) || J < 0)
2530
2530
  throw Error("positive integer expected, got " + J);
2531
2531
  }
2532
- function kJ(J, ...$) {
2533
- if (!HQ(J))
2532
+ function wJ(J, ...$) {
2533
+ if (!BQ(J))
2534
2534
  throw Error("Uint8Array expected");
2535
2535
  if ($.length > 0 && !$.includes(J.length))
2536
2536
  throw Error("Uint8Array expected of length " + $ + ", got length=" + J.length);
2537
2537
  }
2538
- function Z0(J) {
2538
+ function M0(J) {
2539
2539
  if (typeof J !== "function" || typeof J.create !== "function")
2540
2540
  throw Error("Hash should be wrapped by utils.createHasher");
2541
2541
  g$(J.outputLen), g$(J.blockLen);
2542
2542
  }
2543
- function oJ(J, $ = true) {
2543
+ function tJ(J, $ = true) {
2544
2544
  if (J.destroyed)
2545
2545
  throw Error("Hash instance has been destroyed");
2546
2546
  if ($ && J.finished)
2547
2547
  throw Error("Hash#digest() has already been called");
2548
2548
  }
2549
- function X0(J, $) {
2550
- kJ(J);
2549
+ function Z0(J, $) {
2550
+ wJ(J);
2551
2551
  let Q = $.outputLen;
2552
2552
  if (J.length < Q)
2553
2553
  throw Error("digestInto() expects output buffer of length at least " + Q);
2554
2554
  }
2555
- function xJ(...J) {
2555
+ function kJ(...J) {
2556
2556
  for (let $ = 0;$ < J.length; $++)
2557
2557
  J[$].fill(0);
2558
2558
  }
@@ -2562,21 +2562,21 @@ function v$(J) {
2562
2562
  function QJ(J, $) {
2563
2563
  return J << 32 - $ | J >>> $;
2564
2564
  }
2565
- function SQ(J) {
2565
+ function HQ(J) {
2566
2566
  if (typeof J !== "string")
2567
2567
  throw Error("string expected");
2568
2568
  return new Uint8Array(new TextEncoder().encode(J));
2569
2569
  }
2570
2570
  function D$(J) {
2571
2571
  if (typeof J === "string")
2572
- J = SQ(J);
2573
- return kJ(J), J;
2572
+ J = HQ(J);
2573
+ return wJ(J), J;
2574
2574
  }
2575
- function K0(...J) {
2575
+ function X0(...J) {
2576
2576
  let $ = 0;
2577
2577
  for (let G = 0;G < J.length; G++) {
2578
2578
  let Y2 = J[G];
2579
- kJ(Y2), $ += Y2.length;
2579
+ wJ(Y2), $ += Y2.length;
2580
2580
  }
2581
2581
  let Q = new Uint8Array($);
2582
2582
  for (let G = 0, Y2 = 0;G < J.length; G++) {
@@ -2588,27 +2588,27 @@ function K0(...J) {
2588
2588
 
2589
2589
  class V$ {
2590
2590
  }
2591
- function q0(J) {
2591
+ function K0(J) {
2592
2592
  let $ = (G) => J().update(D$(G)).digest(), Q = J();
2593
2593
  return $.outputLen = Q.outputLen, $.blockLen = Q.blockLen, $.create = () => J(), $;
2594
2594
  }
2595
- function U0(J = 32) {
2596
- if (wJ && typeof wJ.getRandomValues === "function")
2597
- return wJ.getRandomValues(new Uint8Array(J));
2598
- if (wJ && typeof wJ.randomBytes === "function")
2599
- return Uint8Array.from(wJ.randomBytes(J));
2595
+ function q0(J = 32) {
2596
+ if (yJ && typeof yJ.getRandomValues === "function")
2597
+ return yJ.getRandomValues(new Uint8Array(J));
2598
+ if (yJ && typeof yJ.randomBytes === "function")
2599
+ return Uint8Array.from(yJ.randomBytes(J));
2600
2600
  throw Error("crypto.getRandomValues must be defined");
2601
2601
  }
2602
- function _Q(J, $, Q, G) {
2602
+ function SQ(J, $, Q, G) {
2603
2603
  if (typeof J.setBigUint64 === "function")
2604
2604
  return J.setBigUint64($, Q, G);
2605
2605
  let Y2 = BigInt(32), M2 = BigInt(4294967295), Z = Number(Q >> Y2 & M2), K = Number(Q & M2), X2 = G ? 4 : 0, q = G ? 0 : 4;
2606
2606
  J.setUint32($ + X2, Z, G), J.setUint32($ + q, K, G);
2607
2607
  }
2608
- function W0(J, $, Q) {
2608
+ function U0(J, $, Q) {
2609
2609
  return J & $ ^ ~J & Q;
2610
2610
  }
2611
- function N0(J, $, Q) {
2611
+ function W0(J, $, Q) {
2612
2612
  return J & $ ^ J & Q ^ $ & Q;
2613
2613
  }
2614
2614
 
@@ -2618,7 +2618,7 @@ class X8 extends V$ {
2618
2618
  this.finished = false, this.length = 0, this.pos = 0, this.destroyed = false, this.blockLen = J, this.outputLen = $, this.padOffset = Q, this.isLE = G, this.buffer = new Uint8Array(J), this.view = v$(this.buffer);
2619
2619
  }
2620
2620
  update(J) {
2621
- oJ(this), J = D$(J), kJ(J);
2621
+ tJ(this), J = D$(J), wJ(J);
2622
2622
  let { view: $, buffer: Q, blockLen: G } = this, Y2 = J.length;
2623
2623
  for (let M2 = 0;M2 < Y2; ) {
2624
2624
  let Z = Math.min(G - this.pos, Y2 - M2);
@@ -2634,13 +2634,13 @@ class X8 extends V$ {
2634
2634
  return this.length += J.length, this.roundClean(), this;
2635
2635
  }
2636
2636
  digestInto(J) {
2637
- oJ(this), X0(J, this), this.finished = true;
2637
+ tJ(this), Z0(J, this), this.finished = true;
2638
2638
  let { buffer: $, view: Q, blockLen: G, isLE: Y2 } = this, { pos: M2 } = this;
2639
- if ($[M2++] = 128, xJ(this.buffer.subarray(M2)), this.padOffset > G - M2)
2639
+ if ($[M2++] = 128, kJ(this.buffer.subarray(M2)), this.padOffset > G - M2)
2640
2640
  this.process(Q, 0), M2 = 0;
2641
2641
  for (let U2 = M2;U2 < G; U2++)
2642
2642
  $[U2] = 0;
2643
- _Q(Q, G - 8, BigInt(this.length * 8), Y2), this.process(Q, 0);
2643
+ SQ(Q, G - 8, BigInt(this.length * 8), Y2), this.process(Q, 0);
2644
2644
  let Z = v$(J), K = this.outputLen;
2645
2645
  if (K % 4)
2646
2646
  throw Error("_sha2: outputLen should be aligned to 32bit");
@@ -2668,10 +2668,10 @@ class X8 extends V$ {
2668
2668
  }
2669
2669
  }
2670
2670
  var qJ = Uint32Array.from([1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225]);
2671
- var AQ = Uint32Array.from([1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298]);
2672
- var RJ = new Uint32Array(64);
2671
+ var _Q = Uint32Array.from([1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298]);
2672
+ var TJ = new Uint32Array(64);
2673
2673
 
2674
- class O0 extends X8 {
2674
+ class N0 extends X8 {
2675
2675
  constructor(J = 32) {
2676
2676
  super(64, J, 8, false);
2677
2677
  this.A = qJ[0] | 0, this.B = qJ[1] | 0, this.C = qJ[2] | 0, this.D = qJ[3] | 0, this.E = qJ[4] | 0, this.F = qJ[5] | 0, this.G = qJ[6] | 0, this.H = qJ[7] | 0;
@@ -2685,31 +2685,31 @@ class O0 extends X8 {
2685
2685
  }
2686
2686
  process(J, $) {
2687
2687
  for (let U2 = 0;U2 < 16; U2++, $ += 4)
2688
- RJ[U2] = J.getUint32($, false);
2688
+ TJ[U2] = J.getUint32($, false);
2689
2689
  for (let U2 = 16;U2 < 64; U2++) {
2690
- let j = RJ[U2 - 15], z2 = RJ[U2 - 2], V2 = QJ(j, 7) ^ QJ(j, 18) ^ j >>> 3, C3 = QJ(z2, 17) ^ QJ(z2, 19) ^ z2 >>> 10;
2691
- RJ[U2] = C3 + RJ[U2 - 7] + V2 + RJ[U2 - 16] | 0;
2690
+ let j = TJ[U2 - 15], z2 = TJ[U2 - 2], V2 = QJ(j, 7) ^ QJ(j, 18) ^ j >>> 3, C3 = QJ(z2, 17) ^ QJ(z2, 19) ^ z2 >>> 10;
2691
+ TJ[U2] = C3 + TJ[U2 - 7] + V2 + TJ[U2 - 16] | 0;
2692
2692
  }
2693
2693
  let { A: Q, B: G, C: Y2, D: M2, E: Z, F: K, G: X2, H: q } = this;
2694
2694
  for (let U2 = 0;U2 < 64; U2++) {
2695
- let j = QJ(Z, 6) ^ QJ(Z, 11) ^ QJ(Z, 25), z2 = q + j + W0(Z, K, X2) + AQ[U2] + RJ[U2] | 0, C3 = (QJ(Q, 2) ^ QJ(Q, 13) ^ QJ(Q, 22)) + N0(Q, G, Y2) | 0;
2695
+ let j = QJ(Z, 6) ^ QJ(Z, 11) ^ QJ(Z, 25), z2 = q + j + U0(Z, K, X2) + _Q[U2] + TJ[U2] | 0, C3 = (QJ(Q, 2) ^ QJ(Q, 13) ^ QJ(Q, 22)) + W0(Q, G, Y2) | 0;
2696
2696
  q = X2, X2 = K, K = Z, Z = M2 + z2 | 0, M2 = Y2, Y2 = G, G = Q, Q = z2 + C3 | 0;
2697
2697
  }
2698
2698
  Q = Q + this.A | 0, G = G + this.B | 0, Y2 = Y2 + this.C | 0, M2 = M2 + this.D | 0, Z = Z + this.E | 0, K = K + this.F | 0, X2 = X2 + this.G | 0, q = q + this.H | 0, this.set(Q, G, Y2, M2, Z, K, X2, q);
2699
2699
  }
2700
2700
  roundClean() {
2701
- xJ(RJ);
2701
+ kJ(TJ);
2702
2702
  }
2703
2703
  destroy() {
2704
- this.set(0, 0, 0, 0, 0, 0, 0, 0), xJ(this.buffer);
2704
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), kJ(this.buffer);
2705
2705
  }
2706
2706
  }
2707
- var j0 = q0(() => new O0);
2707
+ var O0 = K0(() => new N0);
2708
2708
 
2709
2709
  class K8 extends V$ {
2710
2710
  constructor(J, $) {
2711
2711
  super();
2712
- this.finished = false, this.destroyed = false, Z0(J);
2712
+ this.finished = false, this.destroyed = false, M0(J);
2713
2713
  let Q = D$($);
2714
2714
  if (this.iHash = J.create(), typeof this.iHash.update !== "function")
2715
2715
  throw Error("Expected instance of class which extends utils.Hash");
@@ -2721,13 +2721,13 @@ class K8 extends V$ {
2721
2721
  this.iHash.update(Y2), this.oHash = J.create();
2722
2722
  for (let M2 = 0;M2 < Y2.length; M2++)
2723
2723
  Y2[M2] ^= 106;
2724
- this.oHash.update(Y2), xJ(Y2);
2724
+ this.oHash.update(Y2), kJ(Y2);
2725
2725
  }
2726
2726
  update(J) {
2727
- return oJ(this), this.iHash.update(J), this;
2727
+ return tJ(this), this.iHash.update(J), this;
2728
2728
  }
2729
2729
  digestInto(J) {
2730
- oJ(this), kJ(J, this.outputLen), this.finished = true, this.iHash.digestInto(J), this.oHash.update(J), this.oHash.digestInto(J), this.destroy();
2730
+ tJ(this), wJ(J, this.outputLen), this.finished = true, this.iHash.digestInto(J), this.oHash.update(J), this.oHash.digestInto(J), this.destroy();
2731
2731
  }
2732
2732
  digest() {
2733
2733
  let J = new Uint8Array(this.oHash.outputLen);
@@ -2750,14 +2750,14 @@ q8.create = (J, $) => new K8(J, $);
2750
2750
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2751
2751
  var O8 = BigInt(0);
2752
2752
  var N8 = BigInt(1);
2753
- function aJ(J) {
2753
+ function oJ(J) {
2754
2754
  return J instanceof Uint8Array || ArrayBuffer.isView(J) && J.constructor.name === "Uint8Array";
2755
2755
  }
2756
2756
  function j8(J) {
2757
- if (!aJ(J))
2757
+ if (!oJ(J))
2758
2758
  throw Error("Uint8Array expected");
2759
2759
  }
2760
- function sJ(J, $) {
2760
+ function aJ(J, $) {
2761
2761
  if (typeof $ !== "boolean")
2762
2762
  throw Error(J + " boolean expected, got " + $);
2763
2763
  }
@@ -2765,23 +2765,23 @@ function I$(J) {
2765
2765
  let $ = J.toString(16);
2766
2766
  return $.length & 1 ? "0" + $ : $;
2767
2767
  }
2768
- function V0(J) {
2768
+ function D0(J) {
2769
2769
  if (typeof J !== "string")
2770
2770
  throw Error("hex string expected, got " + typeof J);
2771
2771
  return J === "" ? O8 : BigInt("0x" + J);
2772
2772
  }
2773
- var I0 = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
2774
- var yQ = Array.from({ length: 256 }, (J, $) => $.toString(16).padStart(2, "0"));
2775
- function rJ(J) {
2776
- if (j8(J), I0)
2773
+ var V0 = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
2774
+ var AQ = Array.from({ length: 256 }, (J, $) => $.toString(16).padStart(2, "0"));
2775
+ function sJ(J) {
2776
+ if (j8(J), V0)
2777
2777
  return J.toHex();
2778
2778
  let $ = "";
2779
2779
  for (let Q = 0;Q < J.length; Q++)
2780
- $ += yQ[J[Q]];
2780
+ $ += AQ[J[Q]];
2781
2781
  return $;
2782
2782
  }
2783
2783
  var UJ = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
2784
- function z0(J) {
2784
+ function j0(J) {
2785
2785
  if (J >= UJ._0 && J <= UJ._9)
2786
2786
  return J - UJ._0;
2787
2787
  if (J >= UJ.A && J <= UJ.F)
@@ -2790,17 +2790,17 @@ function z0(J) {
2790
2790
  return J - (UJ.a - 10);
2791
2791
  return;
2792
2792
  }
2793
- function R$(J) {
2793
+ function T$(J) {
2794
2794
  if (typeof J !== "string")
2795
2795
  throw Error("hex string expected, got " + typeof J);
2796
- if (I0)
2796
+ if (V0)
2797
2797
  return Uint8Array.fromHex(J);
2798
2798
  let $ = J.length, Q = $ / 2;
2799
2799
  if ($ % 2)
2800
2800
  throw Error("hex string expected, got unpadded hex of length " + $);
2801
2801
  let G = new Uint8Array(Q);
2802
2802
  for (let Y2 = 0, M2 = 0;Y2 < Q; Y2++, M2 += 2) {
2803
- let Z = z0(J.charCodeAt(M2)), K = z0(J.charCodeAt(M2 + 1));
2803
+ let Z = j0(J.charCodeAt(M2)), K = j0(J.charCodeAt(M2 + 1));
2804
2804
  if (Z === undefined || K === undefined) {
2805
2805
  let X2 = J[M2] + J[M2 + 1];
2806
2806
  throw Error('hex string expected, got non-hex character "' + X2 + '" at index ' + M2);
@@ -2810,26 +2810,26 @@ function R$(J) {
2810
2810
  return G;
2811
2811
  }
2812
2812
  function WJ(J) {
2813
- return V0(rJ(J));
2813
+ return D0(sJ(J));
2814
2814
  }
2815
2815
  function z8(J) {
2816
- return j8(J), V0(rJ(Uint8Array.from(J).reverse()));
2816
+ return j8(J), D0(sJ(Uint8Array.from(J).reverse()));
2817
2817
  }
2818
- function bJ(J, $) {
2819
- return R$(J.toString(16).padStart($ * 2, "0"));
2818
+ function xJ(J, $) {
2819
+ return T$(J.toString(16).padStart($ * 2, "0"));
2820
2820
  }
2821
2821
  function D8(J, $) {
2822
- return bJ(J, $).reverse();
2822
+ return xJ(J, $).reverse();
2823
2823
  }
2824
2824
  function s2(J, $, Q) {
2825
2825
  let G;
2826
2826
  if (typeof $ === "string")
2827
2827
  try {
2828
- G = R$($);
2828
+ G = T$($);
2829
2829
  } catch (M2) {
2830
2830
  throw Error(J + " must be hex string or Uint8Array, cause: " + M2);
2831
2831
  }
2832
- else if (aJ($))
2832
+ else if (oJ($))
2833
2833
  G = Uint8Array.from($);
2834
2834
  else
2835
2835
  throw Error(J + " must be hex string or Uint8Array");
@@ -2838,7 +2838,7 @@ function s2(J, $, Q) {
2838
2838
  throw Error(J + " of length " + Q + " expected, got " + Y2);
2839
2839
  return G;
2840
2840
  }
2841
- function T$(...J) {
2841
+ function R$(...J) {
2842
2842
  let $ = 0;
2843
2843
  for (let G = 0;G < J.length; G++) {
2844
2844
  let Y2 = J[G];
@@ -2859,15 +2859,15 @@ function FJ(J, $, Q, G) {
2859
2859
  if (!u$($, Q, G))
2860
2860
  throw Error("expected valid " + J + ": " + Q + " <= n < " + G + ", got " + $);
2861
2861
  }
2862
- function R0(J) {
2862
+ function I0(J) {
2863
2863
  let $;
2864
2864
  for ($ = 0;J > O8; J >>= N8, $ += 1)
2865
2865
  ;
2866
2866
  return $;
2867
2867
  }
2868
- var fJ = (J) => (N8 << BigInt(J)) - N8;
2868
+ var bJ = (J) => (N8 << BigInt(J)) - N8;
2869
2869
  var W8 = (J) => new Uint8Array(J);
2870
- var D0 = (J) => Uint8Array.from(J);
2870
+ var z0 = (J) => Uint8Array.from(J);
2871
2871
  function T0(J, $, Q) {
2872
2872
  if (typeof J !== "number" || J < 2)
2873
2873
  throw Error("hashLen must be a number");
@@ -2878,9 +2878,9 @@ function T0(J, $, Q) {
2878
2878
  let G = W8(J), Y2 = W8(J), M2 = 0, Z = () => {
2879
2879
  G.fill(1), Y2.fill(0), M2 = 0;
2880
2880
  }, K = (...j) => Q(Y2, G, ...j), X2 = (j = W8(0)) => {
2881
- if (Y2 = K(D0([0]), j), G = K(), j.length === 0)
2881
+ if (Y2 = K(z0([0]), j), G = K(), j.length === 0)
2882
2882
  return;
2883
- Y2 = K(D0([1]), j), G = K();
2883
+ Y2 = K(z0([1]), j), G = K();
2884
2884
  }, q = () => {
2885
2885
  if (M2++ >= 1000)
2886
2886
  throw Error("drbg: tried 1000 values");
@@ -2890,7 +2890,7 @@ function T0(J, $, Q) {
2890
2890
  let V2 = G.slice();
2891
2891
  z2.push(V2), j += G.length;
2892
2892
  }
2893
- return T$(...z2);
2893
+ return R$(...z2);
2894
2894
  };
2895
2895
  return (j, z2) => {
2896
2896
  Z(), X2(j);
@@ -2900,8 +2900,8 @@ function T0(J, $, Q) {
2900
2900
  return Z(), V2;
2901
2901
  };
2902
2902
  }
2903
- var EQ = { bigint: (J) => typeof J === "bigint", function: (J) => typeof J === "function", boolean: (J) => typeof J === "boolean", string: (J) => typeof J === "string", stringOrUint8Array: (J) => typeof J === "string" || aJ(J), isSafeInteger: (J) => Number.isSafeInteger(J), array: (J) => Array.isArray(J), field: (J, $) => $.Fp.isValid(J), hash: (J) => typeof J === "function" && Number.isSafeInteger(J.outputLen) };
2904
- function gJ(J, $, Q = {}) {
2903
+ var EQ = { bigint: (J) => typeof J === "bigint", function: (J) => typeof J === "function", boolean: (J) => typeof J === "boolean", string: (J) => typeof J === "string", stringOrUint8Array: (J) => typeof J === "string" || oJ(J), isSafeInteger: (J) => Number.isSafeInteger(J), array: (J) => Array.isArray(J), field: (J, $) => $.Fp.isValid(J), hash: (J) => typeof J === "function" && Number.isSafeInteger(J.outputLen) };
2904
+ function fJ(J, $, Q = {}) {
2905
2905
  let G = (Y2, M2, Z) => {
2906
2906
  let K = EQ[M2];
2907
2907
  if (typeof K !== "function")
@@ -2931,16 +2931,16 @@ function V8(J) {
2931
2931
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2932
2932
  var t2 = BigInt(0);
2933
2933
  var n2 = BigInt(1);
2934
- var vJ = BigInt(2);
2935
- var wQ = BigInt(3);
2936
- var C0 = BigInt(4);
2937
- var B0 = BigInt(5);
2934
+ var gJ = BigInt(2);
2935
+ var yQ = BigInt(3);
2936
+ var P0 = BigInt(4);
2937
+ var C0 = BigInt(5);
2938
2938
  var L0 = BigInt(8);
2939
2939
  function d2(J, $) {
2940
2940
  let Q = J % $;
2941
2941
  return Q >= t2 ? Q : $ + Q;
2942
2942
  }
2943
- function e2(J, $, Q) {
2943
+ function r3(J, $, Q) {
2944
2944
  let G = J;
2945
2945
  while ($-- > t2)
2946
2946
  G *= G, G %= Q;
@@ -2960,35 +2960,35 @@ function m$(J, $) {
2960
2960
  throw Error("invert: does not exist");
2961
2961
  return d2(Y2, $);
2962
2962
  }
2963
- function H0(J, $) {
2964
- let Q = (J.ORDER + n2) / C0, G = J.pow($, Q);
2963
+ function B0(J, $) {
2964
+ let Q = (J.ORDER + n2) / P0, G = J.pow($, Q);
2965
2965
  if (!J.eql(J.sqr(G), $))
2966
2966
  throw Error("Cannot find square root");
2967
2967
  return G;
2968
2968
  }
2969
- function kQ(J, $) {
2970
- let Q = (J.ORDER - B0) / L0, G = J.mul($, vJ), Y2 = J.pow(G, Q), M2 = J.mul($, Y2), Z = J.mul(J.mul(M2, vJ), Y2), K = J.mul(M2, J.sub(Z, J.ONE));
2969
+ function wQ(J, $) {
2970
+ let Q = (J.ORDER - C0) / L0, G = J.mul($, gJ), Y2 = J.pow(G, Q), M2 = J.mul($, Y2), Z = J.mul(J.mul(M2, gJ), Y2), K = J.mul(M2, J.sub(Z, J.ONE));
2971
2971
  if (!J.eql(J.sqr(K), $))
2972
2972
  throw Error("Cannot find square root");
2973
2973
  return K;
2974
2974
  }
2975
- function xQ(J) {
2975
+ function kQ(J) {
2976
2976
  if (J < BigInt(3))
2977
2977
  throw Error("sqrt is not defined for small field");
2978
2978
  let $ = J - n2, Q = 0;
2979
- while ($ % vJ === t2)
2980
- $ /= vJ, Q++;
2981
- let G = vJ, Y2 = P$(J);
2982
- while (P0(Y2, G) === 1)
2979
+ while ($ % gJ === t2)
2980
+ $ /= gJ, Q++;
2981
+ let G = gJ, Y2 = P$(J);
2982
+ while (R0(Y2, G) === 1)
2983
2983
  if (G++ > 1000)
2984
2984
  throw Error("Cannot find square root: probably non-prime P");
2985
2985
  if (Q === 1)
2986
- return H0;
2987
- let M2 = Y2.pow(G, $), Z = ($ + n2) / vJ;
2986
+ return B0;
2987
+ let M2 = Y2.pow(G, $), Z = ($ + n2) / gJ;
2988
2988
  return function(X2, q) {
2989
2989
  if (X2.is0(q))
2990
2990
  return q;
2991
- if (P0(X2, q) !== 1)
2991
+ if (R0(X2, q) !== 1)
2992
2992
  throw Error("Cannot find square root");
2993
2993
  let U2 = Q, j = X2.mul(X2.ONE, M2), z2 = X2.pow(q, $), V2 = X2.pow(q, Z);
2994
2994
  while (!X2.eql(z2, X2.ONE)) {
@@ -3004,21 +3004,21 @@ function xQ(J) {
3004
3004
  return V2;
3005
3005
  };
3006
3006
  }
3007
- function bQ(J) {
3008
- if (J % C0 === wQ)
3009
- return H0;
3010
- if (J % L0 === B0)
3011
- return kQ;
3012
- return xQ(J);
3007
+ function xQ(J) {
3008
+ if (J % P0 === yQ)
3009
+ return B0;
3010
+ if (J % L0 === C0)
3011
+ return wQ;
3012
+ return kQ(J);
3013
3013
  }
3014
3014
  var FQ = ["create", "isValid", "is0", "neg", "inv", "sqrt", "sqr", "eql", "add", "sub", "mul", "pow", "div", "addN", "subN", "mulN", "sqrN"];
3015
3015
  function I8(J) {
3016
3016
  let $ = { ORDER: "bigint", MASK: "bigint", BYTES: "isSafeInteger", BITS: "isSafeInteger" }, Q = FQ.reduce((G, Y2) => {
3017
3017
  return G[Y2] = "function", G;
3018
3018
  }, $);
3019
- return gJ(J, Q);
3019
+ return fJ(J, Q);
3020
3020
  }
3021
- function fQ(J, $, Q) {
3021
+ function bQ(J, $, Q) {
3022
3022
  if (Q < t2)
3023
3023
  throw Error("invalid exponent, negatives unsupported");
3024
3024
  if (Q === t2)
@@ -3033,7 +3033,7 @@ function fQ(J, $, Q) {
3033
3033
  }
3034
3034
  return G;
3035
3035
  }
3036
- function R8(J, $, Q = false) {
3036
+ function T8(J, $, Q = false) {
3037
3037
  let G = Array($.length).fill(Q ? J.ZERO : undefined), Y2 = $.reduce((Z, K, X2) => {
3038
3038
  if (J.is0(K))
3039
3039
  return Z;
@@ -3045,13 +3045,13 @@ function R8(J, $, Q = false) {
3045
3045
  return G[X2] = J.mul(Z, G[X2]), J.mul(Z, K);
3046
3046
  }, M2), G;
3047
3047
  }
3048
- function P0(J, $) {
3049
- let Q = (J.ORDER - n2) / vJ, G = J.pow($, Q), Y2 = J.eql(G, J.ONE), M2 = J.eql(G, J.ZERO), Z = J.eql(G, J.neg(J.ONE));
3048
+ function R0(J, $) {
3049
+ let Q = (J.ORDER - n2) / gJ, G = J.pow($, Q), Y2 = J.eql(G, J.ONE), M2 = J.eql(G, J.ZERO), Z = J.eql(G, J.neg(J.ONE));
3050
3050
  if (!Y2 && !M2 && !Z)
3051
3051
  throw Error("invalid Legendre symbol result");
3052
3052
  return Y2 ? 1 : M2 ? 0 : -1;
3053
3053
  }
3054
- function T8(J, $) {
3054
+ function R8(J, $) {
3055
3055
  if ($ !== undefined)
3056
3056
  g$($);
3057
3057
  let Q = $ !== undefined ? $ : J.toString(2).length, G = Math.ceil(Q / 8);
@@ -3060,43 +3060,43 @@ function T8(J, $) {
3060
3060
  function P$(J, $, Q = false, G = {}) {
3061
3061
  if (J <= t2)
3062
3062
  throw Error("invalid field: expected ORDER > 0, got " + J);
3063
- let { nBitLength: Y2, nByteLength: M2 } = T8(J, $);
3063
+ let { nBitLength: Y2, nByteLength: M2 } = R8(J, $);
3064
3064
  if (M2 > 2048)
3065
3065
  throw Error("invalid field: expected ORDER of <= 2048 bytes");
3066
- let Z, K = Object.freeze({ ORDER: J, isLE: Q, BITS: Y2, BYTES: M2, MASK: fJ(Y2), ZERO: t2, ONE: n2, create: (X2) => d2(X2, J), isValid: (X2) => {
3066
+ let Z, K = Object.freeze({ ORDER: J, isLE: Q, BITS: Y2, BYTES: M2, MASK: bJ(Y2), ZERO: t2, ONE: n2, create: (X2) => d2(X2, J), isValid: (X2) => {
3067
3067
  if (typeof X2 !== "bigint")
3068
3068
  throw Error("invalid field element: expected bigint, got " + typeof X2);
3069
3069
  return t2 <= X2 && X2 < J;
3070
- }, is0: (X2) => X2 === t2, isOdd: (X2) => (X2 & n2) === n2, neg: (X2) => d2(-X2, J), eql: (X2, q) => X2 === q, sqr: (X2) => d2(X2 * X2, J), add: (X2, q) => d2(X2 + q, J), sub: (X2, q) => d2(X2 - q, J), mul: (X2, q) => d2(X2 * q, J), pow: (X2, q) => fQ(K, X2, q), div: (X2, q) => d2(X2 * m$(q, J), J), sqrN: (X2) => X2 * X2, addN: (X2, q) => X2 + q, subN: (X2, q) => X2 - q, mulN: (X2, q) => X2 * q, inv: (X2) => m$(X2, J), sqrt: G.sqrt || ((X2) => {
3070
+ }, is0: (X2) => X2 === t2, isOdd: (X2) => (X2 & n2) === n2, neg: (X2) => d2(-X2, J), eql: (X2, q) => X2 === q, sqr: (X2) => d2(X2 * X2, J), add: (X2, q) => d2(X2 + q, J), sub: (X2, q) => d2(X2 - q, J), mul: (X2, q) => d2(X2 * q, J), pow: (X2, q) => bQ(K, X2, q), div: (X2, q) => d2(X2 * m$(q, J), J), sqrN: (X2) => X2 * X2, addN: (X2, q) => X2 + q, subN: (X2, q) => X2 - q, mulN: (X2, q) => X2 * q, inv: (X2) => m$(X2, J), sqrt: G.sqrt || ((X2) => {
3071
3071
  if (!Z)
3072
- Z = bQ(J);
3072
+ Z = xQ(J);
3073
3073
  return Z(K, X2);
3074
- }), toBytes: (X2) => Q ? D8(X2, M2) : bJ(X2, M2), fromBytes: (X2) => {
3074
+ }), toBytes: (X2) => Q ? D8(X2, M2) : xJ(X2, M2), fromBytes: (X2) => {
3075
3075
  if (X2.length !== M2)
3076
3076
  throw Error("Field.fromBytes: expected " + M2 + " bytes, got " + X2.length);
3077
3077
  return Q ? z8(X2) : WJ(X2);
3078
- }, invertBatch: (X2) => R8(K, X2), cmov: (X2, q, U2) => U2 ? q : X2 });
3078
+ }, invertBatch: (X2) => T8(K, X2), cmov: (X2, q, U2) => U2 ? q : X2 });
3079
3079
  return Object.freeze(K);
3080
3080
  }
3081
- function S0(J) {
3081
+ function H0(J) {
3082
3082
  if (typeof J !== "bigint")
3083
3083
  throw Error("field order must be bigint");
3084
3084
  let $ = J.toString(2).length;
3085
3085
  return Math.ceil($ / 8);
3086
3086
  }
3087
3087
  function P8(J) {
3088
- let $ = S0(J);
3088
+ let $ = H0(J);
3089
3089
  return $ + Math.ceil($ / 2);
3090
3090
  }
3091
- function _0(J, $, Q = false) {
3092
- let G = J.length, Y2 = S0($), M2 = P8($);
3091
+ function S0(J, $, Q = false) {
3092
+ let G = J.length, Y2 = H0($), M2 = P8($);
3093
3093
  if (G < 16 || G < M2 || G > 1024)
3094
3094
  throw Error("expected " + M2 + "-1024 bytes of input, got " + G);
3095
3095
  let Z = Q ? z8(J) : WJ(J), K = d2(Z, $ - n2) + n2;
3096
- return Q ? D8(K, Y2) : bJ(K, Y2);
3096
+ return Q ? D8(K, Y2) : xJ(K, Y2);
3097
3097
  }
3098
3098
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3099
- var A0 = BigInt(0);
3099
+ var _0 = BigInt(0);
3100
3100
  var S8 = BigInt(1);
3101
3101
  function C8(J, $) {
3102
3102
  let Q = $.negate();
@@ -3106,19 +3106,19 @@ function E0(J, $) {
3106
3106
  if (!Number.isSafeInteger(J) || J <= 0 || J > $)
3107
3107
  throw Error("invalid window size, expected [1.." + $ + "], got W=" + J);
3108
3108
  }
3109
- function B8(J, $) {
3109
+ function L8(J, $) {
3110
3110
  E0(J, $);
3111
- let Q = Math.ceil($ / J) + 1, G = 2 ** (J - 1), Y2 = 2 ** J, M2 = fJ(J), Z = BigInt(J);
3111
+ let Q = Math.ceil($ / J) + 1, G = 2 ** (J - 1), Y2 = 2 ** J, M2 = bJ(J), Z = BigInt(J);
3112
3112
  return { windows: Q, windowSize: G, mask: M2, maxNumber: Y2, shiftBy: Z };
3113
3113
  }
3114
- function y0(J, $, Q) {
3114
+ function A0(J, $, Q) {
3115
3115
  let { windowSize: G, mask: Y2, maxNumber: M2, shiftBy: Z } = Q, K = Number(J & Y2), X2 = J >> Z;
3116
3116
  if (K > G)
3117
3117
  K -= M2, X2 += S8;
3118
3118
  let q = $ * G, U2 = q + Math.abs(K) - 1, j = K === 0, z2 = K < 0, V2 = $ % 2 !== 0;
3119
3119
  return { nextN: X2, offset: U2, isZero: j, isNeg: z2, isNegF: V2, offsetF: q };
3120
3120
  }
3121
- function gQ(J, $) {
3121
+ function fQ(J, $) {
3122
3122
  if (!Array.isArray(J))
3123
3123
  throw Error("array expected");
3124
3124
  J.forEach((Q, G) => {
@@ -3126,7 +3126,7 @@ function gQ(J, $) {
3126
3126
  throw Error("invalid point at index " + G);
3127
3127
  });
3128
3128
  }
3129
- function vQ(J, $) {
3129
+ function gQ(J, $) {
3130
3130
  if (!Array.isArray(J))
3131
3131
  throw Error("array of scalars expected");
3132
3132
  J.forEach((Q, G) => {
@@ -3134,24 +3134,24 @@ function vQ(J, $) {
3134
3134
  throw Error("invalid scalar at index " + G);
3135
3135
  });
3136
3136
  }
3137
- var L8 = new WeakMap;
3138
- var w0 = new WeakMap;
3137
+ var B8 = new WeakMap;
3138
+ var y0 = new WeakMap;
3139
3139
  function H8(J) {
3140
- return w0.get(J) || 1;
3140
+ return y0.get(J) || 1;
3141
3141
  }
3142
- function k0(J, $) {
3142
+ function w0(J, $) {
3143
3143
  return { constTimeNegate: C8, hasPrecomputes(Q) {
3144
3144
  return H8(Q) !== 1;
3145
3145
  }, unsafeLadder(Q, G, Y2 = J.ZERO) {
3146
3146
  let M2 = Q;
3147
- while (G > A0) {
3147
+ while (G > _0) {
3148
3148
  if (G & S8)
3149
3149
  Y2 = Y2.add(M2);
3150
3150
  M2 = M2.double(), G >>= S8;
3151
3151
  }
3152
3152
  return Y2;
3153
3153
  }, precomputeWindow(Q, G) {
3154
- let { windows: Y2, windowSize: M2 } = B8(G, $), Z = [], K = Q, X2 = K;
3154
+ let { windows: Y2, windowSize: M2 } = L8(G, $), Z = [], K = Q, X2 = K;
3155
3155
  for (let q = 0;q < Y2; q++) {
3156
3156
  X2 = K, Z.push(X2);
3157
3157
  for (let U2 = 1;U2 < M2; U2++)
@@ -3160,9 +3160,9 @@ function k0(J, $) {
3160
3160
  }
3161
3161
  return Z;
3162
3162
  }, wNAF(Q, G, Y2) {
3163
- let { ZERO: M2, BASE: Z } = J, K = B8(Q, $);
3163
+ let { ZERO: M2, BASE: Z } = J, K = L8(Q, $);
3164
3164
  for (let X2 = 0;X2 < K.windows; X2++) {
3165
- let { nextN: q, offset: U2, isZero: j, isNeg: z2, isNegF: V2, offsetF: C3 } = y0(Y2, X2, K);
3165
+ let { nextN: q, offset: U2, isZero: j, isNeg: z2, isNegF: V2, offsetF: C3 } = A0(Y2, X2, K);
3166
3166
  if (Y2 = q, j)
3167
3167
  Z = Z.add(C8(V2, G[C3]));
3168
3168
  else
@@ -3170,11 +3170,11 @@ function k0(J, $) {
3170
3170
  }
3171
3171
  return { p: M2, f: Z };
3172
3172
  }, wNAFUnsafe(Q, G, Y2, M2 = J.ZERO) {
3173
- let Z = B8(Q, $);
3173
+ let Z = L8(Q, $);
3174
3174
  for (let K = 0;K < Z.windows; K++) {
3175
- if (Y2 === A0)
3175
+ if (Y2 === _0)
3176
3176
  break;
3177
- let { nextN: X2, offset: q, isZero: U2, isNeg: j } = y0(Y2, K, Z);
3177
+ let { nextN: X2, offset: q, isZero: U2, isNeg: j } = A0(Y2, K, Z);
3178
3178
  if (Y2 = X2, U2)
3179
3179
  continue;
3180
3180
  else {
@@ -3184,10 +3184,10 @@ function k0(J, $) {
3184
3184
  }
3185
3185
  return M2;
3186
3186
  }, getPrecomputes(Q, G, Y2) {
3187
- let M2 = L8.get(G);
3187
+ let M2 = B8.get(G);
3188
3188
  if (!M2) {
3189
3189
  if (M2 = this.precomputeWindow(G, Q), Q !== 1)
3190
- L8.set(G, Y2(M2));
3190
+ B8.set(G, Y2(M2));
3191
3191
  }
3192
3192
  return M2;
3193
3193
  }, wNAFCached(Q, G, Y2) {
@@ -3199,22 +3199,22 @@ function k0(J, $) {
3199
3199
  return this.unsafeLadder(Q, G, M2);
3200
3200
  return this.wNAFUnsafe(Z, this.getPrecomputes(Z, Q, Y2), G, M2);
3201
3201
  }, setWindowSize(Q, G) {
3202
- E0(G, $), w0.set(Q, G), L8.delete(Q);
3202
+ E0(G, $), y0.set(Q, G), B8.delete(Q);
3203
3203
  } };
3204
3204
  }
3205
- function x0(J, $, Q, G) {
3206
- gQ(Q, J), vQ(G, $);
3205
+ function k0(J, $, Q, G) {
3206
+ fQ(Q, J), gQ(G, $);
3207
3207
  let Y2 = Q.length, M2 = G.length;
3208
3208
  if (Y2 !== M2)
3209
3209
  throw Error("arrays of points and scalars must have equal length");
3210
- let Z = J.ZERO, K = R0(BigInt(Y2)), X2 = 1;
3210
+ let Z = J.ZERO, K = I0(BigInt(Y2)), X2 = 1;
3211
3211
  if (K > 12)
3212
3212
  X2 = K - 3;
3213
3213
  else if (K > 4)
3214
3214
  X2 = K - 2;
3215
3215
  else if (K > 0)
3216
3216
  X2 = 2;
3217
- let q = fJ(X2), U2 = Array(Number(q) + 1).fill(Z), j = Math.floor(($.BITS - 1) / X2) * X2, z2 = Z;
3217
+ let q = bJ(X2), U2 = Array(Number(q) + 1).fill(Z), j = Math.floor(($.BITS - 1) / X2) * X2, z2 = Z;
3218
3218
  for (let V2 = j;V2 >= 0; V2 -= X2) {
3219
3219
  U2.fill(Z);
3220
3220
  for (let D3 = 0;D3 < M2; D3++) {
@@ -3231,18 +3231,18 @@ function x0(J, $, Q, G) {
3231
3231
  return z2;
3232
3232
  }
3233
3233
  function _8(J) {
3234
- return I8(J.Fp), gJ(J, { n: "bigint", h: "bigint", Gx: "field", Gy: "field" }, { nBitLength: "isSafeInteger", nByteLength: "isSafeInteger" }), Object.freeze({ ...T8(J.n, J.nBitLength), ...J, ...{ p: J.Fp.ORDER } });
3234
+ return I8(J.Fp), fJ(J, { n: "bigint", h: "bigint", Gx: "field", Gy: "field" }, { nBitLength: "isSafeInteger", nByteLength: "isSafeInteger" }), Object.freeze({ ...R8(J.n, J.nBitLength), ...J, ...{ p: J.Fp.ORDER } });
3235
3235
  }
3236
3236
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3237
- function b0(J) {
3237
+ function x0(J) {
3238
3238
  if (J.lowS !== undefined)
3239
- sJ("lowS", J.lowS);
3239
+ aJ("lowS", J.lowS);
3240
3240
  if (J.prehash !== undefined)
3241
- sJ("prehash", J.prehash);
3241
+ aJ("prehash", J.prehash);
3242
3242
  }
3243
- function uQ(J) {
3243
+ function vQ(J) {
3244
3244
  let $ = _8(J);
3245
- gJ($, { a: "field", b: "field" }, { allowInfinityPoint: "boolean", allowedPrivateKeyLengths: "array", clearCofactor: "function", fromBytes: "function", isTorsionFree: "function", toBytes: "function", wrapPrivateKey: "boolean" });
3245
+ fJ($, { a: "field", b: "field" }, { allowInfinityPoint: "boolean", allowedPrivateKeyLengths: "array", clearCofactor: "function", fromBytes: "function", isTorsionFree: "function", toBytes: "function", wrapPrivateKey: "boolean" });
3246
3246
  let { endo: Q, Fp: G, a: Y2 } = $;
3247
3247
  if (Q) {
3248
3248
  if (!G.eql(Y2, G.ZERO))
@@ -3328,51 +3328,51 @@ var NJ = { Err: F0, _tlv: { encode: (J, $) => {
3328
3328
  return $.encode(48, M2);
3329
3329
  } };
3330
3330
  function A8(J, $) {
3331
- return rJ(bJ(J, $));
3331
+ return sJ(xJ(J, $));
3332
3332
  }
3333
3333
  var OJ = BigInt(0);
3334
3334
  var l3 = BigInt(1);
3335
3335
  var a9 = BigInt(2);
3336
- var y8 = BigInt(3);
3337
- var mQ = BigInt(4);
3338
- function hQ(J) {
3339
- let $ = uQ(J), { Fp: Q } = $, G = P$($.n, $.nBitLength), Y2 = $.toBytes || ((W2, N3, T2) => {
3336
+ var E8 = BigInt(3);
3337
+ var uQ = BigInt(4);
3338
+ function mQ(J) {
3339
+ let $ = vQ(J), { Fp: Q } = $, G = P$($.n, $.nBitLength), Y2 = $.toBytes || ((W2, N3, R3) => {
3340
3340
  let P3 = N3.toAffine();
3341
- return T$(Uint8Array.from([4]), Q.toBytes(P3.x), Q.toBytes(P3.y));
3341
+ return R$(Uint8Array.from([4]), Q.toBytes(P3.x), Q.toBytes(P3.y));
3342
3342
  }), M2 = $.fromBytes || ((W2) => {
3343
- let N3 = W2.subarray(1), T2 = Q.fromBytes(N3.subarray(0, Q.BYTES)), P3 = Q.fromBytes(N3.subarray(Q.BYTES, 2 * Q.BYTES));
3344
- return { x: T2, y: P3 };
3343
+ let N3 = W2.subarray(1), R3 = Q.fromBytes(N3.subarray(0, Q.BYTES)), P3 = Q.fromBytes(N3.subarray(Q.BYTES, 2 * Q.BYTES));
3344
+ return { x: R3, y: P3 };
3345
3345
  });
3346
3346
  function Z(W2) {
3347
- let { a: N3, b: T2 } = $, P3 = Q.sqr(W2), w3 = Q.mul(P3, W2);
3348
- return Q.add(Q.add(w3, Q.mul(W2, N3)), T2);
3347
+ let { a: N3, b: R3 } = $, P3 = Q.sqr(W2), w3 = Q.mul(P3, W2);
3348
+ return Q.add(Q.add(w3, Q.mul(W2, N3)), R3);
3349
3349
  }
3350
3350
  function K(W2, N3) {
3351
- let T2 = Q.sqr(N3), P3 = Z(W2);
3352
- return Q.eql(T2, P3);
3351
+ let R3 = Q.sqr(N3), P3 = Z(W2);
3352
+ return Q.eql(R3, P3);
3353
3353
  }
3354
3354
  if (!K($.Gx, $.Gy))
3355
3355
  throw Error("bad curve params: generator point");
3356
- let X2 = Q.mul(Q.pow($.a, y8), mQ), q = Q.mul(Q.sqr($.b), BigInt(27));
3356
+ let X2 = Q.mul(Q.pow($.a, E8), uQ), q = Q.mul(Q.sqr($.b), BigInt(27));
3357
3357
  if (Q.is0(Q.add(X2, q)))
3358
3358
  throw Error("bad curve params: a or b");
3359
3359
  function U2(W2) {
3360
3360
  return u$(W2, l3, $.n);
3361
3361
  }
3362
3362
  function j(W2) {
3363
- let { allowedPrivateKeyLengths: N3, nByteLength: T2, wrapPrivateKey: P3, n: w3 } = $;
3363
+ let { allowedPrivateKeyLengths: N3, nByteLength: R3, wrapPrivateKey: P3, n: w3 } = $;
3364
3364
  if (N3 && typeof W2 !== "bigint") {
3365
- if (aJ(W2))
3366
- W2 = rJ(W2);
3365
+ if (oJ(W2))
3366
+ W2 = sJ(W2);
3367
3367
  if (typeof W2 !== "string" || !N3.includes(W2.length))
3368
3368
  throw Error("invalid private key");
3369
- W2 = W2.padStart(T2 * 2, "0");
3369
+ W2 = W2.padStart(R3 * 2, "0");
3370
3370
  }
3371
3371
  let k2;
3372
3372
  try {
3373
- k2 = typeof W2 === "bigint" ? W2 : WJ(s2("private key", W2, T2));
3373
+ k2 = typeof W2 === "bigint" ? W2 : WJ(s2("private key", W2, R3));
3374
3374
  } catch (x3) {
3375
- throw Error("invalid private key, expected hex or " + T2 + " bytes, got " + typeof W2);
3375
+ throw Error("invalid private key, expected hex or " + R3 + " bytes, got " + typeof W2);
3376
3376
  }
3377
3377
  if (P3)
3378
3378
  k2 = d2(k2, w3);
@@ -3383,16 +3383,16 @@ function hQ(J) {
3383
3383
  throw Error("ProjectivePoint expected");
3384
3384
  }
3385
3385
  let V2 = V8((W2, N3) => {
3386
- let { px: T2, py: P3, pz: w3 } = W2;
3386
+ let { px: R3, py: P3, pz: w3 } = W2;
3387
3387
  if (Q.eql(w3, Q.ONE))
3388
- return { x: T2, y: P3 };
3388
+ return { x: R3, y: P3 };
3389
3389
  let k2 = W2.is0();
3390
3390
  if (N3 == null)
3391
3391
  N3 = k2 ? Q.ONE : Q.inv(w3);
3392
- let x3 = Q.mul(T2, N3), S3 = Q.mul(P3, N3), y3 = Q.mul(w3, N3);
3392
+ let x3 = Q.mul(R3, N3), S3 = Q.mul(P3, N3), E3 = Q.mul(w3, N3);
3393
3393
  if (k2)
3394
3394
  return { x: Q.ZERO, y: Q.ZERO };
3395
- if (!Q.eql(y3, Q.ONE))
3395
+ if (!Q.eql(E3, Q.ONE))
3396
3396
  throw Error("invZ was invalid");
3397
3397
  return { x: x3, y: S3 };
3398
3398
  }), C3 = V8((W2) => {
@@ -3401,10 +3401,10 @@ function hQ(J) {
3401
3401
  return;
3402
3402
  throw Error("bad point: ZERO");
3403
3403
  }
3404
- let { x: N3, y: T2 } = W2.toAffine();
3405
- if (!Q.isValid(N3) || !Q.isValid(T2))
3404
+ let { x: N3, y: R3 } = W2.toAffine();
3405
+ if (!Q.isValid(N3) || !Q.isValid(R3))
3406
3406
  throw Error("bad point: x or y not FE");
3407
- if (!K(N3, T2))
3407
+ if (!K(N3, R3))
3408
3408
  throw Error("bad point: equation left != right");
3409
3409
  if (!W2.isTorsionFree())
3410
3410
  throw Error("bad point: not in prime-order subgroup");
@@ -3412,25 +3412,25 @@ function hQ(J) {
3412
3412
  });
3413
3413
 
3414
3414
  class D3 {
3415
- constructor(W2, N3, T2) {
3415
+ constructor(W2, N3, R3) {
3416
3416
  if (W2 == null || !Q.isValid(W2))
3417
3417
  throw Error("x required");
3418
3418
  if (N3 == null || !Q.isValid(N3) || Q.is0(N3))
3419
3419
  throw Error("y required");
3420
- if (T2 == null || !Q.isValid(T2))
3420
+ if (R3 == null || !Q.isValid(R3))
3421
3421
  throw Error("z required");
3422
- this.px = W2, this.py = N3, this.pz = T2, Object.freeze(this);
3422
+ this.px = W2, this.py = N3, this.pz = R3, Object.freeze(this);
3423
3423
  }
3424
3424
  static fromAffine(W2) {
3425
- let { x: N3, y: T2 } = W2 || {};
3426
- if (!W2 || !Q.isValid(N3) || !Q.isValid(T2))
3425
+ let { x: N3, y: R3 } = W2 || {};
3426
+ if (!W2 || !Q.isValid(N3) || !Q.isValid(R3))
3427
3427
  throw Error("invalid affine point");
3428
3428
  if (W2 instanceof D3)
3429
3429
  throw Error("projective point not allowed");
3430
3430
  let P3 = (w3) => Q.eql(w3, Q.ZERO);
3431
- if (P3(N3) && P3(T2))
3431
+ if (P3(N3) && P3(R3))
3432
3432
  return D3.ZERO;
3433
- return new D3(N3, T2, Q.ONE);
3433
+ return new D3(N3, R3, Q.ONE);
3434
3434
  }
3435
3435
  get x() {
3436
3436
  return this.toAffine().x;
@@ -3439,8 +3439,8 @@ function hQ(J) {
3439
3439
  return this.toAffine().y;
3440
3440
  }
3441
3441
  static normalizeZ(W2) {
3442
- let N3 = R8(Q, W2.map((T2) => T2.pz));
3443
- return W2.map((T2, P3) => T2.toAffine(N3[P3])).map(D3.fromAffine);
3442
+ let N3 = T8(Q, W2.map((R3) => R3.pz));
3443
+ return W2.map((R3, P3) => R3.toAffine(N3[P3])).map(D3.fromAffine);
3444
3444
  }
3445
3445
  static fromHex(W2) {
3446
3446
  let N3 = D3.fromAffine(M2(s2("pointHex", W2)));
@@ -3450,10 +3450,10 @@ function hQ(J) {
3450
3450
  return D3.BASE.multiply(j(W2));
3451
3451
  }
3452
3452
  static msm(W2, N3) {
3453
- return x0(D3, G, W2, N3);
3453
+ return k0(D3, G, W2, N3);
3454
3454
  }
3455
3455
  _setWindowSize(W2) {
3456
- F2.setWindowSize(this, W2);
3456
+ b3.setWindowSize(this, W2);
3457
3457
  }
3458
3458
  assertValidity() {
3459
3459
  C3(this);
@@ -3466,22 +3466,22 @@ function hQ(J) {
3466
3466
  }
3467
3467
  equals(W2) {
3468
3468
  z2(W2);
3469
- let { px: N3, py: T2, pz: P3 } = this, { px: w3, py: k2, pz: x3 } = W2, S3 = Q.eql(Q.mul(N3, x3), Q.mul(w3, P3)), y3 = Q.eql(Q.mul(T2, x3), Q.mul(k2, P3));
3470
- return S3 && y3;
3469
+ let { px: N3, py: R3, pz: P3 } = this, { px: w3, py: k2, pz: x3 } = W2, S3 = Q.eql(Q.mul(N3, x3), Q.mul(w3, P3)), E3 = Q.eql(Q.mul(R3, x3), Q.mul(k2, P3));
3470
+ return S3 && E3;
3471
3471
  }
3472
3472
  negate() {
3473
3473
  return new D3(this.px, Q.neg(this.py), this.pz);
3474
3474
  }
3475
3475
  double() {
3476
- let { a: W2, b: N3 } = $, T2 = Q.mul(N3, y8), { px: P3, py: w3, pz: k2 } = this, x3 = Q.ZERO, S3 = Q.ZERO, y3 = Q.ZERO, _2 = Q.mul(P3, P3), c3 = Q.mul(w3, w3), u2 = Q.mul(k2, k2), O3 = Q.mul(P3, w3);
3477
- return O3 = Q.add(O3, O3), y3 = Q.mul(P3, k2), y3 = Q.add(y3, y3), x3 = Q.mul(W2, y3), S3 = Q.mul(T2, u2), S3 = Q.add(x3, S3), x3 = Q.sub(c3, S3), S3 = Q.add(c3, S3), S3 = Q.mul(x3, S3), x3 = Q.mul(O3, x3), y3 = Q.mul(T2, y3), u2 = Q.mul(W2, u2), O3 = Q.sub(_2, u2), O3 = Q.mul(W2, O3), O3 = Q.add(O3, y3), y3 = Q.add(_2, _2), _2 = Q.add(y3, _2), _2 = Q.add(_2, u2), _2 = Q.mul(_2, O3), S3 = Q.add(S3, _2), u2 = Q.mul(w3, k2), u2 = Q.add(u2, u2), _2 = Q.mul(u2, O3), x3 = Q.sub(x3, _2), y3 = Q.mul(u2, c3), y3 = Q.add(y3, y3), y3 = Q.add(y3, y3), new D3(x3, S3, y3);
3476
+ let { a: W2, b: N3 } = $, R3 = Q.mul(N3, E8), { px: P3, py: w3, pz: k2 } = this, x3 = Q.ZERO, S3 = Q.ZERO, E3 = Q.ZERO, _2 = Q.mul(P3, P3), c3 = Q.mul(w3, w3), u2 = Q.mul(k2, k2), O3 = Q.mul(P3, w3);
3477
+ return O3 = Q.add(O3, O3), E3 = Q.mul(P3, k2), E3 = Q.add(E3, E3), x3 = Q.mul(W2, E3), S3 = Q.mul(R3, u2), S3 = Q.add(x3, S3), x3 = Q.sub(c3, S3), S3 = Q.add(c3, S3), S3 = Q.mul(x3, S3), x3 = Q.mul(O3, x3), E3 = Q.mul(R3, E3), u2 = Q.mul(W2, u2), O3 = Q.sub(_2, u2), O3 = Q.mul(W2, O3), O3 = Q.add(O3, E3), E3 = Q.add(_2, _2), _2 = Q.add(E3, _2), _2 = Q.add(_2, u2), _2 = Q.mul(_2, O3), S3 = Q.add(S3, _2), u2 = Q.mul(w3, k2), u2 = Q.add(u2, u2), _2 = Q.mul(u2, O3), x3 = Q.sub(x3, _2), E3 = Q.mul(u2, c3), E3 = Q.add(E3, E3), E3 = Q.add(E3, E3), new D3(x3, S3, E3);
3478
3478
  }
3479
3479
  add(W2) {
3480
3480
  z2(W2);
3481
- let { px: N3, py: T2, pz: P3 } = this, { px: w3, py: k2, pz: x3 } = W2, S3 = Q.ZERO, y3 = Q.ZERO, _2 = Q.ZERO, c3 = $.a, u2 = Q.mul($.b, y8), O3 = Q.mul(N3, w3), R3 = Q.mul(T2, k2), B3 = Q.mul(P3, x3), b3 = Q.add(N3, T2), L2 = Q.add(w3, k2);
3482
- b3 = Q.mul(b3, L2), L2 = Q.add(O3, R3), b3 = Q.sub(b3, L2), L2 = Q.add(N3, P3);
3483
- let E3 = Q.add(w3, x3);
3484
- return L2 = Q.mul(L2, E3), E3 = Q.add(O3, B3), L2 = Q.sub(L2, E3), E3 = Q.add(T2, P3), S3 = Q.add(k2, x3), E3 = Q.mul(E3, S3), S3 = Q.add(R3, B3), E3 = Q.sub(E3, S3), _2 = Q.mul(c3, L2), S3 = Q.mul(u2, B3), _2 = Q.add(S3, _2), S3 = Q.sub(R3, _2), _2 = Q.add(R3, _2), y3 = Q.mul(S3, _2), R3 = Q.add(O3, O3), R3 = Q.add(R3, O3), B3 = Q.mul(c3, B3), L2 = Q.mul(u2, L2), R3 = Q.add(R3, B3), B3 = Q.sub(O3, B3), B3 = Q.mul(c3, B3), L2 = Q.add(L2, B3), O3 = Q.mul(R3, L2), y3 = Q.add(y3, O3), O3 = Q.mul(E3, L2), S3 = Q.mul(b3, S3), S3 = Q.sub(S3, O3), O3 = Q.mul(b3, R3), _2 = Q.mul(E3, _2), _2 = Q.add(_2, O3), new D3(S3, y3, _2);
3481
+ let { px: N3, py: R3, pz: P3 } = this, { px: w3, py: k2, pz: x3 } = W2, S3 = Q.ZERO, E3 = Q.ZERO, _2 = Q.ZERO, c3 = $.a, u2 = Q.mul($.b, E8), O3 = Q.mul(N3, w3), T2 = Q.mul(R3, k2), L2 = Q.mul(P3, x3), F2 = Q.add(N3, R3), B3 = Q.add(w3, k2);
3482
+ F2 = Q.mul(F2, B3), B3 = Q.add(O3, T2), F2 = Q.sub(F2, B3), B3 = Q.add(N3, P3);
3483
+ let y3 = Q.add(w3, x3);
3484
+ return B3 = Q.mul(B3, y3), y3 = Q.add(O3, L2), B3 = Q.sub(B3, y3), y3 = Q.add(R3, P3), S3 = Q.add(k2, x3), y3 = Q.mul(y3, S3), S3 = Q.add(T2, L2), y3 = Q.sub(y3, S3), _2 = Q.mul(c3, B3), S3 = Q.mul(u2, L2), _2 = Q.add(S3, _2), S3 = Q.sub(T2, _2), _2 = Q.add(T2, _2), E3 = Q.mul(S3, _2), T2 = Q.add(O3, O3), T2 = Q.add(T2, O3), L2 = Q.mul(c3, L2), B3 = Q.mul(u2, B3), T2 = Q.add(T2, L2), L2 = Q.sub(O3, L2), L2 = Q.mul(c3, L2), B3 = Q.add(B3, L2), O3 = Q.mul(T2, B3), E3 = Q.add(E3, O3), O3 = Q.mul(y3, B3), S3 = Q.mul(F2, S3), S3 = Q.sub(S3, O3), O3 = Q.mul(F2, T2), _2 = Q.mul(y3, _2), _2 = Q.add(_2, O3), new D3(S3, E3, _2);
3485
3485
  }
3486
3486
  subtract(W2) {
3487
3487
  return this.add(W2.negate());
@@ -3490,47 +3490,47 @@ function hQ(J) {
3490
3490
  return this.equals(D3.ZERO);
3491
3491
  }
3492
3492
  wNAF(W2) {
3493
- return F2.wNAFCached(this, W2, D3.normalizeZ);
3493
+ return b3.wNAFCached(this, W2, D3.normalizeZ);
3494
3494
  }
3495
3495
  multiplyUnsafe(W2) {
3496
- let { endo: N3, n: T2 } = $;
3497
- FJ("scalar", W2, OJ, T2);
3496
+ let { endo: N3, n: R3 } = $;
3497
+ FJ("scalar", W2, OJ, R3);
3498
3498
  let P3 = D3.ZERO;
3499
3499
  if (W2 === OJ)
3500
3500
  return P3;
3501
3501
  if (this.is0() || W2 === l3)
3502
3502
  return this;
3503
- if (!N3 || F2.hasPrecomputes(this))
3504
- return F2.wNAFCachedUnsafe(this, W2, D3.normalizeZ);
3505
- let { k1neg: w3, k1: k2, k2neg: x3, k2: S3 } = N3.splitScalar(W2), y3 = P3, _2 = P3, c3 = this;
3503
+ if (!N3 || b3.hasPrecomputes(this))
3504
+ return b3.wNAFCachedUnsafe(this, W2, D3.normalizeZ);
3505
+ let { k1neg: w3, k1: k2, k2neg: x3, k2: S3 } = N3.splitScalar(W2), E3 = P3, _2 = P3, c3 = this;
3506
3506
  while (k2 > OJ || S3 > OJ) {
3507
3507
  if (k2 & l3)
3508
- y3 = y3.add(c3);
3508
+ E3 = E3.add(c3);
3509
3509
  if (S3 & l3)
3510
3510
  _2 = _2.add(c3);
3511
3511
  c3 = c3.double(), k2 >>= l3, S3 >>= l3;
3512
3512
  }
3513
3513
  if (w3)
3514
- y3 = y3.negate();
3514
+ E3 = E3.negate();
3515
3515
  if (x3)
3516
3516
  _2 = _2.negate();
3517
- return _2 = new D3(Q.mul(_2.px, N3.beta), _2.py, _2.pz), y3.add(_2);
3517
+ return _2 = new D3(Q.mul(_2.px, N3.beta), _2.py, _2.pz), E3.add(_2);
3518
3518
  }
3519
3519
  multiply(W2) {
3520
- let { endo: N3, n: T2 } = $;
3521
- FJ("scalar", W2, l3, T2);
3520
+ let { endo: N3, n: R3 } = $;
3521
+ FJ("scalar", W2, l3, R3);
3522
3522
  let P3, w3;
3523
3523
  if (N3) {
3524
- let { k1neg: k2, k1: x3, k2neg: S3, k2: y3 } = N3.splitScalar(W2), { p: _2, f: c3 } = this.wNAF(x3), { p: u2, f: O3 } = this.wNAF(y3);
3525
- _2 = F2.constTimeNegate(k2, _2), u2 = F2.constTimeNegate(S3, u2), u2 = new D3(Q.mul(u2.px, N3.beta), u2.py, u2.pz), P3 = _2.add(u2), w3 = c3.add(O3);
3524
+ let { k1neg: k2, k1: x3, k2neg: S3, k2: E3 } = N3.splitScalar(W2), { p: _2, f: c3 } = this.wNAF(x3), { p: u2, f: O3 } = this.wNAF(E3);
3525
+ _2 = b3.constTimeNegate(k2, _2), u2 = b3.constTimeNegate(S3, u2), u2 = new D3(Q.mul(u2.px, N3.beta), u2.py, u2.pz), P3 = _2.add(u2), w3 = c3.add(O3);
3526
3526
  } else {
3527
3527
  let { p: k2, f: x3 } = this.wNAF(W2);
3528
3528
  P3 = k2, w3 = x3;
3529
3529
  }
3530
3530
  return D3.normalizeZ([P3, w3])[0];
3531
3531
  }
3532
- multiplyAndAddUnsafe(W2, N3, T2) {
3533
- let P3 = D3.BASE, w3 = (x3, S3) => S3 === OJ || S3 === l3 || !x3.equals(P3) ? x3.multiplyUnsafe(S3) : x3.multiply(S3), k2 = w3(this, N3).add(w3(W2, T2));
3532
+ multiplyAndAddUnsafe(W2, N3, R3) {
3533
+ let P3 = D3.BASE, w3 = (x3, S3) => S3 === OJ || S3 === l3 || !x3.equals(P3) ? x3.multiplyUnsafe(S3) : x3.multiply(S3), k2 = w3(this, N3).add(w3(W2, R3));
3534
3534
  return k2.is0() ? undefined : k2;
3535
3535
  }
3536
3536
  toAffine(W2) {
@@ -3553,94 +3553,94 @@ function hQ(J) {
3553
3553
  return this.multiplyUnsafe($.h);
3554
3554
  }
3555
3555
  toRawBytes(W2 = true) {
3556
- return sJ("isCompressed", W2), this.assertValidity(), Y2(D3, this, W2);
3556
+ return aJ("isCompressed", W2), this.assertValidity(), Y2(D3, this, W2);
3557
3557
  }
3558
3558
  toHex(W2 = true) {
3559
- return sJ("isCompressed", W2), rJ(this.toRawBytes(W2));
3559
+ return aJ("isCompressed", W2), sJ(this.toRawBytes(W2));
3560
3560
  }
3561
3561
  }
3562
3562
  D3.BASE = new D3($.Gx, $.Gy, Q.ONE), D3.ZERO = new D3(Q.ZERO, Q.ONE, Q.ZERO);
3563
- let { endo: f3, nBitLength: A2 } = $, F2 = k0(D3, f3 ? Math.ceil(A2 / 2) : A2);
3563
+ let { endo: f3, nBitLength: A2 } = $, b3 = w0(D3, f3 ? Math.ceil(A2 / 2) : A2);
3564
3564
  return { CURVE: $, ProjectivePoint: D3, normPrivateKeyToScalar: j, weierstrassEquation: Z, isWithinCurveOrder: U2 };
3565
3565
  }
3566
- function lQ(J) {
3566
+ function hQ(J) {
3567
3567
  let $ = _8(J);
3568
- return gJ($, { hash: "hash", hmac: "function", randomBytes: "function" }, { bits2int: "function", bits2int_modN: "function", lowS: "boolean" }), Object.freeze({ lowS: true, ...$ });
3568
+ return fJ($, { hash: "hash", hmac: "function", randomBytes: "function" }, { bits2int: "function", bits2int_modN: "function", lowS: "boolean" }), Object.freeze({ lowS: true, ...$ });
3569
3569
  }
3570
- function f0(J) {
3571
- let $ = lQ(J), { Fp: Q, n: G, nByteLength: Y2, nBitLength: M2 } = $, Z = Q.BYTES + 1, K = 2 * Q.BYTES + 1;
3570
+ function b0(J) {
3571
+ let $ = hQ(J), { Fp: Q, n: G, nByteLength: Y2, nBitLength: M2 } = $, Z = Q.BYTES + 1, K = 2 * Q.BYTES + 1;
3572
3572
  function X2(O3) {
3573
3573
  return d2(O3, G);
3574
3574
  }
3575
3575
  function q(O3) {
3576
3576
  return m$(O3, G);
3577
3577
  }
3578
- let { ProjectivePoint: U2, normPrivateKeyToScalar: j, weierstrassEquation: z2, isWithinCurveOrder: V2 } = hQ({ ...$, toBytes(O3, R3, B3) {
3579
- let b3 = R3.toAffine(), L2 = Q.toBytes(b3.x), E3 = T$;
3580
- if (sJ("isCompressed", B3), B3)
3581
- return E3(Uint8Array.from([R3.hasEvenY() ? 2 : 3]), L2);
3578
+ let { ProjectivePoint: U2, normPrivateKeyToScalar: j, weierstrassEquation: z2, isWithinCurveOrder: V2 } = mQ({ ...$, toBytes(O3, T2, L2) {
3579
+ let F2 = T2.toAffine(), B3 = Q.toBytes(F2.x), y3 = R$;
3580
+ if (aJ("isCompressed", L2), L2)
3581
+ return y3(Uint8Array.from([T2.hasEvenY() ? 2 : 3]), B3);
3582
3582
  else
3583
- return E3(Uint8Array.from([4]), L2, Q.toBytes(b3.y));
3583
+ return y3(Uint8Array.from([4]), B3, Q.toBytes(F2.y));
3584
3584
  }, fromBytes(O3) {
3585
- let R3 = O3.length, B3 = O3[0], b3 = O3.subarray(1);
3586
- if (R3 === Z && (B3 === 2 || B3 === 3)) {
3587
- let L2 = WJ(b3);
3588
- if (!u$(L2, l3, Q.ORDER))
3585
+ let T2 = O3.length, L2 = O3[0], F2 = O3.subarray(1);
3586
+ if (T2 === Z && (L2 === 2 || L2 === 3)) {
3587
+ let B3 = WJ(F2);
3588
+ if (!u$(B3, l3, Q.ORDER))
3589
3589
  throw Error("Point is not on curve");
3590
- let E3 = z2(L2), $J;
3590
+ let y3 = z2(B3), JJ;
3591
3591
  try {
3592
- $J = Q.sqrt(E3);
3592
+ JJ = Q.sqrt(y3);
3593
3593
  } catch (YJ) {
3594
3594
  let a2 = YJ instanceof Error ? ": " + YJ.message : "";
3595
3595
  throw Error("Point is not on curve" + a2);
3596
3596
  }
3597
- let i2 = ($J & l3) === l3;
3598
- if ((B3 & 1) === 1 !== i2)
3599
- $J = Q.neg($J);
3600
- return { x: L2, y: $J };
3601
- } else if (R3 === K && B3 === 4) {
3602
- let L2 = Q.fromBytes(b3.subarray(0, Q.BYTES)), E3 = Q.fromBytes(b3.subarray(Q.BYTES, 2 * Q.BYTES));
3603
- return { x: L2, y: E3 };
3597
+ let i2 = (JJ & l3) === l3;
3598
+ if ((L2 & 1) === 1 !== i2)
3599
+ JJ = Q.neg(JJ);
3600
+ return { x: B3, y: JJ };
3601
+ } else if (T2 === K && L2 === 4) {
3602
+ let B3 = Q.fromBytes(F2.subarray(0, Q.BYTES)), y3 = Q.fromBytes(F2.subarray(Q.BYTES, 2 * Q.BYTES));
3603
+ return { x: B3, y: y3 };
3604
3604
  } else {
3605
- let L2 = Z, E3 = K;
3606
- throw Error("invalid Point, expected length of " + L2 + ", or uncompressed " + E3 + ", got " + R3);
3605
+ let B3 = Z, y3 = K;
3606
+ throw Error("invalid Point, expected length of " + B3 + ", or uncompressed " + y3 + ", got " + T2);
3607
3607
  }
3608
3608
  } });
3609
3609
  function C3(O3) {
3610
- let R3 = G >> l3;
3611
- return O3 > R3;
3610
+ let T2 = G >> l3;
3611
+ return O3 > T2;
3612
3612
  }
3613
3613
  function D3(O3) {
3614
3614
  return C3(O3) ? X2(-O3) : O3;
3615
3615
  }
3616
- let f3 = (O3, R3, B3) => WJ(O3.slice(R3, B3));
3616
+ let f3 = (O3, T2, L2) => WJ(O3.slice(T2, L2));
3617
3617
 
3618
3618
  class A2 {
3619
- constructor(O3, R3, B3) {
3620
- if (FJ("r", O3, l3, G), FJ("s", R3, l3, G), this.r = O3, this.s = R3, B3 != null)
3621
- this.recovery = B3;
3619
+ constructor(O3, T2, L2) {
3620
+ if (FJ("r", O3, l3, G), FJ("s", T2, l3, G), this.r = O3, this.s = T2, L2 != null)
3621
+ this.recovery = L2;
3622
3622
  Object.freeze(this);
3623
3623
  }
3624
3624
  static fromCompact(O3) {
3625
- let R3 = Y2;
3626
- return O3 = s2("compactSignature", O3, R3 * 2), new A2(f3(O3, 0, R3), f3(O3, R3, 2 * R3));
3625
+ let T2 = Y2;
3626
+ return O3 = s2("compactSignature", O3, T2 * 2), new A2(f3(O3, 0, T2), f3(O3, T2, 2 * T2));
3627
3627
  }
3628
3628
  static fromDER(O3) {
3629
- let { r: R3, s: B3 } = NJ.toSig(s2("DER", O3));
3630
- return new A2(R3, B3);
3629
+ let { r: T2, s: L2 } = NJ.toSig(s2("DER", O3));
3630
+ return new A2(T2, L2);
3631
3631
  }
3632
3632
  assertValidity() {}
3633
3633
  addRecoveryBit(O3) {
3634
3634
  return new A2(this.r, this.s, O3);
3635
3635
  }
3636
3636
  recoverPublicKey(O3) {
3637
- let { r: R3, s: B3, recovery: b3 } = this, L2 = w3(s2("msgHash", O3));
3638
- if (b3 == null || ![0, 1, 2, 3].includes(b3))
3637
+ let { r: T2, s: L2, recovery: F2 } = this, B3 = w3(s2("msgHash", O3));
3638
+ if (F2 == null || ![0, 1, 2, 3].includes(F2))
3639
3639
  throw Error("recovery id invalid");
3640
- let E3 = b3 === 2 || b3 === 3 ? R3 + $.n : R3;
3641
- if (E3 >= Q.ORDER)
3640
+ let y3 = F2 === 2 || F2 === 3 ? T2 + $.n : T2;
3641
+ if (y3 >= Q.ORDER)
3642
3642
  throw Error("recovery id 2 or 3 invalid");
3643
- let $J = (b3 & 1) === 0 ? "02" : "03", i2 = U2.fromHex($J + A8(E3, Q.BYTES)), GJ = q(E3), YJ = X2(-L2 * GJ), a2 = X2(B3 * GJ), jJ = U2.BASE.multiplyAndAddUnsafe(i2, YJ, a2);
3643
+ let JJ = (F2 & 1) === 0 ? "02" : "03", i2 = U2.fromHex(JJ + A8(y3, Q.BYTES)), GJ = q(y3), YJ = X2(-B3 * GJ), a2 = X2(L2 * GJ), jJ = U2.BASE.multiplyAndAddUnsafe(i2, YJ, a2);
3644
3644
  if (!jJ)
3645
3645
  throw Error("point at infinify");
3646
3646
  return jJ.assertValidity(), jJ;
@@ -3652,167 +3652,167 @@ function f0(J) {
3652
3652
  return this.hasHighS() ? new A2(this.r, X2(-this.s), this.recovery) : this;
3653
3653
  }
3654
3654
  toDERRawBytes() {
3655
- return R$(this.toDERHex());
3655
+ return T$(this.toDERHex());
3656
3656
  }
3657
3657
  toDERHex() {
3658
3658
  return NJ.hexFromSig(this);
3659
3659
  }
3660
3660
  toCompactRawBytes() {
3661
- return R$(this.toCompactHex());
3661
+ return T$(this.toCompactHex());
3662
3662
  }
3663
3663
  toCompactHex() {
3664
3664
  let O3 = Y2;
3665
3665
  return A8(this.r, O3) + A8(this.s, O3);
3666
3666
  }
3667
3667
  }
3668
- let F2 = { isValidPrivateKey(O3) {
3668
+ let b3 = { isValidPrivateKey(O3) {
3669
3669
  try {
3670
3670
  return j(O3), true;
3671
- } catch (R3) {
3671
+ } catch (T2) {
3672
3672
  return false;
3673
3673
  }
3674
3674
  }, normPrivateKeyToScalar: j, randomPrivateKey: () => {
3675
3675
  let O3 = P8($.n);
3676
- return _0($.randomBytes(O3), $.n);
3677
- }, precompute(O3 = 8, R3 = U2.BASE) {
3678
- return R3._setWindowSize(O3), R3.multiply(BigInt(3)), R3;
3676
+ return S0($.randomBytes(O3), $.n);
3677
+ }, precompute(O3 = 8, T2 = U2.BASE) {
3678
+ return T2._setWindowSize(O3), T2.multiply(BigInt(3)), T2;
3679
3679
  } };
3680
- function W2(O3, R3 = true) {
3681
- return U2.fromPrivateKey(O3).toRawBytes(R3);
3680
+ function W2(O3, T2 = true) {
3681
+ return U2.fromPrivateKey(O3).toRawBytes(T2);
3682
3682
  }
3683
3683
  function N3(O3) {
3684
3684
  if (typeof O3 === "bigint")
3685
3685
  return false;
3686
3686
  if (O3 instanceof U2)
3687
3687
  return true;
3688
- let B3 = s2("key", O3).length, b3 = Q.BYTES, L2 = b3 + 1, E3 = 2 * b3 + 1;
3689
- if ($.allowedPrivateKeyLengths || Y2 === L2)
3688
+ let L2 = s2("key", O3).length, F2 = Q.BYTES, B3 = F2 + 1, y3 = 2 * F2 + 1;
3689
+ if ($.allowedPrivateKeyLengths || Y2 === B3)
3690
3690
  return;
3691
3691
  else
3692
- return B3 === L2 || B3 === E3;
3692
+ return L2 === B3 || L2 === y3;
3693
3693
  }
3694
- function T2(O3, R3, B3 = true) {
3694
+ function R3(O3, T2, L2 = true) {
3695
3695
  if (N3(O3) === true)
3696
3696
  throw Error("first arg must be private key");
3697
- if (N3(R3) === false)
3697
+ if (N3(T2) === false)
3698
3698
  throw Error("second arg must be public key");
3699
- return U2.fromHex(R3).multiply(j(O3)).toRawBytes(B3);
3699
+ return U2.fromHex(T2).multiply(j(O3)).toRawBytes(L2);
3700
3700
  }
3701
3701
  let P3 = $.bits2int || function(O3) {
3702
3702
  if (O3.length > 8192)
3703
3703
  throw Error("input is too large");
3704
- let R3 = WJ(O3), B3 = O3.length * 8 - M2;
3705
- return B3 > 0 ? R3 >> BigInt(B3) : R3;
3704
+ let T2 = WJ(O3), L2 = O3.length * 8 - M2;
3705
+ return L2 > 0 ? T2 >> BigInt(L2) : T2;
3706
3706
  }, w3 = $.bits2int_modN || function(O3) {
3707
3707
  return X2(P3(O3));
3708
- }, k2 = fJ(M2);
3708
+ }, k2 = bJ(M2);
3709
3709
  function x3(O3) {
3710
- return FJ("num < 2^" + M2, O3, OJ, k2), bJ(O3, Y2);
3710
+ return FJ("num < 2^" + M2, O3, OJ, k2), xJ(O3, Y2);
3711
3711
  }
3712
- function S3(O3, R3, B3 = y3) {
3713
- if (["recovered", "canonical"].some((PJ) => (PJ in B3)))
3712
+ function S3(O3, T2, L2 = E3) {
3713
+ if (["recovered", "canonical"].some((PJ) => (PJ in L2)))
3714
3714
  throw Error("sign() legacy options not supported");
3715
- let { hash: b3, randomBytes: L2 } = $, { lowS: E3, prehash: $J, extraEntropy: i2 } = B3;
3716
- if (E3 == null)
3717
- E3 = true;
3718
- if (O3 = s2("msgHash", O3), b0(B3), $J)
3719
- O3 = s2("prehashed msgHash", b3(O3));
3720
- let GJ = w3(O3), YJ = j(R3), a2 = [x3(YJ), x3(GJ)];
3715
+ let { hash: F2, randomBytes: B3 } = $, { lowS: y3, prehash: JJ, extraEntropy: i2 } = L2;
3716
+ if (y3 == null)
3717
+ y3 = true;
3718
+ if (O3 = s2("msgHash", O3), x0(L2), JJ)
3719
+ O3 = s2("prehashed msgHash", F2(O3));
3720
+ let GJ = w3(O3), YJ = j(T2), a2 = [x3(YJ), x3(GJ)];
3721
3721
  if (i2 != null && i2 !== false) {
3722
- let PJ = i2 === true ? L2(Q.BYTES) : i2;
3722
+ let PJ = i2 === true ? B3(Q.BYTES) : i2;
3723
3723
  a2.push(s2("extraEntropy", PJ));
3724
3724
  }
3725
- let jJ = T$(...a2), B$ = GJ;
3725
+ let jJ = R$(...a2), L$ = GJ;
3726
3726
  function c$(PJ) {
3727
- let mJ = P3(PJ);
3728
- if (!V2(mJ))
3727
+ let vJ = P3(PJ);
3728
+ if (!V2(vJ))
3729
3729
  return;
3730
- let p$ = q(mJ), J$ = U2.BASE.multiply(mJ).toAffine(), CJ = X2(J$.x);
3730
+ let p$ = q(vJ), J$ = U2.BASE.multiply(vJ).toAffine(), CJ = X2(J$.x);
3731
3731
  if (CJ === OJ)
3732
3732
  return;
3733
- let $$ = X2(p$ * X2(B$ + CJ * YJ));
3733
+ let $$ = X2(p$ * X2(L$ + CJ * YJ));
3734
3734
  if ($$ === OJ)
3735
3735
  return;
3736
- let hJ = (J$.x === CJ ? 0 : 2) | Number(J$.y & l3), v8 = $$;
3737
- if (E3 && C3($$))
3738
- v8 = D3($$), hJ ^= 1;
3739
- return new A2(CJ, v8, hJ);
3736
+ let uJ = (J$.x === CJ ? 0 : 2) | Number(J$.y & l3), g8 = $$;
3737
+ if (y3 && C3($$))
3738
+ g8 = D3($$), uJ ^= 1;
3739
+ return new A2(CJ, g8, uJ);
3740
3740
  }
3741
3741
  return { seed: jJ, k2sig: c$ };
3742
3742
  }
3743
- let y3 = { lowS: $.lowS, prehash: false }, _2 = { lowS: $.lowS, prehash: false };
3744
- function c3(O3, R3, B3 = y3) {
3745
- let { seed: b3, k2sig: L2 } = S3(O3, R3, B3), E3 = $;
3746
- return T0(E3.hash.outputLen, E3.nByteLength, E3.hmac)(b3, L2);
3743
+ let E3 = { lowS: $.lowS, prehash: false }, _2 = { lowS: $.lowS, prehash: false };
3744
+ function c3(O3, T2, L2 = E3) {
3745
+ let { seed: F2, k2sig: B3 } = S3(O3, T2, L2), y3 = $;
3746
+ return T0(y3.hash.outputLen, y3.nByteLength, y3.hmac)(F2, B3);
3747
3747
  }
3748
3748
  U2.BASE._setWindowSize(8);
3749
- function u2(O3, R3, B3, b3 = _2) {
3750
- let L2 = O3;
3751
- R3 = s2("msgHash", R3), B3 = s2("publicKey", B3);
3752
- let { lowS: E3, prehash: $J, format: i2 } = b3;
3753
- if (b0(b3), "strict" in b3)
3749
+ function u2(O3, T2, L2, F2 = _2) {
3750
+ let B3 = O3;
3751
+ T2 = s2("msgHash", T2), L2 = s2("publicKey", L2);
3752
+ let { lowS: y3, prehash: JJ, format: i2 } = F2;
3753
+ if (x0(F2), "strict" in F2)
3754
3754
  throw Error("options.strict was renamed to lowS");
3755
3755
  if (i2 !== undefined && i2 !== "compact" && i2 !== "der")
3756
3756
  throw Error("format must be compact or der");
3757
- let GJ = typeof L2 === "string" || aJ(L2), YJ = !GJ && !i2 && typeof L2 === "object" && L2 !== null && typeof L2.r === "bigint" && typeof L2.s === "bigint";
3757
+ let GJ = typeof B3 === "string" || oJ(B3), YJ = !GJ && !i2 && typeof B3 === "object" && B3 !== null && typeof B3.r === "bigint" && typeof B3.s === "bigint";
3758
3758
  if (!GJ && !YJ)
3759
3759
  throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");
3760
3760
  let a2 = undefined, jJ;
3761
3761
  try {
3762
3762
  if (YJ)
3763
- a2 = new A2(L2.r, L2.s);
3763
+ a2 = new A2(B3.r, B3.s);
3764
3764
  if (GJ) {
3765
3765
  try {
3766
3766
  if (i2 !== "compact")
3767
- a2 = A2.fromDER(L2);
3768
- } catch (hJ) {
3769
- if (!(hJ instanceof NJ.Err))
3770
- throw hJ;
3767
+ a2 = A2.fromDER(B3);
3768
+ } catch (uJ) {
3769
+ if (!(uJ instanceof NJ.Err))
3770
+ throw uJ;
3771
3771
  }
3772
3772
  if (!a2 && i2 !== "der")
3773
- a2 = A2.fromCompact(L2);
3773
+ a2 = A2.fromCompact(B3);
3774
3774
  }
3775
- jJ = U2.fromHex(B3);
3776
- } catch (hJ) {
3775
+ jJ = U2.fromHex(L2);
3776
+ } catch (uJ) {
3777
3777
  return false;
3778
3778
  }
3779
3779
  if (!a2)
3780
3780
  return false;
3781
- if (E3 && a2.hasHighS())
3781
+ if (y3 && a2.hasHighS())
3782
3782
  return false;
3783
- if ($J)
3784
- R3 = $.hash(R3);
3785
- let { r: B$, s: c$ } = a2, PJ = w3(R3), mJ = q(c$), p$ = X2(PJ * mJ), J$ = X2(B$ * mJ), CJ = U2.BASE.multiplyAndAddUnsafe(jJ, p$, J$)?.toAffine();
3783
+ if (JJ)
3784
+ T2 = $.hash(T2);
3785
+ let { r: L$, s: c$ } = a2, PJ = w3(T2), vJ = q(c$), p$ = X2(PJ * vJ), J$ = X2(L$ * vJ), CJ = U2.BASE.multiplyAndAddUnsafe(jJ, p$, J$)?.toAffine();
3786
3786
  if (!CJ)
3787
3787
  return false;
3788
- return X2(CJ.x) === B$;
3788
+ return X2(CJ.x) === L$;
3789
3789
  }
3790
- return { CURVE: $, getPublicKey: W2, getSharedSecret: T2, sign: c3, verify: u2, ProjectivePoint: U2, Signature: A2, utils: F2 };
3790
+ return { CURVE: $, getPublicKey: W2, getSharedSecret: R3, sign: c3, verify: u2, ProjectivePoint: U2, Signature: A2, utils: b3 };
3791
3791
  }
3792
3792
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3793
- function cQ(J) {
3794
- return { hash: J, hmac: ($, ...Q) => q8(J, $, K0(...Q)), randomBytes: U0 };
3793
+ function lQ(J) {
3794
+ return { hash: J, hmac: ($, ...Q) => q8(J, $, X0(...Q)), randomBytes: q0 };
3795
3795
  }
3796
- function g0(J, $) {
3797
- let Q = (G) => f0({ ...J, ...cQ(G) });
3796
+ function f0(J, $) {
3797
+ let Q = (G) => b0({ ...J, ...lQ(G) });
3798
3798
  return { ...Q($), create: Q };
3799
3799
  }
3800
3800
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3801
- var m0 = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
3802
- var v0 = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
3803
- var pQ = BigInt(0);
3804
- var dQ = BigInt(1);
3805
- var E8 = BigInt(2);
3806
- var u0 = (J, $) => (J + $ / E8) / $;
3807
- function nQ(J) {
3808
- let $ = m0, Q = BigInt(3), G = BigInt(6), Y2 = BigInt(11), M2 = BigInt(22), Z = BigInt(23), K = BigInt(44), X2 = BigInt(88), q = J * J * J % $, U2 = q * q * J % $, j = e2(U2, Q, $) * U2 % $, z2 = e2(j, Q, $) * U2 % $, V2 = e2(z2, E8, $) * q % $, C3 = e2(V2, Y2, $) * V2 % $, D3 = e2(C3, M2, $) * C3 % $, f3 = e2(D3, K, $) * D3 % $, A2 = e2(f3, X2, $) * f3 % $, F2 = e2(A2, K, $) * D3 % $, W2 = e2(F2, Q, $) * U2 % $, N3 = e2(W2, Z, $) * C3 % $, T2 = e2(N3, G, $) * q % $, P3 = e2(T2, E8, $);
3801
+ var u0 = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
3802
+ var g0 = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
3803
+ var cQ = BigInt(0);
3804
+ var pQ = BigInt(1);
3805
+ var y8 = BigInt(2);
3806
+ var v0 = (J, $) => (J + $ / y8) / $;
3807
+ function dQ(J) {
3808
+ let $ = u0, Q = BigInt(3), G = BigInt(6), Y2 = BigInt(11), M2 = BigInt(22), Z = BigInt(23), K = BigInt(44), X2 = BigInt(88), q = J * J * J % $, U2 = q * q * J % $, j = r3(U2, Q, $) * U2 % $, z2 = r3(j, Q, $) * U2 % $, V2 = r3(z2, y8, $) * q % $, C3 = r3(V2, Y2, $) * V2 % $, D3 = r3(C3, M2, $) * C3 % $, f3 = r3(D3, K, $) * D3 % $, A2 = r3(f3, X2, $) * f3 % $, b3 = r3(A2, K, $) * D3 % $, W2 = r3(b3, Q, $) * U2 % $, N3 = r3(W2, Z, $) * C3 % $, R3 = r3(N3, G, $) * q % $, P3 = r3(R3, y8, $);
3809
3809
  if (!w8.eql(w8.sqr(P3), J))
3810
3810
  throw Error("Cannot find square root");
3811
3811
  return P3;
3812
3812
  }
3813
- var w8 = P$(m0, undefined, undefined, { sqrt: nQ });
3814
- var k8 = g0({ a: pQ, b: BigInt(7), Fp: w8, n: v0, Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"), Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"), h: BigInt(1), lowS: true, endo: { beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"), splitScalar: (J) => {
3815
- let $ = v0, Q = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), G = -dQ * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), Y2 = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), M2 = Q, Z = BigInt("0x100000000000000000000000000000000"), K = u0(M2 * J, $), X2 = u0(-G * J, $), q = d2(J - K * Q - X2 * Y2, $), U2 = d2(-K * G - X2 * M2, $), j = q > Z, z2 = U2 > Z;
3813
+ var w8 = P$(u0, undefined, undefined, { sqrt: dQ });
3814
+ var k8 = f0({ a: cQ, b: BigInt(7), Fp: w8, n: g0, Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"), Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"), h: BigInt(1), lowS: true, endo: { beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"), splitScalar: (J) => {
3815
+ let $ = g0, Q = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), G = -pQ * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), Y2 = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), M2 = Q, Z = BigInt("0x100000000000000000000000000000000"), K = v0(M2 * J, $), X2 = v0(-G * J, $), q = d2(J - K * Q - X2 * Y2, $), U2 = d2(-K * G - X2 * M2, $), j = q > Z, z2 = U2 > Z;
3816
3816
  if (j)
3817
3817
  q = $ - q;
3818
3818
  if (z2)
@@ -3820,13 +3820,13 @@ var k8 = g0({ a: pQ, b: BigInt(7), Fp: w8, n: v0, Gx: BigInt("550662630222773436
3820
3820
  if (q > Z || U2 > Z)
3821
3821
  throw Error("splitScalar: Endomorphism failed, k=" + J);
3822
3822
  return { k1neg: j, k1: q, k2neg: z2, k2: U2 };
3823
- } } }, j0);
3823
+ } } }, O0);
3824
3824
  function h$() {
3825
3825
  let J = k8.utils.randomPrivateKey();
3826
3826
  return "0x" + Buffer.from(J).toString("hex");
3827
3827
  }
3828
- function eJ(J) {
3829
- let $ = J.startsWith("0x") ? J.slice(2) : J, Q = Buffer.from($, "hex"), G = k8.getPublicKey(Q, false), M2 = cJ(G.slice(1)).slice(-20), Z = "0x" + Buffer.from(M2).toString("hex");
3828
+ function rJ(J) {
3829
+ let $ = J.startsWith("0x") ? J.slice(2) : J, Q = Buffer.from($, "hex"), G = k8.getPublicKey(Q, false), M2 = hJ(G.slice(1)).slice(-20), Z = "0x" + Buffer.from(M2).toString("hex");
3830
3830
  return VJ(Z);
3831
3831
  }
3832
3832
  function l$(J) {
@@ -3836,7 +3836,7 @@ function l$(J) {
3836
3836
  $ = Buffer.from(G, "hex");
3837
3837
  } else
3838
3838
  $ = J;
3839
- let Q = cJ($);
3839
+ let Q = hJ($);
3840
3840
  return "0x" + Buffer.from(Q).toString("hex");
3841
3841
  }
3842
3842
 
@@ -3869,44 +3869,44 @@ class o3 extends z$ {
3869
3869
  }
3870
3870
  }
3871
3871
 
3872
- class v3 extends z$ {
3872
+ class g3 extends z$ {
3873
3873
  constructor(J, $) {
3874
3874
  super("InvitationError", J, { ...$, source: $?.source || "INVITATIONS" });
3875
3875
  }
3876
3876
  static noPathFound(J, $, Q) {
3877
- return new v3(`No valid invitation path found from ${J} to ${$}. ${Q || "The inviter may not have enough balance of the proxy inviter's token or there's no trust connection."}`, { code: "INVITATION_NO_PATH", source: "PATHFINDING", context: { from: J, to: $, reason: Q } });
3877
+ return new g3(`No valid invitation path found from ${J} to ${$}. ${Q || "The inviter may not have enough balance of the proxy inviter's token or there's no trust connection."}`, { code: "INVITATION_NO_PATH", source: "PATHFINDING", context: { from: J, to: $, reason: Q } });
3878
3878
  }
3879
3879
  static noProxyInviters(J) {
3880
- return new v3(`No proxy inviters found for ${J}. The inviter must have mutual trust connections with users who are also trusted by the invitation module, and these users must have sufficient balance.`, { code: "INVITATION_NO_PROXY_INVITERS", source: "VALIDATION", context: { inviter: J } });
3880
+ return new g3(`No proxy inviters found for ${J}. The inviter must have mutual trust connections with users who are also trusted by the invitation module, and these users must have sufficient balance.`, { code: "INVITATION_NO_PROXY_INVITERS", source: "VALIDATION", context: { inviter: J } });
3881
3881
  }
3882
3882
  static insufficientBalance(J, $, Q, G, Y2, M2) {
3883
3883
  let Z = Number(Q) / 1000000000000000000, K = Number(G) / 1000000000000000000;
3884
- return new v3(`Insufficient balance for ${J} invitation(s). Can only afford ${$} invitation(s). Requested: ${Z.toFixed(6)} CRC, Available: ${K.toFixed(6)} CRC.`, { code: "INVITATION_INSUFFICIENT_BALANCE", source: "VALIDATION", context: { from: Y2, to: M2, requestedInvites: J, availableInvites: $, requested: Q.toString(), available: G.toString(), requestedCrc: Z, availableCrc: K } });
3884
+ return new g3(`Insufficient balance for ${J} invitation(s). Can only afford ${$} invitation(s). Requested: ${Z.toFixed(6)} CRC, Available: ${K.toFixed(6)} CRC.`, { code: "INVITATION_INSUFFICIENT_BALANCE", source: "VALIDATION", context: { from: Y2, to: M2, requestedInvites: J, availableInvites: $, requested: Q.toString(), available: G.toString(), requestedCrc: Z, availableCrc: K } });
3885
3885
  }
3886
3886
  static inviteeAlreadyRegistered(J, $) {
3887
- return new v3(`Invitee ${$} is already registered as a human in Circles Hub. Cannot invite an already registered user.`, { code: "INVITATION_INVITEE_ALREADY_REGISTERED", source: "VALIDATION", context: { inviter: J, invitee: $ } });
3887
+ return new g3(`Invitee ${$} is already registered as a human in Circles Hub. Cannot invite an already registered user.`, { code: "INVITATION_INVITEE_ALREADY_REGISTERED", source: "VALIDATION", context: { inviter: J, invitee: $ } });
3888
3888
  }
3889
3889
  static noAddressesProvided() {
3890
- return new v3("At least one address must be provided for invitation.", { code: "INVITATION_NO_ADDRESSES_PROVIDED", source: "VALIDATION" });
3890
+ return new g3("At least one address must be provided for invitation.", { code: "INVITATION_NO_ADDRESSES_PROVIDED", source: "VALIDATION" });
3891
3891
  }
3892
3892
  }
3893
- var h0 = [];
3893
+ var m0 = [];
3894
3894
  for (let J = 0;J < 256; J++)
3895
- h0[J] = J.toString(16).padStart(2, "0");
3895
+ m0[J] = J.toString(16).padStart(2, "0");
3896
3896
  function C$(J) {
3897
3897
  let $ = "0x";
3898
3898
  for (let Q = 0;Q < J.length; Q++)
3899
- $ += h0[J[Q]];
3899
+ $ += m0[J[Q]];
3900
3900
  return $;
3901
3901
  }
3902
- function l0(J) {
3902
+ function h0(J) {
3903
3903
  let $ = new Uint8Array(J.length * 2);
3904
3904
  return J.forEach((Q, G) => {
3905
3905
  let Y2 = Q >> 8, M2 = Q & 255, Z = 2 * G;
3906
3906
  $[Z] = Y2, $[Z + 1] = M2;
3907
3907
  }), C$($);
3908
3908
  }
3909
- function c0(J, $, Q) {
3909
+ function l0(J, $, Q) {
3910
3910
  let G = new Set([$.toLowerCase(), Q.toLowerCase()]);
3911
3911
  J.forEach((Z) => {
3912
3912
  G.add(Z.from.toLowerCase()), G.add(Z.to.toLowerCase()), G.add(Z.tokenOwner.toLowerCase());
@@ -3919,7 +3919,7 @@ function c0(J, $, Q) {
3919
3919
  M2[Z] = K;
3920
3920
  }), { sorted: Y2, idx: M2 };
3921
3921
  }
3922
- function iQ(J, $) {
3922
+ function nQ(J, $) {
3923
3923
  let Q = new Set, G = [], Y2 = null;
3924
3924
  if (J.forEach((M2, Z) => {
3925
3925
  let K = M2.from.toLowerCase(), X2 = M2.to.toLowerCase();
@@ -3933,9 +3933,9 @@ function iQ(J, $) {
3933
3933
  G.forEach((M2) => Q.add(M2));
3934
3934
  return Q;
3935
3935
  }
3936
- function p0(J, $, Q, G) {
3937
- let Y2 = J.toLowerCase(), M2 = $.toLowerCase(), { sorted: Z, idx: K } = c0(G, Y2, M2), X2 = iQ(G, M2), q = G.map((A2, F2) => {
3938
- return { streamSinkId: X2.has(F2) ? 1 : 0, amount: A2.value };
3936
+ function c0(J, $, Q, G) {
3937
+ let Y2 = J.toLowerCase(), M2 = $.toLowerCase(), { sorted: Z, idx: K } = l0(G, Y2, M2), X2 = nQ(G, M2), q = G.map((A2, b3) => {
3938
+ return { streamSinkId: X2.has(b3) ? 1 : 0, amount: A2.value };
3939
3939
  });
3940
3940
  if (X2.size === 0)
3941
3941
  throw Error(`No terminal edges detected. Flow must have at least one edge delivering to receiver ${M2}`);
@@ -3943,18 +3943,18 @@ function p0(J, $, Q, G) {
3943
3943
  G.forEach((A2) => {
3944
3944
  z2.push(K[A2.tokenOwner.toLowerCase()]), z2.push(K[A2.from.toLowerCase()]), z2.push(K[A2.to.toLowerCase()]);
3945
3945
  });
3946
- let V2 = l0(z2), C3 = BigInt(Q), D3 = q.filter((A2) => A2.streamSinkId === 1).reduce((A2, F2) => A2 + BigInt(F2.amount.toString()), BigInt(0));
3946
+ let V2 = h0(z2), C3 = BigInt(Q), D3 = q.filter((A2) => A2.streamSinkId === 1).reduce((A2, b3) => A2 + BigInt(b3.amount.toString()), BigInt(0));
3947
3947
  if (D3 !== C3)
3948
3948
  throw Error(`Terminal sum ${D3} does not equal expected ${C3}`);
3949
3949
  return { flowVertices: Z, flowEdges: q, streams: j, packedCoordinates: V2, sourceCoordinate: K[Y2] };
3950
3950
  }
3951
- function d0(J, $) {
3951
+ function p0(J, $) {
3952
3952
  let Q = J.streams.map((G) => ({ sourceCoordinate: G.sourceCoordinate, flowEdgeIds: G.flowEdgeIds, data: G.data instanceof Uint8Array ? C$(G.data) : G.data }));
3953
3953
  if ($ && Q.length > 0)
3954
3954
  Q[0].data = $ instanceof Uint8Array ? C$($) : $;
3955
3955
  return Q;
3956
3956
  }
3957
- async function n0(J, $, Q) {
3957
+ async function d0(J, $, Q) {
3958
3958
  let G = new Map, Y2 = new Set;
3959
3959
  return Q.transfers.forEach((K) => {
3960
3960
  if (J.toLowerCase() === K.from.toLowerCase())
@@ -3965,7 +3965,7 @@ async function n0(J, $, Q) {
3965
3965
  G.set(K.tokenAddress.toLowerCase(), K);
3966
3966
  }), G;
3967
3967
  }
3968
- function i0(J, $) {
3968
+ function n0(J, $) {
3969
3969
  let Q = {};
3970
3970
  return J.transfers.forEach((G) => {
3971
3971
  let Y2 = $.get(G.tokenOwner.toLowerCase());
@@ -3976,7 +3976,7 @@ function i0(J, $) {
3976
3976
  }
3977
3977
  }), Q;
3978
3978
  }
3979
- function t0(J, $) {
3979
+ function i0(J, $) {
3980
3980
  let Q = J.transfers.map((G) => {
3981
3981
  let Y2 = $.get(G.tokenOwner.toLowerCase());
3982
3982
  if (Y2 && Y2.tokenType.startsWith("CrcV2_ERC20WrapperDeployed"))
@@ -3986,32 +3986,32 @@ function t0(J, $) {
3986
3986
  return { ...J, transfers: Q };
3987
3987
  }
3988
3988
 
3989
- class JJ extends G$ {
3989
+ class e2 extends G$ {
3990
3990
  constructor(J, $) {
3991
3991
  super("TransferError", J, { ...$, source: $?.source || "TRANSFERS" });
3992
3992
  }
3993
3993
  static noPathFound(J, $, Q) {
3994
- return new JJ(`No valid transfer path found from ${J} to ${$}. ${Q || "This could mean there's no trust connection, insufficient balance, or the tokens are not transferable."}`, { code: "TRANSFER_NO_PATH", source: "PATHFINDING", context: { from: J, to: $, reason: Q } });
3994
+ return new e2(`No valid transfer path found from ${J} to ${$}. ${Q || "This could mean there's no trust connection, insufficient balance, or the tokens are not transferable."}`, { code: "TRANSFER_NO_PATH", source: "PATHFINDING", context: { from: J, to: $, reason: Q } });
3995
3995
  }
3996
3996
  static insufficientBalance(J, $, Q, G) {
3997
3997
  let Y2 = Number(J) / 1000000000000000000, M2 = Number($) / 1000000000000000000;
3998
- return new JJ(`Insufficient balance for transfer. Requested: ${Y2.toFixed(6)} CRC, Available: ${M2.toFixed(6)} CRC.`, { code: "TRANSFER_INSUFFICIENT_BALANCE", source: "VALIDATION", context: { from: Q, to: G, requested: J.toString(), available: $.toString(), requestedCrc: Y2, availableCrc: M2 } });
3998
+ return new e2(`Insufficient balance for transfer. Requested: ${Y2.toFixed(6)} CRC, Available: ${M2.toFixed(6)} CRC.`, { code: "TRANSFER_INSUFFICIENT_BALANCE", source: "VALIDATION", context: { from: Q, to: G, requested: J.toString(), available: $.toString(), requestedCrc: Y2, availableCrc: M2 } });
3999
3999
  }
4000
4000
  static wrappedTokensRequired() {
4001
- return new JJ("Insufficient unwrapped token balance for transfer. Your balance contains wrapped tokens (ERC20 wrappers), but useWrappedBalances option is not enabled. Please enable it by passing { useWrappedBalances: true } in the transfer options.", { code: "TRANSFER_WRAPPED_TOKENS_REQUIRED", source: "VALIDATION" });
4001
+ return new e2("Insufficient unwrapped token balance for transfer. Your balance contains wrapped tokens (ERC20 wrappers), but useWrappedBalances option is not enabled. Please enable it by passing { useWrappedBalances: true } in the transfer options.", { code: "TRANSFER_WRAPPED_TOKENS_REQUIRED", source: "VALIDATION" });
4002
4002
  }
4003
4003
  static unregisteredAvatars(J) {
4004
- return new JJ(`Flow matrix contains ${J.length} unregistered avatar(s): ${J.join(", ")}. All addresses in the flow must be registered Circles avatars (human or group).`, { code: "TRANSFER_UNREGISTERED_AVATARS", source: "FLOW_MATRIX", context: { unregisteredAddresses: J, count: J.length } });
4004
+ return new e2(`Flow matrix contains ${J.length} unregistered avatar(s): ${J.join(", ")}. All addresses in the flow must be registered Circles avatars (human or group).`, { code: "TRANSFER_UNREGISTERED_AVATARS", source: "FLOW_MATRIX", context: { unregisteredAddresses: J, count: J.length } });
4005
4005
  }
4006
4006
  static flowMatrixMismatch(J, $) {
4007
- return new JJ(`Flow matrix terminal sum (${J}) does not equal expected amount (${$})`, { code: "TRANSFER_FLOW_MATRIX_MISMATCH", source: "FLOW_MATRIX", context: { terminalSum: J.toString(), expected: $.toString() } });
4007
+ return new e2(`Flow matrix terminal sum (${J}) does not equal expected amount (${$})`, { code: "TRANSFER_FLOW_MATRIX_MISMATCH", source: "FLOW_MATRIX", context: { terminalSum: J.toString(), expected: $.toString() } });
4008
4008
  }
4009
4009
  static emptyPath(J, $) {
4010
- return new JJ(`Transfer path is empty for route from ${J} to ${$}`, { code: "TRANSFER_EMPTY_PATH", source: "PATHFINDING", context: { from: J, to: $ } });
4010
+ return new e2(`Transfer path is empty for route from ${J} to ${$}`, { code: "TRANSFER_EMPTY_PATH", source: "PATHFINDING", context: { from: J, to: $ } });
4011
4011
  }
4012
4012
  }
4013
4013
 
4014
- class uJ {
4014
+ class eJ {
4015
4015
  config;
4016
4016
  hubV2;
4017
4017
  liftERC20;
@@ -4020,31 +4020,31 @@ class uJ {
4020
4020
  balance;
4021
4021
  group;
4022
4022
  constructor(J) {
4023
- this.config = J, this.hubV2 = new IJ({ address: J.v2HubAddress, rpcUrl: J.circlesRpcUrl }), this.liftERC20 = new x$({ address: J.liftERC20Address, rpcUrl: J.circlesRpcUrl }), this.rpcClient = new zJ(J.circlesRpcUrl), this.pathfinder = new KJ(this.rpcClient), this.balance = new AJ(this.rpcClient), this.group = new EJ(this.rpcClient);
4023
+ this.config = J, this.hubV2 = new IJ({ address: J.v2HubAddress, rpcUrl: J.circlesRpcUrl }), this.liftERC20 = new x$({ address: J.liftERC20Address, rpcUrl: J.circlesRpcUrl }), this.rpcClient = new zJ(J.circlesRpcUrl), this.pathfinder = new KJ(this.rpcClient), this.balance = new _J(this.rpcClient), this.group = new EJ(this.rpcClient);
4024
4024
  }
4025
4025
  async buildFlowMatrixTx(J, $, Q, G, Y2 = false) {
4026
4026
  let M2 = J.toLowerCase(), Z = $.toLowerCase();
4027
4027
  if (!Q.transfers || Q.transfers.length === 0)
4028
- throw JJ.noPathFound(M2, Z);
4028
+ throw e2.noPathFound(M2, Z);
4029
4029
  let K = { ...Q };
4030
4030
  if (Y2 && G?.toTokens?.length === 1) {
4031
- let F2 = G.toTokens[0].toLowerCase();
4031
+ let b3 = G.toTokens[0].toLowerCase();
4032
4032
  if (Q.maxFlow > 0n)
4033
- K.transfers.push({ from: Z, to: Z, tokenOwner: F2, value: Q.maxFlow });
4033
+ K.transfers.push({ from: Z, to: Z, tokenOwner: b3, value: Q.maxFlow });
4034
4034
  }
4035
- let X2 = await n0(M2, this.config.circlesRpcUrl, K), q = i0(K, X2), U2 = Object.keys(q).length > 0;
4035
+ let X2 = await d0(M2, this.config.circlesRpcUrl, K), q = n0(K, X2), U2 = Object.keys(q).length > 0;
4036
4036
  if (U2 && !G?.useWrappedBalances)
4037
- throw JJ.wrappedTokensRequired();
4037
+ throw e2.wrappedTokensRequired();
4038
4038
  let j = [], z2 = [];
4039
4039
  if (U2) {
4040
- let F2 = await this._getTokenBalanceMap(M2), W2 = this._createDemurragedUnwrapCalls(q), { unwrapCalls: N3, wrapCalls: T2 } = this._createInflationaryUnwrapAndWrapCalls(q, X2, F2);
4041
- j = [...W2, ...N3], z2 = T2, K = t0(K, X2);
4040
+ let b3 = await this._getTokenBalanceMap(M2), W2 = this._createDemurragedUnwrapCalls(q), { unwrapCalls: N3, wrapCalls: R3 } = this._createInflationaryUnwrapAndWrapCalls(q, X2, b3);
4041
+ j = [...W2, ...N3], z2 = R3, K = i0(K, X2);
4042
4042
  }
4043
- let V2 = p0(M2, Z, K.maxFlow, K.transfers), C3 = d0(V2, G?.txData), D3 = this.hubV2.operateFlowMatrix(V2.flowVertices, V2.flowEdges, C3, V2.packedCoordinates), f3 = false;
4043
+ let V2 = c0(M2, Z, K.maxFlow, K.transfers), C3 = p0(V2, G?.txData), D3 = this.hubV2.operateFlowMatrix(V2.flowVertices, V2.flowEdges, C3, V2.packedCoordinates), f3 = false;
4044
4044
  try {
4045
4045
  f3 = await this.hubV2.isApprovedForAll(M2, M2);
4046
- } catch (F2) {
4047
- console.warn("Failed to check approval status, including approval transaction:", F2);
4046
+ } catch (b3) {
4047
+ console.warn("Failed to check approval status, including approval transaction:", b3);
4048
4048
  }
4049
4049
  return [...f3 ? [] : [this.hubV2.setApprovalForAll(M2, true)], ...j, D3, ...z2];
4050
4050
  }
@@ -4052,20 +4052,20 @@ class uJ {
4052
4052
  let M2 = J.toLowerCase(), Z = $.toLowerCase(), K = BigInt(Q);
4053
4053
  if (M2 === Z && G?.fromTokens?.length === 1 && G?.toTokens?.length === 1) {
4054
4054
  let V2 = G.fromTokens[0], C3 = G.toTokens[0], [D3, f3] = await Promise.all([this.liftERC20.erc20Circles(0, C3), this.liftERC20.erc20Circles(1, C3)]);
4055
- if (V2.toLowerCase() === D3.toLowerCase() && D3 !== LJ) {
4056
- let F2 = new O$({ address: V2, rpcUrl: this.config.circlesRpcUrl }).unwrap(K);
4057
- return [{ to: F2.to, data: F2.data, value: F2.value ?? 0n }];
4055
+ if (V2.toLowerCase() === D3.toLowerCase() && D3 !== BJ) {
4056
+ let b3 = new O$({ address: V2, rpcUrl: this.config.circlesRpcUrl }).unwrap(K);
4057
+ return [{ to: b3.to, data: b3.data, value: b3.value ?? 0n }];
4058
4058
  }
4059
- if (V2.toLowerCase() === f3.toLowerCase() && f3 !== LJ) {
4060
- let A2 = new j$({ address: V2, rpcUrl: this.config.circlesRpcUrl }), F2 = nJ.attoCirclesToAttoStaticCircles(K), W2 = A2.unwrap(F2);
4059
+ if (V2.toLowerCase() === f3.toLowerCase() && f3 !== BJ) {
4060
+ let A2 = new j$({ address: V2, rpcUrl: this.config.circlesRpcUrl }), b3 = dJ.attoCirclesToAttoStaticCircles(K), W2 = A2.unwrap(b3);
4061
4061
  return [{ to: W2.to, data: W2.data, value: W2.value ?? 0n }];
4062
4062
  }
4063
4063
  }
4064
4064
  let X2 = this._truncateToSixDecimals(K), q = await this._getDefaultTokenExcludeList(Z, G?.excludeFromTokens), { ...U2 } = G || {}, j = { ...U2, ...q ? { excludeFromTokens: q } : {} }, z2 = await this.pathfinder.findPath({ from: M2, to: Z, targetFlow: X2, ...j });
4065
4065
  if (!z2.transfers || z2.transfers.length === 0)
4066
- throw JJ.noPathFound(M2, Z);
4066
+ throw e2.noPathFound(M2, Z);
4067
4067
  if (z2.maxFlow < X2)
4068
- throw JJ.insufficientBalance(X2, z2.maxFlow, M2, Z);
4068
+ throw e2.insufficientBalance(X2, z2.maxFlow, M2, Z);
4069
4069
  return this.buildFlowMatrixTx(M2, Z, z2, G, Y2);
4070
4070
  }
4071
4071
  async _getTokenBalanceMap(J) {
@@ -4094,7 +4094,7 @@ class uJ {
4094
4094
  continue;
4095
4095
  let j = new j$({ address: M2, rpcUrl: this.config.circlesRpcUrl }).unwrap(q);
4096
4096
  G.push({ to: j.to, data: j.data, value: j.value ?? 0n });
4097
- let z2 = X2?.tokenOwner, V2 = nJ.attoStaticCirclesToAttoCircles(q) - Z;
4097
+ let z2 = X2?.tokenOwner, V2 = dJ.attoStaticCirclesToAttoCircles(q) - Z;
4098
4098
  if (V2 > 0n) {
4099
4099
  let C3 = this.hubV2.wrap(z2, V2, 1);
4100
4100
  Y2.push({ to: C3.to, data: C3.data, value: C3.value ?? 0n });
@@ -4120,10 +4120,10 @@ class uJ {
4120
4120
  return Array.from(G);
4121
4121
  }
4122
4122
  }
4123
- var o0 = dJ;
4124
- var x8 = "0x20EcD8bDeb2F48d8a7c94E542aA4feC5790D9676";
4123
+ var tQ = cJ;
4124
+ var t0 = "0x20EcD8bDeb2F48d8a7c94E542aA4feC5790D9676";
4125
4125
 
4126
- class b8 {
4126
+ class x8 {
4127
4127
  config;
4128
4128
  rpcClient;
4129
4129
  pathfinder;
@@ -4136,12 +4136,12 @@ class b8 {
4136
4136
  gnosisPayGrantee;
4137
4137
  constructor(J) {
4138
4138
  if (!J.referralsServiceUrl)
4139
- throw new v3("referralsServiceUrl is required in config", { code: "INVITATION_MISSING_CONFIG", source: "INVITATIONS", context: { missingField: "referralsServiceUrl" } });
4140
- if (this.config = J, this.rpcClient = new zJ(J.circlesRpcUrl), this.pathfinder = new KJ(this.rpcClient), this.trust = new _J(this.rpcClient), this.token = new yJ(this.rpcClient), this.hubV2 = new IJ({ address: J.v2HubAddress, rpcUrl: J.circlesRpcUrl }), this.referralsModule = new iJ({ address: J.referralsModuleAddress, rpcUrl: J.circlesRpcUrl }), this.invitationFarm = new tJ({ address: J.invitationFarmAddress, rpcUrl: J.circlesRpcUrl }), this.invitationModuleContract = new F$({ address: J.invitationModuleAddress, rpcUrl: J.circlesRpcUrl }), J.gnosisPayInviteQuotaGranteeAddress)
4139
+ throw new g3("referralsServiceUrl is required in config", { code: "INVITATION_MISSING_CONFIG", source: "INVITATIONS", context: { missingField: "referralsServiceUrl" } });
4140
+ if (this.config = J, this.rpcClient = new zJ(J.circlesRpcUrl), this.pathfinder = new KJ(this.rpcClient), this.trust = new SJ(this.rpcClient), this.token = new AJ(this.rpcClient), this.hubV2 = new IJ({ address: J.v2HubAddress, rpcUrl: J.circlesRpcUrl }), this.referralsModule = new nJ({ address: J.referralsModuleAddress, rpcUrl: J.circlesRpcUrl }), this.invitationFarm = new iJ({ address: J.invitationFarmAddress, rpcUrl: J.circlesRpcUrl }), this.invitationModuleContract = new b$({ address: J.invitationModuleAddress, rpcUrl: J.circlesRpcUrl }), J.gnosisPayInviteQuotaGranteeAddress)
4141
4141
  this.gnosisPayGrantee = new f$({ address: J.gnosisPayInviteQuotaGranteeAddress, rpcUrl: J.circlesRpcUrl });
4142
4142
  }
4143
4143
  async ensureInviterSetup(J) {
4144
- let $ = J.toLowerCase(), Q = this.config.invitationModuleAddress, G = [], Y2 = new b$({ address: $, rpcUrl: this.config.circlesRpcUrl });
4144
+ let $ = J.toLowerCase(), Q = this.config.invitationModuleAddress, G = [], Y2 = new F$({ address: $, rpcUrl: this.config.circlesRpcUrl });
4145
4145
  if (!await Y2.isModuleEnabled(Q))
4146
4146
  G.push(Y2.enableModule(Q)), G.push(this.invitationModuleContract.trustInviter($));
4147
4147
  else if (!await this.hubV2.isTrusted(Q, $))
@@ -4154,16 +4154,16 @@ class b8 {
4154
4154
  return this.gnosisPayGrantee.claimableFreeInvites(J.toLowerCase());
4155
4155
  }
4156
4156
  async buildFreeInviteTransactions(J, $) {
4157
- let Q = await this.invitationFarm.read("claimInvite", [], { from: x8 }), G = await this.invitationFarm.invitationModule();
4157
+ let Q = await this.invitationFarm.read("claimInvite", [], { from: t0 }), G = await this.invitationFarm.invitationModule();
4158
4158
  return [this.gnosisPayGrantee.claimFreeInvite(), this.invitationFarm.claimInvite(), this.hubV2.safeTransferFrom(J, G, Q, m2, $)];
4159
4159
  }
4160
4160
  async saveReferralData(J, $) {
4161
4161
  try {
4162
4162
  let Q = await fetch(`${this.config.referralsServiceUrl}/store`, { method: "POST", headers: { accept: "application/json", "Content-Type": "application/json" }, body: JSON.stringify({ privateKey: $, inviter: J }) });
4163
4163
  if (!Q.ok)
4164
- throw new v3(`HTTP error! status: ${Q.status}`, { code: "INVITATION_HTTP_ERROR", source: "INVITATIONS", context: { status: Q.status, url: `${this.config.referralsServiceUrl}/store` } });
4164
+ throw new g3(`HTTP error! status: ${Q.status}`, { code: "INVITATION_HTTP_ERROR", source: "INVITATIONS", context: { status: Q.status, url: `${this.config.referralsServiceUrl}/store` } });
4165
4165
  } catch (Q) {
4166
- throw new v3(`Failed to save referral data: ${Q instanceof Error ? Q.message : "Unknown error"}`, { code: "INVITATION_SAVE_REFERRAL_FAILED", source: "INVITATIONS", cause: Q });
4166
+ throw new g3(`Failed to save referral data: ${Q instanceof Error ? Q.message : "Unknown error"}`, { code: "INVITATION_SAVE_REFERRAL_FAILED", source: "INVITATIONS", cause: Q });
4167
4167
  }
4168
4168
  }
4169
4169
  async listReferrals(J, $ = 10, Q = 0) {
@@ -4172,12 +4172,12 @@ class b8 {
4172
4172
  G.searchParams.set("limit", String($)), G.searchParams.set("offset", String(Q));
4173
4173
  let Y2 = await fetch(G.toString(), { method: "GET", headers: { accept: "application/json" } });
4174
4174
  if (!Y2.ok)
4175
- throw new v3(`HTTP error! status: ${Y2.status}`, { code: "INVITATION_HTTP_ERROR", source: "INVITATIONS", context: { status: Y2.status, url: G.toString() } });
4175
+ throw new g3(`HTTP error! status: ${Y2.status}`, { code: "INVITATION_HTTP_ERROR", source: "INVITATIONS", context: { status: Y2.status, url: G.toString() } });
4176
4176
  return await Y2.json();
4177
4177
  } catch (G) {
4178
- if (G instanceof v3)
4178
+ if (G instanceof g3)
4179
4179
  throw G;
4180
- throw new v3(`Failed to list referrals: ${G instanceof Error ? G.message : "Unknown error"}`, { code: "INVITATION_LIST_REFERRALS_FAILED", source: "INVITATIONS", cause: G });
4180
+ throw new g3(`Failed to list referrals: ${G instanceof Error ? G.message : "Unknown error"}`, { code: "INVITATION_LIST_REFERRALS_FAILED", source: "INVITATIONS", cause: G });
4181
4181
  }
4182
4182
  }
4183
4183
  orderRealInviters(J, $) {
@@ -4194,28 +4194,29 @@ class b8 {
4194
4194
  async generateInvite(J, $) {
4195
4195
  let Q = J.toLowerCase(), G = $.toLowerCase();
4196
4196
  if (await this.hubV2.isHuman(G))
4197
- throw v3.inviteeAlreadyRegistered(Q, G);
4198
- let M2 = await this.ensureInviterSetup(Q);
4199
- if (await this.getClaimableFreeInvites(Q) > 0n) {
4200
- let X2 = await this.generateInviteData([G], false), q = await this.buildFreeInviteTransactions(Q, X2);
4201
- return [...M2, ...q];
4202
- }
4203
- let Z = await this.getRealInviters(Q), K = [...M2];
4197
+ throw g3.inviteeAlreadyRegistered(Q, G);
4198
+ let M2 = await this.ensureInviterSetup(Q), Z = await this.getRealInviters(Q), K = [...M2], X2 = $J(["address"], [G]);
4204
4199
  if (Z.length > 0) {
4205
4200
  console.log("[generateInvite] Using STANDARD PATH (proxy inviters available)");
4206
- let X2 = Z[0].address, q = await this.findInvitePath(Q, X2), U2 = await this.generateInviteData([G], false), z2 = await new uJ(this.config).buildFlowMatrixTx(Q, this.config.invitationModuleAddress, q, { toTokens: [X2], useWrappedBalances: true, txData: A$(U2) }, true);
4201
+ let q = Z[0].address, U2 = await this.findInvitePath(Q, q), z2 = await new eJ(this.config).buildFlowMatrixTx(Q, this.config.invitationModuleAddress, U2, { toTokens: [q], useWrappedBalances: true, txData: A$(X2) }, true);
4207
4202
  K.push(...z2);
4208
- } else {
4209
- console.log("[generateInvite] Using FARM FALLBACK PATH (no proxy inviters available)");
4210
- let X2 = new uJ(this.config), q = await this.findFarmInvitePath(Q), U2 = await X2.buildFlowMatrixTx(Q, HJ, q, { toTokens: [dJ], useWrappedBalances: true }, true);
4211
- K.push(...U2);
4212
- let j = await this.invitationFarm.read("claimInvite", [], { from: x8 }), z2 = this.invitationFarm.claimInvite();
4213
- K.push(z2);
4214
- let V2 = await this.invitationFarm.invitationModule(), C3 = r3(["address"], [G]), D3 = this.hubV2.safeTransferFrom(Q, V2, j, m2, C3);
4215
- K.push(D3);
4216
- }
4203
+ } else
4204
+ K.push(...await this.buildFarmOrFreeInviteTransactions(Q, X2));
4217
4205
  return K;
4218
4206
  }
4207
+ async buildFarmOrFreeInviteTransactions(J, $) {
4208
+ try {
4209
+ console.log("[invitations] Using FARM FALLBACK PATH (no proxy inviters available)");
4210
+ let Q = new eJ(this.config), G = await this.findFarmInvitePath(J), Y2 = await Q.buildFlowMatrixTx(J, pJ, G, { toTokens: [cJ], useWrappedBalances: true }, true), M2 = await this.invitationFarm.read("claimInvite", [], { from: t0 }), Z = await this.invitationFarm.invitationModule();
4211
+ return [...Y2, this.invitationFarm.claimInvite(), this.hubV2.safeTransferFrom(J, Z, M2, m2, $)];
4212
+ } catch (Q) {
4213
+ if (!(Q instanceof g3 && (Q.code === "INVITATION_INSUFFICIENT_BALANCE" || Q.code === "INVITATION_NO_PATH")))
4214
+ throw Q;
4215
+ if (await this.getClaimableFreeInvites(J) > 0n)
4216
+ return console.log("[invitations] Using FREE INVITE PATH (Gnosis Pay)"), this.buildFreeInviteTransactions(J, $);
4217
+ throw Q;
4218
+ }
4219
+ }
4219
4220
  async findInvitePath(J, $) {
4220
4221
  let Q = J.toLowerCase(), G;
4221
4222
  if ($)
@@ -4223,30 +4224,30 @@ class b8 {
4223
4224
  else {
4224
4225
  let M2 = await this.getRealInviters(Q);
4225
4226
  if (M2.length === 0)
4226
- throw v3.noPathFound(Q, this.config.invitationModuleAddress);
4227
+ throw g3.noPathFound(Q, this.config.invitationModuleAddress);
4227
4228
  G = M2[0].address;
4228
4229
  }
4229
4230
  let Y2 = await this.pathfinder.findPath({ from: Q, to: this.config.invitationModuleAddress, targetFlow: m2, toTokens: [G], useWrappedBalances: true, simulatedTrusts: [{ truster: this.config.invitationModuleAddress, trustee: Q }] });
4230
4231
  if (!Y2.transfers || Y2.transfers.length === 0)
4231
- throw v3.noPathFound(Q, this.config.invitationModuleAddress);
4232
+ throw g3.noPathFound(Q, this.config.invitationModuleAddress);
4232
4233
  if (Y2.maxFlow < m2) {
4233
4234
  let Z = Number(Y2.maxFlow / m2);
4234
- throw v3.insufficientBalance(1, Z, m2, Y2.maxFlow, Q, this.config.invitationModuleAddress);
4235
+ throw g3.insufficientBalance(1, Z, m2, Y2.maxFlow, Q, this.config.invitationModuleAddress);
4235
4236
  }
4236
4237
  return Y2;
4237
4238
  }
4238
4239
  async findFarmInvitePath(J) {
4239
- let $ = J.toLowerCase(), Q = await this.pathfinder.findPath({ from: $, to: HJ, targetFlow: m2, toTokens: [o0], useWrappedBalances: true });
4240
+ let $ = J.toLowerCase(), Q = await this.pathfinder.findPath({ from: $, to: pJ, targetFlow: m2, toTokens: [tQ], useWrappedBalances: true });
4240
4241
  if (!Q.transfers || Q.transfers.length === 0)
4241
- throw v3.noPathFound($, HJ);
4242
+ throw g3.noPathFound($, pJ);
4242
4243
  if (Q.maxFlow < m2) {
4243
4244
  let Y2 = Number(Q.maxFlow / m2);
4244
- throw v3.insufficientBalance(1, Y2, m2, Q.maxFlow, $, HJ);
4245
+ throw g3.insufficientBalance(1, Y2, m2, Q.maxFlow, $, pJ);
4245
4246
  }
4246
4247
  return Q;
4247
4248
  }
4248
4249
  async getRealInviters(J) {
4249
- let $ = J.toLowerCase(), [Q, G, Y2, M2, Z] = await Promise.all([dJ !== "0x0000000000000000000000000000000000000000" ? this.trust.getTrusts(dJ) : Promise.resolve([]), this.trust.getTrustedBy($), this.trust.getMutualTrusts($), this.trust.getTrusts(this.config.invitationModuleAddress), this.trust.getMutualTrusts(this.config.invitationModuleAddress)]), K = new Set(Q.map((N3) => N3.objectAvatar.toLowerCase())), X2 = new Set([...G.map((N3) => N3.objectAvatar.toLowerCase()), ...Y2.map((N3) => N3.objectAvatar.toLowerCase())]), q = new Set([...M2.map((N3) => N3.objectAvatar.toLowerCase()), ...Z.map((N3) => N3.objectAvatar.toLowerCase())]), j = [...[...X2].filter((N3) => q.has(N3) && !K.has(N3)), $];
4250
+ let $ = J.toLowerCase(), [Q, G, Y2, M2, Z] = await Promise.all([cJ !== "0x0000000000000000000000000000000000000000" ? this.trust.getTrusts(cJ) : Promise.resolve([]), this.trust.getTrustedBy($), this.trust.getMutualTrusts($), this.trust.getTrusts(this.config.invitationModuleAddress), this.trust.getMutualTrusts(this.config.invitationModuleAddress)]), K = new Set(Q.map((N3) => N3.objectAvatar.toLowerCase())), X2 = new Set([...G.map((N3) => N3.objectAvatar.toLowerCase()), ...Y2.map((N3) => N3.objectAvatar.toLowerCase())]), q = new Set([...M2.map((N3) => N3.objectAvatar.toLowerCase()), ...Z.map((N3) => N3.objectAvatar.toLowerCase())]), j = [...[...X2].filter((N3) => q.has(N3) && !K.has(N3)), $];
4250
4251
  if (j.length === 0)
4251
4252
  return [];
4252
4253
  let z2 = await this.pathfinder.findPath({ from: $, to: this.config.invitationModuleAddress, useWrappedBalances: true, targetFlow: X$, toTokens: j, simulatedTrusts: [{ truster: this.config.invitationModuleAddress, trustee: $ }] });
@@ -4254,59 +4255,47 @@ class b8 {
4254
4255
  return [];
4255
4256
  let V2 = this.config.invitationModuleAddress.toLowerCase(), C3 = z2.transfers.filter((N3) => N3.to.toLowerCase() === V2), D3 = [...new Set(C3.map((N3) => N3.tokenOwner.toLowerCase()))], f3 = await this.token.getTokenInfoBatch(D3), A2 = new Map;
4256
4257
  for (let N3 of f3) {
4257
- let T2 = N3.tokenAddress ?? N3.token;
4258
- if (T2 && N3?.tokenOwner)
4259
- A2.set(T2.toLowerCase(), N3.tokenOwner.toLowerCase());
4258
+ let R3 = N3.tokenAddress ?? N3.token;
4259
+ if (R3 && N3?.tokenOwner)
4260
+ A2.set(R3.toLowerCase(), N3.tokenOwner.toLowerCase());
4260
4261
  }
4261
- let F2 = new Map;
4262
+ let b3 = new Map;
4262
4263
  for (let N3 of C3) {
4263
- let T2 = N3.tokenOwner.toLowerCase(), P3 = A2.get(T2) ?? T2;
4264
- F2.set(P3, (F2.get(P3) ?? 0n) + N3.value);
4264
+ let R3 = N3.tokenOwner.toLowerCase(), P3 = A2.get(R3) ?? R3;
4265
+ b3.set(P3, (b3.get(P3) ?? 0n) + N3.value);
4265
4266
  }
4266
4267
  let W2 = [];
4267
- for (let [N3, T2] of F2.entries()) {
4268
- let P3 = Number(T2 / m2);
4268
+ for (let [N3, R3] of b3.entries()) {
4269
+ let P3 = Number(R3 / m2);
4269
4270
  if (P3 >= 1)
4270
4271
  W2.push({ address: N3, possibleInvites: P3 });
4271
4272
  }
4272
4273
  return this.orderRealInviters(W2, $);
4273
4274
  }
4274
4275
  async generateReferral(J) {
4275
- let $ = J.toLowerCase(), Q = h$(), G = eJ(Q), Y2 = await this.ensureInviterSetup($);
4276
- if (await this.getClaimableFreeInvites($) > 0n) {
4277
- let K = await this.generateInviteData([G], true), X2 = await this.buildFreeInviteTransactions($, K);
4278
- return { transactions: [...Y2, ...X2], privateKey: Q };
4279
- }
4280
- let M2 = await this.getRealInviters($), Z = [...Y2];
4276
+ let $ = J.toLowerCase(), Q = h$(), G = rJ(Q), Y2 = await this.ensureInviterSetup($), M2 = await this.getRealInviters($), Z = [...Y2], K = await this.generateInviteData([G], true);
4281
4277
  if (M2.length > 0) {
4282
4278
  console.log("[generateReferral] Using STANDARD PATH (proxy inviters available)");
4283
- let K = new uJ(this.config), X2 = await this.generateInviteData([G], true), q = M2[0].address, U2 = await this.findInvitePath($, q), j = await K.buildFlowMatrixTx($, this.config.invitationModuleAddress, U2, { toTokens: [q], useWrappedBalances: true, txData: A$(X2) }, true);
4279
+ let X2 = new eJ(this.config), q = M2[0].address, U2 = await this.findInvitePath($, q), j = await X2.buildFlowMatrixTx($, this.config.invitationModuleAddress, U2, { toTokens: [q], useWrappedBalances: true, txData: A$(K) }, true);
4284
4280
  Z.push(...j);
4285
- } else {
4286
- console.log("[generateReferral] Using FARM FALLBACK PATH (no proxy inviters available)");
4287
- let K = new uJ(this.config), X2 = await this.findFarmInvitePath($), q = await K.buildFlowMatrixTx($, HJ, X2, { toTokens: [o0], useWrappedBalances: true }, true);
4288
- Z.push(...q);
4289
- let U2 = await this.invitationFarm.read("claimInvite", [], { from: x8 }), j = this.invitationFarm.claimInvite();
4290
- Z.push(j);
4291
- let z2 = await this.invitationFarm.invitationModule(), V2 = this.referralsModule.createAccount(G).data, C3 = r3(["address", "bytes"], [this.config.referralsModuleAddress, V2]), D3 = this.hubV2.safeTransferFrom($, z2, U2, m2, C3);
4292
- Z.push(D3);
4293
- }
4281
+ } else
4282
+ Z.push(...await this.buildFarmOrFreeInviteTransactions($, K));
4294
4283
  return { transactions: Z, privateKey: Q };
4295
4284
  }
4296
4285
  async generateInviteData(J, $ = true) {
4297
4286
  if (J.length === 0)
4298
- throw v3.noAddressesProvided();
4287
+ throw g3.noAddressesProvided();
4299
4288
  if (!$)
4300
4289
  if (J.length === 1)
4301
- return r3(["address"], [J[0]]);
4290
+ return $J(["address"], [J[0]]);
4302
4291
  else
4303
- return r3(["address[]"], [J]);
4292
+ return $J(["address[]"], [J]);
4304
4293
  if (J.length === 1) {
4305
4294
  let G = this.referralsModule.createAccount(J[0]).data;
4306
- return r3(["address", "bytes"], [this.config.referralsModuleAddress, G]);
4295
+ return $J(["address", "bytes"], [this.config.referralsModuleAddress, G]);
4307
4296
  } else {
4308
4297
  let G = this.referralsModule.createAccounts(J).data;
4309
- return r3(["address", "bytes"], [this.config.referralsModuleAddress, G]);
4298
+ return $J(["address", "bytes"], [this.config.referralsModuleAddress, G]);
4310
4299
  }
4311
4300
  }
4312
4301
  computeAddress(J) {
@@ -4315,7 +4304,7 @@ class b8 {
4315
4304
  }
4316
4305
  generateSecrets(J) {
4317
4306
  return Array.from({ length: J }, () => {
4318
- let $ = h$(), Q = eJ($).toLowerCase();
4307
+ let $ = h$(), Q = rJ($).toLowerCase();
4319
4308
  return { secret: $, signer: Q };
4320
4309
  });
4321
4310
  }
@@ -4328,7 +4317,7 @@ class oQ {
4328
4317
  referralsModule;
4329
4318
  hubV2;
4330
4319
  constructor(J) {
4331
- this.referralsModuleAddress = J.referralsModuleAddress, this.invitations = new b8(J), this.invitationFarm = new tJ({ address: J.invitationFarmAddress, rpcUrl: J.circlesRpcUrl }), this.referralsModule = new iJ({ address: J.referralsModuleAddress, rpcUrl: J.circlesRpcUrl }), this.hubV2 = new IJ({ address: J.v2HubAddress, rpcUrl: J.circlesRpcUrl });
4320
+ this.referralsModuleAddress = J.referralsModuleAddress, this.invitations = new x8(J), this.invitationFarm = new iJ({ address: J.invitationFarmAddress, rpcUrl: J.circlesRpcUrl }), this.referralsModule = new nJ({ address: J.referralsModuleAddress, rpcUrl: J.circlesRpcUrl }), this.hubV2 = new IJ({ address: J.v2HubAddress, rpcUrl: J.circlesRpcUrl });
4332
4321
  }
4333
4322
  async getQuota(J) {
4334
4323
  return this.invitationFarm.inviterQuota(J);
@@ -4341,19 +4330,19 @@ class oQ {
4341
4330
  }
4342
4331
  async generateReferrals(J, $) {
4343
4332
  if ($ <= 0)
4344
- throw new v3("Count must be greater than 0", { code: "INVITATION_INVALID_COUNT", source: "VALIDATION", context: { count: $ } });
4333
+ throw new g3("Count must be greater than 0", { code: "INVITATION_INVALID_COUNT", source: "VALIDATION", context: { count: $ } });
4345
4334
  let Q = J.toLowerCase(), G = $ === 1, Y2 = await this.simulateClaim(Q, $);
4346
4335
  if (!Y2.length)
4347
- throw new v3("No invitation IDs returned from claim", { code: "INVITATION_NO_IDS", source: "INVITATIONS", context: { inviter: Q, count: $ } });
4336
+ throw new g3("No invitation IDs returned from claim", { code: "INVITATION_NO_IDS", source: "INVITATIONS", context: { inviter: Q, count: $ } });
4348
4337
  let M2 = this.invitations.generateSecrets($), Z = M2.map((U2) => U2.signer), K = await this.invitationFarm.invitationModule(), X2 = G ? this.invitationFarm.claimInvite() : this.invitationFarm.claimInvites(BigInt($)), q = G ? this.buildReferralTransfer(Q, K, Y2[0], Z[0]) : this.buildBatchReferralTransfer(Q, K, Y2, Z);
4349
4338
  return { referrals: M2, transactions: [X2, q] };
4350
4339
  }
4351
4340
  async generateInvites(J, $) {
4352
4341
  if ($.length === 0)
4353
- throw new v3("At least one invitee address must be provided", { code: "INVITATION_INVALID_COUNT", source: "VALIDATION", context: { count: 0 } });
4342
+ throw new g3("At least one invitee address must be provided", { code: "INVITATION_INVALID_COUNT", source: "VALIDATION", context: { count: 0 } });
4354
4343
  let Q = J.toLowerCase(), G = $.map((U2) => U2.toLowerCase()), Y2 = G.length, M2 = Y2 === 1, Z = await this.simulateClaim(Q, Y2);
4355
4344
  if (!Z.length)
4356
- throw new v3("No invitation IDs returned from claim", { code: "INVITATION_NO_IDS", source: "INVITATIONS", context: { inviter: Q, count: Y2 } });
4345
+ throw new g3("No invitation IDs returned from claim", { code: "INVITATION_NO_IDS", source: "INVITATIONS", context: { inviter: Q, count: Y2 } });
4357
4346
  let K = await this.invitationFarm.invitationModule(), X2 = M2 ? this.invitationFarm.claimInvite() : this.invitationFarm.claimInvites(BigInt(Y2)), q = M2 ? this.buildInviteTransfer(Q, K, Z[0], G[0]) : this.buildBatchInviteTransfer(Q, K, Z, G);
4358
4347
  return { invitees: G, transactions: [X2, q] };
4359
4348
  }
@@ -4366,19 +4355,19 @@ class oQ {
4366
4355
  return this.invitationFarm.read("claimInvites", [BigInt($)], { from: J });
4367
4356
  }
4368
4357
  buildReferralTransfer(J, $, Q, G) {
4369
- let Y2 = this.referralsModule.createAccount(G).data, M2 = r3(["address", "bytes"], [this.referralsModuleAddress, Y2]);
4358
+ let Y2 = this.referralsModule.createAccount(G).data, M2 = $J(["address", "bytes"], [this.referralsModuleAddress, Y2]);
4370
4359
  return this.hubV2.safeTransferFrom(J, $, Q, m2, M2);
4371
4360
  }
4372
4361
  buildBatchReferralTransfer(J, $, Q, G) {
4373
- let Y2 = this.referralsModule.createAccounts(G).data, M2 = r3(["address", "bytes"], [this.referralsModuleAddress, Y2]), Z = Q.map(() => m2);
4362
+ let Y2 = this.referralsModule.createAccounts(G).data, M2 = $J(["address", "bytes"], [this.referralsModuleAddress, Y2]), Z = Q.map(() => m2);
4374
4363
  return this.hubV2.safeBatchTransferFrom(J, $, Q, Z, M2);
4375
4364
  }
4376
4365
  buildInviteTransfer(J, $, Q, G) {
4377
- let Y2 = r3(["address"], [G]);
4366
+ let Y2 = $J(["address"], [G]);
4378
4367
  return this.hubV2.safeTransferFrom(J, $, Q, m2, Y2);
4379
4368
  }
4380
4369
  buildBatchInviteTransfer(J, $, Q, G) {
4381
- let Y2 = r3(["address[]"], [G]), M2 = Q.map(() => m2);
4370
+ let Y2 = $J(["address[]"], [G]), M2 = Q.map(() => m2);
4382
4371
  return this.hubV2.safeBatchTransferFrom(J, $, Q, M2, Y2);
4383
4372
  }
4384
4373
  }
@@ -4391,7 +4380,7 @@ class F8 {
4391
4380
  this.address = J.address, this.abi = J.abi, this.rpcUrl = J.rpcUrl;
4392
4381
  }
4393
4382
  async read(J, $, Q) {
4394
- let G = BJ({ abi: this.abi, functionName: J, args: $ }), Y2 = { to: this.address, data: G, ...Q?.from && { from: Q.from } }, Z = await (await fetch(this.rpcUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "eth_call", params: [Y2, "latest"] }) })).json();
4383
+ let G = LJ({ abi: this.abi, functionName: J, args: $ }), Y2 = { to: this.address, data: G, ...Q?.from && { from: Q.from } }, Z = await (await fetch(this.rpcUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "eth_call", params: [Y2, "latest"] }) })).json();
4395
4384
  if (Z.error)
4396
4385
  throw Error(`RPC Error: ${Z.error.message}`);
4397
4386
  if (!Z.result)
@@ -4399,14 +4388,14 @@ class F8 {
4399
4388
  return Z$({ abi: this.abi, functionName: J, data: Z.result });
4400
4389
  }
4401
4390
  encodeWrite(J, $) {
4402
- return BJ({ abi: this.abi, functionName: J, args: $ });
4391
+ return LJ({ abi: this.abi, functionName: J, args: $ });
4403
4392
  }
4404
4393
  }
4405
- var a0 = [{ type: "constructor", inputs: [{ name: "invitationModule", type: "address", internalType: "address" }], stateMutability: "nonpayable" }, { type: "function", name: "AFFILIATE_GROUP_REGISTRY", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "DOMAIN_SEPARATOR", inputs: [], outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], stateMutability: "view" }, { type: "function", name: "GENERIC_CALL_PROXY", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "HUB", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "INVITATION_MODULE", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "NAME_REGISTRY", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "SAFE_4337_MODULE", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "SAFE_MODULE_SETUP", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "SAFE_PROXY_FACTORY", inputs: [], outputs: [{ name: "", type: "address", internalType: "contract ISafeProxyFactory" }], stateMutability: "view" }, { type: "function", name: "SAFE_SINGLETON", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "SAFE_WEB_AUTHN_SHARED_SIGNER", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "WELCOME_BONUS", inputs: [], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "accounts", inputs: [{ name: "signer", type: "address", internalType: "address" }], outputs: [{ name: "account", type: "address", internalType: "address" }, { name: "claimed", type: "bool", internalType: "bool" }], stateMutability: "view" }, { type: "function", name: "claimAccount", inputs: [{ name: "x", type: "uint256", internalType: "uint256" }, { name: "y", type: "uint256", internalType: "uint256" }, { name: "verifier", type: "address", internalType: "address" }, { name: "signature", type: "bytes", internalType: "bytes" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "claimAccount", inputs: [{ name: "x", type: "uint256", internalType: "uint256" }, { name: "y", type: "uint256", internalType: "uint256" }, { name: "verifier", type: "address", internalType: "address" }, { name: "signature", type: "bytes", internalType: "bytes" }, { name: "metadataDigest", type: "bytes32", internalType: "bytes32" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "claimAccount", inputs: [{ name: "x", type: "uint256", internalType: "uint256" }, { name: "y", type: "uint256", internalType: "uint256" }, { name: "verifier", type: "address", internalType: "address" }, { name: "signature", type: "bytes", internalType: "bytes" }, { name: "affiliateGroup", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "claimAccount", inputs: [{ name: "x", type: "uint256", internalType: "uint256" }, { name: "y", type: "uint256", internalType: "uint256" }, { name: "verifier", type: "address", internalType: "address" }, { name: "signature", type: "bytes", internalType: "bytes" }, { name: "metadataDigest", type: "bytes32", internalType: "bytes32" }, { name: "affiliateGroup", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "computeAddress", inputs: [{ name: "signer", type: "address", internalType: "address" }], outputs: [{ name: "predictedAddress", type: "address", internalType: "address" }], stateMutability: "pure" }, { type: "function", name: "createAccount", inputs: [{ name: "signer", type: "address", internalType: "address" }], outputs: [{ name: "account", type: "address", internalType: "address" }], stateMutability: "nonpayable" }, { type: "function", name: "createAccounts", inputs: [{ name: "signers", type: "address[]", internalType: "address[]" }], outputs: [{ name: "_accounts", type: "address[]", internalType: "address[]" }], stateMutability: "nonpayable" }, { type: "function", name: "encodePasskeyData", inputs: [{ name: "x", type: "uint256", internalType: "uint256" }, { name: "y", type: "uint256", internalType: "uint256" }, { name: "verifier", type: "address", internalType: "address" }], outputs: [{ name: "", type: "bytes", internalType: "bytes" }], stateMutability: "view" }, { type: "function", name: "getPasskeyHash", inputs: [{ name: "x", type: "uint256", internalType: "uint256" }, { name: "y", type: "uint256", internalType: "uint256" }, { name: "verifier", type: "address", internalType: "address" }], outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], stateMutability: "view" }, { type: "event", name: "AccountClaimed", inputs: [{ name: "account", type: "address", indexed: true, internalType: "address" }], anonymous: false }, { type: "event", name: "AccountCreated", inputs: [{ name: "account", type: "address", indexed: true, internalType: "address" }], anonymous: false }, { type: "error", name: "AccountAlreadyClaimed", inputs: [] }, { type: "error", name: "InvalidSignature", inputs: [] }, { type: "error", name: "OnlyGenericCallProxy", inputs: [] }, { type: "error", name: "SignerAlreadyUsed", inputs: [] }];
4394
+ var o0 = [{ type: "constructor", inputs: [{ name: "invitationModule", type: "address", internalType: "address" }], stateMutability: "nonpayable" }, { type: "function", name: "AFFILIATE_GROUP_REGISTRY", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "DOMAIN_SEPARATOR", inputs: [], outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], stateMutability: "view" }, { type: "function", name: "GENERIC_CALL_PROXY", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "HUB", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "INVITATION_MODULE", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "NAME_REGISTRY", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "SAFE_4337_MODULE", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "SAFE_MODULE_SETUP", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "SAFE_PROXY_FACTORY", inputs: [], outputs: [{ name: "", type: "address", internalType: "contract ISafeProxyFactory" }], stateMutability: "view" }, { type: "function", name: "SAFE_SINGLETON", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "SAFE_WEB_AUTHN_SHARED_SIGNER", inputs: [], outputs: [{ name: "", type: "address", internalType: "address" }], stateMutability: "view" }, { type: "function", name: "WELCOME_BONUS", inputs: [], outputs: [{ name: "", type: "uint256", internalType: "uint256" }], stateMutability: "view" }, { type: "function", name: "accounts", inputs: [{ name: "signer", type: "address", internalType: "address" }], outputs: [{ name: "account", type: "address", internalType: "address" }, { name: "claimed", type: "bool", internalType: "bool" }], stateMutability: "view" }, { type: "function", name: "claimAccount", inputs: [{ name: "x", type: "uint256", internalType: "uint256" }, { name: "y", type: "uint256", internalType: "uint256" }, { name: "verifier", type: "address", internalType: "address" }, { name: "signature", type: "bytes", internalType: "bytes" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "claimAccount", inputs: [{ name: "x", type: "uint256", internalType: "uint256" }, { name: "y", type: "uint256", internalType: "uint256" }, { name: "verifier", type: "address", internalType: "address" }, { name: "signature", type: "bytes", internalType: "bytes" }, { name: "metadataDigest", type: "bytes32", internalType: "bytes32" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "claimAccount", inputs: [{ name: "x", type: "uint256", internalType: "uint256" }, { name: "y", type: "uint256", internalType: "uint256" }, { name: "verifier", type: "address", internalType: "address" }, { name: "signature", type: "bytes", internalType: "bytes" }, { name: "affiliateGroup", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "claimAccount", inputs: [{ name: "x", type: "uint256", internalType: "uint256" }, { name: "y", type: "uint256", internalType: "uint256" }, { name: "verifier", type: "address", internalType: "address" }, { name: "signature", type: "bytes", internalType: "bytes" }, { name: "metadataDigest", type: "bytes32", internalType: "bytes32" }, { name: "affiliateGroup", type: "address", internalType: "address" }], outputs: [], stateMutability: "nonpayable" }, { type: "function", name: "computeAddress", inputs: [{ name: "signer", type: "address", internalType: "address" }], outputs: [{ name: "predictedAddress", type: "address", internalType: "address" }], stateMutability: "pure" }, { type: "function", name: "createAccount", inputs: [{ name: "signer", type: "address", internalType: "address" }], outputs: [{ name: "account", type: "address", internalType: "address" }], stateMutability: "nonpayable" }, { type: "function", name: "createAccounts", inputs: [{ name: "signers", type: "address[]", internalType: "address[]" }], outputs: [{ name: "_accounts", type: "address[]", internalType: "address[]" }], stateMutability: "nonpayable" }, { type: "function", name: "encodePasskeyData", inputs: [{ name: "x", type: "uint256", internalType: "uint256" }, { name: "y", type: "uint256", internalType: "uint256" }, { name: "verifier", type: "address", internalType: "address" }], outputs: [{ name: "", type: "bytes", internalType: "bytes" }], stateMutability: "view" }, { type: "function", name: "getPasskeyHash", inputs: [{ name: "x", type: "uint256", internalType: "uint256" }, { name: "y", type: "uint256", internalType: "uint256" }, { name: "verifier", type: "address", internalType: "address" }], outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], stateMutability: "view" }, { type: "event", name: "AccountClaimed", inputs: [{ name: "account", type: "address", indexed: true, internalType: "address" }], anonymous: false }, { type: "event", name: "AccountCreated", inputs: [{ name: "account", type: "address", indexed: true, internalType: "address" }], anonymous: false }, { type: "error", name: "AccountAlreadyClaimed", inputs: [] }, { type: "error", name: "InvalidSignature", inputs: [] }, { type: "error", name: "OnlyGenericCallProxy", inputs: [] }, { type: "error", name: "SignerAlreadyUsed", inputs: [] }];
4406
4395
 
4407
- class f8 extends F8 {
4396
+ class b8 extends F8 {
4408
4397
  constructor(J) {
4409
- super({ address: J.address, abi: a0, rpcUrl: J.rpcUrl });
4398
+ super({ address: J.address, abi: o0, rpcUrl: J.rpcUrl });
4410
4399
  }
4411
4400
  createAccount(J) {
4412
4401
  return { to: this.address, data: this.encodeWrite("createAccount", [J]), value: BigInt(0) };
@@ -4478,7 +4467,7 @@ class aQ {
4478
4467
  constructor(J, $, Q, G) {
4479
4468
  this.baseUrl = J;
4480
4469
  this.getToken = G;
4481
- this.referralsModule = new f8({ address: $, rpcUrl: Q });
4470
+ this.referralsModule = new b8({ address: $, rpcUrl: Q });
4482
4471
  }
4483
4472
  getBaseUrl() {
4484
4473
  return this.baseUrl.endsWith("/") ? this.baseUrl.slice(0, -1) : this.baseUrl;
@@ -4506,14 +4495,14 @@ class aQ {
4506
4495
  return $.json();
4507
4496
  }
4508
4497
  async retrieve(J) {
4509
- let $ = eJ(J), { account: Q, claimed: G } = await this.referralsModule.accounts($), Y2 = await fetch(`${this.getBaseUrl()}/retrieve?key=${encodeURIComponent(J)}`);
4498
+ let $ = rJ(J), { account: Q, claimed: G } = await this.referralsModule.accounts($), Y2 = await fetch(`${this.getBaseUrl()}/retrieve?key=${encodeURIComponent(J)}`);
4510
4499
  if (Y2.ok || Y2.status === 410 || G) {
4511
4500
  let Z = await Y2.json();
4512
- if (Q === LJ)
4501
+ if (Q === BJ)
4513
4502
  return { ...Z, error: `Referral not found on-chain for signer ${$}` };
4514
4503
  return Z;
4515
4504
  }
4516
- if (Q === LJ)
4505
+ if (Q === BJ)
4517
4506
  return { error: `Referral not found on-chain for signer ${$}` };
4518
4507
  let M2 = await Y2.json().catch(() => null);
4519
4508
  throw o3.retrieveFailed(M2?.error || Y2.statusText, Y2.status);
@@ -4855,37 +4844,37 @@ var LJ2 = (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)(
4855
4844
  function PJ(J) {
4856
4845
  return J << 24 & 4278190080 | J << 8 & 16711680 | J >>> 8 & 65280 | J >>> 24 & 255;
4857
4846
  }
4858
- function RJ2(J) {
4847
+ function RJ(J) {
4859
4848
  for (let Z = 0;Z < J.length; Z++)
4860
4849
  J[Z] = PJ(J[Z]);
4861
4850
  return J;
4862
4851
  }
4863
- var p3 = LJ2 ? (J) => J : RJ2;
4852
+ var p3 = LJ2 ? (J) => J : RJ;
4864
4853
  function e3(J, Z = {}) {
4865
4854
  let $ = (W2, G) => J(G).update(W2).digest(), Y2 = J(undefined);
4866
4855
  return $.outputLen = Y2.outputLen, $.blockLen = Y2.blockLen, $.create = (W2) => J(W2), Object.assign($, Z), Object.freeze($);
4867
4856
  }
4868
4857
  var _J2 = BigInt(0);
4869
4858
  var j = BigInt(1);
4870
- var TJ = BigInt(2);
4859
+ var TJ2 = BigInt(2);
4871
4860
  var zJ2 = BigInt(7);
4872
4861
  var CJ = BigInt(256);
4873
4862
  var EJ2 = BigInt(113);
4874
- var $J = [];
4863
+ var $J2 = [];
4875
4864
  var YJ = [];
4876
4865
  var WJ2 = [];
4877
4866
  for (let J = 0, Z = j, $ = 1, Y2 = 0;J < 24; J++) {
4878
- [$, Y2] = [Y2, (2 * $ + 3 * Y2) % 5], $J.push(2 * (5 * Y2 + $)), YJ.push((J + 1) * (J + 2) / 2 % 64);
4867
+ [$, Y2] = [Y2, (2 * $ + 3 * Y2) % 5], $J2.push(2 * (5 * Y2 + $)), YJ.push((J + 1) * (J + 2) / 2 % 64);
4879
4868
  let W2 = _J2;
4880
4869
  for (let G = 0;G < 7; G++)
4881
- if (Z = (Z << j ^ (Z >> zJ2) * EJ2) % CJ, Z & TJ)
4870
+ if (Z = (Z << j ^ (Z >> zJ2) * EJ2) % CJ, Z & TJ2)
4882
4871
  W2 ^= j << (j << BigInt(G)) - j;
4883
4872
  WJ2.push(W2);
4884
4873
  }
4885
4874
  var GJ = i2(WJ2, true);
4886
4875
  var BJ2 = GJ[0];
4887
4876
  var SJ2 = GJ[1];
4888
- var JJ2 = (J, Z, $) => $ > 32 ? t3(J, Z, $) : n3(J, Z, $);
4877
+ var JJ = (J, Z, $) => $ > 32 ? t3(J, Z, $) : n3(J, Z, $);
4889
4878
  var ZJ = (J, Z, $) => $ > 32 ? a2(J, Z, $) : o4(J, Z, $);
4890
4879
  function wJ2(J, Z = 24) {
4891
4880
  let $ = new Uint32Array(10);
@@ -4893,13 +4882,13 @@ function wJ2(J, Z = 24) {
4893
4882
  for (let Q = 0;Q < 10; Q++)
4894
4883
  $[Q] = J[Q] ^ J[Q + 10] ^ J[Q + 20] ^ J[Q + 30] ^ J[Q + 40];
4895
4884
  for (let Q = 0;Q < 10; Q += 2) {
4896
- let M2 = (Q + 8) % 10, F2 = (Q + 2) % 10, O3 = $[F2], U2 = $[F2 + 1], UJ2 = JJ2(O3, U2, 1) ^ $[M2], NJ2 = ZJ(O3, U2, 1) ^ $[M2 + 1];
4885
+ let M2 = (Q + 8) % 10, F2 = (Q + 2) % 10, O3 = $[F2], U2 = $[F2 + 1], UJ2 = JJ(O3, U2, 1) ^ $[M2], NJ2 = ZJ(O3, U2, 1) ^ $[M2 + 1];
4897
4886
  for (let w3 = 0;w3 < 50; w3 += 10)
4898
4887
  J[Q + w3] ^= UJ2, J[Q + w3 + 1] ^= NJ2;
4899
4888
  }
4900
4889
  let W2 = J[2], G = J[3];
4901
4890
  for (let Q = 0;Q < 24; Q++) {
4902
- let M2 = YJ[Q], F2 = JJ2(W2, G, M2), O3 = ZJ(W2, G, M2), U2 = $J[Q];
4891
+ let M2 = YJ[Q], F2 = JJ(W2, G, M2), O3 = ZJ(W2, G, M2), U2 = $J2[Q];
4903
4892
  W2 = J[U2], G = J[U2 + 1], J[U2] = F2, J[U2 + 1] = O3;
4904
4893
  }
4905
4894
  for (let Q = 0;Q < 50; Q += 10) {
@@ -11711,7 +11700,7 @@ class HumanAvatar extends CommonAvatar {
11711
11700
  throw SdkError.unsupportedOperation("getTotalSupply", "This method is not yet implemented");
11712
11701
  }
11713
11702
  };
11714
- _invitations = new b8(this.core.config);
11703
+ _invitations = new x8(this.core.config);
11715
11704
  _inviteFarm = new oQ(this.core.config);
11716
11705
  invitation = {
11717
11706
  getReferralCode: async () => {