@swapkit/core 1.0.0-rc.85 → 1.0.0-rc.86
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.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +54 -50
- package/dist/index.es.js.map +1 -1
- package/package.json +9 -9
- package/src/client/index.ts +3 -0
package/dist/index.d.ts
CHANGED
|
@@ -165,6 +165,7 @@ export declare class SwapKitCore<T = ''> {
|
|
|
165
165
|
connectXDEFI: (_chains: Chain[]) => Promise<void>;
|
|
166
166
|
connectEVMWallet: (_chains: Chain[] | Chain, _wallet: EVMWalletOptions) => Promise<void>;
|
|
167
167
|
connectWalletconnect: (_chains: Chain[], _options?: any) => Promise<void>;
|
|
168
|
+
connectKeepkey: (_chains: Chain[], _derivationPath: number[][]) => Promise<string>;
|
|
168
169
|
connectKeystore: (_chains: Chain[], _phrase: string) => Promise<void>;
|
|
169
170
|
connectLedger: (_chains: Chain, _derivationPath: number[]) => Promise<void>;
|
|
170
171
|
connectTrezor: (_chains: Chain, _derivationPath: number[]) => Promise<void>;
|
package/dist/index.es.js
CHANGED
|
@@ -745,7 +745,7 @@ const Cn = {
|
|
|
745
745
|
OP: [44, 60, 0, 0, 0],
|
|
746
746
|
THOR: [44, 931, 0, 0, 0]
|
|
747
747
|
};
|
|
748
|
-
var
|
|
748
|
+
var _ = /* @__PURE__ */ ((e) => (e[e.ARB = 18] = "ARB", e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DASH = 8] = "DASH", e[e.DOGE = 8] = "DOGE", e[e.ETH = 18] = "ETH", e[e.GAIA = 6] = "GAIA", e[e.KUJI = 6] = "KUJI", e[e.LTC = 8] = "LTC", e[e.MATIC = 18] = "MATIC", e[e.MAYA = 10] = "MAYA", e[e.OP = 18] = "OP", e[e.THOR = 8] = "THOR", e))(_ || {});
|
|
749
749
|
const ot = [
|
|
750
750
|
"ETH",
|
|
751
751
|
"AVAX",
|
|
@@ -839,7 +839,7 @@ const se = Object.values(s), dt = Object.keys(s), he = se.reduce(
|
|
|
839
839
|
MATIC: "https://polygonscan.com",
|
|
840
840
|
THOR: "https://runescan.io"
|
|
841
841
|
};
|
|
842
|
-
var mt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(mt || {}), b = /* @__PURE__ */ ((e) => (e.BOND = "BOND", e.DEPOSIT = "+", e.LEAVE = "LEAVE", e.THORNAME_REGISTER = "~", e.UNBOND = "UNBOND", e.WITHDRAW = "-", e.OPEN_LOAN = "$+", e.CLOSE_LOAN = "$-", e))(b || {}), q = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(q || {}), Tt = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.OKX = "OKX", e.OKX_MOBILE = "OKX_MOBILE", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(Tt || {}), ct = Object.defineProperty, bt = (e, t, n) => t in e ? ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, v = (e, t, n) => (bt(e, typeof t != "symbol" ? t + "" : t, n), n), ft = (e, t, n) => {
|
|
842
|
+
var mt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(mt || {}), b = /* @__PURE__ */ ((e) => (e.BOND = "BOND", e.DEPOSIT = "+", e.LEAVE = "LEAVE", e.THORNAME_REGISTER = "~", e.UNBOND = "UNBOND", e.WITHDRAW = "-", e.OPEN_LOAN = "$+", e.CLOSE_LOAN = "$-", e))(b || {}), q = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(q || {}), Tt = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.KEEPKEY = "KEEPKEY", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.OKX = "OKX", e.OKX_MOBILE = "OKX_MOBILE", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(Tt || {}), ct = Object.defineProperty, bt = (e, t, n) => t in e ? ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, v = (e, t, n) => (bt(e, typeof t != "symbol" ? t + "" : t, n), n), ft = (e, t, n) => {
|
|
843
843
|
if (!t.has(e))
|
|
844
844
|
throw TypeError("Cannot " + n);
|
|
845
845
|
}, F = (e, t, n) => {
|
|
@@ -849,7 +849,7 @@ var mt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(mt || {}
|
|
|
849
849
|
}, E = (e, t, n) => (ft(e, t, "access private method"), n);
|
|
850
850
|
const ht = "0x313ce567", Ne = async ({ chain: e, to: t }) => {
|
|
851
851
|
try {
|
|
852
|
-
const { result: n } = await
|
|
852
|
+
const { result: n } = await Ae.post(lt[e], {
|
|
853
853
|
headers: {
|
|
854
854
|
accept: "*/*",
|
|
855
855
|
"content-type": "application/json",
|
|
@@ -864,26 +864,26 @@ const ht = "0x313ce567", Ne = async ({ chain: e, to: t }) => {
|
|
|
864
864
|
});
|
|
865
865
|
return parseInt(BigInt(n).toString());
|
|
866
866
|
} catch (n) {
|
|
867
|
-
return console.error(n),
|
|
867
|
+
return console.error(n), _[e];
|
|
868
868
|
}
|
|
869
|
-
},
|
|
869
|
+
}, _t = async (e) => {
|
|
870
870
|
if (e === s.Ethereum)
|
|
871
|
-
return
|
|
871
|
+
return _.ETH;
|
|
872
872
|
const [, t] = e.split("-");
|
|
873
|
-
return t != null && t.startsWith("0x") ? Ne({ chain: s.Ethereum, to: t }) :
|
|
874
|
-
},
|
|
873
|
+
return t != null && t.startsWith("0x") ? Ne({ chain: s.Ethereum, to: t }) : _.ETH;
|
|
874
|
+
}, At = async (e) => {
|
|
875
875
|
const [, t] = e.split("-");
|
|
876
|
-
return t != null && t.startsWith("0x") ? Ne({ chain: s.Avalanche, to: t.toLowerCase() }) :
|
|
877
|
-
}, wt = async (e) => (e === s.BinanceSmartChain,
|
|
876
|
+
return t != null && t.startsWith("0x") ? Ne({ chain: s.Avalanche, to: t.toLowerCase() }) : _.AVAX;
|
|
877
|
+
}, wt = async (e) => (e === s.BinanceSmartChain, _.BSC), Mt = async ({ chain: e, symbol: t }) => {
|
|
878
878
|
switch (e) {
|
|
879
879
|
case s.Ethereum:
|
|
880
|
-
return At(t);
|
|
881
|
-
case s.Avalanche:
|
|
882
880
|
return _t(t);
|
|
881
|
+
case s.Avalanche:
|
|
882
|
+
return At(t);
|
|
883
883
|
case s.BinanceSmartChain:
|
|
884
884
|
return wt(t);
|
|
885
885
|
default:
|
|
886
|
-
return
|
|
886
|
+
return _[e];
|
|
887
887
|
}
|
|
888
888
|
}, Et = {
|
|
889
889
|
[q.Average]: 1.2,
|
|
@@ -922,13 +922,13 @@ const ht = "0x313ce567", Ne = async ({ chain: e, to: t }) => {
|
|
|
922
922
|
case `${s.Ethereum}.vTHOR`:
|
|
923
923
|
return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
|
|
924
924
|
case s.Cosmos:
|
|
925
|
-
return { identifier: "GAIA.ATOM", decimal:
|
|
925
|
+
return { identifier: "GAIA.ATOM", decimal: _[e] };
|
|
926
926
|
case s.THORChain:
|
|
927
|
-
return { identifier: "THOR.RUNE", decimal:
|
|
927
|
+
return { identifier: "THOR.RUNE", decimal: _[e] };
|
|
928
928
|
case s.BinanceSmartChain:
|
|
929
|
-
return { identifier: "BSC.BNB", decimal:
|
|
929
|
+
return { identifier: "BSC.BNB", decimal: _[e] };
|
|
930
930
|
case s.Maya:
|
|
931
|
-
return { identifier: "MAYA.CACAO", decimal:
|
|
931
|
+
return { identifier: "MAYA.CACAO", decimal: _.MAYA };
|
|
932
932
|
case `${s.Maya}.MAYA`:
|
|
933
933
|
return { identifier: "MAYA.MAYA", decimal: 4 };
|
|
934
934
|
case `${s.Kujira}.USK`:
|
|
@@ -944,7 +944,7 @@ const ht = "0x313ce567", Ne = async ({ chain: e, to: t }) => {
|
|
|
944
944
|
case s.Polygon:
|
|
945
945
|
case s.Bitcoin:
|
|
946
946
|
case s.Ethereum:
|
|
947
|
-
return { identifier: `${e}.${e}`, decimal:
|
|
947
|
+
return { identifier: `${e}.${e}`, decimal: _[e] };
|
|
948
948
|
}
|
|
949
949
|
}, Rt = ({ chain: e, symbol: t }) => {
|
|
950
950
|
if (t.includes("/"))
|
|
@@ -1026,7 +1026,7 @@ function Vn({
|
|
|
1026
1026
|
return St({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1027
1027
|
}
|
|
1028
1028
|
function g(e) {
|
|
1029
|
-
return k.fromBigInt(BigInt(e),
|
|
1029
|
+
return k.fromBigInt(BigInt(e), _.THOR);
|
|
1030
1030
|
}
|
|
1031
1031
|
function Ct({
|
|
1032
1032
|
liquidityUnits: e,
|
|
@@ -1060,7 +1060,7 @@ function Un({
|
|
|
1060
1060
|
runeAmount: i,
|
|
1061
1061
|
assetAmount: r
|
|
1062
1062
|
}) {
|
|
1063
|
-
const p = new k({ value: e, decimal: 8 }), u = new k({ value: n, decimal: 8 }), y = new k({ value: t, decimal: 8 }), d = new k({ value: i, decimal: 8 }), o = new k({ value: r, decimal: 8 }), T = d.mul(u), f = o.mul(p),
|
|
1063
|
+
const p = new k({ value: e, decimal: 8 }), u = new k({ value: n, decimal: 8 }), y = new k({ value: t, decimal: 8 }), d = new k({ value: i, decimal: 8 }), o = new k({ value: r, decimal: 8 }), T = d.mul(u), f = o.mul(p), A = d.mul(o), w = p.mul(u), M = y.mul(T.add(f.add(A.mul(2)))), R = T.add(f.add(w.mul(2))), O = M.div(R), D = g(a).add(O);
|
|
1064
1064
|
if (O.getBaseValue("number") === 0)
|
|
1065
1065
|
return D.div(y).getBaseValue("number");
|
|
1066
1066
|
const pe = y.add(D);
|
|
@@ -1169,20 +1169,20 @@ const Z = (e) => e !== null && typeof e == "object", J = (...e) => {
|
|
|
1169
1169
|
for (const t of e)
|
|
1170
1170
|
if ((!Z(t) || Array.isArray(t)) && t !== void 0)
|
|
1171
1171
|
throw new TypeError("The `options` argument must be an object");
|
|
1172
|
-
return
|
|
1172
|
+
return _e({}, ...e);
|
|
1173
1173
|
}, He = (e = {}, t = {}) => {
|
|
1174
1174
|
const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, i = new globalThis.Headers(t);
|
|
1175
1175
|
for (const [r, p] of i.entries())
|
|
1176
1176
|
a && p === "undefined" || p === void 0 ? n.delete(r) : n.set(r, p);
|
|
1177
1177
|
return n;
|
|
1178
|
-
},
|
|
1178
|
+
}, _e = (...e) => {
|
|
1179
1179
|
let t = {}, n = {};
|
|
1180
1180
|
for (const a of e)
|
|
1181
1181
|
if (Array.isArray(a))
|
|
1182
1182
|
Array.isArray(t) || (t = []), t = [...t, ...a];
|
|
1183
1183
|
else if (Z(a)) {
|
|
1184
1184
|
for (let [i, r] of Object.entries(a))
|
|
1185
|
-
Z(r) && i in t && (r =
|
|
1185
|
+
Z(r) && i in t && (r = _e(t[i], r)), t = { ...t, [i]: r };
|
|
1186
1186
|
Z(a.headers) && (n = He(n, a.headers), t.headers = n);
|
|
1187
1187
|
}
|
|
1188
1188
|
return t;
|
|
@@ -1353,7 +1353,7 @@ class te {
|
|
|
1353
1353
|
credentials: this._input.credentials || "same-origin",
|
|
1354
1354
|
...n,
|
|
1355
1355
|
headers: He(this._input.headers, n.headers),
|
|
1356
|
-
hooks:
|
|
1356
|
+
hooks: _e({
|
|
1357
1357
|
beforeRequest: [],
|
|
1358
1358
|
beforeRetry: [],
|
|
1359
1359
|
beforeError: [],
|
|
@@ -1482,7 +1482,7 @@ const me = (e) => {
|
|
|
1482
1482
|
for (const n of Ve)
|
|
1483
1483
|
t[n] = (a, i) => te.create(a, J(e, i, { method: n }));
|
|
1484
1484
|
return t.create = (n) => me(J(n)), t.extend = (n) => me(J(e, n)), t.stop = Fe, t;
|
|
1485
|
-
}, Gt = me(), Xt = Gt, jt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Ee = Xt.create({ headers: jt }),
|
|
1485
|
+
}, Gt = me(), Xt = Gt, jt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Ee = Xt.create({ headers: jt }), Ae = {
|
|
1486
1486
|
get: (e, t) => Ee.get(e, t).json(),
|
|
1487
1487
|
post: (e, t) => Ee.post(e, t).json()
|
|
1488
1488
|
}, ge = [...Object.values(s), "TERRA"];
|
|
@@ -1586,7 +1586,7 @@ const Yt = class $e {
|
|
|
1586
1586
|
}
|
|
1587
1587
|
// @ts-expect-error
|
|
1588
1588
|
getBaseValue(t) {
|
|
1589
|
-
const n = this.decimalMultiplier / P(this.decimal ||
|
|
1589
|
+
const n = this.decimalMultiplier / P(this.decimal || _.THOR), a = this.bigIntValue / n;
|
|
1590
1590
|
switch (t) {
|
|
1591
1591
|
case "number":
|
|
1592
1592
|
return Number(a);
|
|
@@ -1778,7 +1778,7 @@ class x extends We {
|
|
|
1778
1778
|
if (i)
|
|
1779
1779
|
return Re(t, n);
|
|
1780
1780
|
const { tax: p, decimal: u, identifier: y } = r || {
|
|
1781
|
-
decimal:
|
|
1781
|
+
decimal: _[a],
|
|
1782
1782
|
identifier: t
|
|
1783
1783
|
};
|
|
1784
1784
|
return new x({
|
|
@@ -1793,7 +1793,7 @@ class x extends We {
|
|
|
1793
1793
|
if (i)
|
|
1794
1794
|
return Re(t, n);
|
|
1795
1795
|
const { tax: p, decimal: u, identifier: y } = r || {
|
|
1796
|
-
decimal:
|
|
1796
|
+
decimal: _[a],
|
|
1797
1797
|
identifier: t
|
|
1798
1798
|
};
|
|
1799
1799
|
return new x({ tax: p, decimal: u, identifier: y, value: G(n, u) });
|
|
@@ -1812,7 +1812,7 @@ class x extends We {
|
|
|
1812
1812
|
(r = i == null ? void 0 : i.tokens) == null || r.forEach(({ identifier: p, chain: u, ...y }) => {
|
|
1813
1813
|
W.set(p.toUpperCase(), {
|
|
1814
1814
|
identifier: p,
|
|
1815
|
-
decimal: "decimals" in y ? y.decimals :
|
|
1815
|
+
decimal: "decimals" in y ? y.decimals : _[u]
|
|
1816
1816
|
});
|
|
1817
1817
|
});
|
|
1818
1818
|
}), t({ ok: !0 });
|
|
@@ -1901,6 +1901,7 @@ const Jt = {
|
|
|
1901
1901
|
core_wallet_trezor_not_installed: 10106,
|
|
1902
1902
|
core_wallet_keplr_not_installed: 10107,
|
|
1903
1903
|
core_wallet_okx_not_installed: 10108,
|
|
1904
|
+
core_wallet_keepkey_not_installed: 10109,
|
|
1904
1905
|
/**
|
|
1905
1906
|
* Core - Swap
|
|
1906
1907
|
*/
|
|
@@ -8235,7 +8236,7 @@ const Zt = [
|
|
|
8235
8236
|
type: "function"
|
|
8236
8237
|
},
|
|
8237
8238
|
{ stateMutability: "payable", type: "receive" }
|
|
8238
|
-
],
|
|
8239
|
+
], _n = [
|
|
8239
8240
|
{
|
|
8240
8241
|
inputs: [
|
|
8241
8242
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8366,7 +8367,7 @@ const Zt = [
|
|
|
8366
8367
|
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: Zt,
|
|
8367
8368
|
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: en,
|
|
8368
8369
|
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: tn
|
|
8369
|
-
},
|
|
8370
|
+
}, An = {
|
|
8370
8371
|
...dn,
|
|
8371
8372
|
...Xe,
|
|
8372
8373
|
// AVAX
|
|
@@ -8382,7 +8383,7 @@ const Zt = [
|
|
|
8382
8383
|
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: bn,
|
|
8383
8384
|
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: fn,
|
|
8384
8385
|
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: hn,
|
|
8385
|
-
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]:
|
|
8386
|
+
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: _n
|
|
8386
8387
|
}, wn = ({
|
|
8387
8388
|
streamSwap: e,
|
|
8388
8389
|
contractAddress: t,
|
|
@@ -8398,7 +8399,7 @@ const Zt = [
|
|
|
8398
8399
|
memoStreamingSwap: o,
|
|
8399
8400
|
tcMemo: T,
|
|
8400
8401
|
tcRouter: f,
|
|
8401
|
-
tcVault:
|
|
8402
|
+
tcVault: A,
|
|
8402
8403
|
vault: w,
|
|
8403
8404
|
token: M
|
|
8404
8405
|
}
|
|
@@ -8407,7 +8408,7 @@ const Zt = [
|
|
|
8407
8408
|
if (R && !d)
|
|
8408
8409
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
8409
8410
|
const O = T || y, D = e && o || O;
|
|
8410
|
-
if (!
|
|
8411
|
+
if (!A && !w)
|
|
8411
8412
|
throw new Error("TC Vault is required on calldata");
|
|
8412
8413
|
if (!f && !d)
|
|
8413
8414
|
throw new Error("TC Router is required on calldata");
|
|
@@ -8418,7 +8419,7 @@ const Zt = [
|
|
|
8418
8419
|
const pe = [
|
|
8419
8420
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
8420
8421
|
a(f || d),
|
|
8421
|
-
a(
|
|
8422
|
+
a(A || w),
|
|
8422
8423
|
D.replace("{recipientAddress}", n),
|
|
8423
8424
|
a(M),
|
|
8424
8425
|
i
|
|
@@ -8474,10 +8475,10 @@ const Zt = [
|
|
|
8474
8475
|
}
|
|
8475
8476
|
}, gn = (e) => {
|
|
8476
8477
|
const t = e ? X.ThornodeStagenet : X.ThornodeMainnet;
|
|
8477
|
-
return
|
|
8478
|
+
return Ae.get(`${t}/thorchain/inbound_addresses`);
|
|
8478
8479
|
}, Rn = (e) => {
|
|
8479
8480
|
const t = e ? X.ThornodeStagenet : X.ThornodeMainnet;
|
|
8480
|
-
return
|
|
8481
|
+
return Ae.get(`${t}/thorchain/mimir`);
|
|
8481
8482
|
}, Se = () => Object.values(s).reduce(
|
|
8482
8483
|
(e, t) => (e[t] = null, e),
|
|
8483
8484
|
{}
|
|
@@ -8523,10 +8524,10 @@ class Xn {
|
|
|
8523
8524
|
throw new m("core_wallet_connection_not_found");
|
|
8524
8525
|
if (!(t ? (u = a == null ? void 0 : a.streamingSwap) == null ? void 0 : u.transaction : a == null ? void 0 : a.transaction))
|
|
8525
8526
|
throw new m("core_swap_route_transaction_not_found");
|
|
8526
|
-
const { data: T, from: f, to:
|
|
8527
|
+
const { data: T, from: f, to: A, value: w } = a.transaction, M = {
|
|
8527
8528
|
data: T,
|
|
8528
8529
|
from: f,
|
|
8529
|
-
to:
|
|
8530
|
+
to: A.toLowerCase(),
|
|
8530
8531
|
chainId: BigInt(De[p]),
|
|
8531
8532
|
value: w ? BigInt(w) : 0n
|
|
8532
8533
|
};
|
|
@@ -8540,8 +8541,8 @@ class Xn {
|
|
|
8540
8541
|
throw new m("core_swap_asset_not_recognized");
|
|
8541
8542
|
const { address: o } = await h(this, L).call(this, d.chain), {
|
|
8542
8543
|
contract: T,
|
|
8543
|
-
calldata: { expiration: f, amountIn:
|
|
8544
|
-
} = a, R = d.add(k.fromBigInt(BigInt(
|
|
8544
|
+
calldata: { expiration: f, amountIn: A, memo: w, memoStreamingSwap: M }
|
|
8545
|
+
} = a, R = d.add(k.fromBigInt(BigInt(A), d.decimal)), O = t && M || w;
|
|
8545
8546
|
return this.deposit({
|
|
8546
8547
|
expiration: f,
|
|
8547
8548
|
assetValue: R,
|
|
@@ -8558,7 +8559,7 @@ class Xn {
|
|
|
8558
8559
|
const T = this.connectedWallets[p], f = this.getAddress(p);
|
|
8559
8560
|
if (!(T != null && T.sendTransaction) || !f)
|
|
8560
8561
|
throw new m("core_wallet_connection_not_found");
|
|
8561
|
-
const { getProvider:
|
|
8562
|
+
const { getProvider: A, toChecksumAddress: w } = await import("@swapkit/toolbox-evm"), M = A(p), R = An[o.toLowerCase()];
|
|
8562
8563
|
if (!R)
|
|
8563
8564
|
throw new m("core_swap_contract_not_supported", { contractAddress: o });
|
|
8564
8565
|
const D = await (await ((y = T.createContract) == null ? void 0 : y.call(T, o, R, M))).getFunction("swapIn").populateTransaction(
|
|
@@ -8654,7 +8655,7 @@ class Xn {
|
|
|
8654
8655
|
return await y.transfer(d);
|
|
8655
8656
|
}
|
|
8656
8657
|
} catch (o) {
|
|
8657
|
-
const T = ((o == null ? void 0 : o.message) || (o == null ? void 0 : o.toString())).toLowerCase(), f = T == null ? void 0 : T.includes("insufficient funds"),
|
|
8658
|
+
const T = ((o == null ? void 0 : o.message) || (o == null ? void 0 : o.toString())).toLowerCase(), f = T == null ? void 0 : T.includes("insufficient funds"), A = T == null ? void 0 : T.includes("gas"), w = T == null ? void 0 : T.includes("server"), M = f ? "core_transaction_deposit_insufficient_funds_error" : A ? "core_transaction_deposit_gas_error" : w ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
|
|
8658
8659
|
throw new m(M, o);
|
|
8659
8660
|
}
|
|
8660
8661
|
});
|
|
@@ -8700,10 +8701,10 @@ class Xn {
|
|
|
8700
8701
|
isPendingSymmAsset: r,
|
|
8701
8702
|
mode: p = "sym"
|
|
8702
8703
|
}) => {
|
|
8703
|
-
const { chain: u, symbol: y } = n, d = p === "sym", o = (t == null ? void 0 : t.gt(0)) && (d || p === "rune"), T = (n == null ? void 0 : n.gt(0)) && (d || p === "asset"), f = r || o,
|
|
8704
|
+
const { chain: u, symbol: y } = n, d = p === "sym", o = (t == null ? void 0 : t.gt(0)) && (d || p === "rune"), T = (n == null ? void 0 : n.gt(0)) && (d || p === "asset"), f = r || o, A = f ? a || this.getAddress(s.THORChain) : "", w = d || p === "asset" ? i || this.getAddress(u) : "";
|
|
8704
8705
|
if (!o && !T)
|
|
8705
8706
|
throw new m("core_transaction_add_liquidity_invalid_params");
|
|
8706
|
-
if (f && !
|
|
8707
|
+
if (f && !A)
|
|
8707
8708
|
throw new m("core_transaction_add_liquidity_no_rune_address");
|
|
8708
8709
|
let M, R;
|
|
8709
8710
|
if (o && t)
|
|
@@ -8719,7 +8720,7 @@ class Xn {
|
|
|
8719
8720
|
try {
|
|
8720
8721
|
R = await h(this, I).call(this, {
|
|
8721
8722
|
assetValue: n,
|
|
8722
|
-
memo: C(b.DEPOSIT, { chain: u, symbol: y, address:
|
|
8723
|
+
memo: C(b.DEPOSIT, { chain: u, symbol: y, address: A })
|
|
8723
8724
|
});
|
|
8724
8725
|
} catch (O) {
|
|
8725
8726
|
throw new m("core_transaction_add_liquidity_asset_error", O);
|
|
@@ -8866,6 +8867,9 @@ class Xn {
|
|
|
8866
8867
|
c(this, "connectWalletconnect", async (t, n) => {
|
|
8867
8868
|
throw new m("core_wallet_walletconnect_not_installed");
|
|
8868
8869
|
});
|
|
8870
|
+
c(this, "connectKeepkey", async (t, n) => {
|
|
8871
|
+
throw new m("core_wallet_keepkey_not_installed");
|
|
8872
|
+
});
|
|
8869
8873
|
c(this, "connectKeystore", async (t, n) => {
|
|
8870
8874
|
throw new m("core_wallet_keystore_not_installed");
|
|
8871
8875
|
});
|
|
@@ -8917,12 +8921,12 @@ class Xn {
|
|
|
8917
8921
|
const f = this.getAddress(r);
|
|
8918
8922
|
if (!i || !f)
|
|
8919
8923
|
throw new m("core_approve_asset_address_or_from_not_found");
|
|
8920
|
-
const
|
|
8924
|
+
const A = a || (await h(this, L).call(this, r)).router;
|
|
8921
8925
|
return T({
|
|
8922
8926
|
amount: t.getBaseValue("bigint"),
|
|
8923
8927
|
assetAddress: i,
|
|
8924
8928
|
from: f,
|
|
8925
|
-
spenderAddress:
|
|
8929
|
+
spenderAddress: A
|
|
8926
8930
|
});
|
|
8927
8931
|
});
|
|
8928
8932
|
B(this, I, async ({
|
|
@@ -8964,7 +8968,7 @@ export {
|
|
|
8964
8968
|
Sn as ApiError,
|
|
8965
8969
|
X as ApiUrl,
|
|
8966
8970
|
x as AssetValue,
|
|
8967
|
-
|
|
8971
|
+
_ as BaseDecimal,
|
|
8968
8972
|
We as BigIntArithmetics,
|
|
8969
8973
|
s as Chain,
|
|
8970
8974
|
fe as ChainId,
|
|
@@ -8986,7 +8990,7 @@ export {
|
|
|
8986
8990
|
Cn as NetworkDerivationPath,
|
|
8987
8991
|
nt as QuoteMode,
|
|
8988
8992
|
ke as RPCUrl,
|
|
8989
|
-
|
|
8993
|
+
Ae as RequestClient,
|
|
8990
8994
|
it as SWAP_IN,
|
|
8991
8995
|
st as SWAP_OUT,
|
|
8992
8996
|
Xn as SwapKitCore,
|