@dhedge/trading-widget 5.4.0-canary.2 → 5.4.0
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/complex-withdraw-asset-data-ColnUVfL.cjs +1 -0
- package/complex-withdraw-asset-data-CsznXzIE.js +390 -0
- package/const.cjs +1 -0
- package/const.d.ts +1 -0
- package/const.js +81 -0
- package/core-kit/const/gmx.d.ts +1 -0
- package/core-kit/const/network.d.ts +2 -64
- package/core-kit/hooks/trading/withdraw-v2/complete-step/use-complete-withdraw-tracked-assets.d.ts +1 -0
- package/core-kit/hooks/trading/withdraw-v2/init-step/use-init-withdraw-estimated-receive-assets.d.ts +1 -0
- package/core-kit/hooks/trading/withdraw-v2/use-withdraw-assets-info.d.ts +1 -0
- package/core-kit/types/trading.types.d.ts +1 -1
- package/index.cjs +1 -1
- package/index.d.ts +1 -1
- package/index.js +3945 -8853
- package/package.json +16 -1
- package/storage-DL2GNx3e.js +4721 -0
- package/storage-Dk8i88bn.cjs +1 -0
- package/trading-widget/components/widget/widget-overlay/withdraw-stepper-overlay/withdraw-stepper-overlay.hooks.d.ts +2 -0
- package/trading-widget/components/withdraw/complete-step/balance/complete-withdraw-balance.hooks.d.ts +1 -0
- package/types.cjs +1 -0
- package/types.d.ts +1 -0
- package/types.js +1 -0
- package/utils.cjs +1 -0
- package/utils.d.ts +1 -0
- package/utils.js +54 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("bignumber.js"),s=require("./storage-Dk8i88bn.cjs"),m=require("viem"),P=()=>typeof window<"u";function x(){return P()&&typeof window.ethereum<"u"}async function U(t){try{if(x())return window.ethereum.request({method:"wallet_watchAsset",params:{type:"ERC20",options:t}})}catch{return!1}return!1}const l=(t,e)=>t?.toLowerCase()===e?.toLowerCase(),$=t=>l(t,s.AddressZero$1),N=(t,e)=>s.contractsAddressesMap[e]?.[t]??s.AddressZero,G=t=>s.contractsAbisMap[t],W=t=>t&&`${t.substring(0,6)}...${t.substring(t.length-4,t.length)}`,K=({address:t,chainId:e})=>{const r=N("aaveLendingPoolV3",e);return l(t,r)},y=({sourceAddress:t,amount:e})=>`${t}_${e}`,V=(t,e)=>{const r=t.slice(0,e),n=t.slice(e);return{firstPart:r,secondPart:n}},w=(t,e)=>t/e*100,Y=t=>t<1?4:t<10?3:2,Z=(t,e=s.DEFAULT_PRECISION)=>new c(t.toString()).shiftedBy(e).toFixed(0),H=(t,e,r,n)=>new c(e).dividedBy(r).multipliedBy(t).shiftedBy(-(n||s.DEFAULT_PRECISION)).toNumber(),k=t=>BigInt(new c(t||"0").shiftedBy(s.DEFAULT_PRECISION).toFixed(0,c.ROUND_DOWN)),Q=t=>{const e=new c(.01),r=new c(t),n=!r.isZero()&&r.lt(e)?e:r;return BigInt(n.multipliedBy(100).toFixed(0))},q=({vaultAddress:t,swapData:e,sendTokenAddress:r,sendTokenAmount:n,vaultDepositTokenAddress:o,minVaultTokensReceivedAmount:a,routerKey:i="ONE_INCH",swapDestinationAmount:d,swapSlippage:A})=>{const u=new c(d).multipliedBy(1-A/100).toFixed(0),g=[m.stringToHex(i,{size:32}),e];return[t,[[r,n,g],[o,u]],a]},z=({receiveAssetAddress:t,assets:e,swapData:r})=>{const n={srcData:[],destAmount:new c("0")},{srcData:o}=e?.reduce((a,i)=>{const d=r?.[i.address];if(!d)return a;const A=[m.stringToHex(d.routerKey,{size:32}),d.rawTransaction.data],u=[i.address,i.rawBalance,A];return{srcData:[...a.srcData,u],destAmount:a.destAmount.plus(d.destinationAmount)}},n)??n;return[o,[t,"0"]]},h=({assetAddress:t,swapQuotes:e,swapParams:r,slippageToleranceForContractTransaction:n,routerKey:o})=>{if(!r)return{supportedAsset:t,withdrawData:"",slippageTolerance:BigInt(0)};const{srcData:a,dstData:i}=r,d=a.map(({asset:g,amount:T})=>{const S=e?.[y({sourceAddress:g,amount:T.toString()})]?.find(M=>M.routerKey===o);return{asset:g,amount:T,swapData:{routerKey:m.stringToHex(S?.routerKey??"",{size:32}),txData:S?.rawTransaction.data??"0x"}}}),A=m.encodeAbiParameters(s.ComplexWithdrawalAssetSrcDataAbiItem,[d]),u=m.encodeAbiParameters(s.ComplexWithdrawalDataAbiItem,[{encodedSrcData:A,dstData:{dstAddress:i.asset,dstAmount:i.amount},slippage:n}]);return{supportedAsset:t,withdrawData:u,slippageTolerance:n}},j=(t,e)=>s.CHAIN_NATIVE_TOKENS[e]?.nativeTokenSymbol===t,X=({nativeTokenBalance:t,tokenDecimals:e,gasPrice:r})=>{const n=new c(r).multipliedBy(s.NATIVE_TOKEN_DEPOSIT_GAS_LIMIT).shiftedBy(-e),o=new c(t).minus(n);return o.gt("0")?o:new c("0")},J=t=>s.STABLE_TOKEN_SYMBOLS.includes(t),tt=t=>{const e=Object.values(t).reduce((r,{type:n})=>(r[n]=r[n]+1,r),{string:0,number:0});if(e.string>10)throw new Error("logger params must contain up to 10 string values");if(e.number>40)throw new Error("logger params must contain up to 40 numeric values");return!0},et=(t,e=150)=>t.length>e?t.substring(0,e):t,E=(t,e=s.TRANSACTION_ERROR_KEYS)=>{const r=t.toLowerCase();return e.sort((n,o)=>o.length-n.length).find(n=>r.includes(n.toLowerCase()))},D=t=>s.TRANSACTION_ERRORS[t]??s.LIMIT_ORDER_TRANSACTION_ERRORS[t],rt=({errorMessage:t,abiErrors:e})=>{if(!t||t.includes("User rejected"))return null;const r=e.find(a=>t.includes(a));if(r&&E(r))return D(r);const n=E(t);if(n)return D(n);const[o]=t.split(r?".":"Contract").map(a=>a.trim());return{title:"Transaction failed",hint:`${et(o??"")} ${r?`: ${r}`:""}`}},nt=t=>typeof t=="bigint"&&t!==BigInt(0),B=(t,e=s.DEFAULT_PRECISION$1)=>new c(t).shiftedBy(-e).toNumber(),I=t=>!isNaN(parseFloat(t))&&!isNaN(t),L=({value:t,minimumFractionDigits:e=2,maximumFractionDigits:r=2,compact:n=!1,normalize:o=!1})=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:n?"compact":void 0,minimumFractionDigits:e,maximumFractionDigits:r}).format(o?B(t):Number(t)),_=t=>I(t)?new c(t).toFixed():"",f=["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"],R=({value:t,decimals:e})=>{const r=new c(t);if(r.isGreaterThan(1)||r.isZero())return _(r.toFixed(e));const o=(/e/i.test(t.toString())?parseFloat(t.toString()).toFixed(s.DEFAULT_PRECISION$1):t.toString()).match(/^0\.(0+)(\d+)$/);if(o){const[,a,i]=o;if(a.length>=e&&a.length<f.length)return`0.0${f[a.length]}${i.slice(0,3)}`}return _(r.toFixed(e))},C=(t,e=0)=>`${t.toLocaleString("en-US",{maximumFractionDigits:e})}%`,st=t=>t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),ot=(t,e,r=0)=>{const n=w(+t,e);return C(n,r)},at=({currency:t,value:e})=>t==="USD"?L({value:e}):`${s.CURRENCY_SYMBOL_MAP[t]} ${R({value:e,decimals:s.CURRENCY_DECIMALS_MAP[t]})}`,b=(t,e)=>new c(new c(t).toFixed(e,c.ROUND_DOWN)).toString(),O=(t,e=3,r=2)=>{if(t.length<=5)return t;const n="...";return t.length<=e+r+n.length?t:`${t.slice(0,e)}${n}${t.slice(-r)}`},it=({balance:t,symbol:e,precision:r,truncateSymbol:n})=>`${b(t,r)} ${n?O(e):e}`,ct=t=>{if(!t)return;const e=t.match(/0x[a-fA-F0-9]{64}/);if(!e)return;const r=e[0];return`${r.slice(0,4)}...${r.slice(-3)}`},p=typeof window<"u",dt=t=>l(s.FLATMONEY_EARLY_DEPOSITOR_VAULT_ADDRESS_BASE,t)||l(s.FLATMONEY_DHT_STAKING_VAULT_ADDRESS_BASE,t),At=t=>s.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES.some(e=>l(e,t)),lt=t=>s.FLAT_MONEY_COLLATERAL_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:s.AddressZero},ut=t=>l(t,s.FLAT_MONEY_V1_UNIT_ADDRESS)?s.FLAT_MONEY_V1_UNIT_LINK:s.FLAT_MONEY_UNIT_LINK,F=t=>`eth_${t}`,mt=({action:t,log:e,symbol:r,vaultAddress:n,chainId:o})=>{const a={[s.TRADING_LOG_EVENT_PARAM.SYMBOL.NAME]:r,[s.TRADING_LOG_EVENT_PARAM.CHAIN_ID.NAME]:o,[s.TRADING_LOG_EVENT_PARAM.ADDRESS.NAME]:F(n)};s.LOG_EVENT_BY_TRANSACTION_ACTION_MAP[t].forEach(i=>{e?.(i,a)})},gt=t=>s.GMX_MARKET_ASSETS.some(e=>l(e,t)),Tt=t=>s.GMX_WITHDRAW_ASSET_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:s.AddressZero},St=t=>s.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS[t.toLowerCase()];function Et(){if(p)try{const t=localStorage.getItem(s.LOCAL_STORAGE_KEYS.IS_BATCH_TRANSACTIONS_ENABLED);return t?JSON.parse(t):void 0}catch{return}}function _t(t){if(p)try{localStorage.setItem(s.LOCAL_STORAGE_KEYS.IS_BATCH_TRANSACTIONS_ENABLED,JSON.stringify(t))}catch(e){console.error("[core-kit]: Failed to persist batch transactions setting",e)}}const pt=t=>{const e=t.find(({swapQuotes:r})=>r);return e?.swapQuotes?Object.values(e.swapQuotes)[0]?.map(({routerKey:r})=>r)??[]:[]},v=(t,e,r)=>t.map(({asset:n,swapParams:o,swapQuotes:a})=>!o||!a?{supportedAsset:n,withdrawData:"",slippageTolerance:r}:h({assetAddress:n,swapQuotes:a,swapParams:o,slippageToleranceForContractTransaction:r,routerKey:e})),Dt=async(t,e,r,n,o)=>{for(const a of t){const i=v(e,a,r),{error:d}=await n(...o,i);if(!d)return i}return null},ft=(t,e)=>(t??[]).map(r=>({supportedAsset:r,withdrawData:"",slippageTolerance:e})),Nt=async(t,e,{fetchAaveSwapParams:r,fetchAaveSwapQuotes:n,withdrawAmountD18:o,slippage:a})=>Promise.all((t??[]).map(async i=>{if(!l(i,e))return{asset:i};try{const A=await r({withdrawAmountD18:o,slippage:a});if(A?.srcData.length){const u=await n({swapParams:A,slippage:a});return{asset:i,swapParams:A,swapQuotes:u}}return{asset:i}}catch(A){return console.error(A),{asset:i}}}));exports.addTokenToWallet=U;exports.buildAaveWithdrawAssetTransactionData=h;exports.buildComplexAssetDataForRouter=v;exports.buildSwapQuoteKeyForAave=y;exports.buildSwapWithdrawTransactionData=z;exports.buildZapDepositTransactionArguments=q;exports.clientSide=p;exports.commify=st;exports.createDefaultComplexAssetData=ft;exports.enrichAssetsWithSwapQuotes=Nt;exports.extractAvailableRouterKeys=pt;exports.formatBalance=b;exports.formatByCurrency=at;exports.formatNumberToLimitedDecimals=R;exports.formatNumeratorToPercentage=ot;exports.formatPercentage=C;exports.formatToUsd=L;exports.formatTokenBalance=it;exports.getContractAbiById=G;exports.getContractAddressById=N;exports.getConventionalTokenPriceDecimals=Y;exports.getErrorKey=E;exports.getFlatMoneyCollateralByLeverageAddress=lt;exports.getFlatMoneyLinkByUnitAddress=ut;exports.getGmxWithdrawAssetByLeverageAddress=Tt;exports.getGmxWithdrawAssetByVaultAddress=St;exports.getNativeTokenInvestableBalance=X;exports.getPercent=w;exports.getPoolFraction=H;exports.getSlippageToleranceForContractTransaction=Q;exports.getStoredBatchTransactionsEnabled=Et;exports.getTxHashShort=ct;exports.isAaveLendAndBorrowAsset=K;exports.isEqualAddress=l;exports.isFlatMoneyLeveragedAsset=At;exports.isFmpAirdropVaultAddress=dt;exports.isGmxLeveragedAsset=gt;exports.isNativeToken=j;exports.isNumeric=I;exports.isStableSymbol=J;exports.isZeroAddress=$;exports.logTransactionByActionType=mt;exports.nonZeroBigInt=nt;exports.normalizeNumber=B;exports.parseAmountToD18=k;exports.parseContractErrorMessage=rt;exports.persistBatchTransactionsEnabled=_t;exports.removeInsignificantTrailingZeros=_;exports.shiftBy=Z;exports.shortenAddress=W;exports.sliceByIndex=V;exports.transformAddressForAnalytics=F;exports.truncateString=O;exports.tryEstimateWithRouters=Dt;exports.validateLoggerEventParams=tt;
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import i from "bignumber.js";
|
|
2
|
+
import { ai as B, ag as R, ah as O, b as T, p as _, aj as C, ak as b, a3 as F, c as M, a7 as v, ac as P, ab as x, Y as $, al as h, f as U, e as K, L as Y, Q as V, O as W, am as G, an as H, P as Z, M as k, a9 as S, _ as Q, V as j, W as z, T as X, Z as y } from "./storage-DL2GNx3e.js";
|
|
3
|
+
import { stringToHex as p, encodeAbiParameters as f } from "viem";
|
|
4
|
+
const q = () => typeof window < "u";
|
|
5
|
+
function J() {
|
|
6
|
+
return q() && typeof window.ethereum < "u";
|
|
7
|
+
}
|
|
8
|
+
async function _t(t) {
|
|
9
|
+
try {
|
|
10
|
+
if (J())
|
|
11
|
+
return window.ethereum.request({
|
|
12
|
+
method: "wallet_watchAsset",
|
|
13
|
+
params: {
|
|
14
|
+
type: "ERC20",
|
|
15
|
+
options: t
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
} catch {
|
|
19
|
+
return !1;
|
|
20
|
+
}
|
|
21
|
+
return !1;
|
|
22
|
+
}
|
|
23
|
+
const d = (t, e) => t?.toLowerCase() === e?.toLowerCase(), pt = (t) => d(t, B), tt = (t, e) => O[e]?.[t] ?? T, ft = (t) => R[t], Et = (t) => t && `${t.substring(0, 6)}...${t.substring(
|
|
24
|
+
t.length - 4,
|
|
25
|
+
t.length
|
|
26
|
+
)}`, Dt = ({
|
|
27
|
+
address: t,
|
|
28
|
+
chainId: e
|
|
29
|
+
}) => {
|
|
30
|
+
const s = tt(
|
|
31
|
+
"aaveLendingPoolV3",
|
|
32
|
+
e
|
|
33
|
+
);
|
|
34
|
+
return d(t, s);
|
|
35
|
+
}, et = ({
|
|
36
|
+
sourceAddress: t,
|
|
37
|
+
amount: e
|
|
38
|
+
}) => `${t}_${e}`, Nt = (t, e) => {
|
|
39
|
+
const s = t.slice(0, e), a = t.slice(e);
|
|
40
|
+
return { firstPart: s, secondPart: a };
|
|
41
|
+
}, st = (t, e) => t / e * 100, wt = (t) => t < 1 ? 4 : t < 10 ? 3 : 2, ht = (t, e = _) => new i(t.toString()).shiftedBy(e).toFixed(0), yt = (t, e, s, a) => new i(e).dividedBy(s).multipliedBy(t).shiftedBy(-(a || _)).toNumber(), It = (t) => BigInt(
|
|
42
|
+
new i(t || "0").shiftedBy(_).toFixed(0, i.ROUND_DOWN)
|
|
43
|
+
), Lt = (t) => {
|
|
44
|
+
const e = new i(0.01), s = new i(t), a = !s.isZero() && s.lt(e) ? e : s;
|
|
45
|
+
return BigInt(a.multipliedBy(100).toFixed(0));
|
|
46
|
+
}, Bt = ({
|
|
47
|
+
vaultAddress: t,
|
|
48
|
+
swapData: e,
|
|
49
|
+
sendTokenAddress: s,
|
|
50
|
+
sendTokenAmount: a,
|
|
51
|
+
vaultDepositTokenAddress: n,
|
|
52
|
+
minVaultTokensReceivedAmount: r,
|
|
53
|
+
routerKey: o = "ONE_INCH",
|
|
54
|
+
swapDestinationAmount: c,
|
|
55
|
+
swapSlippage: u
|
|
56
|
+
}) => {
|
|
57
|
+
const l = new i(c).multipliedBy(1 - u / 100).toFixed(0), A = [p(o, { size: 32 }), e];
|
|
58
|
+
return [t, [[s, a, A], [n, l]], r];
|
|
59
|
+
}, Rt = ({
|
|
60
|
+
receiveAssetAddress: t,
|
|
61
|
+
assets: e,
|
|
62
|
+
swapData: s
|
|
63
|
+
}) => {
|
|
64
|
+
const a = {
|
|
65
|
+
srcData: [],
|
|
66
|
+
destAmount: new i("0")
|
|
67
|
+
}, { srcData: n } = e?.reduce((r, o) => {
|
|
68
|
+
const c = s?.[o.address];
|
|
69
|
+
if (!c)
|
|
70
|
+
return r;
|
|
71
|
+
const u = [
|
|
72
|
+
p(c.routerKey, { size: 32 }),
|
|
73
|
+
c.rawTransaction.data
|
|
74
|
+
], l = [o.address, o.rawBalance, u];
|
|
75
|
+
return {
|
|
76
|
+
srcData: [...r.srcData, l],
|
|
77
|
+
destAmount: r.destAmount.plus(c.destinationAmount)
|
|
78
|
+
};
|
|
79
|
+
}, a) ?? a;
|
|
80
|
+
return [
|
|
81
|
+
n,
|
|
82
|
+
[
|
|
83
|
+
t,
|
|
84
|
+
// destAmount.times(1 - slippage / 100).toFixed(0, BigNumber.ROUND_DOWN),
|
|
85
|
+
// Use 0 to allow swaps with incorrectly increased destination amounts. Slippage protection is handled at a higher level using minExpectedReceiveAmount.
|
|
86
|
+
"0"
|
|
87
|
+
]
|
|
88
|
+
];
|
|
89
|
+
}, at = ({
|
|
90
|
+
assetAddress: t,
|
|
91
|
+
swapQuotes: e,
|
|
92
|
+
swapParams: s,
|
|
93
|
+
slippageToleranceForContractTransaction: a,
|
|
94
|
+
routerKey: n
|
|
95
|
+
}) => {
|
|
96
|
+
if (!s)
|
|
97
|
+
return {
|
|
98
|
+
supportedAsset: t,
|
|
99
|
+
withdrawData: "",
|
|
100
|
+
slippageTolerance: BigInt(0)
|
|
101
|
+
};
|
|
102
|
+
const { srcData: r, dstData: o } = s, c = r.map(({ asset: A, amount: m }) => {
|
|
103
|
+
const g = e?.[et({
|
|
104
|
+
sourceAddress: A,
|
|
105
|
+
amount: m.toString()
|
|
106
|
+
})]?.find((L) => L.routerKey === n);
|
|
107
|
+
return {
|
|
108
|
+
asset: A,
|
|
109
|
+
amount: m,
|
|
110
|
+
swapData: {
|
|
111
|
+
routerKey: p(g?.routerKey ?? "", { size: 32 }),
|
|
112
|
+
txData: g?.rawTransaction.data ?? "0x"
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}), u = f(
|
|
116
|
+
C,
|
|
117
|
+
[c]
|
|
118
|
+
), l = f(b, [
|
|
119
|
+
{
|
|
120
|
+
encodedSrcData: u,
|
|
121
|
+
dstData: {
|
|
122
|
+
dstAddress: o.asset,
|
|
123
|
+
dstAmount: o.amount
|
|
124
|
+
},
|
|
125
|
+
slippage: a
|
|
126
|
+
}
|
|
127
|
+
]);
|
|
128
|
+
return {
|
|
129
|
+
supportedAsset: t,
|
|
130
|
+
withdrawData: l,
|
|
131
|
+
slippageTolerance: a
|
|
132
|
+
};
|
|
133
|
+
}, Ot = (t, e) => M[e]?.nativeTokenSymbol === t, Ct = ({
|
|
134
|
+
nativeTokenBalance: t,
|
|
135
|
+
tokenDecimals: e,
|
|
136
|
+
gasPrice: s
|
|
137
|
+
}) => {
|
|
138
|
+
const a = new i(s).multipliedBy(F).shiftedBy(-e), n = new i(t).minus(
|
|
139
|
+
a
|
|
140
|
+
);
|
|
141
|
+
return n.gt("0") ? n : new i("0");
|
|
142
|
+
}, bt = (t) => v.includes(t), Ft = (t) => {
|
|
143
|
+
const e = Object.values(t).reduce(
|
|
144
|
+
(s, { type: a }) => (s[a] = s[a] + 1, s),
|
|
145
|
+
{ string: 0, number: 0 }
|
|
146
|
+
);
|
|
147
|
+
if (e.string > 10)
|
|
148
|
+
throw new Error("logger params must contain up to 10 string values");
|
|
149
|
+
if (e.number > 40)
|
|
150
|
+
throw new Error("logger params must contain up to 40 numeric values");
|
|
151
|
+
return !0;
|
|
152
|
+
}, nt = (t, e = 150) => t.length > e ? t.substring(0, e) : t, E = (t, e = P) => {
|
|
153
|
+
const s = t.toLowerCase();
|
|
154
|
+
return e.sort((a, n) => n.length - a.length).find((a) => s.includes(a.toLowerCase()));
|
|
155
|
+
}, D = (t) => x[t] ?? $[t], Mt = ({
|
|
156
|
+
errorMessage: t,
|
|
157
|
+
abiErrors: e
|
|
158
|
+
}) => {
|
|
159
|
+
if (!t || t.includes("User rejected"))
|
|
160
|
+
return null;
|
|
161
|
+
const s = e.find((r) => t.includes(r));
|
|
162
|
+
if (s && E(s))
|
|
163
|
+
return D(s);
|
|
164
|
+
const a = E(t);
|
|
165
|
+
if (a)
|
|
166
|
+
return D(a);
|
|
167
|
+
const [n] = t.split(s ? "." : "Contract").map((r) => r.trim());
|
|
168
|
+
return {
|
|
169
|
+
title: "Transaction failed",
|
|
170
|
+
hint: `${nt(n ?? "")} ${s ? `: ${s}` : ""}`
|
|
171
|
+
};
|
|
172
|
+
}, vt = (t) => typeof t == "bigint" && t !== BigInt(0), rt = (t, e = h) => new i(t).shiftedBy(-e).toNumber(), ot = (t) => !isNaN(parseFloat(t)) && !isNaN(t), it = ({
|
|
173
|
+
value: t,
|
|
174
|
+
minimumFractionDigits: e = 2,
|
|
175
|
+
maximumFractionDigits: s = 2,
|
|
176
|
+
compact: a = !1,
|
|
177
|
+
normalize: n = !1
|
|
178
|
+
}) => new Intl.NumberFormat("en-US", {
|
|
179
|
+
style: "currency",
|
|
180
|
+
currency: "USD",
|
|
181
|
+
notation: a ? "compact" : void 0,
|
|
182
|
+
minimumFractionDigits: e,
|
|
183
|
+
maximumFractionDigits: s
|
|
184
|
+
}).format(n ? rt(t) : Number(t)), N = (t) => ot(t) ? new i(t).toFixed() : "", w = ["₀", "₁", "₂", "₃", "₄", "₅", "₆", "₇", "₈", "₉"], ct = ({
|
|
185
|
+
value: t,
|
|
186
|
+
decimals: e
|
|
187
|
+
}) => {
|
|
188
|
+
const s = new i(t);
|
|
189
|
+
if (s.isGreaterThan(1) || s.isZero())
|
|
190
|
+
return N(s.toFixed(e));
|
|
191
|
+
const n = (/e/i.test(t.toString()) ? parseFloat(t.toString()).toFixed(h) : t.toString()).match(/^0\.(0+)(\d+)$/);
|
|
192
|
+
if (n) {
|
|
193
|
+
const [, r, o] = n;
|
|
194
|
+
if (r.length >= e && r.length < w.length)
|
|
195
|
+
return `0.0${w[r.length]}${o.slice(0, 3)}`;
|
|
196
|
+
}
|
|
197
|
+
return N(s.toFixed(e));
|
|
198
|
+
}, ut = (t, e = 0) => `${t.toLocaleString("en-US", { maximumFractionDigits: e })}%`, Pt = (t) => t.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), xt = (t, e, s = 0) => {
|
|
199
|
+
const a = st(+t, e);
|
|
200
|
+
return ut(a, s);
|
|
201
|
+
}, $t = ({
|
|
202
|
+
currency: t,
|
|
203
|
+
value: e
|
|
204
|
+
}) => t === "USD" ? it({ value: e }) : `${U[t]} ${ct({
|
|
205
|
+
value: e,
|
|
206
|
+
decimals: K[t]
|
|
207
|
+
})}`, dt = (t, e) => new i(
|
|
208
|
+
new i(t).toFixed(e, i.ROUND_DOWN)
|
|
209
|
+
).toString(), lt = (t, e = 3, s = 2) => {
|
|
210
|
+
if (t.length <= 5)
|
|
211
|
+
return t;
|
|
212
|
+
const a = "...";
|
|
213
|
+
return t.length <= e + s + a.length ? t : `${t.slice(0, e)}${a}${t.slice(-s)}`;
|
|
214
|
+
}, Ut = ({
|
|
215
|
+
balance: t,
|
|
216
|
+
symbol: e,
|
|
217
|
+
precision: s,
|
|
218
|
+
truncateSymbol: a
|
|
219
|
+
}) => `${dt(t, s)} ${a ? lt(e) : e}`, Kt = (t) => {
|
|
220
|
+
if (!t)
|
|
221
|
+
return;
|
|
222
|
+
const e = t.match(/0x[a-fA-F0-9]{64}/);
|
|
223
|
+
if (!e)
|
|
224
|
+
return;
|
|
225
|
+
const s = e[0];
|
|
226
|
+
return `${s.slice(0, 4)}...${s.slice(-3)}`;
|
|
227
|
+
}, I = typeof window < "u", Yt = (t) => d(G, t) || d(H, t), Vt = (t) => k.some(
|
|
228
|
+
(e) => d(e, t)
|
|
229
|
+
), Wt = (t) => Y[t.toLowerCase()] ?? {
|
|
230
|
+
symbol: "",
|
|
231
|
+
decimals: 18,
|
|
232
|
+
address: T
|
|
233
|
+
}, Gt = (t) => d(t, Z) ? V : W, At = (t) => `eth_${t}`, Ht = ({
|
|
234
|
+
action: t,
|
|
235
|
+
log: e,
|
|
236
|
+
symbol: s,
|
|
237
|
+
vaultAddress: a,
|
|
238
|
+
chainId: n
|
|
239
|
+
}) => {
|
|
240
|
+
const r = {
|
|
241
|
+
[S.SYMBOL.NAME]: s,
|
|
242
|
+
[S.CHAIN_ID.NAME]: n,
|
|
243
|
+
[S.ADDRESS.NAME]: At(a)
|
|
244
|
+
};
|
|
245
|
+
Q[t].forEach((o) => {
|
|
246
|
+
e?.(o, r);
|
|
247
|
+
});
|
|
248
|
+
}, Zt = (t) => X.some((e) => d(e, t)), kt = (t) => j[t.toLowerCase()] ?? {
|
|
249
|
+
symbol: "",
|
|
250
|
+
decimals: 18,
|
|
251
|
+
address: T
|
|
252
|
+
}, Qt = (t) => z[t.toLowerCase()];
|
|
253
|
+
function jt() {
|
|
254
|
+
if (I)
|
|
255
|
+
try {
|
|
256
|
+
const t = localStorage.getItem(
|
|
257
|
+
y.IS_BATCH_TRANSACTIONS_ENABLED
|
|
258
|
+
);
|
|
259
|
+
return t ? JSON.parse(t) : void 0;
|
|
260
|
+
} catch {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function zt(t) {
|
|
265
|
+
if (I)
|
|
266
|
+
try {
|
|
267
|
+
localStorage.setItem(
|
|
268
|
+
y.IS_BATCH_TRANSACTIONS_ENABLED,
|
|
269
|
+
JSON.stringify(t)
|
|
270
|
+
);
|
|
271
|
+
} catch (e) {
|
|
272
|
+
console.error("[core-kit]: Failed to persist batch transactions setting", e);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const Xt = (t) => {
|
|
276
|
+
const e = t.find(
|
|
277
|
+
({ swapQuotes: s }) => s
|
|
278
|
+
);
|
|
279
|
+
return e?.swapQuotes ? Object.values(e.swapQuotes)[0]?.map(
|
|
280
|
+
({ routerKey: s }) => s
|
|
281
|
+
) ?? [] : [];
|
|
282
|
+
}, mt = (t, e, s) => t.map(({ asset: a, swapParams: n, swapQuotes: r }) => !n || !r ? {
|
|
283
|
+
supportedAsset: a,
|
|
284
|
+
withdrawData: "",
|
|
285
|
+
slippageTolerance: s
|
|
286
|
+
} : at({
|
|
287
|
+
assetAddress: a,
|
|
288
|
+
swapQuotes: r,
|
|
289
|
+
swapParams: n,
|
|
290
|
+
slippageToleranceForContractTransaction: s,
|
|
291
|
+
routerKey: e
|
|
292
|
+
})), qt = async (t, e, s, a, n) => {
|
|
293
|
+
for (const r of t) {
|
|
294
|
+
const o = mt(
|
|
295
|
+
e,
|
|
296
|
+
r,
|
|
297
|
+
s
|
|
298
|
+
), { error: c } = await a(...n, o);
|
|
299
|
+
if (!c)
|
|
300
|
+
return o;
|
|
301
|
+
}
|
|
302
|
+
return null;
|
|
303
|
+
}, Jt = (t, e) => (t ?? []).map((s) => ({
|
|
304
|
+
supportedAsset: s,
|
|
305
|
+
withdrawData: "",
|
|
306
|
+
slippageTolerance: e
|
|
307
|
+
})), te = async (t, e, {
|
|
308
|
+
fetchAaveSwapParams: s,
|
|
309
|
+
fetchAaveSwapQuotes: a,
|
|
310
|
+
withdrawAmountD18: n,
|
|
311
|
+
slippage: r
|
|
312
|
+
}) => Promise.all(
|
|
313
|
+
(t ?? []).map(async (o) => {
|
|
314
|
+
if (!d(o, e))
|
|
315
|
+
return { asset: o };
|
|
316
|
+
try {
|
|
317
|
+
const u = await s({
|
|
318
|
+
withdrawAmountD18: n,
|
|
319
|
+
slippage: r
|
|
320
|
+
});
|
|
321
|
+
if (u?.srcData.length) {
|
|
322
|
+
const l = await a({
|
|
323
|
+
swapParams: u,
|
|
324
|
+
slippage: r
|
|
325
|
+
});
|
|
326
|
+
return { asset: o, swapParams: u, swapQuotes: l };
|
|
327
|
+
}
|
|
328
|
+
return { asset: o };
|
|
329
|
+
} catch (u) {
|
|
330
|
+
return console.error(u), { asset: o };
|
|
331
|
+
}
|
|
332
|
+
})
|
|
333
|
+
);
|
|
334
|
+
export {
|
|
335
|
+
Pt as $,
|
|
336
|
+
Kt as A,
|
|
337
|
+
Dt as B,
|
|
338
|
+
Vt as C,
|
|
339
|
+
Yt as D,
|
|
340
|
+
Zt as E,
|
|
341
|
+
Ot as F,
|
|
342
|
+
bt as G,
|
|
343
|
+
Ht as H,
|
|
344
|
+
It as I,
|
|
345
|
+
Mt as J,
|
|
346
|
+
zt as K,
|
|
347
|
+
ht as L,
|
|
348
|
+
Et as M,
|
|
349
|
+
Nt as N,
|
|
350
|
+
At as O,
|
|
351
|
+
lt as P,
|
|
352
|
+
qt as Q,
|
|
353
|
+
Ft as R,
|
|
354
|
+
pt as S,
|
|
355
|
+
d as T,
|
|
356
|
+
it as U,
|
|
357
|
+
vt as V,
|
|
358
|
+
rt as W,
|
|
359
|
+
ct as X,
|
|
360
|
+
_t as Y,
|
|
361
|
+
ut as Z,
|
|
362
|
+
ot as _,
|
|
363
|
+
mt as a,
|
|
364
|
+
N as a0,
|
|
365
|
+
at as b,
|
|
366
|
+
et as c,
|
|
367
|
+
Rt as d,
|
|
368
|
+
Bt as e,
|
|
369
|
+
I as f,
|
|
370
|
+
Jt as g,
|
|
371
|
+
te as h,
|
|
372
|
+
Xt as i,
|
|
373
|
+
dt as j,
|
|
374
|
+
$t as k,
|
|
375
|
+
xt as l,
|
|
376
|
+
Ut as m,
|
|
377
|
+
ft as n,
|
|
378
|
+
tt as o,
|
|
379
|
+
wt as p,
|
|
380
|
+
E as q,
|
|
381
|
+
Wt as r,
|
|
382
|
+
Gt as s,
|
|
383
|
+
kt as t,
|
|
384
|
+
Qt as u,
|
|
385
|
+
Ct as v,
|
|
386
|
+
st as w,
|
|
387
|
+
yt as x,
|
|
388
|
+
Lt as y,
|
|
389
|
+
jt as z
|
|
390
|
+
};
|
package/const.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./storage-Dk8i88bn.cjs"),E=require("wagmi/chains");exports.ALCHEMY_RPC_URL_MAP=_.ALCHEMY_RPC_URL_MAP;exports.AUTO_TRANSACTION_PUSH_DELAY=_.AUTO_TRANSACTION_PUSH_DELAY;exports.AddressZero=_.AddressZero;exports.BRIDGED_TOKENS_SYMBOLS=_.BRIDGED_TOKENS_SYMBOLS;exports.CHAIN_MAP=_.CHAIN_MAP;exports.CHAIN_NATIVE_TOKENS=_.CHAIN_NATIVE_TOKENS;exports.COMPLETE_WITHDRAW_ACTIONS=_.COMPLETE_WITHDRAW_ACTIONS;exports.CURRENCY_DECIMALS_MAP=_.CURRENCY_DECIMALS_MAP;exports.CURRENCY_SYMBOL_MAP=_.CURRENCY_SYMBOL_MAP;exports.DEFAULT_DEBOUNCE_TIME=_.DEFAULT_DEBOUNCE_TIME;exports.DEFAULT_DEPOSIT_METHOD=_.DEFAULT_DEPOSIT_METHOD;exports.DEFAULT_DEPOSIT_SLIPPAGE=_.DEFAULT_DEPOSIT_SLIPPAGE;exports.DEFAULT_DEPOSIT_SLIPPAGE_SCALE=_.DEFAULT_DEPOSIT_SLIPPAGE_SCALE;exports.DEFAULT_ERROR_MESSAGE=_.DEFAULT_ERROR_MESSAGE;exports.DEFAULT_LOCK_TIME=_.DEFAULT_LOCK_TIME;exports.DEFAULT_MULTI_ASSET_WITHDRAW_METHOD=_.DEFAULT_MULTI_ASSET_WITHDRAW_METHOD;exports.DEFAULT_NOTIFICATION_DURATION_MS=_.DEFAULT_NOTIFICATION_DURATION_MS;exports.DEFAULT_NO_SWAP_MIN_DEPOSIT_AMOUNT_GAP=_.DEFAULT_NO_SWAP_MIN_DEPOSIT_AMOUNT_GAP;exports.DEFAULT_POLLING_INTERVAL=_.DEFAULT_POLLING_INTERVAL;exports.DEFAULT_PRECISION=_.DEFAULT_PRECISION;exports.DEFAULT_PROMISE_TIMEOUT_MS=_.DEFAULT_PROMISE_TIMEOUT_MS;exports.DEFAULT_RECEIVED_VALUE_GAP=_.DEFAULT_RECEIVED_VALUE_GAP;exports.DEFAULT_SIMULATION_ERROR=_.DEFAULT_SIMULATION_ERROR;exports.DEFAULT_SWAP_TRANSACTION_SLIPPAGE=_.DEFAULT_SWAP_TRANSACTION_SLIPPAGE;exports.DEFAULT_VAULT_TOKEN_PRICE=_.DEFAULT_VAULT_TOKEN_PRICE;exports.DEFAULT_VISIBLE_ASSETS_LIMIT=_.DEFAULT_VISIBLE_ASSETS_LIMIT;exports.DEFAULT_WITHDRAW_SLIPPAGE=_.DEFAULT_WITHDRAW_SLIPPAGE;exports.DEPOSIT_SWAP_DATA_ERROR=_.DEPOSIT_SWAP_DATA_ERROR;exports.EASY_SWAPPER_V2_COMPLETE_WITHDRAW_METHOD=_.EASY_SWAPPER_V2_COMPLETE_WITHDRAW_METHOD;exports.EASY_SWAPPER_V2_DEPOSIT_METHODS=_.EASY_SWAPPER_V2_DEPOSIT_METHODS;exports.EASY_SWAPPER_V2_INITIATE_WITHDRAW_METHOD=_.EASY_SWAPPER_V2_INITIATE_WITHDRAW_METHOD;exports.EASY_SWAPPER_V2_UNROLL_AND_CLAIM_METHOD=_.EASY_SWAPPER_V2_UNROLL_AND_CLAIM_METHOD;exports.EMPTY_POOL_CONFIG=_.EMPTY_POOL_CONFIG;exports.EXTENDED_DEBOUNCE_TIME=_.EXTENDED_DEBOUNCE_TIME;exports.EXTENDED_POLLING_INTERVAL=_.EXTENDED_POLLING_INTERVAL;exports.EXTREMELY_SHORT_POLLING_INTERVAL=_.EXTREMELY_SHORT_POLLING_INTERVAL;exports.FALLBACK_ASSETS_MAP=_.FALLBACK_ASSETS_MAP;exports.FLAT_MONEY_COLLATERAL_MAP=_.FLAT_MONEY_COLLATERAL_MAP;exports.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES=_.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES;exports.FLAT_MONEY_UNIT_ADDRESSES=_.FLAT_MONEY_UNIT_ADDRESSES;exports.FLAT_MONEY_UNIT_LINK=_.FLAT_MONEY_UNIT_LINK;exports.FLAT_MONEY_V1_UNIT_ADDRESS=_.FLAT_MONEY_V1_UNIT_ADDRESS;exports.FLAT_MONEY_V1_UNIT_LINK=_.FLAT_MONEY_V1_UNIT_LINK;exports.GAS_ESTIMATION_ERROR=_.GAS_ESTIMATION_ERROR;exports.GAS_LIMIT_BUFFER_COEFF=_.GAS_LIMIT_BUFFER_COEFF;exports.GMX_MARKET_ASSETS=_.GMX_MARKET_ASSETS;exports.GMX_MARKET_ASSETS_MAP=_.GMX_MARKET_ASSETS_MAP;exports.GMX_WITHDRAW_ASSET_MAP=_.GMX_WITHDRAW_ASSET_MAP;exports.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS=_.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS;exports.INVALID_PRICES_LIMIT_ORDER_TITLE=_.INVALID_PRICES_LIMIT_ORDER_TITLE;exports.LIMIT_ORDER_TRANSACTION_ERRORS=_.LIMIT_ORDER_TRANSACTION_ERRORS;exports.LOCAL_STORAGE_KEYS=_.LOCAL_STORAGE_KEYS;exports.LOG_EVENT_BY_TRANSACTION_ACTION_MAP=_.LOG_EVENT_BY_TRANSACTION_ACTION_MAP;exports.MANAGER_FEE_DENOMINATOR=_.MANAGER_FEE_DENOMINATOR;exports.MAX_GAS_LIMIT_MAP=_.MAX_GAS_LIMIT_MAP;exports.MULTI_ASSET_TOKEN=_.MULTI_ASSET_TOKEN;exports.MaxUint256=_.MaxUint256;exports.NATIVE_TOKEN_DEPOSIT_GAS_LIMIT=_.NATIVE_TOKEN_DEPOSIT_GAS_LIMIT;exports.PYTH_API_LINK=_.PYTH_API_LINK;exports.SHORTEN_POLLING_INTERVAL=_.SHORTEN_POLLING_INTERVAL;exports.SIMULATION_TIMEOUT_ERROR=_.SIMULATION_TIMEOUT_ERROR;exports.STABLE_TOKEN_SYMBOLS=_.STABLE_TOKEN_SYMBOLS;exports.SWAP_QUOTE_REFRESH_INTERVAL_MS=_.SWAP_QUOTE_REFRESH_INTERVAL_MS;exports.TRADING_LOG_EVENT_PARAM=_.TRADING_LOG_EVENT_PARAM;exports.TRADING_PANEL_LOG_EVENT=_.TRADING_PANEL_LOG_EVENT;exports.TRANSACTION_ERRORS=_.TRANSACTION_ERRORS;exports.TRANSACTION_ERROR_KEYS=_.TRANSACTION_ERROR_KEYS;exports.WBTC_BY_CHAIN_ID=_.WBTC_BY_CHAIN_ID;exports.WETH_BY_CHAIN_ID=_.WETH_BY_CHAIN_ID;exports.WITHDRAW_SWAP_DATA_ERROR=_.WITHDRAW_SWAP_DATA_ERROR;exports.contractsAbisMap=_.contractsAbisMap;exports.contractsAddressesMap=_.contractsAddressesMap;Object.defineProperty(exports,"arbitrum",{enumerable:!0,get:()=>E.arbitrum});Object.defineProperty(exports,"base",{enumerable:!0,get:()=>E.base});Object.defineProperty(exports,"mainnet",{enumerable:!0,get:()=>E.mainnet});Object.defineProperty(exports,"optimism",{enumerable:!0,get:()=>E.optimism});Object.defineProperty(exports,"polygon",{enumerable:!0,get:()=>E.polygon});
|
package/const.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './core-kit/const';
|
package/const.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { A, a as T, b as I, B as a, C as S, c as L, d as R, e as O, f as s, D as N, g as D, h as M, i as P, j as U, k as C, l as F, m as G, n as W, o as Y, p as H, q as V, r as B, s as K, t as r, u as o, v as t, w as e, x as X, E as i, y as m, z as n, F as p, G as c, H as d, I as b, J as f, K as x, L as g, M as h, N as l, O as u, P as y, Q, R as Z, S as j, T as k, U as q, V as v, W as w, X as z, Y as J, Z as $, _ as __, $ as E_, a0 as A_, a1 as T_, a2 as I_, a3 as a_, a4 as S_, a5 as L_, a6 as R_, a7 as O_, a8 as s_, a9 as N_, aa as D_, ab as M_, ac as P_, ad as U_, ae as C_, af as F_, ag as G_, ah as W_ } from "./storage-DL2GNx3e.js";
|
|
2
|
+
import { arbitrum as H_, base as V_, mainnet as B_, optimism as K_, polygon as r_ } from "wagmi/chains";
|
|
3
|
+
export {
|
|
4
|
+
A as ALCHEMY_RPC_URL_MAP,
|
|
5
|
+
T as AUTO_TRANSACTION_PUSH_DELAY,
|
|
6
|
+
I as AddressZero,
|
|
7
|
+
a as BRIDGED_TOKENS_SYMBOLS,
|
|
8
|
+
S as CHAIN_MAP,
|
|
9
|
+
L as CHAIN_NATIVE_TOKENS,
|
|
10
|
+
R as COMPLETE_WITHDRAW_ACTIONS,
|
|
11
|
+
O as CURRENCY_DECIMALS_MAP,
|
|
12
|
+
s as CURRENCY_SYMBOL_MAP,
|
|
13
|
+
N as DEFAULT_DEBOUNCE_TIME,
|
|
14
|
+
D as DEFAULT_DEPOSIT_METHOD,
|
|
15
|
+
M as DEFAULT_DEPOSIT_SLIPPAGE,
|
|
16
|
+
P as DEFAULT_DEPOSIT_SLIPPAGE_SCALE,
|
|
17
|
+
U as DEFAULT_ERROR_MESSAGE,
|
|
18
|
+
C as DEFAULT_LOCK_TIME,
|
|
19
|
+
F as DEFAULT_MULTI_ASSET_WITHDRAW_METHOD,
|
|
20
|
+
G as DEFAULT_NOTIFICATION_DURATION_MS,
|
|
21
|
+
W as DEFAULT_NO_SWAP_MIN_DEPOSIT_AMOUNT_GAP,
|
|
22
|
+
Y as DEFAULT_POLLING_INTERVAL,
|
|
23
|
+
H as DEFAULT_PRECISION,
|
|
24
|
+
V as DEFAULT_PROMISE_TIMEOUT_MS,
|
|
25
|
+
B as DEFAULT_RECEIVED_VALUE_GAP,
|
|
26
|
+
K as DEFAULT_SIMULATION_ERROR,
|
|
27
|
+
r as DEFAULT_SWAP_TRANSACTION_SLIPPAGE,
|
|
28
|
+
o as DEFAULT_VAULT_TOKEN_PRICE,
|
|
29
|
+
t as DEFAULT_VISIBLE_ASSETS_LIMIT,
|
|
30
|
+
e as DEFAULT_WITHDRAW_SLIPPAGE,
|
|
31
|
+
X as DEPOSIT_SWAP_DATA_ERROR,
|
|
32
|
+
i as EASY_SWAPPER_V2_COMPLETE_WITHDRAW_METHOD,
|
|
33
|
+
m as EASY_SWAPPER_V2_DEPOSIT_METHODS,
|
|
34
|
+
n as EASY_SWAPPER_V2_INITIATE_WITHDRAW_METHOD,
|
|
35
|
+
p as EASY_SWAPPER_V2_UNROLL_AND_CLAIM_METHOD,
|
|
36
|
+
c as EMPTY_POOL_CONFIG,
|
|
37
|
+
d as EXTENDED_DEBOUNCE_TIME,
|
|
38
|
+
b as EXTENDED_POLLING_INTERVAL,
|
|
39
|
+
f as EXTREMELY_SHORT_POLLING_INTERVAL,
|
|
40
|
+
x as FALLBACK_ASSETS_MAP,
|
|
41
|
+
g as FLAT_MONEY_COLLATERAL_MAP,
|
|
42
|
+
h as FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES,
|
|
43
|
+
l as FLAT_MONEY_UNIT_ADDRESSES,
|
|
44
|
+
u as FLAT_MONEY_UNIT_LINK,
|
|
45
|
+
y as FLAT_MONEY_V1_UNIT_ADDRESS,
|
|
46
|
+
Q as FLAT_MONEY_V1_UNIT_LINK,
|
|
47
|
+
Z as GAS_ESTIMATION_ERROR,
|
|
48
|
+
j as GAS_LIMIT_BUFFER_COEFF,
|
|
49
|
+
k as GMX_MARKET_ASSETS,
|
|
50
|
+
q as GMX_MARKET_ASSETS_MAP,
|
|
51
|
+
v as GMX_WITHDRAW_ASSET_MAP,
|
|
52
|
+
w as GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS,
|
|
53
|
+
z as INVALID_PRICES_LIMIT_ORDER_TITLE,
|
|
54
|
+
J as LIMIT_ORDER_TRANSACTION_ERRORS,
|
|
55
|
+
$ as LOCAL_STORAGE_KEYS,
|
|
56
|
+
__ as LOG_EVENT_BY_TRANSACTION_ACTION_MAP,
|
|
57
|
+
E_ as MANAGER_FEE_DENOMINATOR,
|
|
58
|
+
A_ as MAX_GAS_LIMIT_MAP,
|
|
59
|
+
T_ as MULTI_ASSET_TOKEN,
|
|
60
|
+
I_ as MaxUint256,
|
|
61
|
+
a_ as NATIVE_TOKEN_DEPOSIT_GAS_LIMIT,
|
|
62
|
+
S_ as PYTH_API_LINK,
|
|
63
|
+
L_ as SHORTEN_POLLING_INTERVAL,
|
|
64
|
+
R_ as SIMULATION_TIMEOUT_ERROR,
|
|
65
|
+
O_ as STABLE_TOKEN_SYMBOLS,
|
|
66
|
+
s_ as SWAP_QUOTE_REFRESH_INTERVAL_MS,
|
|
67
|
+
N_ as TRADING_LOG_EVENT_PARAM,
|
|
68
|
+
D_ as TRADING_PANEL_LOG_EVENT,
|
|
69
|
+
M_ as TRANSACTION_ERRORS,
|
|
70
|
+
P_ as TRANSACTION_ERROR_KEYS,
|
|
71
|
+
U_ as WBTC_BY_CHAIN_ID,
|
|
72
|
+
C_ as WETH_BY_CHAIN_ID,
|
|
73
|
+
F_ as WITHDRAW_SWAP_DATA_ERROR,
|
|
74
|
+
H_ as arbitrum,
|
|
75
|
+
V_ as base,
|
|
76
|
+
G_ as contractsAbisMap,
|
|
77
|
+
W_ as contractsAddressesMap,
|
|
78
|
+
B_ as mainnet,
|
|
79
|
+
K_ as optimism,
|
|
80
|
+
r_ as polygon
|
|
81
|
+
};
|
package/core-kit/const/gmx.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const GMX_MARKET_ASSETS_MAP: {
|
|
|
13
13
|
readonly BNB_WBTC_USDC_ARBITRUM: "0x065577D05c3D4C11505ed7bc97BBF85d462A6A6f";
|
|
14
14
|
readonly LINK_ARBITRUM: "0x7f1fa204bb700853d36994da19f830b6ad18455c";
|
|
15
15
|
readonly PUMP_ARBITRUM: "0x4c0bb704529fa49a26bd854802d70206982c6f1b";
|
|
16
|
+
readonly GOLD_ARBITRUM: "0xeb28ad1a2e497f4acc5d9b87e7b496623c93061e";
|
|
16
17
|
};
|
|
17
18
|
export type GmxMarketAsset = (typeof GMX_MARKET_ASSETS_MAP)[keyof typeof GMX_MARKET_ASSETS_MAP];
|
|
18
19
|
export declare const GMX_MARKET_ASSETS: GmxMarketAsset[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { arbitrum, base,
|
|
1
|
+
import { arbitrum, base, mainnet, optimism, polygon } from 'wagmi/chains';
|
|
2
2
|
import type { ChainId, ChainNativeTokenMap } from '../types';
|
|
3
3
|
export declare const CHAIN_MAP: {
|
|
4
4
|
readonly 1: {
|
|
@@ -847,70 +847,8 @@ export declare const CHAIN_MAP: {
|
|
|
847
847
|
uid?: undefined;
|
|
848
848
|
} | undefined>, parameters: import("viem").VerifyHashActionParameters) => Promise<boolean>) | undefined;
|
|
849
849
|
};
|
|
850
|
-
readonly 999: {
|
|
851
|
-
blockExplorers: {
|
|
852
|
-
readonly default: {
|
|
853
|
-
readonly name: "HyperEVMScan";
|
|
854
|
-
readonly url: "https://hyperevmscan.io";
|
|
855
|
-
};
|
|
856
|
-
};
|
|
857
|
-
blockTime?: number | undefined;
|
|
858
|
-
contracts?: {
|
|
859
|
-
[x: string]: import("viem").ChainContract | {
|
|
860
|
-
[sourceId: number]: import("viem").ChainContract | undefined;
|
|
861
|
-
} | undefined;
|
|
862
|
-
ensRegistry?: import("viem").ChainContract | undefined;
|
|
863
|
-
ensUniversalResolver?: import("viem").ChainContract | undefined;
|
|
864
|
-
multicall3?: import("viem").ChainContract | undefined;
|
|
865
|
-
erc6492Verifier?: import("viem").ChainContract | undefined;
|
|
866
|
-
} | undefined;
|
|
867
|
-
ensTlds?: readonly string[] | undefined;
|
|
868
|
-
id: 999;
|
|
869
|
-
name: "HyperEVM";
|
|
870
|
-
nativeCurrency: {
|
|
871
|
-
readonly name: "HYPE";
|
|
872
|
-
readonly symbol: "HYPE";
|
|
873
|
-
readonly decimals: 18;
|
|
874
|
-
};
|
|
875
|
-
experimental_preconfirmationTime?: number | undefined;
|
|
876
|
-
rpcUrls: {
|
|
877
|
-
readonly default: {
|
|
878
|
-
readonly http: readonly ["https://rpc.hyperliquid.xyz/evm"];
|
|
879
|
-
};
|
|
880
|
-
};
|
|
881
|
-
sourceId?: number | undefined;
|
|
882
|
-
testnet: false;
|
|
883
|
-
custom?: Record<string, unknown> | undefined;
|
|
884
|
-
extendSchema?: Record<string, unknown> | undefined;
|
|
885
|
-
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
886
|
-
formatters?: undefined;
|
|
887
|
-
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters<import("wagmi/chains").Chain | undefined, import("viem").Account | undefined, import("wagmi/chains").Chain | undefined, `0x${string}` | import("viem").Account | undefined, import("viem").PrepareTransactionRequestRequest<import("wagmi/chains").Chain | undefined, import("wagmi/chains").Chain | undefined, import("wagmi/chains").Chain | undefined>>, options: {
|
|
888
|
-
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
889
|
-
}) => Promise<import("viem").PrepareTransactionRequestParameters<import("wagmi/chains").Chain | undefined, import("viem").Account | undefined, import("wagmi/chains").Chain | undefined, `0x${string}` | import("viem").Account | undefined, import("viem").PrepareTransactionRequestRequest<import("wagmi/chains").Chain | undefined, import("wagmi/chains").Chain | undefined, import("wagmi/chains").Chain | undefined>>>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters<import("wagmi/chains").Chain | undefined, import("viem").Account | undefined, import("wagmi/chains").Chain | undefined, `0x${string}` | import("viem").Account | undefined, import("viem").PrepareTransactionRequestRequest<import("wagmi/chains").Chain | undefined, import("wagmi/chains").Chain | undefined, import("wagmi/chains").Chain | undefined>>, options: {
|
|
890
|
-
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
891
|
-
}) => Promise<import("viem").PrepareTransactionRequestParameters<import("wagmi/chains").Chain | undefined, import("viem").Account | undefined, import("wagmi/chains").Chain | undefined, `0x${string}` | import("viem").Account | undefined, import("viem").PrepareTransactionRequestRequest<import("wagmi/chains").Chain | undefined, import("wagmi/chains").Chain | undefined, import("wagmi/chains").Chain | undefined>>>) | undefined, options: {
|
|
892
|
-
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
893
|
-
}] | undefined;
|
|
894
|
-
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable<bigint, number>> | undefined;
|
|
895
|
-
verifyHash?: ((client: import('../types').Client<import("viem").Transport, import("wagmi/chains").Chain | undefined, import("viem").Account | undefined, undefined, {
|
|
896
|
-
[x: string]: unknown;
|
|
897
|
-
account?: undefined;
|
|
898
|
-
batch?: undefined;
|
|
899
|
-
cacheTime?: undefined;
|
|
900
|
-
ccipRead?: undefined;
|
|
901
|
-
chain?: undefined;
|
|
902
|
-
experimental_blockTag?: undefined;
|
|
903
|
-
key?: undefined;
|
|
904
|
-
name?: undefined;
|
|
905
|
-
pollingInterval?: undefined;
|
|
906
|
-
request?: undefined;
|
|
907
|
-
transport?: undefined;
|
|
908
|
-
type?: undefined;
|
|
909
|
-
uid?: undefined;
|
|
910
|
-
} | undefined>, parameters: import("viem").VerifyHashActionParameters) => Promise<boolean>) | undefined;
|
|
911
|
-
};
|
|
912
850
|
};
|
|
913
851
|
export declare const CHAIN_NATIVE_TOKENS: ChainNativeTokenMap;
|
|
914
852
|
export declare const MAX_GAS_LIMIT_MAP: Record<ChainId, number>;
|
|
915
853
|
export declare const ALCHEMY_RPC_URL_MAP: Record<number, string>;
|
|
916
|
-
export { polygon, optimism, arbitrum, base, mainnet
|
|
854
|
+
export { polygon, optimism, arbitrum, base, mainnet };
|