@dhedge/trading-widget 5.6.1 → 5.7.3

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.
Files changed (40) hide show
  1. package/README.md +1 -0
  2. package/{complex-withdraw-asset-data-Dcnjfbe1.js → complex-withdraw-asset-data-CSbXrln9.js} +7 -7
  3. package/{complex-withdraw-asset-data-CJHcItJS.cjs → complex-withdraw-asset-data-PUJePMgr.cjs} +1 -1
  4. package/const.cjs +1 -1
  5. package/const.js +30 -27
  6. package/core-kit/const/derive.d.ts +1 -0
  7. package/core-kit/const/error.d.ts +1 -0
  8. package/core-kit/const/gmx.d.ts +1 -0
  9. package/core-kit/const/index.d.ts +1 -0
  10. package/core-kit/hooks/state/action.d.ts +8 -1
  11. package/core-kit/hooks/state/index.d.ts +1 -1
  12. package/core-kit/types/state.types.d.ts +12 -1
  13. package/derive-BmKPodpX.js +7 -0
  14. package/derive-CsdqSZEg.cjs +1 -0
  15. package/index.cjs +1 -1
  16. package/index.js +2935 -2699
  17. package/package.json +1 -1
  18. package/{storage-CHA9ReGl.js → storage-C-fGORin.js} +241 -238
  19. package/{storage-DWlbZwWV.cjs → storage-DpKnvEM4.cjs} +1 -1
  20. package/style.css +1 -1
  21. package/trading-widget/components/common/icon/sad-face-icon/sad-face-icon.d.ts +2 -0
  22. package/trading-widget/components/common/switch/switch.d.ts +3 -1
  23. package/trading-widget/components/widget/widget-buttons/withdraw-stepper-button/withdraw-stepper-button.hooks.d.ts +1 -0
  24. package/trading-widget/components/widget/widget-overlay/error-notification-overlay/deposits/deposit-swap-error-overlay.d.ts +7 -0
  25. package/trading-widget/components/widget/widget-overlay/error-notification-overlay/deposits/refresh-deposit-swap-quote-overlay-button.d.ts +6 -0
  26. package/trading-widget/components/widget/widget-overlay/error-notification-overlay/deposits/refresh-deposit-swap-quote-overlay-button.hooks.d.ts +4 -0
  27. package/trading-widget/components/widget/widget-overlay/error-notification-overlay/error-notification-overlay.hooks.d.ts +2 -0
  28. package/trading-widget/components/widget/widget-overlay/error-notification-overlay/refresh-swap-quote-overlay-button.d.ts +7 -0
  29. package/trading-widget/components/widget/widget-overlay/error-notification-overlay/refresh-swap-quote-overlay-button.hooks.d.ts +12 -0
  30. package/trading-widget/components/widget/widget-overlay/error-notification-overlay/{complete-withdraw-error-overlay.d.ts → withdrawals/complete-withdraw-error-overlay.d.ts} +3 -2
  31. package/trading-widget/components/widget/widget-overlay/error-notification-overlay/withdrawals/refresh-withdraw-swap-quote-overlay-button.d.ts +6 -0
  32. package/trading-widget/components/widget/widget-overlay/error-notification-overlay/withdrawals/refresh-withdraw-swap-quote-overlay-button.hooks.d.ts +4 -0
  33. package/trading-widget/components/widget/widget-overlay/trading-overlay/deposits/success-deposit-overlay.hooks.d.ts +2 -0
  34. package/trading-widget/components/withdraw/init-step/input-group/init-withdraw-input-group.hooks.d.ts +1 -0
  35. package/trading-widget/providers/component-provider/component-provider.d.ts +1 -0
  36. package/trading-widget/providers/component-provider/component-provider.hooks.d.ts +1 -0
  37. package/trading-widget/providers/component-provider/component-provider.types.d.ts +1 -0
  38. package/trading-widget/providers/translation-provider/translation-provider.types.d.ts +2 -0
  39. package/utils.cjs +1 -1
  40. package/utils.js +1 -1
package/README.md CHANGED
@@ -586,6 +586,7 @@ path: `component.meta[name]`
586
586
  > | `showAll` | string | Show All | |
587
587
  > | `hide` | string | Hide | |
588
588
  > | `refreshSwapQuoteTooltip` | string | Refresh swap quote | |
589
+ > | `tryAgain` | string | Try again | |
589
590
  > | `proceedWithNextStep` | string | Please proceed with the next step. | |
590
591
  > | `aggregatorsLabel` | string | Swap source | |
591
592
  > | `aggregatorsTooltip` | string | Choose which aggregators to use for your trades. | |
@@ -1,5 +1,5 @@
1
1
  import i from "bignumber.js";
2
- import { ai as B, ag as R, ah as O, b as T, p as _, aj as C, ak as b, a3 as F, c as M, a7 as v, ac as P, ab as x, Y as $, al as h, f as U, e as K, L as Y, Q as V, O as W, am as G, an as H, P as Z, M as k, a9 as S, _ as Q, V as j, W as z, T as X, Z as y } from "./storage-CHA9ReGl.js";
2
+ import { aj as B, ah as R, ai as O, b as T, p as _, ak as C, al as b, a3 as F, c as M, a7 as v, ad as P, ac as x, Y as $, am as h, f as U, e as K, L as Y, Q as V, O as W, an as G, ao as H, P as Z, M as k, aa as g, _ as Q, V as j, W as z, T as X, Z as y } from "./storage-C-fGORin.js";
3
3
  import { stringToHex as p, encodeAbiParameters as f } from "viem";
4
4
  const q = () => typeof window < "u";
5
5
  function J() {
@@ -100,7 +100,7 @@ const d = (t, e) => t?.toLowerCase() === e?.toLowerCase(), pt = (t) => d(t, B),
100
100
  slippageTolerance: BigInt(0)
101
101
  };
