@swapkit/helpers
Advanced tools
Comparing version 1.0.0-rc.15 to 1.0.0-rc.16
@@ -16,4 +16,8 @@ var bt = Object.defineProperty; | ||
try { | ||
const { result: e } = await Kt.post(At[s], { | ||
headers: { accept: "*/*", "cache-control": "no-cache" }, | ||
const { result: e } = await Qt.post(At[s], { | ||
headers: { | ||
accept: "*/*", | ||
"content-type": "application/json", | ||
"cache-control": "no-cache" | ||
}, | ||
body: JSON.stringify({ | ||
@@ -49,3 +53,3 @@ id: 44, | ||
} | ||
}, ee = { | ||
}, re = { | ||
[L.Average]: 1.2, | ||
@@ -139,3 +143,3 @@ [L.Fast]: 1.5, | ||
} | ||
}, re = (s) => { | ||
}, se = (s) => { | ||
var a; | ||
@@ -147,3 +151,3 @@ const [t, ...e] = s.split("."), r = s.includes("/"), n = e.join("."), i = (a = n == null ? void 0 : n.split("-")) == null ? void 0 : a[0]; | ||
"gmi" | ||
), se = (s) => s.filter( | ||
), ne = (s) => s.filter( | ||
(t) => !Et.test(t.toString()) && !t.toString().includes("undefined") | ||
@@ -164,3 +168,3 @@ ), Ot = ({ | ||
return h.div(g); | ||
}, ne = ({ | ||
}, ie = ({ | ||
percent: s, | ||
@@ -170,3 +174,3 @@ runeDepth: t, | ||
poolUnits: r | ||
}) => Ot({ runeDepth: t, liquidityUnits: e, poolUnits: r }).mul(s), ie = ({ | ||
}) => Ot({ runeDepth: t, liquidityUnits: e, poolUnits: r }).mul(s), oe = ({ | ||
percent: s, | ||
@@ -184,3 +188,3 @@ assetDepth: t, | ||
runeAmount: d(e).mul(s).div(t) | ||
}), oe = ({ | ||
}), ae = ({ | ||
liquidityUnits: s, | ||
@@ -195,3 +199,3 @@ poolUnits: t, | ||
) | ||
), ae = ({ | ||
), ce = ({ | ||
runeDepth: s, | ||
@@ -209,3 +213,3 @@ poolUnits: t, | ||
return D.div(gt).baseValueNumber; | ||
}, ce = ({ | ||
}, ue = ({ | ||
runeAmount: s, | ||
@@ -222,3 +226,3 @@ assetAmount: t, | ||
chain: e | ||
}) => e === "ETH" && t !== "ETH" ? `${t}-${s.slice(-3)}` : s, ue = (s, t) => { | ||
}) => e === "ETH" && t !== "ETH" ? `${t}-${s.slice(-3)}` : s, le = (s, t) => { | ||
switch (s) { | ||
@@ -254,7 +258,7 @@ case b.LEAVE: | ||
} | ||
}, le = (s) => { | ||
}, he = (s) => { | ||
if (s < 0) | ||
throw new Error("Invalid number of year"); | ||
return 10 + s; | ||
}, he = (s) => { | ||
}, de = (s) => { | ||
if (s.length > 30) | ||
@@ -264,3 +268,3 @@ return !1; | ||
return !!s.match(t); | ||
}, de = ([s, t, e, r, n]) => `${s}'/${t}'/${e}'/${r}${typeof n != "number" ? "" : `/${n}`}`; | ||
}, me = ([s, t, e, r, n]) => `${s}'/${t}'/${e}'/${r}${typeof n != "number" ? "" : `/${n}`}`; | ||
class Z extends Error { | ||
@@ -614,12 +618,6 @@ constructor(t, e, r) { | ||
return t.create = (e) => G(V(e)), t.extend = (e) => G(V(s, e)), t.stop = ut, t; | ||
}, zt = G(), Jt = zt, et = Jt.create({ | ||
headers: { | ||
referrer: "https://sk.thorswap.net", | ||
referer: "https://sk.thorswap.net", | ||
"Content-Type": "application/json" | ||
} | ||
}), Kt = { | ||
}, zt = G(), Jt = zt, Kt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, et = Jt.create({ headers: Kt }), Qt = { | ||
get: (s, t) => et.get(s, t).json(), | ||
post: (s, t) => et.post(s, t).json() | ||
}, rt = Object.values(o), Qt = (s = "") => { | ||
}, rt = Object.values(o), Xt = (s = "") => { | ||
const t = s.toUpperCase(), [e] = t.split("."); | ||
@@ -870,3 +868,3 @@ if (rt.includes(e)) | ||
}, st = async (s, t = 0) => { | ||
Qt(s); | ||
Xt(s); | ||
const e = await it(k(s)), r = M(t, e); | ||
@@ -964,3 +962,3 @@ return new _({ decimal: e, value: r, identifier: s }); | ||
} | ||
const me = (s) => { | ||
const fe = (s) => { | ||
const t = _.fromChainOrSignature(s); | ||
@@ -993,3 +991,3 @@ switch (s) { | ||
}; | ||
}, Xt = { | ||
}, Zt = { | ||
/** | ||
@@ -1053,3 +1051,3 @@ * Core | ||
constructor(t, e) { | ||
console.error(e), super(t, { cause: { code: Xt[t], message: t } }), Object.setPrototypeOf(this, mt.prototype); | ||
console.error(e), super(t, { cause: { code: Zt[t], message: t } }), Object.setPrototypeOf(this, mt.prototype); | ||
} | ||
@@ -1071,26 +1069,26 @@ } | ||
I as BigIntArithmetics, | ||
Kt as RequestClient, | ||
Qt as RequestClient, | ||
mt as SwapKitError, | ||
Q as SwapKitNumber, | ||
re as assetFromString, | ||
de as derivationPathToString, | ||
se as filterAssets, | ||
se as assetFromString, | ||
me as derivationPathToString, | ||
ne as filterAssets, | ||
x as formatBigIntToSafeValue, | ||
ee as gasFeeMultiplier, | ||
re as gasFeeMultiplier, | ||
It as getAssetType, | ||
Vt as getAsymmetricAssetShare, | ||
ie as getAsymmetricAssetWithdrawAmount, | ||
oe as getAsymmetricAssetWithdrawAmount, | ||
Ot as getAsymmetricRuneShare, | ||
ne as getAsymmetricRuneWithdrawAmount, | ||
ie as getAsymmetricRuneWithdrawAmount, | ||
Ct as getCommonAssetInfo, | ||
it as getDecimal, | ||
ae as getEstimatedPoolShare, | ||
ce as getLiquiditySlippage, | ||
ue as getMemoFor, | ||
me as getMinAmountByChain, | ||
ce as getEstimatedPoolShare, | ||
ue as getLiquiditySlippage, | ||
le as getMemoFor, | ||
fe as getMinAmountByChain, | ||
Bt as getSymmetricPoolShare, | ||
oe as getSymmetricWithdraw, | ||
le as getTHORNameCost, | ||
ae as getSymmetricWithdraw, | ||
he as getTHORNameCost, | ||
$t as isGasAsset, | ||
he as validateTHORName | ||
de as validateTHORName | ||
}; |
@@ -13,3 +13,3 @@ { | ||
"@swapkit/tokens": "1.0.0-rc.7", | ||
"@swapkit/types": "1.0.0-rc.6" | ||
"@swapkit/types": "1.0.0-rc.7" | ||
}, | ||
@@ -21,3 +21,3 @@ "eslintConfig": { | ||
"@swapkit/tokens": "1.0.0-rc.7", | ||
"@swapkit/types": "1.0.0-rc.6" | ||
"@swapkit/types": "1.0.0-rc.7" | ||
}, | ||
@@ -47,3 +47,3 @@ "exports": { | ||
"types": "./dist/index.d.ts", | ||
"version": "1.0.0-rc.15", | ||
"version": "1.0.0-rc.16", | ||
"scripts": { | ||
@@ -50,0 +50,0 @@ "build": "vite build", |
@@ -13,3 +13,7 @@ import type { EVMChain } from '@swapkit/types'; | ||
const { result } = await RequestClient.post<{ result: string }>(ChainToRPC[chain], { | ||
headers: { accept: '*/*', 'cache-control': 'no-cache' }, | ||
headers: { | ||
accept: '*/*', | ||
'content-type': 'application/json', | ||
'cache-control': 'no-cache', | ||
}, | ||
body: JSON.stringify({ | ||
@@ -16,0 +20,0 @@ id: 44, |
import type { Options } from 'ky'; | ||
import ky from 'ky'; | ||
const kyClient = ky.create({ | ||
headers: { | ||
referrer: 'https://sk.thorswap.net', | ||
referer: 'https://sk.thorswap.net', | ||
'Content-Type': 'application/json', | ||
}, | ||
}); | ||
const headers = | ||
typeof window !== 'undefined' | ||
? {} | ||
: { referrer: 'https://sk.thorswap.net', referer: 'https://sk.thorswap.net' }; | ||
const kyClient = ky.create({ headers }); | ||
export const RequestClient = { | ||
@@ -13,0 +12,0 @@ get: <T>(url: string | URL | Request, options?: Options) => kyClient.get(url, options).json<T>(), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
193439