@gardenfi/core 0.2.0-beta.16 → 0.2.0-beta.18

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
@@ -2,10 +2,9 @@ var _i = Object.defineProperty;
2
2
  var gi = (e, t, r) => t in e ? _i(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var nt = (e, t, r) => gi(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { Ok as se, Err as H, Fetcher as Ht, trim0x as ze } from "@catalogfi/utils";
5
- import { EthereumLocalnet as wi, ArbitrumLocalnet as mi, Orderbook as vi, isMainnet as kt, isBitcoin as Lt, getBlockchainType as Ot, BlockchainType as We } from "@gardenfi/orderbook";
6
- import { Asset as af, MatchedOrder as of, isBitcoin as sf } from "@gardenfi/orderbook";
5
+ import { EthereumLocalnet as wi, ArbitrumLocalnet as mi, Orderbook as vi, isMainnet as Lt, isBitcoin as Ot, getBlockchainType as Ft, BlockchainType as We } from "@gardenfi/orderbook";
7
6
  import { Url as An, fetchEVMBlockNumber as xr, with0x as Dt, checkAllowanceAndApprove as xi, Authorization as Wr, MemoryStorage as Ei, sleep as Bi, fetchBitcoinBlockNumber as qr } from "@gardenfi/utils";
8
- import { createWalletClient as Kr, http as Gr, getContract as Ri, sha256 as Ft } from "viem";
7
+ import { createWalletClient as Kr, http as Gr, getContract as Ri, sha256 as Mt } from "viem";
9
8
  import * as Vr from "varuint-bitcoin";
10
9
  import * as ft from "tiny-secp256k1";
11
10
  import { Urgency as Jr } from "@catalogfi/wallets";
@@ -150,7 +149,7 @@ function Oi(e, t) {
150
149
  }
151
150
  return [e, t];
152
151
  }
153
- const Mt = (e) => e.length === 64 ? e : e.slice(2), Fi = (e) => {
152
+ const yt = (e) => e.length === 64 ? e : e.slice(2), Fi = (e) => {
154
153
  if (!e) return !1;
155
154
  try {
156
155
  const t = Buffer.from(e, "hex");
@@ -1205,11 +1204,11 @@ class Zs {
1205
1204
  async validateAndFillParams(t) {
1206
1205
  if (t.fromAsset.chain === t.toAsset.chain && t.fromAsset.atomicSwapAddress === t.toAsset.atomicSwapAddress)
1207
1206
  return H("Source and destination assets cannot be the same");
1208
- if (kt(t.fromAsset.chain) && !kt(t.toAsset.chain) || !kt(t.fromAsset.chain) && kt(t.toAsset.chain))
1207
+ if (Lt(t.fromAsset.chain) && !Lt(t.toAsset.chain) || !Lt(t.fromAsset.chain) && Lt(t.toAsset.chain))
1209
1208
  return H(
1210
1209
  "Both assets should be on the same network (either mainnet or testnet)"
1211
1210
  );
1212
- if (Lt(t.fromAsset.chain) || Lt(t.toAsset.chain)) {
1211
+ if (Ot(t.fromAsset.chain) || Ot(t.toAsset.chain)) {
1213
1212
  if (!this.wallets.btcWallet)
1214
1213
  return H(
1215
1214
  "btcWallet is required for bitcoin chain. Please provide btcWallet in the constructor"
@@ -1238,12 +1237,12 @@ class Zs {
1238
1237
  }
1239
1238
  async getAddresses(t) {
1240
1239
  var a;
1241
- switch (Ot(t)) {
1240
+ switch (Ft(t)) {
1242
1241
  case We.EVM:
1243
1242
  return this.wallets.evmWallet.account ? se(this.wallets.evmWallet.account.address) : H("EVM Wallet not found");
1244
1243
  case We.Bitcoin: {
1245
1244
  const o = await ((a = this.wallets.btcWallet) == null ? void 0 : a.getPublicKey());
1246
- return !o || !Fi(o) ? H("Invalid btc public key") : se(o);
1245
+ return !o || !Fi(o) ? H("Invalid btc public key") : se(yt(o));
1247
1246
  }
1248
1247
  default:
1249
1248
  return H("Unsupported chain");
@@ -1254,7 +1253,7 @@ class Zs {
1254
1253
  return t == null || r <= 0n || t.includes(".") ? H("Invalid amount ", t) : se(r);
1255
1254
  }
1256
1255
  getTimelock(t) {
1257
- switch (Ot(t)) {
1256
+ switch (Ft(t)) {
1258
1257
  case We.EVM:
1259
1258
  return Er.evm;
1260
1259
  case We.Bitcoin:
@@ -1315,7 +1314,7 @@ class Zs {
1315
1314
  v.val.destination
1316
1315
  ), C = new Gi(c, this.store);
1317
1316
  if (C.get(A)) continue;
1318
- switch (Ot(c.destination_swap.chain)) {
1317
+ switch (Ft(c.destination_swap.chain)) {
1319
1318
  case We.EVM:
1320
1319
  switch (A) {
1321
1320
  case Re.Redeem: {
@@ -1360,8 +1359,8 @@ class Zs {
1360
1359
  m.val,
1361
1360
  Number(c.destination_swap.amount),
1362
1361
  c.create_order.secret_hash,
1363
- Mt(c.destination_swap.initiator),
1364
- Mt(c.destination_swap.redeemer),
1362
+ yt(c.destination_swap.initiator),
1363
+ yt(c.destination_swap.redeemer),
1365
1364
  c.destination_swap.timelock
1366
1365
  ), T = this.secretManager.generateSecret(
1367
1366
  Number(c.create_order.nonce)
@@ -1386,8 +1385,8 @@ class Zs {
1386
1385
  w.val,
1387
1386
  Number(c.source_swap.amount),
1388
1387
  c.create_order.secret_hash,
1389
- Mt(c.source_swap.initiator),
1390
- Mt(c.source_swap.redeemer),
1388
+ yt(c.source_swap.initiator),
1389
+ yt(c.source_swap.redeemer),
1391
1390
  c.source_swap.timelock
1392
1391
  )).refund(
1393
1392
  (o = c.create_order.additional_data) == null ? void 0 : o.bitcoin_optional_recipient
@@ -1414,7 +1413,7 @@ class Zs {
1414
1413
  );
1415
1414
  }
1416
1415
  getWallet(t) {
1417
- switch (Ot(t)) {
1416
+ switch (Ft(t)) {
1418
1417
  case We.EVM:
1419
1418
  return se(this.wallets.evmWallet);
1420
1419
  case We.Bitcoin:
@@ -1434,11 +1433,11 @@ class Zs {
1434
1433
  async fetchCurrentBlockNumbers(t, r) {
1435
1434
  if (!r || !r.source || !r.destination)
1436
1435
  return H("Provide wallets to fetch the current block number");
1437
- const a = Lt(t.source_swap.chain) ? await qr(
1436
+ const a = Ot(t.source_swap.chain) ? await qr(
1438
1437
  await r.source.getProvider()
1439
1438
  ) : await xr(r.source);
1440
1439
  if (a.error) return H(a.error);
1441
- const o = Lt(t.destination_swap.chain) ? await qr(
1440
+ const o = Ot(t.destination_swap.chain) ? await qr(
1442
1441
  await r.destination.getProvider()
1443
1442
  ) : await xr(r.destination);
1444
1443
  return o.error ? H(o.error) : se({
@@ -1494,7 +1493,7 @@ ct.testnet = {
1494
1493
  scriptHash: 196,
1495
1494
  wif: 239
1496
1495
  };
1497
- var Tn = {}, Et = {
1496
+ var Tn = {}, Bt = {
1498
1497
  Array: function(e) {
1499
1498
  return e != null && e.constructor === Array;
1500
1499
  },
@@ -1520,12 +1519,12 @@ var Tn = {}, Et = {
1520
1519
  return !0;
1521
1520
  }
1522
1521
  };
1523
- Et.Null = Et.Nil;
1524
- for (var zr in Et)
1525
- Et[zr].toJSON = (function(e) {
1522
+ Bt.Null = Bt.Nil;
1523
+ for (var zr in Bt)
1524
+ Bt[zr].toJSON = (function(e) {
1526
1525
  return e;
1527
1526
  }).bind(null, zr);
1528
- var Mr = Et, Qe = Mr;
1527
+ var Mr = Bt, Qe = Mr;
1529
1528
  function Cn(e) {
1530
1529
  return e.name || e.toString().match(/function (.*?)\s*\(/)[1];
1531
1530
  }
@@ -1668,7 +1667,7 @@ function Xi() {
1668
1667
  }).bind(null, P);
1669
1668
  return sr = O, sr;
1670
1669
  }
1671
- var Rt = Ln, fe = Mr, Fe = Rt.tfJSON, On = Rt.TfTypeError, Fn = Rt.TfPropertyTypeError, yt = Rt.tfSubError, Zi = Rt.getValueTypeName, Me = {
1670
+ var St = Ln, fe = Mr, Fe = St.tfJSON, On = St.TfTypeError, Fn = St.TfPropertyTypeError, _t = St.tfSubError, Zi = St.getValueTypeName, Me = {
1672
1671
  arrayOf: function(t, r) {
1673
1672
  t = ke(t), r = r || {};
1674
1673
  function a(o, f) {
@@ -1676,7 +1675,7 @@ var Rt = Ln, fe = Mr, Fe = Rt.tfJSON, On = Rt.TfTypeError, Fn = Rt.TfPropertyTyp
1676
1675
  try {
1677
1676
  return _e(t, c, f);
1678
1677
  } catch (p) {
1679
- throw yt(p, u);
1678
+ throw _t(p, u);
1680
1679
  }
1681
1680
  });
1682
1681
  }
@@ -1702,13 +1701,13 @@ var Rt = Ln, fe = Mr, Fe = Rt.tfJSON, On = Rt.TfTypeError, Fn = Rt.TfPropertyTyp
1702
1701
  try {
1703
1702
  r && _e(r, c, f);
1704
1703
  } catch (p) {
1705
- throw yt(p, c, "key");
1704
+ throw _t(p, c, "key");
1706
1705
  }
1707
1706
  try {
1708
1707
  var u = o[c];
1709
1708
  _e(t, u, f);
1710
1709
  } catch (p) {
1711
- throw yt(p, c);
1710
+ throw _t(p, c);
1712
1711
  }
1713
1712
  }
1714
1713
  return !0;
@@ -1732,7 +1731,7 @@ var Rt = Ln, fe = Mr, Fe = Rt.tfJSON, On = Rt.TfTypeError, Fn = Rt.TfPropertyTyp
1732
1731
  _e(p, w, c);
1733
1732
  }
1734
1733
  } catch (m) {
1735
- throw yt(m, u);
1734
+ throw _t(m, u);
1736
1735
  }
1737
1736
  if (c) {
1738
1737
  for (u in f)
@@ -1790,7 +1789,7 @@ var Rt = Ln, fe = Mr, Fe = Rt.tfJSON, On = Rt.TfTypeError, Fn = Rt.TfPropertyTyp
1790
1789
  try {
1791
1790
  return _e(f, a[c], o);
1792
1791
  } catch (u) {
1793
- throw yt(u, c);
1792
+ throw _t(u, c);
1794
1793
  }
1795
1794
  });
1796
1795
  }
@@ -3806,8 +3805,8 @@ function Pa(e) {
3806
3805
  if (typeof t != "string" && (Hr.isEncoding === sn || !sn(e))) throw new Error("Unknown encoding: " + e);
3807
3806
  return t || e;
3808
3807
  }
3809
- Kt.StringDecoder = St;
3810
- function St(e) {
3808
+ Kt.StringDecoder = At;
3809
+ function At(e) {
3811
3810
  this.encoding = Pa(e);
3812
3811
  var t;
3813
3812
  switch (this.encoding) {
@@ -3826,7 +3825,7 @@ function St(e) {
3826
3825
  }
3827
3826
  this.lastNeed = 0, this.lastTotal = 0, this.lastChar = Hr.allocUnsafe(t);
3828
3827
  }
3829
- St.prototype.write = function(e) {
3828
+ At.prototype.write = function(e) {
3830
3829
  if (e.length === 0) return "";
3831
3830
  var t, r;
3832
3831
  if (this.lastNeed) {
@@ -3836,9 +3835,9 @@ St.prototype.write = function(e) {
3836
3835
  r = 0;
3837
3836
  return r < e.length ? t ? t + this.text(e, r) : this.text(e, r) : t || "";
3838
3837
  };
3839
- St.prototype.end = Ha;
3840
- St.prototype.text = $a;
3841
- St.prototype.fillLast = function(e) {
3838
+ At.prototype.end = Ha;
3839
+ At.prototype.text = $a;
3840
+ At.prototype.fillLast = function(e) {
3842
3841
  if (this.lastNeed <= e.length)
3843
3842
  return e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal);
3844
3843
  e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, e.length), this.lastNeed -= e.length;
@@ -4482,13 +4481,13 @@ function hn(e, t, r) {
4482
4481
  if (e._transformState.transforming) throw new to();
4483
4482
  return e.push(null);
4484
4483
  }
4485
- var ao = Bt, Zn = Xn;
4486
- pe(Bt, Zn);
4487
- function Bt(e) {
4488
- if (!(this instanceof Bt)) return new Bt(e);
4484
+ var ao = Rt, Zn = Xn;
4485
+ pe(Rt, Zn);
4486
+ function Rt(e) {
4487
+ if (!(this instanceof Rt)) return new Rt(e);
4489
4488
  Zn.call(this, e);
4490
4489
  }
4491
- Bt.prototype._transform = function(e, t, r) {
4490
+ Rt.prototype._transform = function(e, t, r) {
4492
4491
  r(null, e);
4493
4492
  };
4494
4493
  var gr;
@@ -4636,7 +4635,7 @@ function le(e, t, r, a, o, f, c) {
4636
4635
  function he(e, t, r, a, o, f, c) {
4637
4636
  return Zt(e + (r ^ (t | ~a)) + o + f | 0, c) + t | 0;
4638
4637
  }
4639
- var xo = Xt, wr = ht.Buffer, Eo = pe, ii = ri, Bo = new Array(16), _t = [
4638
+ var xo = Xt, wr = ht.Buffer, Eo = pe, ii = ri, Bo = new Array(16), gt = [
4640
4639
  0,
4641
4640
  1,
4642
4641
  2,
@@ -4717,7 +4716,7 @@ var xo = Xt, wr = ht.Buffer, Eo = pe, ii = ri, Bo = new Array(16), _t = [
4717
4716
  6,
4718
4717
  15,
4719
4718
  13
4720
- ], gt = [
4719
+ ], wt = [
4721
4720
  5,
4722
4721
  14,
4723
4722
  7,
@@ -4798,7 +4797,7 @@ var xo = Xt, wr = ht.Buffer, Eo = pe, ii = ri, Bo = new Array(16), _t = [
4798
4797
  3,
4799
4798
  9,
4800
4799
  11
4801
- ], wt = [
4800
+ ], mt = [
4802
4801
  11,
4803
4802
  14,
4804
4803
  15,
@@ -4879,7 +4878,7 @@ var xo = Xt, wr = ht.Buffer, Eo = pe, ii = ri, Bo = new Array(16), _t = [
4879
4878
  8,
4880
4879
  5,
4881
4880
  6
4882
- ], mt = [
4881
+ ], vt = [
4883
4882
  8,
4884
4883
  9,
4885
4884
  9,
@@ -4960,7 +4959,7 @@ var xo = Xt, wr = ht.Buffer, Eo = pe, ii = ri, Bo = new Array(16), _t = [
4960
4959
  13,
4961
4960
  11,
4962
4961
  11
4963
- ], vt = [0, 1518500249, 1859775393, 2400959708, 2840853838], xt = [1352829926, 1548603684, 1836072691, 2053994217, 0];
4962
+ ], xt = [0, 1518500249, 1859775393, 2400959708, 2840853838], Et = [1352829926, 1548603684, 1836072691, 2053994217, 0];
4964
4963
  function er() {
4965
4964
  ii.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520;
4966
4965
  }
@@ -4969,7 +4968,7 @@ er.prototype._update = function() {
4969
4968
  for (var e = Bo, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(t * 4);
4970
4969
  for (var r = this._a | 0, a = this._b | 0, o = this._c | 0, f = this._d | 0, c = this._e | 0, u = this._a | 0, p = this._b | 0, w = this._c | 0, m = this._d | 0, v = this._e | 0, A = 0; A < 80; A += 1) {
4971
4970
  var C, R;
4972
- A < 16 ? (C = bn(r, a, o, f, c, e[_t[A]], vt[0], wt[A]), R = wn(u, p, w, m, v, e[gt[A]], xt[0], mt[A])) : A < 32 ? (C = yn(r, a, o, f, c, e[_t[A]], vt[1], wt[A]), R = gn(u, p, w, m, v, e[gt[A]], xt[1], mt[A])) : A < 48 ? (C = _n(r, a, o, f, c, e[_t[A]], vt[2], wt[A]), R = _n(u, p, w, m, v, e[gt[A]], xt[2], mt[A])) : A < 64 ? (C = gn(r, a, o, f, c, e[_t[A]], vt[3], wt[A]), R = yn(u, p, w, m, v, e[gt[A]], xt[3], mt[A])) : (C = wn(r, a, o, f, c, e[_t[A]], vt[4], wt[A]), R = bn(u, p, w, m, v, e[gt[A]], xt[4], mt[A])), r = c, c = f, f = Xe(o, 10), o = a, a = C, u = v, v = m, m = Xe(w, 10), w = p, p = R;
4971
+ A < 16 ? (C = bn(r, a, o, f, c, e[gt[A]], xt[0], mt[A]), R = wn(u, p, w, m, v, e[wt[A]], Et[0], vt[A])) : A < 32 ? (C = yn(r, a, o, f, c, e[gt[A]], xt[1], mt[A]), R = gn(u, p, w, m, v, e[wt[A]], Et[1], vt[A])) : A < 48 ? (C = _n(r, a, o, f, c, e[gt[A]], xt[2], mt[A]), R = _n(u, p, w, m, v, e[wt[A]], Et[2], vt[A])) : A < 64 ? (C = gn(r, a, o, f, c, e[gt[A]], xt[3], mt[A]), R = yn(u, p, w, m, v, e[wt[A]], Et[3], vt[A])) : (C = wn(r, a, o, f, c, e[gt[A]], xt[4], mt[A]), R = bn(u, p, w, m, v, e[wt[A]], Et[4], vt[A])), r = c, c = f, f = Xe(o, 10), o = a, a = C, u = v, v = m, m = Xe(w, 10), w = p, p = R;
4973
4972
  }
4974
4973
  var k = this._b + o + m | 0;
4975
4974
  this._b = this._c + f + v | 0, this._c = this._d + c + u | 0, this._d = this._e + r + p | 0, this._e = this._a + a + w | 0, this._a = k;
@@ -5033,11 +5032,11 @@ var dt = tr, So = pe, si = dt, Ao = me.Buffer, Io = [
5033
5032
  -1894007588,
5034
5033
  -899497514
5035
5034
  ], To = new Array(80);
5036
- function At() {
5035
+ function It() {
5037
5036
  this.init(), this._w = To, si.call(this, 64, 56);
5038
5037
  }
5039
- So(At, si);
5040
- At.prototype.init = function() {
5038
+ So(It, si);
5039
+ It.prototype.init = function() {
5041
5040
  return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
5042
5041
  };
5043
5042
  function Co(e) {
@@ -5049,7 +5048,7 @@ function ko(e) {
5049
5048
  function Lo(e, t, r, a) {
5050
5049
  return e === 0 ? t & r | ~t & a : e === 2 ? t & r | t & a | r & a : t ^ r ^ a;
5051
5050
  }
5052
- At.prototype._update = function(e) {
5051
+ It.prototype._update = function(e) {
5053
5052
  for (var t = this._w, r = this._a | 0, a = this._b | 0, o = this._c | 0, f = this._d | 0, c = this._e | 0, u = 0; u < 16; ++u) t[u] = e.readInt32BE(u * 4);
5054
5053
  for (; u < 80; ++u) t[u] = t[u - 3] ^ t[u - 8] ^ t[u - 14] ^ t[u - 16];
5055
5054
  for (var p = 0; p < 80; ++p) {
@@ -5058,21 +5057,21 @@ At.prototype._update = function(e) {
5058
5057
  }
5059
5058
  this._a = r + this._a | 0, this._b = a + this._b | 0, this._c = o + this._c | 0, this._d = f + this._d | 0, this._e = c + this._e | 0;
5060
5059
  };
5061
- At.prototype._hash = function() {
5060
+ It.prototype._hash = function() {
5062
5061
  var e = Ao.allocUnsafe(20);
5063
5062
  return e.writeInt32BE(this._a | 0, 0), e.writeInt32BE(this._b | 0, 4), e.writeInt32BE(this._c | 0, 8), e.writeInt32BE(this._d | 0, 12), e.writeInt32BE(this._e | 0, 16), e;
5064
5063
  };
5065
- var Oo = At, Fo = pe, fi = dt, Mo = me.Buffer, Po = [
5064
+ var Oo = It, Fo = pe, fi = dt, Mo = me.Buffer, Po = [
5066
5065
  1518500249,
5067
5066
  1859775393,
5068
5067
  -1894007588,
5069
5068
  -899497514
5070
5069
  ], No = new Array(80);
5071
- function It() {
5070
+ function Tt() {
5072
5071
  this.init(), this._w = No, fi.call(this, 64, 56);
5073
5072
  }
5074
- Fo(It, fi);
5075
- It.prototype.init = function() {
5073
+ Fo(Tt, fi);
5074
+ Tt.prototype.init = function() {
5076
5075
  return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
5077
5076
  };
5078
5077
  function Do(e) {
@@ -5087,7 +5086,7 @@ function $o(e) {
5087
5086
  function Ho(e, t, r, a) {
5088
5087
  return e === 0 ? t & r | ~t & a : e === 2 ? t & r | t & a | r & a : t ^ r ^ a;
5089
5088
  }
5090
- It.prototype._update = function(e) {
5089
+ Tt.prototype._update = function(e) {
5091
5090
  for (var t = this._w, r = this._a | 0, a = this._b | 0, o = this._c | 0, f = this._d | 0, c = this._e | 0, u = 0; u < 16; ++u) t[u] = e.readInt32BE(u * 4);
5092
5091
  for (; u < 80; ++u) t[u] = Do(t[u - 3] ^ t[u - 8] ^ t[u - 14] ^ t[u - 16]);
5093
5092
  for (var p = 0; p < 80; ++p) {
@@ -5096,11 +5095,11 @@ It.prototype._update = function(e) {
5096
5095
  }
5097
5096
  this._a = r + this._a | 0, this._b = a + this._b | 0, this._c = o + this._c | 0, this._d = f + this._d | 0, this._e = c + this._e | 0;
5098
5097
  };
5099
- It.prototype._hash = function() {
5098
+ Tt.prototype._hash = function() {
5100
5099
  var e = Mo.allocUnsafe(20);
5101
5100
  return e.writeInt32BE(this._a | 0, 0), e.writeInt32BE(this._b | 0, 4), e.writeInt32BE(this._c | 0, 8), e.writeInt32BE(this._d | 0, 12), e.writeInt32BE(this._e | 0, 16), e;
5102
5101
  };
5103
- var jo = It, Wo = pe, ui = dt, qo = me.Buffer, Ko = [
5102
+ var jo = Tt, Wo = pe, ui = dt, qo = me.Buffer, Ko = [
5104
5103
  1116352408,
5105
5104
  1899447441,
5106
5105
  3049323471,
@@ -5166,11 +5165,11 @@ var jo = It, Wo = pe, ui = dt, qo = me.Buffer, Ko = [
5166
5165
  3204031479,
5167
5166
  3329325298
5168
5167
  ], Go = new Array(64);
5169
- function Tt() {
5168
+ function Ct() {
5170
5169
  this.init(), this._w = Go, ui.call(this, 64, 56);
5171
5170
  }
5172
- Wo(Tt, ui);
5173
- Tt.prototype.init = function() {
5171
+ Wo(Ct, ui);
5172
+ Ct.prototype.init = function() {
5174
5173
  return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this;
5175
5174
  };
5176
5175
  function Vo(e, t, r) {
@@ -5191,7 +5190,7 @@ function Qo(e) {
5191
5190
  function Xo(e) {
5192
5191
  return (e >>> 17 | e << 15) ^ (e >>> 19 | e << 13) ^ e >>> 10;
5193
5192
  }
5194
- Tt.prototype._update = function(e) {
5193
+ Ct.prototype._update = function(e) {
5195
5194
  for (var t = this._w, r = this._a | 0, a = this._b | 0, o = this._c | 0, f = this._d | 0, c = this._e | 0, u = this._f | 0, p = this._g | 0, w = this._h | 0, m = 0; m < 16; ++m) t[m] = e.readInt32BE(m * 4);
5196
5195
  for (; m < 64; ++m) t[m] = Xo(t[m - 2]) + t[m - 7] + Qo(t[m - 15]) + t[m - 16] | 0;
5197
5196
  for (var v = 0; v < 64; ++v) {
@@ -5200,11 +5199,11 @@ Tt.prototype._update = function(e) {
5200
5199
  }
5201
5200
  this._a = r + this._a | 0, this._b = a + this._b | 0, this._c = o + this._c | 0, this._d = f + this._d | 0, this._e = c + this._e | 0, this._f = u + this._f | 0, this._g = p + this._g | 0, this._h = w + this._h | 0;
5202
5201
  };
5203
- Tt.prototype._hash = function() {
5202
+ Ct.prototype._hash = function() {
5204
5203
  var e = qo.allocUnsafe(32);
5205
5204
  return e.writeInt32BE(this._a, 0), e.writeInt32BE(this._b, 4), e.writeInt32BE(this._c, 8), e.writeInt32BE(this._d, 12), e.writeInt32BE(this._e, 16), e.writeInt32BE(this._f, 20), e.writeInt32BE(this._g, 24), e.writeInt32BE(this._h, 28), e;
5206
5205
  };
5207
- var ci = Tt, Zo = pe, es = ci, ts = dt, rs = me.Buffer, ns = new Array(64);
5206
+ var ci = Ct, Zo = pe, es = ci, ts = dt, rs = me.Buffer, ns = new Array(64);
5208
5207
  function rr() {
5209
5208
  this.init(), this._w = ns, ts.call(this, 64, 56);
5210
5209
  }
@@ -5378,11 +5377,11 @@ var is = rr, as = pe, li = dt, os = me.Buffer, mn = [
5378
5377
  1816402316,
5379
5378
  1246189591
5380
5379
  ], ss = new Array(160);
5381
- function Ct() {
5380
+ function kt() {
5382
5381
  this.init(), this._w = ss, li.call(this, 128, 112);
5383
5382
  }
5384
- as(Ct, li);
5385
- Ct.prototype.init = function() {
5383
+ as(kt, li);
5384
+ kt.prototype.init = function() {
5386
5385
  return this._ah = 1779033703, this._bh = 3144134277, this._ch = 1013904242, this._dh = 2773480762, this._eh = 1359893119, this._fh = 2600822924, this._gh = 528734635, this._hh = 1541459225, this._al = 4089235720, this._bl = 2227873595, this._cl = 4271175723, this._dl = 1595750129, this._el = 2917565137, this._fl = 725511199, this._gl = 4215389547, this._hl = 327033209, this;
5387
5386
  };
5388
5387
  function vn(e, t, r) {
@@ -5412,7 +5411,7 @@ function ls(e, t) {
5412
5411
  function oe(e, t) {
5413
5412
  return e >>> 0 < t >>> 0 ? 1 : 0;
5414
5413
  }
5415
- Ct.prototype._update = function(e) {
5414
+ kt.prototype._update = function(e) {
5416
5415
  for (var t = this._w, r = this._ah | 0, a = this._bh | 0, o = this._ch | 0, f = this._dh | 0, c = this._eh | 0, u = this._fh | 0, p = this._gh | 0, w = this._hh | 0, m = this._al | 0, v = this._bl | 0, A = this._cl | 0, C = this._dl | 0, R = this._el | 0, k = this._fl | 0, S = this._gl | 0, T = this._hl | 0, L = 0; L < 32; L += 2)
5417
5416
  t[L] = e.readInt32BE(L * 4), t[L + 1] = e.readInt32BE(L * 4 + 4);
5418
5417
  for (; L < 160; L += 2) {
@@ -5430,14 +5429,14 @@ Ct.prototype._update = function(e) {
5430
5429
  }
5431
5430
  this._al = this._al + m | 0, this._bl = this._bl + v | 0, this._cl = this._cl + A | 0, this._dl = this._dl + C | 0, this._el = this._el + R | 0, this._fl = this._fl + k | 0, this._gl = this._gl + S | 0, this._hl = this._hl + T | 0, this._ah = this._ah + r + oe(this._al, m) | 0, this._bh = this._bh + a + oe(this._bl, v) | 0, this._ch = this._ch + o + oe(this._cl, A) | 0, this._dh = this._dh + f + oe(this._dl, C) | 0, this._eh = this._eh + c + oe(this._el, R) | 0, this._fh = this._fh + u + oe(this._fl, k) | 0, this._gh = this._gh + p + oe(this._gl, S) | 0, this._hh = this._hh + w + oe(this._hl, T) | 0;
5432
5431
  };
5433
- Ct.prototype._hash = function() {
5432
+ kt.prototype._hash = function() {
5434
5433
  var e = os.allocUnsafe(64);
5435
5434
  function t(r, a, o) {
5436
5435
  e.writeInt32BE(r, o), e.writeInt32BE(a, o + 4);
5437
5436
  }
5438
5437
  return t(this._ah, this._al, 0), t(this._bh, this._bl, 8), t(this._ch, this._cl, 16), t(this._dh, this._dl, 24), t(this._eh, this._el, 32), t(this._fh, this._fl, 40), t(this._gh, this._gl, 48), t(this._hh, this._hl, 56), e;
5439
5438
  };
5440
- var hi = Ct, hs = pe, ds = hi, ps = dt, bs = me.Buffer, ys = new Array(160);
5439
+ var hi = kt, hs = pe, ds = hi, ps = dt, bs = me.Buffer, ys = new Array(160);
5441
5440
  function nr() {
5442
5441
  this.init(), this._w = ys, ps.call(this, 128, 112);
5443
5442
  }
@@ -6044,7 +6043,7 @@ class Fr {
6044
6043
  Nonce: 1n
6045
6044
  }
6046
6045
  });
6047
- return se(new Fr(ze(Ft(r))));
6046
+ return se(new Fr(ze(Mt(r))));
6048
6047
  } catch (r) {
6049
6048
  return H("Failed to initialize: " + r);
6050
6049
  }
@@ -6053,11 +6052,11 @@ class Fr {
6053
6052
  return this.privKey;
6054
6053
  }
6055
6054
  generateSecret(t) {
6056
- const r = this.signMessage(t), a = Ft(Dt(r)), o = Ft(a);
6055
+ const r = this.signMessage(t), a = Mt(Dt(r)), o = Mt(a);
6057
6056
  return se({ secret: a, secretHash: o });
6058
6057
  }
6059
6058
  signMessage(t) {
6060
- const r = In.ECPairFactory(ft), a = "Garden.fi" + t.toString(), o = Buffer.from(a, "utf8"), f = Ft(o), c = Buffer.from(ze(this.privKey), "hex");
6059
+ const r = In.ECPairFactory(ft), a = "Garden.fi" + t.toString(), o = Buffer.from(a, "utf8"), f = Mt(o), c = Buffer.from(ze(this.privKey), "hex");
6061
6060
  if (c.length !== 32)
6062
6061
  throw new Error("Invalid private key length. Expected 32 bytes.");
6063
6062
  return r.fromPrivateKey(c).sign(Buffer.from(ze(f), "hex")).toString("hex");
@@ -6094,15 +6093,12 @@ class tf {
6094
6093
  }
6095
6094
  }
6096
6095
  export {
6097
- af as Asset,
6098
6096
  $i as EvmRelay,
6099
6097
  Zs as Garden,
6100
- of as MatchedOrder,
6101
6098
  Ni as ParseOrderStatus,
6102
6099
  Rr as ParseSwapStatus,
6103
6100
  tf as Quote,
6104
6101
  Fr as SecretManager,
6105
- sf as isBitcoin,
6106
6102
  Di as parseAction,
6107
6103
  Xs as switchOrAddNetwork
6108
6104
  };
@@ -9,4 +9,3 @@ export type { ISecretManager, Secret, } from './lib/secretManager/secretManager.
9
9
  export { Quote } from './lib/quote/quote';
10
10
  export type { IQuote, QuoteResponse } from './lib/quote/quote.types';
11
11
  export { switchOrAddNetwork } from './lib/utils';
12
- export { Asset, isBitcoin, MatchedOrder } from '@gardenfi/orderbook';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/core",
3
- "version": "0.2.0-beta.16",
3
+ "version": "0.2.0-beta.18",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"