@swapkit/helpers 1.0.0-rc.63 → 1.0.0-rc.64

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.es.js CHANGED
@@ -1,307 +1,45 @@
1
- var bt = Object.defineProperty;
2
- var yt = (s, t, e) => t in s ? bt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var f = (s, t, e) => (yt(s, typeof t != "symbol" ? t + "" : t, e), e), wt = (s, t, e) => {
4
- if (!t.has(s))
5
- throw TypeError("Cannot " + e);
1
+ var ye = Object.defineProperty;
2
+ var we = (e, t, n) => t in e ? ye(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var p = (e, t, n) => (we(e, typeof t != "symbol" ? t + "" : t, n), n), Ve = (e, t, n) => {
4
+ if (!t.has(e))
5
+ throw TypeError("Cannot " + n);
6
6
  };
7
- var v = (s, t, e) => {
8
- if (t.has(s))
7
+ var O = (e, t, n) => {
8
+ if (t.has(e))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
- t instanceof WeakSet ? t.add(s) : t.set(s, e);
10
+ t instanceof WeakSet ? t.add(e) : t.set(e, n);
11
11
  };
12
- var m = (s, t, e) => (wt(s, t, "access private method"), e);
13
- import { FeeOption as D, BaseDecimal as d, Chain as o, EVMChainList as At, ChainToRPC as $t, MemoType as _, ChainToChainId as vt } from "@swapkit/types";
14
- const Tt = "0x313ce567", nt = async ({ chain: s, to: t }) => {
15
- try {
16
- const { result: e } = await Zt.post($t[s], {
17
- headers: {
18
- accept: "*/*",
19
- "content-type": "application/json",
20
- "cache-control": "no-cache"
21
- },
22
- body: JSON.stringify({
23
- id: 44,
24
- jsonrpc: "2.0",
25
- method: "eth_call",
26
- params: [{ to: t.toLowerCase(), data: Tt }, "latest"]
27
- })
28
- });
29
- return parseInt(BigInt(e).toString());
30
- } catch (e) {
31
- return console.error(e), d[s];
32
- }
33
- }, Ct = async (s) => {
34
- if (s === o.Ethereum)
35
- return d.ETH;
36
- const [, t] = s.split("-");
37
- return t != null && t.startsWith("0x") ? nt({ chain: o.Ethereum, to: t }) : d.ETH;
38
- }, Rt = async (s) => {
39
- const [, t] = s.split("-");
40
- return t != null && t.startsWith("0x") ? nt({ chain: o.Avalanche, to: t.toLowerCase() }) : d.AVAX;
41
- }, St = async (s) => s === o.BinanceSmartChain ? d.BSC : d.BSC, It = async ({ chain: s, symbol: t }) => {
42
- switch (s) {
43
- case o.Ethereum:
44
- return Ct(t);
45
- case o.Avalanche:
46
- return Rt(t);
47
- case o.BinanceSmartChain:
48
- return St(t);
49
- default:
50
- return d[s];
51
- }
52
- }, ie = {
53
- [D.Average]: 1.2,
54
- [D.Fast]: 1.5,
55
- [D.Fastest]: 2
56
- }, it = ({ chain: s, symbol: t }) => {
57
- switch (s) {
58
- case o.Bitcoin:
59
- case o.BitcoinCash:
60
- case o.Litecoin:
61
- case o.Dogecoin:
62
- case o.Binance:
63
- case o.Ethereum:
64
- case o.Avalanche:
65
- return t === s;
66
- case o.Arbitrum:
67
- case o.Optimism:
68
- return t === "ETH";
69
- case o.Maya:
70
- return t === "CACAO";
71
- case o.Kujira:
72
- return t === "KUJI";
73
- case o.Cosmos:
74
- return t === "ATOM";
75
- case o.Polygon:
76
- return t === "MATIC";
77
- case o.BinanceSmartChain:
78
- return t === "BNB";
79
- case o.THORChain:
80
- return t === "RUNE";
81
- }
82
- }, Ot = (s) => {
83
- switch (s) {
84
- case `${o.Ethereum}.THOR`:
85
- return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
86
- case `${o.Ethereum}.vTHOR`:
87
- return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
88
- case o.Cosmos:
89
- return { identifier: "GAIA.ATOM", decimal: d[s] };
90
- case o.THORChain:
91
- return { identifier: "THOR.RUNE", decimal: d[s] };
92
- case o.BinanceSmartChain:
93
- return { identifier: "BSC.BNB", decimal: d[s] };
94
- case o.Maya:
95
- return { identifier: "MAYA.CACAO", decimal: d.MAYA };
96
- case `${o.Maya}.MAYA`:
97
- return { identifier: "MAYA.MAYA", decimal: 4 };
98
- case `${o.Kujira}.USK`:
99
- return { identifier: `${o.Kujira}.USK`, decimal: 6 };
100
- case o.Kujira:
101
- case o.Arbitrum:
102
- case o.Optimism:
103
- case o.BitcoinCash:
104
- case o.Litecoin:
105
- case o.Dogecoin:
106
- case o.Binance:
107
- case o.Avalanche:
108
- case o.Polygon:
109
- case o.Bitcoin:
110
- case o.Ethereum:
111
- return { identifier: `${s}.${s}`, decimal: d[s] };
112
- }
113
- }, Et = ({ chain: s, symbol: t }) => {
114
- if (t.includes("/"))
115
- return "Synth";
116
- switch (s) {
117
- case o.Bitcoin:
118
- case o.BitcoinCash:
119
- case o.Dogecoin:
120
- case o.Litecoin:
121
- case o.Maya:
122
- case o.THORChain:
123
- return "Native";
124
- case o.Cosmos:
125
- return t === "ATOM" ? "Native" : o.Cosmos;
126
- case o.Kujira:
127
- return t === o.Kujira ? "Native" : o.Kujira;
128
- case o.Binance:
129
- return t === o.Binance ? "Native" : "BEP2";
130
- case o.BinanceSmartChain:
131
- return t === o.Binance ? "Native" : "BEP20";
132
- case o.Ethereum:
133
- return t === o.Ethereum ? "Native" : "ERC20";
134
- case o.Avalanche:
135
- return t === o.Avalanche ? "Native" : o.Avalanche;
136
- case o.Polygon:
137
- return t === o.Polygon ? "Native" : "POLYGON";
138
- case o.Arbitrum:
139
- return [o.Ethereum, o.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
140
- case o.Optimism:
141
- return [o.Ethereum, o.Optimism].includes(t) ? "Native" : "OPTIMISM";
142
- }
143
- }, oe = (s) => {
144
- var c;
145
- const [t, ...e] = s.split("."), r = s.includes("/"), n = e.join("."), i = (c = n == null ? void 0 : n.split("-")) == null ? void 0 : c[0];
146
- return { chain: t, symbol: n, ticker: i, synth: r };
147
- }, Bt = new RegExp(
148
- /(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
149
- "gmi"
150
- ), Mt = (s) => {
151
- const [t, e] = s.split(".");
152
- if (!At.includes(t))
153
- return !0;
154
- const [, r] = e.split("-");
155
- return it({ chain: t, symbol: e }) || !!r;
156
- }, ae = (s) => s.filter((t) => {
157
- const e = `${t.chain}.${t.symbol}`;
158
- return !Bt.test(e) && Mt(e) && t.value !== "0";
159
- });
160
- function xt({
161
- liquidityUnits: s,
162
- poolUnits: t,
163
- runeDepth: e
164
- }) {
165
- const r = p(s), n = p(t), i = p(e), c = r.mul(i), a = n.mul(n).mul(2), u = n.mul(r).mul(2), l = r.mul(r), h = n.mul(n).mul(n);
166
- return c.mul(a.sub(u).add(l)).div(h);
167
- }
168
- function qt({
169
- liquidityUnits: s,
170
- poolUnits: t,
171
- assetDepth: e
172
- }) {
173
- const r = p(s), n = p(t), i = p(e), c = r.mul(i), a = n.mul(n).mul(2), u = n.mul(r).mul(2), l = r.mul(r), h = c.mul(a.sub(u).add(l)), $ = n.mul(n).mul(n);
174
- return h.div($);
175
- }
176
- function ce({
177
- percent: s,
178
- runeDepth: t,
179
- liquidityUnits: e,
180
- poolUnits: r
181
- }) {
182
- return xt({ runeDepth: t, liquidityUnits: e, poolUnits: r }).mul(s);
183
- }
184
- function ue({
185
- percent: s,
186
- assetDepth: t,
187
- liquidityUnits: e,
188
- poolUnits: r
189
- }) {
190
- return qt({ assetDepth: t, liquidityUnits: e, poolUnits: r }).mul(s);
191
- }
192
- function p(s) {
193
- return g.fromBigInt(BigInt(s), d.THOR);
194
- }
195
- function Pt({
196
- liquidityUnits: s,
197
- poolUnits: t,
198
- runeDepth: e,
199
- assetDepth: r
200
- }) {
201
- return {
202
- assetAmount: p(r).mul(s).div(t),
203
- runeAmount: p(e).mul(s).div(t)
204
- };
205
- }
206
- function le({
207
- liquidityUnits: s,
208
- poolUnits: t,
209
- runeDepth: e,
210
- assetDepth: r,
211
- percent: n
212
- }) {
213
- return Object.fromEntries(
214
- Object.entries(Pt({ liquidityUnits: s, poolUnits: t, runeDepth: e, assetDepth: r })).map(
215
- ([i, c]) => [i, c.mul(n)]
216
- )
217
- );
218
- }
219
- function he({
220
- runeDepth: s,
221
- poolUnits: t,
222
- assetDepth: e,
223
- liquidityUnits: r,
224
- runeAmount: n,
225
- assetAmount: i
226
- }) {
227
- const c = new g({ value: s, decimal: 8 }), a = new g({ value: e, decimal: 8 }), u = new g({ value: t, decimal: 8 }), l = new g({ value: n, decimal: 8 }), h = new g({ value: i, decimal: 8 }), $ = l.mul(a), H = h.mul(c), mt = l.mul(h), pt = c.mul(a), ft = u.mul($.add(H.add(mt.mul(2)))), _t = $.add(H.add(pt.mul(2))), Q = ft.div(_t), U = p(r).add(Q);
228
- if (Q.getBaseValue("number") === 0)
229
- return U.div(u).getBaseValue("number");
230
- const gt = u.add(U);
231
- return U.div(gt).getBaseValue("number");
232
- }
233
- function de({
234
- runeAmount: s,
235
- assetAmount: t,
236
- runeDepth: e,
237
- assetDepth: r
238
- }) {
239
- if (s === "0" || t === "0" || e === "0" || r === "0")
240
- return 0;
241
- const n = p(e), i = p(r), c = p(t), a = p(s), u = c.mul(n).sub(i.mul(a)), l = i.mul(a).add(n.mul(i));
242
- return Math.abs(u.div(l).getBaseValue("number"));
243
- }
244
- const me = (s, t) => {
245
- switch (s) {
246
- case _.LEAVE:
247
- case _.BOND: {
248
- const { address: e } = t;
249
- return `${s}:${e}`;
250
- }
251
- case _.UNBOND: {
252
- const { address: e, unbondAmount: r } = t;
253
- return `${s}:${e}:${r}`;
254
- }
255
- case _.THORNAME_REGISTER: {
256
- const { name: e, chain: r, address: n, owner: i } = t;
257
- return `${s}:${e}:${r}:${n}${i ? `:${i}` : ""}`;
258
- }
259
- case _.DEPOSIT: {
260
- const { chain: e, symbol: r, address: n, singleSide: i } = t;
261
- return i ? `${s}:${e}/${r}::t:0` : `${s}:${((a, u) => {
262
- switch (a) {
263
- case o.Litecoin:
264
- return "l";
265
- case o.Dogecoin:
266
- return "d";
267
- case o.BitcoinCash:
268
- return "c";
269
- default:
270
- return `${a}.${u}`;
271
- }
272
- })(e, r)}:${n || ""}:t:0`;
273
- }
274
- case _.WITHDRAW: {
275
- const { chain: e, ticker: r, symbol: n, basisPoints: i, targetAssetString: c, singleSide: a } = t, u = e === "ETH" && r !== "ETH" ? `${r}-${n.slice(-3)}` : n, l = !a && c ? `:${c}` : "";
276
- return `${s}:${e}${a ? "/" : "."}${u}:${i}${l}`;
277
- }
278
- case _.OPEN_LOAN:
279
- case _.CLOSE_LOAN: {
280
- const { asset: e, address: r } = t;
281
- return `${s}:${e}:${r}`;
282
- }
283
- default:
284
- return "";
285
- }
286
- };
287
- function pe(s) {
288
- if (s < 0)
289
- throw new Error("Invalid number of year");
290
- return 10 + s;
291
- }
292
- function fe(s) {
293
- if (s.length > 30)
294
- return !1;
295
- const t = /^[a-zA-Z0-9+_-]+$/g;
296
- return !!s.match(t);
297
- }
298
- function _e([s, t, e, r, n]) {
299
- return `${s}'/${t}'/${e}'/${r}${typeof n != "number" ? "" : `/${n}`}`;
300
- }
301
- class X extends Error {
302
- constructor(t, e, r) {
303
- const n = t.status || t.status === 0 ? t.status : "", i = t.statusText || "", c = `${n} ${i}`.trim(), a = c ? `status code ${c}` : "an unknown error";
304
- super(`Request failed with ${a}`), Object.defineProperty(this, "response", {
12
+ var T = (e, t, n) => (Ve(e, t, "access private method"), n);
13
+ import { FeeOption as Y, BaseDecimal as d, Chain as a, EVMChainList as Be, ChainToRPC as Ue, MemoType as E, ChainToChainId as Le } from "@swapkit/types";
14
+ var l = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.INVALID_TYPE_GENERIC = "1100", e.INVALID_NUMBER_STRING = "1101", e.INVALID_NUMBER = "1102", e.INVALID_BOOLEAN = "1103", e.INVALID_OBJECT = "1104", e.INVALID_ARRAY = "1105", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_MAX_500 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.SOURCE_ADDRESS_SMART_CONTRACT = "2011", e.INVALID_PROVIDER = "2100", e.MISSING_CROSS_CHAIN_PROVIDER = "2101", e.MISSING_AVAX_PROVIDER = "2102", e.MISSING_BSC_PROVIDER = "2103", e.MISSING_ETH_PROVIDER = "2104", e.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", e.MISSING_ARB_PROVIDER = "2106", e.INVALID_CHAIN = "2200", e.INVALID_ASSET = "2201", e.INVALID_ASSET_IDENTIFIER = "2202", e.UNSUPPORTED_CHAIN = "2204", e.UNSUPPORTED_ASSET = "2203", e.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", e.INVALID_SOURCE_ADDRESS = "2300", e.INVALID_DESTINATION_ADDRESS = "2301", e.THORNODE_QUOTE_GENERIC_ERROR = "3000", e.NOT_ENOUGH_SYNTH_BALANCE = "3001", e.SYNTH_MINTING_CAP_REACHED = "3002", e.INVALID_QUOTE_MODE = "4000", e.NO_QUOTES = "4001", e.SERVICE_UNAVAILABLE_GENERIC = "5000", e.MISSING_GAS_DATA_GENERIC = "5100", e.MISSING_TOKEN_INFO_GENERIC = "5200", e.CANT_FIND_TOKEN_LIST = "5201", e.NO_PRICE = "5202", e.PRICE_IS_STALE = "5203", e.ADDRESS_NOT_WHITELISTED = "6000", e.ADDRESS_ALREADY_CLAIMED = "6001", e.TEMPORARY_ERROR = "9999", e))(l || {});
15
+ l.INVALID_INPUT_PARAMETERS + "", l.UNKNOWN_PROVIDERS + "", l.CANNOT_FIND_INBOUND_ADDRESS + "", l.NO_INBOUND_ADDRESSES + "", l.CHAIN_HALTED_OR_UNSUPPORTED + "", l.MISSING_INPUT_PARAMETER + "", l.INVALID_TYPE_GENERIC + "", l.INVALID_NUMBER_STRING + "", l.INVALID_NUMBER + "", l.INVALID_BOOLEAN + "", l.INVALID_OBJECT + "", l.INVALID_ARRAY + "", l.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", l.SELL_BUY_ASSETS_ARE_THE_SAME + "", l.MISSING_SOURCE_ADDRESS_FOR_SYNTH + "", l.AFF_ADDRESS_AND_BPS_OR_NEITHER + "", l.AFF_ADDRESS_TOO_LONG + "", l.AFF_BPS_INTEGER_MAX_500 + "", l.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN + "", l.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN + "", l.PREFERRED_PROVIDER_NOT_SUPPORTED + "", l.SOURCE_ADDRESS_SMART_CONTRACT + "", l.DESTINATION_ADDRESS_SMART_CONTRACT + "", l.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", l.INVALID_PROVIDER + "", l.MISSING_CROSS_CHAIN_PROVIDER + "", l.MISSING_AVAX_PROVIDER + "", l.MISSING_BSC_PROVIDER + "", l.MISSING_ETH_PROVIDER + "", l.MISSING_ARB_PROVIDER + "", l.INVALID_PROVIDER_FOR_SWAP_OUT + "", l.INVALID_CHAIN + "", l.INVALID_ASSET + "", l.UNSUPPORTED_CHAIN + "", l.UNSUPPORTED_ASSET + "", l.UNSUPPORTED_ASSET_FOR_SWAPOUT + "", l.THORNODE_QUOTE_GENERIC_ERROR + "", l.INVALID_SOURCE_ADDRESS + "", l.INVALID_DESTINATION_ADDRESS + "", l.NOT_ENOUGH_SYNTH_BALANCE + "", l.SYNTH_MINTING_CAP_REACHED + "", l.INVALID_QUOTE_MODE + "", l.NO_QUOTES + "", l.SERVICE_UNAVAILABLE_GENERIC + "", l.MISSING_GAS_DATA_GENERIC + "", l.MISSING_TOKEN_INFO_GENERIC + "", l.CANT_FIND_TOKEN_LIST + "", l.NO_PRICE + "", l.PRICE_IS_STALE + "", l.ADDRESS_NOT_WHITELISTED + "", l.ADDRESS_ALREADY_CLAIMED + "";
16
+ var q = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(q || {}), te = /* @__PURE__ */ ((e) => (e.Arbitrum = "42161", e.ArbitrumHex = "0xa4b1", e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.BitcoinCash = "bitcoincash", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Kujira = "kaiyo-1", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Maya = "mayachain-mainnet-v1", e.MayaStagenet = "mayachain-stagenet-v1", e.Optimism = "10", e.OptimismHex = "0xa", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(te || {}), de = /* @__PURE__ */ ((e) => (e.Arbitrum = "https://arb1.arbitrum.io/rpc", e.Avalanche = "https://node-router.thorswap.net/avalanche-c", e.Binance = "", e.BinanceSmartChain = "https://bsc-dataseed.binance.org", e.Bitcoin = "https://node-router.thorswap.net/bitcoin", e.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Kujira = "https://rpc-kujira.synergynodes.com/", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Litecoin = "https://node-router.thorswap.net/litecoin", e.Maya = "https://tendermint.mayachain.info", e.MayaStagenet = "https://stagenet.tendermint.mayachain.info", e.Optimism = "https://mainnet.optimism.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))(de || {}), R = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.net", e.ThorswapStatic = "https://static.thorswap.net", e))(R || {});
17
+ const j = Object.values(q), $e = Object.keys(q), ne = j.reduce(
18
+ (e, t) => {
19
+ const n = $e.find((s) => q[s] === t);
20
+ return n && (e[t] = n), e;
21
+ },
22
+ {}
23
+ );
24
+ j.reduce(
25
+ (e, t) => (e[t] = te[ne[t]], e),
26
+ {}
27
+ );
28
+ j.reduce(
29
+ (e, t) => (e[t] = de[ne[t]], e),
30
+ {}
31
+ );
32
+ j.reduce(
33
+ (e, t) => {
34
+ const n = `${ne[t]}Hex`;
35
+ return e[t] = te[n], e;
36
+ },
37
+ {}
38
+ );
39
+ class oe extends Error {
40
+ constructor(t, n, s) {
41
+ const r = t.status || t.status === 0 ? t.status : "", i = t.statusText || "", o = `${r} ${i}`.trim(), u = o ? `status code ${o}` : "an unknown error";
42
+ super(`Request failed with ${u}`), Object.defineProperty(this, "response", {
305
43
  enumerable: !0,
306
44
  configurable: !0,
307
45
  writable: !0,
@@ -316,10 +54,10 @@ class X extends Error {
316
54
  configurable: !0,
317
55
  writable: !0,
318
56
  value: void 0
319
- }), this.name = "HTTPError", this.response = t, this.request = e, this.options = r;
57
+ }), this.name = "HTTPError", this.response = t, this.request = n, this.options = s;
320
58
  }
321
59
  }
322
- class ot extends Error {
60
+ class Te extends Error {
323
61
  constructor(t) {
324
62
  super("Request timed out"), Object.defineProperty(this, "request", {
325
63
  enumerable: !0,
@@ -329,45 +67,45 @@ class ot extends Error {
329
67
  }), this.name = "TimeoutError", this.request = t;
330
68
  }
331
69
  }
332
- const q = (s) => s !== null && typeof s == "object", M = (...s) => {
333
- for (const t of s)
334
- if ((!q(t) || Array.isArray(t)) && t !== void 0)
70
+ const M = (e) => e !== null && typeof e == "object", $ = (...e) => {
71
+ for (const t of e)
72
+ if ((!M(t) || Array.isArray(t)) && t !== void 0)
335
73
  throw new TypeError("The `options` argument must be an object");
336
- return J({}, ...s);
337
- }, at = (s = {}, t = {}) => {
338
- const e = new globalThis.Headers(s), r = t instanceof globalThis.Headers, n = new globalThis.Headers(t);
339
- for (const [i, c] of n.entries())
340
- r && c === "undefined" || c === void 0 ? e.delete(i) : e.set(i, c);
341
- return e;
342
- }, J = (...s) => {
343
- let t = {}, e = {};
344
- for (const r of s)
345
- if (Array.isArray(r))
346
- Array.isArray(t) || (t = []), t = [...t, ...r];
347
- else if (q(r)) {
348
- for (let [n, i] of Object.entries(r))
349
- q(i) && n in t && (i = J(t[n], i)), t = { ...t, [n]: i };
350
- q(r.headers) && (e = at(e, r.headers), t.headers = e);
74
+ return se({}, ...e);
75
+ }, Ae = (e = {}, t = {}) => {
76
+ const n = new globalThis.Headers(e), s = t instanceof globalThis.Headers, r = new globalThis.Headers(t);
77
+ for (const [i, o] of r.entries())
78
+ s && o === "undefined" || o === void 0 ? n.delete(i) : n.set(i, o);
79
+ return n;
80
+ }, se = (...e) => {
81
+ let t = {}, n = {};
82
+ for (const s of e)
83
+ if (Array.isArray(s))
84
+ Array.isArray(t) || (t = []), t = [...t, ...s];
85
+ else if (M(s)) {
86
+ for (let [r, i] of Object.entries(s))
87
+ M(i) && r in t && (i = se(t[r], i)), t = { ...t, [r]: i };
88
+ M(s.headers) && (n = Ae(n, s.headers), t.headers = n);
351
89
  }
352
90
  return t;
353
- }, Vt = (() => {
354
- let s = !1, t = !1;
355
- const e = typeof globalThis.ReadableStream == "function", r = typeof globalThis.Request == "function";
356
- return e && r && (t = new globalThis.Request("https://empty.invalid", {
91
+ }, ve = (() => {
92
+ let e = !1, t = !1;
93
+ const n = typeof globalThis.ReadableStream == "function", s = typeof globalThis.Request == "function";
94
+ return n && s && (t = new globalThis.Request("https://empty.invalid", {
357
95
  body: new globalThis.ReadableStream(),
358
96
  method: "POST",
359
97
  // @ts-expect-error - Types are outdated.
360
98
  get duplex() {
361
- return s = !0, "half";
99
+ return e = !0, "half";
362
100
  }
363
- }).headers.has("Content-Type")), s && !t;
364
- })(), kt = typeof globalThis.AbortController == "function", jt = typeof globalThis.ReadableStream == "function", Nt = typeof globalThis.FormData == "function", ct = ["get", "post", "put", "patch", "head", "delete"], Ht = {
101
+ }).headers.has("Content-Type")), e && !t;
102
+ })(), Me = typeof globalThis.AbortController == "function", He = typeof globalThis.ReadableStream == "function", xe = typeof globalThis.FormData == "function", pe = ["get", "post", "put", "patch", "head", "delete"], Fe = {
365
103
  json: "application/json",
366
104
  text: "text/*",
367
105
  formData: "multipart/form-data",
368
106
  arrayBuffer: "*/*",
369
107
  blob: "*/*"
370
- }, L = 2147483647, ut = Symbol("stop"), Ut = {
108
+ }, K = 2147483647, Se = Symbol("stop"), Ge = {
371
109
  json: !0,
372
110
  parseJson: !0,
373
111
  searchParams: !0,
@@ -378,7 +116,7 @@ const q = (s) => s !== null && typeof s == "object", M = (...s) => {
378
116
  throwHttpErrors: !0,
379
117
  onDownloadProgress: !0,
380
118
  fetch: !0
381
- }, Dt = {
119
+ }, We = {
382
120
  method: !0,
383
121
  headers: !0,
384
122
  body: !0,
@@ -394,99 +132,99 @@ const q = (s) => s !== null && typeof s == "object", M = (...s) => {
394
132
  window: !0,
395
133
  dispatcher: !0,
396
134
  duplex: !0
397
- }, Lt = (s) => ct.includes(s) ? s.toUpperCase() : s, Ft = ["get", "put", "head", "delete", "options", "trace"], Wt = [408, 413, 429, 500, 502, 503, 504], lt = [413, 429, 503], Z = {
135
+ }, ke = (e) => pe.includes(e) ? e.toUpperCase() : e, qe = ["get", "put", "head", "delete", "options", "trace"], je = [408, 413, 429, 500, 502, 503, 504], me = [413, 429, 503], ce = {
398
136
  limit: 2,
399
- methods: Ft,
400
- statusCodes: Wt,
401
- afterStatusCodes: lt,
137
+ methods: qe,
138
+ statusCodes: je,
139
+ afterStatusCodes: me,
402
140
  maxRetryAfter: Number.POSITIVE_INFINITY,
403
141
  backoffLimit: Number.POSITIVE_INFINITY,
404
- delay: (s) => 0.3 * 2 ** (s - 1) * 1e3
405
- }, Kt = (s = {}) => {
406
- if (typeof s == "number")
142
+ delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
143
+ }, Xe = (e = {}) => {
144
+ if (typeof e == "number")
407
145
  return {
408
- ...Z,
409
- limit: s
146
+ ...ce,
147
+ limit: e
410
148
  };
411
- if (s.methods && !Array.isArray(s.methods))
149
+ if (e.methods && !Array.isArray(e.methods))
412
150
  throw new Error("retry.methods must be an array");
413
- if (s.statusCodes && !Array.isArray(s.statusCodes))
151
+ if (e.statusCodes && !Array.isArray(e.statusCodes))
414
152
  throw new Error("retry.statusCodes must be an array");
415
153
  return {
416
- ...Z,
417
- ...s,
418
- afterStatusCodes: lt
154
+ ...ce,
155
+ ...e,
156
+ afterStatusCodes: me
419
157
  };
420
158
  };
421
- async function Gt(s, t, e, r) {
422
- return new Promise((n, i) => {
423
- const c = setTimeout(() => {
424
- e && e.abort(), i(new ot(s));
425
- }, r.timeout);
426
- r.fetch(s, t).then(n).catch(i).then(() => {
427
- clearTimeout(c);
159
+ async function Ye(e, t, n, s) {
160
+ return new Promise((r, i) => {
161
+ const o = setTimeout(() => {
162
+ n && n.abort(), i(new Te(e));
163
+ }, s.timeout);
164
+ s.fetch(e, t).then(r).catch(i).then(() => {
165
+ clearTimeout(o);
428
166
  });
429
167
  });
430
168
  }
431
- async function zt(s, { signal: t }) {
432
- return new Promise((e, r) => {
433
- t && (t.throwIfAborted(), t.addEventListener("abort", n, { once: !0 }));
434
- function n() {
435
- clearTimeout(i), r(t.reason);
169
+ async function Ke(e, { signal: t }) {
170
+ return new Promise((n, s) => {
171
+ t && (t.throwIfAborted(), t.addEventListener("abort", r, { once: !0 }));
172
+ function r() {
173
+ clearTimeout(i), s(t.reason);
436
174
  }
437
175
  const i = setTimeout(() => {
438
- t == null || t.removeEventListener("abort", n), e();
439
- }, s);
176
+ t == null || t.removeEventListener("abort", r), n();
177
+ }, e);
440
178
  });
441
179
  }
442
- const Jt = (s, t) => {
443
- const e = {};
444
- for (const r in t)
445
- !(r in Dt) && !(r in Ut) && !(r in s) && (e[r] = t[r]);
446
- return e;
180
+ const Je = (e, t) => {
181
+ const n = {};
182
+ for (const s in t)
183
+ !(s in We) && !(s in Ge) && !(s in e) && (n[s] = t[s]);
184
+ return n;
447
185
  };
448
- class V {
449
- static create(t, e) {
450
- const r = new V(t, e), n = async () => {
451
- if (typeof r._options.timeout == "number" && r._options.timeout > L)
452
- throw new RangeError(`The \`timeout\` option cannot be greater than ${L}`);
186
+ class F {
187
+ static create(t, n) {
188
+ const s = new F(t, n), r = async () => {
189
+ if (typeof s._options.timeout == "number" && s._options.timeout > K)
190
+ throw new RangeError(`The \`timeout\` option cannot be greater than ${K}`);
453
191
  await Promise.resolve();
454
- let a = await r._fetch();
455
- for (const u of r._options.hooks.afterResponse) {
456
- const l = await u(r.request, r._options, r._decorateResponse(a.clone()));
457
- l instanceof globalThis.Response && (a = l);
192
+ let o = await s._fetch();
193
+ for (const u of s._options.hooks.afterResponse) {
194
+ const c = await u(s.request, s._options, s._decorateResponse(o.clone()));
195
+ c instanceof globalThis.Response && (o = c);
458
196
  }
459
- if (r._decorateResponse(a), !a.ok && r._options.throwHttpErrors) {
460
- let u = new X(a, r.request, r._options);
461
- for (const l of r._options.hooks.beforeError)
462
- u = await l(u);
197
+ if (s._decorateResponse(o), !o.ok && s._options.throwHttpErrors) {
198
+ let u = new oe(o, s.request, s._options);
199
+ for (const c of s._options.hooks.beforeError)
200
+ u = await c(u);
463
201
  throw u;
464
202
  }
465
- if (r._options.onDownloadProgress) {
466
- if (typeof r._options.onDownloadProgress != "function")
203
+ if (s._options.onDownloadProgress) {
204
+ if (typeof s._options.onDownloadProgress != "function")
467
205
  throw new TypeError("The `onDownloadProgress` option must be a function");
468
- if (!jt)
206
+ if (!He)
469
207
  throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
470
- return r._stream(a.clone(), r._options.onDownloadProgress);
208
+ return s._stream(o.clone(), s._options.onDownloadProgress);
471
209
  }
472
- return a;
473
- }, c = r._options.retry.methods.includes(r.request.method.toLowerCase()) ? r._retry(n) : n();
474
- for (const [a, u] of Object.entries(Ht))
475
- c[a] = async () => {
476
- r.request.headers.set("accept", r.request.headers.get("accept") || u);
477
- const h = (await c).clone();
478
- if (a === "json") {
479
- if (h.status === 204 || (await h.clone().arrayBuffer()).byteLength === 0)
210
+ return o;
211
+ }, i = s._options.retry.methods.includes(s.request.method.toLowerCase()) ? s._retry(r) : r();
212
+ for (const [o, u] of Object.entries(Fe))
213
+ i[o] = async () => {
214
+ s.request.headers.set("accept", s.request.headers.get("accept") || u);
215
+ const c = (await i).clone();
216
+ if (o === "json") {
217
+ if (c.status === 204 || (await c.clone().arrayBuffer()).byteLength === 0)
480
218
  return "";
481
- if (e.parseJson)
482
- return e.parseJson(await h.text());
219
+ if (n.parseJson)
220
+ return n.parseJson(await c.text());
483
221
  }
484
- return h[a]();
222
+ return c[o]();
485
223
  };
486
- return c;
224
+ return i;
487
225
  }
488
226
  // eslint-disable-next-line complexity
489
- constructor(t, e = {}) {
227
+ constructor(t, n = {}) {
490
228
  if (Object.defineProperty(this, "request", {
491
229
  enumerable: !0,
492
230
  configurable: !0,
@@ -515,21 +253,21 @@ class V {
515
253
  }), this._input = t, this._options = {
516
254
  // TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
517
255
  credentials: this._input.credentials || "same-origin",
518
- ...e,
519
- headers: at(this._input.headers, e.headers),
520
- hooks: J({
256
+ ...n,
257
+ headers: Ae(this._input.headers, n.headers),
258
+ hooks: se({
521
259
  beforeRequest: [],
522
260
  beforeRetry: [],
523
261
  beforeError: [],
524
262
  afterResponse: []
525
- }, e.hooks),
526
- method: Lt(e.method ?? this._input.method),
263
+ }, n.hooks),
264
+ method: ke(n.method ?? this._input.method),
527
265
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
528
- prefixUrl: String(e.prefixUrl || ""),
529
- retry: Kt(e.retry),
530
- throwHttpErrors: e.throwHttpErrors !== !1,
531
- timeout: e.timeout ?? 1e4,
532
- fetch: e.fetch ?? globalThis.fetch.bind(globalThis)
266
+ prefixUrl: String(n.prefixUrl || ""),
267
+ retry: Xe(n.retry),
268
+ throwHttpErrors: n.throwHttpErrors !== !1,
269
+ timeout: n.timeout ?? 1e4,
270
+ fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
533
271
  }, typeof this._input != "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request))
534
272
  throw new TypeError("`input` must be a string, URL, or Request");
535
273
  if (this._options.prefixUrl && typeof this._input == "string") {
@@ -537,36 +275,36 @@ class V {
537
275
  throw new Error("`input` must not begin with a slash when using `prefixUrl`");
538
276
  this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
539
277
  }
540
- if (kt) {
278
+ if (Me) {
541
279
  if (this.abortController = new globalThis.AbortController(), this._options.signal) {
542
- const r = this._options.signal;
280
+ const s = this._options.signal;
543
281
  this._options.signal.addEventListener("abort", () => {
544
- this.abortController.abort(r.reason);
282
+ this.abortController.abort(s.reason);
545
283
  });
546
284
  }
547
285
  this._options.signal = this.abortController.signal;
548
286
  }
549
- if (Vt && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
550
- const n = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), i = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, n);
551
- (Nt && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(i, { ...this.request }), this._options);
287
+ if (ve && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
288
+ const s = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), r = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, s);
289
+ (xe && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(r, { ...this.request }), this._options);
552
290
  }
553
291
  this._options.json !== void 0 && (this._options.body = JSON.stringify(this._options.json), this.request.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json"), this.request = new globalThis.Request(this.request, { body: this._options.body }));
554
292
  }
555
293
  _calculateRetryDelay(t) {
556
- if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof ot)) {
557
- if (t instanceof X) {
294
+ if (this._retryCount++, this._retryCount <= this._options.retry.limit && !(t instanceof Te)) {
295
+ if (t instanceof oe) {
558
296
  if (!this._options.retry.statusCodes.includes(t.response.status))
559
297
  return 0;
560
- const r = t.response.headers.get("Retry-After");
561
- if (r && this._options.retry.afterStatusCodes.includes(t.response.status)) {
562
- let n = Number(r);
563
- return Number.isNaN(n) ? n = Date.parse(r) - Date.now() : n *= 1e3, this._options.retry.maxRetryAfter !== void 0 && n > this._options.retry.maxRetryAfter ? 0 : n;
298
+ const s = t.response.headers.get("Retry-After");
299
+ if (s && this._options.retry.afterStatusCodes.includes(t.response.status)) {
300
+ let r = Number(s);
301
+ return Number.isNaN(r) ? r = Date.parse(s) - Date.now() : r *= 1e3, this._options.retry.maxRetryAfter !== void 0 && r > this._options.retry.maxRetryAfter ? 0 : r;
564
302
  }
565
303
  if (t.response.status === 413)
566
304
  return 0;
567
305
  }
568
- const e = this._options.retry.delay(this._retryCount);
569
- return Math.min(this._options.retry.backoffLimit, e);
306
+ const n = this._options.retry.delay(this._retryCount);
307
+ return Math.min(this._options.retry.backoffLimit, n);
570
308
  }
571
309
  return 0;
572
310
  }
@@ -576,62 +314,62 @@ class V {
576
314
  async _retry(t) {
577
315
  try {
578
316
  return await t();
579
- } catch (e) {
580
- const r = Math.min(this._calculateRetryDelay(e), L);
581
- if (r !== 0 && this._retryCount > 0) {
582
- await zt(r, { signal: this._options.signal });
583
- for (const n of this._options.hooks.beforeRetry)
584
- if (await n({
317
+ } catch (n) {
318
+ const s = Math.min(this._calculateRetryDelay(n), K);
319
+ if (s !== 0 && this._retryCount > 0) {
320
+ await Ke(s, { signal: this._options.signal });
321
+ for (const r of this._options.hooks.beforeRetry)
322
+ if (await r({
585
323
  request: this.request,
586
324
  options: this._options,
587
- error: e,
325
+ error: n,
588
326
  retryCount: this._retryCount
589
- }) === ut)
327
+ }) === Se)
590
328
  return;
591
329
  return this._retry(t);
592
330
  }
593
- throw e;
331
+ throw n;
594
332
  }
595
333
  }
596
334
  async _fetch() {
597
- for (const e of this._options.hooks.beforeRequest) {
598
- const r = await e(this.request, this._options);
599
- if (r instanceof Request) {
600
- this.request = r;
335
+ for (const n of this._options.hooks.beforeRequest) {
336
+ const s = await n(this.request, this._options);
337
+ if (s instanceof Request) {
338
+ this.request = s;
601
339
  break;
602
340
  }
603
- if (r instanceof Response)
604
- return r;
341
+ if (s instanceof Response)
342
+ return s;
605
343
  }
606
- const t = Jt(this.request, this._options);
607
- return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Gt(this.request.clone(), t, this.abortController, this._options);
344
+ const t = Je(this.request, this._options);
345
+ return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Ye(this.request.clone(), t, this.abortController, this._options);
608
346
  }
609
347
  /* istanbul ignore next */
610
- _stream(t, e) {
611
- const r = Number(t.headers.get("content-length")) || 0;
612
- let n = 0;
613
- return t.status === 204 ? (e && e({ percent: 1, totalBytes: r, transferredBytes: n }, new Uint8Array()), new globalThis.Response(null, {
348
+ _stream(t, n) {
349
+ const s = Number(t.headers.get("content-length")) || 0;
350
+ let r = 0;
351
+ return t.status === 204 ? (n && n({ percent: 1, totalBytes: s, transferredBytes: r }, new Uint8Array()), new globalThis.Response(null, {
614
352
  status: t.status,
615
353
  statusText: t.statusText,
616
354
  headers: t.headers
617
355
  })) : new globalThis.Response(new globalThis.ReadableStream({
618
356
  async start(i) {
619
- const c = t.body.getReader();
620
- e && e({ percent: 0, transferredBytes: 0, totalBytes: r }, new Uint8Array());
621
- async function a() {
622
- const { done: u, value: l } = await c.read();
623
- if (u) {
357
+ const o = t.body.getReader();
358
+ n && n({ percent: 0, transferredBytes: 0, totalBytes: s }, new Uint8Array());
359
+ async function u() {
360
+ const { done: c, value: _ } = await o.read();
361
+ if (c) {
624
362
  i.close();
625
363
  return;
626
364
  }
627
- if (e) {
628
- n += l.byteLength;
629
- const h = r === 0 ? 0 : n / r;
630
- e({ percent: h, transferredBytes: n, totalBytes: r }, l);
365
+ if (n) {
366
+ r += _.byteLength;
367
+ const h = s === 0 ? 0 : r / s;
368
+ n({ percent: h, transferredBytes: r, totalBytes: s }, _);
631
369
  }
632
- i.enqueue(l), await a();
370
+ i.enqueue(_), await u();
633
371
  }
634
- await a();
372
+ await u();
635
373
  }
636
374
  }), {
637
375
  status: t.status,
@@ -641,288 +379,608 @@ class V {
641
379
  }
642
380
  }
643
381
  /*! MIT License © Sindre Sorhus */
644
- const W = (s) => {
645
- const t = (e, r) => V.create(e, M(s, r));
646
- for (const e of ct)
647
- t[e] = (r, n) => V.create(r, M(s, n, { method: e }));
648
- return t.create = (e) => W(M(e)), t.extend = (e) => W(M(s, e)), t.stop = ut, t;
649
- }, Yt = W(), Qt = Yt, Xt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, tt = Qt.create({ headers: Xt }), Zt = {
650
- get: (s, t) => tt.get(s, t).json(),
651
- post: (s, t) => tt.post(s, t).json()
652
- }, et = [...Object.values(o), "TERRA"];
653
- function te(s = "") {
654
- const t = s.toUpperCase(), [e] = t.split(".");
655
- if (et.includes(e))
382
+ const Q = (e) => {
383
+ const t = (n, s) => F.create(n, $(e, s));
384
+ for (const n of pe)
385
+ t[n] = (s, r) => F.create(s, $(e, r, { method: n }));
386
+ return t.create = (n) => Q($(n)), t.extend = (n) => Q($(e, n)), t.stop = Se, t;
387
+ }, Ee = Q();
388
+ let H;
389
+ const m = {
390
+ CachedPrices: `${R.ThorswapApi}/tokenlist/cached-price`,
391
+ GasRates: `${R.ThorswapApi}/resource-worker/gasPrice/getAll`,
392
+ Quote: `${R.ThorswapApi}/aggregator/tokens/quote`,
393
+ Txn: `${R.ThorswapApi}/apiusage/v2/txn`,
394
+ TokenlistProviders: `${R.ThorswapApi}/tokenlist/providers`,
395
+ TokenList: `${R.ThorswapStatic}/token-list`,
396
+ Thorname: `${R.ThorswapApi}/thorname`
397
+ }, Re = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, ue = () => H || (H = Ee.create({ headers: Re }), H), mt = ({ apiKey: e, ...t }) => {
398
+ H = Ee.create({
399
+ ...t,
400
+ headers: { ...Re, ...t.headers, "x-api-key": e }
401
+ });
402
+ }, S = {
403
+ get: (e, t) => ue().get(e, t).json(),
404
+ post: (e, t) => ue().post(e, t).json()
405
+ }, Qe = ({ tokens: e, ...t }) => {
406
+ const n = new URLSearchParams();
407
+ return e.filter((s, r, i) => i.findIndex((o) => o === s) === r).forEach((s) => n.append("tokens", JSON.stringify(s))), t.metadata && n.append("metadata", "true"), t.lookup && n.append("lookup", "true"), t.sparkline && n.append("sparkline", "true"), S.post(m.CachedPrices, {
408
+ body: n.toString(),
409
+ headers: { "Content-Type": "application/x-www-form-urlencoded" }
410
+ });
411
+ }, Et = {
412
+ getCachedPrices: Qe,
413
+ getQuote: (e) => S.get(m.Quote, { searchParams: e }),
414
+ getGasRates: () => S.get(m.GasRates),
415
+ getTxnDetails: (e) => S.get(m.Txn, { searchParams: e }),
416
+ getTokenlistProviders: () => S.get(m.TokenlistProviders),
417
+ getTokenList: (e) => S.get(`${m.TokenList}/${e}.json`),
418
+ getThornameAddresses: (e) => S.get(`${m.Thorname}/${e}`),
419
+ getThornameRegisteredChains: (e) => S.get(`${m.Thorname}/chains/${e}`),
420
+ getThornameRlookup: (e, t) => S.get(`${m.Thorname}/rlookup`, { searchParams: { address: e, chain: t } })
421
+ };
422
+ var ze = /* @__PURE__ */ ((e) => (e.SWAP_TC_TO_TC = "SWAP:TC-TC", e.SWAP_ETH_TO_TC = "SWAP:ERC20-TC", e.SWAP_TC_TO_ETH = "SWAP:TC-ERC20", e.SWAP_ETH_TO_ETH = "SWAP:ERC20-ERC20", e.SWAP_AVAX_TO_TC = "SWAP:AVAX-TC", e.SWAP_TC_TO_AVAX = "SWAP:TC-AVAX", e.SWAP_AVAX_TO_AVAX = "SWAP:AVAX-AVAX", e.SWAP_ETH_TO_AVAX = "SWAP:ETH-AVAX", e.SWAP_AVAX_TO_ETH = "SWAP:AVAX-ETH", e.SWAP_TC_TO_GAIA = "SWAP:TC-GAIA", e.SWAP_GAIA_TO_TC = "SWAP:GAIA-TC", e.SWAP_TC_TO_BNB = "SWAP:TC-BNB", e.SWAP_BNB_TO_TC = "SWAP:BNB-TC", e.SWAP_TC_TO_BTC = "SWAP:TC-BTC", e.SWAP_BTC_TO_TC = "SWAP:BTC-TC", e.SWAP_TC_TO_BCH = "SWAP:TC-BCH", e.SWAP_BCH_TO_TC = "SWAP:BCH-TC", e.SWAP_TC_TO_LTC = "SWAP:TC-LTC", e.SWAP_LTC_TO_TC = "SWAP:LTC-TC", e.SWAP_TC_TO_DOGE = "SWAP:TC-DOGE", e.SWAP_DOGE_TO_TC = "SWAP:DOGE-TC", e.TC_STATUS = "TC:STATUS", e.TC_TRANSFER = "TC:TRANSFER", e.TC_DEPOSIT = "TC:DEPOSIT", e.TC_SEND = "TC:SEND", e.TC_SWITCH = "TC:SWITCH", e.TC_LP_ADD = "TC:ADDLIQUIDITY", e.TC_LP_WITHDRAW = "TC:WITHDRAW", e.TC_TNS_CREATE = "TC:TNS-CREATE", e.TC_TNS_EXTEND = "TC:TNS-EXTEND", e.TC_TNS_UPDATE = "TC:TNS-UPDATE", e.TC_SAVINGS_ADD = "TC:ADDSAVINGS", e.TC_SAVINGS_WITHDRAW = "TC:WITHDRAWSAVINGS", e.TC_LENDING_OPEN = "TC:LENDINGOPEN", e.TC_LENDING_CLOSE = "TC:LENDINGCLOSE", e.ETH_APPROVAL = "ETH:APPROVAL", e.ETH_STATUS = "ETH:STATUS", e.ETH_TRANSFER_TO_TC = "ETH:TRANSFER:IN", e.ETH_TRANSFER_FROM_TC = "ETH:TRANSFER:OUT", e.AVAX_APPROVAL = "AVAX:APPROVAL", e.AVAX_STATUS = "AVAX:STATUS", e.AVAX_TRANSFER_TO_TC = "AVAX:TRANSFER:IN", e.AVAX_TRANSFER_FROM_TC = "AVAX:TRANSFER:OUT", e.BSC_APPROVAL = "BSC:APPROVAL", e.BSC_STATUS = "BSC:STATUS", e.BSC_TRANSFER_TO_TC = "BSC:TRANSFER:IN", e.BSC_TRANSFER_FROM_TC = "BSC:TRANSFER:OUT", e.APPROVAL = "APPROVAL", e.STATUS = "STATUS", e.TRANSFER_TO_TC = "TRANSFER:IN", e.TRANSFER_FROM_TC = "TRANSFER:OUT", e.UNSUPPORTED = "UNSUPPORTED", e.TC_LENDING = "TC:LENDING", e))(ze || {}), Ze = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.SUCCESS = "success", e.CANCELLED = "cancelled", e.REFUNDED = "refunded", e.REPLACED = "replaced", e.ERROR = "error", e.UNKNOWN = "unknown", e.NOT_STARTED = "not_started", e.NOT_FOUND = "not_found", e.RETRIES_EXCEEDED = "retries_exceeded", e.STREAMING = "streaming", e))(Ze || {}), et = /* @__PURE__ */ ((e) => (e[e.NOT_STARTED = 0] = "NOT_STARTED", e[e.SUCCESS = 1] = "SUCCESS", e[e.REFUNDED = 2] = "REFUNDED", e))(et || {});
423
+ const tt = "0x313ce567", Ie = async ({ chain: e, to: t }) => {
424
+ try {
425
+ const { result: n } = await S.post(Ue[e], {
426
+ headers: {
427
+ accept: "*/*",
428
+ "content-type": "application/json",
429
+ "cache-control": "no-cache"
430
+ },
431
+ body: JSON.stringify({
432
+ id: 44,
433
+ jsonrpc: "2.0",
434
+ method: "eth_call",
435
+ params: [{ to: t.toLowerCase(), data: tt }, "latest"]
436
+ })
437
+ });
438
+ return parseInt(BigInt(n).toString());
439
+ } catch (n) {
440
+ return console.error(n), d[e];
441
+ }
442
+ }, nt = async (e) => {
443
+ if (e === a.Ethereum)
444
+ return d.ETH;
445
+ const [, t] = e.split("-");
446
+ return t != null && t.startsWith("0x") ? Ie({ chain: a.Ethereum, to: t }) : d.ETH;
447
+ }, st = async (e) => {
448
+ const [, t] = e.split("-");
449
+ return t != null && t.startsWith("0x") ? Ie({ chain: a.Avalanche, to: t.toLowerCase() }) : d.AVAX;
450
+ }, rt = async (e) => e === a.BinanceSmartChain ? d.BSC : d.BSC, it = async ({ chain: e, symbol: t }) => {
451
+ switch (e) {
452
+ case a.Ethereum:
453
+ return nt(t);
454
+ case a.Avalanche:
455
+ return st(t);
456
+ case a.BinanceSmartChain:
457
+ return rt(t);
458
+ default:
459
+ return d[e];
460
+ }
461
+ }, Rt = {
462
+ [Y.Average]: 1.2,
463
+ [Y.Fast]: 1.5,
464
+ [Y.Fastest]: 2
465
+ }, fe = ({ chain: e, symbol: t }) => {
466
+ switch (e) {
467
+ case a.Bitcoin:
468
+ case a.BitcoinCash:
469
+ case a.Litecoin:
470
+ case a.Dogecoin:
471
+ case a.Binance:
472
+ case a.Ethereum:
473
+ case a.Avalanche:
474
+ return t === e;
475
+ case a.Arbitrum:
476
+ case a.Optimism:
477
+ return t === "ETH";
478
+ case a.Maya:
479
+ return t === "CACAO";
480
+ case a.Kujira:
481
+ return t === "KUJI";
482
+ case a.Cosmos:
483
+ return t === "ATOM";
484
+ case a.Polygon:
485
+ return t === "MATIC";
486
+ case a.BinanceSmartChain:
487
+ return t === "BNB";
488
+ case a.THORChain:
489
+ return t === "RUNE";
490
+ }
491
+ }, at = (e) => {
492
+ switch (e) {
493
+ case `${a.Ethereum}.THOR`:
494
+ return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
495
+ case `${a.Ethereum}.vTHOR`:
496
+ return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
497
+ case a.Cosmos:
498
+ return { identifier: "GAIA.ATOM", decimal: d[e] };
499
+ case a.THORChain:
500
+ return { identifier: "THOR.RUNE", decimal: d[e] };
501
+ case a.BinanceSmartChain:
502
+ return { identifier: "BSC.BNB", decimal: d[e] };
503
+ case a.Maya:
504
+ return { identifier: "MAYA.CACAO", decimal: d.MAYA };
505
+ case `${a.Maya}.MAYA`:
506
+ return { identifier: "MAYA.MAYA", decimal: 4 };
507
+ case `${a.Kujira}.USK`:
508
+ return { identifier: `${a.Kujira}.USK`, decimal: 6 };
509
+ case a.Kujira:
510
+ case a.Arbitrum:
511
+ case a.Optimism:
512
+ case a.BitcoinCash:
513
+ case a.Litecoin:
514
+ case a.Dogecoin:
515
+ case a.Binance:
516
+ case a.Avalanche:
517
+ case a.Polygon:
518
+ case a.Bitcoin:
519
+ case a.Ethereum:
520
+ return { identifier: `${e}.${e}`, decimal: d[e] };
521
+ }
522
+ }, ot = ({ chain: e, symbol: t }) => {
523
+ if (t.includes("/"))
524
+ return "Synth";
525
+ switch (e) {
526
+ case a.Bitcoin:
527
+ case a.BitcoinCash:
528
+ case a.Dogecoin:
529
+ case a.Litecoin:
530
+ case a.Maya:
531
+ case a.THORChain:
532
+ return "Native";
533
+ case a.Cosmos:
534
+ return t === "ATOM" ? "Native" : a.Cosmos;
535
+ case a.Kujira:
536
+ return t === a.Kujira ? "Native" : a.Kujira;
537
+ case a.Binance:
538
+ return t === a.Binance ? "Native" : "BEP2";
539
+ case a.BinanceSmartChain:
540
+ return t === a.Binance ? "Native" : "BEP20";
541
+ case a.Ethereum:
542
+ return t === a.Ethereum ? "Native" : "ERC20";
543
+ case a.Avalanche:
544
+ return t === a.Avalanche ? "Native" : a.Avalanche;
545
+ case a.Polygon:
546
+ return t === a.Polygon ? "Native" : "POLYGON";
547
+ case a.Arbitrum:
548
+ return [a.Ethereum, a.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
549
+ case a.Optimism:
550
+ return [a.Ethereum, a.Optimism].includes(t) ? "Native" : "OPTIMISM";
551
+ }
552
+ }, It = (e) => {
553
+ var o;
554
+ const [t, ...n] = e.split("."), s = e.includes("/"), r = n.join("."), i = (o = r == null ? void 0 : r.split("-")) == null ? void 0 : o[0];
555
+ return { chain: t, symbol: r, ticker: i, synth: s };
556
+ }, ct = new RegExp(
557
+ /(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
558
+ "gmi"
559
+ ), ut = (e) => {
560
+ const [t, n] = e.split(".");
561
+ if (!Be.includes(t))
656
562
  return !0;
657
- const [r] = t.split("/");
658
- if (et.includes(r))
563
+ const [, s] = n.split("-");
564
+ return fe({ chain: t, symbol: n }) || !!s;
565
+ }, ft = (e) => e.filter((t) => {
566
+ const n = `${t.chain}.${t.symbol}`;
567
+ return !ct.test(n) && ut(n) && t.value !== "0";
568
+ });
569
+ function lt({
570
+ liquidityUnits: e,
571
+ poolUnits: t,
572
+ runeDepth: n
573
+ }) {
574
+ const s = A(e), r = A(t), i = A(n), o = s.mul(i), u = r.mul(r).mul(2), c = r.mul(s).mul(2), _ = s.mul(s), h = r.mul(r).mul(r);
575
+ return o.mul(u.sub(c).add(_)).div(h);
576
+ }
577
+ function _t({
578
+ liquidityUnits: e,
579
+ poolUnits: t,
580
+ assetDepth: n
581
+ }) {
582
+ const s = A(e), r = A(t), i = A(n), o = s.mul(i), u = r.mul(r).mul(2), c = r.mul(s).mul(2), _ = s.mul(s), h = o.mul(u.sub(c).add(_)), P = r.mul(r).mul(r);
583
+ return h.div(P);
584
+ }
585
+ function Nt({
586
+ percent: e,
587
+ runeDepth: t,
588
+ liquidityUnits: n,
589
+ poolUnits: s
590
+ }) {
591
+ return lt({ runeDepth: t, liquidityUnits: n, poolUnits: s }).mul(e);
592
+ }
593
+ function Ct({
594
+ percent: e,
595
+ assetDepth: t,
596
+ liquidityUnits: n,
597
+ poolUnits: s
598
+ }) {
599
+ return _t({ assetDepth: t, liquidityUnits: n, poolUnits: s }).mul(e);
600
+ }
601
+ function A(e) {
602
+ return I.fromBigInt(BigInt(e), d.THOR);
603
+ }
604
+ function ht({
605
+ liquidityUnits: e,
606
+ poolUnits: t,
607
+ runeDepth: n,
608
+ assetDepth: s
609
+ }) {
610
+ return {
611
+ assetAmount: A(s).mul(e).div(t),
612
+ runeAmount: A(n).mul(e).div(t)
613
+ };
614
+ }
615
+ function gt({
616
+ liquidityUnits: e,
617
+ poolUnits: t,
618
+ runeDepth: n,
619
+ assetDepth: s,
620
+ percent: r
621
+ }) {
622
+ return Object.fromEntries(
623
+ Object.entries(ht({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: s })).map(
624
+ ([i, o]) => [i, o.mul(r)]
625
+ )
626
+ );
627
+ }
628
+ function Ot({
629
+ runeDepth: e,
630
+ poolUnits: t,
631
+ assetDepth: n,
632
+ liquidityUnits: s,
633
+ runeAmount: r,
634
+ assetAmount: i
635
+ }) {
636
+ const o = new I({ value: e, decimal: 8 }), u = new I({ value: n, decimal: 8 }), c = new I({ value: t, decimal: 8 }), _ = new I({ value: r, decimal: 8 }), h = new I({ value: i, decimal: 8 }), P = _.mul(u), ie = h.mul(o), ge = _.mul(h), Oe = o.mul(u), De = c.mul(P.add(ie.add(ge.mul(2)))), Pe = P.add(ie.add(Oe.mul(2))), ae = De.div(Pe), X = A(s).add(ae);
637
+ if (ae.getBaseValue("number") === 0)
638
+ return X.div(c).getBaseValue("number");
639
+ const be = c.add(X);
640
+ return X.div(be).getBaseValue("number");
641
+ }
642
+ function Dt({
643
+ runeAmount: e,
644
+ assetAmount: t,
645
+ runeDepth: n,
646
+ assetDepth: s
647
+ }) {
648
+ if (e === "0" || t === "0" || n === "0" || s === "0")
649
+ return 0;
650
+ const r = A(n), i = A(s), o = A(t), u = A(e), c = o.mul(r).sub(i.mul(u)), _ = i.mul(u).add(r.mul(i));
651
+ return Math.abs(c.div(_).getBaseValue("number"));
652
+ }
653
+ const Pt = (e, t) => {
654
+ switch (e) {
655
+ case E.LEAVE:
656
+ case E.BOND: {
657
+ const { address: n } = t;
658
+ return `${e}:${n}`;
659
+ }
660
+ case E.UNBOND: {
661
+ const { address: n, unbondAmount: s } = t;
662
+ return `${e}:${n}:${s}`;
663
+ }
664
+ case E.THORNAME_REGISTER: {
665
+ const { name: n, chain: s, address: r, owner: i } = t;
666
+ return `${e}:${n}:${s}:${r}${i ? `:${i}` : ""}`;
667
+ }
668
+ case E.DEPOSIT: {
669
+ const { chain: n, symbol: s, address: r, singleSide: i } = t;
670
+ return i ? `${e}:${n}/${s}::t:0` : `${e}:${((u, c) => {
671
+ switch (u) {
672
+ case a.Litecoin:
673
+ return "l";
674
+ case a.Dogecoin:
675
+ return "d";
676
+ case a.BitcoinCash:
677
+ return "c";
678
+ default:
679
+ return `${u}.${c}`;
680
+ }
681
+ })(n, s)}:${r || ""}:t:0`;
682
+ }
683
+ case E.WITHDRAW: {
684
+ const { chain: n, ticker: s, symbol: r, basisPoints: i, targetAssetString: o, singleSide: u } = t, c = n === "ETH" && s !== "ETH" ? `${s}-${r.slice(-3)}` : r, _ = !u && o ? `:${o}` : "";
685
+ return `${e}:${n}${u ? "/" : "."}${c}:${i}${_}`;
686
+ }
687
+ case E.OPEN_LOAN:
688
+ case E.CLOSE_LOAN: {
689
+ const { asset: n, address: s } = t;
690
+ return `${e}:${n}:${s}`;
691
+ }
692
+ default:
693
+ return "";
694
+ }
695
+ };
696
+ function bt(e) {
697
+ if (e < 0)
698
+ throw new Error("Invalid number of year");
699
+ return 10 + e;
700
+ }
701
+ function yt(e) {
702
+ if (e.length > 30)
703
+ return !1;
704
+ const t = /^[a-zA-Z0-9+_-]+$/g;
705
+ return !!e.match(t);
706
+ }
707
+ function wt([e, t, n, s, r]) {
708
+ return `${e}'/${t}'/${n}'/${s}${typeof r != "number" ? "" : `/${r}`}`;
709
+ }
710
+ const le = [...Object.values(a), "TERRA"];
711
+ function dt(e = "") {
712
+ const t = e.toUpperCase(), [n] = t.split(".");
713
+ if (le.includes(n))
714
+ return !0;
715
+ const [s] = t.split("/");
716
+ if (le.includes(s))
659
717
  return !0;
660
718
  throw new Error(
661
- `Invalid identifier: ${s}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
719
+ `Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
662
720
  );
663
721
  }
664
- const O = 8, y = (s) => 10n ** BigInt(s), C = (s) => Math.log10(parseFloat(s.toString()));
665
- function k({
666
- value: s,
667
- bigIntDecimal: t = O,
668
- decimal: e = O
722
+ const B = 8, N = (e) => 10n ** BigInt(e), b = (e) => Math.log10(parseFloat(e.toString()));
723
+ function G({
724
+ value: e,
725
+ bigIntDecimal: t = B,
726
+ decimal: n = B
669
727
  }) {
670
- if (e === 0)
671
- return s.toString();
672
- const r = s < 0n;
673
- let n = s.toString().substring(r ? 1 : 0);
674
- const i = e - (n.length - 1);
675
- i > 0 && (n = "0".repeat(i) + n);
676
- const c = n.length - e;
677
- let a = n.slice(-e);
678
- return parseInt(a[t]) >= 5 ? a = `${a.substring(0, t - 1)}${(parseInt(a[t - 1]) + 1).toString()}` : a = a.substring(0, t), `${r ? "-" : ""}${n.slice(0, c)}.${a}`.replace(
728
+ if (n === 0)
729
+ return e.toString();
730
+ const s = e < 0n;
731
+ let r = e.toString().substring(s ? 1 : 0);
732
+ const i = n - (r.length - 1);
733
+ i > 0 && (r = "0".repeat(i) + r);
734
+ const o = r.length - n;
735
+ let u = r.slice(-n);
736
+ return parseInt(u[t]) >= 5 ? u = `${u.substring(0, t - 1)}${(parseInt(u[t - 1]) + 1).toString()}` : u = u.substring(0, t), `${s ? "-" : ""}${r.slice(0, o)}.${u}`.replace(
679
737
  /\.?0*$/,
680
738
  ""
681
739
  );
682
740
  }
683
- var w, R, b, T, N, ht, E, K, B, G;
684
- const Y = class Y {
741
+ var C, y, f, D, k, Ne, U, z, L, Z;
742
+ const re = class re {
685
743
  constructor(t) {
686
- v(this, w);
687
- v(this, b);
688
- v(this, N);
689
- v(this, E);
690
- v(this, B);
691
- f(this, "decimalMultiplier", 10n ** 8n);
692
- f(this, "bigIntValue", 0n);
693
- f(this, "decimal");
694
- const e = z(t), r = typeof t == "object";
695
- this.decimal = r ? t.decimal : void 0, this.decimalMultiplier = r && "decimalMultiplier" in t ? t.decimalMultiplier : y(Math.max(rt(x(e)), this.decimal || 0)), m(this, N, ht).call(this, e);
744
+ O(this, C);
745
+ O(this, f);
746
+ O(this, k);
747
+ O(this, U);
748
+ O(this, L);
749
+ p(this, "decimalMultiplier", 10n ** 8n);
750
+ p(this, "bigIntValue", 0n);
751
+ p(this, "decimal");
752
+ const n = ee(t), s = typeof t == "object";
753
+ this.decimal = s ? t.decimal : void 0, this.decimalMultiplier = s && "decimalMultiplier" in t ? t.decimalMultiplier : N(Math.max(_e(v(n)), this.decimal || 0)), T(this, k, Ne).call(this, n);
696
754
  }
697
- static fromBigInt(t, e) {
698
- return new Y({
699
- decimal: e,
700
- value: k({ value: t, bigIntDecimal: e, decimal: e })
755
+ static fromBigInt(t, n) {
756
+ return new re({
757
+ decimal: n,
758
+ value: G({ value: t, bigIntDecimal: n, decimal: n })
701
759
  });
702
760
  }
703
761
  static shiftDecimals({
704
762
  value: t,
705
- from: e,
706
- to: r
763
+ from: n,
764
+ to: s
707
765
  }) {
708
766
  return this.fromBigInt(
709
- t.getBaseValue("bigint") * y(r) / y(e),
710
- r
767
+ t.getBaseValue("bigint") * N(s) / N(n),
768
+ s
711
769
  );
712
770
  }
713
771
  set(t) {
714
772
  return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
715
773
  }
716
774
  add(...t) {
717
- return m(this, w, R).call(this, "add", ...t);
775
+ return T(this, C, y).call(this, "add", ...t);
718
776
  }
719
777
  sub(...t) {
720
- return m(this, w, R).call(this, "sub", ...t);
778
+ return T(this, C, y).call(this, "sub", ...t);
721
779
  }
722
780
  mul(...t) {
723
- return m(this, w, R).call(this, "mul", ...t);
781
+ return T(this, C, y).call(this, "mul", ...t);
724
782
  }
725
783
  div(...t) {
726
- return m(this, w, R).call(this, "div", ...t);
784
+ return T(this, C, y).call(this, "div", ...t);
727
785
  }
728
786
  gt(t) {
729
- return m(this, b, T).call(this, "gt", t);
787
+ return T(this, f, D).call(this, "gt", t);
730
788
  }
731
789
  gte(t) {
732
- return m(this, b, T).call(this, "gte", t);
790
+ return T(this, f, D).call(this, "gte", t);
733
791
  }
734
792
  lt(t) {
735
- return m(this, b, T).call(this, "lt", t);
793
+ return T(this, f, D).call(this, "lt", t);
736
794
  }
737
795
  lte(t) {
738
- return m(this, b, T).call(this, "lte", t);
796
+ return T(this, f, D).call(this, "lte", t);
739
797
  }
740
798
  eqValue(t) {
741
- return m(this, b, T).call(this, "eqValue", t);
799
+ return T(this, f, D).call(this, "eqValue", t);
742
800
  }
743
801
  // @ts-expect-error False positive
744
802
  getValue(t) {
745
- const e = this.formatBigIntToSafeValue(
803
+ const n = this.formatBigIntToSafeValue(
746
804
  this.bigIntValue,
747
- this.decimal || C(this.decimalMultiplier)
805
+ this.decimal || b(this.decimalMultiplier)
748
806
  );
749
807
  switch (t) {
750
808
  case "number":
751
- return Number(e);
809
+ return Number(n);
752
810
  case "string":
753
- return e;
811
+ return n;
754
812
  case "bigint":
755
813
  return this.bigIntValue * 10n ** BigInt(this.decimal || 8n) / this.decimalMultiplier;
756
814
  }
757
815
  }
758
816
  // @ts-expect-error
759
817
  getBaseValue(t) {
760
- const e = this.decimalMultiplier / y(this.decimal || d.THOR), r = this.bigIntValue / e;
818
+ const n = this.decimalMultiplier / N(this.decimal || d.THOR), s = this.bigIntValue / n;
761
819
  switch (t) {
762
820
  case "number":
763
- return Number(r);
821
+ return Number(s);
764
822
  case "string":
765
- return r.toString();
823
+ return s.toString();
766
824
  case "bigint":
767
- return r;
825
+ return s;
768
826
  }
769
827
  }
770
- getBigIntValue(t, e) {
771
- if (!e && typeof t == "object")
828
+ getBigIntValue(t, n) {
829
+ if (!n && typeof t == "object")
772
830
  return t.bigIntValue;
773
- const r = z(t), n = x(r);
774
- return n === "0" || n === "undefined" ? 0n : m(this, B, G).call(this, n, e);
831
+ const s = ee(t), r = v(s);
832
+ return r === "0" || r === "undefined" ? 0n : T(this, L, Z).call(this, r, n);
775
833
  }
776
834
  toSignificant(t = 6) {
777
- const [e, r] = this.getValue("string").split("."), n = e || "", i = r || "";
778
- if ((parseInt(n) ? n.length + i.length : i.length) <= t)
835
+ const [n, s] = this.getValue("string").split("."), r = n || "", i = s || "";
836
+ if ((parseInt(r) ? r.length + i.length : i.length) <= t)
779
837
  return this.getValue("string");
780
- if (n.length >= t)
781
- return n.slice(0, t).padEnd(n.length, "0");
782
- if (parseInt(n))
783
- return `${n}.${i.slice(0, t - n.length)}`.padEnd(
784
- t - n.length,
838
+ if (r.length >= t)
839
+ return r.slice(0, t).padEnd(r.length, "0");
840
+ if (parseInt(r))
841
+ return `${r}.${i.slice(0, t - r.length)}`.padEnd(
842
+ t - r.length,
785
843
  "0"
786
844
  );
787
- const a = parseInt(i), u = `${a}`.slice(0, t);
788
- return `0.${u.padStart(
789
- i.length - `${a}`.length + u.length,
845
+ const u = parseInt(i), c = `${u}`.slice(0, t);
846
+ return `0.${c.padStart(
847
+ i.length - `${u}`.length + c.length,
790
848
  "0"
791
849
  )}`;
792
850
  }
793
851
  toFixed(t = 6) {
794
- const [e, r] = this.getValue("string").split("."), n = e || "", i = r || "";
795
- if (parseInt(n))
796
- return `${n}.${i.slice(0, t)}`.padEnd(t, "0");
797
- const c = parseInt(i), a = `${c}`.slice(0, t);
798
- return `0.${a.padStart(
799
- i.length - `${c}`.length + a.length,
852
+ const [n, s] = this.getValue("string").split("."), r = n || "", i = s || "";
853
+ if (parseInt(r))
854
+ return `${r}.${i.slice(0, t)}`.padEnd(t, "0");
855
+ const o = parseInt(i), u = `${o}`.slice(0, t);
856
+ return `0.${u.padStart(
857
+ i.length - `${o}`.length + u.length,
800
858
  "0"
801
859
  )}`;
802
860
  }
803
861
  toAbbreviation(t = 2) {
804
- const e = this.getValue("number"), r = ["", "K", "M", "B", "T", "Q", "Qi", "S"], n = Math.floor(Math.log10(Math.abs(e)) / 3), i = r[n];
862
+ const n = this.getValue("number"), s = ["", "K", "M", "B", "T", "Q", "Qi", "S"], r = Math.floor(Math.log10(Math.abs(n)) / 3), i = s[r];
805
863
  if (!i)
806
864
  return this.getValue("string");
807
- const c = 10 ** (n * 3);
808
- return `${(e / c).toFixed(t)}${i}`;
865
+ const o = 10 ** (r * 3);
866
+ return `${(n / o).toFixed(t)}${i}`;
809
867
  }
810
868
  toCurrency(t = "$", {
811
- currencyPosition: e = "start",
812
- decimal: r = 2,
813
- decimalSeparator: n = ".",
869
+ currencyPosition: n = "start",
870
+ decimal: s = 2,
871
+ decimalSeparator: r = ".",
814
872
  thousandSeparator: i = ","
815
873
  } = {}) {
816
- const c = this.getValue("number"), [a, u = ""] = c.toFixed(6).split("."), l = a.replace(/\B(?=(\d{3})+(?!\d))/g, i), h = !a && !u ? "0.00" : a === "0" ? `${parseFloat(`0.${u}`)}`.replace(".", n) : `${l}${parseInt(u) ? `${n}${u.slice(0, r)}` : ""}`;
817
- return `${e === "start" ? t : ""}${h}${e === "end" ? t : ""}`;
874
+ const o = this.getValue("number"), [u, c = ""] = o.toFixed(6).split("."), _ = u.replace(/\B(?=(\d{3})+(?!\d))/g, i), h = !u && !c ? "0.00" : u === "0" ? `${parseFloat(`0.${c}`)}`.replace(".", r) : `${_}${parseInt(c) ? `${r}${c.slice(0, s)}` : ""}`;
875
+ return `${n === "start" ? t : ""}${h}${n === "end" ? t : ""}`;
818
876
  }
819
- formatBigIntToSafeValue(t, e) {
820
- const r = e || this.decimal || O, n = Math.max(
821
- r,
822
- C(this.decimalMultiplier)
823
- ), i = t < 0n, c = t.toString().substring(i ? 1 : 0), a = n - (c.length - 1), u = a > 0 ? "0".repeat(a) + c : c, l = u.length - n;
824
- let h = u.slice(-n);
825
- return parseInt(h[r]) >= 5 ? h = `${h.substring(0, r - 1)}${(parseInt(h[r - 1]) + 1).toString()}` : h = h.substring(0, r), `${i ? "-" : ""}${u.slice(
877
+ formatBigIntToSafeValue(t, n) {
878
+ const s = n || this.decimal || B, r = Math.max(
879
+ s,
880
+ b(this.decimalMultiplier)
881
+ ), i = t < 0n, o = t.toString().substring(i ? 1 : 0), u = r - (o.length - 1), c = u > 0 ? "0".repeat(u) + o : o, _ = c.length - r;
882
+ let h = c.slice(-r);
883
+ return parseInt(h[s]) >= 5 ? h = `${h.substring(0, s - 1)}${(parseInt(h[s - 1]) + 1).toString()}` : h = h.substring(0, s), `${i ? "-" : ""}${c.slice(
826
884
  0,
827
- l
885
+ _
828
886
  )}.${h}`.replace(/\.?0*$/, "");
829
887
  }
830
888
  };
831
- w = new WeakSet(), R = function(t, ...e) {
832
- const r = m(this, E, K).call(this, this, ...e), n = Math.max(r, C(this.decimalMultiplier)), i = y(n), c = e.reduce(
833
- (u, l) => {
834
- const h = this.getBigIntValue(l, n);
889
+ C = new WeakSet(), y = function(t, ...n) {
890
+ const s = T(this, U, z).call(this, this, ...n), r = Math.max(s, b(this.decimalMultiplier)), i = N(r), o = n.reduce(
891
+ (c, _) => {
892
+ const h = this.getBigIntValue(_, r);
835
893
  switch (t) {
836
894
  case "add":
837
- return u + h;
895
+ return c + h;
838
896
  case "sub":
839
- return u - h;
897
+ return c - h;
840
898
  case "mul":
841
- return u * h / i;
899
+ return c * h / i;
842
900
  case "div": {
843
901
  if (h === 0n)
844
902
  throw new RangeError("Division by zero");
845
- return u * i / h;
903
+ return c * i / h;
846
904
  }
847
905
  default:
848
- return u;
906
+ return c;
849
907
  }
850
908
  },
851
909
  //normalize is to precision multiplier base
852
910
  this.bigIntValue * i / this.decimalMultiplier
853
- ), a = k({
854
- bigIntDecimal: n,
855
- decimal: n,
856
- value: c
911
+ ), u = G({
912
+ bigIntDecimal: r,
913
+ decimal: r,
914
+ value: o
857
915
  });
858
916
  return new this.constructor({
859
- decimalMultiplier: y(n),
917
+ decimalMultiplier: N(r),
860
918
  decimal: this.decimal,
861
- value: a,
919
+ value: u,
862
920
  identifier: this.toString()
863
921
  });
864
- }, b = new WeakSet(), T = function(t, ...e) {
865
- const r = m(this, E, K).call(this, this, ...e), n = this.getBigIntValue(e[0], r), i = this.getBigIntValue(this, r);
922
+ }, f = new WeakSet(), D = function(t, ...n) {
923
+ const s = T(this, U, z).call(this, this, ...n), r = this.getBigIntValue(n[0], s), i = this.getBigIntValue(this, s);
866
924
  switch (t) {
867
925
  case "gt":
868
- return i > n;
926
+ return i > r;
869
927
  case "gte":
870
- return i >= n;
928
+ return i >= r;
871
929
  case "lt":
872
- return i < n;
930
+ return i < r;
873
931
  case "lte":
874
- return i <= n;
932
+ return i <= r;
875
933
  case "eqValue":
876
- return i === n;
934
+ return i === r;
877
935
  }
878
- }, N = new WeakSet(), ht = function(t) {
879
- const e = x(t) || "0";
880
- this.bigIntValue = m(this, B, G).call(this, e);
881
- }, E = new WeakSet(), K = function(...t) {
882
- const e = t.map((r) => typeof r == "object" ? r.decimal || C(r.decimalMultiplier) : rt(x(r))).filter(Boolean);
883
- return Math.max(...e, O);
884
- }, B = new WeakSet(), G = function(t, e) {
885
- const r = e ? y(e) : this.decimalMultiplier, n = C(r), [i = "", c = ""] = t.split(".");
886
- return BigInt(`${i}${c.padEnd(n, "0")}`);
936
+ }, k = new WeakSet(), Ne = function(t) {
937
+ const n = v(t) || "0";
938
+ this.bigIntValue = T(this, L, Z).call(this, n);
939
+ }, U = new WeakSet(), z = function(...t) {
940
+ const n = t.map((s) => typeof s == "object" ? s.decimal || b(s.decimalMultiplier) : _e(v(s))).filter(Boolean);
941
+ return Math.max(...n, B);
942
+ }, L = new WeakSet(), Z = function(t, n) {
943
+ const s = n ? N(n) : this.decimalMultiplier, r = b(s), [i = "", o = ""] = t.split(".");
944
+ return BigInt(`${i}${o.padEnd(r, "0")}`);
887
945
  };
888
- let j = Y;
889
- const ee = Intl.NumberFormat("fullwide", {
946
+ let W = re;
947
+ const Tt = Intl.NumberFormat("fullwide", {
890
948
  useGrouping: !1,
891
949
  maximumFractionDigits: 20
892
950
  });
893
- function x(s) {
894
- const e = `${typeof s == "number" ? ee.format(s) : z(s)}`.replaceAll(",", ".").split(".");
895
- return e.length > 1 ? `${e.slice(0, -1).join("")}.${e.at(-1)}` : e[0];
951
+ function v(e) {
952
+ const n = `${typeof e == "number" ? Tt.format(e) : ee(e)}`.replaceAll(",", ".").split(".");
953
+ return n.length > 1 ? `${n.slice(0, -1).join("")}.${n.at(-1)}` : n[0];
896
954
  }
897
- function rt(s) {
898
- var e;
899
- const t = ((e = s.split(".")[1]) == null ? void 0 : e.length) || 0;
900
- return Math.max(t, O);
955
+ function _e(e) {
956
+ var n;
957
+ const t = ((n = e.split(".")[1]) == null ? void 0 : n.length) || 0;
958
+ return Math.max(t, B);
901
959
  }
902
- function z(s) {
903
- return typeof s == "object" ? "getValue" in s ? s.getValue("string") : s.value : s;
960
+ function ee(e) {
961
+ return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
904
962
  }
905
- const S = /* @__PURE__ */ new Map();
906
- class A extends j {
963
+ const w = /* @__PURE__ */ new Map();
964
+ class g extends W {
907
965
  constructor({
908
- value: e,
909
- decimal: r,
910
- tax: n,
966
+ value: n,
967
+ decimal: s,
968
+ tax: r,
911
969
  chain: i,
912
- symbol: c,
913
- identifier: a
970
+ symbol: o,
971
+ identifier: u
914
972
  }) {
915
- super(typeof e == "object" ? e : { decimal: r, value: e });
916
- f(this, "address");
917
- f(this, "chain");
918
- f(this, "isGasAsset", !1);
919
- f(this, "isSynthetic", !1);
920
- f(this, "symbol");
921
- f(this, "tax");
922
- f(this, "ticker");
923
- f(this, "type");
924
- const u = P(a || `${i}.${c}`);
925
- this.type = Et(u), this.tax = n, this.chain = u.chain, this.ticker = u.ticker, this.symbol = u.symbol, this.address = u.address, this.isSynthetic = u.isSynthetic, this.isGasAsset = u.isGasAsset;
973
+ super(typeof n == "object" ? n : { decimal: s, value: n });
974
+ p(this, "address");
975
+ p(this, "chain");
976
+ p(this, "isGasAsset", !1);
977
+ p(this, "isSynthetic", !1);
978
+ p(this, "symbol");
979
+ p(this, "tax");
980
+ p(this, "ticker");
981
+ p(this, "type");
982
+ const c = x(u || `${i}.${o}`);
983
+ this.type = ot(c), this.tax = r, this.chain = c.chain, this.ticker = c.ticker, this.symbol = c.symbol, this.address = c.address, this.isSynthetic = c.isSynthetic, this.isGasAsset = c.isGasAsset;
926
984
  }
927
985
  toString() {
928
986
  return this.isSynthetic ? this.symbol : `${this.chain}.${this.symbol}`;
@@ -930,75 +988,75 @@ class A extends j {
930
988
  toUrl() {
931
989
  return this.isSynthetic ? `${this.chain}.${this.symbol.replace("/", ".")}` : this.toString();
932
990
  }
933
- eq({ chain: e, symbol: r }) {
934
- return this.chain === e && this.symbol === r;
991
+ eq({ chain: n, symbol: s }) {
992
+ return this.chain === n && this.symbol === s;
935
993
  }
936
994
  chainId() {
937
- return vt[this.chain];
995
+ return Le[this.chain];
938
996
  }
939
997
  // THOR.RUNE
940
998
  // THOR.ETH.ETH
941
999
  // ETH.THOR-0x1234567890
942
- static fromUrl(e, r = 0) {
943
- const [n, i, c] = e.split(".");
944
- if (!n || !i)
1000
+ static fromUrl(n, s = 0) {
1001
+ const [r, i, o] = n.split(".");
1002
+ if (!r || !i)
945
1003
  throw new Error("Invalid asset url");
946
- const a = n === o.THORChain && c ? `${n}.${i}/${c}` : e;
947
- return F(a, r);
1004
+ const u = r === a.THORChain && o ? `${r}.${i}/${o}` : n;
1005
+ return J(u, s);
948
1006
  }
949
- static fromString(e, r = 0) {
950
- return F(e, r);
1007
+ static fromString(n, s = 0) {
1008
+ return J(n, s);
951
1009
  }
952
- static fromIdentifier(e, r = 0) {
953
- return F(e, r);
1010
+ static fromIdentifier(n, s = 0) {
1011
+ return J(n, s);
954
1012
  }
955
- static fromStringSync(e, r = 0) {
956
- const { chain: n, isSynthetic: i } = P(e), c = S.get(e.toUpperCase());
1013
+ static fromStringSync(n, s = 0) {
1014
+ const { chain: r, isSynthetic: i } = x(n), o = w.get(n.toUpperCase());
957
1015
  if (i)
958
- return st(e, r);
959
- const { tax: a, decimal: u, identifier: l } = c || {
960
- decimal: d[n],
961
- identifier: e
1016
+ return he(n, s);
1017
+ const { tax: u, decimal: c, identifier: _ } = o || {
1018
+ decimal: d[r],
1019
+ identifier: n
962
1020
  };
963
- return new A({
964
- tax: a,
965
- value: I(r, u),
966
- identifier: i ? e : l,
967
- decimal: i ? 8 : u
1021
+ return new g({
1022
+ tax: u,
1023
+ value: V(s, c),
1024
+ identifier: i ? n : _,
1025
+ decimal: i ? 8 : c
968
1026
  });
969
1027
  }
970
- static fromIdentifierSync(e, r = 0) {
971
- const { chain: n, isSynthetic: i } = P(e), c = S.get(e);
1028
+ static fromIdentifierSync(n, s = 0) {
1029
+ const { chain: r, isSynthetic: i } = x(n), o = w.get(n);
972
1030
  if (i)
973
- return st(e, r);
974
- const { tax: a, decimal: u, identifier: l } = c || {
975
- decimal: d[n],
976
- identifier: e
1031
+ return he(n, s);
1032
+ const { tax: u, decimal: c, identifier: _ } = o || {
1033
+ decimal: d[r],
1034
+ identifier: n
977
1035
  };
978
- return new A({ tax: a, decimal: u, identifier: l, value: I(r, u) });
1036
+ return new g({ tax: u, decimal: c, identifier: _, value: V(s, c) });
979
1037
  }
980
- static fromChainOrSignature(e, r = 0) {
981
- const { decimal: n, identifier: i } = Ot(e);
982
- return new A({ value: I(r, n), decimal: n, identifier: i });
1038
+ static fromChainOrSignature(n, s = 0) {
1039
+ const { decimal: r, identifier: i } = at(n);
1040
+ return new g({ value: V(s, r), decimal: r, identifier: i });
983
1041
  }
984
1042
  static loadStaticAssets() {
985
1043
  return new Promise(
986
- async (e, r) => {
1044
+ async (n, s) => {
987
1045
  try {
988
- const n = await import("@swapkit/tokens");
989
- Object.values(n).forEach((i) => {
990
- var c;
991
- (c = i == null ? void 0 : i.tokens) == null || c.forEach(({ identifier: a, chain: u, ...l }) => {
992
- S.set(a.toUpperCase(), {
993
- identifier: a,
994
- decimal: "decimals" in l ? l.decimals : d[u]
1046
+ const r = await import("@swapkit/tokens");
1047
+ Object.values(r).forEach((i) => {
1048
+ var o;
1049
+ (o = i == null ? void 0 : i.tokens) == null || o.forEach(({ identifier: u, chain: c, ..._ }) => {
1050
+ w.set(u.toUpperCase(), {
1051
+ identifier: u,
1052
+ decimal: "decimals" in _ ? _.decimals : d[c]
995
1053
  });
996
1054
  });
997
- }), e({ ok: !0 });
998
- } catch (n) {
999
- console.error(n), r({
1055
+ }), n({ ok: !0 });
1056
+ } catch (r) {
1057
+ console.error(r), s({
1000
1058
  ok: !1,
1001
- error: n,
1059
+ error: r,
1002
1060
  message: "Couldn't load static assets. Ensure you have installed @swapkit/tokens package"
1003
1061
  });
1004
1062
  }
@@ -1006,60 +1064,60 @@ class A extends j {
1006
1064
  );
1007
1065
  }
1008
1066
  }
1009
- function ge(s) {
1010
- const t = A.fromChainOrSignature(s);
1011
- switch (s) {
1012
- case o.Bitcoin:
1013
- case o.Litecoin:
1014
- case o.BitcoinCash:
1067
+ function Vt(e) {
1068
+ const t = g.fromChainOrSignature(e);
1069
+ switch (e) {
1070
+ case a.Bitcoin:
1071
+ case a.Litecoin:
1072
+ case a.BitcoinCash:
1015
1073
  return t.set(10001e-8);
1016
- case o.Dogecoin:
1074
+ case a.Dogecoin:
1017
1075
  return t.set(1.00000001);
1018
- case o.Avalanche:
1019
- case o.Ethereum:
1076
+ case a.Avalanche:
1077
+ case a.Ethereum:
1020
1078
  return t.set(1e-8);
1021
- case o.THORChain:
1022
- case o.Maya:
1079
+ case a.THORChain:
1080
+ case a.Maya:
1023
1081
  return t.set(0);
1024
- case o.Cosmos:
1082
+ case a.Cosmos:
1025
1083
  return t.set(1e-6);
1026
1084
  default:
1027
1085
  return t.set(1e-8);
1028
1086
  }
1029
1087
  }
1030
- async function F(s, t = 0) {
1031
- te(s);
1032
- const e = S.get(s.toUpperCase()), r = (e == null ? void 0 : e.decimal) || await It(P(s));
1033
- return e || S.set(s.toUpperCase(), { identifier: s, decimal: r }), new A({ decimal: r, value: I(t, r), identifier: s });
1088
+ async function J(e, t = 0) {
1089
+ dt(e);
1090
+ const n = w.get(e.toUpperCase()), s = (n == null ? void 0 : n.decimal) || await it(x(e));
1091
+ return n || w.set(e.toUpperCase(), { identifier: e, decimal: s }), new g({ decimal: s, value: V(t, s), identifier: e });
1034
1092
  }
1035
- function st(s, t = 0) {
1036
- const [e, r] = s.split(".")[0].toUpperCase() === o.THORChain ? s.split(".").slice(1).join().split("/") : s.split("/");
1037
- if (!e || !r)
1093
+ function he(e, t = 0) {
1094
+ const [n, s] = e.split(".")[0].toUpperCase() === a.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
1095
+ if (!n || !s)
1038
1096
  throw new Error("Invalid asset identifier");
1039
- return new A({
1097
+ return new g({
1040
1098
  decimal: 8,
1041
- value: I(t, 8),
1042
- identifier: `${o.THORChain}.${e}/${r}`
1099
+ value: V(t, 8),
1100
+ identifier: `${a.THORChain}.${n}/${s}`
1043
1101
  });
1044
1102
  }
1045
- function I(s, t) {
1046
- return typeof s == "bigint" ? k({ value: s, bigIntDecimal: t, decimal: t }) : s;
1103
+ function V(e, t) {
1104
+ return typeof e == "bigint" ? G({ value: e, bigIntDecimal: t, decimal: t }) : e;
1047
1105
  }
1048
- function P(s) {
1049
- const t = s.slice(0, 14).includes("/"), [e, r] = s.split(".")[0].toUpperCase() === o.THORChain ? s.split(".").slice(1).join().split("/") : s.split("/");
1050
- if (t && (!e || !r))
1106
+ function x(e) {
1107
+ const t = e.slice(0, 14).includes("/"), [n, s] = e.split(".")[0].toUpperCase() === a.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
1108
+ if (t && (!n || !s))
1051
1109
  throw new Error("Invalid asset identifier");
1052
- const n = s.includes(".") && !t ? s : `${o.THORChain}.${r}`, [i, c] = n.split("."), [a, u] = (t ? r : c).split("-");
1110
+ const r = e.includes(".") && !t ? e : `${a.THORChain}.${s}`, [i, o] = r.split("."), [u, c] = (t ? s : o).split("-");
1053
1111
  return {
1054
- address: u == null ? void 0 : u.toLowerCase(),
1112
+ address: c == null ? void 0 : c.toLowerCase(),
1055
1113
  chain: i,
1056
- isGasAsset: it({ chain: i, symbol: c }),
1114
+ isGasAsset: fe({ chain: i, symbol: o }),
1057
1115
  isSynthetic: t,
1058
- symbol: (t ? `${e}/` : "") + (u ? `${a}-${(u == null ? void 0 : u.toLowerCase()) ?? ""}` : c),
1059
- ticker: a
1116
+ symbol: (t ? `${n}/` : "") + (c ? `${u}-${(c == null ? void 0 : c.toLowerCase()) ?? ""}` : o),
1117
+ ticker: u
1060
1118
  };
1061
1119
  }
1062
- const re = {
1120
+ const At = {
1063
1121
  /**
1064
1122
  * Core
1065
1123
  */
@@ -1118,48 +1176,55 @@ const re = {
1118
1176
  */
1119
1177
  helpers_number_different_decimals: 99101
1120
1178
  };
1121
- class dt extends Error {
1122
- constructor(t, e) {
1123
- console.error(e, { stack: e == null ? void 0 : e.stack, message: e == null ? void 0 : e.message }), super(t, { cause: { code: re[t], message: t } }), Object.setPrototypeOf(this, dt.prototype);
1179
+ class Ce extends Error {
1180
+ constructor(t, n) {
1181
+ console.error(n, { stack: n == null ? void 0 : n.stack, message: n == null ? void 0 : n.message }), super(t, { cause: { code: At[t], message: t } }), Object.setPrototypeOf(this, Ce.prototype);
1124
1182
  }
1125
1183
  }
1126
- class g extends j {
1184
+ class I extends W {
1127
1185
  eq(t) {
1128
1186
  return this.eqValue(t);
1129
1187
  }
1130
- static fromBigInt(t, e) {
1131
- return new g({
1132
- decimal: e,
1133
- value: k({ value: t, bigIntDecimal: e, decimal: e })
1188
+ static fromBigInt(t, n) {
1189
+ return new I({
1190
+ decimal: n,
1191
+ value: G({ value: t, bigIntDecimal: n, decimal: n })
1134
1192
  });
1135
1193
  }
1136
1194
  }
1137
1195
  export {
1138
- A as AssetValue,
1139
- j as BigIntArithmetics,
1140
- Zt as RequestClient,
1141
- dt as SwapKitError,
1142
- g as SwapKitNumber,
1143
- oe as assetFromString,
1144
- _e as derivationPathToString,
1145
- ae as filterAssets,
1146
- k as formatBigIntToSafeValue,
1147
- ie as gasFeeMultiplier,
1148
- Et as getAssetType,
1149
- qt as getAsymmetricAssetShare,
1150
- ue as getAsymmetricAssetWithdrawAmount,
1151
- xt as getAsymmetricRuneShare,
1152
- ce as getAsymmetricRuneWithdrawAmount,
1153
- Ot as getCommonAssetInfo,
1154
- It as getDecimal,
1155
- he as getEstimatedPoolShare,
1156
- de as getLiquiditySlippage,
1157
- me as getMemoFor,
1158
- ge as getMinAmountByChain,
1159
- Pt as getSymmetricPoolShare,
1160
- le as getSymmetricWithdraw,
1161
- pe as getTHORNameCost,
1162
- it as isGasAsset,
1163
- fe as validateTHORName
1196
+ m as ApiEndpoints,
1197
+ g as AssetValue,
1198
+ W as BigIntArithmetics,
1199
+ S as RequestClient,
1200
+ et as StreamingSwapProgressStatus,
1201
+ Et as SwapKitApi,
1202
+ Ce as SwapKitError,
1203
+ I as SwapKitNumber,
1204
+ ze as TransactionType,
1205
+ Ze as TxStatus,
1206
+ It as assetFromString,
1207
+ Re as defaultRequestHeaders,
1208
+ wt as derivationPathToString,
1209
+ ft as filterAssets,
1210
+ G as formatBigIntToSafeValue,
1211
+ Rt as gasFeeMultiplier,
1212
+ ot as getAssetType,
1213
+ _t as getAsymmetricAssetShare,
1214
+ Ct as getAsymmetricAssetWithdrawAmount,
1215
+ lt as getAsymmetricRuneShare,
1216
+ Nt as getAsymmetricRuneWithdrawAmount,
1217
+ at as getCommonAssetInfo,
1218
+ it as getDecimal,
1219
+ Ot as getEstimatedPoolShare,
1220
+ Dt as getLiquiditySlippage,
1221
+ Pt as getMemoFor,
1222
+ Vt as getMinAmountByChain,
1223
+ ht as getSymmetricPoolShare,
1224
+ gt as getSymmetricWithdraw,
1225
+ bt as getTHORNameCost,
1226
+ fe as isGasAsset,
1227
+ mt as setRequestClientConfig,
1228
+ yt as validateTHORName
1164
1229
  };
1165
1230
  //# sourceMappingURL=index.es.js.map