102
102
  const { srcData: r, dstData: o } = s, c = r.map(({ asset: A, amount: m }) => {
103
- const g = e?.[et({
103
+ const S = e?.[et({
104
104
  sourceAddress: A,
105
105
  amount: m.toString()
106
106
  })]?.find((L) => L.routerKey === n);
@@ -108,8 +108,8 @@ const d = (t, e) => t?.toLowerCase() === e?.toLowerCase(), pt = (t) => d(t, B),
108
108
  asset: A,
109
109
  amount: m,
110
110
  swapData: {
111
- routerKey: p(g?.routerKey ?? "", { size: 32 }),
112
- txData: g?.rawTransaction.data ?? "0x"
111
+ routerKey: p(S?.routerKey ?? "", { size: 32 }),
112
+ txData: S?.rawTransaction.data ?? "0x"
113
113
  }
114
114
  };
115
115
  }), u = f(
@@ -238,9 +238,9 @@ const d = (t, e) => t?.toLowerCase() === e?.toLowerCase(), pt = (t) => d(t, B),
238
238
  chainId: n
239
239
  }) => {
240
240
  const r = {
241
- [S.SYMBOL.NAME]: s,
242
- [S.CHAIN_ID.NAME]: n,
243
- [S.ADDRESS.NAME]: At(a)
241
+ [g.SYMBOL.NAME]: s,
242
+ [g.CHAIN_ID.NAME]: n,
243
+ [g.ADDRESS.NAME]: At(a)
244
244
  };
245
245
  Q[t].forEach((o) => {
246
246
  e?.(o, r);
@@ -1 +1 @@
1
- "use strict";const c=require("bignumber.js"),s=require("./storage-DWlbZwWV.cjs"),m=require("viem"),P=()=>typeof window<"u";function x(){return P()&&typeof window.ethereum<"u"}async function U(t){try{if(x())return window.ethereum.request({method:"wallet_watchAsset",params:{type:"ERC20",options:t}})}catch{return!1}return!1}const l=(t,e)=>t?.toLowerCase()===e?.toLowerCase(),$=t=>l(t,s.AddressZero$1),N=(t,e)=>s.contractsAddressesMap[e]?.[t]??s.AddressZero,G=t=>s.contractsAbisMap[t],W=t=>t&&`${t.substring(0,6)}...${t.substring(t.length-4,t.length)}`,K=({address:t,chainId:e})=>{const r=N("aaveLendingPoolV3",e);return l(t,r)},y=({sourceAddress:t,amount:e})=>`${t}_${e}`,V=(t,e)=>{const r=t.slice(0,e),n=t.slice(e);return{firstPart:r,secondPart:n}},w=(t,e)=>t/e*100,Y=t=>t<1?4:t<10?3:2,Z=(t,e=s.DEFAULT_PRECISION)=>new c(t.toString()).shiftedBy(e).toFixed(0),H=(t,e,r,n)=>new c(e).dividedBy(r).multipliedBy(t).shiftedBy(-(n||s.DEFAULT_PRECISION)).toNumber(),k=t=>BigInt(new c(t||"0").shiftedBy(s.DEFAULT_PRECISION).toFixed(0,c.ROUND_DOWN)),Q=t=>{const e=new c(.01),r=new c(t),n=!r.isZero()&&r.lt(e)?e:r;return BigInt(n.multipliedBy(100).toFixed(0))},q=({vaultAddress:t,swapData:e,sendTokenAddress:r,sendTokenAmount:n,vaultDepositTokenAddress:o,minVaultTokensReceivedAmount:a,routerKey:i="ONE_INCH",swapDestinationAmount:d,swapSlippage:A})=>{const u=new c(d).multipliedBy(1-A/100).toFixed(0),g=[m.stringToHex(i,{size:32}),e];return[t,[[r,n,g],[o,u]],a]},z=({receiveAssetAddress:t,assets:e,swapData:r})=>{const n={srcData:[],destAmount:new c("0")},{srcData:o}=e?.reduce((a,i)=>{const d=r?.[i.address];if(!d)return a;const A=[m.stringToHex(d.routerKey,{size:32}),d.rawTransaction.data],u=[i.address,i.rawBalance,A];return{srcData:[...a.srcData,u],destAmount:a.destAmount.plus(d.destinationAmount)}},n)??n;return[o,[t,"0"]]},h=({assetAddress:t,swapQuotes:e,swapParams:r,slippageToleranceForContractTransaction:n,routerKey:o})=>{if(!r)return{supportedAsset:t,withdrawData:"",slippageTolerance:BigInt(0)};const{srcData:a,dstData:i}=r,d=a.map(({asset:g,amount:T})=>{const S=e?.[y({sourceAddress:g,amount:T.toString()})]?.find(M=>M.routerKey===o);return{asset:g,amount:T,swapData:{routerKey:m.stringToHex(S?.routerKey??"",{size:32}),txData:S?.rawTransaction.data??"0x"}}}),A=m.encodeAbiParameters(s.ComplexWithdrawalAssetSrcDataAbiItem,[d]),u=m.encodeAbiParameters(s.ComplexWithdrawalDataAbiItem,[{encodedSrcData:A,dstData:{dstAddress:i.asset,dstAmount:i.amount},slippage:n}]);return{supportedAsset:t,withdrawData:u,slippageTolerance:n}},j=(t,e)=>s.CHAIN_NATIVE_TOKENS[e]?.nativeTokenSymbol===t,X=({nativeTokenBalance:t,tokenDecimals:e,gasPrice:r})=>{const n=new c(r).multipliedBy(s.NATIVE_TOKEN_DEPOSIT_GAS_LIMIT).shiftedBy(-e),o=new c(t).minus(n);return o.gt("0")?o:new c("0")},J=t=>s.STABLE_TOKEN_SYMBOLS.includes(t),tt=t=>{const e=Object.values(t).reduce((r,{type:n})=>(r[n]=r[n]+1,r),{string:0,number:0});if(e.string>10)throw new Error("logger params must contain up to 10 string values");if(e.number>40)throw new Error("logger params must contain up to 40 numeric values");return!0},et=(t,e=150)=>t.length>e?t.substring(0,e):t,E=(t,e=s.TRANSACTION_ERROR_KEYS)=>{const r=t.toLowerCase();return e.sort((n,o)=>o.length-n.length).find(n=>r.includes(n.toLowerCase()))},D=t=>s.TRANSACTION_ERRORS[t]??s.LIMIT_ORDER_TRANSACTION_ERRORS[t],rt=({errorMessage:t,abiErrors:e})=>{if(!t||t.includes("User rejected"))return null;const r=e.find(a=>t.includes(a));if(r&&E(r))return D(r);const n=E(t);if(n)return D(n);const[o]=t.split(r?".":"Contract").map(a=>a.trim());return{title:"Transaction failed",hint:`${et(o??"")} ${r?`: ${r}`:""}`}},nt=t=>typeof t=="bigint"&&t!==BigInt(0),B=(t,e=s.DEFAULT_PRECISION$1)=>new c(t).shiftedBy(-e).toNumber(),I=t=>!isNaN(parseFloat(t))&&!isNaN(t),L=({value:t,minimumFractionDigits:e=2,maximumFractionDigits:r=2,compact:n=!1,normalize:o=!1})=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:n?"compact":void 0,minimumFractionDigits:e,maximumFractionDigits:r}).format(o?B(t):Number(t)),_=t=>I(t)?new c(t).toFixed():"",f=["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"],R=({value:t,decimals:e=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<f.length)return`0.0${f[a.length]}${i.slice(0,3)}`}return _(r.toFixed(e))},C=(t,e=0)=>`${t.toLocaleString("en-US",{maximumFractionDigits:e})}%`,st=t=>t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),ot=(t,e,r=0)=>{const n=w(+t,e);return C(n,r)},at=({currency:t,value:e})=>t==="USD"?L({value:e}):`${s.CURRENCY_SYMBOL_MAP[t]} ${R({value:e,decimals:s.CURRENCY_DECIMALS_MAP[t]})}`,b=(t,e)=>new c(new c(t).toFixed(e,c.ROUND_DOWN)).toString(),O=(t,e=3,r=2)=>{if(t.length<=5)return t;const n="...";return t.length<=e+r+n.length?t:`${t.slice(0,e)}${n}${t.slice(-r)}`},it=({balance:t,symbol:e,precision:r,truncateSymbol:n})=>`${b(t,r)} ${n?O(e):e}`,ct=t=>{if(!t)return;const e=t.match(/0x[a-fA-F0-9]{64}/);if(!e)return;const r=e[0];return`${r.slice(0,4)}...${r.slice(-3)}`},p=typeof window<"u",dt=t=>l(s.FLATMONEY_EARLY_DEPOSITOR_VAULT_ADDRESS_BASE,t)||l(s.FLATMONEY_DHT_STAKING_VAULT_ADDRESS_BASE,t),At=t=>s.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES.some(e=>l(e,t)),lt=t=>s.FLAT_MONEY_COLLATERAL_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:s.AddressZero},ut=t=>l(t,s.FLAT_MONEY_V1_UNIT_ADDRESS)?s.FLAT_MONEY_V1_UNIT_LINK:s.FLAT_MONEY_UNIT_LINK,F=t=>`eth_${t}`,mt=({action:t,log:e,symbol:r,vaultAddress:n,chainId:o})=>{const a={[s.TRADING_LOG_EVENT_PARAM.SYMBOL.NAME]:r,[s.TRADING_LOG_EVENT_PARAM.CHAIN_ID.NAME]:o,[s.TRADING_LOG_EVENT_PARAM.ADDRESS.NAME]:F(n)};s.LOG_EVENT_BY_TRANSACTION_ACTION_MAP[t].forEach(i=>{e?.(i,a)})},gt=t=>s.GMX_MARKET_ASSETS.some(e=>l(e,t)),Tt=t=>s.GMX_WITHDRAW_ASSET_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:s.AddressZero},St=t=>s.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS[t.toLowerCase()];function Et(){if(p)try{const t=localStorage.getItem(s.LOCAL_STORAGE_KEYS.IS_BATCH_TRANSACTIONS_ENABLED);return t?JSON.parse(t):void 0}catch{return}}function _t(t){if(p)try{localStorage.setItem(s.LOCAL_STORAGE_KEYS.IS_BATCH_TRANSACTIONS_ENABLED,JSON.stringify(t))}catch(e){console.error("[core-kit]: Failed to persist batch transactions setting",e)}}const pt=t=>{const e=t.find(({swapQuotes:r})=>r);return e?.swapQuotes?Object.values(e.swapQuotes)[0]?.map(({routerKey:r})=>r)??[]:[]},v=(t,e,r)=>t.map(({asset:n,swapParams:o,swapQuotes:a})=>!o||!a?{supportedAsset:n,withdrawData:"",slippageTolerance:r}:h({assetAddress:n,swapQuotes:a,swapParams:o,slippageToleranceForContractTransaction:r,routerKey:e})),Dt=async(t,e,r,n,o)=>{for(const a of t){const i=v(e,a,r),{error:d}=await n(...o,i);if(!d)return i}return null},ft=(t,e)=>(t??[]).map(r=>({supportedAsset:r,withdrawData:"",slippageTolerance:e})),Nt=async(t,e,{fetchAaveSwapParams:r,fetchAaveSwapQuotes:n,withdrawAmountD18:o,slippage:a})=>Promise.all((t??[]).map(async i=>{if(!l(i,e))return{asset:i};try{const A=await r({withdrawAmountD18:o,slippage:a});if(A?.srcData.length){const u=await n({swapParams:A,slippage:a});return{asset:i,swapParams:A,swapQuotes:u}}return{asset:i}}catch(A){return console.error(A),{asset:i}}}));exports.addTokenToWallet=U;exports.buildAaveWithdrawAssetTransactionData=h;exports.buildComplexAssetDataForRouter=v;exports.buildSwapQuoteKeyForAave=y;exports.buildSwapWithdrawTransactionData=z;exports.buildZapDepositTransactionArguments=q;exports.clientSide=p;exports.commify=st;exports.createDefaultComplexAssetData=ft;exports.enrichAssetsWithSwapQuotes=Nt;exports.extractAvailableRouterKeys=pt;exports.formatBalance=b;exports.formatByCurrency=at;exports.formatNumberToLimitedDecimals=R;exports.formatNumeratorToPercentage=ot;exports.formatPercentage=C;exports.formatToUsd=L;exports.formatTokenBalance=it;exports.getContractAbiById=G;exports.getContractAddressById=N;exports.getConventionalTokenPriceDecimals=Y;exports.getErrorKey=E;exports.getFlatMoneyCollateralByLeverageAddress=lt;exports.getFlatMoneyLinkByUnitAddress=ut;exports.getGmxWithdrawAssetByLeverageAddress=Tt;exports.getGmxWithdrawAssetByVaultAddress=St;exports.getNativeTokenInvestableBalance=X;exports.getPercent=w;exports.getPoolFraction=H;exports.getSlippageToleranceForContractTransaction=Q;exports.getStoredBatchTransactionsEnabled=Et;exports.getTxHashShort=ct;exports.isAaveLendAndBorrowAsset=K;exports.isEqualAddress=l;exports.isFlatMoneyLeveragedAsset=At;exports.isFmpAirdropVaultAddress=dt;exports.isGmxLeveragedAsset=gt;exports.isNativeToken=j;exports.isNumeric=I;exports.isStableSymbol=J;exports.isZeroAddress=$;exports.logTransactionByActionType=mt;exports.nonZeroBigInt=nt;exports.normalizeNumber=B;exports.parseAmountToD18=k;exports.parseContractErrorMessage=rt;exports.persistBatchTransactionsEnabled=_t;exports.removeInsignificantTrailingZeros=_;exports.shiftBy=Z;exports.shortenAddress=W;exports.sliceByIndex=V;exports.transformAddressForAnalytics=F;exports.truncateString=O;exports.tryEstimateWithRouters=Dt;exports.validateLoggerEventParams=tt;
1
+ "use strict";const c=require("bignumber.js"),s=require("./storage-DpKnvEM4.cjs"),m=require("viem"),P=()=>typeof window<"u";function x(){return P()&&typeof window.ethereum<"u"}async function U(t){try{if(x())return window.ethereum.request({method:"wallet_watchAsset",params:{type:"ERC20",options:t}})}catch{return!1}return!1}const l=(t,e)=>t?.toLowerCase()===e?.toLowerCase(),$=t=>l(t,s.AddressZero$1),N=(t,e)=>s.contractsAddressesMap[e]?.[t]??s.AddressZero,G=t=>s.contractsAbisMap[t],W=t=>t&&`${t.substring(0,6)}...${t.substring(t.length-4,t.length)}`,K=({address:t,chainId:e})=>{const r=N("aaveLendingPoolV3",e);return l(t,r)},y=({sourceAddress:t,amount:e})=>`${t}_${e}`,V=(t,e)=>{const r=t.slice(0,e),n=t.slice(e);return{firstPart:r,secondPart:n}},w=(t,e)=>t/e*100,Y=t=>t<1?4:t<10?3:2,Z=(t,e=s.DEFAULT_PRECISION)=>new c(t.toString()).shiftedBy(e).toFixed(0),H=(t,e,r,n)=>new c(e).dividedBy(r).multipliedBy(t).shiftedBy(-(n||s.DEFAULT_PRECISION)).toNumber(),k=t=>BigInt(new c(t||"0").shiftedBy(s.DEFAULT_PRECISION).toFixed(0,c.ROUND_DOWN)),Q=t=>{const e=new c(.01),r=new c(t),n=!r.isZero()&&r.lt(e)?e:r;return BigInt(n.multipliedBy(100).toFixed(0))},q=({vaultAddress:t,swapData:e,sendTokenAddress:r,sendTokenAmount:n,vaultDepositTokenAddress:o,minVaultTokensReceivedAmount:a,routerKey:i="ONE_INCH",swapDestinationAmount:d,swapSlippage:A})=>{const u=new c(d).multipliedBy(1-A/100).toFixed(0),g=[m.stringToHex(i,{size:32}),e];return[t,[[r,n,g],[o,u]],a]},z=({receiveAssetAddress:t,assets:e,swapData:r})=>{const n={srcData:[],destAmount:new c("0")},{srcData:o}=e?.reduce((a,i)=>{const d=r?.[i.address];if(!d)return a;const A=[m.stringToHex(d.routerKey,{size:32}),d.rawTransaction.data],u=[i.address,i.rawBalance,A];return{srcData:[...a.srcData,u],destAmount:a.destAmount.plus(d.destinationAmount)}},n)??n;return[o,[t,"0"]]},h=({assetAddress:t,swapQuotes:e,swapParams:r,slippageToleranceForContractTransaction:n,routerKey:o})=>{if(!r)return{supportedAsset:t,withdrawData:"",slippageTolerance:BigInt(0)};const{srcData:a,dstData:i}=r,d=a.map(({asset:g,amount:T})=>{const S=e?.[y({sourceAddress:g,amount:T.toString()})]?.find(M=>M.routerKey===o);return{asset:g,amount:T,swapData:{routerKey:m.stringToHex(S?.routerKey??"",{size:32}),txData:S?.rawTransaction.data??"0x"}}}),A=m.encodeAbiParameters(s.ComplexWithdrawalAssetSrcDataAbiItem,[d]),u=m.encodeAbiParameters(s.ComplexWithdrawalDataAbiItem,[{encodedSrcData:A,dstData:{dstAddress:i.asset,dstAmount:i.amount},slippage:n}]);return{supportedAsset:t,withdrawData:u,slippageTolerance:n}},j=(t,e)=>s.CHAIN_NATIVE_TOKENS[e]?.nativeTokenSymbol===t,X=({nativeTokenBalance:t,tokenDecimals:e,gasPrice:r})=>{const n=new c(r).multipliedBy(s.NATIVE_TOKEN_DEPOSIT_GAS_LIMIT).shiftedBy(-e),o=new c(t).minus(n);return o.gt("0")?o:new c("0")},J=t=>s.STABLE_TOKEN_SYMBOLS.includes(t),tt=t=>{const e=Object.values(t).reduce((r,{type:n})=>(r[n]=r[n]+1,r),{string:0,number:0});if(e.string>10)throw new Error("logger params must contain up to 10 string values");if(e.number>40)throw new Error("logger params must contain up to 40 numeric values");return!0},et=(t,e=150)=>t.length>e?t.substring(0,e):t,E=(t,e=s.TRANSACTION_ERROR_KEYS)=>{const r=t.toLowerCase();return e.sort((n,o)=>o.length-n.length).find(n=>r.includes(n.toLowerCase()))},D=t=>s.TRANSACTION_ERRORS[t]??s.LIMIT_ORDER_TRANSACTION_ERRORS[t],rt=({errorMessage:t,abiErrors:e})=>{if(!t||t.includes("User rejected"))return null;const r=e.find(a=>t.includes(a));if(r&&E(r))return D(r);const n=E(t);if(n)return D(n);const[o]=t.split(r?".":"Contract").map(a=>a.trim());return{title:"Transaction failed",hint:`${et(o??"")} ${r?`: ${r}`:""}`}},nt=t=>typeof t=="bigint"&&t!==BigInt(0),B=(t,e=s.DEFAULT_PRECISION$1)=>new c(t).shiftedBy(-e).toNumber(),I=t=>!isNaN(parseFloat(t))&&!isNaN(t),L=({value:t,minimumFractionDigits:e=2,maximumFractionDigits:r=2,compact:n=!1,normalize:o=!1})=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:n?"compact":void 0,minimumFractionDigits:e,maximumFractionDigits:r}).format(o?B(t):Number(t)),_=t=>I(t)?new c(t).toFixed():"",f=["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"],R=({value:t,decimals:e=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<f.length)return`0.0${f[a.length]}${i.slice(0,3)}`}return _(r.toFixed(e))},C=(t,e=0)=>`${t.toLocaleString("en-US",{maximumFractionDigits:e})}%`,st=t=>t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),ot=(t,e,r=0)=>{const n=w(+t,e);return C(n,r)},at=({currency:t,value:e})=>t==="USD"?L({value:e}):`${s.CURRENCY_SYMBOL_MAP[t]} ${R({value:e,decimals:s.CURRENCY_DECIMALS_MAP[t]})}`,b=(t,e)=>new c(new c(t).toFixed(e,c.ROUND_DOWN)).toString(),O=(t,e=3,r=2)=>{if(t.length<=5)return t;const n="...";return t.length<=e+r+n.length?t:`${t.slice(0,e)}${n}${t.slice(-r)}`},it=({balance:t,symbol:e,precision:r,truncateSymbol:n})=>`${b(t,r)} ${n?O(e):e}`,ct=t=>{if(!t)return;const e=t.match(/0x[a-fA-F0-9]{64}/);if(!e)return;const r=e[0];return`${r.slice(0,4)}...${r.slice(-3)}`},p=typeof window<"u",dt=t=>l(s.FLATMONEY_EARLY_DEPOSITOR_VAULT_ADDRESS_BASE,t)||l(s.FLATMONEY_DHT_STAKING_VAULT_ADDRESS_BASE,t),At=t=>s.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES.some(e=>l(e,t)),lt=t=>s.FLAT_MONEY_COLLATERAL_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:s.AddressZero},ut=t=>l(t,s.FLAT_MONEY_V1_UNIT_ADDRESS)?s.FLAT_MONEY_V1_UNIT_LINK:s.FLAT_MONEY_UNIT_LINK,F=t=>`eth_${t}`,mt=({action:t,log:e,symbol:r,vaultAddress:n,chainId:o})=>{const a={[s.TRADING_LOG_EVENT_PARAM.SYMBOL.NAME]:r,[s.TRADING_LOG_EVENT_PARAM.CHAIN_ID.NAME]:o,[s.TRADING_LOG_EVENT_PARAM.ADDRESS.NAME]:F(n)};s.LOG_EVENT_BY_TRANSACTION_ACTION_MAP[t].forEach(i=>{e?.(i,a)})},gt=t=>s.GMX_MARKET_ASSETS.some(e=>l(e,t)),Tt=t=>s.GMX_WITHDRAW_ASSET_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:s.AddressZero},St=t=>s.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS[t.toLowerCase()];function Et(){if(p)try{const t=localStorage.getItem(s.LOCAL_STORAGE_KEYS.IS_BATCH_TRANSACTIONS_ENABLED);return t?JSON.parse(t):void 0}catch{return}}function _t(t){if(p)try{localStorage.setItem(s.LOCAL_STORAGE_KEYS.IS_BATCH_TRANSACTIONS_ENABLED,JSON.stringify(t))}catch(e){console.error("[core-kit]: Failed to persist batch transactions setting",e)}}const pt=t=>{const e=t.find(({swapQuotes:r})=>r);return e?.swapQuotes?Object.values(e.swapQuotes)[0]?.map(({routerKey:r})=>r)??[]:[]},v=(t,e,r)=>t.map(({asset:n,swapParams:o,swapQuotes:a})=>!o||!a?{supportedAsset:n,withdrawData:"",slippageTolerance:r}:h({assetAddress:n,swapQuotes:a,swapParams:o,slippageToleranceForContractTransaction:r,routerKey:e})),Dt=async(t,e,r,n,o)=>{for(const a of t){const i=v(e,a,r),{error:d}=await n(...o,i);if(!d)return i}return null},ft=(t,e)=>(t??[]).map(r=>({supportedAsset:r,withdrawData:"",slippageTolerance:e})),Nt=async(t,e,{fetchAaveSwapParams:r,fetchAaveSwapQuotes:n,withdrawAmountD18:o,slippage:a})=>Promise.all((t??[]).map(async i=>{if(!l(i,e))return{asset:i};try{const A=await r({withdrawAmountD18:o,slippage:a});if(A?.srcData.length){const u=await n({swapParams:A,slippage:a});return{asset:i,swapParams:A,swapQuotes:u}}return{asset:i}}catch(A){return console.error(A),{asset:i}}}));exports.addTokenToWallet=U;exports.buildAaveWithdrawAssetTransactionData=h;exports.buildComplexAssetDataForRouter=v;exports.buildSwapQuoteKeyForAave=y;exports.buildSwapWithdrawTransactionData=z;exports.buildZapDepositTransactionArguments=q;exports.clientSide=p;exports.commify=st;exports.createDefaultComplexAssetData=ft;exports.enrichAssetsWithSwapQuotes=Nt;exports.extractAvailableRouterKeys=pt;exports.formatBalance=b;exports.formatByCurrency=at;exports.formatNumberToLimitedDecimals=R;exports.formatNumeratorToPercentage=ot;exports.formatPercentage=C;exports.formatToUsd=L;exports.formatTokenBalance=it;exports.getContractAbiById=G;exports.getContractAddressById=N;exports.getConventionalTokenPriceDecimals=Y;exports.getErrorKey=E;exports.getFlatMoneyCollateralByLeverageAddress=lt;exports.getFlatMoneyLinkByUnitAddress=ut;exports.getGmxWithdrawAssetByLeverageAddress=Tt;exports.getGmxWithdrawAssetByVaultAddress=St;exports.getNativeTokenInvestableBalance=X;exports.getPercent=w;exports.getPoolFraction=H;exports.getSlippageToleranceForContractTransaction=Q;exports.getStoredBatchTransactionsEnabled=Et;exports.getTxHashShort=ct;exports.isAaveLendAndBorrowAsset=K;exports.isEqualAddress=l;exports.isFlatMoneyLeveragedAsset=At;exports.isFmpAirdropVaultAddress=dt;exports.isGmxLeveragedAsset=gt;exports.isNativeToken=j;exports.isNumeric=I;exports.isStableSymbol=J;exports.isZeroAddress=$;exports.logTransactionByActionType=mt;exports.nonZeroBigInt=nt;exports.normalizeNumber=B;exports.parseAmountToD18=k;exports.parseContractErrorMessage=rt;exports.persistBatchTransactionsEnabled=_t;exports.removeInsignificantTrailingZeros=_;exports.shiftBy=Z;exports.shortenAddress=W;exports.sliceByIndex=V;exports.transformAddressForAnalytics=F;exports.truncateString=O;exports.tryEstimateWithRouters=Dt;exports.validateLoggerEventParams=tt;
package/const.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./storage-DWlbZwWV.cjs"),E=require("wagmi/chains");exports.ALCHEMY_RPC_URL_MAP=_.ALCHEMY_RPC_URL_MAP;exports.AUTO_TRANSACTION_PUSH_DELAY=_.AUTO_TRANSACTION_PUSH_DELAY;exports.AddressZero=_.AddressZero;exports.BRIDGED_TOKENS_SYMBOLS=_.BRIDGED_TOKENS_SYMBOLS;exports.CHAIN_MAP=_.CHAIN_MAP;exports.CHAIN_NATIVE_TOKENS=_.CHAIN_NATIVE_TOKENS;exports.COMPLETE_WITHDRAW_ACTIONS=_.COMPLETE_WITHDRAW_ACTIONS;exports.CURRENCY_DECIMALS_MAP=_.CURRENCY_DECIMALS_MAP;exports.CURRENCY_SYMBOL_MAP=_.CURRENCY_SYMBOL_MAP;exports.DEFAULT_DEBOUNCE_TIME=_.DEFAULT_DEBOUNCE_TIME;exports.DEFAULT_DEPOSIT_METHOD=_.DEFAULT_DEPOSIT_METHOD;exports.DEFAULT_DEPOSIT_SLIPPAGE=_.DEFAULT_DEPOSIT_SLIPPAGE;exports.DEFAULT_DEPOSIT_SLIPPAGE_SCALE=_.DEFAULT_DEPOSIT_SLIPPAGE_SCALE;exports.DEFAULT_ERROR_MESSAGE=_.DEFAULT_ERROR_MESSAGE;exports.DEFAULT_LOCK_TIME=_.DEFAULT_LOCK_TIME;exports.DEFAULT_MULTI_ASSET_WITHDRAW_METHOD=_.DEFAULT_MULTI_ASSET_WITHDRAW_METHOD;exports.DEFAULT_NOTIFICATION_DURATION_MS=_.DEFAULT_NOTIFICATION_DURATION_MS;exports.DEFAULT_NO_SWAP_MIN_DEPOSIT_AMOUNT_GAP=_.DEFAULT_NO_SWAP_MIN_DEPOSIT_AMOUNT_GAP;exports.DEFAULT_POLLING_INTERVAL=_.DEFAULT_POLLING_INTERVAL;exports.DEFAULT_PRECISION=_.DEFAULT_PRECISION;exports.DEFAULT_PROMISE_TIMEOUT_MS=_.DEFAULT_PROMISE_TIMEOUT_MS;exports.DEFAULT_RECEIVED_VALUE_GAP=_.DEFAULT_RECEIVED_VALUE_GAP;exports.DEFAULT_SIMULATION_ERROR=_.DEFAULT_SIMULATION_ERROR;exports.DEFAULT_SWAP_TRANSACTION_SLIPPAGE=_.DEFAULT_SWAP_TRANSACTION_SLIPPAGE;exports.DEFAULT_VAULT_TOKEN_PRICE=_.DEFAULT_VAULT_TOKEN_PRICE;exports.DEFAULT_VISIBLE_ASSETS_LIMIT=_.DEFAULT_VISIBLE_ASSETS_LIMIT;exports.DEFAULT_WITHDRAW_SLIPPAGE=_.DEFAULT_WITHDRAW_SLIPPAGE;exports.DEPOSIT_SWAP_DATA_ERROR=_.DEPOSIT_SWAP_DATA_ERROR;exports.EASY_SWAPPER_V2_COMPLETE_WITHDRAW_METHOD=_.EASY_SWAPPER_V2_COMPLETE_WITHDRAW_METHOD;exports.EASY_SWAPPER_V2_DEPOSIT_METHODS=_.EASY_SWAPPER_V2_DEPOSIT_METHODS;exports.EASY_SWAPPER_V2_INITIATE_WITHDRAW_METHOD=_.EASY_SWAPPER_V2_INITIATE_WITHDRAW_METHOD;exports.EASY_SWAPPER_V2_UNROLL_AND_CLAIM_METHOD=_.EASY_SWAPPER_V2_UNROLL_AND_CLAIM_METHOD;exports.EMPTY_POOL_CONFIG=_.EMPTY_POOL_CONFIG;exports.EXTENDED_DEBOUNCE_TIME=_.EXTENDED_DEBOUNCE_TIME;exports.EXTENDED_POLLING_INTERVAL=_.EXTENDED_POLLING_INTERVAL;exports.EXTREMELY_SHORT_POLLING_INTERVAL=_.EXTREMELY_SHORT_POLLING_INTERVAL;exports.FALLBACK_ASSETS_MAP=_.FALLBACK_ASSETS_MAP;exports.FLAT_MONEY_COLLATERAL_MAP=_.FLAT_MONEY_COLLATERAL_MAP;exports.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES=_.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES;exports.FLAT_MONEY_UNIT_ADDRESSES=_.FLAT_MONEY_UNIT_ADDRESSES;exports.FLAT_MONEY_UNIT_LINK=_.FLAT_MONEY_UNIT_LINK;exports.FLAT_MONEY_V1_UNIT_ADDRESS=_.FLAT_MONEY_V1_UNIT_ADDRESS;exports.FLAT_MONEY_V1_UNIT_LINK=_.FLAT_MONEY_V1_UNIT_LINK;exports.GAS_ESTIMATION_ERROR=_.GAS_ESTIMATION_ERROR;exports.GAS_LIMIT_BUFFER_COEFF=_.GAS_LIMIT_BUFFER_COEFF;exports.GMX_MARKET_ASSETS=_.GMX_MARKET_ASSETS;exports.GMX_MARKET_ASSETS_MAP=_.GMX_MARKET_ASSETS_MAP;exports.GMX_WITHDRAW_ASSET_MAP=_.GMX_WITHDRAW_ASSET_MAP;exports.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS=_.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS;exports.INVALID_PRICES_LIMIT_ORDER_TITLE=_.INVALID_PRICES_LIMIT_ORDER_TITLE;exports.LIMIT_ORDER_TRANSACTION_ERRORS=_.LIMIT_ORDER_TRANSACTION_ERRORS;exports.LOCAL_STORAGE_KEYS=_.LOCAL_STORAGE_KEYS;exports.LOG_EVENT_BY_TRANSACTION_ACTION_MAP=_.LOG_EVENT_BY_TRANSACTION_ACTION_MAP;exports.MANAGER_FEE_DENOMINATOR=_.MANAGER_FEE_DENOMINATOR;exports.MAX_GAS_LIMIT_MAP=_.MAX_GAS_LIMIT_MAP;exports.MULTI_ASSET_TOKEN=_.MULTI_ASSET_TOKEN;exports.MaxUint256=_.MaxUint256;exports.NATIVE_TOKEN_DEPOSIT_GAS_LIMIT=_.NATIVE_TOKEN_DEPOSIT_GAS_LIMIT;exports.PYTH_API_LINK=_.PYTH_API_LINK;exports.SHORTEN_POLLING_INTERVAL=_.SHORTEN_POLLING_INTERVAL;exports.SIMULATION_TIMEOUT_ERROR=_.SIMULATION_TIMEOUT_ERROR;exports.STABLE_TOKEN_SYMBOLS=_.STABLE_TOKEN_SYMBOLS;exports.SWAP_QUOTE_REFRESH_INTERVAL_MS=_.SWAP_QUOTE_REFRESH_INTERVAL_MS;exports.TRADING_LOG_EVENT_PARAM=_.TRADING_LOG_EVENT_PARAM;exports.TRADING_PANEL_LOG_EVENT=_.TRADING_PANEL_LOG_EVENT;exports.TRANSACTION_ERRORS=_.TRANSACTION_ERRORS;exports.TRANSACTION_ERROR_KEYS=_.TRANSACTION_ERROR_KEYS;exports.WBTC_BY_CHAIN_ID=_.WBTC_BY_CHAIN_ID;exports.WETH_BY_CHAIN_ID=_.WETH_BY_CHAIN_ID;exports.WITHDRAW_SWAP_DATA_ERROR=_.WITHDRAW_SWAP_DATA_ERROR;exports.contractsAbisMap=_.contractsAbisMap;exports.contractsAddressesMap=_.contractsAddressesMap;Object.defineProperty(exports,"arbitrum",{enumerable:!0,get:()=>E.arbitrum});Object.defineProperty(exports,"base",{enumerable:!0,get:()=>E.base});Object.defineProperty(exports,"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-DpKnvEM4.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_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,13 +1,15 @@
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 e, v as o, w as t, x as X, E as m, y 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 l, P as u, Q as v, R as Q, S as Z, T as j, 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_ } from "./storage-CHA9ReGl.js";
2
- import { arbitrum as H_, base as V_, hyperEvm as B_, mainnet as K_, optimism as r_, polygon as e_ } from "wagmi/chains";
1
+ import { A, a as T, b as I, B as S, C as a, 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 m, E as p, y as X, 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 l, P as u, Q as v, R as Q, S as Z, T as j, 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 S_, a4 as a_, 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_ } from "./storage-C-fGORin.js";
2
+ import { C as V_ } from "./derive-BmKPodpX.js";
3
+ import { arbitrum as K_, base as r_, hyperEvm as o_, mainnet as e_, optimism as t_, polygon as m_ } from "wagmi/chains";
3
4
  export {
4
5
  A as ALCHEMY_RPC_URL_MAP,
5
6
  T as AUTO_TRANSACTION_PUSH_DELAY,
6
7
  I as AddressZero,
7
- a as BRIDGED_TOKENS_SYMBOLS,
8
- S as CHAIN_MAP,
8
+ S as BRIDGED_TOKENS_SYMBOLS,
9
+ a as CHAIN_MAP,
9
10
  L as CHAIN_NATIVE_TOKENS,
10
11
  R as COMPLETE_WITHDRAW_ACTIONS,
12
+ V_ as COVERED_CALL_VAULT_ADDRESSES,
11
13
  O as CURRENCY_DECIMALS_MAP,
12
14
  s as CURRENCY_SYMBOL_MAP,
13
15
  N as DEFAULT_DEBOUNCE_TIME,
@@ -25,12 +27,12 @@ export {
25
27
  B as DEFAULT_RECEIVED_VALUE_GAP,
26
28
  K as DEFAULT_SIMULATION_ERROR,
27
29
  r as DEFAULT_SWAP_TRANSACTION_SLIPPAGE,
28
- e as DEFAULT_VAULT_TOKEN_PRICE,
29
- o as DEFAULT_VISIBLE_ASSETS_LIMIT,
30
+ o as DEFAULT_VAULT_TOKEN_PRICE,
31
+ e as DEFAULT_VISIBLE_ASSETS_LIMIT,
30
32
  t as DEFAULT_WITHDRAW_SLIPPAGE,
31
- X as DEPOSIT_SWAP_DATA_ERROR,
32
- m as EASY_SWAPPER_V2_COMPLETE_WITHDRAW_METHOD,
33
- p as EASY_SWAPPER_V2_DEPOSIT_METHODS,
33
+ m as DEPOSIT_SWAP_DATA_ERROR,
34
+ p as EASY_SWAPPER_V2_COMPLETE_WITHDRAW_METHOD,
35
+ X as EASY_SWAPPER_V2_DEPOSIT_METHODS,
34
36
  i as EASY_SWAPPER_V2_INITIATE_WITHDRAW_METHOD,
35
37
  n as EASY_SWAPPER_V2_UNROLL_AND_CLAIM_METHOD,
36
38
  c as EMPTY_POOL_CONFIG,
@@ -58,25 +60,26 @@ export {
58
60
  A_ as MAX_GAS_LIMIT_MAP,
59
61
  T_ as MULTI_ASSET_TOKEN,
60
62
  I_ as MaxUint256,
61
- a_ as NATIVE_TOKEN_DEPOSIT_GAS_LIMIT,
62
- S_ as PYTH_API_LINK,
63
+ S_ as NATIVE_TOKEN_DEPOSIT_GAS_LIMIT,
64
+ a_ as PYTH_API_LINK,
63
65
  L_ as SHORTEN_POLLING_INTERVAL,
64
66
  R_ as SIMULATION_TIMEOUT_ERROR,
65
67
  O_ as STABLE_TOKEN_SYMBOLS,
66
- s_ as SWAP_QUOTE_REFRESH_INTERVAL_MS,
67
- N_ as TRADING_LOG_EVENT_PARAM,
68
- D_ as TRADING_PANEL_LOG_EVENT,
69
- M_ as TRANSACTION_ERRORS,
70
- P_ as TRANSACTION_ERROR_KEYS,
71
- U_ as WBTC_BY_CHAIN_ID,
72
- C_ as WETH_BY_CHAIN_ID,
73
- F_ as WITHDRAW_SWAP_DATA_ERROR,
74
- H_ as arbitrum,
75
- V_ as base,
76
- G_ as contractsAbisMap,
77
- W_ as contractsAddressesMap,
78
- B_ as hyperEvm,
79
- K_ as mainnet,
80
- r_ as optimism,
81
- e_ as polygon
68
+ s_ as SWAP_FAILED_ERROR,
69
+ N_ as SWAP_QUOTE_REFRESH_INTERVAL_MS,
70
+ D_ as TRADING_LOG_EVENT_PARAM,
71
+ M_ as TRADING_PANEL_LOG_EVENT,
72
+ P_ as TRANSACTION_ERRORS,
73
+ U_ as TRANSACTION_ERROR_KEYS,
74
+ C_ as WBTC_BY_CHAIN_ID,
75
+ F_ as WETH_BY_CHAIN_ID,
76
+ G_ as WITHDRAW_SWAP_DATA_ERROR,
77
+ K_ as arbitrum,
78
+ r_ as base,
79
+ W_ as contractsAbisMap,
80
+ Y_ as contractsAddressesMap,
81
+ o_ as hyperEvm,
82
+ e_ as mainnet,
83
+ t_ as optimism,
84
+ m_ as polygon
82
85
  };
@@ -0,0 +1 @@
1
+ export declare const COVERED_CALL_VAULT_ADDRESSES: Set<string>;
@@ -4,6 +4,7 @@ export declare const DEFAULT_SIMULATION_ERROR = "Missing simulation params";
4
4
  export declare const SIMULATION_TIMEOUT_ERROR = "Simulation timeout";
5
5
  export declare const DEPOSIT_SWAP_DATA_ERROR = "swap_data_deposit_error";
6
6
  export declare const WITHDRAW_SWAP_DATA_ERROR = "swap_data_withdraw_error";
7
+ export declare const SWAP_FAILED_ERROR = "SwapFailed";
7
8
  type ErrorsMap = Record<string, {
8
9
  title: string;
9
10
  hint?: string;
@@ -14,6 +14,7 @@ export declare const GMX_MARKET_ASSETS_MAP: {
14
14
  readonly LINK_ARBITRUM: "0x7f1fa204bb700853d36994da19f830b6ad18455c";
15
15
  readonly PUMP_ARBITRUM: "0x4c0bb704529fa49a26bd854802d70206982c6f1b";
16
16
  readonly GOLD_ARBITRUM: "0xeb28ad1a2e497f4acc5d9b87e7b496623c93061e";
17
+ readonly AAVE_ARBITRUM: "0x1cbba6346f110c8a5ea739ef2d1eb182990e4eb2";
17
18
  };
18
19
  export type GmxMarketAsset = (typeof GMX_MARKET_ASSETS_MAP)[keyof typeof GMX_MARKET_ASSETS_MAP];
19
20
  export declare const GMX_MARKET_ASSETS: GmxMarketAsset[];
@@ -10,4 +10,5 @@ export * from '../const/links';
10
10
  export * from '../const/flat-money';
11
11
  export * from '../const/trading';
12
12
  export * from '../const/gmx';
13
+ export * from '../const/derive';
13
14
  export * from '../const/storage';
@@ -17,7 +17,13 @@ export declare const useSetTradingType: () => (payload: import("../../types").Tr
17
17
  export declare const useUpdateTradingModal: () => (payload: Partial<import("../../types").TradingPanelStateModal>) => void;
18
18
  export declare const useUpdatePoolFallbackData: () => (payload: import("../../types").PoolFallbackData) => void;
19
19
  export declare const useOnTransactionError: () => ((error: Error, action: import("../../types").TransactionAction | undefined, chainId?: number | undefined, txHash?: `0x${string}` | undefined) => void) | undefined;
20
- export declare const useOnTradingSettleError: () => ((error: Error) => void) | undefined;
20
+ export declare const useOnTradingSettleError: () => ((error: Error, variables?: {
21
+ address?: `0x${string}` | undefined;
22
+ functionName?: string | undefined;
23
+ args?: readonly unknown[] | undefined;
24
+ value?: bigint | undefined;
25
+ chainId?: number | undefined;
26
+ } | undefined) => void) | undefined;
21
27
  export declare const useOnTransactionSuccess: () => ((data: import("viem").TransactionReceipt, action: import("../../types").TransactionAction | undefined, link?: string | undefined) => void) | undefined;
22
28
  export declare const useOnTransactionEstimationError: () => ((error: import("../../models").EstimationError, address: `0x${string}`, chainId: number, account?: `0x${string}` | undefined) => void) | undefined;
23
29
  export declare const useOnTokenSelector: () => ((payload: import("../../types").TokenSelectorPayload) => void) | undefined;
@@ -30,3 +36,4 @@ export declare const useGetSwapQuotes: () => ({ signal, variables, }: {
30
36
  export declare const useUpdatePoolConfig: () => (payload: Record<`0x${string}`, Pick<import("../../types").PoolConfig, "maintenance" | "maintenanceDeposits" | "maintenanceWithdrawals" | "depositCapacity">>) => void;
31
37
  export declare const useAddPoolConfig: () => (payload: import("../../types").PoolConfig) => void;
32
38
  export declare const useUpdateCustomDepositTokensPerChain: () => (payload: Record<number, import("@shared/types").TradingToken[]>) => void;
39
+ export declare const useSetSwapQuoteRefreshTriggered: () => (payload: "deposit" | "withdraw" | null) => void;
@@ -1,4 +1,4 @@
1
- export { useSetTradingType, useUpdateTradingModal, useUpdateSendTokenInput, useSetPoolAddress, useUpdateReceiveTokenInput, useUpdateTradingSettings, useOnTransactionError, useOnTransactionSuccess, useOnTransactionEstimationError, useOnTokenSelector, useTradingPanelLogger, useOnSimulateTransaction, useUpdatePoolFallbackData, useOnTradingSettleError, useUpdatePoolConfig, useAddPoolConfig, useUpdateCustomDepositTokensPerChain, useGetSwapQuotes, } from '../../hooks/state/action';
1
+ export { useSetTradingType, useUpdateTradingModal, useUpdateSendTokenInput, useSetPoolAddress, useUpdateReceiveTokenInput, useUpdateTradingSettings, useOnTransactionError, useOnTransactionSuccess, useOnTransactionEstimationError, useOnTokenSelector, useTradingPanelLogger, useOnSimulateTransaction, useUpdatePoolFallbackData, useOnTradingSettleError, useUpdatePoolConfig, useAddPoolConfig, useUpdateCustomDepositTokensPerChain, useGetSwapQuotes, useSetSwapQuoteRefreshTriggered, } from '../../hooks/state/action';
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';
@@ -35,6 +35,7 @@ export interface TradingPanelState {
35
35
  selectedAggregators: string[];
36
36
  isBatchTransactionsEnabled: boolean;
37
37
  };
38
+ swapQuoteRefreshTriggered: 'deposit' | 'withdraw' | null;
38
39
  type: TradingPanelType;
39
40
  input: {
40
41
  sendToken: DynamicTradingToken;
@@ -62,6 +63,7 @@ export interface TradingPanelSetters {
62
63
  updatePoolConfig: (payload: Record<PoolConfig['address'], Pick<PoolConfig, 'maintenance' | 'maintenanceDeposits' | 'maintenanceWithdrawals' | 'depositCapacity'>>) => void;
63
64
  addPoolConfig: (payload: PoolConfig) => void;
64
65
  updateCustomDepositTokensPerChain: (payload: Record<ChainId, TradingToken[]>) => void;
66
+ setSwapQuoteRefreshTriggered: (payload: TradingPanelState['swapQuoteRefreshTriggered']) => void;
65
67
  }
66
68
  export interface CallbackConfig {
67
69
  onSetPoolAddress: TradingPanelSetters['setPoolAddress'];
@@ -71,7 +73,13 @@ export interface CallbackConfig {
71
73
  onSetTradingType: TradingPanelSetters['setTradingType'];
72
74
  onUpdateTradingModal: TradingPanelSetters['updateTradingModal'];
73
75
  onUpdateTransactions: TradingPanelSetters['updateTransactions'];
74
- onTradingSettleError: (error: Error) => void;
76
+ onTradingSettleError: (error: Error, variables?: {
77
+ address?: Address;
78
+ functionName?: string;
79
+ args?: readonly unknown[];
80
+ value?: bigint;
81
+ chainId?: ChainId;
82
+ }) => void;
75
83
  onTransactionError: (error: Error, action: TransactionAction | undefined, chainId?: ChainId, txHash?: Address) => void;
76
84
  onTransactionSuccess: (data: WaitForTransactionReceiptReturnType, action: TransactionAction | undefined, link?: string) => void;
77
85
  onTransactionEstimationError: (error: EstimationError, address: Address, chainId: ChainId, account?: Address) => void;
@@ -119,6 +127,9 @@ export type TradingPanelAction = {
119
127
  } | {
120
128
  type: 'UPDATE_CUSTOM_DEPOSIT_TOKENS_PER_CHAIN';
121
129
  payload: Record<ChainId, TradingToken[]>;
130
+ } | {
131
+ type: 'SET_SWAP_QUOTE_REFRESH_TRIGGERED';
132
+ payload: TradingPanelState['swapQuoteRefreshTriggered'];
122
133
  };
123
134
  export interface TradingPanelContextConfig {
124
135
  actions: Partial<CallbackConfig> & Pick<CallbackConfig, 'getSwapQuotes'>;
@@ -0,0 +1,7 @@
1
+ const e = /* @__PURE__ */ new Set([
2
+ "0x2fbadd08ade2e8a24cf1fe3a58fe918336b39a72"
3
+ // BTCCOVCALL (Arbitrum)
4
+ ]);
5
+ export {
6
+ e as C
7
+ };
@@ -0,0 +1 @@
1
+ "use strict";const E=new Set(["0x2fbadd08ade2e8a24cf1fe3a58fe918336b39a72"]);exports.COVERED_CALL_VAULT_ADDRESSES=E;