@toon-protocol/townhouse 0.7.0 → 0.9.0

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.
@@ -25,6 +25,7 @@ import {
25
25
  u32
26
26
  } from "./chunk-5O4SBV5O.js";
27
27
  import {
28
+ ACCOUNT_INDEX_APEX,
28
29
  ACCOUNT_INDEX_DVM,
29
30
  ACCOUNT_INDEX_MILL,
30
31
  ACCOUNT_INDEX_TOWN,
@@ -34,7 +35,7 @@ import {
34
35
  MILL_HEALTH_PORT,
35
36
  NODE_BTP_PORT,
36
37
  TOWN_HEALTH_PORT
37
- } from "./chunk-NZR5C3KD.js";
38
+ } from "./chunk-BLNEL3QS.js";
38
39
  import {
39
40
  __commonJS,
40
41
  __require,
@@ -6489,11 +6490,13 @@ function validateConfig(raw) {
6489
6490
  `${path}.tokenAddress must match /^0x[a-fA-F0-9]+$/`
6490
6491
  );
6491
6492
  }
6492
- assertString(entry["keyId"], `${path}.keyId`);
6493
- if (!HEX_ADDRESS.test(entry["keyId"])) {
6494
- throw new ConfigValidationError(
6495
- `${path}.keyId must match /^0x[a-fA-F0-9]+$/`
6496
- );
6493
+ if (entry["keyId"] !== void 0) {
6494
+ assertString(entry["keyId"], `${path}.keyId`);
6495
+ if (!HEX_ADDRESS.test(entry["keyId"])) {
6496
+ throw new ConfigValidationError(
6497
+ `${path}.keyId must match /^0x[a-fA-F0-9]+$/`
6498
+ );
6499
+ }
6497
6500
  }
6498
6501
  return {
6499
6502
  chainType: "evm",
@@ -6501,13 +6504,15 @@ function validateConfig(raw) {
6501
6504
  rpcUrl: entry["rpcUrl"],
6502
6505
  registryAddress: entry["registryAddress"],
6503
6506
  tokenAddress: entry["tokenAddress"],
6504
- keyId: entry["keyId"]
6507
+ ...entry["keyId"] !== void 0 ? { keyId: entry["keyId"] } : {}
6505
6508
  };
6506
6509
  }
6507
6510
  if (chainType === "solana") {
6508
6511
  assertString(entry["rpcUrl"], `${path}.rpcUrl`);
6509
6512
  assertString(entry["programId"], `${path}.programId`);
6510
- assertString(entry["keyId"], `${path}.keyId`);
6513
+ if (entry["keyId"] !== void 0) {
6514
+ assertString(entry["keyId"], `${path}.keyId`);
6515
+ }
6511
6516
  if (entry["wsUrl"] !== void 0) {
6512
6517
  assertString(entry["wsUrl"], `${path}.wsUrl`);
6513
6518
  }
@@ -6521,7 +6526,7 @@ function validateConfig(raw) {
6521
6526
  ...entry["wsUrl"] !== void 0 ? { wsUrl: entry["wsUrl"] } : {},
6522
6527
  programId: entry["programId"],
6523
6528
  ...entry["tokenMint"] !== void 0 ? { tokenMint: entry["tokenMint"] } : {},
6524
- keyId: entry["keyId"]
6529
+ ...entry["keyId"] !== void 0 ? { keyId: entry["keyId"] } : {}
6525
6530
  };
6526
6531
  }
6527
6532
  assertString(entry["graphqlUrl"], `${path}.graphqlUrl`);
@@ -6809,7 +6814,7 @@ var ConnectorConfigGenerator = class {
6809
6814
  rpcUrl: p.rpcUrl,
6810
6815
  registryAddress: p.registryAddress,
6811
6816
  tokenAddress: p.tokenAddress,
6812
- keyId: p.keyId
6817
+ ...p.keyId !== void 0 ? { keyId: p.keyId } : {}
6813
6818
  };
6814
6819
  }
6815
6820
  if (p.chainType === "solana") {
@@ -6820,7 +6825,7 @@ var ConnectorConfigGenerator = class {
6820
6825
  ...p.wsUrl !== void 0 ? { wsUrl: p.wsUrl } : {},
6821
6826
  programId: p.programId,
6822
6827
  ...p.tokenMint !== void 0 ? { tokenMint: p.tokenMint } : {},
6823
- keyId: p.keyId
6828
+ ...p.keyId !== void 0 ? { keyId: p.keyId } : {}
6824
6829
  };
6825
6830
  }
6826
6831
  return {
@@ -8754,9 +8759,45 @@ var import_websocket_server = __toESM(require_websocket_server(), 1);
8754
8759
 
8755
8760
  // ../core/dist/index.js
8756
8761
  import { getPublicKey as getPublicKey2, verifyEvent } from "nostr-tools/pure";
8757
- import { SimplePool as SimplePool3 } from "nostr-tools/pool";
8758
- import { getPublicKey as getPublicKey3 } from "nostr-tools/pure";
8759
- import { getPublicKey as getPublicKey4 } from "nostr-tools/pure";
8762
+
8763
+ // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_u64.js
8764
+ var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
8765
+ var _32n = /* @__PURE__ */ BigInt(32);
8766
+ function fromBig(n, le = false) {
8767
+ if (le)
8768
+ return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
8769
+ return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
8770
+ }
8771
+ function split2(lst, le = false) {
8772
+ const len = lst.length;
8773
+ let Ah = new Uint32Array(len);
8774
+ let Al = new Uint32Array(len);
8775
+ for (let i = 0; i < len; i++) {
8776
+ const { h, l } = fromBig(lst[i], le);
8777
+ [Ah[i], Al[i]] = [h, l];
8778
+ }
8779
+ return [Ah, Al];
8780
+ }
8781
+ var shrSH = (h, _l, s) => h >>> s;
8782
+ var shrSL = (h, l, s) => h << 32 - s | l >>> s;
8783
+ var rotrSH = (h, l, s) => h >>> s | l << 32 - s;
8784
+ var rotrSL = (h, l, s) => h << 32 - s | l >>> s;
8785
+ var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
8786
+ var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
8787
+ var rotlSH2 = (h, l, s) => h << s | l >>> 32 - s;
8788
+ var rotlSL2 = (h, l, s) => l << s | h >>> 32 - s;
8789
+ var rotlBH2 = (h, l, s) => l << s - 32 | h >>> 64 - s;
8790
+ var rotlBL2 = (h, l, s) => h << s - 32 | l >>> 64 - s;
8791
+ function add(Ah, Al, Bh, Bl) {
8792
+ const l = (Al >>> 0) + (Bl >>> 0);
8793
+ return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
8794
+ }
8795
+ var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
8796
+ var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
8797
+ var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
8798
+ var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
8799
+ var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
8800
+ var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
8760
8801
 
8761
8802
  // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/utils.js
8762
8803
  function isBytes2(a) {
@@ -8923,121 +8964,190 @@ var oidNist = (suffix) => ({
8923
8964
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, suffix])
8924
8965
  });
8925
8966
 
