@dhedge/trading-widget 5.8.1 → 5.9.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/README.md CHANGED
@@ -81,19 +81,19 @@ Top level provider component. Headless part of trading logic. API handles params
81
81
  <details>
82
82
  <summary><code>initialState</code> <code><b>/</b></code> <code>Optional initial state of trading panel</code></summary>
83
83
 
84
- > | name | type | default value | description |
85
- > | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
86
- > | `poolAddress` | Address | `AddressZero` | Current active pool address |
87
- > | `poolConfigMap` | Record<Address, PoolConfig> | `{}` | Map of pool configs available for trading |
88
- > | `settings` | { slippage: `number \| 'auto'`; minSlippage?: `number`; isInfiniteAllowance: `boolean`; isMultiAssetWithdrawalEnabled: `boolean`; isCustomDepositOptionsDisabled?: `boolean`; isMaxSlippageLoading: `boolean`; availableAggregators: `string[]`; isForceSendEnabled?: `boolean`; forceSendGas?: `number` } | { slippage: `'auto'`; isInfiniteAllowance: `false`; isMultiAssetWithdrawalEnabled: `true`; isMaxSlippageLoading: `false`; availableAggregators: `[]`; isForceSendEnabled: `false`; forceSendGas: `undefined` } | Panel settings (see **Force Send** note below) |
89
- > | `type` | 'deposit' \| 'withdraw' | `'deposit'` | Trading type |
90
- > | `input` | { sendToken: { address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` }; receiveToken: { address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` } } | `poolConfigMap[poolAddress]` | Send/receive tokens pair |
91
- > | `entryFee` | { deposit: `number`; depositWithCustomCooldown: `number`; } | { deposit: `0`; depositWithCustomCooldown: `0.1` } | Entry fee config map |
92
- > | `modal` | { isOpen: `boolean`; status: `'Success' \| 'None' \| 'Mining' \| 'Wallet'`; action: `'deposit' \| 'withdraw' \| 'approve \`; link?: `string`; sendToken: TradingToken \| null; receiveToken: TradingToken \| null } | `{ isOpen: `false`,status: `'None'`, receiveToken: `null`, sendToken: `null` }` | Trading modal state |
93
- > | `transactions` | { action: `'deposit' \| 'withdraw' \| 'approve'`; symbol: `string`; chainId: `ChainId`; txHash?: `Address` }[] | `[]` | Pending transactions |
94
- > | `poolFallbackData` | { address: `Address`; managerLogicAddress?: `Address`; poolCompositions: `PoolComposition[]`; tokenPrice?: `string`; apy?: { value: `number`; currency: `'USD' \| 'ETH'` } } | { address: `AddressZero` } | Current active pool fallback data to override or extend contract's response |
95
- > | `defaultChainId` | number (optional) | undefined | Chain id that will be returned from useNetwork wagmi hook when connected to unsupported network |
96
- > | `customDepositTokensPerChain` | Record<ChainId, TradingToken[]> | `undefined` | Per-chain map of extra deposit tokens that are appended to `depositParams.customTokens`. |
84
+ > | name | type | default value | description |
85
+ > | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
86
+ > | `poolAddress` | Address | `AddressZero` | Current active pool address |
87
+ > | `poolConfigMap` | Record<Address, PoolConfig> | `{}` | Map of pool configs available for trading |
88
+ > | `settings` | { slippage: `number \| 'auto'`; minSlippage?: `number`; isInfiniteAllowance: `boolean`; isMultiAssetWithdrawalEnabled: `boolean`; isCustomDepositOptionsDisabled?: `boolean`; isMaxSlippageLoading: `boolean`; availableAggregators: `string[]`; selectedAggregators: `string[]`; aggregatorLimitPerChain?: `Partial<Record<ChainId, string[]>>`; isForceSendEnabled?: `boolean`; forceSendGas?: `number` } | { slippage: `'auto'`; isInfiniteAllowance: `false`; isMultiAssetWithdrawalEnabled: `true`; isMaxSlippageLoading: `false`; availableAggregators: `[]`; selectedAggregators: `[]`; aggregatorLimitPerChain: `undefined`; isForceSendEnabled: `false`; forceSendGas: `undefined` } | Panel settings (see **Force Send** and **Per-Chain Aggregator Limits** notes below) |
89
+ > | `type` | 'deposit' \| 'withdraw' | `'deposit'` | Trading type |
90
+ > | `input` | { sendToken: { address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` }; receiveToken: { address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` } } | `poolConfigMap[poolAddress]` | Send/receive tokens pair |
91
+ > | `entryFee` | { deposit: `number`; depositWithCustomCooldown: `number`; } | { deposit: `0`; depositWithCustomCooldown: `0.1` } | Entry fee config map |
92
+ > | `modal` | { isOpen: `boolean`; status: `'Success' \| 'None' \| 'Mining' \| 'Wallet'`; action: `'deposit' \| 'withdraw' \| 'approve \`; link?: `string`; sendToken: TradingToken \| null; receiveToken: TradingToken \| null } | `{ isOpen: `false`,status: `'None'`, receiveToken: `null`, sendToken: `null` }` | Trading modal state |
93
+ > | `transactions` | { action: `'deposit' \| 'withdraw' \| 'approve'`; symbol: `string`; chainId: `ChainId`; txHash?: `Address` }[] | `[]` | Pending transactions |
94
+ > | `poolFallbackData` | { address: `Address`; managerLogicAddress?: `Address`; poolCompositions: `PoolComposition[]`; tokenPrice?: `string`; apy?: { value: `number`; currency: `'USD' \| 'ETH'` } } | { address: `AddressZero` } | Current active pool fallback data to override or extend contract's response |
95
+ > | `defaultChainId` | number (optional) | undefined | Chain id that will be returned from useNetwork wagmi hook when connected to unsupported network |
96
+ > | `customDepositTokensPerChain` | Record<ChainId, TradingToken[]> | `undefined` | Per-chain map of extra deposit tokens that are appended to `depositParams.customTokens`. |
97
97
 
98
98
  ###### Source: `packages/trading-widget/src/core-kit/providers/index.tsx`
99
99
 
@@ -140,6 +140,42 @@ updateSettings({ isForceSendEnabled: true, forceSendGas: 10_000_000 })
140
140
 
141
141
  ---
142
142
 
143
+ #### Per-Chain Aggregator Limits
144
+
145
+ The optional `settings.aggregatorLimitPerChain` field allows restricting which aggregators are available on specific chains. When a chain has an entry in this map, both `availableAggregators` and `selectedAggregators` are **filtered** to include only the listed aggregators. Chains without an entry use the global lists unchanged.
146
+
147
+ | setting | type | default | description |
148
+ | ------------------------- | ------------------------------------ | ----------- | --------------------------------------------------------------------------------- |
149
+ | `aggregatorLimitPerChain` | `Partial<Record<ChainId, string[]>>` | `undefined` | Per-chain allow-list that filters the global available/selected aggregator lists. |
150
+
151
+ **Example:**
152
+
153
+ ```tsx
154
+ <TradingPanelProvider
155
+ initialState={{
156
+ settings: {
157
+ availableAggregators: ['Odos', 'ParaSwap', '1inch', 'KyberSwap'],
158
+ selectedAggregators: ['Odos', 'ParaSwap', '1inch', 'KyberSwap'],
159
+ aggregatorLimitPerChain: {
160
+ [hyperEvm.id]: ['KyberSwap'], // hyperEVM only uses KyberSwap
161
+ },
162
+ },
163
+ }}
164
+ actions={{ getSwapQuotes }}
165
+ >
166
+ {children}
167
+ </TradingPanelProvider>
168
+ ```
169
+
170
+ In this example:
171
+
172
+ - **hyperEVM vaults**: only `KyberSwap` is available (the aggregator selector UI is hidden since there's only one)
173
+ - **All other chains**: all four aggregators are available and selected as usual
174
+
175
+ The `useEffectiveAggregators` hook (exported from the widget) can be used to read the resolved aggregator lists for the current pool's chain.
176
+
177
+ ---
178
+
143
179
  <details>
144
180
  <summary><code>PoolConfig</code> <code><b>/</b></code> <code>Vault configuration schema</code></summary>
145
181
 
@@ -1,5 +1,5 @@
1
1
  import i from "bignumber.js";
2
- import { ak as B, ai as R, aj as O, b as T, q as _, al as b, am as C, a4 as F, c as M, a8 as v, ae as P, ad as $, Z as x, an as h, f as U, e as K, M as W, R as Y, P as V, ao as G, ap as H, Q as Z, N as k, ab as g, $ as Q, W as j, X as z, U as X, _ as y } from "./storage-DhvdxqW3.js";
2
+ import { ak as B, ai as R, aj as O, b as T, q as _, al as b, am as C, a4 as F, c as M, a8 as v, ae as P, ad as $, Z as x, an as h, f as U, e as K, M as W, R as Y, P as V, ao as G, ap as H, Q as Z, N as k, ab as g, $ as Q, W as j, X as z, U as X, _ as y } from "./storage-C0zg_Mfy.js";
3
3
  import { stringToHex as p, encodeAbiParameters as f } from "viem";
4
4
  const q = () => typeof window < "u";
5
5
  function J() {
@@ -1 +1 @@
1
- "use strict";const c=require("bignumber.js"),s=require("./storage-Bbr6G6F3.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 A=(t,e)=>t?.toLowerCase()===e?.toLowerCase(),$=t=>A(t,s.AddressZero$1),f=(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=f("aaveLendingPoolV3",e);return A(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:u})=>{const l=new c(d).multipliedBy(1-u/100).toFixed(0),g=[m.stringToHex(i,{size:32}),e];return[t,[[r,n,g],[o,l]],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 u=[m.stringToHex(d.routerKey,{size:32}),d.rawTransaction.data],l=[i.address,i.rawBalance,u];return{srcData:[...a.srcData,l],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"}}}),u=m.encodeAbiParameters(s.ComplexWithdrawalAssetSrcDataAbiItem,[d]),l=m.encodeAbiParameters(s.ComplexWithdrawalDataAbiItem,[{encodedSrcData:u,dstData:{dstAddress:i.asset,dstAmount:i.amount},slippage:n}]);return{supportedAsset:t,withdrawData:l,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=="number"&&Number.isFinite(t),st=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():"",N=["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"],b=({value:t,decimals:e=4})=>{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<N.length)return`0.0${N[a.length]}${i.slice(0,3)}`}return _(r.toFixed(e))},R=(t,e=0)=>`${t.toLocaleString("en-US",{maximumFractionDigits:e})}%`,ot=t=>t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),at=(t,e,r=0)=>{const n=w(+t,e);return R(n,r)},it=({currency:t,value:e})=>t==="USD"?L({value:e}):`${s.CURRENCY_SYMBOL_MAP[t]} ${b({value:e,decimals:s.CURRENCY_DECIMALS_MAP[t]})}`,C=(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)}`},ct=({balance:t,symbol:e,precision:r,truncateSymbol:n})=>`${C(t,r)} ${n?O(e):e}`,dt=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",ut=t=>A(s.FLATMONEY_EARLY_DEPOSITOR_VAULT_ADDRESS_BASE,t)||A(s.FLATMONEY_DHT_STAKING_VAULT_ADDRESS_BASE,t),At=t=>s.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES.some(e=>A(e,t)),lt=t=>s.FLAT_MONEY_COLLATERAL_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:s.AddressZero},mt=t=>A(t,s.FLAT_MONEY_V1_UNIT_ADDRESS)?s.FLAT_MONEY_V1_UNIT_LINK:s.FLAT_MONEY_UNIT_LINK,F=t=>`eth_${t}`,gt=({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)})},Tt=t=>s.GMX_MARKET_ASSETS.some(e=>A(e,t)),St=t=>s.GMX_WITHDRAW_ASSET_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:s.AddressZero},Et=t=>s.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS[t.toLowerCase()];function _t(){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 pt(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 Dt=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})),Nt=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})),yt=async(t,e,{fetchAaveSwapParams:r,fetchAaveSwapQuotes:n,withdrawAmountD18:o,slippage:a})=>Promise.all((t??[]).map(async i=>{if(!A(i,e))return{asset:i};try{const u=await r({withdrawAmountD18:o,slippage:a});if(u?.srcData.length){const l=await n({swapParams:u,slippage:a});return{asset:i,swapParams:u,swapQuotes:l}}return{asset:i}}catch(u){return console.error(u),{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=ot;exports.createDefaultComplexAssetData=ft;exports.enrichAssetsWithSwapQuotes=yt;exports.extractAvailableRouterKeys=Dt;exports.formatBalance=C;exports.formatByCurrency=it;exports.formatNumberToLimitedDecimals=b;exports.formatNumeratorToPercentage=at;exports.formatPercentage=R;exports.formatToUsd=L;exports.formatTokenBalance=ct;exports.getContractAbiById=G;exports.getContractAddressById=f;exports.getConventionalTokenPriceDecimals=Y;exports.getErrorKey=E;exports.getFlatMoneyCollateralByLeverageAddress=lt;exports.getFlatMoneyLinkByUnitAddress=mt;exports.getGmxWithdrawAssetByLeverageAddress=St;exports.getGmxWithdrawAssetByVaultAddress=Et;exports.getNativeTokenInvestableBalance=X;exports.getPercent=w;exports.getPoolFraction=H;exports.getSlippageToleranceForContractTransaction=Q;exports.getStoredBatchTransactionsEnabled=_t;exports.getTxHashShort=dt;exports.isAaveLendAndBorrowAsset=K;exports.isEqualAddress=A;exports.isFlatMoneyLeveragedAsset=At;exports.isFmpAirdropVaultAddress=ut;exports.isGmxLeveragedAsset=Tt;exports.isNativeToken=j;exports.isNumberType=nt;exports.isNumeric=I;exports.isStableSymbol=J;exports.isZeroAddress=$;exports.logTransactionByActionType=gt;exports.nonZeroBigInt=st;exports.normalizeNumber=B;exports.parseAmountToD18=k;exports.parseContractErrorMessage=rt;exports.persistBatchTransactionsEnabled=pt;exports.removeInsignificantTrailingZeros=_;exports.shiftBy=Z;exports.shortenAddress=W;exports.sliceByIndex=V;exports.transformAddressForAnalytics=F;exports.truncateString=O;exports.tryEstimateWithRouters=Nt;exports.validateLoggerEventParams=tt;
1
+ "use strict";const c=require("bignumber.js"),s=require("./storage-B9jNfIvl.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 A=(t,e)=>t?.toLowerCase()===e?.toLowerCase(),$=t=>A(t,s.AddressZero$1),f=(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=f("aaveLendingPoolV3",e);return A(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:u})=>{const l=new c(d).multipliedBy(1-u/100).toFixed(0),g=[m.stringToHex(i,{size:32}),e];return[t,[[r,n,g],[o,l]],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 u=[m.stringToHex(d.routerKey,{size:32}),d.rawTransaction.data],l=[i.address,i.rawBalance,u];return{srcData:[...a.srcData,l],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"}}}),u=m.encodeAbiParameters(s.ComplexWithdrawalAssetSrcDataAbiItem,[d]),l=m.encodeAbiParameters(s.ComplexWithdrawalDataAbiItem,[{encodedSrcData:u,dstData:{dstAddress:i.asset,dstAmount:i.amount},slippage:n}]);return{supportedAsset:t,withdrawData:l,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=="number"&&Number.isFinite(t),st=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():"",N=["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"],b=({value:t,decimals:e=4})=>{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<N.length)return`0.0${N[a.length]}${i.slice(0,3)}`}return _(r.toFixed(e))},R=(t,e=0)=>`${t.toLocaleString("en-US",{maximumFractionDigits:e})}%`,ot=t=>t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),at=(t,e,r=0)=>{const n=w(+t,e);return R(n,r)},it=({currency:t,value:e})=>t==="USD"?L({value:e}):`${s.CURRENCY_SYMBOL_MAP[t]} ${b({value:e,decimals:s.CURRENCY_DECIMALS_MAP[t]})}`,C=(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)}`},ct=({balance:t,symbol:e,precision:r,truncateSymbol:n})=>`${C(t,r)} ${n?O(e):e}`,dt=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",ut=t=>A(s.FLATMONEY_EARLY_DEPOSITOR_VAULT_ADDRESS_BASE,t)||A(s.FLATMONEY_DHT_STAKING_VAULT_ADDRESS_BASE,t),At=t=>s.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES.some(e=>A(e,t)),lt=t=>s.FLAT_MONEY_COLLATERAL_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:s.AddressZero},mt=t=>A(t,s.FLAT_MONEY_V1_UNIT_ADDRESS)?s.FLAT_MONEY_V1_UNIT_LINK:s.FLAT_MONEY_UNIT_LINK,F=t=>`eth_${t}`,gt=({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)})},Tt=t=>s.GMX_MARKET_ASSETS.some(e=>A(e,t)),St=t=>s.GMX_WITHDRAW_ASSET_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:s.AddressZero},Et=t=>s.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS[t.toLowerCase()];function _t(){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 pt(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 Dt=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})),Nt=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})),yt=async(t,e,{fetchAaveSwapParams:r,fetchAaveSwapQuotes:n,withdrawAmountD18:o,slippage:a})=>Promise.all((t??[]).map(async i=>{if(!A(i,e))return{asset:i};try{const u=await r({withdrawAmountD18:o,slippage:a});if(u?.srcData.length){const l=await n({swapParams:u,slippage:a});return{asset:i,swapParams:u,swapQuotes:l}}return{asset:i}}catch(u){return console.error(u),{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=ot;exports.createDefaultComplexAssetData=ft;exports.enrichAssetsWithSwapQuotes=yt;exports.extractAvailableRouterKeys=Dt;exports.formatBalance=C;exports.formatByCurrency=it;exports.formatNumberToLimitedDecimals=b;exports.formatNumeratorToPercentage=at;exports.formatPercentage=R;exports.formatToUsd=L;exports.formatTokenBalance=ct;exports.getContractAbiById=G;exports.getContractAddressById=f;exports.getConventionalTokenPriceDecimals=Y;exports.getErrorKey=E;exports.getFlatMoneyCollateralByLeverageAddress=lt;exports.getFlatMoneyLinkByUnitAddress=mt;exports.getGmxWithdrawAssetByLeverageAddress=St;exports.getGmxWithdrawAssetByVaultAddress=Et;exports.getNativeTokenInvestableBalance=X;exports.getPercent=w;exports.getPoolFraction=H;exports.getSlippageToleranceForContractTransaction=Q;exports.getStoredBatchTransactionsEnabled=_t;exports.getTxHashShort=dt;exports.isAaveLendAndBorrowAsset=K;exports.isEqualAddress=A;exports.isFlatMoneyLeveragedAsset=At;exports.isFmpAirdropVaultAddress=ut;exports.isGmxLeveragedAsset=Tt;exports.isNativeToken=j;exports.isNumberType=nt;exports.isNumeric=I;exports.isStableSymbol=J;exports.isZeroAddress=$;exports.logTransactionByActionType=gt;exports.nonZeroBigInt=st;exports.normalizeNumber=B;exports.parseAmountToD18=k;exports.parseContractErrorMessage=rt;exports.persistBatchTransactionsEnabled=pt;exports.removeInsignificantTrailingZeros=_;exports.shiftBy=Z;exports.shortenAddress=W;exports.sliceByIndex=V;exports.transformAddressForAnalytics=F;exports.truncateString=O;exports.tryEstimateWithRouters=Nt;exports.validateLoggerEventParams=tt;
package/const.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./storage-Bbr6G6F3.cjs"),A=require("./derive-CsdqSZEg.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_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_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_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_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;exports.COVERED_CALL_VAULT_ADDRESSES=A.COVERED_CALL_VAULT_ADDRESSES;Object.defineProperty(exports,"arbitrum",{enumerable:!0,get:()=>E.arbitrum});Object.defineProperty(exports,"base",{enumerable:!0,get:()=>E.base});Object.defineProperty(exports,"hyperEvm",{enumerable:!0,get:()=>E.hyperEvm});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});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./storage-B9jNfIvl.cjs"),A=require("./derive-CsdqSZEg.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_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_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_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_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;exports.COVERED_CALL_VAULT_ADDRESSES=A.COVERED_CALL_VAULT_ADDRESSES;Object.defineProperty(exports,"arbitrum",{enumerable:!0,get:()=>E.arbitrum});Object.defineProperty(exports,"base",{enumerable:!0,get:()=>E.base});Object.defineProperty(exports,"hyperEvm",{enumerable:!0,get:()=>E.hyperEvm});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.js CHANGED
@@ -1,4 +1,4 @@
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 e, w as t, x as X, y as m, E as p, z as i, F as n, G as c, H as d, I as b, J as f, K as x, L as g, M as h, N as y, O as j, P as l, Q as u, R as v, S as Q, T as Z, U as k, V as q, 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_, ai as Y_, aj as H_ } from "./storage-DhvdxqW3.js";
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 e, w as t, x as X, y as m, E as p, z as i, F as n, G as c, H as d, I as b, J as f, K as x, L as g, M as h, N as y, O as j, P as l, Q as u, R as v, S as Q, T as Z, U as k, V as q, 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_, ai as Y_, aj as H_ } from "./storage-C0zg_Mfy.js";
2
2
  import { C as B_ } from "./derive-BmKPodpX.js";
