Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@swapkit/helpers

Package Overview
Dependencies
Maintainers
1
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swapkit/helpers - npm Package Compare versions

Comparing version 1.0.0-rc.64 to 1.0.0-rc.65

13

dist/index.d.ts

@@ -111,2 +111,4 @@ import { Chain } from '@swapkit/types';

export declare type ErrorKeys = keyof typeof errorMessages;
declare const errorMessages: {

@@ -161,3 +163,4 @@ /**

readonly core_transaction_invalid_sender_address: 10313;
readonly core_transaction_deposit_server_error: 10313;
readonly core_transaction_deposit_server_error: 10314;
readonly core_transaction_user_rejected: 10315;
/**

@@ -167,2 +170,6 @@ * Wallets

readonly wallet_ledger_connection_error: 20001;
readonly wallet_ledger_connection_claimed: 20002;
readonly wallet_ledger_get_address_error: 20003;
readonly wallet_ledger_device_not_found: 20004;
readonly wallet_ledger_device_locked: 20005;
/**

@@ -276,4 +283,2 @@ * Helpers

export declare type Keys = keyof typeof errorMessages;
export declare type MemoOptions<T extends MemoType> = {

@@ -334,3 +339,3 @@ [MemoType.BOND]: WithAddress;

export declare class SwapKitError extends Error {
constructor(errorKey: Keys, sourceError?: any);
constructor(errorKey: ErrorKeys, sourceError?: any);
}

@@ -337,0 +342,0 @@

@@ -16,6 +16,6 @@ var ye = Object.defineProperty;

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 + "";
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 || {});
const j = Object.values(q), $e = Object.keys(q), ne = j.reduce(
var j = /* @__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))(j || {}), 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 || {});
const q = Object.values(j), ve = Object.keys(j), ne = q.reduce(
(e, t) => {
const n = $e.find((s) => q[s] === t);
const n = ve.find((r) => j[r] === t);
return n && (e[t] = n), e;

@@ -25,11 +25,11 @@ },

);
j.reduce(
q.reduce(
(e, t) => (e[t] = te[ne[t]], e),
{}
);
j.reduce(
q.reduce(
(e, t) => (e[t] = de[ne[t]], e),
{}
);
j.reduce(
q.reduce(
(e, t) => {

@@ -42,4 +42,4 @@ const n = `${ne[t]}Hex`;

class oe extends Error {
constructor(t, n, s) {
const r = t.status || t.status === 0 ? t.status : "", i = t.statusText || "", o = `${r} ${i}`.trim(), u = o ? `status code ${o}` : "an unknown error";
constructor(t, n, r) {
const s = t.status || t.status === 0 ? t.status : "", i = t.statusText || "", o = `${s} ${i}`.trim(), u = o ? `status code ${o}` : "an unknown error";
super(`Request failed with ${u}`), Object.defineProperty(this, "response", {

@@ -60,3 +60,3 @@ enumerable: !0,

value: void 0
}), this.name = "HTTPError", this.response = t, this.request = n, this.options = s;
}), this.name = "HTTPError", this.response = t, this.request = n, this.options = r;
}

@@ -74,27 +74,27 @@ }

}
const M = (e) => e !== null && typeof e == "object", $ = (...e) => {
const M = (e) => e !== null && typeof e == "object", v = (...e) => {
for (const t of e)
if ((!M(t) || Array.isArray(t)) && t !== void 0)
throw new TypeError("The `options` argument must be an object");
return se({}, ...e);
return re({}, ...e);
}, Ae = (e = {}, t = {}) => {
const n = new globalThis.Headers(e), s = t instanceof globalThis.Headers, r = new globalThis.Headers(t);
for (const [i, o] of r.entries())
s && o === "undefined" || o === void 0 ? n.delete(i) : n.set(i, o);
const n = new globalThis.Headers(e), r = t instanceof globalThis.Headers, s = new globalThis.Headers(t);
for (const [i, o] of s.entries())
r && o === "undefined" || o === void 0 ? n.delete(i) : n.set(i, o);
return n;
}, se = (...e) => {
}, re = (...e) => {
let t = {}, n = {};
for (const s of e)
if (Array.isArray(s))
Array.isArray(t) || (t = []), t = [...t, ...s];
else if (M(s)) {
for (let [r, i] of Object.entries(s))
M(i) && r in t && (i = se(t[r], i)), t = { ...t, [r]: i };
M(s.headers) && (n = Ae(n, s.headers), t.headers = n);
for (const r of e)
if (Array.isArray(r))
Array.isArray(t) || (t = []), t = [...t, ...r];
else if (M(r)) {
for (let [s, i] of Object.entries(r))
M(i) && s in t && (i = re(t[s], i)), t = { ...t, [s]: i };
M(r.headers) && (n = Ae(n, r.headers), t.headers = n);
}
return t;
}, ve = (() => {
}, $e = (() => {
let e = !1, t = !1;
const n = typeof globalThis.ReadableStream == "function", s = typeof globalThis.Request == "function";
return n && s && (t = new globalThis.Request("https://empty.invalid", {
const n = typeof globalThis.ReadableStream == "function", r = typeof globalThis.Request == "function";
return n && r && (t = new globalThis.Request("https://empty.invalid", {
body: new globalThis.ReadableStream(),

@@ -140,6 +140,6 @@ method: "POST",

duplex: !0
}, 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 = {
}, ke = (e) => pe.includes(e) ? e.toUpperCase() : e, je = ["get", "put", "head", "delete", "options", "trace"], qe = [408, 413, 429, 500, 502, 503, 504], me = [413, 429, 503], ce = {
limit: 2,
methods: qe,
statusCodes: je,
methods: je,
statusCodes: qe,
afterStatusCodes: me,

@@ -165,8 +165,8 @@ maxRetryAfter: Number.POSITIVE_INFINITY,

};
async function Ye(e, t, n, s) {
return new Promise((r, i) => {
async function Ye(e, t, n, r) {
return new Promise((s, i) => {
const o = setTimeout(() => {
n && n.abort(), i(new Te(e));
}, s.timeout);
s.fetch(e, t).then(r).catch(i).then(() => {
}, r.timeout);
r.fetch(e, t).then(s).catch(i).then(() => {
clearTimeout(o);

@@ -177,9 +177,9 @@ });

async function Ke(e, { signal: t }) {
return new Promise((n, s) => {
t && (t.throwIfAborted(), t.addEventListener("abort", r, { once: !0 }));
function r() {
clearTimeout(i), s(t.reason);
return new Promise((n, r) => {
t && (t.throwIfAborted(), t.addEventListener("abort", s, { once: !0 }));
function s() {
clearTimeout(i), r(t.reason);
}
const i = setTimeout(() => {
t == null || t.removeEventListener("abort", r), n();
t == null || t.removeEventListener("abort", s), n();
}, e);

@@ -190,4 +190,4 @@ });

const n = {};
for (const s in t)
!(s in We) && !(s in Ge) && !(s in e) && (n[s] = t[s]);
for (const r in t)
!(r in We) && !(r in Ge) && !(r in e) && (n[r] = t[r]);
return n;

@@ -197,29 +197,29 @@ };

static create(t, n) {
const s = new F(t, n), r = async () => {
if (typeof s._options.timeout == "number" && s._options.timeout > K)
const r = new F(t, n), s = async () => {
if (typeof r._options.timeout == "number" && r._options.timeout > K)
throw new RangeError(`The \`timeout\` option cannot be greater than ${K}`);
await Promise.resolve();
let o = await s._fetch();
for (const u of s._options.hooks.afterResponse) {
const c = await u(s.request, s._options, s._decorateResponse(o.clone()));
let o = await r._fetch();
for (const u of r._options.hooks.afterResponse) {
const c = await u(r.request, r._options, r._decorateResponse(o.clone()));
c instanceof globalThis.Response && (o = c);
}
if (s._decorateResponse(o), !o.ok && s._options.throwHttpErrors) {
let u = new oe(o, s.request, s._options);
for (const c of s._options.hooks.beforeError)
if (r._decorateResponse(o), !o.ok && r._options.throwHttpErrors) {
let u = new oe(o, r.request, r._options);
for (const c of r._options.hooks.beforeError)
u = await c(u);
throw u;
}
if (s._options.onDownloadProgress) {
if (typeof s._options.onDownloadProgress != "function")
if (r._options.onDownloadProgress) {
if (typeof r._options.onDownloadProgress != "function")
throw new TypeError("The `onDownloadProgress` option must be a function");
if (!He)
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
return s._stream(o.clone(), s._options.onDownloadProgress);
return r._stream(o.clone(), r._options.onDownloadProgress);
}
return o;
}, i = s._options.retry.methods.includes(s.request.method.toLowerCase()) ? s._retry(r) : r();
}, i = r._options.retry.methods.includes(r.request.method.toLowerCase()) ? r._retry(s) : s();
for (const [o, u] of Object.entries(Fe))
i[o] = async () => {
s.request.headers.set("accept", s.request.headers.get("accept") || u);
r.request.headers.set("accept", r.request.headers.get("accept") || u);
const c = (await i).clone();

@@ -268,3 +268,3 @@ if (o === "json") {

headers: Ae(this._input.headers, n.headers),
hooks: se({
hooks: re({
beforeRequest: [],

@@ -291,5 +291,5 @@ beforeRetry: [],

if (this.abortController = new globalThis.AbortController(), this._options.signal) {
const s = this._options.signal;
const r = this._options.signal;
this._options.signal.addEventListener("abort", () => {
this.abortController.abort(s.reason);
this.abortController.abort(r.reason);
});

@@ -299,5 +299,5 @@ }

}
if (ve && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
const s = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), r = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, s);
(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);
if ($e && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
const r = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, r);
(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(s, { ...this.request }), this._options);
}

@@ -311,6 +311,6 @@ 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 }));

return 0;
const s = t.response.headers.get("Retry-After");
if (s && this._options.retry.afterStatusCodes.includes(t.response.status)) {
let r = Number(s);
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;
const r = t.response.headers.get("Retry-After");
if (r && this._options.retry.afterStatusCodes.includes(t.response.status)) {
let s = Number(r);
return Number.isNaN(s) ? s = Date.parse(r) - Date.now() : s *= 1e3, this._options.retry.maxRetryAfter !== void 0 && s > this._options.retry.maxRetryAfter ? 0 : s;
}

@@ -332,7 +332,7 @@ if (t.response.status === 413)

} catch (n) {
const s = Math.min(this._calculateRetryDelay(n), K);
if (s !== 0 && this._retryCount > 0) {
await Ke(s, { signal: this._options.signal });
for (const r of this._options.hooks.beforeRetry)
if (await r({
const r = Math.min(this._calculateRetryDelay(n), K);
if (r !== 0 && this._retryCount > 0) {
await Ke(r, { signal: this._options.signal });
for (const s of this._options.hooks.beforeRetry)
if (await s({
request: this.request,

@@ -351,9 +351,9 @@ options: this._options,

for (const n of this._options.hooks.beforeRequest) {
const s = await n(this.request, this._options);
if (s instanceof Request) {
this.request = s;
const r = await n(this.request, this._options);
if (r instanceof Request) {
this.request = r;
break;
}
if (s instanceof Response)
return s;
if (r instanceof Response)
return r;
}

@@ -365,5 +365,5 @@ const t = Je(this.request, this._options);

_stream(t, n) {
const s = Number(t.headers.get("content-length")) || 0;
let r = 0;
return t.status === 204 ? (n && n({ percent: 1, totalBytes: s, transferredBytes: r }, new Uint8Array()), new globalThis.Response(null, {
const r = Number(t.headers.get("content-length")) || 0;
let s = 0;
return t.status === 204 ? (n && n({ percent: 1, totalBytes: r, transferredBytes: s }, new Uint8Array()), new globalThis.Response(null, {
status: t.status,

@@ -375,3 +375,3 @@ statusText: t.statusText,

const o = t.body.getReader();
n && n({ percent: 0, transferredBytes: 0, totalBytes: s }, new Uint8Array());
n && n({ percent: 0, transferredBytes: 0, totalBytes: r }, new Uint8Array());
async function u() {

@@ -384,5 +384,5 @@ const { done: c, value: _ } = await o.read();

if (n) {
r += _.byteLength;
const h = s === 0 ? 0 : r / s;
n({ percent: h, transferredBytes: r, totalBytes: s }, _);
s += _.byteLength;
const h = r === 0 ? 0 : s / r;
n({ percent: h, transferredBytes: s, totalBytes: r }, _);
}

@@ -402,6 +402,6 @@ i.enqueue(_), await u();

const Q = (e) => {
const t = (n, s) => F.create(n, $(e, s));
const t = (n, r) => F.create(n, v(e, r));
for (const n of pe)
t[n] = (s, r) => F.create(s, $(e, r, { method: n }));
return t.create = (n) => Q($(n)), t.extend = (n) => Q($(e, n)), t.stop = Se, t;
t[n] = (r, s) => F.create(r, v(e, s, { method: n }));
return t.create = (n) => Q(v(n)), t.extend = (n) => Q(v(e, n)), t.stop = Se, t;
}, Ee = Q();

@@ -427,3 +427,3 @@ let H;

const n = new URLSearchParams();
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, {
return e.filter((r, s, i) => i.findIndex((o) => o === r) === s).forEach((r) => n.append("tokens", JSON.stringify(r))), t.metadata && n.append("metadata", "true"), t.lookup && n.append("lookup", "true"), t.sparkline && n.append("sparkline", "true"), S.post(m.CachedPrices, {
body: n.toString(),

@@ -468,6 +468,6 @@ headers: { "Content-Type": "application/x-www-form-urlencoded" }

return t != null && t.startsWith("0x") ? Ie({ chain: a.Ethereum, to: t }) : d.ETH;
}, st = async (e) => {
}, rt = async (e) => {
const [, t] = e.split("-");
return t != null && t.startsWith("0x") ? Ie({ chain: a.Avalanche, to: t.toLowerCase() }) : d.AVAX;
}, rt = async (e) => e === a.BinanceSmartChain ? d.BSC : d.BSC, it = async ({ chain: e, symbol: t }) => {
}, st = async (e) => e === a.BinanceSmartChain ? d.BSC : d.BSC, it = async ({ chain: e, symbol: t }) => {
switch (e) {

@@ -477,5 +477,5 @@ case a.Ethereum:

case a.Avalanche:
return rt(t);
case a.BinanceSmartChain:
return st(t);
case a.BinanceSmartChain:
return rt(t);
default:

@@ -577,4 +577,4 @@ return d[e];

var o;
const [t, ...n] = e.split("."), s = e.includes("/"), r = n.join("."), i = (o = r == null ? void 0 : r.split("-")) == null ? void 0 : o[0];
return { chain: t, symbol: r, ticker: i, synth: s };
const [t, ...n] = e.split("."), r = e.includes("/"), s = n.join("."), i = (o = s == null ? void 0 : s.split("-")) == null ? void 0 : o[0];
return { chain: t, symbol: s, ticker: i, synth: r };
}, ct = new RegExp(

@@ -587,4 +587,4 @@ /(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,

return !0;
const [, s] = n.split("-");
return fe({ chain: t, symbol: n }) || !!s;
const [, r] = n.split("-");
return fe({ chain: t, symbol: n }) || !!r;
}, ft = (e) => e.filter((t) => {

@@ -599,3 +599,3 @@ const n = `${t.chain}.${t.symbol}`;

}) {
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);
const r = A(e), s = A(t), i = A(n), o = r.mul(i), u = s.mul(s).mul(2), c = s.mul(r).mul(2), _ = r.mul(r), h = s.mul(s).mul(s);
return o.mul(u.sub(c).add(_)).div(h);

@@ -608,3 +608,3 @@ }

}) {
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);
const r = A(e), s = A(t), i = A(n), o = r.mul(i), u = s.mul(s).mul(2), c = s.mul(r).mul(2), _ = r.mul(r), h = o.mul(u.sub(c).add(_)), P = s.mul(s).mul(s);
return h.div(P);

@@ -616,5 +616,5 @@ }

liquidityUnits: n,
poolUnits: s
poolUnits: r
}) {
return lt({ runeDepth: t, liquidityUnits: n, poolUnits: s }).mul(e);
return lt({ runeDepth: t, liquidityUnits: n, poolUnits: r }).mul(e);
}

@@ -625,5 +625,5 @@ function Ct({

liquidityUnits: n,
poolUnits: s
poolUnits: r
}) {
return _t({ assetDepth: t, liquidityUnits: n, poolUnits: s }).mul(e);
return _t({ assetDepth: t, liquidityUnits: n, poolUnits: r }).mul(e);
}

@@ -637,6 +637,6 @@ function A(e) {

runeDepth: n,
assetDepth: s
assetDepth: r
}) {
return {
assetAmount: A(s).mul(e).div(t),
assetAmount: A(r).mul(e).div(t),
runeAmount: A(n).mul(e).div(t)

@@ -649,8 +649,8 @@ };

runeDepth: n,
assetDepth: s,
percent: r
assetDepth: r,
percent: s
}) {
return Object.fromEntries(
Object.entries(ht({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: s })).map(
([i, o]) => [i, o.mul(r)]
Object.entries(ht({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: r })).map(
([i, o]) => [i, o.mul(s)]
)

@@ -663,7 +663,7 @@ );

assetDepth: n,
liquidityUnits: s,
runeAmount: r,
liquidityUnits: r,
runeAmount: s,
assetAmount: i
}) {
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);
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: s, 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(r).add(ae);
if (ae.getBaseValue("number") === 0)

@@ -678,7 +678,7 @@ return X.div(c).getBaseValue("number");

runeDepth: n,
assetDepth: s
assetDepth: r
}) {
if (e === "0" || t === "0" || n === "0" || s === "0")
if (e === "0" || t === "0" || n === "0" || r === "0")
return 0;
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));
const s = A(n), i = A(r), o = A(t), u = A(e), c = o.mul(s).sub(i.mul(u)), _ = i.mul(u).add(s.mul(i));
return Math.abs(c.div(_).getBaseValue("number"));

@@ -694,12 +694,12 @@ }

case E.UNBOND: {
const { address: n, unbondAmount: s } = t;
return `${e}:${n}:${s}`;
const { address: n, unbondAmount: r } = t;
return `${e}:${n}:${r}`;
}
case E.THORNAME_REGISTER: {
const { name: n, chain: s, address: r, owner: i } = t;
return `${e}:${n}:${s}:${r}${i ? `:${i}` : ""}`;
const { name: n, chain: r, address: s, owner: i } = t;
return `${e}:${n}:${r}:${s}${i ? `:${i}` : ""}`;
}
case E.DEPOSIT: {
const { chain: n, symbol: s, address: r, singleSide: i } = t;
return i ? `${e}:${n}/${s}::t:0` : `${e}:${((u, c) => {
const { chain: n, symbol: r, address: s, singleSide: i } = t;
return i ? `${e}:${n}/${r}::t:0` : `${e}:${((u, c) => {
switch (u) {

@@ -715,6 +715,6 @@ case a.Litecoin:

}
})(n, s)}:${r || ""}:t:0`;
})(n, r)}:${s || ""}:t:0`;
}
case E.WITHDRAW: {
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}` : "";
const { chain: n, ticker: r, symbol: s, basisPoints: i, targetAssetString: o, singleSide: u } = t, c = n === "ETH" && r !== "ETH" ? `${r}-${s.slice(-3)}` : s, _ = !u && o ? `:${o}` : "";
return `${e}:${n}${u ? "/" : "."}${c}:${i}${_}`;

@@ -724,4 +724,4 @@ }

case E.CLOSE_LOAN: {
const { asset: n, address: s } = t;
return `${e}:${n}:${s}`;
const { asset: n, address: r } = t;
return `${e}:${n}:${r}`;
}

@@ -743,4 +743,4 @@ default:

}
function wt([e, t, n, s, r]) {
return `${e}'/${t}'/${n}'/${s}${typeof r != "number" ? "" : `/${r}`}`;
function wt([e, t, n, r, s]) {
return `${e}'/${t}'/${n}'/${r}${typeof s != "number" ? "" : `/${s}`}`;
}

@@ -752,4 +752,4 @@ const le = [...Object.values(a), "TERRA"];

return !0;
const [s] = t.split("/");
if (le.includes(s))
const [r] = t.split("/");
if (le.includes(r))
return !0;

@@ -768,9 +768,9 @@ throw new Error(

return e.toString();
const s = e < 0n;
let r = e.toString().substring(s ? 1 : 0);
const i = n - (r.length - 1);
i > 0 && (r = "0".repeat(i) + r);
const o = r.length - n;
let u = r.slice(-n);
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(
const r = e < 0n;
let s = e.toString().substring(r ? 1 : 0);
const i = n - (s.length - 1);
i > 0 && (s = "0".repeat(i) + s);
const o = s.length - n;
let u = s.slice(-n);
return parseInt(u[t]) >= 5 ? u = `${u.substring(0, t - 1)}${(parseInt(u[t - 1]) + 1).toString()}` : u = u.substring(0, t), `${r ? "-" : ""}${s.slice(0, o)}.${u}`.replace(
/\.?0*$/,

@@ -781,3 +781,3 @@ ""

var C, y, f, D, k, Ne, U, z, L, Z;
const re = class re {
const se = class se {
constructor(t) {

@@ -792,7 +792,7 @@ O(this, C);

p(this, "decimal");
const n = ee(t), s = typeof t == "object";
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);
const n = ee(t), r = typeof t == "object";
this.decimal = r ? t.decimal : void 0, this.decimalMultiplier = r && "decimalMultiplier" in t ? t.decimalMultiplier : N(Math.max(_e($(n)), this.decimal || 0)), T(this, k, Ne).call(this, n);
}
static fromBigInt(t, n) {
return new re({
return new se({
decimal: n,

@@ -805,7 +805,7 @@ value: G({ value: t, bigIntDecimal: n, decimal: n })

from: n,
to: s
to: r
}) {
return this.fromBigInt(
t.getBaseValue("bigint") * N(s) / N(n),
s
t.getBaseValue("bigint") * N(r) / N(n),
r
);

@@ -860,10 +860,10 @@ }

getBaseValue(t) {
const n = this.decimalMultiplier / N(this.decimal || d.THOR), s = this.bigIntValue / n;
const n = this.decimalMultiplier / N(this.decimal || d.THOR), r = this.bigIntValue / n;
switch (t) {
case "number":
return Number(s);
return Number(r);
case "string":
return s.toString();
return r.toString();
case "bigint":
return s;
return r;
}

@@ -874,14 +874,14 @@ }

return t.bigIntValue;
const s = ee(t), r = v(s);
return r === "0" || r === "undefined" ? 0n : T(this, L, Z).call(this, r, n);
const r = ee(t), s = $(r);
return s === "0" || s === "undefined" ? 0n : T(this, L, Z).call(this, s, n);
}
toSignificant(t = 6) {
const [n, s] = this.getValue("string").split("."), r = n || "", i = s || "";
if ((parseInt(r) ? r.length + i.length : i.length) <= t)
const [n, r] = this.getValue("string").split("."), s = n || "", i = r || "";
if ((parseInt(s) ? s.length + i.length : i.length) <= t)
return this.getValue("string");
if (r.length >= t)
return r.slice(0, t).padEnd(r.length, "0");
if (parseInt(r))
return `${r}.${i.slice(0, t - r.length)}`.padEnd(
t - r.length,
if (s.length >= t)
return s.slice(0, t).padEnd(s.length, "0");
if (parseInt(s))
return `${s}.${i.slice(0, t - s.length)}`.padEnd(
t - s.length,
"0"

@@ -896,5 +896,5 @@ );

toFixed(t = 6) {
const [n, s] = this.getValue("string").split("."), r = n || "", i = s || "";
if (parseInt(r))
return `${r}.${i.slice(0, t)}`.padEnd(t, "0");
const [n, r] = this.getValue("string").split("."), s = n || "", i = r || "";
if (parseInt(s))
return `${s}.${i.slice(0, t)}`.padEnd(t, "0");
const o = parseInt(i), u = `${o}`.slice(0, t);

@@ -907,6 +907,6 @@ return `0.${u.padStart(

toAbbreviation(t = 2) {
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];
const n = this.getValue("number"), r = ["", "K", "M", "B", "T", "Q", "Qi", "S"], s = Math.floor(Math.log10(Math.abs(n)) / 3), i = r[s];
if (!i)
return this.getValue("string");
const o = 10 ** (r * 3);
const o = 10 ** (s * 3);
return `${(n / o).toFixed(t)}${i}`;

@@ -916,16 +916,16 @@ }

currencyPosition: n = "start",
decimal: s = 2,
decimalSeparator: r = ".",
decimal: r = 2,
decimalSeparator: s = ".",
thousandSeparator: i = ","
} = {}) {
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)}` : ""}`;
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(".", s) : `${_}${parseInt(c) ? `${s}${c.slice(0, r)}` : ""}`;
return `${n === "start" ? t : ""}${h}${n === "end" ? t : ""}`;
}
formatBigIntToSafeValue(t, n) {
const s = n || this.decimal || B, r = Math.max(
s,
const r = n || this.decimal || B, s = Math.max(
r,
b(this.decimalMultiplier)
), 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;
let h = c.slice(-r);
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(
), i = t < 0n, o = t.toString().substring(i ? 1 : 0), u = s - (o.length - 1), c = u > 0 ? "0".repeat(u) + o : o, _ = c.length - s;
let h = c.slice(-s);
return parseInt(h[r]) >= 5 ? h = `${h.substring(0, r - 1)}${(parseInt(h[r - 1]) + 1).toString()}` : h = h.substring(0, r), `${i ? "-" : ""}${c.slice(
0,

@@ -937,5 +937,5 @@ _

C = new WeakSet(), y = function(t, ...n) {
const s = T(this, U, z).call(this, this, ...n), r = Math.max(s, b(this.decimalMultiplier)), i = N(r), o = n.reduce(
const r = T(this, U, z).call(this, this, ...n), s = Math.max(r, b(this.decimalMultiplier)), i = N(s), o = n.reduce(
(c, _) => {
const h = this.getBigIntValue(_, r);
const h = this.getBigIntValue(_, s);
switch (t) {

@@ -960,8 +960,8 @@ case "add":

), u = G({
bigIntDecimal: r,
decimal: r,
bigIntDecimal: s,
decimal: s,
value: o
});
return new this.constructor({
decimalMultiplier: N(r),
decimalMultiplier: N(s),
decimal: this.decimal,

@@ -972,26 +972,26 @@ value: u,

}, f = new WeakSet(), D = function(t, ...n) {
const s = T(this, U, z).call(this, this, ...n), r = this.getBigIntValue(n[0], s), i = this.getBigIntValue(this, s);
const r = T(this, U, z).call(this, this, ...n), s = this.getBigIntValue(n[0], r), i = this.getBigIntValue(this, r);
switch (t) {
case "gt":
return i > r;
return i > s;
case "gte":
return i >= r;
return i >= s;
case "lt":
return i < r;
return i < s;
case "lte":
return i <= r;
return i <= s;
case "eqValue":
return i === r;
return i === s;
}
}, k = new WeakSet(), Ne = function(t) {
const n = v(t) || "0";
const n = $(t) || "0";
this.bigIntValue = T(this, L, Z).call(this, n);
}, U = new WeakSet(), z = function(...t) {
const n = t.map((s) => typeof s == "object" ? s.decimal || b(s.decimalMultiplier) : _e(v(s))).filter(Boolean);
const n = t.map((r) => typeof r == "object" ? r.decimal || b(r.decimalMultiplier) : _e($(r))).filter(Boolean);
return Math.max(...n, B);
}, L = new WeakSet(), Z = function(t, n) {
const s = n ? N(n) : this.decimalMultiplier, r = b(s), [i = "", o = ""] = t.split(".");
return BigInt(`${i}${o.padEnd(r, "0")}`);
const r = n ? N(n) : this.decimalMultiplier, s = b(r), [i = "", o = ""] = t.split(".");
return BigInt(`${i}${o.padEnd(s, "0")}`);
};
let W = re;
let W = se;
const Tt = Intl.NumberFormat("fullwide", {

@@ -1001,3 +1001,3 @@ useGrouping: !1,

});
function v(e) {
function $(e) {
const n = `${typeof e == "number" ? Tt.format(e) : ee(e)}`.replaceAll(",", ".").split(".");

@@ -1018,4 +1018,4 @@ return n.length > 1 ? `${n.slice(0, -1).join("")}.${n.at(-1)}` : n[0];

value: n,
decimal: s,
tax: r,
decimal: r,
tax: s,
chain: i,

@@ -1025,3 +1025,3 @@ symbol: o,

}) {
super(typeof n == "object" ? n : { decimal: s, value: n });
super(typeof n == "object" ? n : { decimal: r, value: n });
p(this, "address");

@@ -1036,3 +1036,3 @@ p(this, "chain");

const c = x(u || `${i}.${o}`);
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;
this.type = ot(c), this.tax = s, this.chain = c.chain, this.ticker = c.ticker, this.symbol = c.symbol, this.address = c.address, this.isSynthetic = c.isSynthetic, this.isGasAsset = c.isGasAsset;
}

@@ -1045,4 +1045,4 @@ toString() {

}
eq({ chain: n, symbol: s }) {
return this.chain === n && this.symbol === s;
eq({ chain: n, symbol: r }) {
return this.chain === n && this.symbol === r;
}

@@ -1055,21 +1055,21 @@ chainId() {

// ETH.THOR-0x1234567890
static fromUrl(n, s = 0) {
const [r, i, o] = n.split(".");
if (!r || !i)
static fromUrl(n, r = 0) {
const [s, i, o] = n.split(".");
if (!s || !i)
throw new Error("Invalid asset url");
const u = r === a.THORChain && o ? `${r}.${i}/${o}` : n;
return J(u, s);
const u = s === a.THORChain && o ? `${s}.${i}/${o}` : n;
return J(u, r);
}
static fromString(n, s = 0) {
return J(n, s);
static fromString(n, r = 0) {
return J(n, r);
}
static fromIdentifier(n, s = 0) {
return J(n, s);
static fromIdentifier(n, r = 0) {
return J(n, r);
}
static fromStringSync(n, s = 0) {
const { chain: r, isSynthetic: i } = x(n), o = w.get(n.toUpperCase());
static fromStringSync(n, r = 0) {
const { chain: s, isSynthetic: i } = x(n), o = w.get(n.toUpperCase());
if (i)
return he(n, s);
return he(n, r);
const { tax: u, decimal: c, identifier: _ } = o || {
decimal: d[r],
decimal: d[s],
identifier: n

@@ -1079,3 +1079,3 @@ };

tax: u,
value: V(s, c),
value: V(r, c),
identifier: i ? n : _,

@@ -1085,22 +1085,22 @@ decimal: i ? 8 : c

}
static fromIdentifierSync(n, s = 0) {
const { chain: r, isSynthetic: i } = x(n), o = w.get(n);
static fromIdentifierSync(n, r = 0) {
const { chain: s, isSynthetic: i } = x(n), o = w.get(n);
if (i)
return he(n, s);
return he(n, r);
const { tax: u, decimal: c, identifier: _ } = o || {
decimal: d[r],
decimal: d[s],
identifier: n
};
return new g({ tax: u, decimal: c, identifier: _, value: V(s, c) });
return new g({ tax: u, decimal: c, identifier: _, value: V(r, c) });
}
static fromChainOrSignature(n, s = 0) {
const { decimal: r, identifier: i } = at(n);
return new g({ value: V(s, r), decimal: r, identifier: i });
static fromChainOrSignature(n, r = 0) {
const { decimal: s, identifier: i } = at(n);
return new g({ value: V(r, s), decimal: s, identifier: i });
}
static loadStaticAssets() {
return new Promise(
async (n, s) => {
async (n, r) => {
try {
const r = await import("@swapkit/tokens");
Object.values(r).forEach((i) => {
const s = await import("@swapkit/tokens");
Object.values(s).forEach((i) => {
var o;

@@ -1114,6 +1114,6 @@ (o = i == null ? void 0 : i.tokens) == null || o.forEach(({ identifier: u, chain: c, ..._ }) => {

}), n({ ok: !0 });
} catch (r) {
console.error(r), s({
} catch (s) {
console.error(s), r({
ok: !1,
error: r,
error: s,
message: "Couldn't load static assets. Ensure you have installed @swapkit/tokens package"

@@ -1149,8 +1149,8 @@ });

dt(e);
const n = w.get(e.toUpperCase()), s = (n == null ? void 0 : n.decimal) || await it(x(e));
return n || w.set(e.toUpperCase(), { identifier: e, decimal: s }), new g({ decimal: s, value: V(t, s), identifier: e });
const n = w.get(e.toUpperCase()), r = (n == null ? void 0 : n.decimal) || await it(x(e));
return n || w.set(e.toUpperCase(), { identifier: e, decimal: r }), new g({ decimal: r, value: V(t, r), identifier: e });
}
function he(e, t = 0) {
const [n, s] = e.split(".")[0].toUpperCase() === a.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
if (!n || !s)
const [n, r] = e.split(".")[0].toUpperCase() === a.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
if (!n || !r)
throw new Error("Invalid asset identifier");

@@ -1160,3 +1160,3 @@ return new g({

value: V(t, 8),
identifier: `${a.THORChain}.${n}/${s}`
identifier: `${a.THORChain}.${n}/${r}`
});

@@ -1168,6 +1168,6 @@ }

function x(e) {
const t = e.slice(0, 14).includes("/"), [n, s] = e.split(".")[0].toUpperCase() === a.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
if (t && (!n || !s))
const t = e.slice(0, 14).includes("/"), [n, r] = e.split(".")[0].toUpperCase() === a.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
if (t && (!n || !r))
throw new Error("Invalid asset identifier");
const r = e.includes(".") && !t ? e : `${a.THORChain}.${s}`, [i, o] = r.split("."), [u, c] = (t ? s : o).split("-");
const s = e.includes(".") && !t ? e : `${a.THORChain}.${r}`, [i, o] = s.split("."), [u, c] = (t ? r : o).split("-");
return {

@@ -1231,3 +1231,4 @@ address: c == null ? void 0 : c.toLowerCase(),

core_transaction_invalid_sender_address: 10313,
core_transaction_deposit_server_error: 10313,
core_transaction_deposit_server_error: 10314,
core_transaction_user_rejected: 10315,
/**

@@ -1237,2 +1238,6 @@ * Wallets

wallet_ledger_connection_error: 20001,
wallet_ledger_connection_claimed: 20002,
wallet_ledger_get_address_error: 20003,
wallet_ledger_device_not_found: 20004,
wallet_ledger_device_locked: 20005,
/**

@@ -1245,3 +1250,3 @@ * Helpers

constructor(t, n) {
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);
n && 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);
}

@@ -1248,0 +1253,0 @@ }

@@ -5,3 +5,3 @@ {

"dependencies": {
"@swapkit/api": "1.0.0-rc.34"
"@swapkit/api": "1.0.0-rc.35"
},

@@ -14,3 +14,3 @@ "devDependencies": {

"@swapkit/tokens": "1.0.0-rc.33",
"@swapkit/types": "1.0.0-rc.33"
"@swapkit/types": "1.0.0-rc.34"
},

@@ -22,3 +22,3 @@ "eslintConfig": {

"@swapkit/tokens": "1.0.0-rc.33",
"@swapkit/types": "1.0.0-rc.33"
"@swapkit/types": "1.0.0-rc.34"
},

@@ -48,3 +48,3 @@ "exports": {

"types": "./dist/index.d.ts",
"version": "1.0.0-rc.64",
"version": "1.0.0-rc.65",
"scripts": {

@@ -51,0 +51,0 @@ "build": "vite build",

@@ -50,3 +50,4 @@ const errorMessages = {

core_transaction_invalid_sender_address: 10313,
core_transaction_deposit_server_error: 10313,
core_transaction_deposit_server_error: 10314,
core_transaction_user_rejected: 10315,

@@ -57,2 +58,6 @@ /**

wallet_ledger_connection_error: 20001,
wallet_ledger_connection_claimed: 20002,
wallet_ledger_get_address_error: 20003,
wallet_ledger_device_not_found: 20004,
wallet_ledger_device_locked: 20005,

@@ -65,7 +70,9 @@ /**

export type Keys = keyof typeof errorMessages;
export type ErrorKeys = keyof typeof errorMessages;
export class SwapKitError extends Error {
constructor(errorKey: Keys, sourceError?: any) {
console.error(sourceError, { stack: sourceError?.stack, message: sourceError?.message });
constructor(errorKey: ErrorKeys, sourceError?: any) {
if (sourceError) {
console.error(sourceError, { stack: sourceError?.stack, message: sourceError?.message });
}

@@ -72,0 +79,0 @@ super(errorKey, { cause: { code: errorMessages[errorKey], message: errorKey } });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc