@dhedge/trading-widget 6.4.0 → 7.0.1
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/README.md +4 -17
- package/const.cjs +1 -1
- package/const.js +1 -1
- package/{contract-error-log-CaRlTnoL.js → contract-error-log-CACKgbSD.js} +1 -1
- package/{contract-error-log-C66ELh8m.cjs → contract-error-log-DX0w240P.cjs} +1 -1
- package/core-kit/types/index.d.ts +9 -9
- package/{gmx-Dc6vyoji.js → gmx-C4CoHlpY.js} +49 -48
- package/gmx-wSTKl_Pc.cjs +1 -0
- package/index.cjs +1 -1
- package/index.js +2703 -2743
- package/limit-orders/common/percentage-input.d.ts +1 -1
- package/limit-orders/common/price-input.d.ts +1 -1
- package/limit-orders/limit-buys/providers/translation-provider/index.d.ts +1 -1
- package/limit-orders/providers/theme-provider/index.d.ts +1 -1
- package/limit-orders/providers/translation-provider/index.d.ts +1 -1
- package/package.json +3 -2
- package/trading-widget/components/common/input/input-number.d.ts +8 -6
- package/trading-widget/components/common/meta/transaction-disclosure/transaction-disclosure-item/transaction-disclosure-item.d.ts +1 -1
- package/trading-widget/components/common/switch/switch.d.ts +2 -1
- package/trading-widget/components/deposit/input-group/input-group.d.ts +2 -1
- package/trading-widget/components/deposit/meta/transaction-disclosure/transaction-disclosure.d.ts +2 -1
- package/trading-widget/components/widget/widget-buttons/switch-network-button/switch-network-button.d.ts +2 -1
- package/trading-widget/components/widget/widget-input/all-assets-composition-table/all-assets-composition-table.d.ts +2 -1
- package/trading-widget/components/widget/widget-input/widget-input.hooks.d.ts +1 -1
- package/trading-widget/components/widget/widget-overlay/token-select-overlay/multi-token-select-item/multi-token-select-item.d.ts +2 -1
- package/trading-widget/components/widget/widget-overlay/token-select-overlay/token-select-item/token-select-item.d.ts +2 -1
- package/trading-widget/components/widget/widget-overlay/trading-overlay/limit-order/limit-order-processing-content.d.ts +2 -1
- package/trading-widget/components/widget/widget-settings/token-allowance-switch/token-allowance-switch.d.ts +2 -1
- package/trading-widget/components/withdraw/complete-step/meta/transaction-disclosure/transaction-disclosure.d.ts +2 -1
- package/trading-widget/components/withdraw/init-step/init-step.d.ts +2 -1
- package/trading-widget/components/withdraw/init-step/input-group/init-withdraw-input-group.d.ts +2 -1
- package/trading-widget/components/withdraw/init-step/meta/transaction-disclosure/transaction-disclosure.d.ts +2 -1
- package/trading-widget/hooks/use-crypto-icon.d.ts +6 -0
- package/trading-widget/providers/component-provider/index.d.ts +1 -1
- package/trading-widget/providers/config-provider/index.d.ts +1 -1
- package/trading-widget/providers/overlay-provider/overlay-provider.hooks.d.ts +1 -1
- package/trading-widget/providers/theme-provider/index.d.ts +1 -1
- package/trading-widget/providers/translation-provider/index.d.ts +1 -1
- package/utils.cjs +1 -1
- package/utils.js +1 -1
- package/gmx-BTdr6Yvr.cjs +0 -1
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@ Requirements:
|
|
|
7
7
|
Widget library has some vital `peerDependencies` as a core tool stack. Make sure having all those dependencies installed in app before starting the integration:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
"@tanstack/react-query": "^5.
|
|
11
|
-
"react": "
|
|
12
|
-
"viem": "^2.
|
|
10
|
+
"@tanstack/react-query": "^5.81.2",
|
|
11
|
+
"react": "^19.0.0",
|
|
12
|
+
"viem": "^2.52.2",
|
|
13
13
|
"wagmi": "^2.19.5"
|
|
14
14
|
```
|
|
15
15
|
|
|
@@ -739,17 +739,4 @@ Follow the steps below to set up the project for local development:
|
|
|
739
739
|
pnpm install
|
|
740
740
|
```
|
|
741
741
|
|
|
742
|
-
2. **
|
|
743
|
-
|
|
744
|
-
```bash
|
|
745
|
-
packages/trading-widget/src/core-kit/providers/wagmi-provider.tsx
|
|
746
|
-
```
|
|
747
|
-
|
|
748
|
-
3. **Implement** getSwapQuotes in:
|
|
749
|
-
```bash
|
|
750
|
-
packages/trading-widget/src/core-kit/providers/wagmi-provider.tsx
|
|
751
|
-
```
|
|
752
|
-
4. **Run Storybook**
|
|
753
|
-
```bash
|
|
754
|
-
pnpm storybook
|
|
755
|
-
```
|
|
742
|
+
2. **Run the widget inside an app**: `pnpm dev` at the repository root starts toros-dapp and rebuilds the widget's `dist/` on every change (`vite build --watch`); `pnpm dev:mstable` and `pnpm dev:flat` do the same for the other apps. Run `pnpm --filter @dhedge/trading-widget run test` and `run lint` before publishing.
|
package/const.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./geoblocking-peuNwHMJ.cjs"),_=require("./gmx-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./geoblocking-peuNwHMJ.cjs"),_=require("./gmx-wSTKl_Pc.cjs"),A=require("wagmi/chains");exports.BLOCKED_COUNTRY_CODES_MAP=E.BLOCKED_COUNTRY_CODES_MAP;exports.COVERED_CALL_VAULT_ADDRESSES=E.COVERED_CALL_VAULT_ADDRESSES;exports.LOCAL_STORAGE_KEYS=E.LOCAL_STORAGE_KEYS;exports.MIDAS_MAPOLLO_ADDRESS=E.MIDAS_MAPOLLO_ADDRESS;exports.MIDAS_MAPOLLO_LINK=E.MIDAS_MAPOLLO_LINK;exports.ONDO_ASSET_TYPE=E.ONDO_ASSET_TYPE;exports.ONDO_BLOCKED_COUNTRY_CODES_MAP=E.ONDO_BLOCKED_COUNTRY_CODES_MAP;exports.ALCHEMY_RPC_URL_MAP=_.ALCHEMY_RPC_URL_MAP;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_MAX_GAS_LIMIT=_.DEFAULT_MAX_GAS_LIMIT;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_ONDO_WITHDRAWAL_CONTRACT_SLIPPAGE=_.DEFAULT_ONDO_WITHDRAWAL_CONTRACT_SLIPPAGE;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.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_GAS_RESERVE_UNITS=_.NATIVE_TOKEN_GAS_RESERVE_UNITS;exports.ONDO_PRICES_FETCH_TIMEOUT_MS=_.ONDO_PRICES_FETCH_TIMEOUT_MS;exports.ONDO_PRICES_RABBY_SETTLE_DELAY=_.ONDO_PRICES_RABBY_SETTLE_DELAY;exports.ONDO_PRICE_CHECK_TIMEOUT_MS=_.ONDO_PRICE_CHECK_TIMEOUT_MS;exports.ONDO_PRICE_FRESHNESS_WINDOW_MS=_.ONDO_PRICE_FRESHNESS_WINDOW_MS;exports.ONDO_PRICE_MAX_DEVIATION_PERCENT=_.ONDO_PRICE_MAX_DEVIATION_PERCENT;exports.ON_DEMAND_PRICING_ASSET_BY_CHAIN_MAP=_.ON_DEMAND_PRICING_ASSET_BY_CHAIN_MAP;exports.PYTH_API_LINK=_.PYTH_API_LINK;exports.SHORTEN_POLLING_INTERVAL=_.SHORTEN_POLLING_INTERVAL;exports.SIMULATION_TIMEOUT_ERROR=_.SIMULATION_TIMEOUT_ERROR;exports.SLIPPAGE_AUTO_SIMULATION_CANDIDATES=_.SLIPPAGE_AUTO_SIMULATION_CANDIDATES;exports.STABLE_TOKEN_SYMBOLS=_.STABLE_TOKEN_SYMBOLS;exports.SWAP_FAILED_ERROR=_.SWAP_FAILED_ERROR;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_SETTLE_DELAY=_.TRANSACTION_SETTLE_DELAY;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:()=>A.arbitrum});Object.defineProperty(exports,"base",{enumerable:!0,get:()=>A.base});Object.defineProperty(exports,"hyperEvm",{enumerable:!0,get:()=>A.hyperEvm});Object.defineProperty(exports,"mainnet",{enumerable:!0,get:()=>A.mainnet});Object.defineProperty(exports,"optimism",{enumerable:!0,get:()=>A.optimism});Object.defineProperty(exports,"polygon",{enumerable:!0,get:()=>A.polygon});
|
package/const.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { B as A, C as T, L as S, M as I, a, O, b as L } from "./geoblocking-DtB4yr5l.js";
|
|
2
|
-
import { A as D, a as N, B as s, C as M, b as P, c as C, d as U, e as F, D as G, f as W, g as Y, h as H, i as V, j as B, k as K, l as r, m as o, n as e, o as t, p as X, q as m, r as p, s as i, t as n, u as b, v as c, w as d, x as f, y as x, E as g, z as h, F as l, G as y, H as j, I as k, J as u, K as v, L as Q, M as Z, N as q, O as w, P as z, Q as J, R as $, S as __, T as E_, U as A_, V as T_, W as S_, X as I_, Y as a_, Z as O_, _ as L_, $ as R_, a0 as D_, a1 as N_, a2 as s_, a3 as M_, a4 as P_, a5 as C_, a6 as U_, a7 as F_, a8 as G_, a9 as W_, aa as Y_, ab as H_, ac as V_, ad as B_, ae as K_, af as r_, ag as o_, ah as e_, ai as t_, aj as X_, ak as m_, al as p_, am as i_, an as n_, ao as b_, ap as c_ } from "./gmx-
|
|
2
|
+
import { A as D, a as N, B as s, C as M, b as P, c as C, d as U, e as F, D as G, f as W, g as Y, h as H, i as V, j as B, k as K, l as r, m as o, n as e, o as t, p as X, q as m, r as p, s as i, t as n, u as b, v as c, w as d, x as f, y as x, E as g, z as h, F as l, G as y, H as j, I as k, J as u, K as v, L as Q, M as Z, N as q, O as w, P as z, Q as J, R as $, S as __, T as E_, U as A_, V as T_, W as S_, X as I_, Y as a_, Z as O_, _ as L_, $ as R_, a0 as D_, a1 as N_, a2 as s_, a3 as M_, a4 as P_, a5 as C_, a6 as U_, a7 as F_, a8 as G_, a9 as W_, aa as Y_, ab as H_, ac as V_, ad as B_, ae as K_, af as r_, ag as o_, ah as e_, ai as t_, aj as X_, ak as m_, al as p_, am as i_, an as n_, ao as b_, ap as c_ } from "./gmx-C4CoHlpY.js";
|
|
3
3
|
import { arbitrum as f_, base as x_, hyperEvm as g_, mainnet as h_, optimism as l_, polygon as y_ } from "wagmi/chains";
|
|
4
4
|
export {
|
|
5
5
|
D as ALCHEMY_RPC_URL_MAP,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hyperEvm as H, mainnet as I, polygon as at, optimism as rt, base as ot, arbitrum as it } from "wagmi/chains";
|
|
2
|
-
import { aq as ct, ao as ut, ap as dt, a as N, q as R, ar as pt, as as lt, a5 as mt, ak as yt, a3 as gt, b as At, ae as Et, Z as k, aj as ht, at as V, e as ft, d as St, M as Tt, R as wt, P as _t, au as bt, av as Dt, Q as It, N as Nt, ah as _, _ as Rt, W as Ot, X as Ct, U as xt, aw as q, ax as Bt, ay as Lt, az as Mt, aA as Pt, aB as Ut, ad as $t } from "./gmx-
|
|
2
|
+
import { aq as ct, ao as ut, ap as dt, a as N, q as R, ar as pt, as as lt, a5 as mt, ak as yt, a3 as gt, b as At, ae as Et, Z as k, aj as ht, at as V, e as ft, d as St, M as Tt, R as wt, P as _t, au as bt, av as Dt, Q as It, N as Nt, ah as _, _ as Rt, W as Ot, X as Ct, U as xt, aw as q, ax as Bt, ay as Lt, az as Mt, aA as Pt, aB as Ut, ad as $t } from "./gmx-C4CoHlpY.js";
|
|
3
3
|
import d from "bignumber.js";
|
|
4
4
|
import { zeroHash as vt, bytesToHex as Ft, pad as Yt, stringToHex as O, encodeAbiParameters as T, encodeFunctionData as A, maxUint256 as w, erc20Abi as K } from "viem";
|
|
5
5
|
const B = "application/json";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const E=require("wagmi/chains"),a=require("./gmx-BTdr6Yvr.cjs"),p=require("bignumber.js"),d=require("viem"),B="application/json";class W extends Error{constructor(e,n,s){super(`HTTP ${e}${s?`: ${s}`:""}`),this.name="FetchRequestError",this.status=e,this.statusText=n,this.body=s}}const Tt=t=>{if(!(t instanceof W)||!t.body)return null;try{return JSON.parse(t.body)}catch{return null}},St=t=>typeof t=="string"||t instanceof FormData||t instanceof URLSearchParams||t instanceof Blob||t instanceof ArrayBuffer||ArrayBuffer.isView(t),ft=(t,e)=>{const n=String(t),s=e?new URLSearchParams(e).toString():"";if(!s)return n;const r=n.indexOf("#"),o=r===-1?n:n.slice(0,r),i=r===-1?"":n.slice(r);return`${o}${o.includes("?")?"&":"?"}${s}${i}`},_t=(t,e)=>{const n=new AbortController,s=()=>n.abort();e?.aborted&&s();const r=setTimeout(s,t);return e?.addEventListener("abort",s),{signal:n.signal,cleanup:()=>{clearTimeout(r),e?.removeEventListener("abort",s)}}},Dt=async(t,e,n)=>{if(n===void 0)return await t[e]();const s=Number(t.headers.get("content-length"));if(s>n)throw new Error(`Response too large: ${s} bytes`);if(e==="blob"||e==="arrayBuffer"){const o=await t[e](),i=o instanceof Blob?o.size:o.byteLength;if(i>n)throw new Error(`Response too large: ${i} bytes`);return o}const r=await t.text();if(r.length>n)throw new Error(`Response too large: ${r.length} chars`);return e==="json"?JSON.parse(r):r},H=async({url:t,headers:e,method:n,body:s,params:r,signal:o,readMethod:i="json",cache:u,timeoutMs:c,maxResponseBytes:l})=>{const A=s!==void 0&&n!=="GET",h=A&&!St(s),g=new Headers(e);i==="json"&&!g.has("Accept")&&g.set("Accept",B),h&&!g.has("Content-Type")&&g.set("Content-Type",B);const _=c?_t(c,o):void 0,ht={method:n,headers:g,signal:_?.signal??o,...u&&{cache:u},...A&&{body:h?JSON.stringify(s):s}};try{const T=await fetch(ft(t,r),ht);if(!T.ok)throw new W(T.status,T.statusText,await T.text().catch(()=>""));return await Dt(T,i,l)}finally{_?.cleanup()}},wt=typeof window<"u",bt=[{inputs:[{internalType:"address",name:"_pool",type:"address"},{internalType:"address",name:"_asset",type:"address"},{internalType:"uint256",name:"_poolTokenAmount",type:"uint256"}],name:"previewGmTokenAmount",outputs:[{internalType:"uint256",name:"gmTokenAmount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ondoGMSwap",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"usdc",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],Rt=[{type:"tuple",components:[{name:"attestationSignature",type:"bytes"},{name:"quote",type:"tuple",components:[{name:"chainId",type:"uint256"},{name:"attestationId",type:"uint256"},{name:"userId",type:"bytes32"},{name:"asset",type:"address"},{name:"price",type:"uint256"},{name:"quantity",type:"uint256"},{name:"expiration",type:"uint256"},{name:"side",type:"uint8"},{name:"additionalData",type:"bytes32"}]},{name:"amountOutMinimum",type:"uint256"}]}],It=[{name:"asset",type:"address"},{name:"amount",type:"uint256"},{name:"assetType",type:"uint16"},{name:"isPool",type:"bool"},{name:"isDebt",type:"bool"},{name:"marketId",type:"uint88"},{name:"accountId",type:"uint256"},{name:"tokenId",type:"uint256"},{name:"debtKey",type:"uint248"},{name:"shares",type:"uint256"}],Nt=[{inputs:[{internalType:"address",name:"_pool",type:"address"},{internalType:"uint256",name:"_poolTokenAmount",type:"uint256"}],name:"previewWithdrawal",outputs:[{name:"assetData",type:"tuple[]",components:It}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"dytmWithdrawProcessor",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"}],N=[{inputs:[{name:"params",type:"tuple",components:[{name:"account",type:"uint256"},{name:"tokenId",type:"uint256"},{name:"receiver",type:"address"},{name:"assets",type:"uint256"},{name:"shares",type:"uint256"},{name:"extraData",type:"bytes"}]}],name:"withdraw",outputs:[{name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"params",type:"tuple",components:[{name:"account",type:"uint256"},{name:"key",type:"uint248"},{name:"withCollateralType",type:"uint8"},{name:"assets",type:"uint256"},{name:"shares",type:"uint256"},{name:"extraData",type:"bytes"}]}],name:"repay",outputs:[{name:"assetsRepaid",type:"uint256"}],stateMutability:"nonpayable",type:"function"}],Ot=[{inputs:[{name:"tokenIn",type:"address"},{name:"amountIn",type:"uint256"},{name:"tokenOut",type:"address"},{name:"amountOutMinimum",type:"uint256"},{name:"attestationSignature",type:"bytes"},{name:"quote",type:"tuple",components:[{name:"chainId",type:"uint256"},{name:"attestationId",type:"uint256"},{name:"userId",type:"bytes32"},{name:"asset",type:"address"},{name:"price",type:"uint256"},{name:"quantity",type:"uint256"},{name:"expiration",type:"uint256"},{name:"side",type:"uint8"},{name:"additionalData",type:"bytes32"}]}],name:"swapExactInWithAttestation",outputs:[],stateMutability:"nonpayable",type:"function"}],Ct=[{type:"tuple",components:[{name:"actions",type:"tuple[]",components:[{name:"to",type:"address"},{name:"data",type:"bytes"}]},{name:"outputAsset",type:"address"},{name:"minOutputAmount",type:"uint256"}]}],D={stringErrors:{"currently closed for trading":{title:"The market for this tokenized asset is closed right now",hint:"Wait until the market reopens (the error message says when) and simply retry."},"Synth exchange suspended. Operation prohibited":{title:"Vault includes deprecated synths in portfolio",hint:"Redeem deprecated synth to be able to withdraw."}},selectorErrors:{"0x54971d46":{signature:"SwapFailed(address,(address,uint256,(bytes32,bytes)),bytes)",title:"The token swap failed to execute",hint:"Your assets are still in your wallet — try again, or retry with a higher slippage tolerance."},"0x81a815ef":{signature:"InsufficientAmountReceived(address,uint256,uint256)",title:"Swap output was below the minimum received amount",hint:"Increase slippage tolerance and try again."}}},Y=t=>({stringErrors:{...t.stringErrors,...D.stringErrors},selectorErrors:{...t.selectorErrors,...D.selectorErrors}}),Pt=["https://cdn.jsdelivr.net/gh/dhedge/V2-Public@master/readmes/errorCodes/registry.json","https://raw.githubusercontent.com/dhedge/V2-Public/master/readmes/errorCodes/registry.json"],xt=1,Bt=1e4,Lt=2e6,Mt=2e3,Ut=500,vt=120,Ft=300,$t=4,Gt=/^dh\d{1,3}$/i,V=/[\u0000-\u001f\u007f]/,Wt=/https?:\/\/|[<>`]/i,Ht=t=>t.length<=vt&&!V.test(t)&&(Gt.test(t)||t.length>=$t),S=t=>typeof t=="string"&&t.length>0&&t.length<=Ft&&!V.test(t)&&!Wt.test(t);let q=D,w=null;const O=()=>q,k=t=>{q=Y(t)},Yt=t=>{const e=t;if(e?.schemaVersion!==xt)throw new Error(`Unsupported error registry schemaVersion: ${String(e?.schemaVersion)}`);const n={};for(const[r,o]of Object.entries(e.stringErrors??{}))o?.curated===!0&&Ht(r)&&S(o.description)&&S(o.action)&&(n[r]={title:o.description,hint:o.action});const s={};for(const[r,o]of Object.entries(e.selectorErrors??{}))o?.curated===!0&&/^0x[0-9a-f]{8}$/.test(r)&&S(o.signature)&&S(o.description)&&S(o.action)&&(s[r]={signature:o.signature,title:o.description,hint:o.action});if(!Object.keys(n).length)throw new Error("Error registry contained no curated string errors");if(Object.keys(n).length>Mt||Object.keys(s).length>Ut)throw new Error("Error registry exceeded expected entry counts");return{stringErrors:n,selectorErrors:s}},K=async({timeoutMs:t=Bt}={})=>{const e=[];for(const n of Pt)try{const s=await H({url:n,method:"GET",timeoutMs:t,maxResponseBytes:Lt});return Y(Yt(s))}catch(s){e.push(`${n}: ${s instanceof Error?s.message:String(s)}`)}throw new Error(`All error registry sources failed: ${e.join("; ")}`)},Vt=()=>(w??(w=K().then(k).catch(()=>{w=null})),w),qt=()=>typeof window<"u";function kt(){return qt()&&typeof window.ethereum<"u"}async function Kt(t){try{if(kt())return window.ethereum.request({method:"wallet_watchAsset",params:{type:"ERC20",options:t}})}catch{return!1}return!1}const m=(t,e)=>t?.toLowerCase()===e?.toLowerCase(),jt=t=>m(t,a.AddressZero$1),f=t=>{if(!t)throw new Error("Cannot prefix an empty hex value");return t.startsWith("0x")?t:`0x${t}`},y=(t,e)=>{try{return BigInt(t)}catch{throw new Error(`Cannot convert "${e}" value "${t}" to bigint`)}},b=t=>t?d.pad(f(t),{size:32}):d.zeroHash,j=t=>{if(!t)throw new Error("Cannot decode an empty base64 string");return d.bytesToHex(Uint8Array.from(atob(t),e=>e.charCodeAt(0)))},X=(t,e)=>a.contractsAddressesMap[e]?.[t]??a.AddressZero,Xt=t=>a.contractsAbisMap[t],Zt=t=>t&&`${t.substring(0,6)}...${t.substring(t.length-4,t.length)}`,zt=({address:t,chainId:e})=>{const n=X("aaveLendingPoolV3",e);return m(t,n)},Z=({sourceAddress:t,amount:e})=>`${t}_${e}`,Qt=(t,e)=>{const n=t.slice(0,e),s=t.slice(e);return{firstPart:n,secondPart:s}},z=(t,e)=>t/e*100,Jt=t=>t<1?4:t<10?3:2,te=(t,e=a.DEFAULT_PRECISION)=>new p(t.toString()).shiftedBy(e).toFixed(0),ee=t=>{const e=t?.trim();return e?!isNaN(Number(e))&&Number(e)>0:!1},ne=(t,e,n,s)=>new p(e).dividedBy(n).multipliedBy(t).shiftedBy(-(s||a.DEFAULT_PRECISION)).toNumber(),se=t=>{const e=new p(t||"0").shiftedBy(a.DEFAULT_PRECISION);return e.isFinite()?BigInt(e.toFixed(0,p.ROUND_DOWN)):BigInt(0)},C=t=>{const e=new p(.01),n=new p(t),s=!n.isZero()&&n.lt(e)?e:n;return BigInt(s.multipliedBy(100).toFixed(0))},re=({chainId:t,slippage:e})=>t===E.hyperEvm.id?BigInt(0):C(e),oe=({vaultAddress:t,swapData:e,sendTokenAddress:n,sendTokenAmount:s,vaultDepositTokenAddress:r,minVaultTokensReceivedAmount:o,routerKey:i="ONE_INCH",swapDestinationAmount:u,swapSlippage:c})=>{const l=new p(u).multipliedBy(1-c/100).toFixed(0),A=[d.stringToHex(i,{size:32}),e];return[t,[[n,s,A],[r,l]],o]},ae=({receiveAssetAddress:t,assets:e,swapData:n,slippage:s})=>{const r={srcData:[],destAmount:new p("0")},{srcData:o,destAmount:i}=e?.reduce((u,c)=>{const l=n?.[c.address];if(!l)return u;const A=[d.stringToHex(l.routerKey,{size:32}),l.rawTransaction.data],h=[c.address,c.rawBalance,A];return{srcData:[...u.srcData,h],destAmount:u.destAmount.plus(l.destinationAmount)}},r)??r;return[o,[t,i.times(1-s/100).toFixed(0,p.ROUND_DOWN)]]},Q=({assetAddress:t,swapQuotes:e,swapParams:n,slippageToleranceForContractTransaction:s,routerKey:r})=>{if(!n)return{supportedAsset:t,withdrawData:"",slippageTolerance:BigInt(0)};const{srcData:o,dstData:i}=n,u=o.map(({asset:A,amount:h})=>{const g=e?.[Z({sourceAddress:A,amount:h.toString()})]?.find(_=>_.routerKey===r);return{asset:A,amount:h,swapData:{routerKey:d.stringToHex(g?.routerKey??"",{size:32}),txData:g?.rawTransaction.data??"0x"}}}),c=d.encodeAbiParameters(a.ComplexWithdrawalAssetSrcDataAbiItem,[u]),l=d.encodeAbiParameters(a.ComplexWithdrawalDataAbiItem,[{encodedSrcData:c,dstData:{dstAddress:i.asset,dstAmount:i.amount},slippage:s}]);return{supportedAsset:t,withdrawData:l,slippageTolerance:s}},ie=({chainId:t,txHash:e,error:n})=>{if(t!==E.mainnet.id||!e||!n)return!1;const s=n instanceof Error?n.message:String(n);return/\bNo Result\b/i.test(s)},ce=({chainId:t,action:e,isRabbyWallet:n})=>e==="update_ondo_prices"&&t===E.mainnet.id&&n?a.ONDO_PRICES_RABBY_SETTLE_DELAY:t?a.TRANSACTION_SETTLE_DELAY[t]??0:0,ue=(t,e)=>a.CHAIN_NATIVE_TOKENS[e]?.nativeTokenSymbol===t,de=({nativeTokenBalance:t,tokenDecimals:e,gasPrice:n})=>{const s=new p(n).multipliedBy(a.NATIVE_TOKEN_GAS_RESERVE_UNITS).shiftedBy(-e),r=new p(t).minus(s);return r.gt("0")?r:new p("0")},le=t=>a.STABLE_TOKEN_SYMBOLS.includes(t),pe=t=>{const e=Object.values(t).reduce((n,{type:s})=>(n[s]=n[s]+1,n),{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},me=(t,e=150)=>t.length>e?t.substring(0,e):t,J=()=>({...O().stringErrors,...a.TRANSACTION_ERRORS}),ye=()=>[...Object.keys(J()),...Object.keys(a.LIMIT_ORDER_TRANSACTION_ERRORS)],Ae=/^dh\d+$/i,ge=(t,e)=>Ae.test(e)?new RegExp(`\\b${e}\\b`,"i").test(t):t.includes(e.toLowerCase()),R=(t,e)=>{const n=t.toLowerCase();return[...e??ye()].sort((s,r)=>r.length-s.length).find(s=>ge(n,s))},L=t=>J()[t]??a.LIMIT_ORDER_TRANSACTION_ERRORS[t],Ee=/\b0x[0-9a-f]{8}\b/i,he=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Te=t=>{const{selectorErrors:e}=O(),n=t.match(Ee)?.[0]?.toLowerCase(),s=n?e[n]:void 0;if(s)return{title:s.title,hint:s.hint};const r=Object.values(e).find(o=>new RegExp(`\\b${he(o.signature.split("(")[0]??"")}\\b`).test(t));return r?{title:r.title,hint:r.hint}:void 0},Se=({errorMessage:t,abiErrors:e})=>{if(!t||t.includes("User rejected"))return null;const n=e.find(i=>t.includes(i));if(n){const i=R(n);if(i)return L(i)}const s=R(t);if(s)return L(s);const r=Te(t);if(r)return r;const[o]=t.split(n?".":"Contract").map(i=>i.trim());return{title:"Transaction failed",hint:`${me(o??"")} ${n?`: ${n}`:""}`}},fe=t=>typeof t=="number"&&Number.isFinite(t),_e=t=>typeof t=="bigint"&&t!==BigInt(0),tt=(t,e=a.DEFAULT_PRECISION$1)=>new p(t).shiftedBy(-e).toNumber(),et=t=>!isNaN(parseFloat(t))&&!isNaN(t),nt=({value:t,minimumFractionDigits:e=2,maximumFractionDigits:n=2,compact:s=!1,normalize:r=!1})=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:s?"compact":void 0,minimumFractionDigits:e,maximumFractionDigits:n}).format(r?tt(t):Number(t)),I=t=>et(t)?new p(t).toFixed():"",M=["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"],st=({value:t,decimals:e=4})=>{const n=new p(t);if(n.isGreaterThan(1)||n.isZero())return I(n.toFixed(e));const r=(/e/i.test(t.toString())?parseFloat(t.toString()).toFixed(a.DEFAULT_PRECISION$1):t.toString()).match(/^0\.(0+)(\d+)$/);if(r){const[,o,i]=r;if(o.length>=e&&o.length<M.length)return`0.0${M[o.length]}${i.slice(0,3)}`}return I(n.toFixed(e))},rt=(t,e=0)=>`${t.toLocaleString("en-US",{maximumFractionDigits:e})}%`,De=t=>t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),we=(t,e,n=0)=>{const s=z(+t,e);return rt(s,n)},be=({currency:t,value:e})=>t==="USD"?nt({value:e}):`${a.CURRENCY_SYMBOL_MAP[t]} ${st({value:e,decimals:a.CURRENCY_DECIMALS_MAP[t]})}`,ot=(t,e)=>new p(new p(t).toFixed(e,p.ROUND_DOWN)).toString(),at=(t,e=3,n=2)=>{if(t.length<=5)return t;const s="...";return t.length<=e+n+s.length?t:`${t.slice(0,e)}${s}${t.slice(-n)}`},Re=({balance:t,symbol:e,precision:n,truncateSymbol:s})=>`${ot(t,n)} ${s?at(e):e}`,Ie=t=>{if(!t)return;const e=t.match(/0x[a-fA-F0-9]{64}/);if(!e)return;const n=e[0];return`${n.slice(0,4)}...${n.slice(-3)}`},Ne=t=>m(a.FLATMONEY_EARLY_DEPOSITOR_VAULT_ADDRESS_BASE,t)||m(a.FLATMONEY_DHT_STAKING_VAULT_ADDRESS_BASE,t),Oe=t=>a.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES.some(e=>m(e,t)),Ce=t=>a.FLAT_MONEY_COLLATERAL_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:a.AddressZero},Pe=t=>m(t,a.FLAT_MONEY_V1_UNIT_ADDRESS)?a.FLAT_MONEY_V1_UNIT_LINK:a.FLAT_MONEY_UNIT_LINK,it=t=>`eth_${t}`,xe=({action:t,log:e,symbol:n,vaultAddress:s,chainId:r})=>{const o={[a.TRADING_LOG_EVENT_PARAM.SYMBOL.NAME]:n,[a.TRADING_LOG_EVENT_PARAM.CHAIN_ID.NAME]:r,[a.TRADING_LOG_EVENT_PARAM.ADDRESS.NAME]:it(s)};a.LOG_EVENT_BY_TRANSACTION_ACTION_MAP[t].forEach(i=>{e?.(i,o)})},Be=t=>a.GMX_MARKET_ASSETS.some(e=>m(e,t)),Le=t=>a.GMX_WITHDRAW_ASSET_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:a.AddressZero},Me=t=>a.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS[t.toLowerCase()],ct="0x3333333333333333333333333333333333333333";E.arbitrum.id+"",a.USDC_ARBITRUM.address,E.base.id+"",a.USDC_BASE.address,E.optimism.id+"",a.USDC_OPTIMISM.address,E.polygon.id+"",a.USDC_POLYGON.address,E.mainnet.id+"",a.USDC_MAINNET.address,E.hyperEvm.id+"",a.USDC_HYPEREVM.address;const Ue="0x2222222222222222222222222222222222222222",U=BigInt("0x2000000000000000000000000000000000000000"),ve=10000n,ut=t=>m(t,ct),dt=t=>{if(m(t,Ue))return!0;try{const e=BigInt(t);return e>=U&&e<U+ve}catch{return!1}},Fe=t=>ut(t)||dt(t),$e=()=>a.USDC_HYPEREVM,Ge=new Map,P=(t,e)=>!e||e.size===0?t:t.map(n=>{const s=e.get(n.supportedAsset.toLowerCase());return s?{...n,withdrawData:s.withdrawData,slippageTolerance:s.slippageTolerance}:n}),lt=t=>{const e=t.find(({swapQuotes:n})=>n);return e?.swapQuotes?Object.values(e.swapQuotes)[0]?.map(({routerKey:n})=>n)??[]:[]},pt=(t,e,n)=>t.map(({asset:s,swapParams:r,swapQuotes:o})=>!r||!o?{supportedAsset:s,withdrawData:"",slippageTolerance:n}:Q({assetAddress:s,swapQuotes:o,swapParams:r,slippageToleranceForContractTransaction:n,routerKey:e})),mt=async(t,e,n,s,r,o)=>{for(const i of t){const u=P(pt(e,i,n),o),{error:c}=await s(...r,u);if(!c)return u}return null},We=(t,e,n)=>{const s=(t??[]).map(r=>({supportedAsset:r,withdrawData:"",slippageTolerance:e}));return P(s,n)},He=async(t,e,n,s,r)=>{for(const o of t){const i=C(o);try{const u=await e(o),c=lt(u),l=await mt(c,u,i,n,s,r);if(l)return console.debug(`[Init Withdraw] Auto slippage simulation succeeded: slippage=${o}%`),console.debug("[Init Withdraw] Complex asset data:",l),l}catch(u){console.error(`[Init Withdraw] Failed to fetch quotes for slippage=${o}%:`,u)}}return null},Ye=async(t,e,{fetchAaveSwapParams:n,fetchAaveSwapQuotes:s,withdrawAmountD18:r,slippage:o})=>Promise.all((t??[]).map(async i=>{if(!m(i,e))return{asset:i};try{const c=await n({withdrawAmountD18:r,slippage:o});if(c?.srcData.length){const l=await s({swapParams:c,slippage:o});return{asset:i,swapParams:c,swapQuotes:l}}return{asset:i}}catch(c){return console.error(c),{asset:i}}})),v=t=>Math.round(t*100)/100,Ve=({maxSlippage:t,candidates:e=a.SLIPPAGE_AUTO_SIMULATION_CANDIDATES})=>{if(!Number.isFinite(t)||t<=0)return[];const n=v(Math.min(t,100)),s=e.filter(o=>o>0&&o<=n).map(v),r=new Set(s);return r.add(n),r.add(t),Array.from(r).sort((o,i)=>o-i)},x=1000000000000000000n,qe=1000000n,F=10000n,$=100n,ke=t=>({quotes:t.quotes.map(e=>({chainId:y(e.chainId,"chainId"),attestationId:y(e.attestationId,"attestationId"),userId:f(e.userId),asset:e.asset,price:y(e.price,"price"),quantity:y(e.quantity,"quantity"),expiration:y(e.expiration,"expiration"),side:Number(e.side),additionalData:f(e.additionalData)})),signatures:t.signatures.map(f)}),yt=(t,e)=>t*e/x,At=x,Ke=(t,e)=>!!e&&yt(t,e)<At,gt=(t,e,n)=>{const s=BigInt(Math.max(0,Math.round(n*100))),r=s>$?$:s,o=F-r,u=yt(t,e)*o*qe,c=F*x;return(u+c-1n)/c},Et=(t,e)=>({chainId:e,attestationId:y(t.attestationId,"attestationId"),userId:b(t.userId),asset:t.assetAddress,price:y(t.price,"price"),quantity:y(t.tokenAmount,"tokenAmount"),expiration:y(t.expiration,"expiration"),side:Number(t.side),additionalData:b(t.additionalData)}),je=({attestation:t,chainId:e,slippagePercent:n})=>{const s=Et(t,e);return d.encodeAbiParameters(Rt,[{attestationSignature:j(t.signature),quote:s,amountOutMinimum:gt(s.quantity,s.price,n)}])},Xe=t=>[...t.reduce((n,s)=>n.has(s.accountId)?n:n.set(s.accountId,s),new Map).values()].map(({accountId:n,marketId:s})=>({accountId:n,marketId:s,collaterals:t.filter(r=>r.accountId===n&&!r.isDebt),debt:t.find(r=>r.accountId===n&&r.isDebt)})),Ze=({collateral:t,dytmOffice:e,processor:n,gmToken:s,ondoGMSwap:r,usdc:o,gmAmount:i,amountOutMinimum:u,signature:c,quote:l})=>[{to:e,data:d.encodeFunctionData({abi:N,functionName:"withdraw",args:[{account:t.accountId,tokenId:t.tokenId,receiver:n,assets:0n,shares:d.maxUint256,extraData:"0x"}]})},{to:s,data:d.encodeFunctionData({abi:d.erc20Abi,functionName:"approve",args:[r,i]})},{to:r,data:d.encodeFunctionData({abi:Ot,functionName:"swapExactInWithAttestation",args:[s,i,o,u,c,l]})}],ze=({collateral:t,dytmOffice:e,processor:n})=>({to:e,data:d.encodeFunctionData({abi:N,functionName:"withdraw",args:[{account:t.accountId,tokenId:t.tokenId,receiver:n,assets:0n,shares:d.maxUint256,extraData:"0x"}]})}),Qe=({accountId:t,debtKey:e,dytmOffice:n,usdc:s})=>[{to:s,data:d.encodeFunctionData({abi:d.erc20Abi,functionName:"approve",args:[n,d.maxUint256]})},{to:n,data:d.encodeFunctionData({abi:N,functionName:"repay",args:[{account:t,key:e,withCollateralType:0,assets:d.maxUint256,shares:0n,extraData:"0x"}]})}],Je=({actions:t,outputAsset:e,minOutputAmount:n})=>d.encodeAbiParameters(Ct,[{actions:t,outputAsset:e,minOutputAmount:n}]),G=new Set,tn=t=>{const e=t?.message;!e||G.has(e)||(G.add(e),console.warn(e))};exports.DytmOfficeAssetGuardAbi=Nt;exports.EMPTY_PER_ASSET_WITHDRAW_DATA=Ge;exports.HYPERLIQUID_PERPS_ACCOUNT_ADDRESS=ct;exports.MIN_GM_UNWIND_VALUE_USD=At;exports.OndoGMTokenAssetGuardAbi=bt;exports.THIRD_PARTY_CONTRACT_ERRORS=D;exports.addTokenToWallet=Kt;exports.applyContractErrorRegistry=k;exports.base64ToHex=j;exports.buildAaveWithdrawAssetTransactionData=Q;exports.buildComplexAssetDataForRouter=pt;exports.buildDytmActions=Ze;exports.buildDytmOutputAssetWithdrawAction=ze;exports.buildDytmRepayActions=Qe;exports.buildSwapQuoteKeyForAave=Z;exports.buildSwapWithdrawTransactionData=ae;exports.buildZapDepositTransactionArguments=oe;exports.clientSide=wt;exports.commify=De;exports.computeAmountOutMinimumUsdc=gt;exports.createDefaultComplexAssetData=We;exports.encodeOndoWithdrawData=je;exports.encodeUnwindPlan=Je;exports.enrichAssetsWithSwapQuotes=Ye;exports.ensureContractErrorRegistryLoaded=Vt;exports.ensureHexPrefix=f;exports.extractAvailableRouterKeys=lt;exports.fetchContractErrorRegistry=K;exports.fetchRequest=H;exports.formatBalance=ot;exports.formatByCurrency=be;exports.formatNumberToLimitedDecimals=st;exports.formatNumeratorToPercentage=we;exports.formatPercentage=rt;exports.formatToUsd=nt;exports.formatTokenBalance=Re;exports.getAutoSlippageSimulationCandidates=Ve;exports.getComplexAssetDataSlippageTolerance=re;exports.getContractAbiById=Xt;exports.getContractAddressById=X;exports.getContractErrorRegistry=O;exports.getConventionalTokenPriceDecimals=Jt;exports.getErrorKey=R;exports.getFlatMoneyCollateralByLeverageAddress=Ce;exports.getFlatMoneyLinkByUnitAddress=Pe;exports.getGmxWithdrawAssetByLeverageAddress=Le;exports.getGmxWithdrawAssetByVaultAddress=Me;exports.getHyperliquidWithdrawAsset=$e;exports.getNativeTokenInvestableBalance=de;exports.getPercent=z;exports.getPoolFraction=ne;exports.getSettleDelay=ce;exports.getSlippageToleranceForContractTransaction=C;exports.getTxHashShort=Ie;exports.groupPreviewByAccount=Xe;exports.isAaveLendAndBorrowAsset=zt;exports.isEqualAddress=m;exports.isFlatMoneyLeveragedAsset=Oe;exports.isFmpAirdropVaultAddress=Ne;exports.isGmxLeveragedAsset=Be;exports.isHyperliquidCorePositionAsset=Fe;exports.isHyperliquidPerpsAsset=ut;exports.isHyperliquidSpotSystemAsset=dt;exports.isNativeToken=ue;exports.isNumberType=fe;exports.isNumeric=et;exports.isPositiveNumber=ee;exports.isStableSymbol=le;exports.isUnswappableGmDust=Ke;exports.isZeroAddress=jt;exports.logContractErrorOnce=tn;exports.logTransactionByActionType=xe;exports.mapAttestationToOndoQuote=Et;exports.mapOndoApiResponseToUpdatePricesArgs=ke;exports.nonZeroBigInt=_e;exports.normalizeNumber=tt;exports.overlayWithdrawData=P;exports.parseAmountToD18=se;exports.parseContractErrorMessage=Se;exports.parseFetchErrorBody=Tt;exports.removeInsignificantTrailingZeros=I;exports.shiftBy=te;exports.shortenAddress=Zt;exports.shouldSwallowMainnetPollError=ie;exports.sliceByIndex=Qt;exports.toBigInt=y;exports.toBytes32Hex=b;exports.transformAddressForAnalytics=it;exports.truncateString=at;exports.tryEstimateWithRouters=mt;exports.tryEstimateWithSlippageValues=He;exports.validateLoggerEventParams=pe;
|
|
1
|
+
"use strict";const E=require("wagmi/chains"),a=require("./gmx-wSTKl_Pc.cjs"),p=require("bignumber.js"),d=require("viem"),B="application/json";class W extends Error{constructor(e,n,s){super(`HTTP ${e}${s?`: ${s}`:""}`),this.name="FetchRequestError",this.status=e,this.statusText=n,this.body=s}}const Tt=t=>{if(!(t instanceof W)||!t.body)return null;try{return JSON.parse(t.body)}catch{return null}},St=t=>typeof t=="string"||t instanceof FormData||t instanceof URLSearchParams||t instanceof Blob||t instanceof ArrayBuffer||ArrayBuffer.isView(t),ft=(t,e)=>{const n=String(t),s=e?new URLSearchParams(e).toString():"";if(!s)return n;const r=n.indexOf("#"),o=r===-1?n:n.slice(0,r),i=r===-1?"":n.slice(r);return`${o}${o.includes("?")?"&":"?"}${s}${i}`},_t=(t,e)=>{const n=new AbortController,s=()=>n.abort();e?.aborted&&s();const r=setTimeout(s,t);return e?.addEventListener("abort",s),{signal:n.signal,cleanup:()=>{clearTimeout(r),e?.removeEventListener("abort",s)}}},Dt=async(t,e,n)=>{if(n===void 0)return await t[e]();const s=Number(t.headers.get("content-length"));if(s>n)throw new Error(`Response too large: ${s} bytes`);if(e==="blob"||e==="arrayBuffer"){const o=await t[e](),i=o instanceof Blob?o.size:o.byteLength;if(i>n)throw new Error(`Response too large: ${i} bytes`);return o}const r=await t.text();if(r.length>n)throw new Error(`Response too large: ${r.length} chars`);return e==="json"?JSON.parse(r):r},H=async({url:t,headers:e,method:n,body:s,params:r,signal:o,readMethod:i="json",cache:u,timeoutMs:c,maxResponseBytes:l})=>{const A=s!==void 0&&n!=="GET",h=A&&!St(s),g=new Headers(e);i==="json"&&!g.has("Accept")&&g.set("Accept",B),h&&!g.has("Content-Type")&&g.set("Content-Type",B);const _=c?_t(c,o):void 0,ht={method:n,headers:g,signal:_?.signal??o,...u&&{cache:u},...A&&{body:h?JSON.stringify(s):s}};try{const T=await fetch(ft(t,r),ht);if(!T.ok)throw new W(T.status,T.statusText,await T.text().catch(()=>""));return await Dt(T,i,l)}finally{_?.cleanup()}},wt=typeof window<"u",bt=[{inputs:[{internalType:"address",name:"_pool",type:"address"},{internalType:"address",name:"_asset",type:"address"},{internalType:"uint256",name:"_poolTokenAmount",type:"uint256"}],name:"previewGmTokenAmount",outputs:[{internalType:"uint256",name:"gmTokenAmount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ondoGMSwap",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"usdc",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],Rt=[{type:"tuple",components:[{name:"attestationSignature",type:"bytes"},{name:"quote",type:"tuple",components:[{name:"chainId",type:"uint256"},{name:"attestationId",type:"uint256"},{name:"userId",type:"bytes32"},{name:"asset",type:"address"},{name:"price",type:"uint256"},{name:"quantity",type:"uint256"},{name:"expiration",type:"uint256"},{name:"side",type:"uint8"},{name:"additionalData",type:"bytes32"}]},{name:"amountOutMinimum",type:"uint256"}]}],It=[{name:"asset",type:"address"},{name:"amount",type:"uint256"},{name:"assetType",type:"uint16"},{name:"isPool",type:"bool"},{name:"isDebt",type:"bool"},{name:"marketId",type:"uint88"},{name:"accountId",type:"uint256"},{name:"tokenId",type:"uint256"},{name:"debtKey",type:"uint248"},{name:"shares",type:"uint256"}],Nt=[{inputs:[{internalType:"address",name:"_pool",type:"address"},{internalType:"uint256",name:"_poolTokenAmount",type:"uint256"}],name:"previewWithdrawal",outputs:[{name:"assetData",type:"tuple[]",components:It}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"dytmWithdrawProcessor",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"}],N=[{inputs:[{name:"params",type:"tuple",components:[{name:"account",type:"uint256"},{name:"tokenId",type:"uint256"},{name:"receiver",type:"address"},{name:"assets",type:"uint256"},{name:"shares",type:"uint256"},{name:"extraData",type:"bytes"}]}],name:"withdraw",outputs:[{name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"params",type:"tuple",components:[{name:"account",type:"uint256"},{name:"key",type:"uint248"},{name:"withCollateralType",type:"uint8"},{name:"assets",type:"uint256"},{name:"shares",type:"uint256"},{name:"extraData",type:"bytes"}]}],name:"repay",outputs:[{name:"assetsRepaid",type:"uint256"}],stateMutability:"nonpayable",type:"function"}],Ot=[{inputs:[{name:"tokenIn",type:"address"},{name:"amountIn",type:"uint256"},{name:"tokenOut",type:"address"},{name:"amountOutMinimum",type:"uint256"},{name:"attestationSignature",type:"bytes"},{name:"quote",type:"tuple",components:[{name:"chainId",type:"uint256"},{name:"attestationId",type:"uint256"},{name:"userId",type:"bytes32"},{name:"asset",type:"address"},{name:"price",type:"uint256"},{name:"quantity",type:"uint256"},{name:"expiration",type:"uint256"},{name:"side",type:"uint8"},{name:"additionalData",type:"bytes32"}]}],name:"swapExactInWithAttestation",outputs:[],stateMutability:"nonpayable",type:"function"}],Ct=[{type:"tuple",components:[{name:"actions",type:"tuple[]",components:[{name:"to",type:"address"},{name:"data",type:"bytes"}]},{name:"outputAsset",type:"address"},{name:"minOutputAmount",type:"uint256"}]}],D={stringErrors:{"currently closed for trading":{title:"The market for this tokenized asset is closed right now",hint:"Wait until the market reopens (the error message says when) and simply retry."},"Synth exchange suspended. Operation prohibited":{title:"Vault includes deprecated synths in portfolio",hint:"Redeem deprecated synth to be able to withdraw."}},selectorErrors:{"0x54971d46":{signature:"SwapFailed(address,(address,uint256,(bytes32,bytes)),bytes)",title:"The token swap failed to execute",hint:"Your assets are still in your wallet — try again, or retry with a higher slippage tolerance."},"0x81a815ef":{signature:"InsufficientAmountReceived(address,uint256,uint256)",title:"Swap output was below the minimum received amount",hint:"Increase slippage tolerance and try again."}}},Y=t=>({stringErrors:{...t.stringErrors,...D.stringErrors},selectorErrors:{...t.selectorErrors,...D.selectorErrors}}),Pt=["https://cdn.jsdelivr.net/gh/dhedge/V2-Public@master/readmes/errorCodes/registry.json","https://raw.githubusercontent.com/dhedge/V2-Public/master/readmes/errorCodes/registry.json"],xt=1,Bt=1e4,Lt=2e6,Mt=2e3,Ut=500,vt=120,Ft=300,$t=4,Gt=/^dh\d{1,3}$/i,V=/[\u0000-\u001f\u007f]/,Wt=/https?:\/\/|[<>`]/i,Ht=t=>t.length<=vt&&!V.test(t)&&(Gt.test(t)||t.length>=$t),S=t=>typeof t=="string"&&t.length>0&&t.length<=Ft&&!V.test(t)&&!Wt.test(t);let q=D,w=null;const O=()=>q,k=t=>{q=Y(t)},Yt=t=>{const e=t;if(e?.schemaVersion!==xt)throw new Error(`Unsupported error registry schemaVersion: ${String(e?.schemaVersion)}`);const n={};for(const[r,o]of Object.entries(e.stringErrors??{}))o?.curated===!0&&Ht(r)&&S(o.description)&&S(o.action)&&(n[r]={title:o.description,hint:o.action});const s={};for(const[r,o]of Object.entries(e.selectorErrors??{}))o?.curated===!0&&/^0x[0-9a-f]{8}$/.test(r)&&S(o.signature)&&S(o.description)&&S(o.action)&&(s[r]={signature:o.signature,title:o.description,hint:o.action});if(!Object.keys(n).length)throw new Error("Error registry contained no curated string errors");if(Object.keys(n).length>Mt||Object.keys(s).length>Ut)throw new Error("Error registry exceeded expected entry counts");return{stringErrors:n,selectorErrors:s}},K=async({timeoutMs:t=Bt}={})=>{const e=[];for(const n of Pt)try{const s=await H({url:n,method:"GET",timeoutMs:t,maxResponseBytes:Lt});return Y(Yt(s))}catch(s){e.push(`${n}: ${s instanceof Error?s.message:String(s)}`)}throw new Error(`All error registry sources failed: ${e.join("; ")}`)},Vt=()=>(w??(w=K().then(k).catch(()=>{w=null})),w),qt=()=>typeof window<"u";function kt(){return qt()&&typeof window.ethereum<"u"}async function Kt(t){try{if(kt())return window.ethereum.request({method:"wallet_watchAsset",params:{type:"ERC20",options:t}})}catch{return!1}return!1}const m=(t,e)=>t?.toLowerCase()===e?.toLowerCase(),jt=t=>m(t,a.AddressZero$1),f=t=>{if(!t)throw new Error("Cannot prefix an empty hex value");return t.startsWith("0x")?t:`0x${t}`},y=(t,e)=>{try{return BigInt(t)}catch{throw new Error(`Cannot convert "${e}" value "${t}" to bigint`)}},b=t=>t?d.pad(f(t),{size:32}):d.zeroHash,j=t=>{if(!t)throw new Error("Cannot decode an empty base64 string");return d.bytesToHex(Uint8Array.from(atob(t),e=>e.charCodeAt(0)))},X=(t,e)=>a.contractsAddressesMap[e]?.[t]??a.AddressZero,Xt=t=>a.contractsAbisMap[t],Zt=t=>t&&`${t.substring(0,6)}...${t.substring(t.length-4,t.length)}`,zt=({address:t,chainId:e})=>{const n=X("aaveLendingPoolV3",e);return m(t,n)},Z=({sourceAddress:t,amount:e})=>`${t}_${e}`,Qt=(t,e)=>{const n=t.slice(0,e),s=t.slice(e);return{firstPart:n,secondPart:s}},z=(t,e)=>t/e*100,Jt=t=>t<1?4:t<10?3:2,te=(t,e=a.DEFAULT_PRECISION)=>new p(t.toString()).shiftedBy(e).toFixed(0),ee=t=>{const e=t?.trim();return e?!isNaN(Number(e))&&Number(e)>0:!1},ne=(t,e,n,s)=>new p(e).dividedBy(n).multipliedBy(t).shiftedBy(-(s||a.DEFAULT_PRECISION)).toNumber(),se=t=>{const e=new p(t||"0").shiftedBy(a.DEFAULT_PRECISION);return e.isFinite()?BigInt(e.toFixed(0,p.ROUND_DOWN)):BigInt(0)},C=t=>{const e=new p(.01),n=new p(t),s=!n.isZero()&&n.lt(e)?e:n;return BigInt(s.multipliedBy(100).toFixed(0))},re=({chainId:t,slippage:e})=>t===E.hyperEvm.id?BigInt(0):C(e),oe=({vaultAddress:t,swapData:e,sendTokenAddress:n,sendTokenAmount:s,vaultDepositTokenAddress:r,minVaultTokensReceivedAmount:o,routerKey:i="ONE_INCH",swapDestinationAmount:u,swapSlippage:c})=>{const l=new p(u).multipliedBy(1-c/100).toFixed(0),A=[d.stringToHex(i,{size:32}),e];return[t,[[n,s,A],[r,l]],o]},ae=({receiveAssetAddress:t,assets:e,swapData:n,slippage:s})=>{const r={srcData:[],destAmount:new p("0")},{srcData:o,destAmount:i}=e?.reduce((u,c)=>{const l=n?.[c.address];if(!l)return u;const A=[d.stringToHex(l.routerKey,{size:32}),l.rawTransaction.data],h=[c.address,c.rawBalance,A];return{srcData:[...u.srcData,h],destAmount:u.destAmount.plus(l.destinationAmount)}},r)??r;return[o,[t,i.times(1-s/100).toFixed(0,p.ROUND_DOWN)]]},Q=({assetAddress:t,swapQuotes:e,swapParams:n,slippageToleranceForContractTransaction:s,routerKey:r})=>{if(!n)return{supportedAsset:t,withdrawData:"",slippageTolerance:BigInt(0)};const{srcData:o,dstData:i}=n,u=o.map(({asset:A,amount:h})=>{const g=e?.[Z({sourceAddress:A,amount:h.toString()})]?.find(_=>_.routerKey===r);return{asset:A,amount:h,swapData:{routerKey:d.stringToHex(g?.routerKey??"",{size:32}),txData:g?.rawTransaction.data??"0x"}}}),c=d.encodeAbiParameters(a.ComplexWithdrawalAssetSrcDataAbiItem,[u]),l=d.encodeAbiParameters(a.ComplexWithdrawalDataAbiItem,[{encodedSrcData:c,dstData:{dstAddress:i.asset,dstAmount:i.amount},slippage:s}]);return{supportedAsset:t,withdrawData:l,slippageTolerance:s}},ie=({chainId:t,txHash:e,error:n})=>{if(t!==E.mainnet.id||!e||!n)return!1;const s=n instanceof Error?n.message:String(n);return/\bNo Result\b/i.test(s)},ce=({chainId:t,action:e,isRabbyWallet:n})=>e==="update_ondo_prices"&&t===E.mainnet.id&&n?a.ONDO_PRICES_RABBY_SETTLE_DELAY:t?a.TRANSACTION_SETTLE_DELAY[t]??0:0,ue=(t,e)=>a.CHAIN_NATIVE_TOKENS[e]?.nativeTokenSymbol===t,de=({nativeTokenBalance:t,tokenDecimals:e,gasPrice:n})=>{const s=new p(n).multipliedBy(a.NATIVE_TOKEN_GAS_RESERVE_UNITS).shiftedBy(-e),r=new p(t).minus(s);return r.gt("0")?r:new p("0")},le=t=>a.STABLE_TOKEN_SYMBOLS.includes(t),pe=t=>{const e=Object.values(t).reduce((n,{type:s})=>(n[s]=n[s]+1,n),{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},me=(t,e=150)=>t.length>e?t.substring(0,e):t,J=()=>({...O().stringErrors,...a.TRANSACTION_ERRORS}),ye=()=>[...Object.keys(J()),...Object.keys(a.LIMIT_ORDER_TRANSACTION_ERRORS)],Ae=/^dh\d+$/i,ge=(t,e)=>Ae.test(e)?new RegExp(`\\b${e}\\b`,"i").test(t):t.includes(e.toLowerCase()),R=(t,e)=>{const n=t.toLowerCase();return[...e??ye()].sort((s,r)=>r.length-s.length).find(s=>ge(n,s))},L=t=>J()[t]??a.LIMIT_ORDER_TRANSACTION_ERRORS[t],Ee=/\b0x[0-9a-f]{8}\b/i,he=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Te=t=>{const{selectorErrors:e}=O(),n=t.match(Ee)?.[0]?.toLowerCase(),s=n?e[n]:void 0;if(s)return{title:s.title,hint:s.hint};const r=Object.values(e).find(o=>new RegExp(`\\b${he(o.signature.split("(")[0]??"")}\\b`).test(t));return r?{title:r.title,hint:r.hint}:void 0},Se=({errorMessage:t,abiErrors:e})=>{if(!t||t.includes("User rejected"))return null;const n=e.find(i=>t.includes(i));if(n){const i=R(n);if(i)return L(i)}const s=R(t);if(s)return L(s);const r=Te(t);if(r)return r;const[o]=t.split(n?".":"Contract").map(i=>i.trim());return{title:"Transaction failed",hint:`${me(o??"")} ${n?`: ${n}`:""}`}},fe=t=>typeof t=="number"&&Number.isFinite(t),_e=t=>typeof t=="bigint"&&t!==BigInt(0),tt=(t,e=a.DEFAULT_PRECISION$1)=>new p(t).shiftedBy(-e).toNumber(),et=t=>!isNaN(parseFloat(t))&&!isNaN(t),nt=({value:t,minimumFractionDigits:e=2,maximumFractionDigits:n=2,compact:s=!1,normalize:r=!1})=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:s?"compact":void 0,minimumFractionDigits:e,maximumFractionDigits:n}).format(r?tt(t):Number(t)),I=t=>et(t)?new p(t).toFixed():"",M=["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"],st=({value:t,decimals:e=4})=>{const n=new p(t);if(n.isGreaterThan(1)||n.isZero())return I(n.toFixed(e));const r=(/e/i.test(t.toString())?parseFloat(t.toString()).toFixed(a.DEFAULT_PRECISION$1):t.toString()).match(/^0\.(0+)(\d+)$/);if(r){const[,o,i]=r;if(o.length>=e&&o.length<M.length)return`0.0${M[o.length]}${i.slice(0,3)}`}return I(n.toFixed(e))},rt=(t,e=0)=>`${t.toLocaleString("en-US",{maximumFractionDigits:e})}%`,De=t=>t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),we=(t,e,n=0)=>{const s=z(+t,e);return rt(s,n)},be=({currency:t,value:e})=>t==="USD"?nt({value:e}):`${a.CURRENCY_SYMBOL_MAP[t]} ${st({value:e,decimals:a.CURRENCY_DECIMALS_MAP[t]})}`,ot=(t,e)=>new p(new p(t).toFixed(e,p.ROUND_DOWN)).toString(),at=(t,e=3,n=2)=>{if(t.length<=5)return t;const s="...";return t.length<=e+n+s.length?t:`${t.slice(0,e)}${s}${t.slice(-n)}`},Re=({balance:t,symbol:e,precision:n,truncateSymbol:s})=>`${ot(t,n)} ${s?at(e):e}`,Ie=t=>{if(!t)return;const e=t.match(/0x[a-fA-F0-9]{64}/);if(!e)return;const n=e[0];return`${n.slice(0,4)}...${n.slice(-3)}`},Ne=t=>m(a.FLATMONEY_EARLY_DEPOSITOR_VAULT_ADDRESS_BASE,t)||m(a.FLATMONEY_DHT_STAKING_VAULT_ADDRESS_BASE,t),Oe=t=>a.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES.some(e=>m(e,t)),Ce=t=>a.FLAT_MONEY_COLLATERAL_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:a.AddressZero},Pe=t=>m(t,a.FLAT_MONEY_V1_UNIT_ADDRESS)?a.FLAT_MONEY_V1_UNIT_LINK:a.FLAT_MONEY_UNIT_LINK,it=t=>`eth_${t}`,xe=({action:t,log:e,symbol:n,vaultAddress:s,chainId:r})=>{const o={[a.TRADING_LOG_EVENT_PARAM.SYMBOL.NAME]:n,[a.TRADING_LOG_EVENT_PARAM.CHAIN_ID.NAME]:r,[a.TRADING_LOG_EVENT_PARAM.ADDRESS.NAME]:it(s)};a.LOG_EVENT_BY_TRANSACTION_ACTION_MAP[t].forEach(i=>{e?.(i,o)})},Be=t=>a.GMX_MARKET_ASSETS.some(e=>m(e,t)),Le=t=>a.GMX_WITHDRAW_ASSET_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:a.AddressZero},Me=t=>a.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS[t.toLowerCase()],ct="0x3333333333333333333333333333333333333333";E.arbitrum.id+"",a.USDC_ARBITRUM.address,E.base.id+"",a.USDC_BASE.address,E.optimism.id+"",a.USDC_OPTIMISM.address,E.polygon.id+"",a.USDC_POLYGON.address,E.mainnet.id+"",a.USDC_MAINNET.address,E.hyperEvm.id+"",a.USDC_HYPEREVM.address;const Ue="0x2222222222222222222222222222222222222222",U=BigInt("0x2000000000000000000000000000000000000000"),ve=10000n,ut=t=>m(t,ct),dt=t=>{if(m(t,Ue))return!0;try{const e=BigInt(t);return e>=U&&e<U+ve}catch{return!1}},Fe=t=>ut(t)||dt(t),$e=()=>a.USDC_HYPEREVM,Ge=new Map,P=(t,e)=>!e||e.size===0?t:t.map(n=>{const s=e.get(n.supportedAsset.toLowerCase());return s?{...n,withdrawData:s.withdrawData,slippageTolerance:s.slippageTolerance}:n}),lt=t=>{const e=t.find(({swapQuotes:n})=>n);return e?.swapQuotes?Object.values(e.swapQuotes)[0]?.map(({routerKey:n})=>n)??[]:[]},pt=(t,e,n)=>t.map(({asset:s,swapParams:r,swapQuotes:o})=>!r||!o?{supportedAsset:s,withdrawData:"",slippageTolerance:n}:Q({assetAddress:s,swapQuotes:o,swapParams:r,slippageToleranceForContractTransaction:n,routerKey:e})),mt=async(t,e,n,s,r,o)=>{for(const i of t){const u=P(pt(e,i,n),o),{error:c}=await s(...r,u);if(!c)return u}return null},We=(t,e,n)=>{const s=(t??[]).map(r=>({supportedAsset:r,withdrawData:"",slippageTolerance:e}));return P(s,n)},He=async(t,e,n,s,r)=>{for(const o of t){const i=C(o);try{const u=await e(o),c=lt(u),l=await mt(c,u,i,n,s,r);if(l)return console.debug(`[Init Withdraw] Auto slippage simulation succeeded: slippage=${o}%`),console.debug("[Init Withdraw] Complex asset data:",l),l}catch(u){console.error(`[Init Withdraw] Failed to fetch quotes for slippage=${o}%:`,u)}}return null},Ye=async(t,e,{fetchAaveSwapParams:n,fetchAaveSwapQuotes:s,withdrawAmountD18:r,slippage:o})=>Promise.all((t??[]).map(async i=>{if(!m(i,e))return{asset:i};try{const c=await n({withdrawAmountD18:r,slippage:o});if(c?.srcData.length){const l=await s({swapParams:c,slippage:o});return{asset:i,swapParams:c,swapQuotes:l}}return{asset:i}}catch(c){return console.error(c),{asset:i}}})),v=t=>Math.round(t*100)/100,Ve=({maxSlippage:t,candidates:e=a.SLIPPAGE_AUTO_SIMULATION_CANDIDATES})=>{if(!Number.isFinite(t)||t<=0)return[];const n=v(Math.min(t,100)),s=e.filter(o=>o>0&&o<=n).map(v),r=new Set(s);return r.add(n),r.add(t),Array.from(r).sort((o,i)=>o-i)},x=1000000000000000000n,qe=1000000n,F=10000n,$=100n,ke=t=>({quotes:t.quotes.map(e=>({chainId:y(e.chainId,"chainId"),attestationId:y(e.attestationId,"attestationId"),userId:f(e.userId),asset:e.asset,price:y(e.price,"price"),quantity:y(e.quantity,"quantity"),expiration:y(e.expiration,"expiration"),side:Number(e.side),additionalData:f(e.additionalData)})),signatures:t.signatures.map(f)}),yt=(t,e)=>t*e/x,At=x,Ke=(t,e)=>!!e&&yt(t,e)<At,gt=(t,e,n)=>{const s=BigInt(Math.max(0,Math.round(n*100))),r=s>$?$:s,o=F-r,u=yt(t,e)*o*qe,c=F*x;return(u+c-1n)/c},Et=(t,e)=>({chainId:e,attestationId:y(t.attestationId,"attestationId"),userId:b(t.userId),asset:t.assetAddress,price:y(t.price,"price"),quantity:y(t.tokenAmount,"tokenAmount"),expiration:y(t.expiration,"expiration"),side:Number(t.side),additionalData:b(t.additionalData)}),je=({attestation:t,chainId:e,slippagePercent:n})=>{const s=Et(t,e);return d.encodeAbiParameters(Rt,[{attestationSignature:j(t.signature),quote:s,amountOutMinimum:gt(s.quantity,s.price,n)}])},Xe=t=>[...t.reduce((n,s)=>n.has(s.accountId)?n:n.set(s.accountId,s),new Map).values()].map(({accountId:n,marketId:s})=>({accountId:n,marketId:s,collaterals:t.filter(r=>r.accountId===n&&!r.isDebt),debt:t.find(r=>r.accountId===n&&r.isDebt)})),Ze=({collateral:t,dytmOffice:e,processor:n,gmToken:s,ondoGMSwap:r,usdc:o,gmAmount:i,amountOutMinimum:u,signature:c,quote:l})=>[{to:e,data:d.encodeFunctionData({abi:N,functionName:"withdraw",args:[{account:t.accountId,tokenId:t.tokenId,receiver:n,assets:0n,shares:d.maxUint256,extraData:"0x"}]})},{to:s,data:d.encodeFunctionData({abi:d.erc20Abi,functionName:"approve",args:[r,i]})},{to:r,data:d.encodeFunctionData({abi:Ot,functionName:"swapExactInWithAttestation",args:[s,i,o,u,c,l]})}],ze=({collateral:t,dytmOffice:e,processor:n})=>({to:e,data:d.encodeFunctionData({abi:N,functionName:"withdraw",args:[{account:t.accountId,tokenId:t.tokenId,receiver:n,assets:0n,shares:d.maxUint256,extraData:"0x"}]})}),Qe=({accountId:t,debtKey:e,dytmOffice:n,usdc:s})=>[{to:s,data:d.encodeFunctionData({abi:d.erc20Abi,functionName:"approve",args:[n,d.maxUint256]})},{to:n,data:d.encodeFunctionData({abi:N,functionName:"repay",args:[{account:t,key:e,withCollateralType:0,assets:d.maxUint256,shares:0n,extraData:"0x"}]})}],Je=({actions:t,outputAsset:e,minOutputAmount:n})=>d.encodeAbiParameters(Ct,[{actions:t,outputAsset:e,minOutputAmount:n}]),G=new Set,tn=t=>{const e=t?.message;!e||G.has(e)||(G.add(e),console.warn(e))};exports.DytmOfficeAssetGuardAbi=Nt;exports.EMPTY_PER_ASSET_WITHDRAW_DATA=Ge;exports.HYPERLIQUID_PERPS_ACCOUNT_ADDRESS=ct;exports.MIN_GM_UNWIND_VALUE_USD=At;exports.OndoGMTokenAssetGuardAbi=bt;exports.THIRD_PARTY_CONTRACT_ERRORS=D;exports.addTokenToWallet=Kt;exports.applyContractErrorRegistry=k;exports.base64ToHex=j;exports.buildAaveWithdrawAssetTransactionData=Q;exports.buildComplexAssetDataForRouter=pt;exports.buildDytmActions=Ze;exports.buildDytmOutputAssetWithdrawAction=ze;exports.buildDytmRepayActions=Qe;exports.buildSwapQuoteKeyForAave=Z;exports.buildSwapWithdrawTransactionData=ae;exports.buildZapDepositTransactionArguments=oe;exports.clientSide=wt;exports.commify=De;exports.computeAmountOutMinimumUsdc=gt;exports.createDefaultComplexAssetData=We;exports.encodeOndoWithdrawData=je;exports.encodeUnwindPlan=Je;exports.enrichAssetsWithSwapQuotes=Ye;exports.ensureContractErrorRegistryLoaded=Vt;exports.ensureHexPrefix=f;exports.extractAvailableRouterKeys=lt;exports.fetchContractErrorRegistry=K;exports.fetchRequest=H;exports.formatBalance=ot;exports.formatByCurrency=be;exports.formatNumberToLimitedDecimals=st;exports.formatNumeratorToPercentage=we;exports.formatPercentage=rt;exports.formatToUsd=nt;exports.formatTokenBalance=Re;exports.getAutoSlippageSimulationCandidates=Ve;exports.getComplexAssetDataSlippageTolerance=re;exports.getContractAbiById=Xt;exports.getContractAddressById=X;exports.getContractErrorRegistry=O;exports.getConventionalTokenPriceDecimals=Jt;exports.getErrorKey=R;exports.getFlatMoneyCollateralByLeverageAddress=Ce;exports.getFlatMoneyLinkByUnitAddress=Pe;exports.getGmxWithdrawAssetByLeverageAddress=Le;exports.getGmxWithdrawAssetByVaultAddress=Me;exports.getHyperliquidWithdrawAsset=$e;exports.getNativeTokenInvestableBalance=de;exports.getPercent=z;exports.getPoolFraction=ne;exports.getSettleDelay=ce;exports.getSlippageToleranceForContractTransaction=C;exports.getTxHashShort=Ie;exports.groupPreviewByAccount=Xe;exports.isAaveLendAndBorrowAsset=zt;exports.isEqualAddress=m;exports.isFlatMoneyLeveragedAsset=Oe;exports.isFmpAirdropVaultAddress=Ne;exports.isGmxLeveragedAsset=Be;exports.isHyperliquidCorePositionAsset=Fe;exports.isHyperliquidPerpsAsset=ut;exports.isHyperliquidSpotSystemAsset=dt;exports.isNativeToken=ue;exports.isNumberType=fe;exports.isNumeric=et;exports.isPositiveNumber=ee;exports.isStableSymbol=le;exports.isUnswappableGmDust=Ke;exports.isZeroAddress=jt;exports.logContractErrorOnce=tn;exports.logTransactionByActionType=xe;exports.mapAttestationToOndoQuote=Et;exports.mapOndoApiResponseToUpdatePricesArgs=ke;exports.nonZeroBigInt=_e;exports.normalizeNumber=tt;exports.overlayWithdrawData=P;exports.parseAmountToD18=se;exports.parseContractErrorMessage=Se;exports.parseFetchErrorBody=Tt;exports.removeInsignificantTrailingZeros=I;exports.shiftBy=te;exports.shortenAddress=Zt;exports.shouldSwallowMainnetPollError=ie;exports.sliceByIndex=Qt;exports.toBigInt=y;exports.toBytes32Hex=b;exports.transformAddressForAnalytics=it;exports.truncateString=at;exports.tryEstimateWithRouters=mt;exports.tryEstimateWithSlippageValues=He;exports.validateLoggerEventParams=pe;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from '../types/config.types';
|
|
2
|
-
export * from '../types/contract.types';
|
|
3
|
-
export * from '../types/pool.types';
|
|
4
|
-
export * from '../types/referral.types';
|
|
5
|
-
export * from '../types/state.types';
|
|
6
|
-
export * from '../types/trading.types';
|
|
7
|
-
export * from '../types/trading-panel.types';
|
|
8
|
-
export * from '../types/web3.types';
|
|
9
|
-
export * from '../types/react-query.types';
|
|
1
|
+
export type * from '../types/config.types';
|
|
2
|
+
export type * from '../types/contract.types';
|
|
3
|
+
export type * from '../types/pool.types';
|
|
4
|
+
export type * from '../types/referral.types';
|
|
5
|
+
export type * from '../types/state.types';
|
|
6
|
+
export type * from '../types/trading.types';
|
|
7
|
+
export type * from '../types/trading-panel.types';
|
|
8
|
+
export type * from '../types/web3.types';
|
|
9
|
+
export type * from '../types/react-query.types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { optimism as a, hyperEvm as p, base as n, arbitrum as s, polygon as i, mainnet as
|
|
1
|
+
import { optimism as a, hyperEvm as p, base as n, arbitrum as s, polygon as i, mainnet as e } from "wagmi/chains";
|
|
2
2
|
import { formatDuration as te } from "date-fns";
|
|
3
3
|
import { erc20Abi as ae } from "viem";
|
|
4
4
|
const ne = "0x0000000000000000000000000000000000000000", Fe = BigInt(
|
|
@@ -22,14 +22,14 @@ const ne = "0x0000000000000000000000000000000000000000", Fe = BigInt(
|
|
|
22
22
|
3,
|
|
23
23
|
5
|
|
24
24
|
], tt = "withdrawSafe", at = "initWithdrawal", nt = "unrollAndClaim", st = "completeWithdrawal", it = 2e6, pt = 1.25, rt = 1e4, dt = 13e3, yt = 3, ot = 2e4, ut = 1e4, lt = {
|
|
25
|
-
[
|
|
25
|
+
[e.id]: e,
|
|
26
26
|
[i.id]: i,
|
|
27
27
|
[a.id]: a,
|
|
28
28
|
[s.id]: s,
|
|
29
29
|
[n.id]: n,
|
|
30
30
|
[p.id]: p
|
|
31
31
|
}, mt = {
|
|
32
|
-
[
|
|
32
|
+
[e.id]: {
|
|
33
33
|
nativeTokenSymbol: "ETH",
|
|
34
34
|
wrappedNativeTokenName: "WETH",
|
|
35
35
|
address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
@@ -66,14 +66,14 @@ const ne = "0x0000000000000000000000000000000000000000", Fe = BigInt(
|
|
|
66
66
|
decimals: l
|
|
67
67
|
}
|
|
68
68
|
}, m = 299e5, Tt = {
|
|
69
|
-
[
|
|
69
|
+
[e.id]: m,
|
|
70
70
|
[i.id]: m,
|
|
71
71
|
[a.id]: m,
|
|
72
72
|
[s.id]: m,
|
|
73
73
|
[n.id]: m,
|
|
74
74
|
[p.id]: m
|
|
75
75
|
}, ct = {
|
|
76
|
-
[
|
|
76
|
+
[e.id]: "https://eth-mainnet.g.alchemy.com/v2",
|
|
77
77
|
[a.id]: "https://opt-mainnet.g.alchemy.com/v2",
|
|
78
78
|
[i.id]: "https://polygon-mainnet.g.alchemy.com/v2",
|
|
79
79
|
[s.id]: "https://arb-mainnet.g.alchemy.com/v2",
|
|
@@ -139,7 +139,7 @@ const ne = "0x0000000000000000000000000000000000000000", Fe = BigInt(
|
|
|
139
139
|
};
|
|
140
140
|
var o = /* @__PURE__ */ ((u) => (u.ETH = "ETH", u.MAINNET = "MAINNET", u.POLYGON = "POLYGON", u.OE = "OPTIMISM", u.ARBI = "ARBITRUM", u.BASE = "BASE", u.HYPEREVM = "HYPEREVM", u))(o || {});
|
|
141
141
|
const c = process.env.NEXT_PUBLIC_INFURA_API_KEY;
|
|
142
|
-
s.id + "", `${c}`, a.id + "", `${c}`, i.id + "", `${c}`, n.id + "", `${c}`,
|
|
142
|
+
s.id + "", `${c}`, a.id + "", `${c}`, i.id + "", `${c}`, n.id + "", `${c}`, e.id + "", `${c}`, p.id + "";
|
|
143
143
|
const Dt = {
|
|
144
144
|
[s.id]: {
|
|
145
145
|
...s,
|
|
@@ -171,9 +171,9 @@ const Dt = {
|
|
|
171
171
|
shortName: "BASE",
|
|
172
172
|
blockchainCode: o.BASE
|
|
173
173
|
},
|
|
174
|
-
[
|
|
175
|
-
...
|
|
176
|
-
chainId:
|
|
174
|
+
[e.id]: {
|
|
175
|
+
...e,
|
|
176
|
+
chainId: e.id,
|
|
177
177
|
iconPath: "/icons/ethereum-network.svg",
|
|
178
178
|
shortName: "ETHEREUM",
|
|
179
179
|
blockchainCode: o.MAINNET
|
|
@@ -186,15 +186,16 @@ const Dt = {
|
|
|
186
186
|
blockchainCode: o.HYPEREVM
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
|
-
o.ETH + "",
|
|
190
|
-
|
|
189
|
+
o.ETH + "", e.id, o.MAINNET + "", e.id, o.POLYGON + "", i.id, o.OE + "", a.id, o.ARBI + "", s.id, o.BASE + "", n.id, o.HYPEREVM + "", p.id;
|
|
190
|
+
e.id + "", a.id + "", i.id + "", s.id + "", n.id + "", p.id + "";
|
|
191
|
+
e.id + "", a.id + "", i.id + "", s.id + "", n.id + "", p.id + "";
|
|
191
192
|
const D = "0x0000000000000000000000000000000000000000";
|
|
192
193
|
BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
|
193
|
-
|
|
194
|
-
const
|
|
194
|
+
e.id + "", BigInt(100), a.id + "", BigInt(600), i.id + "", BigInt(600), n.id + "", BigInt(600), s.id + "", BigInt(5300), p.id + "", BigInt(6e3);
|
|
195
|
+
const t = 18, It = 4, I = {
|
|
195
196
|
address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
196
197
|
symbol: "WETH",
|
|
197
|
-
decimals:
|
|
198
|
+
decimals: t,
|
|
198
199
|
value: ""
|
|
199
200
|
}, S = {
|
|
200
201
|
address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
@@ -219,11 +220,11 @@ const e = 18, It = 4, I = {
|
|
|
219
220
|
}, M = "0x96D33bCF84DdE326014248E2896F79bbb9c13D6d", w = "0xbDd84294bC8299861A2121F749A25EFEb7168a32", O = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2", C = "0x95B19De479bc693721cab39Da98FfECE062f5Ea4", re = "0xD6049430DDFa9bCd1F33064BF697313A1a93ace9", de = "0x0ff1ceB93DbADfB13722058D60c4B8cD122b06ea", ye = 1n;
|
|
220
221
|
ye << 160n | BigInt(S.address);
|
|
221
222
|
const Rt = "0xde41399145F23936b03dD1474eC16c1519c0DC2a", P = "0xffFb5fB14606EB3a548C113026355020dDF27535", v = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", g = "0xA5679C4272A056Bb83f039961fae7D99C48529F5", L = "0x26a687e8244f1866E9Aa2D400c8b9957Aa8e6Ad4", N = "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F", x = "0xf067575Eb60c7587C11e867907AA7284833704d1", oe = "0x59525b9b23adc475ef91d98dae06b568ba574ce5", Mt = "0xa907504d7a4c415b4e6e1d0866d96afe8202f0e5", wt = "0x1849324228d852a67eb7443e42d967e480ffe95d", B = "0xa238dd80c259a72e81d7e4664a9801593f98d1c5", U = "0xFcBEc28c43E356693971a24bf3F2Fd7D965E2ebA", ue = "0x07e144e336fcc3fe928a8a2a5714da64354c1aab", h = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", W = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", F = "0x2Ed1bd7f66e47113672f3870308b5E867C5bb743", V = "0x3bFE2a472d2964Ea4070725b7Fb0A868b3f08b63", H = "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", le = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", k = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", Y = "0x45b90480D6F643dE2f128db091A357C3c90399f2", G = "0xB71410736d2C8F2DAf30dA9D332dA10534d2624d", K = "0x615037C2Df6FA97634c5aD2d8144708b9dd3B176", X = "0x47065E508433E22d73Be3c5B61EB9abafD450364", z = "0x6b696eA2602068a7043C92961B5F202a65A3eF9C", Ot = "0x4F754e0F0924afD74980886b0B479Fa1D7C58D0D";
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
223
|
+
e.id + "", s.id + "", n.id + "", a.id + "", i.id + "", p.id + "";
|
|
224
|
+
e.id + "", s.id + "", n.id + "", a.id + "", i.id + "", p.id + "";
|
|
225
|
+
e.id + "", s.id + "", n.id + "", a.id + "", i.id + "", p.id + "";
|
|
226
|
+
e.id + "";
|
|
227
|
+
e.id + "", s.id + "", n.id + "", a.id + "", i.id + "", p.id + "";
|
|
227
228
|
const E = [
|
|
228
229
|
{
|
|
229
230
|
anonymous: !1,
|
|
@@ -4197,7 +4198,7 @@ const E = [
|
|
|
4197
4198
|
type: "function"
|
|
4198
4199
|
}
|
|
4199
4200
|
], vt = {
|
|
4200
|
-
[
|
|
4201
|
+
[e.id]: {
|
|
4201
4202
|
factory: M,
|
|
4202
4203
|
easySwapperV2: w,
|
|
4203
4204
|
aaveLendingPoolV3: O,
|
|
@@ -4274,7 +4275,7 @@ const E = [
|
|
|
4274
4275
|
}, f = {
|
|
4275
4276
|
address: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
|
|
4276
4277
|
symbol: "WETH",
|
|
4277
|
-
decimals:
|
|
4278
|
+
decimals: t,
|
|
4278
4279
|
value: ""
|
|
4279
4280
|
}, T = {
|
|
4280
4281
|
address: "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",
|
|
@@ -4284,12 +4285,12 @@ const E = [
|
|
|
4284
4285
|
}, Ft = {
|
|
4285
4286
|
address: "0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40",
|
|
4286
4287
|
symbol: "tBTC",
|
|
4287
|
-
decimals:
|
|
4288
|
+
decimals: t,
|
|
4288
4289
|
value: ""
|
|
4289
4290
|
}, Vt = {
|
|
4290
4291
|
address: "0x5979D7b546E38E414F7E9822514be443A4800529",
|
|
4291
4292
|
symbol: "wstETH",
|
|
4292
|
-
decimals:
|
|
4293
|
+
decimals: t,
|
|
4293
4294
|
value: ""
|
|
4294
4295
|
}, Ht = {
|
|
4295
4296
|
address: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
|
|
@@ -4304,12 +4305,12 @@ const E = [
|
|
|
4304
4305
|
}, Yt = {
|
|
4305
4306
|
address: "0xa9004a5421372e1d83fb1f85b0fc986c912f91f3",
|
|
4306
4307
|
symbol: "WBNB",
|
|
4307
|
-
decimals:
|
|
4308
|
+
decimals: t,
|
|
4308
4309
|
value: ""
|
|
4309
4310
|
}, Gt = {
|
|
4310
4311
|
address: "0xf97f4df75117a78c1a5a0dbb814af92458539fb4",
|
|
4311
4312
|
symbol: "LINK",
|
|
4312
|
-
decimals:
|
|
4313
|
+
decimals: t,
|
|
4313
4314
|
value: ""
|
|
4314
4315
|
}, Me = {
|
|
4315
4316
|
address: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
@@ -4324,12 +4325,12 @@ const E = [
|
|
|
4324
4325
|
}, Z = {
|
|
4325
4326
|
address: "0x4200000000000000000000000000000000000006",
|
|
4326
4327
|
symbol: "WETH",
|
|
4327
|
-
decimals:
|
|
4328
|
+
decimals: t,
|
|
4328
4329
|
value: ""
|
|
4329
4330
|
}, Xt = {
|
|
4330
4331
|
address: "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22",
|
|
4331
4332
|
symbol: "cbETH",
|
|
4332
|
-
decimals:
|
|
4333
|
+
decimals: t,
|
|
4333
4334
|
value: ""
|
|
4334
4335
|
}, we = {
|
|
4335
4336
|
address: "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf",
|
|
@@ -4339,17 +4340,17 @@ const E = [
|
|
|
4339
4340
|
}, A = {
|
|
4340
4341
|
address: "0xb6fe221fe9eef5aba221c348ba20a1bf5e73624c",
|
|
4341
4342
|
symbol: "rETH",
|
|
4342
|
-
decimals:
|
|
4343
|
+
decimals: t,
|
|
4343
4344
|
value: ""
|
|
4344
4345
|
}, zt = {
|
|
4345
4346
|
address: "0x236aa50979D5f3De3Bd1Eeb40E81137F22ab794b",
|
|
4346
4347
|
symbol: "tBTC",
|
|
4347
|
-
decimals:
|
|
4348
|
+
decimals: t,
|
|
4348
4349
|
value: ""
|
|
4349
4350
|
}, qt = {
|
|
4350
4351
|
address: "0xc1cba3fcea344f92d9239c08c0568f6f2f0ee452",
|
|
4351
4352
|
symbol: "wstETH",
|
|
4352
|
-
decimals:
|
|
4353
|
+
decimals: t,
|
|
4353
4354
|
value: ""
|
|
4354
4355
|
}, $ = {
|
|
4355
4356
|
address: "0x7F5c764cBc14f9669B88837ca1490cCa17c31607",
|
|
@@ -4369,17 +4370,17 @@ const E = [
|
|
|
4369
4370
|
}, j = {
|
|
4370
4371
|
address: "0x4200000000000000000000000000000000000006",
|
|
4371
4372
|
symbol: "WETH",
|
|
4372
|
-
decimals:
|
|
4373
|
+
decimals: t,
|
|
4373
4374
|
value: ""
|
|
4374
4375
|
}, Zt = {
|
|
4375
4376
|
address: "0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9",
|
|
4376
4377
|
symbol: "sUSD",
|
|
4377
|
-
decimals:
|
|
4378
|
+
decimals: t,
|
|
4378
4379
|
value: ""
|
|
4379
4380
|
}, Pe = {
|
|
4380
4381
|
address: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1",
|
|
4381
4382
|
symbol: "DAI",
|
|
4382
|
-
decimals:
|
|
4383
|
+
decimals: t,
|
|
4383
4384
|
value: ""
|
|
4384
4385
|
}, b = {
|
|
4385
4386
|
address: "0x68f180fcce6836688e9084f035309e29bf0a2095",
|
|
@@ -4389,27 +4390,27 @@ const E = [
|
|
|
4389
4390
|
}, $t = {
|
|
4390
4391
|
address: "0xe405de8f52ba7559f9df3c368500b6e6ae6cee49",
|
|
4391
4392
|
symbol: "sETH",
|
|
4392
|
-
decimals:
|
|
4393
|
+
decimals: t,
|
|
4393
4394
|
value: ""
|
|
4394
4395
|
}, jt = {
|
|
4395
4396
|
address: "0x350a791bfc2c21f9ed5d10980dad2e2638ffa7f6",
|
|
4396
4397
|
symbol: "LINK",
|
|
4397
|
-
decimals:
|
|
4398
|
+
decimals: t,
|
|
4398
4399
|
value: ""
|
|
4399
4400
|
}, Qt = {
|
|
4400
4401
|
address: "0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40",
|
|
4401
4402
|
symbol: "tBTC",
|
|
4402
|
-
decimals:
|
|
4403
|
+
decimals: t,
|
|
4403
4404
|
value: ""
|
|
4404
4405
|
}, Jt = {
|
|
4405
4406
|
address: "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb",
|
|
4406
4407
|
symbol: "wstETH",
|
|
4407
|
-
decimals:
|
|
4408
|
+
decimals: t,
|
|
4408
4409
|
value: ""
|
|
4409
4410
|
}, Q = {
|
|
4410
4411
|
address: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
|
|
4411
4412
|
symbol: "WETH",
|
|
4412
|
-
decimals:
|
|
4413
|
+
decimals: t,
|
|
4413
4414
|
value: ""
|
|
4414
4415
|
}, J = {
|
|
4415
4416
|
address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
|
|
@@ -4424,7 +4425,7 @@ const E = [
|
|
|
4424
4425
|
}, ea = {
|
|
4425
4426
|
address: "0x553d3d295e0f695b9228246232edf400ed3560b5",
|
|
4426
4427
|
symbol: "PAXG",
|
|
4427
|
-
decimals:
|
|
4428
|
+
decimals: t,
|
|
4428
4429
|
value: ""
|
|
4429
4430
|
}, ee = {
|
|
4430
4431
|
address: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",
|
|
@@ -4434,7 +4435,7 @@ const E = [
|
|
|
4434
4435
|
}, ge = {
|
|
4435
4436
|
address: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
|
|
4436
4437
|
symbol: "WPOL",
|
|
4437
|
-
decimals:
|
|
4438
|
+
decimals: t,
|
|
4438
4439
|
value: ""
|
|
4439
4440
|
}, Le = {
|
|
4440
4441
|
address: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
|
|
@@ -4444,12 +4445,12 @@ const E = [
|
|
|
4444
4445
|
}, Ne = {
|
|
4445
4446
|
address: "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063",
|
|
4446
4447
|
symbol: "DAI",
|
|
4447
|
-
decimals:
|
|
4448
|
+
decimals: t,
|
|
4448
4449
|
value: ""
|
|
4449
4450
|
}, ta = {
|
|
4450
4451
|
address: "0x236aa50979d5f3de3bd1eeb40e81137f22ab794b",
|
|
4451
4452
|
symbol: "tBTC",
|
|
4452
|
-
decimals:
|
|
4453
|
+
decimals: t,
|
|
4453
4454
|
value: ""
|
|
4454
4455
|
}, xe = {
|
|
4455
4456
|
address: "0xb88339cb7199b77e23db6e890353e22632ba630f",
|
|
@@ -4459,14 +4460,14 @@ const E = [
|
|
|
4459
4460
|
}, aa = {
|
|
4460
4461
|
address: D,
|
|
4461
4462
|
symbol: "all",
|
|
4462
|
-
decimals:
|
|
4463
|
+
decimals: t,
|
|
4463
4464
|
value: ""
|
|
4464
4465
|
}, na = {
|
|
4465
4466
|
[q.address.toLowerCase()]: "USDCe",
|
|
4466
4467
|
[$.address.toLowerCase()]: "USDCe",
|
|
4467
4468
|
[J.address.toLowerCase()]: "USDCe"
|
|
4468
4469
|
}, sa = {
|
|
4469
|
-
[
|
|
4470
|
+
[e.id]: I,
|
|
4470
4471
|
[a.id]: j,
|
|
4471
4472
|
[n.id]: Z,
|
|
4472
4473
|
[i.id]: Q,
|
|
@@ -4476,7 +4477,7 @@ const E = [
|
|
|
4476
4477
|
[n.id]: we,
|
|
4477
4478
|
[i.id]: ee,
|
|
4478
4479
|
[s.id]: T,
|
|
4479
|
-
[
|
|
4480
|
+
[e.id]: R
|
|
4480
4481
|
}, pa = {
|
|
4481
4482
|
[a.id]: {
|
|
4482
4483
|
WETH: j,
|
|
@@ -4505,7 +4506,7 @@ const E = [
|
|
|
4505
4506
|
WETH: Z,
|
|
4506
4507
|
USDC: Me
|
|
4507
4508
|
},
|
|
4508
|
-
[
|
|
4509
|
+
[e.id]: {
|
|
4509
4510
|
WETH: I,
|
|
4510
4511
|
USDC: S,
|
|
4511
4512
|
WBTC: R,
|
|
@@ -4541,7 +4542,7 @@ const E = [
|
|
|
4541
4542
|
// WBTC_OPTIMISM
|
|
4542
4543
|
], Ta = 500n, ca = {
|
|
4543
4544
|
[n.id]: 2e3,
|
|
4544
|
-
[
|
|
4545
|
+
[e.id]: 2e3,
|
|
4545
4546
|
[a.id]: 2e3,
|
|
4546
4547
|
[s.id]: 500,
|
|
4547
4548
|
[i.id]: 500,
|
|
@@ -4687,7 +4688,7 @@ export {
|
|
|
4687
4688
|
D as aq,
|
|
4688
4689
|
Ct as ar,
|
|
4689
4690
|
Pt as as,
|
|
4690
|
-
|
|
4691
|
+
t as at,
|
|
4691
4692
|
Mt as au,
|
|
4692
4693
|
wt as av,
|
|
4693
4694
|
xe as aw,
|