3
3
  import { arbitrum as r_, base as o_, hyperEvm as e_, mainnet as t_, optimism as X_, polygon as m_ } from "wagmi/chains";
4
4
  export {
@@ -10,7 +10,7 @@ export declare const GMX_MARKET_ASSETS_MAP: {
10
10
  readonly CRV_ARBITRUM: "0x0e46941f9bff8d0784bffa3d0d7883cdb82d7ae7";
11
11
  readonly HYPE_ARBITRUM: "0xbcb8fe13d02b023e8f94f6881cc0192fd918a5c0";
12
12
  readonly BNB_ARBITRUM: "0x2d340912aa47e33c90efb078e69e70efe2b34b9b";
13
- readonly BNB_WBTC_USDC_ARBITRUM: "0x065577D05c3D4C11505ed7bc97BBF85d462A6A6f";
13
+ readonly BNB_WBTC_USDC_ARBITRUM: "0x065577d05c3d4c11505ed7bc97bbf85d462a6a6f";
14
14
  readonly LINK_ARBITRUM: "0x7f1fa204bb700853d36994da19f830b6ad18455c";
15
15
  readonly PUMP_ARBITRUM: "0x4c0bb704529fa49a26bd854802d70206982c6f1b";
16
16
  readonly GOLD_ARBITRUM: "0xeb28ad1a2e497f4acc5d9b87e7b496623c93061e";
@@ -11,6 +11,7 @@ export declare const useUpdateTradingSettings: () => (payload: Partial<{
11
11
  isMaxSlippageLoading: boolean;
12
12
  availableAggregators: string[];
13
13
  selectedAggregators: string[];
14
+ aggregatorLimitPerChain?: Partial<Record<number, string[]>> | undefined;
14
15
  isBatchTransactionsEnabled: boolean;
15
16
  isForceSendEnabled?: boolean | undefined;
16
17
  forceSendGas?: number | undefined;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Resolves effective available and selected aggregators for the current pool's chain.
3
+ *
4
+ * When `aggregatorLimitPerChain[chainId]` is set, both lists are filtered
5
+ * to include only the aggregators in that allow-list.
6
+ * Otherwise the global flat lists are returned unchanged.
7
+ */
8
+ export declare const useEffectiveAggregators: () => {
9
+ effectiveAvailableAggregators: string[];
10
+ effectiveSelectedAggregators: string[];
11
+ };
@@ -2,6 +2,7 @@ export { useSetTradingType, useUpdateTradingModal, useUpdateSendTokenInput, useS
2
2
  export { useTradingPanelPoolAddress, useTradingPanelPoolConfig, useTradingPanelPoolConfigs, useTradingPanelPoolFallbackData, useIsPoolAddress, } from '../../hooks/state/pool';
3
3
  export { useSendTokenInput, useReceiveTokenInput, } from '../../hooks/state/input';
4
4
  export { useTradingPanelSettings, useCustomDepositTokensPerChain, } from '../../hooks/state/settings';
5
+ export { useEffectiveAggregators } from '../../hooks/state/aggregators';
5
6
  export { useTradingPanelModal } from '../../hooks/state/modal';
6
7
  export { useWithdrawAction } from '../../hooks/state/active-action';
7
8
  export { useTradingPanelType, useIsDepositTradingPanelType, } from '../../hooks/state/type';
@@ -33,6 +33,7 @@ export interface TradingPanelState {
33
33
  isMaxSlippageLoading: boolean;
34
34
  availableAggregators: string[];
35
35
  selectedAggregators: string[];
36
+ aggregatorLimitPerChain?: Partial<Record<ChainId, string[]>>;
36
37
  isBatchTransactionsEnabled: boolean;
37
38
  isForceSendEnabled?: boolean;
38
39
  forceSendGas?: number;