PageSourceSearch

https://smtm.ai/_next/static/chunks/3536.f453ebb7d0060af8.js

js smtm.ai collected 2026-10-05 15:08:06 UTC 10,541 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3536],{53536:function(e,t,n){n.r(t),n.d(t,{AwaitingExternalEthereumTransferScreen:function(){return _},default:function(){return _}});var a=n(27573),i=n(35864),r=n(7653),s=n(75863),d=n(47673),o=n(46633),c=n(13004),u=n(39596),l=n(91361),h=n(92644),f=n(1666),g=n(52383),m=n(47179),v=n(75593),p=n(71844),y=n(82888),b=n(29981),C=n(31796),I=n(88089),T=n(50800),w=n(36170),E=n(14397),S=n(17754),x=n(58184),N=n(48066),B=n(43699),A=n(66664),$=n(60220),F=n(80223),j=n(93457),k=n(8360),U=n(13094),M=n(31793);n(69021),n(26996),n(97347),n(7220),n(61899);let _={component:()=>{let{rpcConfig:e,appId:t,closePrivyModal:n,createAnalyticsEvent:_}=(0,I.u)(),{navigate:D,setModalData:P,data:H}=(0,w.a)(),W=(0,C.u)(),{wallets:q}=(0,S.u)(),[L,Q]=(0,r.useState)(!1),[R,O]=(0,r.useState)(0n),[V,z]=(0,r.useState)(!1),[G,K]=(0,r.useState)(null),[Y,Z]=(0,r.useState)(null),[J,X]=(0,r.useState)([]),[ee,et]=(0,r.useState)(0),[en,ea]=(0,r.useState)(!1),[ei,er]=(0,r.useState)(!1),[es,ed]=(0,r.useState)(!1),[eo,ec]=(0,r.useState)(!1),[eu,el]=(0,r.useState)(),[eh,ef]=(0,r.useState)();if(!H?.funding||"ethereum"!==H.funding.chainType)throw Error("Invalid funding data");let{erc20ContractInfo:eg,chain:em,connectedWallet:ev}=H.funding,ep=H.funding.address,ey=H.funding.erc20Address,[eb,eC]=(0,r.useState)(H.funding.amount);(0,r.useEffect)(()=>{ey&&!eg&&K(Error("Unable to fetch token details"))},[]);let eI=!!ey&&!!eg,eT=eI?BigInt(parseFloat(eb)*10**eg.decimals):(0,s.f)(eb),ew=("ethereum"===ev?.type?ev:void 0)??q[0],eE=(0,T.Q)(ew?.walletClientType||"unknown"),eS=eE?.name||"wallet",[ex,eN]=(0,r.useState)(null);(0,r.useEffect)(()=>{(async()=>{if(!ew)return;let e=await ew.getEthereumProvider();eN((0,d.K)({account:ew.address,transport:(0,o.P)(e)}).extend(c.I))})().catch(console.error)},[ew]);let[eB,eA]=(0,r.useState)(0n);(0,r.useEffect)(()=>{(0,u.v)({chain:em,transport:(0,l.d)((0,U.a)(em,e,t))}).getBalance({address:ep}).then(eA).catch(console.error)},[]);let[e$,eF]=(0,r.useState)(0n);(0,r.useEffect)(()=>{eI&&(0,k.g)({chain:em,address:ep,appId:t,rpcConfig:e,erc20Address:ey}).then(e=>eF(e.balance)).catch(console.error)},[]);let{tokenPrice:ej}=(0,E.u)(em.id),[ek,eU]=(0,r.useState)({to:ep,chain:em,value:eT,data:void 0});(0,r.useEffect)(()=>{(async()=>{let n,a;if(!ex||!ew||en||es)return;ea(!0);let i=(0,u.v)({chain:ek.chain,transport:(0,l.d)((0,U.a)(ek.chain,e,t))});if(eI&&!ek.data)return await i.simulateContract({address:ey,chain:ek.chain,abi:x.E,functionName:"transfer",args:[ep,eT],account:ew.address}).catch(e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)})?(ea(!1),void eU({to:ey,chain:ek.chain,data:(0,h.R)({abi:x.E,functionName:"transfer",args:[ep,eT]}),value:"0x0"})):(ea(!1),void z(!0));try{n=await i.prepareTransactionRequest({account:ew.address,to:ek.to,chain:ek.chain,data:ek.data,value:BigInt(ek.value??0)})}catch(e){if(console.error(e),J.length>1)Z(e.shortMessage??"Something went wrong");else if(ei&&0===J.length)return void K(new I.a(`Wallet ${(0,T.D)(ew.address)} does not have enough funds.`,void 0,I.b.INSUFFICIENT_BALANCE))}if(!n)return ea(!1),void z(!0);ea(!1),ed(!0),Q(!0),O(n.gas);try{await ex.switchChain({id:ek.chain.id})}catch(e){await ex.addChain({chain:ek.chain}),await ex.switchChain({id:ek.chain.id})}try{a=await ex.sendTransaction(n)}catch(e){if(console.error(e),"TransactionExecutionError"===e.name){if(J.length<1){let t=e.shortMessage;(e.shortMessage.includes("rejected the request")||e.details.includes("rejected the request"))&&(t="User rejected the request."),K(new I.a(t,void 0,I.b.TRANSACTION_FAILURE))}else Z(e.shortMessage??"Something went wrong")}}if(a)return await ex.waitForTransactionReceipt({hash:a}),ed(!1),ei?(el(a),void ef("pending")):(ec(!0),P((0,F.x)(H,"completed",a,ew?.walletClientType,eI,eg,em)),void _({eventName:A.O,payload:{provider:"external",status:"success",txHash:a,address:ew.address,chainId:ek.chain.id,chainType:"ethereum",value:ek.value?(0,f.b)(BigInt(ek.value),eg?.decimals??18):void 0,token:eg?.symbol??ey??"ETH",destinationAddress:ep,destinationChainId:em.id,destinationChainType:"ethereum",destinationValue:eT?(0,f.b)(eT,eg?.decimals??18):void 0,destinationToken:eg?.symbol??ey??em.nativeCurrency.name}}));ed(!1)})().catch(console.error)},[ex,ek]),(0,r.useEffect)(()=>{(async()=>
1{if(!V||!ex||!ew)return;let n=(0,g.Q)(W.chains).filter(e=>e.id!==em.id&&!!e.testnet==!!em.testnet);eI&&n.unshift(em);let a=await (0,j.g)({chains:n,address:ew.address,appId:t,rpcConfig:e,includeUsdc:H.funding?.isUSDC}),i=eI?a.filter(e=>e.balance>0n):a.filter(e=>e.balance>eT),r=eI&&a.every(e=>0n===e.balance);if(i.length<1)return void K(new I.a(r?`Wallet ${(0,T.D)(ew.address)} doesn't have enough funds to cover gas fees. Top up your wallet and try again.`:`Wallet ${(0,T.D)(ew.address)} does not have enough funds.`,void 0,I.b.INSUFFICIENT_BALANCE));i.sort((e,t)=>Number(eI?(t.erc20Balance??0n)-(e.erc20Balance??0n):t.balance-e.balance));let s=i.flatMap(e=>{let n=[{...e,isErc20Quote:!1,isTestnet:!!em.testnet,input:(0,$.t)({appId:t,amount:eT.toString(),user:ew.address,recipient:ep,destinationChainId:em.id,destinationCurrency:ey,originChainId:e.chain.id})}];return eI&&ey&&(e.erc20Balance??0n)>=eT&&n.push({...e,isErc20Quote:!0,isTestnet:!!em.testnet,input:(0,$.t)({appId:t,amount:eT.toString(),user:ew.address,recipient:ep,destinationChainId:em.id,destinationCurrency:ey,originChainId:e.chain.id,originCurrency:e.erc20Address})}),n}),d=(await Promise.allSettled(s.map(async e=>({...e,quote:await (0,$.g)(e)})))).filter(e=>"fulfilled"===e.status).map(e=>e.value);if(d.length<1)return void K(new I.a(`Wallet ${(0,T.D)(ew.address)} does not have enough funds.`,void 0,I.b.INSUFFICIENT_BALANCE));let o=d.map(e=>({bridgeTx:(0,$.c)(e.quote),balance:e.balance,chain:e.chain,erc20Balance:e.erc20Balance,isErc20Quote:e.isErc20Quote})).filter(e=>!!e.bridgeTx);if(o.length>1)return void X(o);let c=o[0];c?(er(!0),eU({data:c.bridgeTx.data,to:c.bridgeTx.to,value:c.bridgeTx.value,chain:c.chain})):K(new I.a(`Wallet ${(0,T.D)(ew.address)} does not have enough funds.`,void 0,I.b.INSUFFICIENT_BALANCE))})().catch(console.error)},[V]),(0,$.u)({transactionHash:eu,isTestnet:!!em.testnet,bridgingStatus:eh,setBridgingStatus:ef,onSuccess({transactionHash:e}){er(!1),ec(!0),P((0,F.x)(H,"completed",e,ew?.walletClientType,eI,eg,em)),_({eventName:A.O,payload:{provider:"external",status:"success",txHash:e,address:ew?.address,chainId:ek.chain.id,chainType:"ethereum",value:ek.value?(0,f.b)(BigInt(ek.value),eg?.decimals??18):void 0,token:eg?.symbol??ey??"ETH",destinationAddress:ep,destinationChainId:em.id,destinationChainType:"ethereum",destinationValue:eT?(0,f.b)(eT,eg?.decimals??18):void 0,destinationToken:eg?.symbol??ey??em.nativeCurrency.name}})},onFailure({error:e}){er(!1),K(e)}}),(0,r.useEffect)(()=>{G&&(P({funding:H?.funding,solanaFundingData:H?.solanaFundingData,sendTransaction:H?.sendTransaction,errorModalData:{error:G,previousScreen:"TransferFromWalletScreen"}}),D("ErrorScreen",!1))},[G]);let eM=!eI&&ej?(0,B.c)(eb??"0",ej):void 0,e_=eI?R:(0,B.s)([R,eT]),eD=e_&&ej?(0,B.a)(e_,ej):void 0,eP=e_?(0,B.g)(e_,H?.funding?.erc20Address?H?.funding?.erc20ContractInfo?.symbol||"ETH":H?.funding?.chain.nativeCurrency.symbol||"ETH"):void 0,eH=R&&ej?(0,B.a)(R,ej):void 0,eW=R?(0,B.g)(R,em?.nativeCurrency?.symbol||"ETH"):void 0;if((0,r.useEffect)(()=>{if(!eo)return;let e=setTimeout(n,C.t);return()=>clearTimeout(e)},[eo]),eo)return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y.t,{}),(0,a.jsx)(m.b,{}),(0,a.jsxs)(m.c,{children:[(0,a.jsx)(i.Z,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),(0,a.jsx)(p.C,{title:"Success!",description:`You’ve successfully added ${eb}
1 ${eI?eg.symbol:em.nativeCurrency.symbol} to your ${W.name} wallet. It may take a minute before the funds are available to use.`})]}),(0,a.jsx)(m.R,{}),(0,a.jsx)(v.B,{})]});let eq=eI?`${(0,N.f)({amount:e$,decimals:eg.decimals})}  ${eg.symbol}`:(0,B.g)(eB,em.nativeCurrency.symbol,3,!0),eL=J[ee];return J.length>1&&eL?(0,a.jsx)(j.B,{displayName:eS,configuredFundingChain:em,erc20ContractInfo:eg,formattedBalance:eq,fundingAmount:eb,fundingCurrency:eI?eg.symbol:em.nativeCurrency.symbol,fundingAmountInUsd:eM,options:J,selectedOption:eL,isPreparing:en,isSubmitting:es,addressToFund:ep,fundingWalletAddress:ew?.address||"",errorMessage:Y,onSubmit:()=>{H.funding?.amount!==eb?(async function(){if(ew&&eL)try{let e=await (0,$.g)({isTestnet:!!em.testnet,input:(0,$.t)({appId:t,amount:eT.toString(),user:ew.address,recipient:ep,destinationChainId:em.id,destinationCurrency:ey,originChainId:eL.chain.id})}),n=(0,$.c)(e);if(!n)throw Error("Invalid transaction request");er(!0),eU({data:n.data,to:n.to,value:n.value,chain:eL.chain})}catch(e){console.error(e),K(new I.a("Unable to fetch quotes for bridging",e,I.b.INSUFFICIENT_BALANCE))}})().catch(console.error):eU({to:eL.bridgeTx.to,data:eL.bridgeTx.data,value:eL.bridgeTx.value,chain:eL.chain})},onSelect:e=>{e!==ee&&(Z(null),et(e))},onAmountChange:eC}):L&&R&&ew&&H?.funding?(0,a.jsx)(M.T,{walletClientType:ew?.walletClientType||"unknown",displayName:eS,addressToFund:ep,isBridging:ei,isErc20Flow:eI,totalPriceInUsd:eD,totalPriceInNativeCurrency:eP,gasPriceInUsd:eH,gasPriceInNativeCurrency:eW,chainId:em.id,chainName:em.name}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y.t,{}),(0,a.jsx)(b.N,{}),(0,a.jsx)("div",{style:{marginTop:"1rem"}}),(0,a.jsx)(v.B,{})]})}}},58184:function(e,t,n){n.d(t,{E:function(){return a}});let a=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}]},75863:function(e,t,n){n.d(t,{f:function(){return r}});var a=n(7734),i=n(89369);function r(e,t="wei"){return(0,i.v)(e,a.ez[t])}},89369:function(e,t,n){n.d(t,{v:function(){return r}});var a=n(18635);class i extends a.G{constructor({value:e}){super(`Number \`${e}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function r(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new i({value:e});let[n,a="0"]=e.split("."),r=n.startsWith("-");if(r&&(n=n.slice(1)),a=a.replace(/(0+)$/,""),0===t)1===Math.round(Number(`.${a}`))&&(n=`${BigInt(n)+1n}`),a="";else if(a.length>t){let[e,i,r]=[a.slice(0,t-1),a.slice(t-1,t),a.slice(t)],s=Math.round(Number(`${i}.${r}`));(a=s>9?`${BigInt(e)+BigInt(1)}0`.padStart(e.length+1,"0"):`${e}${s}`).length>t&&(a=a.slice(1),n=`${BigInt(n)+1n}`),a=a.slice(0,t)}else a=a.padEnd(t,"0");return BigInt(`${r?"-":""}${n}${a}`)}}}]);

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.