PageSourceSearch

https://bonkuji.com/_next/static/chunks/5732.6b3adba8d4937b40.js

js bonkuji.com collected 2026-10-06 19:30:24 UTC 10,938 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5732],{85732:function(e,t,a){a.r(t),a.d(t,{AwaitingExternalEthereumTransferScreen:function(){return $},default:function(){return $}});var n=a(85893),i=a(11429),r=a(67294),s=a(27760),o=a(98477),d=a(76812),c=a(64532),u=a(79948),l=a(90088),h=a(21429),f=a(15975),g=a(39732),p=a(54988),m=a(62355),v=a(83011),y=a(13337),C=a(51079),b=a(24741),I=a(77670),T=a(21200),w=a(68371),S=a(72817),E=a(48492),x=a(31010),N=a(77906),F=a(84320),A=a(53584),P=a(95872),B=a(19656),j=a(73305),k=a(88185),_=a(25430),U=a(16947),q=a(62058),M=a(90811);a(97234),a(31008),a(85518),a(46673);let $={component:()=>{let{rpcConfig:e,appId:t,closePrivyModal:a,createAnalyticsEvent:$}=(0,w.u)(),{navigate:W,setModalData:H,data:L}=(0,S.u)(),R=(0,b.u)(),{wallets:D}=(0,x.u)(),[Q,G]=(0,r.useState)(!1),[O,V]=(0,r.useState)(0n),[Z,K]=(0,r.useState)(!1),[Y,z]=(0,r.useState)(null),[J,X]=(0,r.useState)(null),[ee,et]=(0,r.useState)([]),[ea,en]=(0,r.useState)(0),[ei,er]=(0,r.useState)([]),[es,eo]=(0,r.useState)(!1),[ed,ec]=(0,r.useState)(!1),[eu,el]=(0,r.useState)(!1),[eh,ef]=(0,r.useState)(!1),[eg,ep]=(0,r.useState)(),[em,ev]=(0,r.useState)();if(!L?.funding||"ethereum"!==L.funding.chainType)throw Error("Invalid funding data");let{erc20ContractInfo:ey,chain:eC,connectedWallet:eb}=L.funding,eI=L.funding.address,eT=L.funding.erc20Address,[ew,eS]=(0,r.useState)(L.funding.amount);(0,r.useEffect)(()=>{eT&&!ey&&z(Error("Unable to fetch token details"))},[]);let eE=!!eT&&!!ey,ex=eE?BigInt(parseFloat(ew)*10**ey.decimals):(0,s.f)(ew),eN=("ethereum"===eb?.type?eb:void 0)??D[0],eF=(0,T.k)(eN?.walletClientType||"unknown"),eA=eF?.name||"wallet",[eP,eB]=(0,r.useState)(null);(0,r.useEffect)(()=>{(async()=>{if(!eN)return;let e=await eN.getEthereumProvider();eB((0,o.K)({account:eN.address,transport:(0,d.P)(e)}).extend(c.I))})().catch(console.error)},[eN]);let[ej,ek]=(0,r.useState)(0n);(0,r.useEffect)(()=>{(0,u.v)({chain:eC,transport:(0,l.d)((0,q.a)(eC,e,t))}).getBalance({address:eI}).then(ek).catch(console.error)},[]);let[e_,eU]=(0,r.useState)(0n);(0,r.useEffect)(()=>{eE&&(0,_.g)({chain:eC,address:eI,appId:t,rpcConfig:e,erc20Address:eT}).then(e=>eU(e.balance)).catch(console.error)},[]);let{tokenPrice:eq}=(0,E.u)(eC.id),[eM,e$]=(0,r.useState)({to:eI,chain:eC,value:ex,data:void 0});(0,r.useEffect)(()=>{(async()=>{let a,n;if(!eP||!eN||es||eu)return;eo(!0);let i=(0,u.v)({chain:eM.chain,transport:(0,l.d)((0,q.a)(eM.chain,e,t))});if(eE&&!eM.data)return await i.simulateContract({address:eT,chain:eM.chain,abi:N.E,functionName:"transfer",args:[eI,ex],account:eN.address}).catch(e=>{if("ContractFunctionZeroDataError"===e?.cause?.name||e?.message?.includes("returned no data"))return i.simulateContract({address:eT,chain:eM.chain,abi:N.a,functionName:"transfer",args:[eI,ex],account:eN.address}).catch(e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)});console.warn("Simulated token transfer failed with error, fetching bridge options.",e)})?(eo(!1),void e$({to:eT,chain:eM.chain,data:(0,h.R)({abi:N.E,functionName:"transfer",args:[eI,ex]}),value:"0x0"})):(eo(!1),void K(!0));try{a=await i.prepareTransactionRequest({account:eN.address,to:eM.to,chain:eM.chain,data:eM.data,value:BigInt(eM.value??0)})}catch(e){if(console.error(e),ee.length>1)X(e.shortMessage??"Something went wrong");else if(ed&&0===ee.length)return void z(new I.P(`Wallet ${(0,U.c)(eN.address)} does not have enough funds.`,void 0,I.a.INSUFFICIENT_BALANCE))}if(!a)return eo(!1),void K(!0);"eip1559"===a.type||"eip4844"===a.type||"eip7702"===a.type?void 0!==a.gasPrice&&delete a.gasPrice:("legacy"===a.type||"eip2930"===a.type)&&(void 0!==a.maxFeePerGas&&delete a.maxFeePerGas,void 0!==a.maxPriorityFeePerGas&&delete a.maxPriorityFeePerGas),eo(!1),el(!0),G(!0),V(a.gas);try{await eP.switchChain({id:eM.chain.id})}catch(e){await eP.addChain({chain:eM.chain}),await eP.switchChain({id:eM.chain.id})}try{n=await eP.sendTransaction(a)}catch(e){if(console.error(e),"TransactionExecutionError"===e.name){if(ee.length<1){let t=e.shortMessage;(e.shortMessage.includes("rejected the request")||e.details.includes("rejected the request"))&&(t="User rejected the request."),z(new I.P(t,void 0,I.a.TRANSACTION_FAILURE))}else X(e.shortMessage??"Something went wrong")}}if(n){if(await eP.waitForTransactionReceipt({hash:n}),el(!1),ed){if(ei.length>0){let[e,...t]=ei;if(!e)return;return er(t),void e$(e)}return ep(n),void ev("pending")}ef(!0),H((0,j.q)(L,"completed",n,eN?.walletClientType,eE,ey,eC)),$({eventName:P.O,payload:{provider:"external",status:"success",txHash:n,address:eN.address,chainId:eM.chain.id,chainType:"ethereum",value:eM.value?(0,f.b)(BigInt(eM.value),ey?.decimals??18):void 0,token:ey?.symbol??eT??"ETH",destinationAddress:eI,destinationChainId:eC.id,destinationChainType:"ethereum",destinationValue:ex?(0,f.b)(ex,ey?.decimals??18):void 0,destinationToken:ey?.symbol??eT??eC.nativeCurrency.name}})}else el(!1)})().catch(console.error)},[eP,eM]),(0,r.useEffect)(()=>{(async()=>
1{if(!Z||!eP||!eN)return;let a=(0,g.Q2)(R.chains).filter(e=>e.id!==eC.id&&!!e.testnet==!!eC.testnet);eE&&a.unshift(eC);let n=await (0,k.g)({chains:a,address:eN.address,appId:t,rpcConfig:e}),i=eE?n.filter(e=>e.balance>0n):n.filter(e=>e.balance>ex),r=eE&&n.every(e=>0n===e.balance);if(i.length<1)return void z(new I.P(r?`Wallet ${(0,U.c)(eN.address)} doesn't have enough funds to cover gas fees. Top up your wallet and try again.`:`Wallet ${(0,U.c)(eN.address)} does not have enough funds.`,void 0,I.a.INSUFFICIENT_BALANCE));i.sort((e,t)=>Number(eE?(t.erc20Balance??0n)-(e.erc20Balance??0n):t.balance-e.balance));let s=i.flatMap(e=>{let a=[{...e,isErc20Quote:!1,isTestnet:!!eC.testnet,input:(0,B.t)({appId:t,amount:ex.toString(),user:eN.address,recipient:eI,destinationChainId:eC.id,destinationCurrency:eT,originChainId:e.chain.id})}];return eE&&eT&&(e.erc20Balance??0n)>0n&&a.push({...e,isErc20Quote:!0,isTestnet:!!eC.testnet,input:(0,B.t)({appId:t,amount:ex.toString(),user:eN.address,recipient:eI,destinationChainId:eC.id,destinationCurrency:eT,originChainId:e.chain.id,originCurrency:e.erc20Address})}),a}),o=(await Promise.allSettled(s.map(async e=>({...e,quote:await (0,B.g)(e)})))).filter(e=>"fulfilled"===e.status).map(e=>e.value);if(o.length<1)return void z(new I.P(`Wallet ${(0,U.c)(eN.address)} does not have enough funds.`,void 0,I.a.INSUFFICIENT_BALANCE));let d=o.map(e=>({bridgeTx:(0,B.a)(e.quote),allTxSteps:(0,B.d)(e.quote),balance:e.balance,chain:e.chain,erc20Balance:e.erc20Balance,isErc20Quote:e.isErc20Quote})).filter(e=>!!e.bridgeTx);if(d.length>1)return void et(d);let c=d[0];if(!c)return void z(new I.P(`Wallet ${(0,U.c)(eN.address)} does not have enough funds.`,void 0,I.a.INSUFFICIENT_BALANCE));let[u,...l]=c.allTxSteps??[c.bridgeTx];u?(ec(!0),er(l.map(e=>({...e,chain:c.chain}))),e$({data:u.data,to:u.to,value:u.value,chain:c.chain})):z(new I.P(`Wallet ${(0,U.c)(eN.address)} does not have enough funds.`,void 0,I.a.INSUFFICIENT_BALANCE))})().catch(console.error)},[Z]),(0,B.u)({transactionHash:eg,isTestnet:!!eC.testnet,bridgingStatus:em,setBridgingStatus:ev,onSuccess({transactionHash:e}){ec(!1),ef(!0),H((0,j.q)(L,"completed",e,eN?.walletClientType,eE,ey,eC)),$({eventName:P.O,payload:{provider:"external",status:"success",txHash:e,address:eN?.address,chainId:eM.chain.id,chainType:"ethereum",value:eM.value?(0,f.b)(BigInt(eM.value),ey?.decimals??18):void 0,token:ey?.symbol??eT??"ETH",destinationAddress:eI,destinationChainId:eC.id,destinationChainType:"ethereum",destinationValue:ex?(0,f.b)(ex,ey?.decimals??18):void 0,destinationToken:ey?.symbol??eT??eC.nativeCurrency.name}})},onFailure({error:e}){ec(!1),z(e)}}),(0,r.useEffect)(()=>{Y&&(H({funding:L?.funding,solanaFundingData:L?.solanaFundingData,sendTransaction:L?.sendTransaction,errorModalData:{error:Y,previousScreen:"TransferFromWalletScreen"}}),W("ErrorScreen",!1))},[Y]);let eW=!eE&&eq?(0,A.c)(ew??"0",eq):void 0,eH=eE?O:(0,A.s)([O,ex]),eL=eH&&eq?(0,A.a)(eH,eq):void 0,eR=eH?(0,A.g)(eH,L?.funding?.erc20Address?L?.funding?.erc20ContractInfo?.symbol||"ETH":L?.funding?.chain.nativeCurrency.symbol||"ETH"):void 0,eD=O&&eq?(0,A.a)(O,eq):void 0,eQ=O?(0,A.g)(O,eC?.nativeCurrency?.symbol||"ETH"):void 0;if((0,r.useEffect)(()=>{if(!eh)return;let e=setTimeout(a,b.v);return()=>clearTimeout(e)},[eh]),eh)return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(y.t,{}),(0,n.jsx)(p.b,{}),(0,n.jsxs)(p.c,{children:[(0,n.jsx)(i.Z,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),(0,n.jsx)(v.C,{title:"Success!",description:`You’ve successfully added ${ew} ${eE?ey.symbol:eC.nativeCurrency.symbol} to your ${R.name} wallet. It may take a minute before the funds are available to use.`})]}),(0,n.jsx)(p.R,{}),(0,n.jsx)(m.B,{})]});let eG=eE?`${(0,F.f)({amount:e_,decimals:ey.decimals})}  ${ey.symbol}`:(0,A.g)(ej,eC.nativeCurrency.symbol,3,!0),eO=ee[ea];return ee.length>1&&eO?(0,n.jsx)(k.B,{displayName:eA,configuredFundingChain:eC,formattedBalance:eG,fundingAmount:ew,fundingCurrency:eE?ey.symbol:eC.nativeCurrency.symbol,fundingAmountInUsd:eW,options:ee,selectedOption:eO,isPreparing:es,isSubmitting:eu,addressToFund:eI,fundingWalletAddress:eN?.address||"",errorMessage:J,onSubmit:()=>{if(L.funding?.amount===ew){let[e,...t]=eO.allTxSteps??[eO.bridgeTx];if(!e)return;return ec(!0),er(t.map(e=>({...e,chain:eO.chain}))),void e$({to:e.to,data:e.data,value:e.value,chain:eO.chain})}(async function(){if(eN&&eO)try{let e=await (0,B.g)({isTestnet:!!eC.testnet,input:(0,B.t)({appId:t,amount:ex.toString(),user:eN.address,recipient:eI,destinationChainId:eC.id,destinationCurrency:eT,originChainId:eO.chain.id})}),[a,...n]=(0,B.d)(e);if(!a)throw Error("Invalid transaction request");ec(!0),er(n.map(e=>({...e,chain:eO.chain}))),e$({data:a.data,to:a.to,value:a.value,chain:eO.chain})}catch(e){console.error(e),z(new I.P("Unable to fetch quotes for bridging",e,I.a.INSUFFICIENT_BALANCE))}})().catch(console.error)},onSelect:e=>{e!==ea&&(X(null),en(e))},onAmountChange:eS}):Q&&O&&eN&&L?.funding?(0,n.jsx)(M.T,{walletClientType:eN?.walletClientType||"unknown",displayName:eA,addressToFund:eI,isBridging:ed,isErc20Flow:eE,totalPriceInUsd:eL,totalPriceInNativeCurrency:eR,gasPriceInUsd:eD,gasPriceInNativeCurrency:eQ,chainId:eC.id,chainName:eC.name}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(y.t,{}),(0,n.jsx)(C.N,{}),(0,n.jsx)("div",{style:{marginTop:"1rem"}}),(0,n.jsx)(m.B,{})]})}}},77906:function(e,t,a){a.d(t,{E:function(){return n},a:function(){return i}});let n=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],i=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"}]},27760:function(e,t,a){a.d(t,{f:function(){return i}});var n=a(81594);function i(e,t="wei"){return n.Wn(e,t)}}}]);

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.