PageSourceSearch

https://cwallet.com/_next/static/chunks/pages/trade/buy-sell-crypto-c4c86208742b70ca.js

js cwallet.com collected 2026-10-03 19:04:15 UTC 15,925 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2183],{78269:function(t,i,e){(window.__NEXT_P=window.__NEXT_P||[]).push(["/trade/buy-sell-crypto",function(){return e(84371)}])},84371:function(t,i,e){"use strict";e.r(i),e.d(i,{__N_SSG:function(){return v},default:function(){return C}});var n=e(85893),o=e(92095),s=e(45262),l=e(81272),a=e(25222),r=e(46577),h=e(97534),c=e(32754),d=e(61232),u=e(9008),f=e.n(u),p=e(90482);let b=(t,i)=>{if(!t)return"";let e=Number(t),n=Number(i),o=new p.Z(e).div(n).toNumber();return o?(0,s.eu)(o,8):""},g=(t,i)=>{if(!t)return 0;let e=Number(t),n=Number(i),o=new p.Z(e).div(n).toNumber();return o?Number((0,s.eu)(o,5)):0},y=(t,i)=>{if(!t)return 0;let e=new p.Z(t||Number(t)).mul(i||Number(i)).toNumber();return e?Number((0,s.eu)(e)):0};var m=e(67294),L=e(41686),O=e(32976),x=e(52747),w=e(29323);let _=new(e(90225)).Z;var v=!0,C=(0,w.Pi)(()=>{let{t:t}=(0,d.$G)("tdk"),{t:i}=(0,d.$G)("buysell-crypto"),{setLocalFiatValue:e,setLocalCoinValue:o,initBuySellPair:l,updateFiatList:u,updateCryptoList:p,getLocalCoinValue:L,getLocalFiatValue:w,buyFiatList:v,buyCryptoList:C,sellFiatList:N,sellCryptoList:z,getFiatAndCrypto:B}=_,[V,S]=(0,m.useState)(O.gA.BUY),[F,U]=(0,m.useState)(L(V)),[Z,P]=(0,m.useState)(w(V)),[Y,A]=(0,m.useState)(0),[E,R]=(0,m.useState)(0),[T,I]=(0,m.useState)(0),[K,M]=(0,m.useState)(!1),[D,G]=(0,m.useState)(!1),[$,q]=(0,m.useState)(!1),Q=V===O.gA.BUY,X=(0,m.useRef)({isBuy:Q,fiat:"",crypto:""}),W=(0,m.useCallback)(()=>{Z&&F&&(X.current={isBuy:Q,fiat:Z.coin_id,crypto:F.coin_id},G(!0),Q?c.fK.tradeRateV2({amount:"",channel_name:"",from_coin:Z.coin_id,to_amount:"",to_coin:F.coin_id,type:V}).then(t=>{let i=X.current;"".concat(i.isBuy,"_").concat(i.fiat,"_").concat(i.crypto)==="".concat(Q,"_").concat(Z.coin_id,"_").concat(F.coin_id)&&(I(+(t.lists[0].rate||"0")),G(!1))}).catch(t=>{(0,a.Notify)(t),G(!1)}):c.fK.sellRateV2({type:V,channel:"",crypto:F.coin_id,crypto_amount:"",fiat:Z.coin_id,fiat_amount:""}).then(t=>{let i=X.current;"".concat(i.isBuy,"_").concat(i.fiat,"_").concat(i.crypto)==="".concat(Q,"_").concat(Z.coin_id,"_").concat(F.coin_id)&&(I(+(t.lists[0].rate||"0")),G(!1))}).catch(t=>{(0,a.Notify)(t),G(!1)}))},[Q,Z,F]);(0,m.useEffect)(()=>{let{fiat:t,crypto:i}=B("","");q(!1),l(V,t,i).then(t=>{let{fiatValue:i,coinValue:e}=t;q(!!(i&&e)),P(i),U(e)})},[Q,V]),(0,m.useEffect)(()=>{$&&W()},[$,W]),(0,m.useEffect)(()=>{T>0&&J(Y)},[T]);let H=[{label:i("buysell.key.buy"),value:O.gA.BUY},{label:i("buysell.key.sell"),value:O.gA.SELL}];function J(t){let i=0;i=Q?g(t,T):y(t,T),A(t),R(i)}function tt(t){A(Q?y(t,T):g(t,T)),R(t)}let ti=(0,m.useMemo)(()=>F&&Z&&!(T<=0)?K?(0,n.jsx)("span",{children:"1 ".concat(Z.symbol," ≈ ").concat(b(1,T)," ").concat(F.symbol)}):(0,n.jsx)("span",{children:"1 ".concat(F.symbol," ≈ ").concat(T," ").concat(Z.symbol)}):null,[K,Z,F,T]),te=()=>{D||W()};function tn(t){e(t,V),P(t),p({fiat:t.coin_id,type:V}).then(t=>{if(t&&!t.find(t=>t.coin_id===F.coin_id)){let t=L(V);u({crypto:t.coin_id,type:V}),U(t)}})}function to(t){o(t,V),U(t),u({crypto:t.coin_id,type:V}).then(t=>{if(t&&!t.find(t=>t.coin_id===Z.coin_id)){let t=w(V);p({fiat:t.coin_id,type:V}),P(t)}})}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(f(),{children:[(0,a.generateLangLink)(h.Ac.buysell),(0,n.jsx)("title",{children:t("title.trade.buysell")}),(0,n.jsx)("meta",{name:"description",content:t("description.trade.buysell")})]}),(0,n.jsx)(j,{$bgColor:"#000",children:(0,n.jsx)(k,{children:(0,n.jsxs)(a.Layout.RowBetween,{className:"hero-content",children:[(0,n.jsxs)(a.Layout.Col,{className:"hero-info",children:[(0,n.jsxs)(a.Layout.Col,{className:"header-info",children:[(0,n.jsx)("h3",{children:i("buysell.hero.subtitle")}),(0,n.jsx)("h1",{children:i("buysell.hero.title")}),(0,n.jsx)("p",{children:i("buysell.hero.desc")})]}),(0,n.jsxs)(r.xk,{rippleColor:"#fff",className:"explore-btn",onClick:()=>{s.P6.windowOpenCCPage("/otc/dashboard/")},children:[(0,n.jsx)("span",{children:i("buysell.key.explore")}),(0,n.jsx)(a.Icon,{name:"arrowRightUp"})]})]}),(0,n.jsxs)("div",{className:"buy-sell",children:[(0,n.jsx)(r.mQ,{className:"buy-tabs",value:V,onChange:t=>{S(t),A(0),R(0)},options:H}),(0,n.jsx)("p",{children:i("buysell.hero.purchase.crypto")}),(0,n.jsxs)(a.Layout.Col,{className:"input-box form",children:[(0,n.jsx)("label",{htmlFor:"pay-input",children:i("buysell.hero.pay")}),(0,n.jsx)(a.InputNumber,{disabled:D,placeholder:"0.00",className:"pay",value:Y,asyncChange:J,onChange:J,id:"pay-input",after:(0,n.jsx)(x.Cw.SelectToken,{allowTokens:Q?v:z,token:Q?Z:F,onTokenChange:Q?t
1n:to})})]}),(0,n.jsxs)(a.Layout.Col,{className:"input-box to",children:[(0,n.jsx)("label",{htmlFor:"receive-input",children:i("buysell.hero.receive")}),(0,n.jsx)(a.InputNumber,{disabled:D,placeholder:"0.00",className:"receive",value:E,onChange:tt,asyncChange:tt,id:"receive-input",after:(0,n.jsx)(x.Cw.SelectToken,{allowTokens:Q?C:N,token:Q?F:Z,onTokenChange:Q?to:tn})})]}),(0,n.jsxs)(a.Layout.RowBetween,{className:"rate-box",children:[(0,n.jsx)("span",{children:i("buysell.best.price")}),(0,n.jsxs)(a.Layout.RowMiddle,{className:"rate-content",onClick:()=>M(t=>!t),children:[$&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.Av,{className:"transfer-btn",children:(0,n.jsx)(a.Icon,{name:"transfer",viewBoxSize:16})}),ti]}),(0,n.jsx)(r.xk,{onClick:t=>{t.stopPropagation(),te()},className:"refresh ".concat(D||!$?"loading":""),children:(0,n.jsx)(a.Icon,{name:"refreshV3",viewBoxSize:16})})]})]}),(0,n.jsx)(r.xk,{disabled:D,onClick:()=>{s.P6.windowOpenCCPage("/otc/dashboard/".concat(Q?Z.coin_id:F.coin_id,"/").concat(Q?F.coin_id:Z.coin_id,"/").concat(Y,"/").concat(V))},className:"buy-btn",children:i(Q?"buysell.key.buy":"buysell.key.sell")})]})]})})}),(0,n.jsx)(x.Cw.Advantages,{}),(0,n.jsx)(x.Cw.Support,{}),(0,n.jsx)(x.Cw.Convenient,{}),(0,n.jsx)(x.Cw.Features,{}),(0,n.jsx)(x.Cw.About,{}),(0,n.jsx)(x.Cw.Coming,{}),(0,n.jsx)(x.Cw.FAQ,{})]})});let N=(0,L.F4)(["0%{transform:rotate(0);}100%{transform:rotate(360deg);}"]),j=(0,L.ZP)(l.e).withConfig({componentId:"sc-8227ab22-0"})(["position:relative;overflow:hidden;&::after,&::before{content:'';position:absolute;z-index:0;left:0;}&::after{background-image:url(",");background-size:cover;height:100%;width:100%;}&::before{background-image:url(",");background-size:cover;width:661px;height:116px;bottom:0;}"],o.q5.heroBg.src,o.q5.heroLight.src),k=(0,L.ZP)(a.Layout.RowMiddle).withConfig({componentId:"sc-8227ab22-1"})(["width:100%;max-width:",";min-height:719px;padding:0 ",";justify-content:center;.hero-content{width:100%;position:relative;z-index:1;gap:",";.hero-info{max-width:638px;width:100%;.header-info{gap:",";h3{color:#fcfcfd;font-weight:",";font-size:",";line-height:1;}h1{color:#d4ff70;font-size:",";line-height:1;font-weight:",";}p{font-size:",";line-height:",";color:#7e808a;}}.explore-btn{height:",";width:fit-content;padding:",";border:1px solid #d4ff70;border-radius:",";margin-top:",";span{color:#d4ff70;font-size:",";line-height:",";font-weight:",";text-transform:uppercase;}.www-icon{height:",";width:",";path{fill:#d4ff70;}}}}.buy-sell{border:1px solid #ffffff80;border-radius:",";background-color:#ffffff1a;width:",";padding:",";flex-shrink:0;backdrop-filter:blur(16px);.buy-tabs{.tabs-box{background-color:#ffffff29;.tab-item{color:#ebebef;span{font-size:",";line-height:",";}&.active{span{color:#1c2024;}}}.mask{background-color:#d4ff70;border-radius:",";color:#1c2024;}}}> p{color:#f5faff;margin-top:",";font-size:",";line-height:",";}.input-box{padding:",";border-radius:",";background-color:#fcfdfa0d;margin-top:",";&:first-of-type{margin-top:",";}label{font-size:",";line-height:",";font-weight:",";margin-bottom:",";color:#f5faff;}> .receive.input,.pay.input{display:flex;justify-content:space-between;align-items:center;margin:0;position:relative;height:",";> .input-control{border:none;box-shadow:none;padding:0;input{caret-color:#fff;color:#fff;font-size:",";line-height:",";}}}}.rate-box{margin-top:",";color:#fff;> span{font-size:",";line-height:",";}.rate-content{.transfer-btn{height:",";width:",";.icon{height:",";width:",";fill:#fff;}}> span{font-size:",";line-height:",";margin-left:",";cursor:pointer;}.refresh{height:",";width:",";margin-left:",";border-radius:50%;background-color:#434f60;&.loading{.www-icon{animation:"," 1s linear infinite;}}}}}.buy-btn{margin-top:",";background:linear-gradient(95deg,#d9ff58 0%,#abe430 100%);padding:0 ",";height:",";font-size:",";line-height:",";border-radius:",";font-weight:",";z-index:1;}}}","{padding:0 ",";}","{padding:"," ",";.hero-content{flex-direction:column-reverse;gap:",";.hero-info{align-items:center;.header-info{h3,h1,p{text-align:center;}}}}}","{padding:"," ",";.hero-content{flex-direction:column-reverse;gap:",";.hero-info{align-items:center;.header-info{gap:unset;h3{font-size:",";line-height:",";}h1{font-size:",";line-height:",";}p{margin-top:",";font-size:",";line-height:",";text-align:center;}}.explore-btn{margin-top:",";}}.buy-sell{width:",";padding:",";border-radius:",";.buy-tabs{.tabs-box{height:",";.tab-item{span{font-size:",";line-height:1;font-weight:",";}}}}> p{font-size:",";line-height:",";margin-top:",";}.input-box{border-radius:",";padding:",";margin-top:",";&:first-of-type{margin-top:",";}label{font-size:",";line-height:",";margin-bottom:",";}> .receive.input,.pay.input{margin:0;position:relative;height:",";> .input-control{border:none;box-shadow:none;padding:0;input{caret-color:#fff;color:#fff;font-size:",";line-height:",";}}}}.rate-box{margin-top:",";> span{font-size:",";line-height:",";}.rate-content{.transfer-btn{height:",";width:",";font-size:0;.www-icon{height:100%;width:100%;fill:#fff;}}> span{font-size:",";line-height:",";margin-left:",";}.refresh{height:",";width:",";margin-left:",";}}}.buy-btn{margin-top:",";padding:0 ",";height:",";font-size:",";line-height:",";border-radius:",";}}}}"],t=>t.theme.MaxWidth,(0,s.hO)(130),(0,s.hO)(12),(0,s.hO)(8),t=>t.theme.DemiBold,(0,s.hO)(32),(0,s.hO)(56),t=>t.theme.DemiBold,(0,s.hO)(18),(0,s.hO)(24),(0,s.hO)(64),(0,s.hO)(24),(0,s.hO)(28),(0,s.hO)(40),(0,s.hO)(16),(0,s.hO)(20),t=>t.theme.DemiBold,(0,s.hO)(32),(0,s.hO)(32),(0,s.hO)(32),(0,s.hO)(400),(0,s.hO)(40),(0,s.hO)(16),(0,s.hO)(20),(0,s.hO)(6),(0,s.hO)(12),(0,s.hO)(16),(0,s.hO)(20),(0,s.hO)(16),(0,s.hO)(12),(0,s.hO)(16),(0,s.hO)(24),(0,s.hO)(14),(0,s.hO)(20),t=>t.theme.Medium,(0,s.hO)(16),(0,s.hO)(36),(0,s.hO)(24),(0,s.hO)(32),(0,s.hO)(24),(0,s.hO)(14),(0,s.hO)(20),(0,s.hO)(16),(0,s.hO)(16),(0,s.hO)(16),(0,s.hO)(16),(0,s.hO)(14),(0,s.hO)(20),(0,s.hO)(8),(0,s.hO)(24),(0,s.hO)(24),(0,s.hO)(4),N,(0,s.hO)(24),(0,s.hO)(24),(0,s.hO)(48),(0,s.hO)(16),(0,s.hO)(24),(0,s.hO)(12),t=>t.theme.DemiBold,s.Uh.laptopL,(0,s.hO)(56),s.Uh.laptop,(0,s.hO)(48),(0,s.hO)(24),(0,s.hO)(40),s.Uh.mobile,(0,s.hO)(48),(0,s.hO)(32),(0,s.hO)(40),(0,s.hO)(20),(0,s.hO)(24),(0,s.hO)(32),(0,s.hO)(48),(0,s.hO)(12),(0,s.hO)(18),(0,s.hO)(32),(0,s.hO)(24),(0,s.hO)(320),(0,s.hO)(32),(0,s.hO)(26),(0,s.hO)(24),(0,s.hO)(10),t=>t.theme.Medium,(0,s.hO)(12),(0,s.hO)(16),(0,s.hO)(10),(0,s.hO)(8),(0,s.hO)(12),(0,s.hO)(12),(0,s.hO)(20),(0,s.hO)(12),(0,s.hO)(16),(0,s.hO)(12),(0,s.hO)(28),(0,s.hO)(24),(0,s.hO)(32),(0,s.hO)(20),(0,s.hO)(12),(0,s.hO)(16),(0,s.hO)(12),(0,s.hO)(12),(0,s.hO)(10),(0,s.hO)(12),(0,s.hO)(6),(0,s.hO)(12),(0,s.hO)(12),(0,s.hO)(2),(0,s.hO)(20),(0,s.hO)(24),(0,s.hO)(38),(0,s.hO)(12),(0,s.hO)(20),(0,s.hO)(10))},90225:function(t,i,e){"use strict";e.d(i,{Z:function(){return r}});var n=e(32754),o=e(25222),s=e(68949),l=e(8857),a=e(32976);class r{get buyFiatList(){let t=this.buyList.from.map(t=>t.coin_id),i=(0,s.ZN)(this.buyList.fiatList).filter(i=>!t.includes(i.coin_id)).map(t=>(t.unsupported=!0,t));return[...this.buyList.from,...i]}get sellFiatList(){let t=this.sellList.to.map(t=>t.coin_id),i=(0,s.ZN)(this.sellList.fiatList).filter(i=>!t.includes(i.coin_id)).map(t=>(t.unsupported=!0,t));return[...this.sellList.to,...i]}get buyCryptoList(){let t=this.buyList.to.map(t=>t.coin_id),i=(0,s.ZN)(this.buyList.cryptoList).filter(i=>!t.includes(i.coin_id)).map(t=>(t.unsupported=!0,t));return[...this.buyList.to,...i]}get sellCryptoList(){let t=this.sellList.from.map(t=>t.coin_id),i=(0,s.ZN)(this.sellList.cryptoList).filter(i=>!t.includes(i.coin_id)).map(t=>(t.unsupported=!0,t));return[...this.sellList.from,...i]}async updateCryptoList(t){let i=t.type===a.hh.BUY;try{i?this.buyLoading.crypto=!0:this.sellLoading.crypto=!0;let{list:e}=await n.fK.getCryptoList(t);return(0,s.z)(()=>{i?this.buyList.to=e:this.sellList.from=e}),e}catch(t){(0,o.Notify)(t)}finally{i?this.buyLoading.crypto=!1:this.sellLoading.crypto=!1}}async updateFiatList(t){let i=t.type===a.hh.BUY;try{i?this.buyLoading.fiat=!0:this.sellLoading.fiat=!0;let{list:e}=await n.fK.getFiatList(t);return(0,s.z)(()=>{i?this.buyList.from=e:this.sellList.to=e}),e}catch(t){(0,o.Notify)(t)}finally{i?this.buyLoading.fiat=!1:this.sellLoading.fiat=!1}}async initBuySellPair(t,i,e){if(await this.getBuySellList(t),t===a.hh.BUY){e&&!this.buyList.cryptoList.find(t=>t.coin_id===e)&&(e=void 0);let n=e?await this.updateFiatList({crypto:e,type:t}):this.buyList.fiatList;e||(0,s.z)(()=>{this.buyList.from=this.buyList.fiatList});let o=(null==n?void 0:n.find(t=>t.coin_id===i))||this.getLocalFiatValue(t),l=await this.updateCryptoList({fiat:o.coin_id,type:t}),a=(null==l?void 0:l.find(t=>t.coin_id===e))||this.getLocalCoinValue(t);return{fiatValue:(0,s.ZN)(o),coinValue:a}}{i&&!this.sellList.fiatList.find(t=>t.coin_id===i)&&(i=void 0);let n=i?await this.updateCryptoList({fiat:i,type:t}):this.sellList.cryptoList;i||(0,s.z)(()=>{this.sellList.from=this.sellList.cryptoList});let o=(null==n?void 0:n.find(t=>t.coin_id===e))||this.getLocalCoinValue(t),l=await this.updateFiatList({crypto:o.coin_id,type:t});return{fiatValue:(null==l?void 0:l.find(t=>t.coin_id===i))||this.getLocalFiatValue(t),coinValue:(0,s.ZN)(o)}}}async getBuySellList(t){let i=t===a.hh.BUY;if(i){if(this.buyList.fiatList.length&&this.buyList.cryptoList.length)return}else if(this.sellList.fiatList.length&&this.sellList.cryptoList.length)return;try{let[{list:e,location:o},{list:l}]=await Promise.all([n.fK.getFiatList({type:t}),n.fK.getCryptoList({type:t})]);(0,s.z)(()=>{i?(this.buyList.fiatList=e||[],this.buyList.cryptoList=l||[]):(this.sellList.fiatList=e||[],this.sellList.cryptoList=l||[]),this.location=o||[]})}catch(t){(0,o.Notify)(t)}}getLocalFiatValue(t){let i;let{buy:e,sell:n}=l.account.options.buysell,o=t===a.hh.BUY;if(!(i=o?this.buyList.from.find(t=>{var i;return t.coin_id===(null===(i=e.fiatValue)||void 0===i?void 0:i.coin_id)}):this.sellList.to.find(t=>{var i;return t.coin_id===(null===(i=n.fiatValue)||void 0===i?void 0:i.coin_id)}))){let t=this.location.map(t=>t.symbol);t&&(i=o?this.buyList.from.find(i=>t.includes(i.symbol)):this.sellList.to.find(i=>t.includes(i.symbol)))}
1return i||(i=o?this.buyList.from[0]:this.sellList.to[0]),(0,s.ZN)(i)}getLocalCoinValue(t){let i;let{buy:e,sell:n}=l.account.options.buysell;return(i=t===a.hh.BUY?this.buyList.to.find(t=>{var i;return t.coin_id===(null===(i=e.coinValue)||void 0===i?void 0:i.coin_id)}):this.sellList.from.find(t=>{var i;return t.coin_id===(null===(i=n.coinValue)||void 0===i?void 0:i.coin_id)}))||(i=t===a.hh.BUY?this.buyList.to[0]:this.sellList.from[0]),(0,s.ZN)(i)}setLocalFiatValue(t,i){i===a.hh.BUY?l.account.options.buysell.buy.fiatValue=t:l.account.options.buysell.sell.fiatValue=t}setLocalCoinValue(t,i){i===a.hh.BUY?l.account.options.buysell.buy.coinValue=t:l.account.options.buysell.sell.coinValue=t}getFiatAndCrypto(t,i){let e=[t,i].filter(t=>!!t);return{fiat:e.find(t=>3===t.length),crypto:e.find(t=>t.length>3)}}constructor(){this.buyList={from:[],to:[],fiatList:[],cryptoList:[]},this.buyLoading={fiat:!1,crypto:!1},this.sellList={from:[],to:[],fiatList:[],cryptoList:[]},this.sellLoading={fiat:!1,crypto:!1},this.location=[],(0,s.ky)(this,void 0,{name:"BuySellStore",autoBind:!0})}}}},function(t){t.O(0,[7536,9382,2754,629,4766,2747,2888,9774,179],function(){return t(t.s=78269)}),_N_E=t.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.