New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@coinmasters/helpers

Package Overview
Dependencies
Maintainers
2
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coinmasters/helpers - npm Package Compare versions

Comparing version 7.0.0 to 8.0.0

2

dist/index.d.ts

@@ -231,3 +231,3 @@ import { Chain } from '@coinmasters/types';

symbol: string;
}) => Promise<any>;
}) => Promise<number>;

@@ -234,0 +234,0 @@ export declare const getEstimatedPoolShare: ({ runeDepth, poolUnits, assetDepth, liquidityUnits, runeAmount, assetAmount, }: ShareParams<{

@@ -13,3 +13,3 @@ var bt = Object.defineProperty;

var m = (r, t, e) => (wt(r, t, "access private method"), e);
import { FeeOption as D, BaseDecimal as d, Chain as a, EVMChainList as At, ChainToRPC as vt, MemoType as b } from "@coinmasters/types";
import { FeeOption as D, BaseDecimal as d, Chain as i, EVMChainList as At, ChainToRPC as vt, MemoType as b } from "@coinmasters/types";
const Tt = "0x313ce567", at = async ({ chain: r, to: t }) => {

@@ -35,16 +35,16 @@ try {

}, $t = async (r) => {
if (r === a.Ethereum)
if (r === i.Ethereum)
return d.ETH;
const [, t] = r.split("-");
return t != null && t.startsWith("0x") ? at({ chain: a.Ethereum, to: t }) : d.ETH;
return t != null && t.startsWith("0x") ? at({ chain: i.Ethereum, to: t }) : d.ETH;
}, Rt = async (r) => {
const [, t] = r.split("-");
return t != null && t.startsWith("0x") ? at({ chain: a.Avalanche, to: t.toLowerCase() }) : d.AVAX;
}, St = async (r) => r === a.BinanceSmartChain ? d.BSC : d.BSC, Ct = async ({ chain: r, symbol: t }) => {
return t != null && t.startsWith("0x") ? at({ chain: i.Avalanche, to: t.toLowerCase() }) : d.AVAX;
}, St = async (r) => r === i.BinanceSmartChain ? d.BSC : d.BSC, Ct = async ({ chain: r, symbol: t }) => {
switch (r) {
case a.Ethereum:
case i.Ethereum:
return $t(t);
case a.Avalanche:
case i.Avalanche:
return Rt(t);
case a.BinanceSmartChain:
case i.BinanceSmartChain:
return St(t);

@@ -60,28 +60,29 @@ default:

switch (r) {
case a.Bitcoin:
case a.BitcoinCash:
case a.Dash:
case a.Digibyte:
case a.Zcash:
case a.Ripple:
case a.Litecoin:
case a.Dogecoin:
case a.Binance:
case a.Ethereum:
case a.Avalanche:
case i.Bitcoin:
case i.BitcoinCash:
case i.Dash:
case i.Digibyte:
case i.Zcash:
case i.Ripple:
case i.Litecoin:
case i.Dogecoin:
case i.Binance:
case i.Ethereum:
case i.Base:
case i.Avalanche:
return t === r;
case a.Arbitrum:
case a.Optimism:
case i.Arbitrum:
case i.Optimism:
return t === "ETH";
case a.Maya:
case i.Maya:
return t === "CACAO";
case a.Kujira:
case i.Kujira:
return t === "KUJI";
case a.Cosmos:
case i.Cosmos:
return t === "ATOM";
case a.Polygon:
case i.Polygon:
return t === "MATIC";
case a.BinanceSmartChain:
case i.BinanceSmartChain:
return t === "BNB";
case a.THORChain:
case i.THORChain:
return t === "RUNE";

@@ -95,26 +96,27 @@ }

return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
case a.Cosmos:
case i.Cosmos:
return { identifier: "GAIA.ATOM", decimal: d[r] };
case a.THORChain:
case i.THORChain:
return { identifier: "THOR.RUNE", decimal: d[r] };
case a.BinanceSmartChain:
case i.BinanceSmartChain:
return { identifier: "BSC.BNB", decimal: d[r] };
case a.Maya:
case i.Maya:
return { identifier: "MAYA.CACAO", decimal: d.MAYA };
case "MAYA.MAYA":
return { identifier: "MAYA.MAYA", decimal: 4 };
case a.Ripple:
case a.Kujira:
case a.Arbitrum:
case a.Optimism:
case a.BitcoinCash:
case a.Zcash:
case a.Dash:
case a.Litecoin:
case a.Dogecoin:
case a.Binance:
case a.Avalanche:
case a.Polygon:
case a.Bitcoin:
case a.Ethereum:
case i.Ripple:
case i.Kujira:
case i.Arbitrum:
case i.Optimism:
case i.BitcoinCash:
case i.Zcash:
case i.Dash:
case i.Litecoin:
case i.Dogecoin:
case i.Binance:
case i.Avalanche:
case i.Polygon:
case i.Bitcoin:
case i.Base:
case i.Ethereum:
return { identifier: `${r}.${r}`, decimal: d[r] };

@@ -126,40 +128,42 @@ }

switch (r) {
case a.Bitcoin:
case a.BitcoinCash:
case a.Dogecoin:
case a.Dash:
case a.Zcash:
case a.Litecoin:
case a.Maya:
case a.THORChain:
case i.Bitcoin:
case i.BitcoinCash:
case i.Dogecoin:
case i.Dash:
case i.Zcash:
case i.Litecoin:
case i.Maya:
case i.THORChain:
return "Native";
case a.Osmosis:
case i.Osmosis:
return "Native";
case a.Cosmos:
return t === "ATOM" ? "Native" : a.Cosmos;
case a.Kujira:
return t === a.Kujira ? "Native" : a.Kujira;
case a.Binance:
return t === a.Binance ? "Native" : "BEP2";
case a.BinanceSmartChain:
return t === a.Binance ? "Native" : "BEP20";
case a.Ethereum:
return t === a.Ethereum ? "Native" : "ERC20";
case a.Avalanche:
return t === a.Avalanche ? "Native" : a.Avalanche;
case a.Polygon:
return t === a.Polygon ? "Native" : "POLYGON";
case a.Arbitrum:
return [a.Ethereum, a.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
case a.Optimism:
return [a.Ethereum, a.Optimism].includes(t) ? "Native" : "OPTIMISM";
case i.Cosmos:
return t === "ATOM" ? "Native" : i.Cosmos;
case i.Kujira:
return t === i.Kujira ? "Native" : i.Kujira;
case i.Binance:
return t === i.Binance ? "Native" : "BEP2";
case i.BinanceSmartChain:
return t === i.Binance ? "Native" : "BEP20";
case i.Ethereum:
return t === i.Ethereum ? "Native" : "ERC20";
case i.Avalanche:
return t === i.Avalanche ? "Native" : i.Avalanche;
case i.Polygon:
return t === i.Polygon ? "Native" : "POLYGON";
case i.Base:
return "Native";
case i.Arbitrum:
return [i.Ethereum, i.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
case i.Optimism:
return [i.Ethereum, i.Optimism].includes(t) ? "Native" : "OPTIMISM";
}
}, ae = (r) => {
var o;
const [t, ...e] = r.split("."), s = r.includes("/"), n = e.join("."), i = (o = n == null ? void 0 : n.split("-")) == null ? void 0 : o[0];
return { chain: t, symbol: n, ticker: i, synth: s };
const [t, ...e] = r.split("."), s = r.includes("/"), n = e.join("."), a = (o = n == null ? void 0 : n.split("-")) == null ? void 0 : o[0];
return { chain: t, symbol: n, ticker: a, synth: s };
}, Et = new RegExp(
/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
"gmi"
), Mt = (r) => {
), Bt = (r) => {
const [t, e] = r.split(".");

@@ -172,4 +176,4 @@ if (!At.includes(t))

const e = `${t.chain}.${t.symbol}`;
return !Et.test(e) && Mt(e) && t.value !== "0";
}), Bt = ({
return !Et.test(e) && Bt(e) && t.value !== "0";
}), Mt = ({
liquidityUnits: r,

@@ -179,3 +183,3 @@ poolUnits: t,

}) => {
const s = p(r), n = p(t), i = p(e), o = s.mul(i), c = n.mul(n).mul(2), u = n.mul(s).mul(2), h = s.mul(s), l = n.mul(n).mul(n);
const s = p(r), n = p(t), a = p(e), o = s.mul(a), c = n.mul(n).mul(2), u = n.mul(s).mul(2), h = s.mul(s), l = n.mul(n).mul(n);
return o.mul(c.sub(u).add(h)).div(l);

@@ -187,3 +191,3 @@ }, xt = ({

}) => {
const s = p(r), n = p(t), i = p(e), o = s.mul(i), c = n.mul(n).mul(2), u = n.mul(s).mul(2), h = s.mul(s), l = o.mul(c.sub(u).add(h)), _ = n.mul(n).mul(n);
const s = p(r), n = p(t), a = p(e), o = s.mul(a), c = n.mul(n).mul(2), u = n.mul(s).mul(2), h = s.mul(s), l = o.mul(c.sub(u).add(h)), _ = n.mul(n).mul(n);
return l.div(_);

@@ -195,3 +199,3 @@ }, ce = ({

poolUnits: s
}) => Bt({ runeDepth: t, liquidityUnits: e, poolUnits: s }).mul(r), ue = ({
}) => Mt({ runeDepth: t, liquidityUnits: e, poolUnits: s }).mul(r), ue = ({
percent: r,

@@ -217,3 +221,3 @@ assetDepth: t,

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

@@ -226,5 +230,5 @@ ), he = ({

runeAmount: n,
assetAmount: i
assetAmount: a
}) => {
const o = new y({ value: r, decimal: 8 }), c = new y({ value: e, decimal: 8 }), u = new y({ value: t, decimal: 8 }), h = new y({ value: n, decimal: 8 }), l = new y({ value: i, decimal: 8 }), _ = h.mul(c), g = l.mul(o), $ = h.mul(l), Z = o.mul(c), ft = u.mul(_.add(g.add($.mul(2)))), _t = _.add(g.add(Z.mul(2))), Q = ft.div(_t), H = p(s).add(Q);
const o = new y({ value: r, decimal: 8 }), c = new y({ value: e, decimal: 8 }), u = new y({ value: t, decimal: 8 }), h = new y({ value: n, decimal: 8 }), l = new y({ value: a, decimal: 8 }), _ = h.mul(c), g = l.mul(o), $ = h.mul(l), Z = o.mul(c), ft = u.mul(_.add(g.add($.mul(2)))), _t = _.add(g.add(Z.mul(2))), Q = ft.div(_t), H = p(s).add(Q);
if (Q.getBaseValue("number") === 0)

@@ -242,3 +246,3 @@ return H.div(u).getBaseValue("number");

return 0;
const n = p(e), i = p(s), o = p(t), c = p(r), u = o.mul(n).sub(i.mul(c)), h = i.mul(c).add(n.mul(i));
const n = p(e), a = p(s), o = p(t), c = p(r), u = o.mul(n).sub(a.mul(c)), h = a.mul(c).add(n.mul(a));
return Math.abs(u.div(h).getBaseValue("number"));

@@ -261,12 +265,12 @@ }, qt = ({

case b.THORNAME_REGISTER: {
const { name: e, chain: s, address: n, owner: i } = t;
return `${r}:${e}:${s}:${n}${i ? `:${i}` : ""}`;
const { name: e, chain: s, address: n, owner: a } = t;
return `${r}:${e}:${s}:${n}${a ? `:${a}` : ""}`;
}
case b.DEPOSIT: {
const { chain: e, symbol: s, address: n, singleSide: i } = t;
return i ? `${r}:${e}/${s}::t:0` : `${r}:${e}.${s}:${n || ""}:t:0`;
const { chain: e, symbol: s, address: n, singleSide: a } = t;
return a ? `${r}:${e}/${s}::t:0` : `${r}:${e}.${s}:${n || ""}:t:0`;
}
case b.WITHDRAW: {
const { chain: e, ticker: s, symbol: n, basisPoints: i, targetAssetString: o, singleSide: c } = t, u = !c && o ? `:${o}` : "", h = qt({ chain: e, symbol: n, ticker: s });
return `${r}:${e}${c ? "/" : "."}${h}:${i}${u}`;
const { chain: e, ticker: s, symbol: n, basisPoints: a, targetAssetString: o, singleSide: c } = t, u = !c && o ? `:${o}` : "", h = qt({ chain: e, symbol: n, ticker: s });
return `${r}:${e}${c ? "/" : "."}${h}:${a}${u}`;
}

@@ -293,3 +297,3 @@ case b.OPEN_LOAN:

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

@@ -330,4 +334,4 @@ enumerable: !0,

const e = new globalThis.Headers(r), s = t instanceof globalThis.Headers, n = new globalThis.Headers(t);
for (const [i, o] of n.entries())
s && o === "undefined" || o === void 0 ? e.delete(i) : e.set(i, o);
for (const [a, o] of n.entries())
s && o === "undefined" || o === void 0 ? e.delete(a) : e.set(a, o);
return e;

@@ -340,4 +344,4 @@ }, J = (...r) => {

else if (q(s)) {
for (let [n, i] of Object.entries(s))
q(i) && n in t && (i = J(t[n], i)), t = { ...t, [n]: i };
for (let [n, a] of Object.entries(s))
q(a) && n in t && (a = J(t[n], a)), t = { ...t, [n]: a };
q(s.headers) && (e = ut(e, s.headers), t.headers = e);

@@ -415,7 +419,7 @@ }

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

@@ -429,5 +433,5 @@ });

function n() {
clearTimeout(i), s(t.reason);
clearTimeout(a), s(t.reason);
}
const i = setTimeout(() => {
const a = setTimeout(() => {
t == null || t.removeEventListener("abort", n), e();

@@ -545,4 +549,4 @@ }, r);

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

@@ -614,3 +618,3 @@ 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 }));

})) : new globalThis.Response(new globalThis.ReadableStream({
async start(i) {
async start(a) {
const o = t.body.getReader();

@@ -621,3 +625,3 @@ e && e({ percent: 0, transferredBytes: 0, totalBytes: s }, new Uint8Array());

if (u) {
i.close();
a.close();
return;

@@ -630,3 +634,3 @@ }

}
i.enqueue(h), await c();
a.enqueue(h), await c();
}

@@ -651,3 +655,3 @@ await c();

post: (r, t) => et.post(r, t).json()
}, st = Object.values(a), te = (r = "") => {
}, st = Object.values(i), te = (r = "") => {
const t = r.toUpperCase(), [e] = t.split(".");

@@ -670,4 +674,4 @@ if (st.includes(e))

let n = r.toString().substring(s ? 1 : 0);
const i = e - (n.length - 1);
i > 0 && (n = "0".repeat(i) + n);
const a = e - (n.length - 1);
a > 0 && (n = "0".repeat(a) + n);
const o = n.length - e;

@@ -680,3 +684,3 @@ let c = n.slice(-e);

}
var T, I, w, S, j, mt, M, F, B, G;
var T, I, w, S, j, mt, B, F, M, G;
const K = class K {

@@ -687,4 +691,4 @@ constructor(t) {

R(this, j);
R(this, B);
R(this, M);
R(this, B);
f(this, "decimalMultiplier", 10n ** 8n);

@@ -773,7 +777,7 @@ f(this, "bigIntValue", 0n);

const s = W(t), n = k(s);
return n === "0" || n === "undefined" ? 0n : m(this, B, G).call(this, n, e);
return n === "0" || n === "undefined" ? 0n : m(this, M, G).call(this, n, e);
}
toSignificant(t = 6) {
const [e, s] = this.getValue("string").split("."), n = e || "", i = s || "";
if ((parseInt(n) ? n.length + i.length : i.length) <= t)
const [e, s] = this.getValue("string").split("."), n = e || "", a = s || "";
if ((parseInt(n) ? n.length + a.length : a.length) <= t)
return this.getValue("string");

@@ -783,9 +787,9 @@ if (n.length >= t)

if (parseInt(n))
return `${n}.${i.slice(0, t - n.length)}`.padEnd(
return `${n}.${a.slice(0, t - n.length)}`.padEnd(
t - n.length,
"0"
);
const c = parseInt(i), u = `${c}`.slice(0, t);
const c = parseInt(a), u = `${c}`.slice(0, t);
return `0.${u.padStart(
i.length - `${c}`.length + u.length,
a.length - `${c}`.length + u.length,
"0"

@@ -795,8 +799,8 @@ )}`;

toFixed(t = 6) {
const [e, s] = this.getValue("string").split("."), n = e || "", i = s || "";
const [e, s] = this.getValue("string").split("."), n = e || "", a = s || "";
if (parseInt(n))
return `${n}.${i.slice(0, t)}`.padEnd(t, "0");
const o = parseInt(i), c = `${o}`.slice(0, t);
return `${n}.${a.slice(0, t)}`.padEnd(t, "0");
const o = parseInt(a), c = `${o}`.slice(0, t);
return `0.${c.padStart(
i.length - `${o}`.length + c.length,
a.length - `${o}`.length + c.length,
"0"

@@ -806,7 +810,7 @@ )}`;

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

@@ -817,5 +821,5 @@ toCurrency(t = "$", {

decimalSeparator: n = ".",
thousandSeparator: i = ","
thousandSeparator: a = ","
} = {}) {
const o = this.getValue("number"), [c, u = ""] = o.toFixed(6).split("."), h = c.replace(/\B(?=(\d{3})+(?!\d))/g, i), l = !c && !u ? "0.00" : c === "0" ? `${parseFloat(`0.${u}`)}`.replace(".", n) : `${h}${parseInt(u) ? `${n}${u.slice(0, s)}` : ""}`;
const o = this.getValue("number"), [c, u = ""] = o.toFixed(6).split("."), h = c.replace(/\B(?=(\d{3})+(?!\d))/g, a), l = !c && !u ? "0.00" : c === "0" ? `${parseFloat(`0.${u}`)}`.replace(".", n) : `${h}${parseInt(u) ? `${n}${u.slice(0, s)}` : ""}`;
return `${e === "start" ? t : ""}${l}${e === "end" ? t : ""}`;

@@ -827,5 +831,5 @@ }

C(this.decimalMultiplier)
), i = t < 0n, o = t.toString().substring(i ? 1 : 0), c = n - (o.length - 1), u = c > 0 ? "0".repeat(c) + o : o, h = u.length - n;
), a = t < 0n, o = t.toString().substring(a ? 1 : 0), c = n - (o.length - 1), u = c > 0 ? "0".repeat(c) + o : o, h = u.length - n;
let l = u.slice(-n);
return parseInt(l[s]) >= 5 ? l = `${l.substring(0, s - 1)}${(parseInt(l[s - 1]) + 1).toString()}` : l = l.substring(0, s), `${i ? "-" : ""}${u.slice(
return parseInt(l[s]) >= 5 ? l = `${l.substring(0, s - 1)}${(parseInt(l[s - 1]) + 1).toString()}` : l = l.substring(0, s), `${a ? "-" : ""}${u.slice(
0,

@@ -837,3 +841,3 @@ h

T = new WeakSet(), I = function(t, ...e) {
const s = m(this, M, F).call(this, this, ...e), n = Math.max(s, C(this.decimalMultiplier)), i = A(n), o = e.reduce(
const s = m(this, B, F).call(this, this, ...e), n = Math.max(s, C(this.decimalMultiplier)), a = A(n), o = e.reduce(
(u, h) => {

@@ -847,7 +851,7 @@ const l = this.getBigIntValue(h, n);

case "mul":
return u * l / i;
return u * l / a;
case "div": {
if (l === 0n)
throw new RangeError("Division by zero");
return u * i / l;
return u * a / l;
}

@@ -859,3 +863,3 @@ default:

//normalize is to precision multiplier base
this.bigIntValue * i / this.decimalMultiplier
this.bigIntValue * a / this.decimalMultiplier
), c = N({

@@ -873,24 +877,24 @@ bigIntDecimal: n,

}, w = new WeakSet(), S = function(t, ...e) {
const s = m(this, M, F).call(this, this, ...e), n = this.getBigIntValue(e[0], s), i = this.getBigIntValue(this, s);
const s = m(this, B, F).call(this, this, ...e), n = this.getBigIntValue(e[0], s), a = this.getBigIntValue(this, s);
switch (t) {
case "gt":
return i > n;
return a > n;
case "gte":
return i >= n;
return a >= n;
case "lt":
return i < n;
return a < n;
case "lte":
return i <= n;
return a <= n;
case "eqValue":
return i === n;
return a === n;
}
}, j = new WeakSet(), mt = function(t) {
const e = k(t) || "0";
this.bigIntValue = m(this, B, G).call(this, e);
}, M = new WeakSet(), F = function(...t) {
this.bigIntValue = m(this, M, G).call(this, e);
}, B = new WeakSet(), F = function(...t) {
const e = t.map((s) => typeof s == "object" ? s.decimal || C(s.decimalMultiplier) : rt(k(s))).filter(Boolean);
return Math.max(...e, O);
}, B = new WeakSet(), G = function(t, e) {
const s = e ? A(e) : this.decimalMultiplier, n = C(s), [i = "", o = ""] = t.split(".");
return BigInt(`${i}${o.padEnd(n, "0")}`);
}, M = new WeakSet(), G = function(t, e) {
const s = e ? A(e) : this.decimalMultiplier, n = C(s), [a = "", o = ""] = t.split(".");
return BigInt(`${a}${o.padEnd(n, "0")}`);
};

@@ -962,4 +966,4 @@ let E = K;

static fromStringSync(e, s = 0) {
const { isSynthetic: n, symbol: i, chain: o, isGasAsset: c, ticker: u, address: h } = z(e);
console.log("isSynthetic: ", { isSynthetic: n, symbol: i, chain: o, isGasAsset: c, ticker: u, address: h });
const { isSynthetic: n, symbol: a, chain: o, isGasAsset: c, ticker: u, address: h } = z(e);
console.log("isSynthetic: ", { isSynthetic: n, symbol: a, chain: o, isGasAsset: c, ticker: u, address: h });
const {

@@ -976,11 +980,11 @@ tax: l,

static fromIdentifierSync(e, s = 0) {
const { decimal: n, identifier: i } = nt(e), o = V(s, n);
return new v({ decimal: n, identifier: i, value: o });
const { decimal: n, identifier: a } = nt(e), o = V(s, n);
return new v({ decimal: n, identifier: a, value: o });
}
static fromChainOrSignature(e, s = 0) {
const { decimal: n, identifier: i } = It(e);
if (!n || !i)
const { decimal: n, identifier: a } = It(e);
if (!n || !a)
throw Error("unknown coin! " + e);
const o = V(s, n);
return new v({ value: o, decimal: n, identifier: i });
return new v({ value: o, decimal: n, identifier: a });
}

@@ -995,6 +999,6 @@ static async loadStaticAssets() {

ThorchainList: n,
NativeList: i,
NativeList: a,
...o
} = await import("@coinmasters/tokens");
Y = [i, ...Object.values(o)].reduce(
Y = [a, ...Object.values(o)].reduce(
(u, { tokens: h }) => (h.forEach(({ identifier: l, chain: _, ...g }) => {

@@ -1020,15 +1024,15 @@ const $ = "decimals" in g ? g.decimals : d[_];

switch (r) {
case a.Bitcoin:
case a.Litecoin:
case a.Dash:
case a.Zcash:
case a.BitcoinCash:
case i.Bitcoin:
case i.Litecoin:
case i.Dash:
case i.Zcash:
case i.BitcoinCash:
return t.set(10001e-8);
case a.Dogecoin:
case i.Dogecoin:
return t.set(1.00000001);
case a.Avalanche:
case a.Ethereum:
case i.Avalanche:
case i.Ethereum:
return t.set(1e-8);
case a.THORChain:
case a.Maya:
case i.THORChain:
case i.Maya:
return t.set(0);

@@ -1039,7 +1043,7 @@ default:

}, z = (r) => {
const t = r.slice(0, 14).includes("/"), [e, s] = r.split(".").pop().split("/"), n = r.includes(".") && !t ? r : `${a.THORChain}.${s}`, [i, o] = n.split("."), [c, u] = (t ? s : o).split("-");
const t = r.slice(0, 14).includes("/"), [e, s] = r.split(".").pop().split("/"), n = r.includes(".") && !t ? r : `${i.THORChain}.${s}`, [a, o] = n.split("."), [c, u] = (t ? s : o).split("-");
return {
address: u == null ? void 0 : u.toLowerCase(),
chain: i,
isGasAsset: ot({ chain: i, symbol: o }),
chain: a,
isGasAsset: ot({ chain: a, symbol: o }),
isSynthetic: t,

@@ -1138,3 +1142,3 @@ symbol: (t ? `${e}/` : "") + (u ? `${c}-${(u == null ? void 0 : u.toLowerCase()) ?? ""}` : o),

ue as getAsymmetricAssetWithdrawAmount,
Bt as getAsymmetricRuneShare,
Mt as getAsymmetricRuneShare,
ce as getAsymmetricRuneWithdrawAmount,

@@ -1141,0 +1145,0 @@ It as getCommonAssetInfo,

@@ -11,5 +11,5 @@ {

"vitest": "0.34.6",
"@internal/config": "2.3.0",
"@coinmasters/types": "4.3.0",
"@coinmasters/tokens": "3.3.0"
"@coinmasters/tokens": "3.4.0",
"@internal/config": "2.4.0",
"@coinmasters/types": "4.4.0"
},

@@ -20,4 +20,4 @@ "eslintConfig": {

"peerDependencies": {
"@coinmasters/tokens": "3.3.0",
"@coinmasters/types": "4.3.0"
"@coinmasters/types": "4.4.0",
"@coinmasters/tokens": "3.4.0"
},

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

"types": "./dist/index.d.ts",
"version": "7.0.0",
"version": "8.0.0",
"scripts": {

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

@@ -87,15 +87,12 @@ import type { EVMChain } from '@coinmasters/types';

case Chain.Ethereum:
case Chain.Base:
case Chain.Avalanche:
return symbol === chain;
case Chain.Arbitrum:
case Chain.Optimism:
return 'ETH' === symbol;
case Chain.Maya:
return symbol === 'CACAO';
case Chain.Kujira:
return symbol === 'KUJI';
case Chain.Cosmos:

@@ -144,2 +141,3 @@ return symbol === 'ATOM';

case Chain.Bitcoin:
case Chain.Base:
case Chain.Ethereum:

@@ -179,3 +177,4 @@ return { identifier: `${assetString}.${assetString}`, decimal: BaseDecimal[assetString] };

return symbol === Chain.Polygon ? 'Native' : 'POLYGON';
case Chain.Base:
return 'Native';
case Chain.Arbitrum:

@@ -182,0 +181,0 @@ return [Chain.Ethereum, Chain.Arbitrum].includes(symbol as Chain) ? 'Native' : 'ARBITRUM';

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