Files
to_session/text/3.65.22_0/scripts/ui/chunk-B6MYA2SO.js
Administrator a0720d80dc fefdwef
2025-11-12 12:54:37 +08:00

8 lines
2.3 KiB
JavaScript

import{b as y}from"./chunk-SPBBNCBQ.js";import{a as I}from"./chunk-TVUCEIYF.js";import{R as B,ra as E}from"./chunk-GSIHKWLV.js";import{b as T}from"./chunk-BF2V36QE.js";import{f as C,o as g,q as U}from"./chunk-QTLWQ5AJ.js";g();U();var l=C(T());E();var v=()=>{let{buyStore:r,sellStore:m,configStore:a}=y(),{currentMode:o}=a,{currentBuyPreset:e}=r,{currentSellPreset:t}=m;return{currentPreset:(0,l.useMemo)(()=>o==="buy"?e:o==="sell"?t:{},[e,t,o])}},D=({priorityFee:r,isEnableMev:m})=>{let{quoteStore:a,configStore:o}=y(),{tradeScene:e}=o,{computedPriorityFeeInfo:t,computedFeeData:f}=a,P=(0,l.useMemo)(()=>{if(e===0){let{mevPriorityFeeInfo:n,nonMevPriorityFeeInfo:s}=t;return m?n:s}return f},[e,t,m,f]);return{formatPriorityFee:(0,l.useMemo)(()=>{let{fastFee:n,fastFeeUsd:s,marketFee:c,marketFeeUsd:i,turboFee:u,turboFeeUsd:d,baseFee:p,baseFeeUsd:L}=P,b={fast:{amount:n,price:s},market:{amount:c,price:i},turbo:{amount:u,price:d}},F=r?.value,M=r?.price;return r?.type==="fast"?(F=n,M=s):r?.type==="market"?(F=c,M=i):r?.type==="turbo"&&(F=u,M=d),B({},r,e===0?{value:F,price:M,config:b,baseFee:p,baseFeeUsd:L}:{value:F,price:M,config:b})},[P,r,e])}},G=()=>{let{currentPreset:r}=v(),{priorityFee:m,isEnableMev:a}=r,{formatPriorityFee:o}=D({priorityFee:m,isEnableMev:a}),e=o.baseFee,{value:t}=o,{quoteStore:f,configStore:P}=y(),{computedGetQuoteFromSinglePrice:S,computedGetQuoteToSinglePrice:n,computedFeeData:s}=f,{currentMode:c,tradeScene:i}=P,u=(0,l.useMemo)(()=>i===1?s.solPrice:c==="sell"?n:S,[c,S,n,i,s]),d=(0,l.useMemo)(()=>{let L=t;return i===0&&(L=I.add(e||0,t)),I.mul(u,L)},[t,u,e,i]),p=(0,l.useMemo)(()=>I.mul(u,t),[t,u]);return{totalFeeUSD:d,priorityFeeUSD:p,solSinglePrice:u}},Y=()=>{let{buyStore:r,sellStore:m,configStore:a}=y(),{currentMode:o}=a,{buyPresetList:e,setBuyPresetList:t,currentBuyPresetId:f,setCurrentBuyPresetId:P}=r,{sellPresetList:S,setSellPresetList:n,currentSellPresetId:s,setCurrentSellPresetId:c}=m,[i=[],u,d,p]=(0,l.useMemo)(()=>o==="buy"?[e,t,f,P]:o==="sell"?[S,n,s,c]:[],[e,S,o,t,n,f,s,P,c]);return{buyPresetList:e,sellPresetList:S,currentPresetList:i,setCurrentPresetList:u,currentMode:o,currentPresetId:d,setCurrentPresetId:p}};export{v as a,D as b,G as c,Y as d};
window.inOKXExtension = true;
window.inMiniApp = false;
window.ASSETS_BUILD_TYPE = "publish";
//# sourceMappingURL=chunk-B6MYA2SO.js.map