@gardenfi/core 0.3.0-beta.24 → 0.3.0-beta.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -52,7 +52,7 @@ const Tu = (e) => {
52
52
  return e;
53
53
  }
54
54
  };
55
- class Ft {
55
+ class Mt {
56
56
  static async _postWithFallback(t, r) {
57
57
  let n = "";
58
58
  for (const i of t)
@@ -155,7 +155,7 @@ class Ft {
155
155
  function oo(e) {
156
156
  return (e == null ? void 0 : e.message) || (e == null ? void 0 : e.toString()) || "unknown error";
157
157
  }
158
- const Tn = (e) => new Pu((e == null ? void 0 : e.retryCount) ?? 2, (e == null ? void 0 : e.retryDelay) ?? 1e3), Yt = (e) => e.startsWith("0x") ? e.slice(2) : e;
158
+ const Tn = (e) => new Pu((e == null ? void 0 : e.retryCount) ?? 2, (e == null ? void 0 : e.retryDelay) ?? 1e3), Nt = (e) => e.startsWith("0x") ? e.slice(2) : e;
159
159
  var Mn, Hn, $n;
160
160
  let cs = class {
161
161
  constructor(t, r, n = void 0) {
@@ -750,7 +750,7 @@ class Lu {
750
750
  amount: c,
751
751
  secretHash: s
752
752
  }
753
- }), P = await Ft.post(
753
+ }), P = await Mt.post(
754
754
  this.url.endpoint("initiate"),
755
755
  {
756
756
  body: JSON.stringify({
@@ -773,12 +773,12 @@ class Lu {
773
773
  try {
774
774
  const n = await this.auth.getToken();
775
775
  if (n.error) return j(n.error);
776
- const i = await Ft.post(
776
+ const i = await Mt.post(
777
777
  this.url.endpoint("redeem"),
778
778
  {
779
779
  body: JSON.stringify({
780
780
  order_id: t,
781
- secret: Yt(r),
781
+ secret: Nt(r),
782
782
  perform_on: "Destination"
783
783
  }),
784
784
  headers: {
@@ -817,7 +817,7 @@ function $u() {
817
817
  if (!r) throw new Error(fo.failedToCreateInternalPubkey);
818
818
  return hs(Buffer.from(r));
819
819
  }
820
- var $t = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
820
+ var Dt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
821
821
  function Du(e) {
822
822
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
823
823
  }
@@ -1050,7 +1050,7 @@ Ss.write = function(e, t, r, n, i, s) {
1050
1050
  return u.length === 0 || h.copy(u, 0, 0, f), u;
1051
1051
  }
1052
1052
  if (h.length !== void 0)
1053
- return typeof h.length != "number" || zt(h.length) ? o(0) : y(h);
1053
+ return typeof h.length != "number" || qt(h.length) ? o(0) : y(h);
1054
1054
  if (h.type === "Buffer" && Array.isArray(h.data))
1055
1055
  return y(h.data);
1056
1056
  }
@@ -1247,7 +1247,7 @@ Ss.write = function(e, t, r, n, i, s) {
1247
1247
  };
1248
1248
  function E(h, f, u, p, v) {
1249
1249
  if (h.length === 0) return -1;
1250
- if (typeof u == "string" ? (p = u, u = 0) : u > 2147483647 ? u = 2147483647 : u < -2147483648 && (u = -2147483648), u = +u, zt(u) && (u = v ? 0 : h.length - 1), u < 0 && (u = h.length + u), u >= h.length) {
1250
+ if (typeof u == "string" ? (p = u, u = 0) : u > 2147483647 ? u = 2147483647 : u < -2147483648 && (u = -2147483648), u = +u, qt(u) && (u = v ? 0 : h.length - 1), u < 0 && (u = h.length + u), u >= h.length) {
1251
1251
  if (v) return -1;
1252
1252
  u = h.length - 1;
1253
1253
  } else if (u < 0)
@@ -1305,7 +1305,7 @@ Ss.write = function(e, t, r, n, i, s) {
1305
1305
  let L;
1306
1306
  for (L = 0; L < p; ++L) {
1307
1307
  const Q = parseInt(f.substr(L * 2, 2), 16);
1308
- if (zt(Q)) return L;
1308
+ if (qt(Q)) return L;
1309
1309
  h[u + L] = Q;
1310
1310
  }
1311
1311
  return L;
@@ -1838,7 +1838,7 @@ Ss.write = function(e, t, r, n, i, s) {
1838
1838
  function Ve(h, f) {
1839
1839
  return h instanceof f || h != null && h.constructor != null && h.constructor.name != null && h.constructor.name === f.name;
1840
1840
  }
1841
- function zt(h) {
1841
+ function qt(h) {
1842
1842
  return h !== h;
1843
1843
  }
1844
1844
  const Hr = function() {
@@ -1851,9 +1851,9 @@ Ss.write = function(e, t, r, n, i, s) {
1851
1851
  return f;
1852
1852
  }();
1853
1853
  function Ke(h) {
1854
- return typeof BigInt > "u" ? qt : h;
1854
+ return typeof BigInt > "u" ? Kt : h;
1855
1855
  }
1856
- function qt() {
1856
+ function Kt() {
1857
1857
  throw new Error("BigInt not supported");
1858
1858
  }
1859
1859
  })(Bt);
@@ -2191,13 +2191,13 @@ function De(e, t, r, n) {
2191
2191
  }
2192
2192
  return De(ut(e), t, r);
2193
2193
  }
2194
- for (var Mt in Te)
2195
- De[Mt] = Te[Mt];
2196
- for (Mt in mt)
2197
- De[Mt] = mt[Mt];
2194
+ for (var Ht in Te)
2195
+ De[Ht] = Te[Ht];
2196
+ for (Ht in mt)
2197
+ De[Ht] = mt[Ht];
2198
2198
  var ho = ec();
2199
- for (Mt in ho)
2200
- De[Mt] = ho[Mt];
2199
+ for (Ht in ho)
2200
+ De[Ht] = ho[Ht];
2201
2201
  De.compile = ut;
2202
2202
  De.TfTypeError = Aa;
2203
2203
  De.TfPropertyTypeError = Ia;
@@ -2355,7 +2355,7 @@ class ic {
2355
2355
  }
2356
2356
  }
2357
2357
  Ae.BufferReader = ic;
2358
- var jt = {}, Ar = {}, _t = {}, et = {};
2358
+ var Gt = {}, Ar = {}, _t = {}, et = {};
2359
2359
  Object.defineProperty(et, "__esModule", { value: !0 });
2360
2360
  et.isBytes = Na;
2361
2361
  et.number = Jn;
@@ -3562,7 +3562,7 @@ const za = /* @__PURE__ */ Cs(() => new Ls()), Tc = /* @__PURE__ */ Cs(() => new
3562
3562
  return o(Buffer.concat([e.TAGGED_HASH_PREFIXES[d], g]));
3563
3563
  }
3564
3564
  e.taggedHash = l;
3565
- })(jt);
3565
+ })(Gt);
3566
3566
  var Di = {}, vt = {};
3567
3567
  Object.defineProperty(vt, "__esModule", { value: !0 });
3568
3568
  vt.encode = vt.decode = vt.check = void 0;
@@ -3747,33 +3747,33 @@ for (const e of Object.keys(ls)) {
3747
3747
  const t = ls[e];
3748
3748
  Ka[t] = e;
3749
3749
  }
3750
- var Ht = {};
3751
- Object.defineProperty(Ht, "__esModule", { value: !0 });
3752
- Ht.decode = Ht.encode = Ht.encodingLength = void 0;
3753
- const Nt = Zt;
3750
+ var $t = {};
3751
+ Object.defineProperty($t, "__esModule", { value: !0 });
3752
+ $t.decode = $t.encode = $t.encodingLength = void 0;
3753
+ const Ft = Zt;
3754
3754
  function Ya(e) {
3755
- return e < Nt.OPS.OP_PUSHDATA1 ? 1 : e <= 255 ? 2 : e <= 65535 ? 3 : 5;
3755
+ return e < Ft.OPS.OP_PUSHDATA1 ? 1 : e <= 255 ? 2 : e <= 65535 ? 3 : 5;
3756
3756
  }
3757
- Ht.encodingLength = Ya;
3757
+ $t.encodingLength = Ya;
3758
3758
  function Rc(e, t, r) {
3759
3759
  const n = Ya(t);
3760
- return n === 1 ? e.writeUInt8(t, r) : n === 2 ? (e.writeUInt8(Nt.OPS.OP_PUSHDATA1, r), e.writeUInt8(t, r + 1)) : n === 3 ? (e.writeUInt8(Nt.OPS.OP_PUSHDATA2, r), e.writeUInt16LE(t, r + 1)) : (e.writeUInt8(Nt.OPS.OP_PUSHDATA4, r), e.writeUInt32LE(t, r + 1)), n;
3760
+ return n === 1 ? e.writeUInt8(t, r) : n === 2 ? (e.writeUInt8(Ft.OPS.OP_PUSHDATA1, r), e.writeUInt8(t, r + 1)) : n === 3 ? (e.writeUInt8(Ft.OPS.OP_PUSHDATA2, r), e.writeUInt16LE(t, r + 1)) : (e.writeUInt8(Ft.OPS.OP_PUSHDATA4, r), e.writeUInt32LE(t, r + 1)), n;
3761
3761
  }
3762
- Ht.encode = Rc;
3762
+ $t.encode = Rc;
3763
3763
  function Uc(e, t) {
3764
3764
  const r = e.readUInt8(t);
3765
3765
  let n, i;
3766
- if (r < Nt.OPS.OP_PUSHDATA1)
3766
+ if (r < Ft.OPS.OP_PUSHDATA1)
3767
3767
  n = r, i = 1;
3768
- else if (r === Nt.OPS.OP_PUSHDATA1) {
3768
+ else if (r === Ft.OPS.OP_PUSHDATA1) {
3769
3769
  if (t + 2 > e.length) return null;
3770
3770
  n = e.readUInt8(t + 1), i = 2;
3771
- } else if (r === Nt.OPS.OP_PUSHDATA2) {
3771
+ } else if (r === Ft.OPS.OP_PUSHDATA2) {
3772
3772
  if (t + 3 > e.length) return null;
3773
3773
  n = e.readUInt16LE(t + 1), i = 3;
3774
3774
  } else {
3775
3775
  if (t + 5 > e.length) return null;
3776
- if (r !== Nt.OPS.OP_PUSHDATA4) throw new Error("Unexpected opcode");
3776
+ if (r !== Ft.OPS.OP_PUSHDATA4) throw new Error("Unexpected opcode");
3777
3777
  n = e.readUInt32LE(t + 1), i = 5;
3778
3778
  }
3779
3779
  return {
@@ -3782,7 +3782,7 @@ function Uc(e, t) {
3782
3782
  size: i
3783
3783
  };
3784
3784
  }
3785
- Ht.decode = Uc;
3785
+ $t.decode = Uc;
3786
3786
  var Or = {};
3787
3787
  Object.defineProperty(Or, "__esModule", { value: !0 });
3788
3788
  Or.encode = Or.decode = void 0;
@@ -3814,10 +3814,10 @@ function Nc(e) {
3814
3814
  return n[r - 1] & 128 ? n.writeUInt8(i ? 128 : 0, r - 1) : i && (n[r - 1] |= 128), n;
3815
3815
  }
3816
3816
  Or.encode = Nc;
3817
- var Kt = {}, wo;
3817
+ var Yt = {}, wo;
3818
3818
  function Fc() {
3819
- if (wo) return Kt;
3820
- wo = 1, Object.defineProperty(Kt, "__esModule", { value: !0 }), Kt.encode = Kt.decode = void 0;
3819
+ if (wo) return Yt;
3820
+ wo = 1, Object.defineProperty(Yt, "__esModule", { value: !0 }), Yt.encode = Yt.decode = void 0;
3821
3821
  const e = vt, t = qe(), r = Le, { typeforce: n } = r, i = Buffer.alloc(1, 0);
3822
3822
  function s(l) {
3823
3823
  let d = 0;
@@ -3836,7 +3836,7 @@ function Fc() {
3836
3836
  const g = e.decode(l.slice(0, -1)), x = o(g.r), y = o(g.s);
3837
3837
  return { signature: Buffer.concat([x, y], 64), hashType: d };
3838
3838
  }
3839
- Kt.decode = a;
3839
+ Yt.decode = a;
3840
3840
  function c(l, d) {
3841
3841
  if (n(
3842
3842
  {
@@ -3851,7 +3851,7 @@ function Fc() {
3851
3851
  const x = s(l.slice(0, 32)), y = s(l.slice(32, 64));
3852
3852
  return Buffer.concat([e.encode(x, y), g]);
3853
3853
  }
3854
- return Kt.encode = c, Kt;
3854
+ return Yt.encode = c, Yt;
3855
3855
  }
3856
3856
  var go;
3857
3857
  function qe() {
@@ -3864,7 +3864,7 @@ function qe() {
3864
3864
  return r.OPS;
3865
3865
  }
3866
3866
  });
3867
- const n = Ht, i = Or, s = Fc(), o = Le, { typeforce: a } = o, c = r.OPS.OP_RESERVED;
3867
+ const n = $t, i = Or, s = Fc(), o = Le, { typeforce: a } = o, c = r.OPS.OP_RESERVED;
3868
3868
  function l(R) {
3869
3869
  return o.Number(R) && (R === r.OPS.OP_0 || R >= r.OPS.OP_1 && R <= r.OPS.OP_16 || R === r.OPS.OP_1NEGATE);
3870
3870
  }
@@ -3974,7 +3974,7 @@ function qe() {
3974
3974
  }
3975
3975
  Object.defineProperty(pn, "__esModule", { value: !0 });
3976
3976
  pn.Transaction = void 0;
3977
- const xe = Ae, Ne = jt, mo = qe(), Mc = qe(), ee = Le, { typeforce: it } = ee;
3977
+ const xe = Ae, Ne = Gt, mo = qe(), Mc = qe(), ee = Le, { typeforce: it } = ee;
3978
3978
  function at(e) {
3979
3979
  const t = e.length;
3980
3980
  return xe.varuint.encodingLength(t) + t;
@@ -4681,7 +4681,7 @@ function sh(e) {
4681
4681
  var Fs = ih(sh);
4682
4682
  Object.defineProperty(pi, "__esModule", { value: !0 });
4683
4683
  pi.p2pkh = void 0;
4684
- const Vi = jt, oh = Ce, _r = qe(), Fe = Le, pt = ze, Po = Fs, Ut = _r.OPS;
4684
+ const Vi = Gt, oh = Ce, _r = qe(), Fe = Le, pt = ze, Po = Fs, Ut = _r.OPS;
4685
4685
  function ah(e, t) {
4686
4686
  if (!e.address && !e.hash && !e.output && !e.pubkey && !e.input)
4687
4687
  throw new TypeError("Not enough data");
@@ -4779,7 +4779,7 @@ pi.p2pkh = ah;
4779
4779
  var yi = {};
4780
4780
  Object.defineProperty(yi, "__esModule", { value: !0 });
4781
4781
  yi.p2sh = void 0;
4782
- const To = jt, fh = Ce, ft = qe(), ue = Le, ot = ze, Ao = Fs, Wr = ft.OPS;
4782
+ const To = Gt, fh = Ce, ft = qe(), ue = Le, ot = ze, Ao = Fs, Wr = ft.OPS;
4783
4783
  function uh(e, t) {
4784
4784
  if (!e.address && !e.hash && !e.output && !e.redeem && !e.input)
4785
4785
  throw new TypeError("Not enough data");
@@ -5055,7 +5055,7 @@ xt.bech32 = Qa("bech32");
5055
5055
  xt.bech32m = Qa("bech32m");
5056
5056
  Object.defineProperty(bi, "__esModule", { value: !0 });
5057
5057
  bi.p2wpkh = void 0;
5058
- const zi = jt, dh = Ce, Gn = qe(), Se = Le, Ct = ze, On = xt, Oo = Gn.OPS, ph = Buffer.alloc(0);
5058
+ const zi = Gt, dh = Ce, Gn = qe(), Se = Le, Ct = ze, On = xt, Oo = Gn.OPS, ph = Buffer.alloc(0);
5059
5059
  function yh(e, t) {
5060
5060
  if (!e.address && !e.hash && !e.output && !e.pubkey && !e.witness)
5061
5061
  throw new TypeError("Not enough data");
@@ -5157,7 +5157,7 @@ bi.p2wpkh = yh;
5157
5157
  var wi = {};
5158
5158
  Object.defineProperty(wi, "__esModule", { value: !0 });
5159
5159
  wi.p2wsh = void 0;
5160
- const ko = jt, bh = Ce, gt = qe(), oe = Le, yt = ze, kn = xt, Ro = gt.OPS, qi = Buffer.alloc(0);
5160
+ const ko = Gt, bh = Ce, gt = qe(), oe = Le, yt = ze, kn = xt, Ro = gt.OPS, qi = Buffer.alloc(0);
5161
5161
  function Rn(e) {
5162
5162
  return !!(Buffer.isBuffer(e) && e.length === 65 && e[0] === 4 && (0, oe.isPoint)(e));
5163
5163
  }
@@ -5368,7 +5368,7 @@ const vh = [
5368
5368
  var Hs = {};
5369
5369
  (function(e) {
5370
5370
  Object.defineProperty(e, "__esModule", { value: !0 }), e.tweakKey = e.tapTweakHash = e.tapleafHash = e.findScriptPath = e.toHashTree = e.rootHashFromPath = e.MAX_TAPTREE_DEPTH = e.LEAF_VERSION_TAPSCRIPT = void 0;
5371
- const t = Bt, r = er, n = jt, i = Ae, s = Le;
5371
+ const t = Bt, r = er, n = Gt, i = Ae, s = Le;
5372
5372
  e.LEAF_VERSION_TAPSCRIPT = 192, e.MAX_TAPTREE_DEPTH = 128;
5373
5373
  const o = (P) => "left" in P && "right" in P;
5374
5374
  function a(P, A) {
@@ -5835,7 +5835,7 @@ function $s() {
5835
5835
  }
5836
5836
  Object.defineProperty(se, "__esModule", { value: !0 });
5837
5837
  se.signatureBlocksAction = se.checkInputForSig = se.pubkeyInScript = se.pubkeyPositionInScript = se.witnessStackToScriptWitness = se.isP2TR = se.isP2SHScript = se.isP2WSHScript = se.isP2WPKH = se.isP2PKH = se.isP2PK = se.isP2MS = void 0;
5838
- const No = yn, fn = qe(), Un = pn, Sh = jt, or = $s();
5838
+ const No = yn, fn = qe(), Un = pn, Sh = Gt, or = $s();
5839
5839
  function ar(e) {
5840
5840
  return (t) => {
5841
5841
  try {
@@ -5914,7 +5914,7 @@ function Ih(e) {
5914
5914
  }
5915
5915
  Object.defineProperty(ge, "__esModule", { value: !0 });
5916
5916
  ge.checkTaprootInputForSigs = ge.tapTreeFromList = ge.tapTreeToList = ge.tweakInternalPubKey = ge.checkTaprootOutputFields = ge.checkTaprootInputFields = ge.isTaprootOutput = ge.isTaprootInput = Wn = ge.serializeTaprootSignature = ge.tapScriptFinalizer = ge.toXOnly = void 0;
5917
- const Ds = Le, Oh = pn, gi = se, Dt = Hs, kh = $s(), Rh = se, Uh = (e) => e.length === 32 ? e : e.slice(1, 33);
5917
+ const Ds = Le, Oh = pn, gi = se, jt = Hs, kh = $s(), Rh = se, Uh = (e) => e.length === 32 ? e : e.slice(1, 33);
5918
5918
  ge.toXOnly = Uh;
5919
5919
  function Ch(e, t, r) {
5920
5920
  const n = Qh(
@@ -5970,7 +5970,7 @@ function Hh(e, t) {
5970
5970
  return n;
5971
5971
  }
5972
5972
  function $h(e, t) {
5973
- const r = t.tapInternalKey, n = r && (0, Dt.tweakKey)(r, t.tapMerkleRoot);
5973
+ const r = t.tapInternalKey, n = r && (0, jt.tweakKey)(r, t.tapMerkleRoot);
5974
5974
  if (!n)
5975
5975
  throw new Error(
5976
5976
  `Cannot tweak tap internal key for input #${e}. Public key: ${r && r.toString("hex")}`
@@ -6019,11 +6019,11 @@ function Vh(e) {
6019
6019
  if (t.length === 64 || t.length === 65) return t;
6020
6020
  }
6021
6021
  function ds(e, t = [], r = 0) {
6022
- if (r > Dt.MAX_TAPTREE_DEPTH)
6022
+ if (r > jt.MAX_TAPTREE_DEPTH)
6023
6023
  throw new Error("Max taptree depth exceeded.");
6024
6024
  return e ? (0, Ds.isTapleaf)(e) ? (t.push({
6025
6025
  depth: r,
6026
- leafVersion: e.version || Dt.LEAF_VERSION_TAPSCRIPT,
6026
+ leafVersion: e.version || jt.LEAF_VERSION_TAPSCRIPT,
6027
6027
  script: e.output
6028
6028
  }), t) : (e[0] && ds(e[0], t, r + 1), e[1] && ds(e[1], t, r + 1), t) : [];
6029
6029
  }
@@ -6034,7 +6034,7 @@ function zh(e) {
6034
6034
  return t;
6035
6035
  }
6036
6036
  function ps(e, t, r = 0) {
6037
- if (r > Dt.MAX_TAPTREE_DEPTH)
6037
+ if (r > jt.MAX_TAPTREE_DEPTH)
6038
6038
  throw new Error("Max taptree depth exceeded.");
6039
6039
  if (e.depth === r)
6040
6040
  return t ? void 0 : {
@@ -6081,17 +6081,17 @@ function Yh(e, t, r) {
6081
6081
  }
6082
6082
  function Ki(e, t) {
6083
6083
  if (!t) return !0;
6084
- const r = (0, Dt.tapleafHash)({
6084
+ const r = (0, jt.tapleafHash)({
6085
6085
  output: e.script,
6086
6086
  version: e.leafVersion
6087
6087
  });
6088
- return (0, Dt.rootHashFromPath)(
6088
+ return (0, jt.rootHashFromPath)(
6089
6089
  e.controlBlock,
6090
6090
  r
6091
6091
  ).equals(t);
6092
6092
  }
6093
6093
  function Xh(e, t) {
6094
- const r = (0, Dt.tapleafHash)({
6094
+ const r = (0, jt.tapleafHash)({
6095
6095
  output: t.script,
6096
6096
  version: t.leafVersion
6097
6097
  });
@@ -6123,7 +6123,7 @@ function Qh(e, t, r) {
6123
6123
  return n;
6124
6124
  }
6125
6125
  function Zh(e, t, r) {
6126
- const n = (0, Dt.tapleafHash)({
6126
+ const n = (0, jt.tapleafHash)({
6127
6127
  output: e.script,
6128
6128
  version: e.leafVersion
6129
6129
  });
@@ -6594,7 +6594,7 @@ class tl {
6594
6594
  }
6595
6595
  async fetchBlockNumbers() {
6596
6596
  try {
6597
- const t = await Ft.get(this.url);
6597
+ const t = await Mt.get(this.url);
6598
6598
  return re(t);
6599
6599
  } catch (t) {
6600
6600
  return j("Failed to fetch block numbers", t);
@@ -6628,7 +6628,7 @@ class rl {
6628
6628
  order_pair: t,
6629
6629
  amount: r.toString(),
6630
6630
  exact_out: n.toString()
6631
- }), o = await Ft.get(s, {
6631
+ }), o = await Mt.get(s, {
6632
6632
  retryCount: 0,
6633
6633
  ...i
6634
6634
  });
@@ -6639,7 +6639,7 @@ class rl {
6639
6639
  }
6640
6640
  async getAttestedQuote(t) {
6641
6641
  try {
6642
- const r = await Ft.post(this.quoteUrl.endpoint("/attested").toString(), {
6642
+ const r = await Mt.post(this.quoteUrl.endpoint("/attested").toString(), {
6643
6643
  body: JSON.stringify(t),
6644
6644
  headers: {
6645
6645
  "Content-Type": "application/json"
@@ -6652,7 +6652,7 @@ class rl {
6652
6652
  }
6653
6653
  async getStrategies() {
6654
6654
  try {
6655
- const t = await Ft.get(
6655
+ const t = await Mt.get(
6656
6656
  this.quoteUrl.endpoint("/strategies")
6657
6657
  );
6658
6658
  if (t.error) return j(t.error);
@@ -6758,7 +6758,7 @@ function il() {
6758
6758
  throw new Error(`Secure random number generation is not supported by this browser.
6759
6759
  Use Chrome, Firefox or Internet Explorer 11`);
6760
6760
  }
6761
- var sl = je.Buffer, ei = $t.crypto || $t.msCrypto;
6761
+ var sl = je.Buffer, ei = Dt.crypto || Dt.msCrypto;
6762
6762
  ei && ei.getRandomValues ? ys.exports = ol : ys.exports = il;
6763
6763
  function ol(e, t) {
6764
6764
  if (e > nl) throw new RangeError("requested too many random bytes");
@@ -7313,11 +7313,11 @@ function Al(e, t) {
7313
7313
  }
7314
7314
  function Ji(e) {
7315
7315
  try {
7316
- if (!$t.localStorage) return !1;
7316
+ if (!Dt.localStorage) return !1;
7317
7317
  } catch {
7318
7318
  return !1;
7319
7319
  }
7320
- var t = $t.localStorage[e];
7320
+ var t = Dt.localStorage[e];
7321
7321
  return t == null ? !1 : String(t).toLowerCase() === "true";
7322
7322
  }
7323
7323
  var Qi, Go;
@@ -7334,7 +7334,7 @@ function gf() {
7334
7334
  D.WritableState = E;
7335
7335
  var r = {
7336
7336
  deprecate: Tl
7337
- }, n = pf, i = Bt.Buffer, s = (typeof $t < "u" ? $t : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
7337
+ }, n = pf, i = Bt.Buffer, s = (typeof Dt < "u" ? Dt : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
7338
7338
  };
7339
7339
  function o(T) {
7340
7340
  return i.from(T);
@@ -7947,7 +7947,7 @@ function _f() {
7947
7947
  R.ReadableState = D, df.EventEmitter;
7948
7948
  var t = function(w, N) {
7949
7949
  return w.listeners(N).length;
7950
- }, r = pf, n = Bt.Buffer, i = (typeof $t < "u" ? $t : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
7950
+ }, r = pf, n = Bt.Buffer, i = (typeof Dt < "u" ? Dt : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
7951
7951
  };
7952
7952
  function s(b) {
7953
7953
  return n.from(b);
@@ -8095,7 +8095,7 @@ function _f() {
8095
8095
  break;
8096
8096
  }
8097
8097
  $.pipesCount += 1, c("pipe count=%d opts=%j", $.pipesCount, w);
8098
- var pe = (!w || w.end !== !1) && b !== process.stdout && b !== process.stderr, Y = pe ? Tt : qt;
8098
+ var pe = (!w || w.end !== !1) && b !== process.stdout && b !== process.stderr, Y = pe ? Tt : Kt;
8099
8099
  $.endEmitted ? process.nextTick(Y) : N.once("end", Y), b.on("unpipe", te);
8100
8100
  function te(h, f) {
8101
8101
  c("onunpipe"), h === N && f && f.hasUnpiped === !1 && (f.hasUnpiped = !0, lr());
@@ -8107,7 +8107,7 @@ function _f() {
8107
8107
  b.on("drain", hr);
8108
8108
  var Mr = !1;
8109
8109
  function lr() {
8110
- c("cleanup"), b.removeListener("close", Hr), b.removeListener("finish", Ke), b.removeListener("drain", hr), b.removeListener("error", zt), b.removeListener("unpipe", te), N.removeListener("end", Tt), N.removeListener("end", qt), N.removeListener("data", Ve), Mr = !0, $.awaitDrain && (!b._writableState || b._writableState.needDrain) && hr();
8110
+ c("cleanup"), b.removeListener("close", Hr), b.removeListener("finish", Ke), b.removeListener("drain", hr), b.removeListener("error", qt), b.removeListener("unpipe", te), N.removeListener("end", Tt), N.removeListener("end", Kt), N.removeListener("data", Ve), Mr = !0, $.awaitDrain && (!b._writableState || b._writableState.needDrain) && hr();
8111
8111
  }
8112
8112
  N.on("data", Ve);
8113
8113
  function Ve(h) {
@@ -8115,19 +8115,19 @@ function _f() {
8115
8115
  var f = b.write(h);
8116
8116
  c("dest.write", f), f === !1 && (($.pipesCount === 1 && $.pipes === b || $.pipesCount > 1 && K($.pipes, b) !== -1) && !Mr && (c("false write response, pause", $.awaitDrain), $.awaitDrain++), N.pause());
8117
8117
  }
8118
- function zt(h) {
8119
- c("onerror", h), qt(), b.removeListener("error", zt), t(b, "error") === 0 && S(b, h);
8118
+ function qt(h) {
8119
+ c("onerror", h), Kt(), b.removeListener("error", qt), t(b, "error") === 0 && S(b, h);
8120
8120
  }
8121
- H(b, "error", zt);
8121
+ H(b, "error", qt);
8122
8122
  function Hr() {
8123
- b.removeListener("finish", Ke), qt();
8123
+ b.removeListener("finish", Ke), Kt();
8124
8124
  }
8125
8125
  b.once("close", Hr);
8126
8126
  function Ke() {
8127
- c("onfinish"), b.removeListener("close", Hr), qt();
8127
+ c("onfinish"), b.removeListener("close", Hr), Kt();
8128
8128
  }
8129
8129
  b.once("finish", Ke);
8130
- function qt() {
8130
+ function Kt() {
8131
8131
  c("unpipe"), N.unpipe(b);
8132
8132
  }
8133
8133
  return b.emit("pipe", N), $.flowing || (c("pipe resume"), N.resume()), b;
@@ -8410,11 +8410,11 @@ function c0(e, t) {
8410
8410
  if (!ri.isBuffer(e) && typeof e != "string")
8411
8411
  throw new TypeError(t + " must be a string or a buffer");
8412
8412
  }
8413
- function Gt(e) {
8413
+ function Wt(e) {
8414
8414
  Bf.call(this), this._block = ri.allocUnsafe(e), this._blockSize = e, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1;
8415
8415
  }
8416
- u0(Gt, Bf);
8417
- Gt.prototype._transform = function(e, t, r) {
8416
+ u0(Wt, Bf);
8417
+ Wt.prototype._transform = function(e, t, r) {
8418
8418
  var n = null;
8419
8419
  try {
8420
8420
  this.update(e, t);
@@ -8423,7 +8423,7 @@ Gt.prototype._transform = function(e, t, r) {
8423
8423
  }
8424
8424
  r(n);
8425
8425
  };
8426
- Gt.prototype._flush = function(e) {
8426
+ Wt.prototype._flush = function(e) {
8427
8427
  var t = null;
8428
8428
  try {
8429
8429
  this.push(this.digest());
@@ -8432,7 +8432,7 @@ Gt.prototype._flush = function(e) {
8432
8432
  }
8433
8433
  e(t);
8434
8434
  };
8435
- Gt.prototype.update = function(e, t) {
8435
+ Wt.prototype.update = function(e, t) {
8436
8436
  if (c0(e, "Data"), this._finalized) throw new Error("Digest already called");
8437
8437
  ri.isBuffer(e) || (e = ri.from(e, t));
8438
8438
  for (var r = this._block, n = 0; this._blockOffset + e.length - n >= this._blockSize; ) {
@@ -8444,10 +8444,10 @@ Gt.prototype.update = function(e, t) {
8444
8444
  this._length[s] += o, o = this._length[s] / 4294967296 | 0, o > 0 && (this._length[s] -= 4294967296 * o);
8445
8445
  return this;
8446
8446
  };
8447
- Gt.prototype._update = function() {
8447
+ Wt.prototype._update = function() {
8448
8448
  throw new Error("_update is not implemented");
8449
8449
  };
8450
- Gt.prototype.digest = function(e) {
8450
+ Wt.prototype.digest = function(e) {
8451
8451
  if (this._finalized) throw new Error("Digest already called");
8452
8452
  this._finalized = !0;
8453
8453
  var t = this._digest();
@@ -8455,10 +8455,10 @@ Gt.prototype.digest = function(e) {
8455
8455
  for (var r = 0; r < 4; ++r) this._length[r] = 0;
8456
8456
  return t;
8457
8457
  };
8458
- Gt.prototype._digest = function() {
8458
+ Wt.prototype._digest = function() {
8459
8459
  throw new Error("_digest is not implemented");
8460
8460
  };
8461
- var h0 = Gt, l0 = Ie, Pf = h0, d0 = je.Buffer, p0 = new Array(16);
8461
+ var h0 = Wt, l0 = Ie, Pf = h0, d0 = je.Buffer, p0 = new Array(16);
8462
8462
  function Ei() {
8463
8463
  Pf.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878;
8464
8464
  }
@@ -8493,11 +8493,11 @@ function w0(e, t) {
8493
8493
  if (!ni.isBuffer(e) && typeof e != "string")
8494
8494
  throw new TypeError(t + " must be a string or a buffer");
8495
8495
  }
8496
- function Wt(e) {
8496
+ function Vt(e) {
8497
8497
  Tf.call(this), this._block = ni.allocUnsafe(e), this._blockSize = e, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1;
8498
8498
  }
8499
- b0(Wt, Tf);
8500
- Wt.prototype._transform = function(e, t, r) {
8499
+ b0(Vt, Tf);
8500
+ Vt.prototype._transform = function(e, t, r) {
8501
8501
  var n = null;
8502
8502
  try {
8503
8503
  this.update(e, t);
@@ -8506,7 +8506,7 @@ Wt.prototype._transform = function(e, t, r) {
8506
8506
  }
8507
8507
  r(n);
8508
8508
  };
8509
- Wt.prototype._flush = function(e) {
8509
+ Vt.prototype._flush = function(e) {
8510
8510
  var t = null;
8511
8511
  try {
8512
8512
  this.push(this.digest());
@@ -8515,7 +8515,7 @@ Wt.prototype._flush = function(e) {
8515
8515
  }
8516
8516
  e(t);
8517
8517
  };
8518
- Wt.prototype.update = function(e, t) {
8518
+ Vt.prototype.update = function(e, t) {
8519
8519
  if (w0(e, "Data"), this._finalized) throw new Error("Digest already called");
8520
8520
  ni.isBuffer(e) || (e = ni.from(e, t));
8521
8521
  for (var r = this._block, n = 0; this._blockOffset + e.length - n >= this._blockSize; ) {
@@ -8527,10 +8527,10 @@ Wt.prototype.update = function(e, t) {
8527
8527
  this._length[s] += o, o = this._length[s] / 4294967296 | 0, o > 0 && (this._length[s] -= 4294967296 * o);
8528
8528
  return this;
8529
8529
  };
8530
- Wt.prototype._update = function() {
8530
+ Vt.prototype._update = function() {
8531
8531
  throw new Error("_update is not implemented");
8532
8532
  };
8533
- Wt.prototype.digest = function(e) {
8533
+ Vt.prototype.digest = function(e) {
8534
8534
  if (this._finalized) throw new Error("Digest already called");
8535
8535
  this._finalized = !0;
8536
8536
  var t = this._digest();
@@ -8538,10 +8538,10 @@ Wt.prototype.digest = function(e) {
8538
8538
  for (var r = 0; r < 4; ++r) this._length[r] = 0;
8539
8539
  return t;
8540
8540
  };
8541
- Wt.prototype._digest = function() {
8541
+ Vt.prototype._digest = function() {
8542
8542
  throw new Error("_digest is not implemented");
8543
8543
  };
8544
- var g0 = Wt, ss = Bt.Buffer, m0 = Ie, Af = g0, _0 = new Array(16), qr = [
8544
+ var g0 = Vt, ss = Bt.Buffer, m0 = Ie, Af = g0, _0 = new Array(16), qr = [
8545
8545
  0,
8546
8546
  1,
8547
8547
  2,
@@ -9924,7 +9924,7 @@ class ii extends ga {
9924
9924
  super(), this.privKey = t, this.walletClient = r;
9925
9925
  }
9926
9926
  static fromPrivKey(t) {
9927
- return new ii(Yt(t));
9927
+ return new ii(Nt(t));
9928
9928
  }
9929
9929
  static fromWalletClient(t) {
9930
9930
  return new ii(void 0, t);
@@ -9962,7 +9962,7 @@ class ii extends ga {
9962
9962
  Nonce: 1n
9963
9963
  }
9964
9964
  });
9965
- return this.privKey = Yt(Pn(t)), this.emit("initialized", !0), re(this.privKey);
9965
+ return this.privKey = Nt(Pn(t)), this.emit("initialized", !0), re(this.privKey);
9966
9966
  } catch (t) {
9967
9967
  return j("Failed to initialize: " + t);
9968
9968
  }
@@ -9989,10 +9989,10 @@ class ii extends ga {
9989
9989
  if (l.error) return j(l.error);
9990
9990
  this.privKey = l.val;
9991
9991
  }
9992
- const r = Dd(Qt), n = "Garden.fi" + t.toString(), i = Buffer.from(n, "utf8"), s = Pn(i), o = Buffer.from(Yt(this.privKey), "hex");
9992
+ const r = Dd(Qt), n = "Garden.fi" + t.toString(), i = Buffer.from(n, "utf8"), s = Pn(i), o = Buffer.from(Nt(this.privKey), "hex");
9993
9993
  if (o.length !== 32)
9994
9994
  return j("Invalid private key length. Expected 32 bytes.");
9995
- const c = r.fromPrivateKey(o).sign(Buffer.from(Yt(s), "hex"));
9995
+ const c = r.fromPrivateKey(o).sign(Buffer.from(Nt(s), "hex"));
9996
9996
  return re(c.toString("hex"));
9997
9997
  }
9998
9998
  }
@@ -10067,7 +10067,7 @@ class Dy extends ga {
10067
10067
  fee: "1",
10068
10068
  nonce: o,
10069
10069
  timelock: s,
10070
- secret_hash: Yt(a.val.secretHash),
10070
+ secret_hash: Nt(a.val.secretHash),
10071
10071
  min_destination_confirmations: t.minDestinationConfirmations ?? 0,
10072
10072
  additional_data: d
10073
10073
  }, x = await this._quote.getAttestedQuote(g);
@@ -10326,7 +10326,7 @@ class Dy extends ga {
10326
10326
  r.destination_swap.timelock,
10327
10327
  o ? [s] : []
10328
10328
  )).redeem(
10329
- Yt(n),
10329
+ Nt(n),
10330
10330
  (c = r.create_order.additional_data) == null ? void 0 : c.bitcoin_optional_recipient
10331
10331
  );
10332
10332
  o ? this.emit(
@@ -10385,7 +10385,7 @@ class Dy extends ga {
10385
10385
  const o = await i.generateInstantRefundSACP(
10386
10386
  s
10387
10387
  ), a = this._orderbookUrl.endpoint("orders/add-instant-refund-sacp");
10388
- (await Ft.post(a, {
10388
+ (await Mt.post(a, {
10389
10389
  headers: {
10390
10390
  "Content-Type": "application/json"
10391
10391
  },
@@ -10403,7 +10403,7 @@ class Dy extends ga {
10403
10403
  }
10404
10404
  async postRedeemSACP(t, r, n) {
10405
10405
  if (this.redeemSacpCache.get(r.create_order.create_id)) return;
10406
- console.log("posting redeem sacp", r.create_order.create_id);
10406
+ console.log("secret :", t), console.log("posting redeem sacp", r.create_order.create_id);
10407
10407
  const s = await Er.from(
10408
10408
  n,
10409
10409
  Number(r.destination_swap.amount),
@@ -10415,9 +10415,11 @@ class Dy extends ga {
10415
10415
  if (o)
10416
10416
  try {
10417
10417
  const a = await s.generateRedeemSACP(
10418
- t,
10418
+ Nt(t),
10419
10419
  o
10420
- ), c = this._orderbookUrl.endpoint("orders/add-redeem-sacp"), l = await Ft.post(c, {
10420
+ ), c = this._orderbookUrl.endpoint("orders/add-redeem-sacp");
10421
+ console.log("sacp :", a);
10422
+ const l = await Mt.post(c, {
10421
10423
  headers: {
10422
10424
  "Content-Type": "application/json"
10423
10425
  },
@@ -10611,13 +10613,13 @@ function zd(e, { dir: t, size: r = 32 } = {}) {
10611
10613
  }
10612
10614
  const qd = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
10613
10615
  function J(e, t = {}) {
10614
- return typeof e == "number" || typeof e == "bigint" ? Wf(e, t) : typeof e == "string" ? Xd(e, t) : typeof e == "boolean" ? Kd(e, t) : Vt(e, t);
10616
+ return typeof e == "number" || typeof e == "bigint" ? Wf(e, t) : typeof e == "string" ? Xd(e, t) : typeof e == "boolean" ? Kd(e, t) : zt(e, t);
10615
10617
  }
10616
10618
  function Kd(e, t = {}) {
10617
10619
  const r = `0x${Number(e)}`;
10618
10620
  return typeof t.size == "number" ? (Fr(r, { size: t.size }), Nr(r, { size: t.size })) : r;
10619
10621
  }
10620
- function Vt(e, t = {}) {
10622
+ function zt(e, t = {}) {
10621
10623
  let r = "";
10622
10624
  for (let i = 0; i < e.length; i++)
10623
10625
  r += qd[e[i]];
@@ -10645,7 +10647,7 @@ function Wf(e, t = {}) {
10645
10647
  const Yd = /* @__PURE__ */ new TextEncoder();
10646
10648
  function Xd(e, t = {}) {
10647
10649
  const r = Yd.encode(e);
10648
- return Vt(r, t);
10650
+ return zt(r, t);
10649
10651
  }
10650
10652
  const Jd = /* @__PURE__ */ new TextEncoder();
10651
10653
  function Vf(e, t = {}) {
@@ -10980,7 +10982,7 @@ function Kf(e, { recursiveReadLimit: t = 8192 } = {}) {
10980
10982
  }
10981
10983
  function nr(e, t = "hex") {
10982
10984
  const r = Yf(e), n = Kf(new Uint8Array(r.length));
10983
- return r.encode(n), t === "hex" ? Vt(n.bytes) : n.bytes;
10985
+ return r.encode(n), t === "hex" ? zt(n.bytes) : n.bytes;
10984
10986
  }
10985
10987
  function Yf(e) {
10986
10988
  return Array.isArray(e) ? hp(e.map((t) => Yf(t))) : lp(e);
@@ -11075,7 +11077,7 @@ function Jf(e) {
11075
11077
  const { kzg: t } = e, r = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), n = typeof e.blobs[0] == "string" ? e.blobs.map((s) => rr(s)) : e.blobs, i = [];
11076
11078
  for (const s of n)
11077
11079
  i.push(Uint8Array.from(t.blobToKzgCommitment(s)));
11078
- return r === "bytes" ? i : i.map((s) => Vt(s));
11080
+ return r === "bytes" ? i : i.map((s) => zt(s));
11079
11081
  }
11080
11082
  function Qf(e) {
11081
11083
  const { kzg: t } = e, r = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), n = typeof e.blobs[0] == "string" ? e.blobs.map((o) => rr(o)) : e.blobs, i = typeof e.commitments[0] == "string" ? e.commitments.map((o) => rr(o)) : e.commitments, s = [];
@@ -11083,14 +11085,14 @@ function Qf(e) {
11083
11085
  const a = n[o], c = i[o];
11084
11086
  s.push(Uint8Array.from(t.computeBlobKzgProof(a, c)));
11085
11087
  }
11086
- return r === "bytes" ? s : s.map((o) => Vt(o));
11088
+ return r === "bytes" ? s : s.map((o) => zt(o));
11087
11089
  }
11088
11090
  function mp(e, t) {
11089
11091
  return za(vn(e, { strict: !1 }) ? Vf(e) : e);
11090
11092
  }
11091
11093
  function _p(e) {
11092
11094
  const { commitment: t, version: r = 1 } = e, n = e.to ?? (typeof t == "string" ? "hex" : "bytes"), i = mp(t);
11093
- return i.set([r], 0), n === "bytes" ? i : Vt(i);
11095
+ return i.set([r], 0), n === "bytes" ? i : zt(i);
11094
11096
  }
11095
11097
  function vp(e) {
11096
11098
  const { commitments: t, version: r } = e, n = e.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), i = [];
@@ -11161,7 +11163,7 @@ function Bp(e) {
11161
11163
  }
11162
11164
  i.push(a);
11163
11165
  }
11164
- return t === "bytes" ? i.map((a) => a.bytes) : i.map((a) => Vt(a.bytes));
11166
+ return t === "bytes" ? i.map((a) => a.bytes) : i.map((a) => zt(a.bytes));
11165
11167
  }
11166
11168
  function Pp(e) {
11167
11169
  const { data: t, kzg: r, to: n } = e, i = e.blobs ?? Bp({ data: t, to: n }), s = e.commitments ?? Jf({ blobs: i, kzg: r, to: n }), o = e.proofs ?? Qf({ blobs: i, commitments: s, kzg: r, to: n }), a = [];
@@ -11532,7 +11534,7 @@ function ny(e, t) {
11532
11534
  Jp(e);
11533
11535
  let x = e.blobVersionedHashes, y = e.sidecars;
11534
11536
  if (e.blobs && (typeof x > "u" || typeof y > "u")) {
11535
- const _ = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((E) => Vt(E)), m = e.kzg, S = Jf({
11537
+ const _ = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((E) => zt(E)), m = e.kzg, S = Jf({
11536
11538
  blobs: _,
11537
11539
  kzg: m
11538
11540
  });