8926
- // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/hmac.js
8927
- var _HMAC = class {
8928
- oHash;
8929
- iHash;
8930
- blockLen;
8931
- outputLen;
8967
+ // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/sha3.js
8968
+ var _0n = BigInt(0);
8969
+ var _1n = BigInt(1);
8970
+ var _2n = BigInt(2);
8971
+ var _7n = BigInt(7);
8972
+ var _256n = BigInt(256);
8973
+ var _0x71n = BigInt(113);
8974
+ var SHA3_PI = [];
8975
+ var SHA3_ROTL = [];
8976
+ var _SHA3_IOTA = [];
8977
+ for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
8978
+ [x, y] = [y, (2 * x + 3 * y) % 5];
8979
+ SHA3_PI.push(2 * (5 * y + x));
8980
+ SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
8981
+ let t = _0n;
8982
+ for (let j = 0; j < 7; j++) {
8983
+ R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
8984
+ if (R & _2n)
8985
+ t ^= _1n << (_1n << BigInt(j)) - _1n;
8986
+ }
8987
+ _SHA3_IOTA.push(t);
8988
+ }
8989
+ var IOTAS = split2(_SHA3_IOTA, true);
8990
+ var SHA3_IOTA_H = IOTAS[0];
8991
+ var SHA3_IOTA_L = IOTAS[1];
8992
+ var rotlH = (h, l, s) => s > 32 ? rotlBH2(h, l, s) : rotlSH2(h, l, s);
8993
+ var rotlL = (h, l, s) => s > 32 ? rotlBL2(h, l, s) : rotlSL2(h, l, s);
8994
+ function keccakP(s, rounds = 24) {
8995
+ const B = new Uint32Array(5 * 2);
8996
+ for (let round = 24 - rounds; round < 24; round++) {
8997
+ for (let x = 0; x < 10; x++)
8998
+ B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
8999
+ for (let x = 0; x < 10; x += 2) {
9000
+ const idx1 = (x + 8) % 10;
9001
+ const idx0 = (x + 2) % 10;
9002
+ const B0 = B[idx0];
9003
+ const B1 = B[idx0 + 1];
9004
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
9005
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
9006
+ for (let y = 0; y < 50; y += 10) {
9007
+ s[x + y] ^= Th;
9008
+ s[x + y + 1] ^= Tl;
9009
+ }
9010
+ }
9011
+ let curH = s[2];
9012
+ let curL = s[3];
9013
+ for (let t = 0; t < 24; t++) {
9014
+ const shift = SHA3_ROTL[t];
9015
+ const Th = rotlH(curH, curL, shift);
9016
+ const Tl = rotlL(curH, curL, shift);
9017
+ const PI = SHA3_PI[t];
9018
+ curH = s[PI];
9019
+ curL = s[PI + 1];
9020
+ s[PI] = Th;
9021
+ s[PI + 1] = Tl;
9022
+ }
9023
+ for (let y = 0; y < 50; y += 10) {
9024
+ for (let x = 0; x < 10; x++)
9025
+ B[x] = s[y + x];
9026
+ for (let x = 0; x < 10; x++)
9027
+ s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
9028
+ }
9029
+ s[0] ^= SHA3_IOTA_H[round];
9030
+ s[1] ^= SHA3_IOTA_L[round];
9031
+ }
9032
+ clean2(B);
9033
+ }
9034
+ var Keccak = class _Keccak {
9035
+ state;
9036
+ pos = 0;
9037
+ posOut = 0;
8932
9038
  finished = false;
9039
+ state32;
8933
9040
  destroyed = false;
8934
- constructor(hash, key) {
8935
- ahash2(hash);
8936
- abytes2(key, void 0, "key");
8937
- this.iHash = hash.create();
8938
- if (typeof this.iHash.update !== "function")
8939
- throw new Error("Expected instance of class which extends utils.Hash");
8940
- this.blockLen = this.iHash.blockLen;
8941
- this.outputLen = this.iHash.outputLen;
8942
- const blockLen = this.blockLen;
8943
- const pad = new Uint8Array(blockLen);
8944
- pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
8945
- for (let i = 0; i < pad.length; i++)
8946
- pad[i] ^= 54;
8947
- this.iHash.update(pad);
8948
- this.oHash = hash.create();
8949
- for (let i = 0; i < pad.length; i++)
8950
- pad[i] ^= 54 ^ 92;
8951
- this.oHash.update(pad);
8952
- clean2(pad);
9041
+ blockLen;
9042
+ suffix;
9043
+ outputLen;
9044
+ enableXOF = false;
9045
+ rounds;
9046
+ // NOTE: we accept arguments in bytes instead of bits here.
9047
+ constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
9048
+ this.blockLen = blockLen;
9049
+ this.suffix = suffix;
9050
+ this.outputLen = outputLen;
9051
+ this.enableXOF = enableXOF;
9052
+ this.rounds = rounds;
9053
+ anumber2(outputLen, "outputLen");
9054
+ if (!(0 < blockLen && blockLen < 200))
9055
+ throw new Error("only keccak-f1600 function is supported");
9056
+ this.state = new Uint8Array(200);
9057
+ this.state32 = u322(this.state);
8953
9058
  }
8954
- update(buf) {
9059
+ clone() {
9060
+ return this._cloneInto();
9061
+ }
9062
+ keccak() {
9063
+ swap32IfBE2(this.state32);
9064
+ keccakP(this.state32, this.rounds);
9065
+ swap32IfBE2(this.state32);
9066
+ this.posOut = 0;
9067
+ this.pos = 0;
9068
+ }
9069
+ update(data) {
8955
9070
  aexists2(this);
8956
- this.iHash.update(buf);
9071
+ abytes2(data);
9072
+ const { blockLen, state } = this;
9073
+ const len = data.length;
9074
+ for (let pos = 0; pos < len; ) {
9075
+ const take = Math.min(blockLen - this.pos, len - pos);
9076
+ for (let i = 0; i < take; i++)
9077
+ state[this.pos++] ^= data[pos++];
9078
+ if (this.pos === blockLen)
9079
+ this.keccak();
9080
+ }
8957
9081
  return this;
8958
9082
  }
8959
- digestInto(out) {
8960
- aexists2(this);
8961
- abytes2(out, this.outputLen, "output");
9083
+ finish() {
9084
+ if (this.finished)
9085
+ return;
8962
9086
  this.finished = true;
8963
- this.iHash.digestInto(out);
8964
- this.oHash.update(out);
8965
- this.oHash.digestInto(out);
8966
- this.destroy();
9087
+ const { state, suffix, pos, blockLen } = this;
9088
+ state[pos] ^= suffix;
9089
+ if ((suffix & 128) !== 0 && pos === blockLen - 1)
9090
+ this.keccak();
9091
+ state[blockLen - 1] ^= 128;
9092
+ this.keccak();
8967
9093
  }
8968
- digest() {
8969
- const out = new Uint8Array(this.oHash.outputLen);
8970
- this.digestInto(out);
9094
+ writeInto(out) {
9095
+ aexists2(this, false);
9096
+ abytes2(out);
9097
+ this.finish();
9098
+ const bufferOut = this.state;
9099
+ const { blockLen } = this;
9100
+ for (let pos = 0, len = out.length; pos < len; ) {
9101
+ if (this.posOut >= blockLen)
9102
+ this.keccak();
9103
+ const take = Math.min(blockLen - this.posOut, len - pos);
9104
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
9105
+ this.posOut += take;
9106
+ pos += take;
9107
+ }
8971
9108
  return out;
8972
9109
  }
8973
- _cloneInto(to) {
8974
- to ||= Object.create(Object.getPrototypeOf(this), {});
8975
- const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
8976
- to = to;
8977
- to.finished = finished;
8978
- to.destroyed = destroyed;
8979
- to.blockLen = blockLen;
8980
- to.outputLen = outputLen;
8981
- to.oHash = oHash._cloneInto(to.oHash);
8982
- to.iHash = iHash._cloneInto(to.iHash);
8983
- return to;
8984
- }
8985
- clone() {
8986
- return this._cloneInto();
8987
- }
8988
- destroy() {
8989
- this.destroyed = true;
8990
- this.oHash.destroy();
8991
- this.iHash.destroy();
8992
- }
8993
- };
8994
- var hmac2 = (hash, key, message) => new _HMAC(hash, key).update(message).digest();
8995
- hmac2.create = (hash, key) => new _HMAC(hash, key);
8996
-
8997
- // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/pbkdf2.js
8998
- function pbkdf2Init(hash, _password, _salt, _opts) {
8999
- ahash2(hash);
9000
- const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
9001
- const { c, dkLen, asyncTick } = opts;
9002
- anumber2(c, "c");
9003
- anumber2(dkLen, "dkLen");
9004
- anumber2(asyncTick, "asyncTick");
9005
- if (c < 1)
9006
- throw new Error("iterations (c) must be >= 1");
9007
- const password = kdfInputToBytes(_password, "password");
9008
- const salt = kdfInputToBytes(_salt, "salt");
9009
- const DK = new Uint8Array(dkLen);
9010
- const PRF = hmac2.create(hash, password);
9011
- const PRFSalt = PRF._cloneInto().update(salt);
9012
- return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
9013
- }
9014
- function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {
9015
- PRF.destroy();
9016
- PRFSalt.destroy();
9017
- if (prfW)
9018
- prfW.destroy();
9019
- clean2(u);
9020
- return DK;
9021
- }
9022
- function pbkdf2(hash, password, salt, opts) {
9023
- const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
9024
- let prfW;
9025
- const arr = new Uint8Array(4);
9026
- const view = createView(arr);
9027
- const u = new Uint8Array(PRF.outputLen);
9028
- for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
9029
- const Ti = DK.subarray(pos, pos + PRF.outputLen);
9030
- view.setInt32(0, ti, false);
9031
- (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
9032
- Ti.set(u.subarray(0, Ti.length));
9033
- for (let ui = 1; ui < c; ui++) {
9034
- PRF._cloneInto(prfW).update(u).digestInto(u);
9035
- for (let i = 0; i < Ti.length; i++)
9036
- Ti[i] ^= u[i];
9037
- }
9110
+ xofInto(out) {
9111
+ if (!this.enableXOF)
9112
+ throw new Error("XOF is not possible for this instance");
9113
+ return this.writeInto(out);
9038
9114
  }
9039
- return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
9040
- }
9115
+ xof(bytes) {
9116
+ anumber2(bytes);
9117
+ return this.xofInto(new Uint8Array(bytes));
9118
+ }
9119
+ digestInto(out) {
9120
+ aoutput2(out, this);
9121
+ if (this.finished)
9122
+ throw new Error("digest() was already called");
9123
+ this.writeInto(out);
9124
+ this.destroy();
9125
+ return out;
9126
+ }
9127
+ digest() {
9128
+ return this.digestInto(new Uint8Array(this.outputLen));
9129
+ }
9130
+ destroy() {
9131
+ this.destroyed = true;
9132
+ clean2(this.state);
9133
+ }
9134
+ _cloneInto(to) {
9135
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
9136
+ to ||= new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds);
9137
+ to.state32.set(this.state32);
9138
+ to.pos = this.pos;
9139
+ to.posOut = this.posOut;
9140
+ to.finished = this.finished;
9141
+ to.rounds = rounds;
9142
+ to.suffix = suffix;
9143
+ to.outputLen = outputLen;
9144
+ to.enableXOF = enableXOF;
9145
+ to.destroyed = this.destroyed;
9146
+ return to;
9147
+ }
9148
+ };
9149
+ var genKeccak = (suffix, blockLen, outputLen, info = {}) => createHasher2(() => new Keccak(blockLen, suffix, outputLen), info);
9150
+ var keccak_256 = /* @__PURE__ */ genKeccak(1, 136, 32);
9041
9151
 
9042
9152
  // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_md.js
9043
9153
  function Chi(a, b, c) {
@@ -9170,45 +9280,6 @@ var SHA512_IV = /* @__PURE__ */ Uint32Array.from([
9170
9280
  327033209
9171
9281
  ]);
9172
9282
 
9173
- // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_u64.js
9174
- var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
9175
- var _32n = /* @__PURE__ */ BigInt(32);
9176
- function fromBig(n, le = false) {
9177
- if (le)
9178
- return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
9179
- return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
9180
- }
9181
- function split2(lst, le = false) {
9182
- const len = lst.length;
9183
- let Ah = new Uint32Array(len);
9184
- let Al = new Uint32Array(len);
9185
- for (let i = 0; i < len; i++) {
9186
- const { h, l } = fromBig(lst[i], le);
9187
- [Ah[i], Al[i]] = [h, l];
9188
- }
9189
- return [Ah, Al];
9190
- }
9191
- var shrSH = (h, _l, s) => h >>> s;
9192
- var shrSL = (h, l, s) => h << 32 - s | l >>> s;
9193
- var rotrSH = (h, l, s) => h >>> s | l << 32 - s;
9194
- var rotrSL = (h, l, s) => h << 32 - s | l >>> s;
9195
- var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
9196
- var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
9197
- var rotlSH2 = (h, l, s) => h << s | l >>> 32 - s;
9198
- var rotlSL2 = (h, l, s) => l << s | h >>> 32 - s;
9199
- var rotlBH2 = (h, l, s) => l << s - 32 | h >>> 64 - s;
9200
- var rotlBL2 = (h, l, s) => h << s - 32 | l >>> 64 - s;
9201
- function add(Ah, Al, Bh, Bl) {
9202
- const l = (Al >>> 0) + (Bl >>> 0);
9203
- return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
9204
- }
9205
- var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
9206
- var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
9207
- var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
9208
- var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
9209
- var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
9210
- var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
9211
-
9212
9283
  // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/sha2.js
9213
9284
  var SHA256_K = /* @__PURE__ */ Uint32Array.from([
9214
9285
  1116352408,
@@ -9565,6 +9636,127 @@ var sha512 = /* @__PURE__ */ createHasher2(
9565
9636
  /* @__PURE__ */ oidNist(3)
9566
9637
  );
9567
9638
 
9639
+ // ../core/dist/index.js
9640
+ import { SimplePool as SimplePool3 } from "nostr-tools/pool";
9641
+ import { getPublicKey as getPublicKey3 } from "nostr-tools/pure";
9642
+ import { getPublicKey as getPublicKey4 } from "nostr-tools/pure";
9643
+
9644
+ // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/hmac.js
9645
+ var _HMAC = class {
9646
+ oHash;
9647
+ iHash;
9648
+ blockLen;
9649
+ outputLen;
9650
+ finished = false;
9651
+ destroyed = false;
9652
+ constructor(hash, key) {
9653
+ ahash2(hash);
9654
+ abytes2(key, void 0, "key");
9655
+ this.iHash = hash.create();
9656
+ if (typeof this.iHash.update !== "function")
9657
+ throw new Error("Expected instance of class which extends utils.Hash");
9658
+ this.blockLen = this.iHash.blockLen;
9659
+ this.outputLen = this.iHash.outputLen;
9660
+ const blockLen = this.blockLen;
9661
+ const pad = new Uint8Array(blockLen);
9662
+ pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
9663
+ for (let i = 0; i < pad.length; i++)
9664
+ pad[i] ^= 54;
9665
+ this.iHash.update(pad);
9666
+ this.oHash = hash.create();
9667
+ for (let i = 0; i < pad.length; i++)
9668
+ pad[i] ^= 54 ^ 92;
9669
+ this.oHash.update(pad);
9670
+ clean2(pad);
9671
+ }
9672
+ update(buf) {
9673
+ aexists2(this);
9674
+ this.iHash.update(buf);
9675
+ return this;
9676
+ }
9677
+ digestInto(out) {
9678
+ aexists2(this);
9679
+ abytes2(out, this.outputLen, "output");
9680
+ this.finished = true;
9681
+ this.iHash.digestInto(out);
9682
+ this.oHash.update(out);
9683
+ this.oHash.digestInto(out);
9684
+ this.destroy();
9685
+ }
9686
+ digest() {
9687
+ const out = new Uint8Array(this.oHash.outputLen);
9688
+ this.digestInto(out);
9689
+ return out;
9690
+ }
9691
+ _cloneInto(to) {
9692
+ to ||= Object.create(Object.getPrototypeOf(this), {});
9693
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
9694
+ to = to;
9695
+ to.finished = finished;
9696
+ to.destroyed = destroyed;
9697
+ to.blockLen = blockLen;
9698
+ to.outputLen = outputLen;
9699
+ to.oHash = oHash._cloneInto(to.oHash);
9700
+ to.iHash = iHash._cloneInto(to.iHash);
9701
+ return to;
9702
+ }
9703
+ clone() {
9704
+ return this._cloneInto();
9705
+ }
9706
+ destroy() {
9707
+ this.destroyed = true;
9708
+ this.oHash.destroy();
9709
+ this.iHash.destroy();
9710
+ }
9711
+ };
9712
+ var hmac2 = (hash, key, message) => new _HMAC(hash, key).update(message).digest();
9713
+ hmac2.create = (hash, key) => new _HMAC(hash, key);
9714
+
9715
+ // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/pbkdf2.js
9716
+ function pbkdf2Init(hash, _password, _salt, _opts) {
9717
+ ahash2(hash);
9718
+ const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
9719
+ const { c, dkLen, asyncTick } = opts;
9720
+ anumber2(c, "c");
9721
+ anumber2(dkLen, "dkLen");
9722
+ anumber2(asyncTick, "asyncTick");
9723
+ if (c < 1)
9724
+ throw new Error("iterations (c) must be >= 1");
9725
+ const password = kdfInputToBytes(_password, "password");
9726
+ const salt = kdfInputToBytes(_salt, "salt");
9727
+ const DK = new Uint8Array(dkLen);
9728
+ const PRF = hmac2.create(hash, password);
9729
+ const PRFSalt = PRF._cloneInto().update(salt);
9730
+ return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
9731
+ }
9732
+ function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {
9733
+ PRF.destroy();
9734
+ PRFSalt.destroy();
9735
+ if (prfW)
9736
+ prfW.destroy();
9737
+ clean2(u);
9738
+ return DK;
9739
+ }
9740
+ function pbkdf2(hash, password, salt, opts) {
9741
+ const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
9742
+ let prfW;
9743
+ const arr = new Uint8Array(4);
9744
+ const view = createView(arr);
9745
+ const u = new Uint8Array(PRF.outputLen);
9746
+ for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
9747
+ const Ti = DK.subarray(pos, pos + PRF.outputLen);
9748
+ view.setInt32(0, ti, false);
9749
+ (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
9750
+ Ti.set(u.subarray(0, Ti.length));
9751
+ for (let ui = 1; ui < c; ui++) {
9752
+ PRF._cloneInto(prfW).update(u).digestInto(u);
9753
+ for (let i = 0; i < Ti.length; i++)
9754
+ Ti[i] ^= u[i];
9755
+ }
9756
+ }
9757
+ return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
9758
+ }
9759
+
9568
9760
  // ../../node_modules/.pnpm/@scure+base@2.0.0/node_modules/@scure/base/index.js
9569
9761
  function isBytes3(a) {
9570
9762
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
@@ -11964,8 +12156,8 @@ zone
11964
12156
  zoo`.split("\n");
11965
12157
 
11966
12158
  // ../../node_modules/.pnpm/@noble+curves@2.0.1/node_modules/@noble/curves/utils.js
11967
- var _0n = /* @__PURE__ */ BigInt(0);
11968
- var _1n = /* @__PURE__ */ BigInt(1);
12159
+ var _0n2 = /* @__PURE__ */ BigInt(0);
12160
+ var _1n2 = /* @__PURE__ */ BigInt(1);
11969
12161
  function abool(value, title = "") {
11970
12162
  if (typeof value !== "boolean") {
11971
12163
  const prefix = title && `"${title}" `;
@@ -11988,7 +12180,7 @@ function numberToHexUnpadded(num) {
11988
12180
  function hexToNumber(hex) {
11989
12181
  if (typeof hex !== "string")
11990
12182
  throw new Error("hex string expected, got " + typeof hex);
11991
- return hex === "" ? _0n : BigInt("0x" + hex);
12183
+ return hex === "" ? _0n2 : BigInt("0x" + hex);
11992
12184
  }
11993
12185
  function bytesToNumberBE(bytes) {
11994
12186
  return hexToNumber(bytesToHex2(bytes));
@@ -12010,7 +12202,7 @@ function numberToBytesLE(n, len) {
12010
12202
  function copyBytes(bytes) {
12011
12203
  return Uint8Array.from(bytes);
12012
12204
  }
12013
- var isPosBig = (n) => typeof n === "bigint" && _0n <= n;
12205
+ var isPosBig = (n) => typeof n === "bigint" && _0n2 <= n;
12014
12206
  function inRange(n, min, max) {
12015
12207
  return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
12016
12208
  }
@@ -12020,11 +12212,11 @@ function aInRange(title, n, min, max) {
12020
12212
  }
12021
12213
  function bitLen(n) {
12022
12214
  let len;
12023
- for (len = 0; n > _0n; n >>= _1n, len += 1)
12215
+ for (len = 0; n > _0n2; n >>= _1n2, len += 1)
12024
12216
  ;
12025
12217
  return len;
12026
12218
  }
12027
- var bitMask = (n) => (_1n << BigInt(n)) - _1n;
12219
+ var bitMask = (n) => (_1n2 << BigInt(n)) - _1n2;
12028
12220
  function createHmacDrbg(hashLen, qByteLen, hmacFn) {
12029
12221
  anumber2(hashLen, "hashLen");
12030
12222
  anumber2(qByteLen, "qByteLen");
@@ -12104,37 +12296,37 @@ function memoized(fn) {
12104
12296
  }
12105
12297
 
12106
12298
  // ../../node_modules/.pnpm/@noble+curves@2.0.1/node_modules/@noble/curves/abstract/modular.js
12107
- var _0n2 = /* @__PURE__ */ BigInt(0);
12108
- var _1n2 = /* @__PURE__ */ BigInt(1);
12109
- var _2n = /* @__PURE__ */ BigInt(2);
12299
+ var _0n3 = /* @__PURE__ */ BigInt(0);
12300
+ var _1n3 = /* @__PURE__ */ BigInt(1);
12301
+ var _2n2 = /* @__PURE__ */ BigInt(2);
12110
12302
  var _3n = /* @__PURE__ */ BigInt(3);
12111
12303
  var _4n = /* @__PURE__ */ BigInt(4);
12112
12304
  var _5n = /* @__PURE__ */ BigInt(5);
12113
- var _7n = /* @__PURE__ */ BigInt(7);
12305
+ var _7n2 = /* @__PURE__ */ BigInt(7);
12114
12306
  var _8n = /* @__PURE__ */ BigInt(8);
12115
12307
  var _9n = /* @__PURE__ */ BigInt(9);
12116
12308
  var _16n = /* @__PURE__ */ BigInt(16);
12117
12309
  function mod(a, b) {
12118
12310
  const result = a % b;
12119
- return result >= _0n2 ? result : b + result;
12311
+ return result >= _0n3 ? result : b + result;
12120
12312
  }
12121
12313
  function pow2(x, power, modulo) {
12122
12314
  let res = x;
12123
- while (power-- > _0n2) {
12315
+ while (power-- > _0n3) {
12124
12316
  res *= res;
12125
12317
  res %= modulo;
12126
12318
  }
12127
12319
  return res;
12128
12320
  }
12129
12321
  function invert(number, modulo) {
12130
- if (number === _0n2)
12322
+ if (number === _0n3)
12131
12323
  throw new Error("invert: expected non-zero number");
12132
- if (modulo <= _0n2)
12324
+ if (modulo <= _0n3)
12133
12325
  throw new Error("invert: expected positive modulus, got " + modulo);
12134
12326
  let a = mod(number, modulo);
12135
12327
  let b = modulo;
12136
- let x = _0n2, y = _1n2, u = _1n2, v = _0n2;
12137
- while (a !== _0n2) {
12328
+ let x = _0n3, y = _1n3, u = _1n3, v = _0n3;
12329
+ while (a !== _0n3) {
12138
12330
  const q = b / a;
12139
12331
  const r = b % a;
12140
12332
  const m = x - u * q;
@@ -12142,7 +12334,7 @@ function invert(number, modulo) {
12142
12334
  b = a, a = r, x = u, y = v, u = m, v = n;
12143
12335
  }
12144
12336
  const gcd2 = b;
12145
- if (gcd2 !== _1n2)
12337
+ if (gcd2 !== _1n3)
12146
12338
  throw new Error("invert: does not exist");
12147
12339
  return mod(x, modulo);
12148
12340
  }
@@ -12151,17 +12343,17 @@ function assertIsSquare(Fp, root, n) {
12151
12343
  throw new Error("Cannot find square root");
12152
12344
  }
12153
12345
  function sqrt3mod4(Fp, n) {
12154
- const p1div4 = (Fp.ORDER + _1n2) / _4n;
12346
+ const p1div4 = (Fp.ORDER + _1n3) / _4n;
12155
12347
  const root = Fp.pow(n, p1div4);
12156
12348
  assertIsSquare(Fp, root, n);
12157
12349
  return root;
12158
12350
  }
12159
12351
  function sqrt5mod8(Fp, n) {
12160
12352
  const p5div8 = (Fp.ORDER - _5n) / _8n;
12161
- const n2 = Fp.mul(n, _2n);
12353
+ const n2 = Fp.mul(n, _2n2);
12162
12354
  const v = Fp.pow(n2, p5div8);
12163
12355
  const nv = Fp.mul(n, v);
12164
- const i = Fp.mul(Fp.mul(nv, _2n), v);
12356
+ const i = Fp.mul(Fp.mul(nv, _2n2), v);
12165
12357
  const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
12166
12358
  assertIsSquare(Fp, root, n);
12167
12359
  return root;
@@ -12172,7 +12364,7 @@ function sqrt9mod16(P) {
12172
12364
  const c1 = tn(Fp_, Fp_.neg(Fp_.ONE));
12173
12365
  const c2 = tn(Fp_, c1);
12174
12366
  const c3 = tn(Fp_, Fp_.neg(c1));
12175
- const c4 = (P + _7n) / _16n;
12367
+ const c4 = (P + _7n2) / _16n;
12176
12368
  return (Fp, n) => {
12177
12369
  let tv1 = Fp.pow(n, c4);
12178
12370
  let tv2 = Fp.mul(tv1, c1);
@@ -12191,13 +12383,13 @@ function sqrt9mod16(P) {
12191
12383
  function tonelliShanks(P) {
12192
12384
  if (P < _3n)
12193
12385
  throw new Error("sqrt is not defined for small field");
12194
- let Q = P - _1n2;
12386
+ let Q = P - _1n3;
12195
12387
  let S = 0;
12196
- while (Q % _2n === _0n2) {
12197
- Q /= _2n;
12388
+ while (Q % _2n2 === _0n3) {
12389
+ Q /= _2n2;
12198
12390
  S++;
12199
12391
  }
12200
- let Z = _2n;
12392
+ let Z = _2n2;
12201
12393
  const _Fp = Field(P);
12202
12394
  while (FpLegendre(_Fp, Z) === 1) {
12203
12395
  if (Z++ > 1e3)
@@ -12206,7 +12398,7 @@ function tonelliShanks(P) {
12206
12398
  if (S === 1)
12207
12399
  return sqrt3mod4;
12208
12400
  let cc = _Fp.pow(Z, Q);
12209
- const Q1div2 = (Q + _1n2) / _2n;
12401
+ const Q1div2 = (Q + _1n3) / _2n2;
12210
12402
  return function tonelliSlow(Fp, n) {
12211
12403
  if (Fp.is0(n))
12212
12404
  return n;
@@ -12227,7 +12419,7 @@ function tonelliShanks(P) {
12227
12419
  if (i === M)
12228
12420
  throw new Error("Cannot find square root");
12229
12421
  }
12230
- const exponent = _1n2 << BigInt(M - i - 1);
12422
+ const exponent = _1n3 << BigInt(M - i - 1);
12231
12423
  const b = Fp.pow(c, exponent);
12232
12424
  M = i;
12233
12425
  c = Fp.sqr(b);
@@ -12246,7 +12438,7 @@ function FpSqrt(P) {
12246
12438
  return sqrt9mod16(P);
12247
12439
  return tonelliShanks(P);
12248
12440
  }
12249
- var isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n2) === _1n2;
12441
+ var isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n3) === _1n3;
12250
12442
  var FIELD_FIELDS = [
12251
12443
  "create",
12252
12444
  "isValid",
@@ -12280,19 +12472,19 @@ function validateField(field) {
12280
12472
  return field;
12281
12473
  }
12282
12474
  function FpPow(Fp, num, power) {
12283
- if (power < _0n2)
12475
+ if (power < _0n3)
12284
12476
  throw new Error("invalid exponent, negatives unsupported");
12285
- if (power === _0n2)
12477
+ if (power === _0n3)
12286
12478
  return Fp.ONE;
12287
- if (power === _1n2)
12479
+ if (power === _1n3)
12288
12480
  return num;
12289
12481
  let p = Fp.ONE;
12290
12482
  let d = num;
12291
- while (power > _0n2) {
12292
- if (power & _1n2)
12483
+ while (power > _0n3) {
12484
+ if (power & _1n3)
12293
12485
  p = Fp.mul(p, d);
12294
12486
  d = Fp.sqr(d);
12295
- power >>= _1n2;
12487
+ power >>= _1n3;
12296
12488
  }
12297
12489
  return p;
12298
12490
  }
@@ -12314,7 +12506,7 @@ function FpInvertBatch(Fp, nums, passZero = false) {
12314
12506
  return inverted;
12315
12507
  }
12316
12508
  function FpLegendre(Fp, n) {
12317
- const p1mod2 = (Fp.ORDER - _1n2) / _2n;
12509
+ const p1mod2 = (Fp.ORDER - _1n3) / _2n2;
12318
12510
  const powered = Fp.pow(n, p1mod2);
12319
12511
  const yes = Fp.eql(powered, Fp.ONE);
12320
12512
  const zero = Fp.eql(powered, Fp.ZERO);
@@ -12335,14 +12527,14 @@ var _Field = class {
12335
12527
  BITS;
12336
12528
  BYTES;
12337
12529
  isLE;
12338
- ZERO = _0n2;
12339
- ONE = _1n2;
12530
+ ZERO = _0n3;
12531
+ ONE = _1n3;
12340
12532
  _lengths;
12341
12533
  _sqrt;
12342
12534
  // cached sqrt
12343
12535
  _mod;
12344
12536
  constructor(ORDER, opts = {}) {
12345
- if (ORDER <= _0n2)
12537
+ if (ORDER <= _0n3)
12346
12538
  throw new Error("invalid field: expected ORDER > 0, got " + ORDER);
12347
12539
  let _nbitLength = void 0;
12348
12540
  this.isLE = false;
@@ -12373,17 +12565,17 @@ var _Field = class {
12373
12565
  isValid(num) {
12374
12566
  if (typeof num !== "bigint")
12375
12567
  throw new Error("invalid field element: expected bigint, got " + typeof num);
12376
- return _0n2 <= num && num < this.ORDER;
12568
+ return _0n3 <= num && num < this.ORDER;
12377
12569
  }
12378
12570
  is0(num) {
12379
- return num === _0n2;
12571
+ return num === _0n3;
12380
12572
  }
12381
12573
  // is valid and invertible
12382
12574
  isValidNot0(num) {
12383
12575
  return !this.is0(num) && this.isValid(num);
12384
12576
  }
12385
12577
  isOdd(num) {
12386
- return (num & _1n2) === _1n2;
12578
+ return (num & _1n3) === _1n3;
12387
12579
  }
12388
12580
  neg(num) {
12389
12581
  return mod(-num, this.ORDER);
@@ -12486,13 +12678,13 @@ function mapHashToField(key, fieldOrder, isLE2 = false) {
12486
12678
  if (len < 16 || len < minLen || len > 1024)
12487
12679
  throw new Error("expected " + minLen + "-1024 bytes of input, got " + len);
12488
12680
  const num = isLE2 ? bytesToNumberLE(key) : bytesToNumberBE(key);
12489
- const reduced = mod(num, fieldOrder - _1n2) + _1n2;
12681
+ const reduced = mod(num, fieldOrder - _1n3) + _1n3;
12490
12682
  return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
12491
12683
  }
12492
12684
 
12493
12685
  // ../../node_modules/.pnpm/@noble+curves@2.0.1/node_modules/@noble/curves/abstract/curve.js
12494
- var _0n3 = /* @__PURE__ */ BigInt(0);
12495
- var _1n3 = /* @__PURE__ */ BigInt(1);
12686
+ var _0n4 = /* @__PURE__ */ BigInt(0);
12687
+ var _1n4 = /* @__PURE__ */ BigInt(1);
12496
12688
  function negateCt(condition, item) {
12497
12689
  const neg = item.negate();
12498
12690
  return condition ? neg : item;
@@ -12520,7 +12712,7 @@ function calcOffsets(n, window2, wOpts) {
12520
12712
  let nextN = n >> shiftBy;
12521
12713
  if (wbits > windowSize) {
12522
12714
  wbits -= maxNumber;
12523
- nextN += _1n3;
12715
+ nextN += _1n4;
12524
12716
  }
12525
12717
  const offsetStart = window2 * windowSize;
12526
12718
  const offset = offsetStart + Math.abs(wbits) - 1;
@@ -12536,7 +12728,7 @@ function getW(P) {
12536
12728
  return pointWindowSizes.get(P) || 1;
12537
12729
  }
12538
12730
  function assert0(n) {
12539
- if (n !== _0n3)
12731
+ if (n !== _0n4)
12540
12732
  throw new Error("invalid wNAF");
12541
12733
  }
12542
12734
  var wNAF = class {
@@ -12554,11 +12746,11 @@ var wNAF = class {
12554
12746
  // non-const time multiplication ladder
12555
12747
  _unsafeLadder(elm, n, p = this.ZERO) {
12556
12748
  let d = elm;
12557
- while (n > _0n3) {
12558
- if (n & _1n3)
12749
+ while (n > _0n4) {
12750
+ if (n & _1n4)
12559
12751
  p = p.add(d);
12560
12752
  d = d.double();
12561
- n >>= _1n3;
12753
+ n >>= _1n4;
12562
12754
  }
12563
12755
  return p;
12564
12756
  }
@@ -12622,7 +12814,7 @@ var wNAF = class {
12622
12814
  wNAFUnsafe(W, precomputes, n, acc = this.ZERO) {
12623
12815
  const wo = calcWOpts(W, this.bits);
12624
12816
  for (let window2 = 0; window2 < wo.windows; window2++) {
12625
- if (n === _0n3)
12817
+ if (n === _0n4)
12626
12818
  break;
12627
12819
  const { nextN, offset, isZero, isNeg } = calcOffsets(n, window2, wo);
12628
12820
  n = nextN;
@@ -12674,14 +12866,14 @@ function mulEndoUnsafe(Point2, point, k1, k2) {
12674
12866
  let acc = point;
12675
12867
  let p1 = Point2.ZERO;
12676
12868
  let p2 = Point2.ZERO;
12677
- while (k1 > _0n3 || k2 > _0n3) {
12678
- if (k1 & _1n3)
12869
+ while (k1 > _0n4 || k2 > _0n4) {
12870
+ if (k1 & _1n4)
12679
12871
  p1 = p1.add(acc);
12680
- if (k2 & _1n3)
12872
+ if (k2 & _1n4)
12681
12873
  p2 = p2.add(acc);
12682
12874
  acc = acc.double();
12683
- k1 >>= _1n3;
12684
- k2 >>= _1n3;
12875
+ k1 >>= _1n4;
12876
+ k2 >>= _1n4;
12685
12877
  }
12686
12878
  return { p1, p2 };
12687
12879
  }
@@ -12702,7 +12894,7 @@ function createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) {
12702
12894
  throw new Error(`expected valid ${type} CURVE object`);
12703
12895
  for (const p of ["p", "n", "h"]) {
12704
12896
  const val = CURVE[p];
12705
- if (!(typeof val === "bigint" && val > _0n3))
12897
+ if (!(typeof val === "bigint" && val > _0n4))
12706
12898
  throw new Error(`CURVE.${p} must be positive bigint`);
12707
12899
  }
12708
12900
  const Fp = createField(CURVE.p, curveOpts.Fp, FpFnLE);
@@ -12724,21 +12916,21 @@ function createKeygen(randomSecretKey, getPublicKey7) {
12724
12916
  }
12725
12917
 
12726
12918
  // ../../node_modules/.pnpm/@noble+curves@2.0.1/node_modules/@noble/curves/abstract/weierstrass.js
12727
- var divNearest = (num, den) => (num + (num >= 0 ? den : -den) / _2n2) / den;
12919
+ var divNearest = (num, den) => (num + (num >= 0 ? den : -den) / _2n3) / den;
12728
12920
  function _splitEndoScalar(k, basis, n) {
12729
12921
  const [[a1, b1], [a2, b2]] = basis;
12730
12922
  const c1 = divNearest(b2 * k, n);
12731
12923
  const c2 = divNearest(-b1 * k, n);
12732
12924
  let k1 = k - c1 * a1 - c2 * a2;
12733
12925
  let k2 = -c1 * b1 - c2 * b2;
12734
- const k1neg = k1 < _0n4;
12735
- const k2neg = k2 < _0n4;
12926
+ const k1neg = k1 < _0n5;
12927
+ const k2neg = k2 < _0n5;
12736
12928
  if (k1neg)
12737
12929
  k1 = -k1;
12738
12930
  if (k2neg)
12739
12931
  k2 = -k2;
12740
- const MAX_NUM = bitMask(Math.ceil(bitLen(n) / 2)) + _1n4;
12741
- if (k1 < _0n4 || k1 >= MAX_NUM || k2 < _0n4 || k2 >= MAX_NUM) {
12932
+ const MAX_NUM = bitMask(Math.ceil(bitLen(n) / 2)) + _1n5;
12933
+ if (k1 < _0n5 || k1 >= MAX_NUM || k2 < _0n5 || k2 >= MAX_NUM) {
12742
12934
  throw new Error("splitScalar (endomorphism): failed, k=" + k);
12743
12935
  }
12744
12936
  return { k1neg, k1, k2neg, k2 };
@@ -12826,7 +13018,7 @@ var DER = {
12826
13018
  _int: {
12827
13019
  encode(num) {
12828
13020
  const { Err: E } = DER;
12829
- if (num < _0n4)
13021
+ if (num < _0n5)
12830
13022
  throw new E("integer: negative integers are not allowed");
12831
13023
  let hex = numberToHexUnpadded(num);
12832
13024
  if (Number.parseInt(hex[0], 16) & 8)
@@ -12864,9 +13056,9 @@ var DER = {
12864
13056
  return tlv.encode(48, seq);
12865
13057
  }
12866
13058
  };
12867
- var _0n4 = BigInt(0);
12868
- var _1n4 = BigInt(1);
12869
- var _2n2 = BigInt(2);
13059
+ var _0n5 = BigInt(0);
13060
+ var _1n5 = BigInt(1);
13061
+ var _2n3 = BigInt(2);
12870
13062
  var _3n2 = BigInt(3);
12871
13063
  var _4n2 = BigInt(4);
12872
13064
  function weierstrass(params, extraOpts = {}) {
@@ -13232,9 +13424,9 @@ function weierstrass(params, extraOpts = {}) {
13232
13424
  const p = this;
13233
13425
  if (!Fn2.isValid(sc))
13234
13426
  throw new Error("invalid scalar: out of range");
13235
- if (sc === _0n4 || p.is0())
13427
+ if (sc === _0n5 || p.is0())
13236
13428
  return Point2.ZERO;
13237
- if (sc === _1n4)
13429
+ if (sc === _1n5)
13238
13430
  return p;
13239
13431
  if (wnaf.hasCache(this))
13240
13432
  return this.multiply(sc);
@@ -13259,7 +13451,7 @@ function weierstrass(params, extraOpts = {}) {
13259
13451
  */
13260
13452
  isTorsionFree() {
13261
13453
  const { isTorsionFree } = extraOpts;
13262
- if (cofactor === _1n4)
13454
+ if (cofactor === _1n5)
13263
13455
  return true;
13264
13456
  if (isTorsionFree)
13265
13457
  return isTorsionFree(Point2, this);
@@ -13267,7 +13459,7 @@ function weierstrass(params, extraOpts = {}) {
13267
13459
  }
13268
13460
  clearCofactor() {
13269
13461
  const { clearCofactor } = extraOpts;
13270
- if (cofactor === _1n4)
13462
+ if (cofactor === _1n5)
13271
13463
  return this;
13272
13464
  if (clearCofactor)
13273
13465
  return clearCofactor(Point2, this);
@@ -13383,9 +13575,9 @@ function ecdsa(Point2, hash, ecdsaOpts = {}) {
13383
13575
  format: "compact",
13384
13576
  extraEntropy: false
13385
13577
  };
13386
- const hasLargeCofactor = CURVE_ORDER * _2n2 < Fp.ORDER;
13578
+ const hasLargeCofactor = CURVE_ORDER * _2n3 < Fp.ORDER;
13387
13579
  function isBiggerThanHalfOrder(number) {
13388
- const HALF = CURVE_ORDER >> _1n4;
13580
+ const HALF = CURVE_ORDER >> _1n5;
13389
13581
  return number > HALF;
13390
13582
  }
13391
13583
  function validateRS(title, num) {
@@ -13498,7 +13690,7 @@ function ecdsa(Point2, hash, ecdsaOpts = {}) {
13498
13690
  };
13499
13691
  const ORDER_MASK = bitMask(fnBits);
13500
13692
  function int2octets(num) {
13501
- aInRange("num < 2^" + fnBits, num, _0n4, ORDER_MASK);
13693
+ aInRange("num < 2^" + fnBits, num, _0n5, ORDER_MASK);
13502
13694
  return Fn2.toBytes(num);
13503
13695
  }
13504
13696
  function validateMsgAndHash(message, prehash) {
@@ -13526,12 +13718,12 @@ function ecdsa(Point2, hash, ecdsaOpts = {}) {
13526
13718
  const ik = Fn2.inv(k);
13527
13719
  const q = Point2.BASE.multiply(k).toAffine();
13528
13720
  const r = Fn2.create(q.x);
13529
- if (r === _0n4)
13721
+ if (r === _0n5)
13530
13722
  return;
13531
13723
  const s = Fn2.create(ik * Fn2.create(m + r * d));
13532
- if (s === _0n4)
13724
+ if (s === _0n5)
13533
13725
  return;
13534
- let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n4);
13726
+ let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n5);
13535
13727
  let normS = s;
13536
13728
  if (lowS && isBiggerThanHalfOrder(s)) {
13537
13729
  normS = Fn2.neg(s);
@@ -13612,7 +13804,7 @@ var secp256k1_ENDO = {
13612
13804
  [BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
13613
13805
  ]
13614
13806
  };
13615
- var _2n3 = /* @__PURE__ */ BigInt(2);
13807
+ var _2n4 = /* @__PURE__ */ BigInt(2);
13616
13808
  function sqrtMod(y) {
13617
13809
  const P = secp256k1_CURVE.p;
13618
13810
  const _3n5 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
@@ -13621,7 +13813,7 @@ function sqrtMod(y) {
13621
13813
  const b3 = b2 * b2 * y % P;
13622
13814
  const b6 = pow2(b3, _3n5, P) * b3 % P;
13623
13815
  const b9 = pow2(b6, _3n5, P) * b3 % P;
13624
- const b11 = pow2(b9, _2n3, P) * b2 % P;
13816
+ const b11 = pow2(b9, _2n4, P) * b2 % P;
13625
13817
  const b22 = pow2(b11, _11n, P) * b11 % P;
13626
13818
  const b44 = pow2(b22, _22n, P) * b22 % P;
13627
13819
  const b88 = pow2(b44, _44n, P) * b44 % P;
@@ -13630,7 +13822,7 @@ function sqrtMod(y) {
13630
13822
  const b223 = pow2(b220, _3n5, P) * b3 % P;
13631
13823
  const t1 = pow2(b223, _23n, P) * b22 % P;
13632
13824
  const t2 = pow2(t1, _6n, P) * b2 % P;
13633
- const root = pow2(t2, _2n3, P);
13825
+ const root = pow2(t2, _2n4, P);
13634
13826
  if (!Fpk1.eql(Fpk1.sqr(root), y))
13635
13827
  throw new Error("Cannot find square root");
13636
13828
  return root;
@@ -13995,6 +14187,56 @@ var HDKey = class _HDKey {
13995
14187
 
13996
14188
  // ../core/dist/index.js
13997
14189
  import { getPublicKey as getPublicKey5 } from "nostr-tools/pure";
14190
+ function hexToBytes3(hex) {
14191
+ const clean3 = hex.startsWith("0x") ? hex.slice(2) : hex;
14192
+ if (clean3.length % 2 !== 0 || !/^[0-9a-fA-F]*$/.test(clean3)) {
14193
+ throw new Error(`Invalid hex string: ${hex}`);
14194
+ }
14195
+ return hexToBytes2(clean3);
14196
+ }
14197
+ function concatBytes3(...parts) {
14198
+ let len = 0;
14199
+ for (const p of parts) len += p.length;
14200
+ const out = new Uint8Array(len);
14201
+ let o = 0;
14202
+ for (const p of parts) {
14203
+ out.set(p, o);
14204
+ o += p.length;
14205
+ }
14206
+ return out;
14207
+ }
14208
+ var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
14209
+ function base58Encode(bytes) {
14210
+ let zeros = 0;
14211
+ for (let i = 0; i < bytes.length && bytes[i] === 0; i++) zeros++;
14212
+ let value = 0n;
14213
+ for (const byte of bytes) {
14214
+ value = value * 256n + BigInt(byte);
14215
+ }
14216
+ let result = "";
14217
+ while (value > 0n) {
14218
+ result = BASE58_ALPHABET[Number(value % 58n)] + result;
14219
+ value = value / 58n;
14220
+ }
14221
+ for (let i = 0; i < zeros; i++) {
14222
+ result = "1" + result;
14223
+ }
14224
+ return result || "1";
14225
+ }
14226
+ var MINA_PRIVATE_KEY_VERSION = 90;
14227
+ function hexToMinaBase58PrivateKey(privateKey) {
14228
+ if (!/^(0x)?[0-9a-fA-F]{64}$/.test(privateKey)) {
14229
+ return privateKey;
14230
+ }
14231
+ const beScalar = hexToBytes3(privateKey);
14232
+ const leScalar = Uint8Array.from(beScalar).reverse();
14233
+ const payload = concatBytes3(
14234
+ Uint8Array.from([MINA_PRIVATE_KEY_VERSION, 1]),
14235
+ leScalar
14236
+ );
14237
+ const checksum2 = sha2562(sha2562(payload)).slice(0, 4);
14238
+ return base58Encode(concatBytes3(payload, checksum2));
14239
+ }
13998
14240
  var ILP_TO_SEMANTIC = Object.freeze({
13999
14241
  T00: "internal_error",
14000
14242
  T04: "insufficient_funds",
@@ -14312,11 +14554,27 @@ function writeHsConnectorConfig(configDir, config, options = {}) {
14312
14554
  } catch {
14313
14555
  }
14314
14556
  }
14557
+ const apexEvmKey = options.apexSettlementKeys?.evmPrivateKeyHex;
14558
+ const apexSolanaKey = options.apexSettlementKeys?.solanaPrivateKeyBase58;
14559
+ const apexMinaKey = options.apexSettlementKeys?.minaPrivateKeyBase58;
14315
14560
  const derived = resolveConfigNetworkProfile(
14316
14561
  config,
14317
- DEFAULT_HS_CHAIN_PROVIDERS[0]?.keyId
14562
+ apexEvmKey ?? DEFAULT_HS_CHAIN_PROVIDERS[0]?.keyId
14318
14563
  ).chainProviders;
14319
- const hsConfig = derived.length > 0 ? { ...config, chainProviders: derived } : { ...config, chainProviders: [...DEFAULT_HS_CHAIN_PROVIDERS] };
14564
+ const fillApexKey = (providers) => providers.map((p) => {
14565
+ if (p.keyId) return p;
14566
+ if (p.chainType === "evm" && apexEvmKey) {
14567
+ return { ...p, keyId: apexEvmKey };
14568
+ }
14569
+ if (p.chainType === "solana" && apexSolanaKey) {
14570
+ return { ...p, keyId: apexSolanaKey };
14571
+ }
14572
+ if (p.chainType === "mina" && apexMinaKey) {
14573
+ return { ...p, keyId: apexMinaKey };
14574
+ }
14575
+ return p;
14576
+ });
14577
+ const hsConfig = derived.length > 0 ? { ...config, chainProviders: fillApexKey(derived) } : { ...config, chainProviders: [...DEFAULT_HS_CHAIN_PROVIDERS] };
14320
14578
  const generator = new ConnectorConfigGenerator(hsConfig);
14321
14579
  const baseConfig = generator.generate([]);
14322
14580
  const HS_LOCAL_SOCKS_PROXY = "socks5h://127.0.0.1:9050";
@@ -15148,33 +15406,33 @@ async function readImageManifest(path) {
15148
15406
  import { getPublicKey as getPublicKey6 } from "nostr-tools/pure";
15149
15407
 
15150
15408
  // ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha3.js
15151
- var _0n5 = BigInt(0);
15152
- var _1n5 = BigInt(1);
15153
- var _2n4 = BigInt(2);
15154
- var _7n2 = BigInt(7);
15155
- var _256n = BigInt(256);
15156
- var _0x71n = BigInt(113);
15157
- var SHA3_PI = [];
15158
- var SHA3_ROTL = [];
15159
- var _SHA3_IOTA = [];
15160
- for (let round = 0, R = _1n5, x = 1, y = 0; round < 24; round++) {
15409
+ var _0n6 = BigInt(0);
15410
+ var _1n6 = BigInt(1);
15411
+ var _2n5 = BigInt(2);
15412
+ var _7n3 = BigInt(7);
15413
+ var _256n2 = BigInt(256);
15414
+ var _0x71n2 = BigInt(113);
15415
+ var SHA3_PI2 = [];
15416
+ var SHA3_ROTL2 = [];
15417
+ var _SHA3_IOTA2 = [];
15418
+ for (let round = 0, R = _1n6, x = 1, y = 0; round < 24; round++) {
15161
15419
  [x, y] = [y, (2 * x + 3 * y) % 5];
15162
- SHA3_PI.push(2 * (5 * y + x));
15163
- SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
15164
- let t = _0n5;
15420
+ SHA3_PI2.push(2 * (5 * y + x));
15421
+ SHA3_ROTL2.push((round + 1) * (round + 2) / 2 % 64);
15422
+ let t = _0n6;
15165
15423
  for (let j = 0; j < 7; j++) {
15166
- R = (R << _1n5 ^ (R >> _7n2) * _0x71n) % _256n;
15167
- if (R & _2n4)
15168
- t ^= _1n5 << (_1n5 << /* @__PURE__ */ BigInt(j)) - _1n5;
15424
+ R = (R << _1n6 ^ (R >> _7n3) * _0x71n2) % _256n2;
15425
+ if (R & _2n5)
15426
+ t ^= _1n6 << (_1n6 << /* @__PURE__ */ BigInt(j)) - _1n6;
15169
15427
  }
15170
- _SHA3_IOTA.push(t);
15171
- }
15172
- var IOTAS = split(_SHA3_IOTA, true);
15173
- var SHA3_IOTA_H = IOTAS[0];
15174
- var SHA3_IOTA_L = IOTAS[1];
15175
- var rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
15176
- var rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
15177
- function keccakP(s, rounds = 24) {
15428
+ _SHA3_IOTA2.push(t);
15429
+ }
15430
+ var IOTAS2 = split(_SHA3_IOTA2, true);
15431
+ var SHA3_IOTA_H2 = IOTAS2[0];
15432
+ var SHA3_IOTA_L2 = IOTAS2[1];
15433
+ var rotlH2 = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
15434
+ var rotlL2 = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
15435
+ function keccakP2(s, rounds = 24) {
15178
15436
  const B = new Uint32Array(5 * 2);
15179
15437
  for (let round = 24 - rounds; round < 24; round++) {
15180
15438
  for (let x = 0; x < 10; x++)
@@ -15184,8 +15442,8 @@ function keccakP(s, rounds = 24) {
15184
15442
  const idx0 = (x + 2) % 10;
15185
15443
  const B0 = B[idx0];
15186
15444
  const B1 = B[idx0 + 1];
15187
- const Th = rotlH(B0, B1, 1) ^ B[idx1];
15188
- const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
15445
+ const Th = rotlH2(B0, B1, 1) ^ B[idx1];
15446
+ const Tl = rotlL2(B0, B1, 1) ^ B[idx1 + 1];
15189
15447
  for (let y = 0; y < 50; y += 10) {
15190
15448
  s[x + y] ^= Th;
15191
15449
  s[x + y + 1] ^= Tl;
@@ -15194,10 +15452,10 @@ function keccakP(s, rounds = 24) {
15194
15452
  let curH = s[2];
15195
15453
  let curL = s[3];
15196
15454
  for (let t = 0; t < 24; t++) {
15197
- const shift = SHA3_ROTL[t];
15198
- const Th = rotlH(curH, curL, shift);
15199
- const Tl = rotlL(curH, curL, shift);
15200
- const PI = SHA3_PI[t];
15455
+ const shift = SHA3_ROTL2[t];
15456
+ const Th = rotlH2(curH, curL, shift);
15457
+ const Tl = rotlL2(curH, curL, shift);
15458
+ const PI = SHA3_PI2[t];
15201
15459
  curH = s[PI];
15202
15460
  curL = s[PI + 1];
15203
15461
  s[PI] = Th;
@@ -15209,12 +15467,12 @@ function keccakP(s, rounds = 24) {
15209
15467
  for (let x = 0; x < 10; x++)
15210
15468
  s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
15211
15469
  }
15212
- s[0] ^= SHA3_IOTA_H[round];
15213
- s[1] ^= SHA3_IOTA_L[round];
15470
+ s[0] ^= SHA3_IOTA_H2[round];
15471
+ s[1] ^= SHA3_IOTA_L2[round];
15214
15472
  }
15215
15473
  clean(B);
15216
15474
  }
15217
- var Keccak = class _Keccak extends Hash {
15475
+ var Keccak2 = class _Keccak extends Hash {
15218
15476
  // NOTE: we accept arguments in bytes instead of bits here.
15219
15477
  constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
15220
15478
  super();
@@ -15239,7 +15497,7 @@ var Keccak = class _Keccak extends Hash {
15239
15497
  }
15240
15498
  keccak() {
15241
15499
  swap32IfBE(this.state32);
15242
- keccakP(this.state32, this.rounds);
15500
+ keccakP2(this.state32, this.rounds);
15243
15501
  swap32IfBE(this.state32);
15244
15502
  this.posOut = 0;
15245
15503
  this.pos = 0;
@@ -15325,12 +15583,12 @@ var Keccak = class _Keccak extends Hash {
15325
15583
  return to;
15326
15584
  }
15327
15585
  };
15328
- var gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen));
15329
- var keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
15586
+ var gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak2(blockLen, suffix, outputLen));
15587
+ var keccak_2562 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
15330
15588
 
15331
15589
  // ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/utils.js
15332
- var _0n6 = /* @__PURE__ */ BigInt(0);
15333
- var _1n6 = /* @__PURE__ */ BigInt(1);
15590
+ var _0n7 = /* @__PURE__ */ BigInt(0);
15591
+ var _1n7 = /* @__PURE__ */ BigInt(1);
15334
15592
  function _abool2(value, title = "") {
15335
15593
  if (typeof value !== "boolean") {
15336
15594
  const prefix = title && `"${title}"`;
@@ -15357,7 +15615,7 @@ function numberToHexUnpadded2(num) {
15357
15615
  function hexToNumber2(hex) {
15358
15616
  if (typeof hex !== "string")
15359
15617
  throw new Error("hex string expected, got " + typeof hex);
15360
- return hex === "" ? _0n6 : BigInt("0x" + hex);
15618
+ return hex === "" ? _0n7 : BigInt("0x" + hex);
15361
15619
  }
15362
15620
  function bytesToNumberBE2(bytes) {
15363
15621
  return hexToNumber2(bytesToHex(bytes));
@@ -15390,7 +15648,7 @@ function ensureBytes(title, hex, expectedLength) {
15390
15648
  throw new Error(title + " of length " + expectedLength + " expected, got " + len);
15391
15649
  return res;
15392
15650
  }
15393
- var isPosBig2 = (n) => typeof n === "bigint" && _0n6 <= n;
15651
+ var isPosBig2 = (n) => typeof n === "bigint" && _0n7 <= n;
15394
15652
  function inRange2(n, min, max) {
15395
15653
  return isPosBig2(n) && isPosBig2(min) && isPosBig2(max) && min <= n && n < max;
15396
15654
  }
@@ -15400,11 +15658,11 @@ function aInRange2(title, n, min, max) {
15400
15658
  }
15401
15659
  function bitLen2(n) {
15402
15660
  let len;
15403
- for (len = 0; n > _0n6; n >>= _1n6, len += 1)
15661
+ for (len = 0; n > _0n7; n >>= _1n7, len += 1)
15404
15662
  ;
15405
15663
  return len;
15406
15664
  }
15407
- var bitMask2 = (n) => (_1n6 << BigInt(n)) - _1n6;
15665
+ var bitMask2 = (n) => (_1n7 << BigInt(n)) - _1n7;
15408
15666
  function createHmacDrbg2(hashLen, qByteLen, hmacFn) {
15409
15667
  if (typeof hashLen !== "number" || hashLen < 2)
15410
15668
  throw new Error("hashLen must be a number");
@@ -15482,37 +15740,37 @@ function memoized2(fn) {
15482
15740
  }
15483
15741
 
15484
15742
  // ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/modular.js
15485
- var _0n7 = BigInt(0);
15486
- var _1n7 = BigInt(1);
15487
- var _2n5 = /* @__PURE__ */ BigInt(2);
15743
+ var _0n8 = BigInt(0);
15744
+ var _1n8 = BigInt(1);
15745
+ var _2n6 = /* @__PURE__ */ BigInt(2);
15488
15746
  var _3n3 = /* @__PURE__ */ BigInt(3);
15489
15747
  var _4n3 = /* @__PURE__ */ BigInt(4);
15490
15748
  var _5n2 = /* @__PURE__ */ BigInt(5);
15491
- var _7n3 = /* @__PURE__ */ BigInt(7);
15749
+ var _7n4 = /* @__PURE__ */ BigInt(7);
15492
15750
  var _8n2 = /* @__PURE__ */ BigInt(8);
15493
15751
  var _9n2 = /* @__PURE__ */ BigInt(9);
15494
15752
  var _16n2 = /* @__PURE__ */ BigInt(16);
15495
15753
  function mod2(a, b) {
15496
15754
  const result = a % b;
15497
- return result >= _0n7 ? result : b + result;
15755
+ return result >= _0n8 ? result : b + result;
15498
15756
  }
15499
15757
  function pow22(x, power, modulo) {
15500
15758
  let res = x;
15501
- while (power-- > _0n7) {
15759
+ while (power-- > _0n8) {
15502
15760
  res *= res;
15503
15761
  res %= modulo;
15504
15762
  }
15505
15763
  return res;
15506
15764
  }
15507
15765
  function invert2(number, modulo) {
15508
- if (number === _0n7)
15766
+ if (number === _0n8)
15509
15767
  throw new Error("invert: expected non-zero number");
15510
- if (modulo <= _0n7)
15768
+ if (modulo <= _0n8)
15511
15769
  throw new Error("invert: expected positive modulus, got " + modulo);
15512
15770
  let a = mod2(number, modulo);
15513
15771
  let b = modulo;
15514
- let x = _0n7, y = _1n7, u = _1n7, v = _0n7;
15515
- while (a !== _0n7) {
15772
+ let x = _0n8, y = _1n8, u = _1n8, v = _0n8;
15773
+ while (a !== _0n8) {
15516
15774
  const q = b / a;
15517
15775
  const r = b % a;
15518
15776
  const m = x - u * q;
@@ -15520,7 +15778,7 @@ function invert2(number, modulo) {
15520
15778
  b = a, a = r, x = u, y = v, u = m, v = n;
15521
15779
  }
15522
15780
  const gcd2 = b;
15523
- if (gcd2 !== _1n7)
15781
+ if (gcd2 !== _1n8)
15524
15782
  throw new Error("invert: does not exist");
15525
15783
  return mod2(x, modulo);
15526
15784
  }
@@ -15529,17 +15787,17 @@ function assertIsSquare2(Fp, root, n) {
15529
15787
  throw new Error("Cannot find square root");
15530
15788
  }
15531
15789
  function sqrt3mod42(Fp, n) {
15532
- const p1div4 = (Fp.ORDER + _1n7) / _4n3;
15790
+ const p1div4 = (Fp.ORDER + _1n8) / _4n3;
15533
15791
  const root = Fp.pow(n, p1div4);
15534
15792
  assertIsSquare2(Fp, root, n);
15535
15793
  return root;
15536
15794
  }
15537
15795
  function sqrt5mod82(Fp, n) {
15538
15796
  const p5div8 = (Fp.ORDER - _5n2) / _8n2;
15539
- const n2 = Fp.mul(n, _2n5);
15797
+ const n2 = Fp.mul(n, _2n6);
15540
15798
  const v = Fp.pow(n2, p5div8);
15541
15799
  const nv = Fp.mul(n, v);
15542
- const i = Fp.mul(Fp.mul(nv, _2n5), v);
15800
+ const i = Fp.mul(Fp.mul(nv, _2n6), v);
15543
15801
  const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
15544
15802
  assertIsSquare2(Fp, root, n);
15545
15803
  return root;
@@ -15550,7 +15808,7 @@ function sqrt9mod162(P) {
15550
15808
  const c1 = tn(Fp_, Fp_.neg(Fp_.ONE));
15551
15809
  const c2 = tn(Fp_, c1);
15552
15810
  const c3 = tn(Fp_, Fp_.neg(c1));
15553
- const c4 = (P + _7n3) / _16n2;
15811
+ const c4 = (P + _7n4) / _16n2;
15554
15812
  return (Fp, n) => {
15555
15813
  let tv1 = Fp.pow(n, c4);
15556
15814
  let tv2 = Fp.mul(tv1, c1);
@@ -15569,13 +15827,13 @@ function sqrt9mod162(P) {
15569
15827
  function tonelliShanks2(P) {
15570
15828
  if (P < _3n3)
15571
15829
  throw new Error("sqrt is not defined for small field");
15572
- let Q = P - _1n7;
15830
+ let Q = P - _1n8;
15573
15831
  let S = 0;
15574
- while (Q % _2n5 === _0n7) {
15575
- Q /= _2n5;
15832
+ while (Q % _2n6 === _0n8) {
15833
+ Q /= _2n6;
15576
15834
  S++;
15577
15835
  }
15578
- let Z = _2n5;
15836
+ let Z = _2n6;
15579
15837
  const _Fp = Field2(P);
15580
15838
  while (FpLegendre2(_Fp, Z) === 1) {
15581
15839
  if (Z++ > 1e3)
@@ -15584,7 +15842,7 @@ function tonelliShanks2(P) {
15584
15842
  if (S === 1)
15585
15843
  return sqrt3mod42;
15586
15844
  let cc = _Fp.pow(Z, Q);
15587
- const Q1div2 = (Q + _1n7) / _2n5;
15845
+ const Q1div2 = (Q + _1n8) / _2n6;
15588
15846
  return function tonelliSlow(Fp, n) {
15589
15847
  if (Fp.is0(n))
15590
15848
  return n;
@@ -15605,7 +15863,7 @@ function tonelliShanks2(P) {
15605
15863
  if (i === M)
15606
15864
  throw new Error("Cannot find square root");
15607
15865
  }
15608
- const exponent = _1n7 << BigInt(M - i - 1);
15866
+ const exponent = _1n8 << BigInt(M - i - 1);
15609
15867
  const b = Fp.pow(c, exponent);
15610
15868
  M = i;
15611
15869
  c = Fp.sqr(b);
@@ -15658,19 +15916,19 @@ function validateField2(field) {
15658
15916
  return field;
15659
15917
  }
15660
15918
  function FpPow2(Fp, num, power) {
15661
- if (power < _0n7)
15919
+ if (power < _0n8)
15662
15920
  throw new Error("invalid exponent, negatives unsupported");
15663
- if (power === _0n7)
15921
+ if (power === _0n8)
15664
15922
  return Fp.ONE;
15665
- if (power === _1n7)
15923
+ if (power === _1n8)
15666
15924
  return num;
15667
15925
  let p = Fp.ONE;
15668
15926
  let d = num;
15669
- while (power > _0n7) {
15670
- if (power & _1n7)
15927
+ while (power > _0n8) {
15928
+ if (power & _1n8)
15671
15929
  p = Fp.mul(p, d);
15672
15930
  d = Fp.sqr(d);
15673
- power >>= _1n7;
15931
+ power >>= _1n8;
15674
15932
  }
15675
15933
  return p;
15676
15934
  }
@@ -15692,7 +15950,7 @@ function FpInvertBatch2(Fp, nums, passZero = false) {
15692
15950
  return inverted;
15693
15951
  }
15694
15952
  function FpLegendre2(Fp, n) {
15695
- const p1mod2 = (Fp.ORDER - _1n7) / _2n5;
15953
+ const p1mod2 = (Fp.ORDER - _1n8) / _2n6;
15696
15954
  const powered = Fp.pow(n, p1mod2);
15697
15955
  const yes = Fp.eql(powered, Fp.ONE);
15698
15956
  const zero = Fp.eql(powered, Fp.ZERO);
@@ -15709,7 +15967,7 @@ function nLength2(n, nBitLength) {
15709
15967
  return { nBitLength: _nBitLength, nByteLength };
15710
15968
  }
15711
15969
  function Field2(ORDER, bitLenOrOpts, isLE2 = false, opts = {}) {
15712
- if (ORDER <= _0n7)
15970
+ if (ORDER <= _0n8)
15713
15971
  throw new Error("invalid field: expected ORDER > 0, got " + ORDER);
15714
15972
  let _nbitLength = void 0;
15715
15973
  let _sqrt = void 0;
@@ -15744,19 +16002,19 @@ function Field2(ORDER, bitLenOrOpts, isLE2 = false, opts = {}) {
15744
16002
  BITS,
15745
16003
  BYTES,
15746
16004
  MASK: bitMask2(BITS),
15747
- ZERO: _0n7,
15748
- ONE: _1n7,
16005
+ ZERO: _0n8,
16006
+ ONE: _1n8,
15749
16007
  allowedLengths,
15750
16008
  create: (num) => mod2(num, ORDER),
15751
16009
  isValid: (num) => {
15752
16010
  if (typeof num !== "bigint")
15753
16011
  throw new Error("invalid field element: expected bigint, got " + typeof num);
15754
- return _0n7 <= num && num < ORDER;
16012
+ return _0n8 <= num && num < ORDER;
15755
16013
  },
15756
- is0: (num) => num === _0n7,
16014
+ is0: (num) => num === _0n8,
15757
16015
  // is valid and invertible
15758
16016
  isValidNot0: (num) => !f.is0(num) && f.isValid(num),
15759
- isOdd: (num) => (num & _1n7) === _1n7,
16017
+ isOdd: (num) => (num & _1n8) === _1n8,
15760
16018
  neg: (num) => mod2(-num, ORDER),
15761
16019
  eql: (lhs, rhs) => lhs === rhs,
15762
16020
  sqr: (num) => mod2(num * num, ORDER),
@@ -15822,13 +16080,13 @@ function mapHashToField2(key, fieldOrder, isLE2 = false) {
15822
16080
  if (len < 16 || len < minLen || len > 1024)
15823
16081
  throw new Error("expected " + minLen + "-1024 bytes of input, got " + len);
15824
16082
  const num = isLE2 ? bytesToNumberLE2(key) : bytesToNumberBE2(key);
15825
- const reduced = mod2(num, fieldOrder - _1n7) + _1n7;
16083
+ const reduced = mod2(num, fieldOrder - _1n8) + _1n8;
15826
16084
  return isLE2 ? numberToBytesLE2(reduced, fieldLen) : numberToBytesBE2(reduced, fieldLen);
15827
16085
  }
15828
16086
 
15829
16087
  // ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/curve.js
15830
- var _0n8 = BigInt(0);
15831
- var _1n8 = BigInt(1);
16088
+ var _0n9 = BigInt(0);
16089
+ var _1n9 = BigInt(1);
15832
16090
  function negateCt2(condition, item) {
15833
16091
  const neg = item.negate();
15834
16092
  return condition ? neg : item;
@@ -15856,7 +16114,7 @@ function calcOffsets2(n, window2, wOpts) {
15856
16114
  let nextN = n >> shiftBy;
15857
16115
  if (wbits > windowSize) {
15858
16116
  wbits -= maxNumber;
15859
- nextN += _1n8;
16117
+ nextN += _1n9;
15860
16118
  }
15861
16119
  const offsetStart = window2 * windowSize;
15862
16120
  const offset = offsetStart + Math.abs(wbits) - 1;
@@ -15888,7 +16146,7 @@ function getW2(P) {
15888
16146
  return pointWindowSizes2.get(P) || 1;
15889
16147
  }
15890
16148
  function assert02(n) {
15891
- if (n !== _0n8)
16149
+ if (n !== _0n9)
15892
16150
  throw new Error("invalid wNAF");
15893
16151
  }
15894
16152
  var wNAF2 = class {
@@ -15902,11 +16160,11 @@ var wNAF2 = class {
15902
16160
  // non-const time multiplication ladder
15903
16161
  _unsafeLadder(elm, n, p = this.ZERO) {
15904
16162
  let d = elm;
15905
- while (n > _0n8) {
15906
- if (n & _1n8)
16163
+ while (n > _0n9) {
16164
+ if (n & _1n9)
15907
16165
  p = p.add(d);
15908
16166
  d = d.double();
15909
- n >>= _1n8;
16167
+ n >>= _1n9;
15910
16168
  }
15911
16169
  return p;
15912
16170
  }
@@ -15970,7 +16228,7 @@ var wNAF2 = class {
15970
16228
  wNAFUnsafe(W, precomputes, n, acc = this.ZERO) {
15971
16229
  const wo = calcWOpts2(W, this.bits);
15972
16230
  for (let window2 = 0; window2 < wo.windows; window2++) {
15973
- if (n === _0n8)
16231
+ if (n === _0n9)
15974
16232
  break;
15975
16233
  const { nextN, offset, isZero, isNeg } = calcOffsets2(n, window2, wo);
15976
16234
  n = nextN;
@@ -16022,14 +16280,14 @@ function mulEndoUnsafe2(Point2, point, k1, k2) {
16022
16280
  let acc = point;
16023
16281
  let p1 = Point2.ZERO;
16024
16282
  let p2 = Point2.ZERO;
16025
- while (k1 > _0n8 || k2 > _0n8) {
16026
- if (k1 & _1n8)
16283
+ while (k1 > _0n9 || k2 > _0n9) {
16284
+ if (k1 & _1n9)
16027
16285
  p1 = p1.add(acc);
16028
- if (k2 & _1n8)
16286
+ if (k2 & _1n9)
16029
16287
  p2 = p2.add(acc);
16030
16288
  acc = acc.double();
16031
- k1 >>= _1n8;
16032
- k2 >>= _1n8;
16289
+ k1 >>= _1n9;
16290
+ k2 >>= _1n9;
16033
16291
  }
16034
16292
  return { p1, p2 };
16035
16293
  }
@@ -16089,7 +16347,7 @@ function _createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) {
16089
16347
  throw new Error(`expected valid ${type} CURVE object`);
16090
16348
  for (const p of ["p", "n", "h"]) {
16091
16349
  const val = CURVE[p];
16092
- if (!(typeof val === "bigint" && val > _0n8))
16350
+ if (!(typeof val === "bigint" && val > _0n9))
16093
16351
  throw new Error(`CURVE.${p} must be positive bigint`);
16094
16352
  }
16095
16353
  const Fp = createField2(CURVE.p, curveOpts.Fp, FpFnLE);
@@ -16105,21 +16363,21 @@ function _createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) {
16105
16363
  }
16106
16364
 
16107
16365
  // ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/weierstrass.js
16108
- var divNearest2 = (num, den) => (num + (num >= 0 ? den : -den) / _2n6) / den;
16366
+ var divNearest2 = (num, den) => (num + (num >= 0 ? den : -den) / _2n7) / den;
16109
16367
  function _splitEndoScalar2(k, basis, n) {
16110
16368
  const [[a1, b1], [a2, b2]] = basis;
16111
16369
  const c1 = divNearest2(b2 * k, n);
16112
16370
  const c2 = divNearest2(-b1 * k, n);
16113
16371
  let k1 = k - c1 * a1 - c2 * a2;
16114
16372
  let k2 = -c1 * b1 - c2 * b2;
16115
- const k1neg = k1 < _0n9;
16116
- const k2neg = k2 < _0n9;
16373
+ const k1neg = k1 < _0n10;
16374
+ const k2neg = k2 < _0n10;
16117
16375
  if (k1neg)
16118
16376
  k1 = -k1;
16119
16377
  if (k2neg)
16120
16378
  k2 = -k2;
16121
- const MAX_NUM = bitMask2(Math.ceil(bitLen2(n) / 2)) + _1n9;
16122
- if (k1 < _0n9 || k1 >= MAX_NUM || k2 < _0n9 || k2 >= MAX_NUM) {
16379
+ const MAX_NUM = bitMask2(Math.ceil(bitLen2(n) / 2)) + _1n10;
16380
+ if (k1 < _0n10 || k1 >= MAX_NUM || k2 < _0n10 || k2 >= MAX_NUM) {
16123
16381
  throw new Error("splitScalar (endomorphism): failed, k=" + k);
16124
16382
  }
16125
16383
  return { k1neg, k1, k2neg, k2 };
@@ -16207,7 +16465,7 @@ var DER2 = {
16207
16465
  _int: {
16208
16466
  encode(num) {
16209
16467
  const { Err: E } = DER2;
16210
- if (num < _0n9)
16468
+ if (num < _0n10)
16211
16469
  throw new E("integer: negative integers are not allowed");
16212
16470
  let hex = numberToHexUnpadded2(num);
16213
16471
  if (Number.parseInt(hex[0], 16) & 8)
@@ -16245,9 +16503,9 @@ var DER2 = {
16245
16503
  return tlv.encode(48, seq);
16246
16504
  }
16247
16505
  };
16248
- var _0n9 = BigInt(0);
16249
- var _1n9 = BigInt(1);
16250
- var _2n6 = BigInt(2);
16506
+ var _0n10 = BigInt(0);
16507
+ var _1n10 = BigInt(1);
16508
+ var _2n7 = BigInt(2);
16251
16509
  var _3n4 = BigInt(3);
16252
16510
  var _4n4 = BigInt(4);
16253
16511
  function _normFnElement(Fn2, key) {
@@ -16619,9 +16877,9 @@ function weierstrassN(params, extraOpts = {}) {
16619
16877
  const p = this;
16620
16878
  if (!Fn2.isValid(sc))
16621
16879
  throw new Error("invalid scalar: out of range");
16622
- if (sc === _0n9 || p.is0())
16880
+ if (sc === _0n10 || p.is0())
16623
16881
  return Point2.ZERO;
16624
- if (sc === _1n9)
16882
+ if (sc === _1n10)
16625
16883
  return p;
16626
16884
  if (wnaf.hasCache(this))
16627
16885
  return this.multiply(sc);
@@ -16650,7 +16908,7 @@ function weierstrassN(params, extraOpts = {}) {
16650
16908
  */
16651
16909
  isTorsionFree() {
16652
16910
  const { isTorsionFree } = extraOpts;
16653
- if (cofactor === _1n9)
16911
+ if (cofactor === _1n10)
16654
16912
  return true;
16655
16913
  if (isTorsionFree)
16656
16914
  return isTorsionFree(Point2, this);
@@ -16658,7 +16916,7 @@ function weierstrassN(params, extraOpts = {}) {
16658
16916
  }
16659
16917
  clearCofactor() {
16660
16918
  const { clearCofactor } = extraOpts;
16661
- if (cofactor === _1n9)
16919
+ if (cofactor === _1n10)
16662
16920
  return this;
16663
16921
  if (clearCofactor)
16664
16922
  return clearCofactor(Point2, this);
@@ -16816,7 +17074,7 @@ function ecdsa2(Point2, hash, ecdsaOpts = {}) {
16816
17074
  };
16817
17075
  const defaultSigOpts_format = "compact";
16818
17076
  function isBiggerThanHalfOrder(number) {
16819
- const HALF = CURVE_ORDER >> _1n9;
17077
+ const HALF = CURVE_ORDER >> _1n10;
16820
17078
  return number > HALF;
16821
17079
  }
16822
17080
  function validateRS(title, num) {
@@ -16866,7 +17124,7 @@ function ecdsa2(Point2, hash, ecdsaOpts = {}) {
16866
17124
  const { r, s, recovery: rec } = this;
16867
17125
  if (rec == null || ![0, 1, 2, 3].includes(rec))
16868
17126
  throw new Error("recovery id invalid");
16869
- const hasCofactor = CURVE_ORDER * _2n6 < FIELD_ORDER;
17127
+ const hasCofactor = CURVE_ORDER * _2n7 < FIELD_ORDER;
16870
17128
  if (hasCofactor && rec > 1)
16871
17129
  throw new Error("recovery id is ambiguous for h>1 curve");
16872
17130
  const radj = rec === 2 || rec === 3 ? r + CURVE_ORDER : r;
@@ -16941,7 +17199,7 @@ function ecdsa2(Point2, hash, ecdsaOpts = {}) {
16941
17199
  };
16942
17200
  const ORDER_MASK = bitMask2(fnBits);
16943
17201
  function int2octets(num) {
16944
- aInRange2("num < 2^" + fnBits, num, _0n9, ORDER_MASK);
17202
+ aInRange2("num < 2^" + fnBits, num, _0n10, ORDER_MASK);
16945
17203
  return Fn2.toBytes(num);
16946
17204
  }
16947
17205
  function validateMsgAndHash(message, prehash) {
@@ -16969,12 +17227,12 @@ function ecdsa2(Point2, hash, ecdsaOpts = {}) {
16969
17227
  const ik = Fn2.inv(k);
16970
17228
  const q = Point2.BASE.multiply(k).toAffine();
16971
17229
  const r = Fn2.create(q.x);
16972
- if (r === _0n9)
17230
+ if (r === _0n10)
16973
17231
  return;
16974
17232
  const s = Fn2.create(ik * Fn2.create(m + r * d));
16975
- if (s === _0n9)
17233
+ if (s === _0n10)
16976
17234
  return;
16977
- let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n9);
17235
+ let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n10);
16978
17236
  let normS = s;
16979
17237
  if (lowS && isBiggerThanHalfOrder(s)) {
16980
17238
  normS = Fn2.neg(s);
@@ -17141,7 +17399,7 @@ var secp256k1_ENDO2 = {
17141
17399
  [BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
17142
17400
  ]
17143
17401
  };
17144
- var _2n7 = /* @__PURE__ */ BigInt(2);
17402
+ var _2n8 = /* @__PURE__ */ BigInt(2);
17145
17403
  function sqrtMod2(y) {
17146
17404
  const P = secp256k1_CURVE2.p;
17147
17405
  const _3n5 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
@@ -17150,7 +17408,7 @@ function sqrtMod2(y) {
17150
17408
  const b3 = b2 * b2 * y % P;
17151
17409
  const b6 = pow22(b3, _3n5, P) * b3 % P;
17152
17410
  const b9 = pow22(b6, _3n5, P) * b3 % P;
17153
- const b11 = pow22(b9, _2n7, P) * b2 % P;
17411
+ const b11 = pow22(b9, _2n8, P) * b2 % P;
17154
17412
  const b22 = pow22(b11, _11n, P) * b11 % P;
17155
17413
  const b44 = pow22(b22, _22n, P) * b22 % P;
17156
17414
  const b88 = pow22(b44, _44n, P) * b44 % P;
@@ -17159,7 +17417,7 @@ function sqrtMod2(y) {
17159
17417
  const b223 = pow22(b220, _3n5, P) * b3 % P;
17160
17418
  const t1 = pow22(b223, _23n, P) * b22 % P;
17161
17419
  const t2 = pow22(t1, _6n, P) * b2 % P;
17162
- const root = pow22(t2, _2n7, P);
17420
+ const root = pow22(t2, _2n8, P);
17163
17421
  if (!Fpk12.eql(Fpk12.sqr(root), y))
17164
17422
  throw new Error("Cannot find square root");
17165
17423
  return root;
@@ -17274,9 +17532,9 @@ async function deleteArweaveJwkFromCache(path, nodeType) {
17274
17532
  }
17275
17533
 
17276
17534
  // ../../node_modules/.pnpm/@noble+curves@2.0.1/node_modules/@noble/curves/abstract/edwards.js
17277
- var _0n10 = BigInt(0);
17278
- var _1n10 = BigInt(1);
17279
- var _2n8 = BigInt(2);
17535
+ var _0n11 = BigInt(0);
17536
+ var _1n11 = BigInt(1);
17537
+ var _2n9 = BigInt(2);
17280
17538
  var _8n3 = BigInt(8);
17281
17539
  function isEdValidXY(Fp, CURVE, x, y) {
17282
17540
  const x2 = Fp.sqr(x);
@@ -17291,19 +17549,19 @@ function edwards(params, extraOpts = {}) {
17291
17549
  let CURVE = validated.CURVE;
17292
17550
  const { h: cofactor } = CURVE;
17293
17551
  validateObject(extraOpts, {}, { uvRatio: "function" });
17294
- const MASK = _2n8 << BigInt(Fn2.BYTES * 8) - _1n10;
17552
+ const MASK = _2n9 << BigInt(Fn2.BYTES * 8) - _1n11;
17295
17553
  const modP = (n) => Fp.create(n);
17296
17554
  const uvRatio2 = extraOpts.uvRatio || ((u, v) => {
17297
17555
  try {
17298
17556
  return { isValid: true, value: Fp.sqrt(Fp.div(u, v)) };
17299
17557
  } catch (e) {
17300
- return { isValid: false, value: _0n10 };
17558
+ return { isValid: false, value: _0n11 };
17301
17559
  }
17302
17560
  });
17303
17561
  if (!isEdValidXY(Fp, CURVE, CURVE.Gx, CURVE.Gy))
17304
17562
  throw new Error("bad curve params: generator point");
17305
17563
  function acoord(title, n, banZero = false) {
17306
- const min = banZero ? _1n10 : _0n10;
17564
+ const min = banZero ? _1n11 : _0n11;
17307
17565
  aInRange("coordinate " + title, n, min, MASK);
17308
17566
  return n;
17309
17567
  }
@@ -17320,8 +17578,8 @@ function edwards(params, extraOpts = {}) {
17320
17578
  const y = modP(Y * iz);
17321
17579
  const zz = Fp.mul(Z, iz);
17322
17580
  if (is0)
17323
- return { x: _0n10, y: _1n10 };
17324
- if (zz !== _1n10)
17581
+ return { x: _0n11, y: _1n11 };
17582
+ if (zz !== _1n11)
17325
17583
  throw new Error("invZ was invalid");
17326
17584
  return { x, y };
17327
17585
  });
@@ -17347,9 +17605,9 @@ function edwards(params, extraOpts = {}) {
17347
17605
  });
17348
17606
  class Point2 {
17349
17607
  // base / generator point
17350
- static BASE = new Point2(CURVE.Gx, CURVE.Gy, _1n10, modP(CURVE.Gx * CURVE.Gy));
17608
+ static BASE = new Point2(CURVE.Gx, CURVE.Gy, _1n11, modP(CURVE.Gx * CURVE.Gy));
17351
17609
  // zero / infinity / identity point
17352
- static ZERO = new Point2(_0n10, _1n10, _1n10, _0n10);
17610
+ static ZERO = new Point2(_0n11, _1n11, _1n11, _0n11);
17353
17611
  // 0, 1, 1, 0
17354
17612
  // math field
17355
17613
  static Fp = Fp;
@@ -17375,7 +17633,7 @@ function edwards(params, extraOpts = {}) {
17375
17633
  const { x, y } = p || {};
17376
17634
  acoord("x", x);
17377
17635
  acoord("y", y);
17378
- return new Point2(x, y, _1n10, modP(x * y));
17636
+ return new Point2(x, y, _1n11, modP(x * y));
17379
17637
  }
17380
17638
  // Uses algo from RFC8032 5.1.3.
17381
17639
  static fromBytes(bytes, zip215 = false) {
@@ -17388,16 +17646,16 @@ function edwards(params, extraOpts = {}) {
17388
17646
  normed[len - 1] = lastByte & ~128;
17389
17647
  const y = bytesToNumberLE(normed);
17390
17648
  const max = zip215 ? MASK : Fp.ORDER;
17391
- aInRange("point.y", y, _0n10, max);
17649
+ aInRange("point.y", y, _0n11, max);
17392
17650
  const y2 = modP(y * y);
17393
- const u = modP(y2 - _1n10);
17651
+ const u = modP(y2 - _1n11);
17394
17652
  const v = modP(d * y2 - a);
17395
17653
  let { isValid, value: x } = uvRatio2(u, v);
17396
17654
  if (!isValid)
17397
17655
  throw new Error("bad point: invalid y coordinate");
17398
- const isXOdd = (x & _1n10) === _1n10;
17656
+ const isXOdd = (x & _1n11) === _1n11;
17399
17657
  const isLastByteOdd = (lastByte & 128) !== 0;
17400
- if (!zip215 && x === _0n10 && isLastByteOdd)
17658
+ if (!zip215 && x === _0n11 && isLastByteOdd)
17401
17659
  throw new Error("bad point: x=0 and x_0=1");
17402
17660
  if (isLastByteOdd !== isXOdd)
17403
17661
  x = modP(-x);
@@ -17415,7 +17673,7 @@ function edwards(params, extraOpts = {}) {
17415
17673
  precompute(windowSize = 8, isLazy = true) {
17416
17674
  wnaf.createCache(this, windowSize);
17417
17675
  if (!isLazy)
17418
- this.multiply(_2n8);
17676
+ this.multiply(_2n9);
17419
17677
  return this;
17420
17678
  }
17421
17679
  // Useful in fromAffine() - not for fromBytes(), which always created valid points.
@@ -17447,7 +17705,7 @@ function edwards(params, extraOpts = {}) {
17447
17705
  const { X: X1, Y: Y1, Z: Z1 } = this;
17448
17706
  const A = modP(X1 * X1);
17449
17707
  const B = modP(Y1 * Y1);
17450
- const C = modP(_2n8 * modP(Z1 * Z1));
17708
+ const C = modP(_2n9 * modP(Z1 * Z1));
17451
17709
  const D = modP(a * A);
17452
17710
  const x1y1 = X1 + Y1;
17453
17711
  const E = modP(modP(x1y1 * x1y1) - A - B);
@@ -17500,9 +17758,9 @@ function edwards(params, extraOpts = {}) {
17500
17758
  multiplyUnsafe(scalar, acc = Point2.ZERO) {
17501
17759
  if (!Fn2.isValid(scalar))
17502
17760
  throw new Error("invalid scalar: expected 0 <= sc < curve.n");
17503
- if (scalar === _0n10)
17761
+ if (scalar === _0n11)
17504
17762
  return Point2.ZERO;
17505
- if (this.is0() || scalar === _1n10)
17763
+ if (this.is0() || scalar === _1n11)
17506
17764
  return this;
17507
17765
  return wnaf.unsafe(this, scalar, (p) => normalizeZ(Point2, p), acc);
17508
17766
  }
@@ -17524,14 +17782,14 @@ function edwards(params, extraOpts = {}) {
17524
17782
  return toAffineMemo(this, invertedZ);
17525
17783
  }
17526
17784
  clearCofactor() {
17527
- if (cofactor === _1n10)
17785
+ if (cofactor === _1n11)
17528
17786
  return this;
17529
17787
  return this.multiplyUnsafe(cofactor);
17530
17788
  }
17531
17789
  toBytes() {
17532
17790
  const { x, y } = this.toAffine();
17533
17791
  const bytes = Fp.toBytes(y);
17534
- bytes[bytes.length - 1] |= x & _1n10 ? 128 : 0;
17792
+ bytes[bytes.length - 1] |= x & _1n11 ? 128 : 0;
17535
17793
  return bytes;
17536
17794
  }
17537
17795
  toHex() {
@@ -17672,7 +17930,7 @@ function eddsa(Point2, cHash, eddsaOpts = {}) {
17672
17930
  const is25519 = size === 32;
17673
17931
  if (!is25519 && size !== 57)
17674
17932
  throw new Error("only defined for 25519 and 448");
17675
- const u = is25519 ? Fp.div(_1n10 + y, _1n10 - y) : Fp.div(y - _1n10, y + _1n10);
17933
+ const u = is25519 ? Fp.div(_1n11 + y, _1n11 - y) : Fp.div(y - _1n11, y + _1n11);
17676
17934
  return Fp.toBytes(u);
17677
17935
  },
17678
17936
  toMontgomerySecret(secretKey) {
@@ -17694,8 +17952,8 @@ function eddsa(Point2, cHash, eddsaOpts = {}) {
17694
17952
  }
17695
17953
 
17696
17954
  // ../../node_modules/.pnpm/@noble+curves@2.0.1/node_modules/@noble/curves/ed25519.js
17697
- var _1n11 = BigInt(1);
17698
- var _2n9 = BigInt(2);
17955
+ var _1n12 = BigInt(1);
17956
+ var _2n10 = BigInt(2);
17699
17957
  var _5n3 = BigInt(5);
17700
17958
  var _8n4 = BigInt(8);
17701
17959
  var ed25519_CURVE_p = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed");
@@ -17713,8 +17971,8 @@ function ed25519_pow_2_252_3(x) {
17713
17971
  const P = ed25519_CURVE_p;
17714
17972
  const x2 = x * x % P;
17715
17973
  const b2 = x2 * x % P;
17716
- const b4 = pow2(b2, _2n9, P) * b2 % P;
17717
- const b5 = pow2(b4, _1n11, P) * x % P;
17974
+ const b4 = pow2(b2, _2n10, P) * b2 % P;
17975
+ const b5 = pow2(b4, _1n12, P) * x % P;
17718
17976
  const b10 = pow2(b5, _5n3, P) * b5 % P;
17719
17977
  const b20 = pow2(b10, _10n, P) * b10 % P;
17720
17978
  const b40 = pow2(b20, _20n, P) * b20 % P;
@@ -17722,7 +17980,7 @@ function ed25519_pow_2_252_3(x) {
17722
17980
  const b160 = pow2(b80, _80n, P) * b80 % P;
17723
17981
  const b240 = pow2(b160, _80n, P) * b80 % P;
17724
17982
  const b250 = pow2(b240, _10n, P) * b10 % P;
17725
- const pow_p_5_8 = pow2(b250, _2n9, P) * x % P;
17983
+ const pow_p_5_8 = pow2(b250, _2n10, P) * x % P;
17726
17984
  return { pow_p_5_8, b2 };
17727
17985
  }
17728
17986
  function adjustScalarBytes(bytes) {
@@ -17758,191 +18016,6 @@ function ed(opts) {
17758
18016
  }
17759
18017
  var ed25519 = /* @__PURE__ */ ed({});
17760
18018
 
17761
- // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/sha3.js
17762
- var _0n11 = BigInt(0);
17763
- var _1n12 = BigInt(1);
17764
- var _2n10 = BigInt(2);
17765
- var _7n4 = BigInt(7);
17766
- var _256n2 = BigInt(256);
17767
- var _0x71n2 = BigInt(113);
17768
- var SHA3_PI2 = [];
17769
- var SHA3_ROTL2 = [];
17770
- var _SHA3_IOTA2 = [];
17771
- for (let round = 0, R = _1n12, x = 1, y = 0; round < 24; round++) {
17772
- [x, y] = [y, (2 * x + 3 * y) % 5];
17773
- SHA3_PI2.push(2 * (5 * y + x));
17774
- SHA3_ROTL2.push((round + 1) * (round + 2) / 2 % 64);
17775
- let t = _0n11;
17776
- for (let j = 0; j < 7; j++) {
17777
- R = (R << _1n12 ^ (R >> _7n4) * _0x71n2) % _256n2;
17778
- if (R & _2n10)
17779
- t ^= _1n12 << (_1n12 << BigInt(j)) - _1n12;
17780
- }
17781
- _SHA3_IOTA2.push(t);
17782
- }
17783
- var IOTAS2 = split2(_SHA3_IOTA2, true);
17784
- var SHA3_IOTA_H2 = IOTAS2[0];
17785
- var SHA3_IOTA_L2 = IOTAS2[1];
17786
- var rotlH2 = (h, l, s) => s > 32 ? rotlBH2(h, l, s) : rotlSH2(h, l, s);
17787
- var rotlL2 = (h, l, s) => s > 32 ? rotlBL2(h, l, s) : rotlSL2(h, l, s);
17788
- function keccakP2(s, rounds = 24) {
17789
- const B = new Uint32Array(5 * 2);
17790
- for (let round = 24 - rounds; round < 24; round++) {
17791
- for (let x = 0; x < 10; x++)
17792
- B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
17793
- for (let x = 0; x < 10; x += 2) {
17794
- const idx1 = (x + 8) % 10;
17795
- const idx0 = (x + 2) % 10;
17796
- const B0 = B[idx0];
17797
- const B1 = B[idx0 + 1];
17798
- const Th = rotlH2(B0, B1, 1) ^ B[idx1];
17799
- const Tl = rotlL2(B0, B1, 1) ^ B[idx1 + 1];
17800
- for (let y = 0; y < 50; y += 10) {
17801
- s[x + y] ^= Th;
17802
- s[x + y + 1] ^= Tl;
17803
- }
17804
- }
17805
- let curH = s[2];
17806
- let curL = s[3];
17807
- for (let t = 0; t < 24; t++) {
17808
- const shift = SHA3_ROTL2[t];
17809
- const Th = rotlH2(curH, curL, shift);
17810
- const Tl = rotlL2(curH, curL, shift);
17811
- const PI = SHA3_PI2[t];
17812
- curH = s[PI];
17813
- curL = s[PI + 1];
17814
- s[PI] = Th;
17815
- s[PI + 1] = Tl;
17816
- }
17817
- for (let y = 0; y < 50; y += 10) {
17818
- for (let x = 0; x < 10; x++)
17819
- B[x] = s[y + x];
17820
- for (let x = 0; x < 10; x++)
17821
- s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
17822
- }
17823
- s[0] ^= SHA3_IOTA_H2[round];
17824
- s[1] ^= SHA3_IOTA_L2[round];
17825
- }
17826
- clean2(B);
17827
- }
17828
- var Keccak2 = class _Keccak {
17829
- state;
17830
- pos = 0;
17831
- posOut = 0;
17832
- finished = false;
17833
- state32;
17834
- destroyed = false;
17835
- blockLen;
17836
- suffix;
17837
- outputLen;
17838
- enableXOF = false;
17839
- rounds;
17840
- // NOTE: we accept arguments in bytes instead of bits here.
17841
- constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
17842
- this.blockLen = blockLen;
17843
- this.suffix = suffix;
17844
- this.outputLen = outputLen;
17845
- this.enableXOF = enableXOF;
17846
- this.rounds = rounds;
17847
- anumber2(outputLen, "outputLen");
17848
- if (!(0 < blockLen && blockLen < 200))
17849
- throw new Error("only keccak-f1600 function is supported");
17850
- this.state = new Uint8Array(200);
17851
- this.state32 = u322(this.state);
17852
- }
17853
- clone() {
17854
- return this._cloneInto();
17855
- }
17856
- keccak() {
17857
- swap32IfBE2(this.state32);
17858
- keccakP2(this.state32, this.rounds);
17859
- swap32IfBE2(this.state32);
17860
- this.posOut = 0;
17861
- this.pos = 0;
17862
- }
17863
- update(data) {
17864
- aexists2(this);
17865
- abytes2(data);
17866
- const { blockLen, state } = this;
17867
- const len = data.length;
17868
- for (let pos = 0; pos < len; ) {
17869
- const take = Math.min(blockLen - this.pos, len - pos);
17870
- for (let i = 0; i < take; i++)
17871
- state[this.pos++] ^= data[pos++];
17872
- if (this.pos === blockLen)
17873
- this.keccak();
17874
- }
17875
- return this;
17876
- }
17877
- finish() {
17878
- if (this.finished)
17879
- return;
17880
- this.finished = true;
17881
- const { state, suffix, pos, blockLen } = this;
17882
- state[pos] ^= suffix;
17883
- if ((suffix & 128) !== 0 && pos === blockLen - 1)
17884
- this.keccak();
17885
- state[blockLen - 1] ^= 128;
17886
- this.keccak();
17887
- }
17888
- writeInto(out) {
17889
- aexists2(this, false);
17890
- abytes2(out);
17891
- this.finish();
17892
- const bufferOut = this.state;
17893
- const { blockLen } = this;
17894
- for (let pos = 0, len = out.length; pos < len; ) {
17895
- if (this.posOut >= blockLen)
17896
- this.keccak();
17897
- const take = Math.min(blockLen - this.posOut, len - pos);
17898
- out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
17899
- this.posOut += take;
17900
- pos += take;
17901
- }
17902
- return out;
17903
- }
17904
- xofInto(out) {
17905
- if (!this.enableXOF)
17906
- throw new Error("XOF is not possible for this instance");
17907
- return this.writeInto(out);
17908
- }
17909
- xof(bytes) {
17910
- anumber2(bytes);
17911
- return this.xofInto(new Uint8Array(bytes));
17912
- }
17913
- digestInto(out) {
17914
- aoutput2(out, this);
17915
- if (this.finished)
17916
- throw new Error("digest() was already called");
17917
- this.writeInto(out);
17918
- this.destroy();
17919
- return out;
17920
- }
17921
- digest() {
17922
- return this.digestInto(new Uint8Array(this.outputLen));
17923
- }
17924
- destroy() {
17925
- this.destroyed = true;
17926
- clean2(this.state);
17927
- }
17928
- _cloneInto(to) {
17929
- const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
17930
- to ||= new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds);
17931
- to.state32.set(this.state32);
17932
- to.pos = this.pos;
17933
- to.posOut = this.posOut;
17934
- to.finished = this.finished;
17935
- to.rounds = rounds;
17936
- to.suffix = suffix;
17937
- to.outputLen = outputLen;
17938
- to.enableXOF = enableXOF;
17939
- to.destroyed = this.destroyed;
17940
- return to;
17941
- }
17942
- };
17943
- var genKeccak = (suffix, blockLen, outputLen, info = {}) => createHasher2(() => new Keccak2(blockLen, suffix, outputLen), info);
17944
- var keccak_2562 = /* @__PURE__ */ genKeccak(1, 136, 32);
17945
-
17946
18019
  // ../mill/dist/chunk-44VWYELC.js
17947
18020
  var import_ed25519_hd_key = __toESM(require_dist(), 1);
17948
18021
  var MillWalletError = class extends Error {
@@ -18014,13 +18087,13 @@ function deriveEvm(seed, accountIndex, addressIndex) {
18014
18087
  }
18015
18088
  function computeEvmAddress(privateKey) {
18016
18089
  const uncompressed = secp256k1.getPublicKey(privateKey, false);
18017
- const hash = keccak_2562(uncompressed.slice(1));
18090
+ const hash = keccak_256(uncompressed.slice(1));
18018
18091
  const addressHex = bytesToHex2(hash.slice(-20));
18019
18092
  return toChecksumAddress(addressHex);
18020
18093
  }
18021
18094
  function toChecksumAddress(addressHex) {
18022
18095
  const lower = addressHex.toLowerCase();
18023
- const hashHex = bytesToHex2(keccak_2562(new TextEncoder().encode(lower)));
18096
+ const hashHex = bytesToHex2(keccak_256(new TextEncoder().encode(lower)));
18024
18097
  let out = "0x";
18025
18098
  for (let i = 0; i < 40; i++) {
18026
18099
  const ch = lower.charAt(i);
@@ -18048,7 +18121,7 @@ function deriveMina(seed, accountIndex, addressIndex) {
18048
18121
  const firstByte = scalar[0];
18049
18122
  scalar[0] = firstByte & 63;
18050
18123
  const privateKeyHex = bytesToHex2(scalar);
18051
- const publicKeyHex = bytesToHex2(keccak_2562(scalar));
18124
+ const publicKeyHex = bytesToHex2(keccak_256(scalar));
18052
18125
  return {
18053
18126
  privateKey: privateKeyHex,
18054
18127
  publicKey: publicKeyHex,
@@ -18065,15 +18138,15 @@ function deriveSolana(seed, accountIndex) {
18065
18138
  }
18066
18139
 
18067
18140
  // src/wallet/manager.ts
18068
- var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
18069
- function base58Encode(bytes) {
18141
+ var BASE58_ALPHABET2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
18142
+ function base58Encode2(bytes) {
18070
18143
  let zeros = 0;
18071
18144
  for (let i = 0; i < bytes.length && bytes[i] === 0; i++) zeros++;
18072
18145
  let value = 0n;
18073
18146
  for (const byte of bytes) value = value * 256n + BigInt(byte);
18074
18147
  let result = "";
18075
18148
  while (value > 0n) {
18076
- result = BASE58_ALPHABET[Number(value % 58n)] + result;
18149
+ result = BASE58_ALPHABET2[Number(value % 58n)] + result;
18077
18150
  value = value / 58n;
18078
18151
  }
18079
18152
  for (let i = 0; i < zeros; i++) result = "1" + result;
@@ -18226,7 +18299,7 @@ var WalletManager = class {
18226
18299
  accountIndex: derivationIndex
18227
18300
  });
18228
18301
  if (chainKeys.solana) {
18229
- solanaAddress = base58Encode(chainKeys.solana.publicKey);
18302
+ solanaAddress = base58Encode2(chainKeys.solana.publicKey);
18230
18303
  solanaPrivateKey = chainKeys.solana.privateKey;
18231
18304
  solanaDerivationPath = chainKeys.solana.path;
18232
18305
  }
@@ -18261,6 +18334,74 @@ var WalletManager = class {
18261
18334
  const keys = this.getNodeKeys(nodeType);
18262
18335
  return bytesToHex(keys.evmPrivateKey);
18263
18336
  }
18337
+ /**
18338
+ * Derive the APEX (connector) settlement key from the operator mnemonic at
18339
+ * ACCOUNT_INDEX_APEX. The apex signs settlement claims with this key, so the
18340
+ * operator never has to supply a raw `keyId` to `townhouse chains add`.
18341
+ *
18342
+ * Returns the EVM private key as a `0x`-prefixed 64-char hex string — the
18343
+ * form the connector config's `keyId` expects (matches the dev placeholder
18344
+ * `0x7c85…`). Also returns Solana + Mina settlement keys (connector 3.9.0)
18345
+ * derived at the same `ACCOUNT_INDEX_APEX`, in the RAW base58 form the
18346
+ * connector resolves a non-EVM `keyId` as:
18347
+ * - Solana: base58 of the 32-byte Ed25519 seed,
18348
+ * - Mina: `EK…` base58check (via `hexToMinaBase58PrivateKey`).
18349
+ *
18350
+ * EVM derivation must always succeed (it throws on failure). Solana/Mina
18351
+ * derivation is best-effort: if `deriveMillKeys` throws (unsupported
18352
+ * platform, library load error) the corresponding key is OMITTED rather than
18353
+ * failing the whole method, so the EVM keyId path is never blocked.
18354
+ *
18355
+ * Async because `deriveMillKeys` is async. Throws when the wallet is locked.
18356
+ */
18357
+ async getApexSettlementKeys() {
18358
+ if (!this.state) {
18359
+ throw new Error(
18360
+ "Wallet not initialized. Call generate() or fromMnemonic() first."
18361
+ );
18362
+ }
18363
+ const mnemonic = this.state.mnemonic;
18364
+ let seed;
18365
+ let evmPrivateKeyHex;
18366
+ try {
18367
+ seed = mnemonicToSeedSync(mnemonic);
18368
+ const path = `m/44'/60'/${ACCOUNT_INDEX_APEX}'/0/0`;
18369
+ const hd = HDKey.fromMasterSeed(seed).derive(path);
18370
+ if (!hd.privateKey) {
18371
+ throw new Error(`Apex EVM private key missing at ${path}`);
18372
+ }
18373
+ evmPrivateKeyHex = `0x${bytesToHex(new Uint8Array(hd.privateKey))}`;
18374
+ } finally {
18375
+ if (seed) seed.fill(0);
18376
+ }
18377
+ let solanaPrivateKeyBase58;
18378
+ let minaPrivateKeyBase58;
18379
+ try {
18380
+ const chainKeys = await deriveMillKeys({
18381
+ mnemonic,
18382
+ chains: ["solana", "mina"],
18383
+ accountIndex: ACCOUNT_INDEX_APEX
18384
+ });
18385
+ if (chainKeys.solana) {
18386
+ solanaPrivateKeyBase58 = base58Encode(chainKeys.solana.privateKey);
18387
+ }
18388
+ if (chainKeys.mina) {
18389
+ minaPrivateKeyBase58 = hexToMinaBase58PrivateKey(
18390
+ chainKeys.mina.privateKey
18391
+ );
18392
+ }
18393
+ } catch (err) {
18394
+ const errMsg = err instanceof Error ? err.message : String(err);
18395
+ console.warn(
18396
+ `[WalletManager] deriveMillKeys failed for apex (accountIndex=${ACCOUNT_INDEX_APEX}): ${errMsg} \u2014 Solana/Mina apex keys omitted`
18397
+ );
18398
+ }
18399
+ return {
18400
+ evmPrivateKeyHex,
18401
+ ...solanaPrivateKeyBase58 ? { solanaPrivateKeyBase58 } : {},
18402
+ ...minaPrivateKeyBase58 ? { minaPrivateKeyBase58 } : {}
18403
+ };
18404
+ }
18264
18405
  /**
18265
18406
  * Returns the Solana Ed25519 private key seed for a node as a 64-char
18266
18407
  * lowercase hex string (32 raw seed bytes). Throws when the wallet is
@@ -18405,7 +18546,7 @@ var WalletManager = class {
18405
18546
  accountIndex
18406
18547
  });
18407
18548
  if (chainKeys.solana) {
18408
- chainExtras[nodeType].solanaAddress = base58Encode(
18549
+ chainExtras[nodeType].solanaAddress = base58Encode2(
18409
18550
  chainKeys.solana.publicKey
18410
18551
  );
18411
18552
  chainExtras[nodeType].solanaPrivateKey = chainKeys.solana.privateKey;
@@ -18512,13 +18653,13 @@ function zeroArweaveJwk(jwk) {
18512
18653
  }
18513
18654
  function computeEvmAddress2(privateKey) {
18514
18655
  const uncompressed = secp256k12.getPublicKey(privateKey, false);
18515
- const hash = keccak_256(uncompressed.slice(1));
18656
+ const hash = keccak_2562(uncompressed.slice(1));
18516
18657
  const addressHex = bytesToHex(hash.slice(-20));
18517
18658
  return toChecksumAddress2(addressHex);
18518
18659
  }
18519
18660
  function toChecksumAddress2(addressHex) {
18520
18661
  const lower = addressHex.toLowerCase();
18521
- const hashHex = bytesToHex(keccak_256(new TextEncoder().encode(lower)));
18662
+ const hashHex = bytesToHex(keccak_2562(new TextEncoder().encode(lower)));
18522
18663
  let out = "0x";
18523
18664
  for (let i = 0; i < 40; i++) {
18524
18665
  const ch = lower.charAt(i);
@@ -22862,4 +23003,4 @@ export {
22862
23003
  @scure/bip32/index.js:
22863
23004
  (*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
22864
23005
  */
22865
- //# sourceMappingURL=chunk-ZUMMJFGH.js.map
23006
+ //# sourceMappingURL=chunk-UBFITLPQ.js.map