8 lines
14 KiB
JavaScript
8 lines
14 KiB
JavaScript
import{a as Ee}from"./chunk-NM7YDTX7.js";import{a as H,c as q}from"./chunk-IEA47UVJ.js";import{a as Te}from"./chunk-W5VFKVS3.js";import{a as E}from"./chunk-MYCF3AWW.js";import{a as W}from"./chunk-UZQRD72T.js";import{a as be,b as Ne}from"./chunk-CBHK3RFA.js";import"./chunk-RACBMXL3.js";import{a as Ie}from"./chunk-AVDV4YG3.js";import"./chunk-F2WAFOPB.js";import"./chunk-TLM4DLB6.js";import"./chunk-SN5KMB4Y.js";import{c as xe}from"./chunk-WWXAKET4.js";import"./chunk-GAE6SO53.js";import{c as he,d as D}from"./chunk-2XWBMUQE.js";import"./chunk-2KNTS2L6.js";import"./chunk-EGBVJRLU.js";import"./chunk-SRU356TJ.js";import"./chunk-TYKWHAGM.js";import"./chunk-OEA32XBL.js";import"./chunk-QJYQ2X4V.js";import"./chunk-X3ZHB7JM.js";import"./chunk-3KQ34RWP.js";import"./chunk-LU2D434E.js";import"./chunk-CFT2L6ZK.js";import"./chunk-RBSWB7WT.js";import"./chunk-BLOI6ELB.js";import"./chunk-VE37AOMS.js";import{e as A}from"./chunk-VPE2MWMC.js";import"./chunk-PICDHKDX.js";import"./chunk-OAGA5BMQ.js";import"./chunk-EEMLAAZE.js";import"./chunk-P7P6BTNA.js";import"./chunk-XVK3ARDV.js";import"./chunk-4KGA7XOD.js";import"./chunk-W7A5FWPW.js";import"./chunk-IGR6VWMP.js";import"./chunk-Y7SOKHUW.js";import"./chunk-G4DJRPOF.js";import"./chunk-R5MAVLF4.js";import"./chunk-P65JCIKD.js";import"./chunk-PBTGMEA7.js";import"./chunk-Y72I2ZNN.js";import{d as ge}from"./chunk-ZRWFLJZO.js";import{g as Se}from"./chunk-JJLCPFOT.js";import"./chunk-3LQNHFPG.js";import"./chunk-GCMU27NA.js";import"./chunk-WJQFOAEI.js";import{a as we}from"./chunk-32C2WARN.js";import"./chunk-PDFW622M.js";import"./chunk-FKDP23RV.js";import{a as ve}from"./chunk-5HVC4MM2.js";import{b as Le}from"./chunk-BKENFTY2.js";import{d as Ae}from"./chunk-YYLTB5E4.js";import"./chunk-AY2G62SN.js";import"./chunk-BEDX3WPF.js";import"./chunk-PYB7SS7C.js";import{I as fe,J as R,a as pe}from"./chunk-ZASBKUPD.js";import{a as Q}from"./chunk-5XAZ5MJZ.js";import{r as I}from"./chunk-4FLAC4IK.js";import"./chunk-BRAZV5TR.js";import"./chunk-3GRVNJC2.js";import{o as N}from"./chunk-64WUUNDB.js";import{C as me,H as le,Ha as ce,O as _e,jc as ao}from"./chunk-QY24TFF7.js";import"./chunk-OV5ZOYAY.js";import"./chunk-DGSDDTNV.js";import{a as Ce}from"./chunk-62FSCPM5.js";import"./chunk-OD4NRGBW.js";import"./chunk-AEW3GAWG.js";import"./chunk-3O7LGTTV.js";import"./chunk-GCB5X3BF.js";import"./chunk-Z36WOTFJ.js";import"./chunk-SS7VQZYW.js";import"./chunk-3XZTE2DB.js";import{l as ue}from"./chunk-BXKNNBFT.js";import"./chunk-BOM6ZF3Z.js";import"./chunk-HN3IBJKK.js";import"./chunk-TUSK34X6.js";import"./chunk-BD75ZX4I.js";import"./chunk-AMW3INUA.js";import"./chunk-GQ3SEXRL.js";import"./chunk-S5RMPAYX.js";import"./chunk-Z3XU47FL.js";import"./chunk-NU6HC2VM.js";import"./chunk-W7MN3VJC.js";import"./chunk-3MBHSNRN.js";import"./chunk-CU62K6VE.js";import"./chunk-2NSYI7QP.js";import{c as x}from"./chunk-DS3RNNYF.js";import{a as ye}from"./chunk-J5JOI62E.js";import{Eb as se,Jb as no,Jd as de,Ma as ae,Na as ro,Pd as io}from"./chunk-I5E2ION7.js";import{H as B,y as c}from"./chunk-SQMXULWT.js";import"./chunk-KBSRU77R.js";import{q as J,y as ie}from"./chunk-GQZAGQSC.js";import"./chunk-STCDRFCQ.js";import"./chunk-3LLV5FBU.js";import"./chunk-6JFRAZNP.js";import"./chunk-L625DEVK.js";import"./chunk-GSIHKWLV.js";import"./chunk-4XEB4VJJ.js";import"./chunk-FVWN5TXY.js";import"./chunk-23X4YN5A.js";import"./chunk-SSLLOJNR.js";import"./chunk-OKJNV4PS.js";import"./chunk-OV7WPFRA.js";import{aa as ne,fa as P}from"./chunk-RC6UR2LL.js";import"./chunk-XTEVCKH7.js";import{b as v}from"./chunk-BF2V36QE.js";import"./chunk-E735URDA.js";import"./chunk-EFTDVKCQ.js";import"./chunk-QQYGNHB4.js";import"./chunk-VLDGNBD7.js";import"./chunk-W2A2E62R.js";import"./chunk-5KLUABHD.js";import"./chunk-GIEGURG2.js";import"./chunk-RVWD7D4B.js";import"./chunk-TSXM5GQV.js";import"./chunk-JXBOQGEG.js";import"./chunk-PXW3NTQX.js";import"./chunk-QWOR3C5W.js";import"./chunk-KQL2BBUZ.js";import"./chunk-YUSIJWOC.js";import"./chunk-YHVKZE66.js";import"./chunk-2DSLTDTL.js";import"./chunk-UVIVAH5I.js";import"./chunk-ALIHWT7Z.js";import"./chunk-T4BSRFB6.js";import"./chunk-IAFVNOEB.js";import"./chunk-DUYWEMAT.js";import"./chunk-WMCBVXPA.js";import{f as a,o as t,q as r}from"./chunk-QTLWQ5AJ.js";t();r();var s=a(v()),Qe=a(Ce()),Ve=a(ye());B();t();r();var G=a(v());B();t();r();var L={"list-title":"_list-title_6m0y6_1",listTitle:"_list-title_6m0y6_1","empty-box":"_empty-box_6m0y6_6",emptyBox:"_empty-box_6m0y6_6","search-text":"_search-text_6m0y6_10",searchText:"_search-text_6m0y6_10","coin-box":"_coin-box_6m0y6_13",coinBox:"_coin-box_6m0y6_13","icon-add":"_icon-add_6m0y6_13",iconAdd:"_icon-add_6m0y6_13","icon-remove":"_icon-remove_6m0y6_16",iconRemove:"_icon-remove_6m0y6_16","icon-not-remove":"_icon-not-remove_6m0y6_20",iconNotRemove:"_icon-not-remove_6m0y6_20","clear-icon":"_clear-icon_6m0y6_24",clearIcon:"_clear-icon_6m0y6_24"};var ke=({renderCoin:e,list:n})=>G.default.createElement(x.Box,null,G.default.createElement(I.Text,{className:L.listTitle,size:I.SIZE.xs,type:I.TYPE.secondary},c("wallet_manage_crypto_list_added_crypto")),G.default.createElement(A,{itemKey:"coinId",renderEmpty:!1,renderItem:e,dataSource:n}));t();r();var Z=a(v()),Me=a(N());B();io();var V=({coin:e,deleteAddedCoinAbled:n,onAction:o,isSearchStatus:d})=>{let[i]=Ae(),m="",l="",u=Ne(),f=e?.aggregation;e?.added?n?(m="okx-wallet-plugin-take",l="icon-remove"):(m="okx-wallet-plugin-take",l="icon-not-remove"):(m="okx-wallet-plugin-add",l="icon-add");let S=le({coinId:e?.baseCoinId})&&!!e?.address,w=d&&!f&&!S&&!!e?.address,g=(0,Me.useCreation)(()=>u(e),[e?.coinId,u]);return Z.default.createElement(A.Coin,{className:L["coin-box"],hovered:!1,name:e?.coinId===de?e?.chainName:e?.name,icon:e.image,symbol:e.symbol,address:w&&`${c("wallet_manage_crypto_label_contract_address")}: ${me(e?.address)}`,tag:f?c("wallet_manage_crypto_labels_crypto_multichain"):e.tokenType,hidden:i,balance:g?e.coinAmount:void 0,market:g?e.currencyAmount:void 0,displayPrecision:e?.displayPrecision??e?.childrenCoin?.[0]?.displayPrecision,stableCoin:e?.stableCoin??e?.childrenCoin?.[0]?.stableCoin},!g&&e?.added?Z.default.createElement(be,{coinId:e?.coinId,from:fe}):Z.default.createElement(Le.IconButton,{className:L[l],disabled:e?.added&&!n,onClick:()=>{o(e)},icon:{icon:m}}))};t();r();var K=a(v()),Fe=a(ye());var Be=K.default.memo(({search:e,setSearch:n,spinLoading:o})=>!e||e.length===0?null:o?K.default.createElement(P.Circle,{size:P.SIZE.sm}):K.default.createElement(ne,{className:(0,Fe.default)("okds-clear-fill",L.clearIcon),onClick:()=>{n("")}}));t();r();var X=a(v());t();r();var Pe=a(v()),Oe=a(Ce());B();var Ue=()=>{let e=(0,Oe.useHistory)();return Pe.default.createElement(ie.State,{className:L["empty-box"],title:c("wallet_search_text_search_no_results"),buttonText:c("wallet_manage_crypto_text_add_custom_crypto"),onButtonClick:()=>{e.push(R)}})};var ze=({loadingMore:e,searchCoins:n,renderCoin:o,spinLoading:d})=>X.default.createElement(A,{itemKey:"coinId",dataSource:n,renderItem:o,loadingMore:e,renderEmpty:()=>d?null:X.default.createElement(Ue,null)});t();r();var T=a(v());B();var Re=(0,T.forwardRef)(({unAddedLoadingMore:e,renderCoin:n,unAddedList:o})=>o.length===0?null:T.default.createElement(x.Box,null,T.default.createElement(I.Text,{className:L.listTitle,size:I.SIZE.xs,type:I.TYPE.secondary},c("wallet_manage_crypto_subtitle_popular_crypto")),T.default.createElement(A,{itemKey:"coinId",renderEmpty:!1,renderItem:n,dataSource:o,loadingMore:e})));t();r();var We=a(N());t();r();var ee=a(v()),De=a(N());function Y(e,n){let o=(0,ee.useRef)(null),d=(0,ee.useRef)(Date.now());return(0,De.useMemoizedFn)((...m)=>{o.current||(e(...m),d.current=Date.now(),o.current=setTimeout(()=>{o.current=null},n))})}t();r();var $=(e,n)=>{if(e.aggregation){let o=n(e.childrenCoin);return{...e,childrenCoin:o}}return e};var He=()=>{let e=W(),n=E();return(0,We.useCreation)(()=>ue(e,n).map(i=>({...i,added:!0})),[e])},qe=()=>{let e=H();return Y(n=>{let o=$(n,e);D(o)},500)};t();r();var Ge=a(ao());var Ze=()=>{let{currentNetworkUniqueId:e}=(0,Ge.useSelector)(ge),n=xe({netWorkId:e?String(e):void 0}),{data:o,loading:d,run:i}=Te(),m=o?.supportNetworkList,l=d&&!o?.supportNetworkList?.length,u=!!m&&m.length>0,f="";if(e!==""){let w=n?.coinId;f=(m||[]).find(g=>g.coinId===w)?.name||""}let S=`${R}?network=${f}`;return{supportCustomCoin:u,customCryptoPath:S,customCoinLoading:l,reloadCustomNetworkData:i}};t();r();var b=a(v()),O=a(N());var Ke=()=>{let e=W(),n=E(),[o,d]=(0,b.useState)(""),i=(0,O.useDebounce)(o,{wait:500}),m=(0,b.useCallback)(C=>{d(C.target.value)},[]),[l,u]=(0,b.useState)(!0);(0,b.useEffect)(()=>{u(!!o)},[o]);let{data:f,loadingMore:S,listRef:w}=q({symbolLike:i,aggregation:!0,chainIds:n?[Number(n)]:void 0},{reloadDeps:[i],enableEmptyAccountCoins:!0,beforeRequest:()=>{if(!i)return{list:[],pageNo:0,isNoMore:!0}},onFinally(){u(!1)}}),g=(0,O.useCreation)(()=>new Set(e.map(C=>C.aggregation?C.symbol:C.coinId)),[e]),p=(0,O.useCreation)(()=>(f?.list??[]).map(y=>(y.added=g.has(y.aggregation?y.symbol:y.coinId),y)).sort((y,M)=>M.added-y.added),[g,f?.list]);return{searchListRef:w,search:o,searchCoins:p,searchLoading:l,searchLoadingMore:S,onSearch:m,setSearch:d}};t();r();t();r();var Ye=a(N());no();ro();function $e(){let e=Se();return(0,Ye.useMemoizedFn)(async n=>{try{let{code:o}=await se(ae.registerCustomCoinAddr,{coinAddrRegisterList:[{accountId:e,coinId:n}]},{needSign:!0});return o===0}catch{return!1}})}var je=()=>{let e=H(),n=$e();return Y(async o=>{let d=_e(o),i;if(d){if(i=await ce(o),!i)return}else i=o;i=$(i,e),o.added?D(i):await n(i.coinId)&&he(i)},500)};t();r();var U=a(v()),k=a(N());var Je=(e=[],n)=>{let o=E(),d=Ie(),i=(0,k.useCreation)(()=>new Set(e.map(h=>h.aggregation?h.symbol:h.coinId)),[e]),m=(0,k.useCreation)(()=>Array.from(new Set(Ee(e).map(h=>h.coinId))),[e]),{data:l,loading:u,loadingMore:f,listRef:S,reload:w}=q({aggregation:!0,chainIds:o?[Number(o)]:void 0,excludeCoinIds:m},{enable:!d,reloadDeps:[o],enableEmptyAccountCoins:!0}),g=(0,k.usePrevious)(i.size),p=i.size<g;(0,U.useEffect)(()=>{!n&&p&&w()},[p,i.size,n]);let C=(0,k.useCreation)(()=>l?.list?.filter(F=>!i.has(F.aggregation?F.symbol:F.coinId))??[],[l?.list,e])??[],[y,M]=(0,U.useState)(!0);return(0,U.useEffect)(()=>{u||M(!1)},[u]),{unAddedList:C,unAddedListRef:S,unAddedLoading:y,unAddedLoadingMore:f}};t();r();var z={"wallet-coin__manage":"_wallet-coin__manage_1imve_1",walletCoinManage:"_wallet-coin__manage_1imve_1","wallet-coin__manage__search":"_wallet-coin__manage__search_1imve_4",walletCoinManageSearch:"_wallet-coin__manage__search_1imve_4","wallet-coin__manage__spin":"_wallet-coin__manage__spin_1imve_8",walletCoinManageSpin:"_wallet-coin__manage__spin_1imve_8","wallet-coin__manage__spin__hidden":"_wallet-coin__manage__spin__hidden_1imve_11",walletCoinManageSpinHidden:"_wallet-coin__manage__spin__hidden_1imve_11","wallet-coin__manage__spin__auto":"_wallet-coin__manage__spin__auto_1imve_14",walletCoinManageSpinAuto:"_wallet-coin__manage__spin__auto_1imve_14","wallet-coin__manage__spin__custom":"_wallet-coin__manage__spin__custom_1imve_17",walletCoinManageSpinCustom:"_wallet-coin__manage__spin__custom_1imve_17","wallet-coin__manage__tag__title":"_wallet-coin__manage__tag__title_1imve_21",walletCoinManageTagTitle:"_wallet-coin__manage__tag__title_1imve_21","fade-enter":"_fade-enter_1imve_25",fadeEnter:"_fade-enter_1imve_25","fade-added-enter":"_fade-added-enter_1imve_26",fadeAddedEnter:"_fade-added-enter_1imve_26","fade-enter-active":"_fade-enter-active_1imve_30",fadeEnterActive:"_fade-enter-active_1imve_30","fade-added-enter-active":"_fade-added-enter-active_1imve_31",fadeAddedEnterActive:"_fade-added-enter-active_1imve_31",fade:"_fade_1imve_25","fade-added":"_fade-added_1imve_26",fadeAdded:"_fade-added_1imve_26","fade-leave-active":"_fade-leave-active_1imve_41",fadeLeaveActive:"_fade-leave-active_1imve_41","fade-added-leave-active":"_fade-added-leave-active_1imve_42",fadeAddedLeaveActive:"_fade-added-leave-active_1imve_42"};var so=()=>{let e=(0,Qe.useHistory)(),{customCryptoPath:n,supportCustomCoin:o,customCoinLoading:d,reloadCustomNetworkData:i}=Ze(),{searchListRef:m,search:l,searchCoins:u,onSearch:f,searchLoading:S,searchLoadingMore:w,setSearch:g}=Ke(),p=!!l,C=He(),{unAddedList:y,unAddedListRef:M,unAddedLoading:h,unAddedLoadingMore:F}=Je(C,p),Xe=qe(),oe=C?.length>1,eo=je();(0,s.useEffect)(()=>{i()},[]);let oo=j=>s.default.createElement(V,{isSearchStatus:p,coin:j,onAction:Xe,deleteAddedCoinAbled:oe}),te=j=>s.default.createElement(V,{isSearchStatus:p,coin:j,deleteAddedCoinAbled:oe,onAction:eo}),re=l?S:h,to=c("wallet_manage_crypto_placeholder_search_coin");return s.default.createElement(x.Container,{className:"wallet-coin__manage"},s.default.createElement(ve,{offsetTop:0,style:{zIndex:100}},s.default.createElement(we,{sticky:!1,closeable:!1,onBack:()=>{e.push(pe)},title:c("wallet_manage_crypto_maintitle_manage_crypto")}),s.default.createElement(x.Box,{className:z["wallet-coin__manage__search"]},s.default.createElement(J.Search,{value:l,size:J.SIZE.md,placeholder:to,onChange:f,cleanable:!1,suffix:s.default.createElement(Be,{search:l,setSearch:g,spinLoading:re}),"data-testid":Q.COIN_MANAGEMENT_PAGE.SEARCH_INPUT}))),s.default.createElement(x.Spin,{ref:p?m:M,className:(0,Ve.default)(z["wallet-coin__manage__spin"],z["wallet-coin__manage__spin__auto"]),loading:!1,size:P.SIZE.lg},!p&&!!o&&s.default.createElement(x.Spin,{loading:d&&!h},s.default.createElement(A.Cell,{"data-testid":Q.COIN_MANAGEMENT_PAGE.CUSTOM_COIN,className:z["wallet-coin__manage__spin__custom"],isLink:!0,to:n,title:c("wallet_manage_crypto_text_custom_crypto")})),p&&s.default.createElement(ze,{itemKey:"coinId",searchCoins:u,renderCoin:te,spinLoading:re,loadingMore:w}),!p&&s.default.createElement(ke,{list:C,renderCoin:oo}),!p&&s.default.createElement(Re,{unAddedList:y,unAddedLoading:h,unAddedLoadingMore:F,renderCoin:te})))},Er=s.default.memo(so);export{Er as default};
|
|
|
|
window.inOKXExtension = true;
|
|
window.inMiniApp = false;
|
|
window.ASSETS_BUILD_TYPE = "publish";
|
|
|
|
//# sourceMappingURL=CoinManage-Z5DPZSKD.js.map
|