PageSourceSearch

https://app.doppler.lol/_next/static/chunks/0nay-95h4xcut.js?dpl=dpl_6TatcuizGvBCFJ2Xx74T8UH5WUDD

js doppler.lol collected 2026-10-08 04:01:13 UTC 299,217 bytes, 2 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,5151,663608,209165,937801,571618,e=>{"use strict";var t=e.i(768421);e.s(["BellIcon",0,function({className:e="w-4 h-4"}){return(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:e,children:[(0,t.jsx)("path",{d:"M8 2C6.34 2 5 3.34 5 5V7.59C5 7.851 4.89 8.11 4.71 8.29L3.29 9.71C3.11 9.89 3 10.149 3 10.41V11C3 11.55 3.45 12 4 12H12C12.55 12 13 11.55 13 11V10.41C13 10.149 12.89 9.89 12.71 9.71L11.29 8.29C11.11 8.11 11 7.851 11 7.59V5C11 3.34 9.66 2 8 2Z",fill:"currentColor"}),(0,t.jsx)("path",{d:"M9.5 13C9.5 13.83 8.83 14.5 8 14.5C7.17 14.5 6.5 13.83 6.5 13H9.5Z",fill:"currentColor"})]})}],5151);var n=e.i(444220),a=e.i(40542),i=e.i(576982);let r="cloudflare-turnstile-script",s=!!i.default.env.NEXT_PUBLIC_TURNSTILE_SITEKEY;function o({onTokenChangeAction:e}){let a=(0,n.useRef)(null),s=(0,n.useRef)(null),[l,u]=(0,n.useState)(!1),d=i.default.env.NEXT_PUBLIC_TURNSTILE_SITEKEY;return((0,n.useEffect)(()=>{if(!d)return void e("");let t=!0,n=function(e,t){if(window.turnstile)return e(),()=>{};let n=document.getElementById(r),a=n??document.createElement("script"),i=()=>{a.remove(),t()};return a.addEventListener("load",e),a.addEventListener("error",i),n||(a.id=r,a.src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",a.async=!0,a.defer=!0,document.head.appendChild(a)),()=>{a.removeEventListener("load",e),a.removeEventListener("error",i)}}(()=>{t&&!s.current&&a.current&&window.turnstile&&(s.current=window.turnstile.render(a.current,{sitekey:d,theme:"auto",callback:e,"expired-callback":()=>e(""),"error-callback":()=>e("")}))},()=>{t&&(e(""),u(!0))});return()=>{t=!1,n(),"string"==typeof s.current&&window.turnstile&&window.turnstile.remove(s.current),s.current=null}},[e,d]),d)?l?(0,t.jsx)("div",{className:"rounded-lg border border-sentiment-border-orange bg-sentiment-bg-orange p-3",role:"alert",children:(0,t.jsx)("p",{className:"text-xs text-text-orange",children:"We couldn't load the verification check. Disable any content blockers for this site and reload the page."})}):(0,t.jsx)("div",{ref:a,className:"min-h-[65px]"}):null}e.s(["TurnstileWidget",0,o,"isTurnstileEnabled",0,s],663608);var l=e.i(519455),u=e.i(63631),d=e.i(416639),p=e.i(482253),y=e.i(746798);async function c(e,t){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),a=await n.json();if(!n.ok)throw Error(a.error||"Request failed");return a}function m(e){if(!e||12!==e.length)return e;let t=e.slice(-4);return`+1 *** *** ${t}`}function T(e){return/^\+1\d{10}$/.test(e)}e.s(["apiPost",0,c],209165),e.s(["isValidUSPhone",0,T,"maskPhone",0,m],937801),e.s(["SmsOptInModal",0,function({isOpen:e,onCloseAction:i,initialPhoneNumber:r,initiallySubscribed:f=!1,tokenName:h,tokenAddress:b,chainId:g}){let[v,w]=(0,n.useState)(!1),[x,I]=(0,n.useState)(!1),[S,C]=(0,n.useState)(""),[E,k]=(0,n.useState)(""),[A,R]=(0,n.useState)(""),[D,N]=(0,n.useState)(""),[P,O]=(0,n.useState)(""),[_,M]=(0,n.useState)(0);(0,n.useEffect)(()=>{if(e)return()=>{w(!1),I(!1),k(""),R(""),N(""),O(""),M(e=>e+1)}},[e]);let L=async e=>{let t;if(e.preventDefault(),x)return;k(""),R("");let n=(t=D.replace(/\D/g,""),`+1${t}`);if(!T(n))return void R("Enter a valid U.S. mobile number.");if(!b||!g)return void k("SMS alerts are unavailable for this token.");if(s&&!P)return void k("Please complete the verification check.");let a=Intl.DateTimeFormat().resolvedOptions().timeZone;I(!0);try{let e=await c("/api/sms/subscribe",{phone:n,tokenAddress:b,chainId:g,timezone:a,turnstileToken:P||void 0});if("error"in e){k(e.error),O(""),M(e=>e+1);return}C(n),w(!0),O(""),M(e=>e+1)}catch(e){k(e instanceof Error?e.message:"Something went wrong. Please try again."),O(""),M(e=>e+1)}finally{I(!1)}};return e?f&&r?(0,t.jsx)(d.ModalPane,{isOpen:e,onClose:i,title:"SMS Alerts Active",variant:"centered",maxWidth:"28rem",primaryAction:{label:"Close",onClick:i},children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"rounded-lg border border-border-default bg-bg-subtle p-4",children:[(0,t.jsx)("p",{className:"text-sm text-text-secondary mb-1",children:"Phone number"}),(0,t.jsx)("p",{className:"font-mono text-sm text-text-primary",children:m(r)})]}),(0,t.jsx)("p",{className:"text-sm text-text-secondary",children:"You're currently subscribed to Doppler Alerts. Reply STOP at any time to unsubscribe."})]})}):v?(0,t.jsx)(d.ModalPane,{isOpen:e,onClose:i,title:"You're subscribed 👍",variant:"centered",maxWidth:"28rem",primaryAction:{label:"Close",onClick:i},children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("p",{className:"text-sm text-text-secondary",children:"You'll receive SMS updates before token launches you're watching."}),(0,t.jsxs)("div",{className:"rounded-lg border border-border-default bg-bg-subtle p-4",children:[(0,t.jsx)("p",{className:"text-sm text-text-secondary mb-1",children:"Phone number"}),(0,t.jsx)("p",{className:"font-mono text-sm text-text-primary",children:m(S)})]})]})}
1):(0,t.jsx)(d.ModalPane,{isOpen:e,onClose:i,title:"Get launch notifications",variant:"centered",maxWidth:"28rem",showCloseButton:!0,children:(0,t.jsxs)("form",{onSubmit:L,className:"space-y-6",children:[(0,t.jsxs)("p",{className:"text-md text-text-secondary",children:["Sign up to receive text alerts before ",h||"this token"," goes live."]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{htmlFor:"phone",className:"text-sm text-text-secondary mb-2 block",children:"Phone number"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(p.SelectField,{options:[{value:"+1",label:"🇺🇸 +1"}],value:"+1",disabled:!0,size:"lg",className:"flex-shrink-0 w-[100px] whitespace-nowrap"}),(0,t.jsx)(u.FormField,{id:"phone",type:"tel",placeholder:"(555) 555-5555",value:D,onChange:e=>{let t;N(0===(t=e.target.value.replace(/\D/g,"").slice(0,10)).length?"":t.length<=3?`(${t}`:t.length<=6?`(${t.slice(0,3)}) ${t.slice(3)}`:`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6)}`)},error:A,size:"lg",className:"flex-1"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 mt-2",children:[(0,t.jsx)("p",{className:"text-xs text-text-secondary",children:"Msg & data rates may apply."}),(0,t.jsx)(y.Tooltip,{content:(0,t.jsxs)("span",{children:["By entering your phone number, you agree to receive SMS alerts from Doppler about token launch schedules. You will receive up to 3 messages per launch. Reply STOP to unsubscribe or HELP for help. View our"," ",(0,t.jsx)("a",{href:"https://doppler.lol/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Terms"})," ","and"," ",(0,t.jsx)("a",{href:"https://doppler.lol/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Privacy Policy"}),"."]}),position:"top",interactive:!0,className:"max-w-[280px]",children:(0,t.jsx)(a.InfoIcon,{size:24,className:"text-text-tertiary cursor-help"})})]})]}),E&&(0,t.jsx)("div",{className:"rounded-lg bg-sentiment-bg-orange p-4",role:"alert",children:(0,t.jsx)("p",{className:"text-sm text-text-orange",children:E})}),s&&(0,t.jsx)(o,{onTokenChangeAction:O},_),(0,t.jsx)(l.Button,{type:"submit",variant:"primary",emphasis:"high",size:"lg",disabled:x||s&&!P,className:"w-full",children:x?"Subscribing…":"Remind me"})]})}):null}],571618)},722487,e=>{"use strict";let t=[{address:"0x0df07624056b18e2664761cb26247a12926d2258",fee:500}];e.s(["getForceV3Token",0,function(e){return t.find(t=>t.address.toLowerCase()===e.toLowerCase())},"isForceV3Token",0,function(e){return t.some(t=>t.address.toLowerCase()===e.toLowerCase())}])},14940,e=>{"use strict";var t=e.i(261526),n=e.i(278945),a=e.i(286879),i=e.i(131981),r=e.i(95367),s=e.i(228271);e.s(["useTokenMetadata",0,function(e,o,l=!0,u){let d=(0,a.useClientFlag)("clientEnableBrowseSolanaDevnetFlag");return(0,t.useQuery)({queryKey:["token",e,o?(0,i.serializeChainId)(o):null,u?.nocache],queryFn:async()=>{var t;let a,l;if(!o)throw Error("useTokenMetadata invoked without a chainId");let p=(0,r.buildMetadataApiUrl)(o,e);if(!p)throw Error(`Unsupported chain: ${(0,i.serializeChainId)(o)}`);u?.nocache&&(p+="?nocache=1");let y=await fetch(p);if(!y.ok){let t=(()=>{if(!d||(0,i.isEip155)(o))return null;let t=(0,n.findLocalSolanaToken)(e);return t?(0,n.buildLocalSolanaTokenMetadata)(t):null})();if(t)return t;throw Error(`Failed to fetch metadata: ${y.statusText}`)}return t=await y.json(),a=t?.marketingGraphic||t?.marketingGraphicUrl,l=t?.collectionImage||t?.collectionImageUrl||t?.image||t?.image_url||t?.imageUrl,{...t,imageUrl:(0,r.buildImageApiUrl)(o,e),marketingGraphicUrl:(0,s.resolveImageUrl)(a),collectionImageUrl:(0,s.resolveImageUrl)(l),website:t?.website||t?.external_url||""}},enabled:l&&!!e&&!!o,staleTime:!u?.initialData&&u?.nocache?0:9e5,retry:u?.nocache?5:2,retryDelay:e=>u?.nocache?Math.min(1e3*(e+1),5e3):1e3,...u?.initialData?{initialData:u.initialData}:{}})}],14940)},816919,e=>{"use strict";var t=e.i(602208);let n=e=>{if(null==e||""===e)return null;if("bigint"==typeof e)return e;if("string"==typeof e||"number"==typeof e)try{return BigInt(e)}catch{}return null};e.s(["formatDn404Unit",0,function(e,a=18){let i=n(e);
1return null===i?"-":Number((0,t.formatUnits)(i,a)).toLocaleString(void 0,{maximumFractionDigits:6})},"getDn404AssetModeAmount",0,function(e){return"doppler404"!==e.tokenVariant?0n:n(e.dn404?.unit)??0n},"mapDn404Fields",0,function(e){let t=n(e.dn404Unit);return"doppler404"!==e.tokenVariant?{tokenVariant:"standard",dn404:null}:{tokenVariant:"doppler404",dn404:null!==t&&t>0n?{unit:t,nftSupply:n(e.dn404NftSupply),baseUri:e.dn404BaseUri??null,mirrorAddress:e.dn404MirrorAddress??null,readStatus:e.dn404ReadStatus??null}:null}},"toNullableBigInt",0,n])},962259,e=>{"use strict";var t=e.i(781203);function n(e){if(e.migrated)return 100;let t=e.graduationPercentage;if(null==t)return null;let n=Number(t);return Number.isFinite(n)?n:null}e.s(["getTokenGraduationProgress",0,n,"shouldShowTokenProgressBar",0,function(e,a={}){return!a.isUpcoming&&!a.isFailedAuction&&!a.isForceV3&&null!==n(e)&&!("v3"===e.type&&e.isStreaming)&&"multicurve"!==e.type&&"scheduled-multicurve"!==e.type&&"rehype"!==e.type&&"unknown"!==e.migrationType&&""!==e.migrationType&&e.integrator!==t.ZERO_ADDRESS&&e.integrator!==t.FXHASH_INTEGRATOR_ADDRESS&&e.integrator!==t.NOICE_INTEGRATOR_ADDRESS&&e.integrator!==t.BONK_INTEGRATOR_ADDRESS}])},47898,714297,52598,592418,e=>{"use strict";let t;var n=e.i(576982);function a(){return"https://metrics.api.doppler.lol/"}e.i(901834),e.s(["getConsolidatedIndexerBaseUrl",0,a,"toConsolidatedIndexerQualityMode",0,function(e){return e?"product":"raw"}],47898);var i=e.i(131981);let r=["eip155:5042","eip155:42161","solana:mainnet","solana:devnet","eip155:8453","eip155:84532","eip155:56","eip155:57073","eip155:143","eip155:4663","eip155:130"],s={[i.CHAIN_IDS.SOLANA_MAINNET.reference]:"solana:mainnet",[i.CHAIN_IDS.SOLANA_DEVNET.reference]:"solana:devnet"},o={"eip155:5042":i.CHAIN_IDS.ARC,"eip155:42161":i.CHAIN_IDS.ARBITRUM,"solana:mainnet":i.CHAIN_IDS.SOLANA_MAINNET,"solana:devnet":i.CHAIN_IDS.SOLANA_DEVNET,"eip155:8453":i.CHAIN_IDS.BASE,"eip155:84532":i.CHAIN_IDS.BASE_SEPOLIA,"eip155:56":i.CHAIN_IDS.BSC,"eip155:57073":i.CHAIN_IDS.INK,"eip155:143":i.CHAIN_IDS.MONAD,"eip155:4663":i.CHAIN_IDS.ROBINHOOD,"eip155:130":i.CHAIN_IDS.UNICHAIN};function l(e){return o[e]}e.s(["fromIndexerNetworkId",0,l,"toIndexerNetworkId",0,function(e){if((0,i.isSolana)(e))return s[e.reference];let t=`eip155:${e.reference}`;return r.includes(t)?t:void 0}],714297);let u=/\{[^{}]+\}/g;function d(e,t,n){if(null==t)return"";if("object"==typeof t)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${n?.allowReserved===!0?t:encodeURIComponent(t)}`}function p(e,t,n){if(!t||"object"!=typeof t)return"";let a=[],i={simple:",",label:".",matrix:";"}[n.style]||"&";if("deepObject"!==n.style&&!1===n.explode){for(let e in t)a.push(e,!0===n.allowReserved?t[e]:encodeURIComponent(t[e]));let i=a.join(",");switch(n.style){case"form":return`${e}=${i}`;case"label":return`.${i}`;case"matrix":return`;${e}=${i}`;default:return i}}for(let i in t){let r="deepObject"===n.style?`${e}[${i}]`:i;a.push(d(r,t[i],n))}let r=a.join(i);return"label"===n.style||"matrix"===n.style?`${i}${r}`:r}function y(e,t,n){if(!Array.isArray(t))return"";if(!1===n.explode){let a={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[n.style]||",",i=(!0===n.allowReserved?t:t.map(e=>encodeURIComponent(e))).join(a);switch(n.style){case"simple":return i;case"label":return`.${i}`;case"matrix":return`;${e}=${i}`;default:return`${e}=${i}`}}let a={simple:",",label:".",matrix:";"}[n.style]||"&",i=[];for(let a of t)"simple"===n.style||"label"===n.style?i.push(!0===n.allowReserved?a:encodeURIComponent(a)):i.push(d(e,a,n));return"label"===n.style||"matrix"===n.style?`${a}${i.join(a)}`:i.join(a)}function c(e){return function(t){let n=[];if(t&&"object"==typeof t)for(let a in t){let i=t[a];if(null!=i){if(Array.isArray(i)){if(0===i.length)continue;n.push(y(a,i,{style:"form",explode:!0,...e?.array,allowReserved:e?.allowReserved||!1}));continue}if("object"==typeof i){n.push(p(a,i,{style:"deepObject",explode:!0,...e?.object,allowReserved:e?.allowReserved||!1}));continue}n.push(d(a,i,e))}}return n.join("&")}}function m(e,t){let n=e;for(let a of e.match(u)??[]){let e=a.substring(1,a.length-1),i=!1,r="simple";if(e.endsWith("*")&&(i=!0,e=e.substring(0,e.length-1)),e.startsWith(".")?(r="label",e=e.substring(1)):e.startsWith(";")&&(r="matrix",e=e.substring(1)),!t||void 0===t[e]||null===t[e])continue;let s=t[e];if(Array.isArray(s)){n=n.replace(a,y(e,s,{style:r,explode:i}));continue}if("object"==typeof s){n=n.replace(a,p(e,s,{style:r,explode:i}));continue}if("matrix"===r){n=n.replace(a,`;${d(e,s)}`);continue}n=n.replace(a,"label"===r?`.${encodeURIComponent(s)}`:encodeURIComponent(s))}return n}function T(e,t){return e instanceof FormData?e:t&&"application/x-www-form-urlencoded"===(t.get instanceof Function?t.get("Content-Type")??t.get("content-type"):t["Content-Type"]??t["content-type"])?new URLSearchParams(e).toString():JSON.stringify(e)}function f(...e){let t=new Headers;for(let n of e)if(n&&"object"==typeof n)for(let[e,a]of n instanceof Headers?n.entries():Object.entries(n))if(null===a)t.delete(e);else if(Array.isArray(a))for(let n of a)t.append(e,n);else void 0!==a&&t.set(e,a);return t}function h(e){return e.endsWith("/")?e.substring(0,e.length-1):e}e.s(["getConsolidatedIndexerClient",0,function(){return t??=function(e){let{baseUrl:t="",Request:a=globalThis.Request,fetch:i=globalThis.fetch,querySerializer:r,bodySerializer:s,pathSerializer:o,headers:l,requestInitExt:u,...d}={...e};u="object"==typeof n.default&&Number.parseInt(n.default?.versions?.n
1ode?.substring(0,2))>=18&&n.default.versions.undici?u:void 0,t=h(t);let p=[];async function y(e,n){var y,b;let g,v,w,x,I,{baseUrl:S,fetch:C=i,Request:E=a,headers:k,params:A={},parseAs:R="json",querySerializer:D,bodySerializer:N=s??T,pathSerializer:P,body:O,middleware:_=[],...M}=n||{},L=t;S&&(L=h(S)??t);let F="function"==typeof r?r:c(r);D&&(F="function"==typeof D?D:c({..."object"==typeof r?r:{},...D}));let U=P||o||m,q=void 0===O?void 0:N(O,f(l,k,A.header)),B=f(void 0===q||q instanceof FormData?{}:{"Content-Type":"application/json"},l,k,A.header),V=[...p,..._],j={redirect:"follow",...d,...M,body:q,headers:B},$=new E((y=e,b={baseUrl:L,params:A,querySerializer:F,pathSerializer:U},g=`${b.baseUrl}${y}`,b.params?.path&&(g=b.pathSerializer(g,b.params.path)),(v=b.querySerializer(b.params.query??{})).startsWith("?")&&(v=v.substring(1)),v&&(g+=`?${v}`),g),j);for(let e in M)e in $||($[e]=M[e]);if(V.length){for(let t of(w=Math.random().toString(36).slice(2,11),x=Object.freeze({baseUrl:L,fetch:C,parseAs:R,querySerializer:F,bodySerializer:N,pathSerializer:U}),V))if(t&&"object"==typeof t&&"function"==typeof t.onRequest){let n=await t.onRequest({request:$,schemaPath:e,params:A,options:x,id:w});if(n)if(n instanceof E)$=n;else if(n instanceof Response){I=n;break}else throw Error("onRequest: must return new Request() or Response() when modifying the request")}}if(!I){try{I=await C($,u)}catch(n){let t=n;if(V.length)for(let n=V.length-1;n>=0;n--){let a=V[n];if(a&&"object"==typeof a&&"function"==typeof a.onError){let n=await a.onError({request:$,error:t,schemaPath:e,params:A,options:x,id:w});if(n){if(n instanceof Response){t=void 0,I=n;break}if(n instanceof Error){t=n;continue}throw Error("onError: must return new Response() or instance of Error")}}}if(t)throw t}if(V.length)for(let t=V.length-1;t>=0;t--){let n=V[t];if(n&&"object"==typeof n&&"function"==typeof n.onResponse){let t=await n.onResponse({request:$,response:I,schemaPath:e,params:A,options:x,id:w});if(t){if(!(t instanceof Response))throw Error("onResponse: must return new Response() when modifying the response");I=t}}}}let K=I.headers.get("Content-Length");if(204===I.status||"HEAD"===$.method||"0"===K&&!I.headers.get("Transfer-Encoding")?.includes("chunked"))return I.ok?{data:void 0,response:I}:{error:void 0,response:I};if(I.ok){let e=async()=>{if("stream"===R)return I.body;if("json"===R&&!K){let e=await I.text();return e?JSON.parse(e):void 0}return await I[R]()};return{data:await e(),response:I}}let H=await I.text();try{H=JSON.parse(H)}catch{}return{error:H,response:I}}return{request:(e,t,n)=>y(t,{...n,method:e.toUpperCase()}),GET:(e,t)=>y(e,{...t,method:"GET"}),PUT:(e,t)=>y(e,{...t,method:"PUT"}),POST:(e,t)=>y(e,{...t,method:"POST"}),DELETE:(e,t)=>y(e,{...t,method:"DELETE"}),OPTIONS:(e,t)=>y(e,{...t,method:"OPTIONS"}),HEAD:(e,t)=>y(e,{...t,method:"HEAD"}),PATCH:(e,t)=>y(e,{...t,method:"PATCH"}),TRACE:(e,t)=>y(e,{...t,method:"TRACE"}),use(...e){for(let t of e)if(t){if("object"!=typeof t||!("onRequest"in t||"onResponse"in t||"onError"in t))throw Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");p.push(t)}},eject(...e){for(let t of e){let e=p.indexOf(t);-1!==e&&p.splice(e,1)}}}}({baseUrl:a()})}],52598);var b=e.i(781203),g=e.i(831368),v=e.i(95367),w=e.i(816919);let x=/^0x[0-9a-fA-F]{40}$/,I="zora-creator-coin-create",S={[I]:b.ZERO_ADDRESS};b.ZERO_ADDRESS;let C={rehype:"rehype",dhook:"dhook","dynamic-auction":"v4"};function E(e,t){let n=/^(-?)(\d+)(?:\.(\d+))?$/.exec(e.trim());if(!n)return;let[,a,i,r=""]=n,s=BigInt(i+r.slice(0,t).padEnd(t,"0"));return"-"===a?-s:s}function k(e){if(null!=e)return E(e,18)}function A(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?String(Math.floor(t/1e3)):void 0}function R(e){let t=e?.implementation;return t&&t.kind.startsWith("evm-")?t:void 0}function D(e){let t=e?.poolKey;if(t)return{currency0:t.currency0.toLowerCase(),currency1:t.currency1.toLowerCase(),fee:t.fee,tickSpacing:t.tickSpacing,hooks:t.hooks.toLowerCase()}}e.s(["normalizeConsolidatedTokenDetail",0,function(e){var t,n;let a,{token:r,market:s,migratedMarket:o,launch:u}=e,d=l(r.networkId);if(!d)return null;let p=(0,i.isEip155)(d),y=p?String(d.reference):(0,i.serializeChainId)(d),c=e=>(0,v.normalizeAddressForChain)(d,e),m=c(r.address),T=r.metrics,f=r.primaryMarket,h=s?.migration??o?.migration??u?.migration??null,N=h?.migrated??r.launch?.status==="migrated",P="evm-erc20"===r.implementation.kind?r.implementation.collection:null,O=(0,w.mapDn404Fields)({tokenVariant:r.tokenVariant??"standard",dn404Unit:P?.unit,dn404NftSupply:P?.nftSupply,dn404BaseUri:P?.baseUri,dn404MirrorAddress:P?.mirrorAddress,dn404ReadStatus:P?.readStatus}),_=r.decimals??(p?18:9),M=null===r.totalSupply?0n:E(r.totalSupply,0)??0n,L=R(s),F=D(L),U=R(o),q=o?.implementation.kind==="evm-v4-pool"?D(U):void 0,B=q?.fee||g.MIGRATED_V4_POOL_DEFAULTS.fee,V=q?.tickSpacing||g.MIGRATED_V4_POOL_DEFAULTS.tickSpacing,j=f?.quoteToken??s?.quoteToken??null,$=j?c(j.address):void 0,K=p&&!!$&&($===g.WETH_TOKEN_ADDRESS.toLowerCase()||$===b.ZERO_ADDRESS),H=U?function(e){switch(e){case"evm-v2-pool":return"v2";case"evm-v3-pool":return"v3";case"evm-v4-pool":return"v4";default:return}}(U.kind)??h?.migrationType??"v2":h?.migrationType??"v2",W=s?.marketId??u?.initialMarket?.marketId??f?.marketId,z=function(e,t){let n=Number(e.launchState?.graduation?.progressPercent);if(Number.isFinite(n))return n;let a=Number(e.launch?.graduation?.progress);return Number.isFinite(a)?100*a:t?100:void 0}
1(e,N),Q=j?.decimals??void 0,G=u?.graduation,X=G&&void 0!==Q?E(G.requiredQuote,Q):void 0,Y=G&&void 0!==Q?E(G.raisedQuote,Q):void 0;return{address:m,symbol:r.symbol??"",name:r.name??"",chainId:y,decimals:_,creatorAddress:r.creatorAddress?c(r.creatorAddress):void 0,totalSupply:M,migrated:N,creatorCoinPid:"",tokenUriData:(t=r.imageUrl,n=r.tokenUri,t||n?{...n?{metadataUri:n}:{},...t?{image:t,imageUrl:t,image_hash:t}:{}}:null),...O,indexerSource:"consolidated",pool:{volume:k(T.volume24hUsd??f?.volume24hUsd),marketCapUsd:k(T.marketCapUsd??(o??s)?.marketCapUsd),createdAt:A(s?.createdAt??r.createdAt),migratedToPool:h?.toMarketId?c(h.toMarketId):void 0,minThreshold:void 0,maxThreshold:X,chainId:y,graduationBalance:Y,graduationPercentage:z,percentDayChange:function(e){if(null==e)return;let t=100*e;return Number.isFinite(t)?t:void 0}(T.percentDayChange??f?.percentDayChange),address:W?c(W):m,integrator:r.integrator??function(e){if(e)return x.test(e.id)?e.id.toLowerCase():S[e.id]??e.id}(s?.integrator??o?.integrator)??"",holderCount:T.holderCount??s?.holderCount??void 0,isCreatorCoin:!1,isContentCoin:!1,migrated:N,liquidity:k(T.liquidityUsd??f?.liquidityUsd),lastSwapTimestamp:void 0===(a=A(T.lastSwapTimestamp??f?.lastSwapTimestamp))?void 0:BigInt(a),type:function(e){switch(e?.implementation.kind){case"evm-v3-pool":return"v3";case"evm-v4-pool":var t,n;if(t=e.integrator,t?.id===I)return"zora";return(n=e.implementation.callbackKind)&&C[n]||"v4";case"solana-cpmm-pool":return"solana-cpmm-pool";case"solana-initializer-curve":return"solana-initializer-curve";default:return}}(p?s:o??s),fee:L?.fee??0,isQuoteEth:K,isQuoteZora:p&&$===g.ZORA_TOKEN_ADDRESS.toLowerCase(),poolKey:F,migrationType:H,indexerSource:"consolidated",v4Pool:{fee:B,tickSpacing:V,hooks:q?.hooks??b.ZERO_ADDRESS,poolKey:q},baseToken:{address:m,creatorCoinPid:"",symbol:r.symbol??"",decimals:_,chainId:y,totalSupply:M,...O},isToken0:F?F.currency0===m.toLowerCase():void 0,quoteToken:j?{address:$,symbol:j.symbol??"",name:j.name??"",decimals:j.decimals??(p?18:9),pool:{isCreatorCoin:!1}}:void 0,asset:{address:m,migrated:N,chainId:y,migrationType:H,pool:{fee:L?.fee??0}}}}}],592418)},630136,e=>{"use strict";var t=e.i(52805);function n(e){return"string"==typeof e?(0,t.asEvmAddress)(e):void 0}function a(e){if("number"==typeof e)return e;if("string"==typeof e){let t=Number(e);return Number.isFinite(t)?t:void 0}}e.s(["normalizePoolKey",0,function(e){var t;let i=e;if("string"==typeof e)try{i=JSON.parse(e)}catch{return}if(!((t=i)&&"object"==typeof t)||!function(e){if(!e||"object"!=typeof e)return!1;let{currency0:t,currency1:n,fee:a,tickSpacing:i,hooks:r}=e;return"string"==typeof t&&"string"==typeof n&&"string"==typeof r&&("number"==typeof a||"string"==typeof a)&&("number"==typeof i||"string"==typeof i)}(i))return;let r=n(i.currency0),s=n(i.currency1),o=n(i.hooks),l=a(i.fee),u=a(i.tickSpacing);if(r&&s&&o&&void 0!==l&&void 0!==u)return{currency0:r,currency1:s,fee:l,tickSpacing:u,hooks:o}}])},167220,401917,e=>{"use strict";var t=e.i(261526),n=e.i(444220),a=e.i(278945),i=e.i(120307),r=e.i(286879),s=e.i(29529),o=e.i(47898),l=e.i(714297),u=e.i(131981),d=e.i(52598),p=e.i(592418),y=e.i(899582),c=e.i(764804),m=e.i(422642),T=e.i(276812),f=e.i(831368),h=e.i(340550),b=e.i(630136);function g(e){return"string"==typeof e&&/^0x[0-9a-fA-F]{40}$/.test(e)&&e.toLowerCase()!==T.zeroAddress}async function v({reader:e,chainId:t,asset:n,implementation:a}){let i=a.poolId?.toLowerCase();for(let r of function(e,t){let n=[t.poolKey?.hooks,t.hookAddress].filter(g);if(0===n.length){let t=(0,u.tryEvmChainId)(e);try{let e=void 0===t?void 0:(0,h.getDopplerAddresses)(t);n=[e?.dopplerHookInitializer,e?.rehypeDopplerHookInitializer].filter(g)}catch{}}let a=new Set;return n.filter(e=>{let t=e.toLowerCase();return!a.has(t)&&(a.add(t),!0)})}(t,a)){let t;try{t=await e.readContract({address:r,abi:y.dopplerHookInitializerAbi,functionName:"getState",args:[n]})}catch(e){if(e instanceof c.BaseError&&e.walk(e=>e instanceof m.HttpRequestError||e instanceof m.TimeoutError))throw e;continue}if(!g(t[2]))continue;let a=(0,b.normalizePoolKey)(t[5]);if(!i||a&&(0,y.computePoolId)(a).toLowerCase()===i)return"rehype"}return null}let w=new Map;async function x(e,{chainId:t,asset:n,reader:a}){if(!e||!a||!function(e){if(e?.kind!=="evm-v4-pool"||"rehype"===e.callbackKind)return!1;let t=e.poolKey?.fee;return void 0===t||(t&f.V4_DYNAMIC_FEE_FLAG)!=0}(e.implementation))return e;try{let i=await function(e){let t=`${(0,u.serializeChainId)(e.chainId)}:${(e.implementation.poolId??e.asset).toLowerCase()}`,n=w.get(t);if(n)return n;let a=v(e).catch(e=>{throw w.delete(t),e});if(w.size>=512){let e=w.keys().next().value;void 0!==e&&w.delete(e)}return w.set(t,a),a}({reader:a,chainId:t,asset:n,implementation:e.implementation});if("rehype"!==i)return e;return{...e,implementation:{...e.implementation,callbackKind:i}}}catch(t){return console.log("Error resolving v4 callback kind on-chain:",t),e}}async function I(e,t,n,a){let{data:i}=await (0,d.getConsolidatedIndexerClient)().GET("/api/markets/{networkId}/{marketId}",{params:{path:{networkId:e,marketId:t}
1,query:{qualityMode:n}},cache:"no-store",signal:a});return i}async function S(e,t,n,a){let{data:i}=await (0,d.getConsolidatedIndexerClient)().GET("/api/launches/{networkId}/{launchId}",{params:{path:{networkId:e,launchId:t},query:{qualityMode:n}},cache:"no-store",signal:a});return i}async function C(e,t,n){let{data:a}=await (0,d.getConsolidatedIndexerClient)().GET("/api/launches/{networkId}/{launchId}/state",{params:{path:{networkId:e,launchId:t}},cache:"no-store",signal:n});return a}async function E(e){if(e)try{return await e}catch{return}}async function k(e,t,n={}){n.signal?.throwIfAborted();let a=(0,l.toIndexerNetworkId)(e);if(!a)return null;let{qualityMode:i}=n,{data:r,response:s}=await (0,d.getConsolidatedIndexerClient)().GET("/api/tokens/{networkId}/{tokenId}",{params:{path:{networkId:a,tokenId:t},query:{qualityMode:i}},cache:"no-store",signal:n.signal});if(n.signal?.throwIfAborted(),!r){if(404===s.status||400===s.status)return null;throw Error(`Consolidated token detail request failed: ${s.status} ${s.statusText}`)}let o=r.launch?.launchId,y=r.launch?.status==="migrated",c=r.primaryMarket?.marketId;n.signal?.throwIfAborted();let[m,T,f]=await Promise.all([E(c?I(a,c,i,n.signal):void 0),E(o&&(!(0,u.isEip155)(e)||y)?S(a,o,i,n.signal):void 0),E(o&&(0,u.isEip155)(e)&&!y?C(a,o,n.signal):void 0)]);n.signal?.throwIfAborted();let h=m?.migration?.migrated??y,b=T?.initialMarket?.marketId,g=h&&b&&b!==c?await E(I(a,b,i,n.signal)):void 0;n.signal?.throwIfAborted();let v=await x(h?g:m,{chainId:e,asset:r.address,reader:n.publicClient}),w=(0,p.normalizeConsolidatedTokenDetail)({token:r,market:v,migratedMarket:h?m:void 0,launch:T,launchState:f});return n.signal?.throwIfAborted(),w}var A=e.i(428176),R=e.i(786516),D=e.i(95367);let N=["totalSupply"],P=["sqrtPrice","liquidity","price","dollarLiquidity","graduationBalance","minThreshold","maxThreshold","volumeUsd","marketCapUsd","reserves0","reserves1","lastSwapTimestamp","volume"],O=["createdAt","migratedAt","marketCapUsd"];function _(e,t){for(let n of t)null!=e[n]&&(e[n]=BigInt(e[n]))}function M(e){let t={...e};if(_(t,N),t.dn404&&"object"==typeof t.dn404){let e={...t.dn404};_(e,["unit","nftSupply"]),t.dn404=e}if(e.pool){let n={...e.pool};if(_(n,P),n.baseToken&&"object"==typeof n.baseToken){let e={...n.baseToken};if(_(e,N),e.dn404&&"object"==typeof e.dn404){let t={...e.dn404};_(t,["unit","nftSupply"]),e.dn404=t}n.baseToken=e}if(n.asset&&"object"==typeof n.asset){let e={...n.asset};_(e,O),n.asset=e}t.pool=n}return t}async function L(e,t,n=()=>{}){if(!e||!t)return null;let a=(0,u.coerceChainId)(e),r=(0,u.isSolana)(a),s=`${(0,u.serializeChainId)(a)}:${t.toLowerCase()}`,o=await fetch(function(e,t){let n=(0,u.coerceChainId)(e),a=(0,D.getChainRouteFromId)(n);if(!a)throw Error(`Unsupported chain for token details: ${(0,u.serializeChainId)(n)}`);return`/api/tokens/${a}/${t}`}(a,t),{cache:"no-store",credentials:"same-origin"}),l=o.headers.get("x-doppler-indexer-source")??"unknown";if("rpc"===l)return null;if(!o.ok){if(404===o.status)return r&&n(i.SOLANA_INDEXER.TOKEN_DETAIL_LOADED,s,{surface:"token-detail",chainId:(0,u.serializeChainId)(a),indexerSource:l,itemFound:!1,status:o.status}),null;throw r&&n(i.SOLANA_INDEXER.REQUEST_FAILED,s,{surface:"token-detail",chainId:(0,u.serializeChainId)(a),indexerSource:l,status:o.status}),Error(`Failed to fetch token details: ${o.statusText}`)}let d=await o.json();return r&&n(i.SOLANA_INDEXER.TOKEN_DETAIL_LOADED,s,{surface:"token-detail",chainId:(0,u.serializeChainId)(a),indexerSource:l,itemFound:!!d,status:o.status}),d?M(d):null}async function F(e,t,n=()=>{},a={}){let r=(0,u.isSolana)(e),s=`${(0,u.serializeChainId)(e)}:${t.toLowerCase()}`;try{let o=await k(e,t,a);return r&&n(i.SOLANA_INDEXER.TOKEN_DETAIL_LOADED,s,{surface:"token-detail",chainId:(0,u.serializeChainId)(e),indexerSource:"consolidated",itemFound:!!o,status:o?200:404}),o}catch(t){throw r&&n(i.SOLANA_INDEXER.REQUEST_FAILED,s,{surface:"token-detail",chainId:(0,u.serializeChainId)(e),indexerSource:"consolidated",status:0}),t}}e.s(["deserializeToken",0,M],401917),e.s(["fetchTokenDetails",0,L,"useTokenDetailsSql",0,({chainId:e,tokenAddress:i,initialData:d,enabled:p=!0})=>{let y=(0,u.coerceChainId)(e),c=(0,r.useClientFlag)("clientUseConsolidatedIndexerFlag"),m=!(0,u.isEip155)(y)||(0,R.getChainCompatibility)(y,c?"consolidated":"legacy").indexer,T=c?(0,l.toIndexerNetworkId)(y):void 0,f=(0,o.toConsolidatedIndexerQualityMode)((0,r.useClientFlag)("clientUseProdFiltersFlag")),h=(0,s.useGetPublicClient)(),b=(0,n.useRef)(new Set),g=(0,n.useMemo)(()=>
1{if(!(0,u.isSolana)(y))return;let e=(0,a.findLocalSolanaToken)(i);return e?(0,a.buildLocalSolanaTokenDetails)(e):void 0},[y,i]),v=(e,t,n)=>{let a=`${e}:${t}`;b.current.has(a)||(b.current.add(a),(0,A.trackFunnelEvent)(e,n))};return(0,t.useQuery)({queryKey:["tokenDetails",c,f,(0,u.serializeChainId)(y),i],queryFn:async()=>{if(!m)return null;try{return(T?await F(y,i,v,{publicClient:h(y),qualityMode:f}):await L(e,i,v))??d??g??null}catch(e){return console.log("Error fetching token details:",e),d??g??null}},enabled:m&&p&&!!i,staleTime:5e3,refetchInterval:5e3,...g&&!d?{placeholderData:g}:{},...d?{initialData:d}:{}})}],167220)},923288,e=>{"use strict";var t=e.i(444220);let n=new Set,a=null,i=null,r=Date.now();function s(){for(let e of(r=Date.now(),n))e()}function o(e){return n.add(e),1===n.size&&(i=setTimeout(()=>{s(),a=setInterval(s,1e3),i=null},1e3-Date.now()%1e3)),()=>{n.delete(e),0===n.size&&(i&&(clearTimeout(i),i=null),a&&(clearInterval(a),a=null))}}function l(){return r}e.s(["useTick",0,function(){return(0,t.useSyncExternalStore)(o,l,l)}])},336566,370359,e=>{"use strict";var t=e.i(768421),n=e.i(923288);e.s(["CreatedTimeDisplay",0,function({createdAt:e}){let a=(0,n.useTick)();if(!Number.isFinite(e)||e<=0)return(0,t.jsx)(t.Fragment,{children:"Unknown"});let i=Math.max(0,Math.floor((a-1e3*e)/1e3)),r=Math.floor(i/86400),s=Math.floor(r/365),o=Math.floor(r%365/30),l=Math.floor(i%86400/3600),u=Math.floor(i%3600/60);return s>0?(0,t.jsx)(t.Fragment,{children:`${s}y ${o}mo ago`}):o>0?(0,t.jsx)(t.Fragment,{children:`${o}mo ${r%30}d ago`}):r>0?(0,t.jsx)(t.Fragment,{children:`${r}d ${l}h ago`}):l>0?(0,t.jsx)(t.Fragment,{children:`${l}h ago`}):u>0?(0,t.jsx)(t.Fragment,{children:`${u}m ago`}):(0,t.jsx)(t.Fragment,{children:`${i}s ago`})}],336566);var a=e.i(261526);e.s(["useTrendingPools",0,({experimentalSolanaMode:e=!1}={})=>(0,a.useQuery)({queryKey:["trendingPools",e?"solana":"evm"],queryFn:async()=>{let e=await fetch("/api/trendingPools");if(!e.ok)throw Error(`Failed to fetch trending pools: ${e.statusText}`);return e.json()},staleTime:0,refetchInterval:5e3})],370359)},846660,153229,868616,363762,e=>{"use strict";var t=e.i(444220);e.s(["useClickOutside",0,function(e,n){(0,t.useEffect)(()=>{let t=t=>{e.current&&!e.current.contains(t.target)&&n()};return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[e,n])}],846660);var n=e.i(619041),a=e.i(344940),i=e.i(303028),r=e.i(221041),s=e.i(29529);let o="Account must be connected",l="No transaction method available",u="Approval is still propagating onchain. Please wait a moment and try again.",d="Swap could not be prepared. Please retry.";function p(e){let t=e instanceof Object&&"message"in e&&"string"==typeof e.message,n=t?e.message:"";return e instanceof r.UserRejectedRequestError||t&&(n.includes("User denied transaction signature.")||n.includes("User rejected the request."))?{eventError:"user-rejected",userMessage:"You cancelled the transaction."}:t&&(n.includes(o)||n.includes(l)||n.includes("Disconnected from MetaMask background")||n.includes("ExtensionPortStream postMessage failed")||n.includes('Lost connection to "MetaMask RpcProvider"'))?{eventError:"wallet-connection",userMessage:"Wallet connection error, try reconnecting your wallet."}:t&&(n.includes("replacement transaction underpriced")||n.includes("nonce too low")||n.includes("already known"))?{eventError:"nonce-conflict",userMessage:"A previous transaction is still pending. Wait for confirmation, then try again."}:t&&n.includes(u)?{eventError:"approval-pending",userMessage:u}:t&&n.includes(d)?{eventError:"preflight-failed",userMessage:d}:t&&(n.includes("Token approval failed. Please retry.")||n.includes("Spender approval failed. Please retry.")||n.includes("Failed to obtain permit."))?{eventError:"approval-failed",userMessage:"Approval failed. Please retry."}:t&&(n.toLowerCase().includes("internal json-rpc error")||n.toLowerCase().includes("json-rpc error")||n.toLowerCase().includes("could not coalesce error")||n.toLowerCase().includes("execution reverted")||n.toLowerCase().includes("missing revert data"))?{eventError:"rpc-error",userMe
1ssage:"Transaction request failed. Please retry."}:{eventError:"unknown-error",userMessage:"There was an error."}}e.s(["ERROR_ACCOUNT_MUST_BE_CONNECTED",0,o,"ERROR_NO_TRANSACTION_METHOD",0,l,"ERROR_SWAP_APPROVAL_PROPAGATING",0,u,"ERROR_SWAP_PREFLIGHT_FAILED",0,d],153229),e.s(["default",0,p],868616);let y=[{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint160",name:"amount",type:"uint160"},{internalType:"uint48",name:"expiration",type:"uint48"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"allowance",outputs:[{internalType:"uint160",name:"amount",type:"uint160"},{internalType:"uint48",name:"expiration",type:"uint48"},{internalType:"uint48",name:"nonce",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"wordPos",type:"uint256"},{internalType:"uint256",name:"mask",type:"uint256"}],name:"invalidateUnorderedNonces",outputs:[],stateMutability:"nonpayable",type:"function"}];var c=e.i(340550),m=e.i(131981),T=e.i(901834);let f=(1n<<160n)-1n,h=(0,T.isTest)()?[0,0,0]:[0,400,1200,2500],b=async e=>{e<=0||await new Promise(t=>setTimeout(t,e))},g=(e,t)=>{(0,T.isDevelopment)()&&console.log(`[permit2-debug] ${e}`,t)},v=({amount:e,expiration:t,requiredAmount:n})=>!(e<n)&&t>BigInt(Math.floor(Date.now()/1e3))+60n;e.s(["usePermit2Approval",0,({chainId:e,currentChainId:o,token:l,amount:u,spender:d,owner:T,sendTransaction:w,switchChain:x,permit2Address:I,approvalAmount:S})=>{let[C,E]=(0,t.useState)(!1),[k,A]=(0,t.useState)(),R=(0,s.useGetPublicClient)(),D=(0,t.useMemo)(()=>{try{return R(e)}catch{return}},[e,R]),N=(0,t.useCallback)(()=>{A(void 0)},[]),P=(0,t.useCallback)(async({label:e,read:t,isUsable:n,txHash:a})=>{let i,r;for(let[s,o]of h.entries()){await b(o);try{i=await t(),r=void 0;let l=n(i);if(g(`${e}-verification-attempt`,{txHash:a,attempt:s+1,delayMs:o,success:l}),l)return i}catch(t){r=t,g(`${e}-verification-read-error`,{txHash:a,attempt:s+1,delayMs:o,error:t instanceof Error?t.message:String(t)})}}if(void 0!==r&&void 0===i)throw r;return i},[]);return{requestPermit:(0,t.useCallback)(async t=>{if(!T){let e="Wallet not connected.";throw A(e),Error(e)}if(!D){let e="Unsupported chain context for permit approval.";throw A(e),Error(e)}if(!d){let e="Permit spender address is not configured.";throw A(e),Error(e)}if(!I){let e="Permit2 contract address is not configured.";throw A(e),Error(e)}if(u<=0n){let e="Permit amount must be greater than zero.";throw A(e),Error(e)}if(!w){let e="No transaction method available for approvals.";throw A(e),Error(e)}E(!0),A(void 0);try{let r,s,p=(0,m.toEvmChainId)(e);x&&void 0!==o&&!(0,m.chainIdEquals)(o,e)&&(g("switch-chain-before-approval",{fromChainId:o,toChainId:e}),await x({chainId:e}));
1let h=S??i.maxUint256,b=async()=>await D.readContract({address:l,abi:a.erc20Abi,functionName:"allowance",args:[T,I]}),C=async()=>await D.readContract({address:I,abi:y,functionName:"allowance",args:[T,l,d]});if(await b()<h){let e=(0,n.encodeFunctionData)({abi:a.erc20Abi,functionName:"approve",args:[I,h]}),i=await (0,c.withRobinhoodTransactionFeeOverridesIfAvailable)({chainId:p,publicClient:D,request:{to:l,data:e}});await t?.(),r=(await w(i)).hash;let s=await D.waitForTransactionReceipt({hash:r});g("token-approval-confirmed",{owner:T,token:l,txHash:r,blockNumber:s.blockNumber?.toString()});let o=await P({label:"token-approval",read:b,isUsable:e=>e>=h,txHash:r});if(void 0===o||o<h){let e="Token approval failed. Please retry.";throw A(e),Error(e)}}let E=await C();if(!E||void 0===E[0]){let e="Failed to read permit allowance.";throw A(e),Error(e)}let[k,R]=E;if(g("before",{owner:T,spender:d,token:l,permitAmount:k.toString(),permitExpiration:R.toString(),requiredAmount:u.toString()}),!v({amount:k,expiration:R,requiredAmount:u})){let e=BigInt(Math.floor((Date.now()+2592e6)/1e3)),a=(0,n.encodeFunctionData)({abi:y,functionName:"approve",args:[l,d,f,e]}),i=await (0,c.withRobinhoodTransactionFeeOverridesIfAvailable)({chainId:p,publicClient:D,request:{to:I,data:a}});await t?.(),s=(await w(i)).hash,g("permit2-approval-sent",{owner:T,spender:d,token:l,txHash:s});let r=await D.waitForTransactionReceipt({hash:s});g("permit2-approval-confirmed",{owner:T,spender:d,token:l,txHash:s,blockNumber:r.blockNumber?.toString()});let o=await P({label:"permit2-approval",read:C,isUsable:e=>!!(e&&v({amount:e[0],expiration:e[1],requiredAmount:u})),txHash:s});if(g("after",{owner:T,spender:d,token:l,permitAmount:o&&void 0!==o[0]?o[0].toString():void 0,permitExpiration:o&&void 0!==o[1]?o[1].toString():void 0,txHash:s}),!o||!v({amount:o[0],expiration:o[1],requiredAmount:u})){let e="Spender approval failed. Please retry.";throw A(e),Error(e)}}return{type:"approved",didSendTokenApproval:!!r,didSendPermit2Approval:!!s,tokenApprovalTxHash:r,permit2ApprovalTxHash:s}}catch(e){if(e instanceof r.UserRejectedRequestError)throw A(void 0),e;throw A(p(e).userMessage),e}finally{E(!1)}},[u,S,e,P,o,T,I,D,w,d,x,l]),isProcessing:C,error:k,reset:N}}],363762)},947513,958774,136927,215202,36305,116193,916190,683208,695171,90832,901900,361309,481825,487855,619464,e=>{"use strict";e.s(["isValidAmountForParsing",0,e=>{if(!e||""===e||"."===e)return!1;let t=parseFloat(e);return!isNaN(t)&&isFinite(t)&&t>=0},"processNumericInput",0,e=>{let t=e.replace(/[,\s]/g,""),n=""===t||!!/^\d*\.?\d*$/.test(t)&&(t.match(/\./g)||[]).length<=1;return{value:n?t:e,isValid:n,sanitized:t}}],947513);var t,n,a,i,r=e.i(340550),s=e.i(131981),o=e.i(276812),l=e.i(899582),u=e.i(223990),d=e.i(36320);let p={provider:"local",deployment:d.ARBITRUM_DEPLOYMENT,protocols:["v2","v3","v4"],modes:["exactIn","exactOut"]},y={provider:"local",deployment:d.ARBITRUM_DEPLOYMENT,protocols:["v2","v3","v4"],modes:["exactIn","exactOut"]},c={provider:"sdk",deploymentId:"doppler-sdk-1.0.42",protocols:["v2","v3","v4"],modes:["exactIn","exactOut"]},m=(0,l.getAddresses)(56),T={...c,deployment:{...u.BSC_DEPLOYMENT,addresses:{...u.BSC_DEPLOYMENT.addresses,Airlock:m.airlock,UniversalRouter:m.universalRouter,Permit2:m.permit2,WrappedNative:m.weth,UniswapV2Factory:m.uniswapV2Factory,UniswapV3Factory:m.uniswapV3Factory,UniswapV3Quoter:m.v3Quoter,UniswapV4Quoter:m.uniswapV4Quoter,PoolManager:m.poolManager}}},f={5042:{indexed:{...c,protocols:["v4"]}},56:{indexed:T,direct:T},42161:{indexed:c},8453:{indexed:c},84532:{indexed:c},57073:{indexed:c},130:{indexed:c},143:{indexed:c},4663:{indexed:c}},h={42161:{direct:p}},b={provider:"sdk",deploymentId:"doppler-sdk-1.0.42",protocols:["v2","v3","v4"],modes:["exactIn","exactOut"]},g={5042:{indexed:{...b,protocols:["v4"]}},56:{indexed:T,direct:T},42161:{indexed:b},8453:{indexed:b},84532:{indexed:b},57073:{indexed:b},130:{indexed:b},143:{indexed:b},4663:{indexed:b}},v={42161:{direct:y}},w={v2:["UniswapV2Factory"],v3:["UniswapV3Factory","UniswapV3Quoter"],v4:["PoolManager","UniswapV4Quoter"]},x={v2:["UniswapV2Factory"],v3:["UniswapV3Factory"],v4:["PoolManager"]};function I(e){return function(e,t){let{chainId:n,source:a,protocol:i,mode:r}=e,s=t.local[n]?.[a]??t.sdk[n]?.[a],l=`${n}:${a}:${i??"all"}:${r??"all"}`,u=e=>({provider:"unavailable",reason:e,cacheKey:`swap:unavailable:${l}:${e}`});if(!s)return u("Swaps are unavailable for this network and route source.");if(i&&!s.protocols.includes(i))return u("This swap protocol is unavailable.");if(r&&!s.modes.includes(r))return u("This swap mode is unavailable.");if("sdk"===s.provider&&!s.deployment)return{provider:"sdk",cacheKey:`swap:sdk:${l}:${s.deploymentId}`};let{deployment:d}=s;
1if(!d)return u("The reviewed deployment is unavailable.");if(d.chainId!==n)return u("The swap deployment does not match this network.");if("universal-router-2"!==d.routerEncoding)return u("This router's transaction encoding is not supported.");for(let e of["Airlock","UniversalRouter","Permit2","WrappedNative",...i?x[i]:[]]){let t=d.addresses[e];if(!t||t.toLowerCase()===o.zeroAddress)return u(`This chain has no verified ${e} deployment for this operation.`)}let p=Object.entries(d.addresses).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${e}=${t.toLowerCase()}`).join(",");return{provider:s.provider,deployment:d,cacheKey:`swap:${s.provider}:${l}:${"sdk"===s.provider?s.deploymentId:"local"}:${d.routerEncoding}:${p}`}}(e,{local:v,sdk:g})}function S(e){let t=I({chainId:e,source:"indexed"});switch(t.provider){case"unavailable":throw Error(t.reason);case"sdk":return(0,r.getDopplerAddresses)(e);case"local":return{weth:t.deployment.addresses.WrappedNative,universalRouter:t.deployment.addresses.UniversalRouter,permit2:t.deployment.addresses.Permit2}}}function C(e,t,n){let a={chainId:e?(0,s.tryEvmChainId)(e)??-1:-1,source:"indexed",mode:n},i=I(a);for(let e of t){let t=I({...a,protocol:e.protocol});if("unavailable"===t.provider)return t}return i}e.s(["resolveQuoteCapability",0,function(e){return function(e,t){let{chainId:n,source:a,protocol:i,mode:r}=e,s=t.local[n]?.[a]??t.sdk[n]?.[a],l=`${n}:${a}:${i??"all"}:${r??"all"}`,u=e=>({provider:"unavailable",reason:e,cacheKey:`unavailable:${l}:${e}`});if(!s)return u("Quotes are unavailable for this network and route source.");if(i&&!s.protocols.includes(i))return u("This quote protocol is unavailable.");if(r&&!s.modes.includes(r))return u("This quote mode is unavailable.");if("sdk"===s.provider&&!s.deployment)return{provider:"sdk",cacheKey:`sdk:${l}:${s.deploymentId}`};let{deployment:d}=s;if(!d)return u("The reviewed deployment is unavailable.");if(d.chainId!==n)return u("The quote deployment does not match this network.");if("universal-router-2"!==d.routerEncoding)return u("This router's transaction encoding is not supported.");for(let e of["Airlock",...i?w[i]:[]]){let t=d.addresses[e];if(!t||t.toLowerCase()===o.zeroAddress)return u(`This chain has no verified ${e} deployment for this operation.`)}let p=Object.entries(d.addresses).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${e}=${t.toLowerCase()}`).join(",");return{provider:s.provider,deployment:d,cacheKey:`${s.provider}:${l}:${"sdk"===s.provider?s.deploymentId:"local"}:${d.routerEncoding}:${p}`}}(e,{local:h,sdk:f})},"resolveSwapCapability",0,I],958774),e.s(["getSwapDeploymentAddresses",0,S,"resolveRouteSwapCapability",0,C],136927);var E=e.i(464489),k=e.i(969651),A=e.i(619041),R=e.i(101223),D=e.i(29529),N=e.i(63350);let P=[{inputs:[{internalType:"address",name:"_wrappedNativeTokenAddress",type:"address"},{internalType:"uint32",name:"_depositQuoteTimeBuffer",type:"uint32"},{internalType:"uint32",name:"_fillDeadlineBuffer",type:"uint32"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"ClaimedMerkleLeaf",type:"error"},{inputs:[],name:"DisabledRoute",type:"error"},{inputs:[],name:"ExpiredFillDeadline",type:"error"},{inputs:[],name:"InvalidChainId",type:"error"},{inputs:[],name:"InvalidExclusiveRelayer",type:"error"},{inputs:[],name:"InvalidExclusivityDeadline",type:"error"},{inputs:[],name:"InvalidFillDeadline",type:"error"},{inputs:[],name:"InvalidMerkleLeaf",type:"error"},{inputs:[],name:"InvalidMerkleProof",type:"error"},{inputs:[],name:"InvalidPayoutAdjustmentPct",type:"error"},{inputs:[],name:"InvalidQuoteTimestamp",type:"error"},{inputs:[],name:"InvalidSlowFillRequest",type:"error"},{inputs:[],name:"MsgValueDoesNotMatchInputAmount",type:"error"},{inputs:[],name:"NoSlowFillsInExclusivityWindow",type:"error"},{inputs:[],name:"NotEOA",type:"error"},{inputs:[],name:"NotExclusiveRelayer",type:"error"},{inputs:[],name:"RelayFilled",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"beacon",type:"address"}],name:"BeaconUpgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"rootBundleId",type:"uint256"}],name:"EmergencyDeleteRootBundle",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"originToken",type:"address"},{indexed:!0,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!1,internalType:"bool",name:"enabled",type:"bool"}],name:"EnabledDepositRoute",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amountToReturn",type:"uint256"},{indexed:!0,internalType:"uint256",name:"chainId",type:"uint256"},{indexed:!1,internalType:"uint256[]",name:"refundAmounts",type:"uint256[]"},{indexed:!0,internalType:"uint32",name:"rootBundleId",type:"uint32"},{indexed:!0,internalType:"uint32",name:"leafId",type:"uint32"},{indexed:!1,internalType:"address",name:"l2TokenAddress",type:"address"},{indexed:!1,internalType:"address[]",name:"refundAddresses",type:"address[]"},{indexed:!1,internalType:"address",name:"caller",type:"address"}],name:"ExecutedRelayerRefundRoot",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"totalFilledAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fillAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"repaymentChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!1,internalType:"int64",name:"relayerFeePct",type:"int64"},{indexed:!1,internalType:"int64",name:"realizedLpFeePct",type:"int64"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"address",name:"destinationToken",type:"address"},{indexed:!1,internalType:"address",name:"relayer",type:"address"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"},{components:[{internalType:"address",name:"recipient",type:"address"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"bool",name:"isSlowRelay",type:"bool"},{internalType:"int256",name:"payoutAdjustmentPct",type:"int256"}],indexed:!1,internalType:"struct SpokePool.RelayExecutionInfo",name:"updatableRelayData",type:"tuple"}],name:"FilledRelay",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"inputToken",type:"address"},{indexed:!1,internalType:"address",name:"outputToken",type:"address"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"repaymentChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!1,internalType:"address",name:"exclusiveRelayer",type:"address"},{indexed:!0,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"},{components:[{internalType:"address",name:"updatedRecipient",type:"address"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"enum V3SpokePoolInterface.FillType",name:"fillType",type:"uint8"}],indexed:!1,internalType:"struct V3SpokePoolInterface.V3RelayExecutionEventInfo",name:"relayExecutionInfo",type:"tuple"}],name:"FilledV3Relay",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!1,internalType:"int64",name:"relayerFeePct",type:"int64"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{indexed:!1,internalType:"address",name:"originToken",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"}
1],name:"FundsDeposited",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"isPaused",type:"bool"}],name:"PausedDeposits",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"isPaused",type:"bool"}],name:"PausedFills",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint32",name:"rootBundleId",type:"uint32"},{indexed:!0,internalType:"bytes32",name:"relayerRefundRoot",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"slowRelayRoot",type:"bytes32"}],name:"RelayedRootBundle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"int64",name:"newRelayerFeePct",type:"int64"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"updatedRecipient",type:"address"},{indexed:!1,internalType:"bytes",name:"updatedMessage",type:"bytes"},{indexed:!1,internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"RequestedSpeedUpDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"updatedRecipient",type:"address"},{indexed:!1,internalType:"bytes",name:"updatedMessage",type:"bytes"},{indexed:!1,internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"RequestedSpeedUpV3Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"inputToken",type:"address"},{indexed:!1,internalType:"address",name:"outputToken",type:"address"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!0,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!1,internalType:"address",name:"exclusiveRelayer",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"}],name:"RequestedV3SlowFill",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newHubPool",type:"address"}],name:"SetHubPool",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newAdmin",type:"address"}],name:"SetXDomainAdmin",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amountToReturn",type:"uint256"},{indexed:!0,internalType:"uint256",name:"chainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"leafId",type:"uint32"},{indexed:!0,internalType:"address",name:"l2TokenAddress",type:"address"},{indexed:!1,internalType:"address",name:"caller",type:"address"}],name:"TokensBridged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"inputToken",type:"address"},{indexed:!1,internalType:"address",name:"outputToken",type:"address"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!0,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"address",name:"exclusiveRelayer",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"}],name:"V3FundsDeposited",type:"event"},{inputs:[],name:"EMPTY_RELAYER",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"EMPTY_REPAYMENT_CHAIN_ID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"INFINITE_FILL_DEADLINE",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"MAX_TRANSFER_SIZE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"SLOW_FILL_MAX_TOKENS_TO_SEND",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"UPDATE_DEPOSIT_DETAILS_HASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"UPDATE_V3_DEPOSIT_DETAILS_HASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32",name:"_initialDepositId",type:"uint32"},{internalType:"address",name:"_crossDomainAdmin",type:"address"},{internalType:"address",name:"_hubPool",type:"address"}],name:"__SpokePool_init",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"chainId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"crossDomainAdmin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"originToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"uint256",name:"",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"originToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"uint256",name:"",type:"uint256"}],name:"depositFor",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"originToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"uint256",name:"maxCount",type:"uint256"}],name:"depositForNow",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"originToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"uint256",name:"maxCount",type:"uint256"}],name:"depositNow",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"depositQuoteTimeBuffer",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"originToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"uint256",name:"",type:"uint256"}],name:"depositV2",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],name:"depositV3",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"rootBundleId",type:"uint256"}],name:"emergencyDeleteRootBundle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"enabledDepositRoutes",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32",name:"rootBundleId",type:"uint32"},{components:[{internalType:"uint256",name:"amountToReturn",type:"uint256"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"uint256[]",name:"refundAmounts",type:"uint256[]"},{internalType:"uint32",name:"leafId",type:"uint32"},{internalType:"address",name:"l2TokenAddress",type:"address"},{internalType:"address[]",name:"refundAddresses",type:"address[]"}],internalType:"struct SpokePoolInterface.RelayerRefundLeaf",name:"relayerRefundLeaf",type:"tuple"},{internalType:"bytes32[]",name:"proof",type:"bytes32[]"}],name:"executeRelayerRefundLeaf",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"destinationToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"int64",name:"realizedLpFeePct",type:"int64"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"uint32",name:"rootBundleId",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"int256",name:"payoutAdjustment",type:"int256"},{internalType:"bytes32[]",name:"proof",type:"bytes32[]"}],name:"executeSlowRelayLeaf",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],internalType:"struct V3SpokePoolInterface.V3RelayData",name:"relayData",type:"tuple"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"}],internalType:"struct V3SpokePoolInterface.V3SlowFill",name:"slowFillLeaf",type:"tuple"},{internalType:"uint32",name:"rootBundleId",type:"uint32"},{internalType:"bytes32[]",name:"proof",type:"bytes32[]"}
vendor: 11,048 bytes, line 1
1],name:"executeV3SlowRelayLeaf",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"fillDeadlineBuffer",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"destinationToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"maxTokensToSend",type:"uint256"},{internalType:"uint256",name:"repaymentChainId",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"int64",name:"realizedLpFeePct",type:"int64"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"uint256",name:"maxCount",type:"uint256"}],name:"fillRelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"updatedRecipient",type:"address"},{internalType:"address",name:"destinationToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"maxTokensToSend",type:"uint256"},{internalType:"uint256",name:"repaymentChainId",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"int64",name:"realizedLpFeePct",type:"int64"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"int64",name:"updatedRelayerFeePct",type:"int64"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"bytes",name:"depositorSignature",type:"bytes"},{internalType:"uint256",name:"maxCount",type:"uint256"}],name:"fillRelayWithUpdatedDeposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"fillStatuses",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],internalType:"struct V3SpokePoolInterface.V3RelayData",name:"relayData",type:"tuple"},{internalType:"uint256",name:"repaymentChainId",type:"uint256"}],name:"fillV3Relay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],internalType:"struct V3SpokePoolInterface.V3RelayData",name:"relayData",type:"tuple"},{internalType:"uint256",name:"repaymentChainId",type:"uint256"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"address",name:"updatedRecipient",type:"address"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"fillV3RelayWithUpdatedDeposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"getCurrentTime",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"hubPool",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32",name:"_initialDepositId",type:"uint32"},{internalType:"address",name:"_hubPool",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"numberOfDeposits",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bool",name:"pause",type:"bool"}],name:"pauseDeposits",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bool",name:"pause",type:"bool"}],name:"pauseFills",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"pausedDeposits",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"pausedFills",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"relayerRefundRoot",type:"bytes32"},{internalType:"bytes32",name:"slowRelayRoot",type:"bytes32"}],name:"relayRootBundle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],internalType:"struct V3SpokePoolInterface.V3RelayData",name:"relayData",type:"tuple"}],name:"requestV3SlowFill",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"rootBundles",outputs:[{internalType:"bytes32",name:"slowRelayRoot",type:"bytes32"},{internalType:"bytes32",name:"relayerRefundRoot",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newCrossDomainAdmin",type:"address"}],name:"setCrossDomainAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"originToken",type:"address"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"bool",name:"enabled",type:"bool"}],name:"setEnableRoute",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newHubPool",type:"address"}],name:"setHubPool",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"int64",name:"updatedRelayerFeePct",type:"int64"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"address",name:"updatedRecipient",type:"address"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"speedUpDeposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"address",name:"updatedRecipient",type:"address"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"speedUpV3Deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"wrappedNativeToken",outputs:[{internalType:"contract WETH9Interface",name:"",type:"address"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],O=[{type:"constructor",inputs:[{name:"params",type:"tuple",internalType:"struct RouterParameters",components:[{name:"permit2",type:"address",internalType:"address"},{name:"weth9",type:"address",internalType:"address"},{name:"v2Factory",type:"address",internalType:"address"},{name:"v3Factory",type:"address",internalType:"address"},{name:"pairInitCodeHash",type:"bytes32",internalType:"bytes32"},{name:"poolInitCodeHash",type:"bytes32",internalType:"bytes32"},{name:"v4PoolManager",type:"address",internalType:"address"},{name:"v3NFTPositionManager",type:"address",internalType:"address"},{name:"v4PositionManager",type:"address",internalType:"address"}]}],stateMutability:"nonpayable"},{type:"receive",stateMutability:"payable"},{type:"function",name:"V3_POSITION_MANAGER",inputs:[],outputs:[{name:"",type:"address",internalType:"contract INonfungiblePositionManager"}],stateMutability:"view"},{type:"function",name:"V4_POSITION_MANAGER",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IPositionManager"}],stateMutability:"view"},{type:"function",name:"execute",inputs:[{name:"commands",type:"bytes",internalType:"bytes"},{name:"inputs",type:"bytes[]",internalType:"bytes[]"}],outputs:[],stateMutability:"payable"},{type:"function",name:"execute",inputs:[{name:"commands",type:"bytes",internalType:"bytes"},{name:"inputs",type:"bytes[]",internalType:"bytes[]"},{name:"deadline",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"payable"}
1,{type:"function",name:"msgSender",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"poolManager",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IPoolManager"}],stateMutability:"view"},{type:"function",name:"uniswapV3SwapCallback",inputs:[{name:"amount0Delta",type:"int256",internalType:"int256"},{name:"amount1Delta",type:"int256",internalType:"int256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlockCallback",inputs:[{name:"data",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes",internalType:"bytes"}],stateMutability:"nonpayable"},{type:"error",name:"BalanceTooLow",inputs:[]},{type:"error",name:"ContractLocked",inputs:[]},{type:"error",name:"DeltaNotNegative",inputs:[{name:"currency",type:"address",internalType:"Currency"}]},{type:"error",name:"DeltaNotPositive",inputs:[{name:"currency",type:"address",internalType:"Currency"}]},{type:"error",name:"ETHNotAccepted",inputs:[]},{type:"error",name:"ExecutionFailed",inputs:[{name:"commandIndex",type:"uint256",internalType:"uint256"},{name:"message",type:"bytes",internalType:"bytes"}]},{type:"error",name:"FromAddressIsNotOwner",inputs:[]},{type:"error",name:"InputLengthMismatch",inputs:[]},{type:"error",name:"InsufficientBalance",inputs:[]},{type:"error",name:"InsufficientETH",inputs:[]},{type:"error",name:"InsufficientToken",inputs:[]},{type:"error",name:"InvalidAction",inputs:[{name:"action",type:"bytes4",internalType:"bytes4"}]},{type:"error",name:"InvalidBips",inputs:[]},{type:"error",name:"InvalidCommandType",inputs:[{name:"commandType",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidEthSender",inputs:[]},{type:"error",name:"InvalidPath",inputs:[]},{type:"error",name:"InvalidReserves",inputs:[]},{type:"error",name:"LengthMismatch",inputs:[]},{type:"error",name:"NotAuthorizedForToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"NotPoolManager",inputs:[]},{type:"error",name:"OnlyMintAllowed",inputs:[]},{type:"error",name:"SliceOutOfBounds",inputs:[]},{type:"error",name:"TransactionDeadlinePassed",inputs:[]},{type:"error",name:"UnsafeCast",inputs:[]},{type:"error",name:"UnsupportedAction",inputs:[{name:"action",type:"uint256",internalType:"uint256"}]},{type:"error",name:"V2InvalidPath",inputs:[]},{type:"error",name:"V2TooLittleReceived",inputs:[]},{type:"error",name:"V2TooMuchRequested",inputs:[]},{type:"error",name:"V3InvalidAmountOut",inputs:[]},{type:"error",name:"V3InvalidCaller",inputs:[]},{type:"error",name:"V3InvalidSwap",inputs:[]},{type:"error",name:"V3TooLittleReceived",inputs:[]},{type:"error",name:"V3TooMuchRequested",inputs:[]},{type:"error",name:"V4TooLittleReceived",inputs:[{name:"minAmountOutReceived",type:"uint256",internalType:"uint256"},{name:"amountReceived",type:"uint256",internalType:"uint256"}]},{type:"error",name:"V4TooMuchRequested",inputs:[{name:"maxAmountInRequested",type:"uint256",internalType:"uint256"},{name:"amountRequested",type:"uint256",internalType:"uint256"}]}];e.s(["universalRouterAbi",0,O],215202);let _=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"guy",type:"address"},{name:"wad",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"src",type:"address"},{name:"dst",type:"address"},{name:"wad",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"wad",type:"uint256"}],name:"withdraw",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"dst",type:"address"},{name:"wad",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[],name:"deposit",outputs:[],payable:!0,stateMutability:"payable",type:"function"},{constant:!0,inputs:[{name:"",type:"address"},{name:"",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"src",type:"address"},{indexed:!0,name:"guy",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"src",type:"address"},{indexed:!0,name:"dst",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"dst",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"src",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"}];(t=a||(a={}))[t.V3_SWAP_EXACT_IN=0]="V3_SWAP_EXACT_IN",t[t.V3_SWAP_EXACT_OUT=1]="V3_SWAP_EXACT_OUT",t[t.PERMIT2_TRANSFER_FROM=2]="PERMIT2_TRANSFER_FROM",t[t.SWEEP=4]="SWEEP",t[t.PAY_PORTION=6]="PAY_PORTION",t[t.V2_SWAP_EXACT_IN=8]="V2_SWAP_EXACT_IN",t[t.V2_SWAP_EXACT_OUT=9]="V2_SWAP_EXACT_OUT",t[t.PERMIT2_PERMIT=10]="PERMIT2_PERMIT",t[t.WRAP_ETH=11]="WRAP_ETH",t[t.UNWRAP_WETH=12]="UNWRAP_WETH",t[t.V4_SWAP=16]="V4_SWAP";let M={[a.V3_SWAP_EXACT_IN]:[{type:"address"},{type:"uint256"},{type:"uint256"},{type:"bytes"},{type:"bool"}],[a.V3_SWAP_EXACT_OUT]:[{type:"address"},{type:"uint256"},{type:"uint256"},{type:"bytes"},{type:"bool"}],[a.PERMIT2_PERMIT]:[{name:"permit",type:"tuple",components:[{name:"details",type:"tuple",components:[{name:"token",type:"address"},{name:"amount",type:"uint160"},{name:"expiration",type:"uint48"},{name:"nonce",type:"uint48"}]},{name:"spender",type:"address"},{name:"sigDeadline",type:"uint256"}]},{type:"bytes"}
1],[a.PERMIT2_TRANSFER_FROM]:[{type:"address"},{type:"address"},{type:"uint256"}],[a.V4_SWAP]:[{type:"bytes"},{type:"bytes[]"}],[a.WRAP_ETH]:[{type:"address"},{type:"uint256"}],[a.UNWRAP_WETH]:[{type:"address"},{type:"uint256"}],[a.V2_SWAP_EXACT_IN]:[{type:"address"},{type:"uint256"},{type:"uint256"},{type:"address[]"},{type:"bool"}],[a.V2_SWAP_EXACT_OUT]:[{type:"address"},{type:"uint256"},{type:"uint256"},{type:"address[]"},{type:"bool"}],[a.SWEEP]:[{type:"address"},{type:"address"},{type:"uint256"}],[a.PAY_PORTION]:[{type:"address"},{type:"address"},{type:"uint256"}]};class L{constructor(){this.commands="0x",this.inputs=[]}addCommand(e,t){let n=(0,k.encodeAbiParameters)(M[e],t);return this.commands+=e.toString(16).padStart(2,"0"),this.inputs.push(n),this}addPermit2Permit(e,t){return this.addCommand(a.PERMIT2_PERMIT,[e,t])}addWrapEth(e,t){return this.addCommand(a.WRAP_ETH,[e,t])}addUnwrapWeth(e,t){return this.addCommand(a.UNWRAP_WETH,[e,t])}addV3SwapExactIn(e,t,n,i,r){return this.addCommand(a.V3_SWAP_EXACT_IN,[e,t,n,i,r])}addV3SwapExactOut(e,t,n,i,r){return this.addCommand(a.V3_SWAP_EXACT_OUT,[e,t,n,i,r])}addPermit2TransferFrom(e,t,n){return this.addCommand(a.PERMIT2_TRANSFER_FROM,[e,t,n])}addV2SwapExactIn(e,t,n,i,r){return this.addCommand(a.V2_SWAP_EXACT_IN,[e,t,n,i,r])}addV2SwapExactOut(e,t,n,i,r){return this.addCommand(a.V2_SWAP_EXACT_OUT,[e,t,n,i,r])}addV4Swap(e,t){return this.addCommand(a.V4_SWAP,[e,t])}addSweep(e,t,n){return this.addCommand(a.SWEEP,[e,t,n])}addPayPortion(e,t,n){return this.addCommand(a.PAY_PORTION,[e,t,n])}build(){return[this.commands,this.inputs]}}var F=e.i(570635);(0,F.parseAbi)(["function allowance(address user, address token, address spender) external view returns (uint160 amount, uint48 expiration, uint48 nonce)"]),(n=i||(i={}))[n.INCREASE_LIQUIDITY=0]="INCREASE_LIQUIDITY",n[n.DECREASE_LIQUIDITY=1]="DECREASE_LIQUIDITY",n[n.MINT_POSITION=2]="MINT_POSITION",n[n.BURN_POSITION=3]="BURN_POSITION",n[n.INCREASE_LIQUIDITY_FROM_DELTAS=4]="INCREASE_LIQUIDITY_FROM_DELTAS",n[n.MINT_POSITION_FROM_DELTAS=5]="MINT_POSITION_FROM_DELTAS",n[n.SWAP_EXACT_IN_SINGLE=6]="SWAP_EXACT_IN_SINGLE",n[n.SWAP_EXACT_IN=7]="SWAP_EXACT_IN",n[n.SWAP_EXACT_OUT_SINGLE=8]="SWAP_EXACT_OUT_SINGLE",n[n.SWAP_EXACT_OUT=9]="SWAP_EXACT_OUT",n[n.SETTLE=11]="SETTLE",n[n.SETTLE_ALL=12]="SETTLE_ALL",n[n.TAKE=14]="TAKE",n[n.TAKE_ALL=15]="TAKE_ALL",n[n.TAKE_PORTION=16]="TAKE_PORTION",n[n.CLOSE_CURRENCY=18]="CLOSE_CURRENCY",n[n.SWEEP=20]="SWEEP",n[n.WRAP=21]="WRAP",n[n.UNWRAP=22]="UNWRAP";let U={name:"poolKey",type:"tuple",components:[{name:"currency0",type:"address"},{name:"currency1",type:"address"},{name:"fee",type:"uint24"},{name:"tickSpacing",type:"int24"},{name:"hooks",type:"address"}]},q=[{name:"intermediateCurrency",type:"address"},{name:"fee",type:"uint256"},{name:"tickSpacing",type:"int24"},{name:"hooks",type:"address"},{name:"hookData",type:"bytes"}],B={[i.INCREASE_LIQUIDITY]:[{type:"uint256"},{type:"uint256"},{type:"uint128"},{type:"uint128"},{type:"bytes"}],[i.DECREASE_LIQUIDITY]:[{type:"uint256"},{type:"uint256"},{type:"uint128"},{type:"uint128"},{type:"bytes"}],[i.MINT_POSITION]:[U,{type:"int24"},{type:"int24"},{type:"uint256"},{type:"uint128"},{type:"uint128"},{type:"address"},{type:"bytes"}],[i.BURN_POSITION]:[{type:"uint256"},{type:"uint128"},{type:"uint128"},{type:"bytes"}],[i.INCREASE_LIQUIDITY_FROM_DELTAS]:[{type:"uint256"},{type:"uint128"},{type:"uint128"},{type:"bytes"}],[i.MINT_POSITION_FROM_DELTAS]:[U,{type:"int24"},{type:"int24"},{type:"uint128"},{type:"uint128"},{type:"address"},{type:"bytes"}],[i.SWAP_EXACT_IN_SINGLE]:[{name:"swapParams",type:"tuple",components:[U,{name:"zeroForOne",type:"bool"},{name:"amountIn",type:"uint128"},{name:"amountOutMinimum",type:"uint128"},{name:"hookData",type:"bytes"}]}],[i.SWAP_EXACT_IN]:[{name:"swapParams",type:"tuple",components:[{name:"currencyIn",type:"address"},{name:"path",type:"tuple[]",components:q},{name:"amountIn",type:"uint128"},{name:"amountOutMinimum",type:"uint128"}]}],[i.SWAP_EXACT_OUT_SINGLE]:[{name:"swapParams",type:"tuple",components:[U,{name:"zeroForOne",type:"bool"},{name:"amountOut",type:"uint128"},{name:"amountInMaximum",type:"uint128"},{name:"hookData",type:"bytes"}]}],[i.SWAP_EXACT_OUT]:[{name:"swapParams",type:"tuple",components:[{name:"currencyOut",type:"address"},{name:"path",type:"tuple[]",components:q},{name:"amountOut",type:"uint128"},{name:"amountInMaximum",type:"uint128"}]}],[i.SETTLE]:[{type:"address"},{type:"uint256"},{type:"bool"}],[i.SETTLE_ALL]:[{type:"address"},{type:"uint256"}],[i.TAKE]:[{type:"address"},{type:"address"},{type:"uint256"}],[i.TAKE_ALL]:[{type:"address"},{type:"uint256"}],[i.TAKE_PORTION]:[{type:"address"},{type:"address"},{type:"uint256"}],[i.CLOSE_CURRENCY]:[{type:"address"}],[i.SWEEP]:[{type:"address"},{type:"address"}],[i.WRAP]:[{type:"uint256"}],[i.UNWRAP]:[{type:"uint256"}]};class V{constructor(){this.actions="0x",this.inputs=[]}addAction(e,t){let n=(0,k.encodeAbiParameters)(B[e],t);return this.actions+=e.toString(16).padStart(2,"0"),this.inputs.push(n),this}addSwapExactInSingle(e,t,n,a,r){return this.addAction(i.SWAP_EXACT_IN_SINGLE,[{poolKey:e,zeroF
1orOne:t,amountIn:n,amountOutMinimum:a,hookData:r}])}addSwapExactOutSingle(e,t,n,a,r){return this.addAction(i.SWAP_EXACT_OUT_SINGLE,[{poolKey:e,zeroForOne:t,amountOut:n,amountInMaximum:a,hookData:r}])}addWrap(e){return this.addAction(i.WRAP,[e])}addUnwrap(e){return this.addAction(i.UNWRAP,[e])}build(){return[this.actions,this.inputs]}}var j=e.i(990337),$=e.i(303028);let K=BigInt("0x8000000000000000000000000000000000000000000000000000000000000000");var H=e.i(52805),W=e.i(901834),z=e.i(296407),Q=e.i(581933);let G=(0,R.parseAbiParameters)("address,uint256,uint256,bytes,bool,bytes"),X=(0,R.parseAbiParameters)("address,uint256,uint256,address[],bool,bytes"),Y=(0,R.parseAbiParameters)("bytes,bytes[]"),Z=(0,R.parseAbiParameters)("((address,address,uint24,int24,address),bool,uint128,uint128,uint256,bytes)"),J=(0,R.parseAbiParameters)("address,uint256,bool"),ee=(0,R.parseAbiParameters)("address,uint256"),et=(0,R.parseAbiParameters)("address,address,uint256");function en(e){return e===s.CHAIN_IDS.ROBINHOOD.reference||e===s.CHAIN_IDS.ARC.reference}function ea(e,t,n){return e.commands=(0,z.concatHex)([e.commands,(0,Q.numberToHex)(t,{size:1})]),e.inputs.push(n),e}function ei(e,t){let n=(0,k.encodeAbiParameters)(G,[t.recipient,t.amountIn,t.amountOutMinimum,t.path,t.payerIsMsgSender,"0x"]);return ea(e,a.V3_SWAP_EXACT_IN,n)}function er(e,t){let n=(0,k.encodeAbiParameters)(X,[t.recipient,t.amountIn,t.amountOutMinimum,t.path,t.payerIsMsgSender,"0x"]);return ea(e,a.V2_SWAP_EXACT_IN,n)}class es{actions="0x";inputs=[];addAction(e,t){if(this.actions=(0,z.concatHex)([this.actions,(0,Q.numberToHex)(e,{size:1})]),e===i.SETTLE){let[e,n,a]=t;return this.inputs.push((0,k.encodeAbiParameters)(J,[e,n,a])),this}if(e===i.SETTLE_ALL){let[e,n]=t;return this.inputs.push((0,k.encodeAbiParameters)(ee,[e,n])),this}if(e===i.TAKE){let[e,n,a]=t;return this.inputs.push((0,k.encodeAbiParameters)(et,[e,n,a])),this}throw Error(`universal-router-211:v4-action-unsupported:${e}`)}addSwapExactInSingle(e,t,n,a,r){return this.actions=(0,z.concatHex)([this.actions,(0,Q.numberToHex)(i.SWAP_EXACT_IN_SINGLE,{size:1})]),this.inputs.push((0,k.encodeAbiParameters)(Z,[[[e.currency0,e.currency1,e.fee,e.tickSpacing,e.hooks],t,n,a,0n,r]])),this}build(){return[this.actions,this.inputs]}}function eo(e,t,n){return ea(e,a.V4_SWAP,(0,k.encodeAbiParameters)(Y,[t,n]))}e.s(["UniversalRouter211V4ActionBuilder",0,es,"addV2SwapExactIn211",0,er,"addV3SwapExactIn211",0,ei,"addV4Swap211",0,eo,"isUniversalRouter211Chain",0,en],36305);let el=(e,t)=>
1{(0,W.isProduction)()||console.log(`[route-command-debug] ${e}`,t)};function eu(e){return!!e&&0!==e.length&&1===new Set(e.map(e=>e.protocol)).size&&("v4"!==e[0].protocol||1===e.length)}function ed(e){let{route:t,amountOut:n,amountInMaximum:r,account:s,universalRouterAddress:o,weth:l,permit:u,permitSignature:d}=e,p=(0,H.requireEvmAddress)(l,"WETH address");if(!t||0===t.length)throw Error("swap-route:empty-route");let y=new L,c=t[0],m=(0,H.requireEvmAddress)(c.fromToken,"route input token").toLowerCase()===p.toLowerCase(),T=!m;if(m&&y.addWrapEth(o,r),T&&u&&d&&y.addPermit2Permit(u,d),!eu(t)){if(1===new Set(t.map(e=>e.protocol)).size&&"v4"===t[0].protocol)throw Error("swap-route:exact-out-v4-multihop-unsupported");throw Error("swap-route:exact-out-mixed-route-unsupported")}let f=t[0].protocol;if("v4"===f){let e=t[0],a=new V,s=(0,H.requireEvmAddress)(e.fromToken,"V4 input token");T||a.addAction(i.SETTLE,[s,r,!1]),a.addSwapExactOutSingle(e.poolKey,e.zeroForOne,n,r,"0x"),T&&a.addAction(i.SETTLE_ALL,[s,$.maxUint256]),a.addAction(i.TAKE,[(0,H.requireEvmAddress)(e.toToken,"V4 output token"),o,n]),a.addAction(i.TAKE,[s,o,0n]);let[l,u]=a.build();y.addV4Swap(l,u)}else if("v3"===f)y.addV3SwapExactOut(o,n,r,(e=>{let t=[],n=[],a=[...e].reverse();for(let e of(t.push("address"),n.push((0,H.requireEvmAddress)(a[0].toToken,"V3 route output token")),a))t.push("uint24","address"),n.push(e.fee,(0,H.requireEvmAddress)(e.fromToken,"V3 route input token"));return(0,j.encodePacked)(t,n)})(t),T);else{let e=1===t.length?[(0,H.requireEvmAddress)(t[0].fromToken,"V2 route input token"),(0,H.requireEvmAddress)(t[0].toToken,"V2 route output token")]:t.map(e=>(0,H.requireEvmAddress)(e.fromToken,"V2 route input token"));t.length>1&&e.push((0,H.requireEvmAddress)(t[t.length-1].toToken,"V2 route output token")),y.addV2SwapExactOut(o,n,r,e,T)}
1let h=(0,H.requireEvmAddress)(t[t.length-1].toToken,"final output token");h.toLowerCase()===p.toLowerCase()?y.addUnwrapWeth(s,n):y.addCommand(a.SWEEP,[h,s,0n]),m&&y.addUnwrapWeth(s,0n);let b=y.build();return el("built-exact-out",{routeKind:t.map(e=>e.protocol).join("->"),finalRecipient:s,payerMode:T?"user":"router",commandBytes:Math.max(0,(b[0].length-2)/2),inputsCount:b[1].length}),b}function ep(e){let{route:t,amountIn:n,minAmountOut:r,account:s,universalRouterAddress:o,weth:l,chainId:u,permit:d,permitSignature:p}=e,y=(0,H.requireEvmAddress)(s,"account address"),c=(0,H.requireEvmAddress)(o,"universal router address"),m=(0,H.requireEvmAddress)(l,"WETH address"),T=en(u);if(!t||0===t.length)throw Error("swap-route:empty-route");let f=new L,h=t[0],b=(h.protocol,h.fromToken).toLowerCase()===m.toLowerCase(),g=!b;b&&f.addWrapEth(c,n),g&&d&&p&&f.addPermit2Permit(d,p);let v=(e,t,n)=>(0,j.encodePacked)(["address","uint24","address"],[e,n,t]),w=0;for(;w<t.length;){let e=t[w];if("v4"===e.protocol){let e=T?new es:new V,a=0===w&&g,s=w;if(!a){let n=t[s].fromToken;e.addAction(i.SETTLE,[(0,H.requireEvmAddress)(n,"V4 input token"),K,!1])}if(a){let a=t[s],o=1===t.length?r:0n;e.addSwapExactInSingle(a.poolKey,a.zeroForOne,n,o,"0x"),e.addAction(i.SETTLE_ALL,[(0,H.requireEvmAddress)(a.fromToken,"V4 input token"),$.maxUint256]),s+=1}for(;s<t.length&&"v4"===t[s].protocol;s++){let n=t[s],a=s===t.length-1?r:0n;e.addSwapExactInSingle(n.poolKey,n.zeroForOne,0n,a,"0x")}let o=t[s-1].toToken;e.addAction(i.TAKE,[(0,H.requireEvmAddress)(o,"V4 output token"),c,0n]);let[l,u]=e.build();T?eo(f,l,u):f.addV4Swap(l,u),w=s;continue}if("v3"===e.protocol){let e=w,a=0===e&&g;for(;e<t.length&&"v3"===t[e].protocol;e++){let i=t[e],s=e===w,o=s&&a?n:K,l=s&&a,u=e===t.length-1?r:0n,d=v((0,H.requireEvmAddress)(i.fromToken,"V3 route input token"),(0,H.requireEvmAddress)(i.toToken,"V3 route output token"),i.fee);T?ei(f,{recipient:c,amountIn:o,amountOutMinimum:u,path:d,payerIsMsgSender:l}):f.addV3SwapExactIn(c,o,u,d,l)}w=e;continue}if("v2"===e.protocol){let e=w,a=0===e&&g;for(;e<t.length&&"v2"===t[e].protocol;e++){let i=t[e],s=e===w,o=s&&a?n:K,l=s&&a,u=e===t.length-1?r:0n,d=[(0,H.requireEvmAddress)(i.fromToken,"V2 route input token"),(0,H.requireEvmAddress)(i.toToken,"V2 route output token")];T?er(f,{recipient:c,amountIn:o,amountOutMinimum:u,path:d,payerIsMsgSender:l}):f.addV2SwapExactIn(c,o,u,d,l)}w=e;continue}}let x=t[t.length-1],I=(x.protocol,x.toToken);I.toLowerCase()===m.toLowerCase()?f.addUnwrapWeth(y,r):f.addCommand(a.SWEEP,[(0,H.requireEvmAddress)(I,"final output token"),y,0n]);let S=f.build();return el("built",{routeKind:t.map(e=>e.protocol).join("->"),finalRecipient:y,payerMode:g?"user":"router",commandBytes:Math.max(0,(S[0].length-2)/2),inputsCount:S[1].length}),S}e.s(["buildRouteSwapCommands",0,ep,"buildRouteSwapExactOutCommands",0,ed,"isRouteExactOutputSupported",0,eu],116193);var ey=e.i(153229),ec=e.i(444220),em=e.i(211207),eT=e.i(453341),ef=e.i(425152),eh=e.i(832356);let eb=eh.z.custom(e=>"string"==typeof e&&(0,ef.isAddress)(e)),eg=eh.z.object({currency0:eb,currency1:eb}),ev=eh.z.discriminatedUnion("kind",[eh.z.object({kind:eh.z.literal("v4"),poolKey:eg.extend({fee:eh.z.number().int().min(0).max(8388608),tickSpacing:eh.z.number().int().min(1).max(32767),hooks:eb})}),eg.extend({kind:eh.z.literal("v3"),address:eb,fee:eh.z.number().int().min(1).max(1e6)}),eg.extend({kind:eh.z.literal("v2"),address:eb})]);class ew extends Error{constructor(e){super(e),this.name="CompatibilitySwapError"}}let ex=(e,t)=>e.toLowerCase()===t?.toLowerCase();function eI(e,t){let n=(0,d.getCompatibilityDeployment)(e)?.addresses[t];if(!n||n===o.zeroAddress)throw new ew(`This chain has no verified ${t} deployment for this operation.`);return n}async function eS(e,t){let{chainId:n}=t;if("universal-router-2"!==t.routerEncoding)throw new ew("This router's transaction encoding is not supported.");if(await e.getChainId()!==n)throw new ew("The RPC network does not match this token.");await Promise.all(["Airlock","UniversalRouter","Permit2"].map(async n=>{let a=await e.getCode({address:eC(t,n)});if(!a||"0x"===a)throw new ew(`The ${n} deployment is unavailable.`)}))}function eC(e,t){let n=e.addresses[t];if(!n||n===o.zeroAddress)throw new ew(`This chain has no verified ${t} deployment for this operation.`);return n}e.s(["CompatibilitySwapError",0,ew,"compatibilityPoolSchema",0,ev,"sameCompatibilityAddress",0,ex],916190),e.s(["requireCompatibilityAddress",0,eI,"requireDeploymentAddress",0,eC,"verifyCompatibilityContracts",0,eS],683208);var eE=e.i(344940),ek=e.i(245522);let eA=(0,F.parseAbi)(["function owner() view returns (address)","function poolManager() view returns (address)","function initializer() view returns (address)","function factory() view returns (address)","function weth() view returns (address)","function getPair(address,address) view returns (address)","function getPool(address,address,uint24) view returns (address)"]),eR=(0,F.parseAbi)(["function getState(address) view returns (address asset,address numeraire,int24 tickLower,int24 tickUpper,uint256 maxShareToBeSold,uint256 totalTokensOnBondingCurve,uint8 status)"]),eD=(0,F.parseAbi)(["function getAssetData(address,address) view returns (bool isToken0, (address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,uint32 lockDuration,uint24 feeOrInitialDynamicFee,bool useDynamicFee,address dopplerHook,bytes onInitializationCalldata,uint8 status)"]),eN=(0,F.parseAbi)(["function token0() view returns (address)","function token1() view returns (address)","function getReserves() view returns (uint112 reserve0,uint112 reserve1,uint32 blockTimestampLast)"]),eP=(0,F.parseAbi)(["function allowance(address owner,address token,address spender) view returns (uint160 amount,uint48 expiration,uint48 nonce)","function approve(address token,address spender,uint160 amount,uint48 expiration)"]);function eO(e,t,n){let a=[t.toLowerCase(),n.toLowerCase()].sort();if(e.currency0.toLowerCase()!==a[0]||e.currency1.toLowerCase()!==a[1])throw new ew("Pool currencies do not match this token and its paired currency.")}async function e_(e,t){let{client:n,chainId:a,blockNumber:i}=e;if(!ex(await n.readContract({address:t,abi:eA,functionName:"poolManager",blockNumber:i}),eI(a,"PoolManager")))throw new ew("This pool uses an unsupported pool manager.")}async function eM(e){let{client:t,chainId:n,address:a,asset:i,blockNumber:r}=e,[s,,,u,p,y]=i,c=(0,d.getCompatibilityDeployment)(n)?.addresses;if(![c?.NoOpMigrator,c?.DopplerHookMigrator,c?.UniswapV2MigratorSplit].some(e=>ex(u,e)))throw new ew("This migration route is not supported.");
1if(ex(u,c?.DopplerHookMigrator)){let[n,i]=BigInt(a)<BigInt(s)?[a,s]:[s,a],l=await t.readContract({address:u,abi:eD,functionName:"getAssetData",args:[n,i],blockNumber:r});if(2===l[7]){if(eO(l[1],a,s),!ex(l[1].hooks,u)||l[5]!==o.zeroAddress)throw new ew("This migrated pool's hook configuration is not supported.");return await e_(e,u),{pool:ev.parse({kind:"v4",poolKey:l[1]}),lifecycle:"migrator:locked",buyEnabled:!0}}if(1!==l[7])throw new ew("The migration lifecycle is unavailable.")}if(ex(p,c?.DopplerHookInitializer)){let n=await t.readContract({address:p,abi:l.dopplerHookInitializerAbi,functionName:"getState",args:[a],blockNumber:r});if(4===n[4])return eF(e);if(![1,2,3].includes(n[4]))throw new ew("This pool is not active.");eO(n[5],a,s);let i=n[2]===o.zeroAddress||ex(n[2],c?.RehypeDopplerHookInitializer);if(!ex(n[5].hooks,p)||!i)throw new ew("This pool's hook configuration is not supported.");return await e_(e,p),{pool:ev.parse({kind:"v4",poolKey:n[5]}),lifecycle:`initializer:${n[4]}:${n[2]}`,buyEnabled:!0}}if(ex(p,c?.UniswapV4Initializer))return eL(e);if(ex(p,c?.LockableUniswapV3Initializer)){let i=await t.readContract({address:p,abi:eR,functionName:"getState",args:[y],blockNumber:r});if(!ex(i[0],a)||!ex(i[1],s))throw new ew("Pool initializer state does not match this token.");if(3===i[6])return eF(e);if(![1,2].includes(i[6]))throw new ew("This pool is not active.");let[o,u,d,c]=await Promise.all([t.readContract({address:y,abi:l.uniswapV3PoolAbi,functionName:"token0",blockNumber:r}),t.readContract({address:y,abi:l.uniswapV3PoolAbi,functionName:"token1",blockNumber:r}),t.readContract({address:y,abi:l.uniswapV3PoolAbi,functionName:"fee",blockNumber:r}),t.readContract({address:y,abi:eA,functionName:"factory",blockNumber:r})]);if(eO({currency0:o,currency1:u},a,s),!ex(c,eI(n,"UniswapV3Factory")))throw new ew("This V3 factory is not supported.");if(!ex(await t.readContract({address:c,abi:eA,functionName:"getPool",args:[o,u,d],blockNumber:r}),y))throw new ew("The V3 pool identity could not be verified.");return{pool:ev.parse({kind:"v3",address:y,currency0:o,currency1:u,fee:d}),lifecycle:`v3:${i[6]}`,buyEnabled:!0}}throw new ew("This pool initializer is not supported for direct swaps.")}async function eL(e){let{client:t,chainId:n,address:a,asset:i,blockNumber:r}=e,[s,o,,,u,d]=i,[p,y,c,m,T]=await Promise.all([t.readContract({address:a,abi:eA,functionName:"owner",blockNumber:r}),t.readContract({address:d,abi:l.dopplerHookAbi,functionName:"poolKey",blockNumber:r}),t.readContract({address:d,abi:l.dopplerHookAbi,functionName:"earlyExit",blockNumber:r}),t.readContract({address:d,abi:l.dopplerHookAbi,functionName:"insufficientProceeds",blockNumber:r}),t.readContract({address:d,abi:eA,functionName:"initializer",blockNumber:r})]);if(!ex(T,u))throw new ew("The dynamic hook's initializer does not match.");let[f,h,b,g,v]=y;if(eO({currency0:f,currency1:h},a,s),!ex(v,d))throw new ew("The dynamic pool hook does not match.");if(await e_(e,d),!ex(p,eI(n,"Airlock"))){if(!ex(p,o))throw new ew("The dynamic auction's ownership is unrecognized.");return eF(e)}if(c)throw new ew("This auction is waiting for migration.");return{pool:ev.parse({kind:"v4",poolKey:{currency0:f,currency1:h,fee:b,tickSpacing:g,hooks:v}}),lifecycle:`dynamic:${m}`,buyEnabled:!m}}async function eF(e){let{client:t,chainId:n,address:a,asset:i,blockNumber:r}=e,[s,,,l,,,u]=i;if(!ex(l,(0,d.getCompatibilityDeployment)(n)?.addresses.UniswapV2MigratorSplit)||u===o.zeroAddress)throw new ew("This migration route is not supported.");let p=await t.readContract({address:l,abi:eA,functionName:"factory",blockNumber:r});if(!ex(p,eI(n,"UniswapV2Factory")))throw new ew("This V2 factory is not supported.");let y=s===o.zeroAddress?await t.readContract({address:l,abi:eA,functionName:"weth",blockNumber:r}):s;if(s===o.zeroAddress&&!ex(y,eI(n,"WrappedNative")))throw new ew("The wrapped native currency does not match.");let[c,m,T]=await Promise.all([t.readContract({address:u,abi:eN,functionName:"token0",blockNumber:r}),t.readContract({address:u,abi:eN,functionName:"token1",blockNumber:r}),t.readContract({address:p,abi:eA,functionName:"getPair",args:[a,y],blockNumber:r})]);
1if(eO({currency0:c,currency1:m},a,y),!ex(T,u))throw new ew("The V2 pool identity could not be verified.");return{pool:{kind:"v2",address:u,currency0:c,currency1:m},lifecycle:"v2:migrated",buyEnabled:!0}}async function eU(e,t,n){let a=e.chain;if(!a||a.id!==t)throw new ew("The RPC client network does not match this token.");let i=await e.getBlockNumber({cacheTime:0}),r=await e.readContract({address:eI(t,"Airlock"),abi:l.airlockAbi,functionName:"getAssetData",args:[n],blockNumber:i});if(r[4]===o.zeroAddress)throw new ew("No verified Doppler pool is available for this token.");let[s,u]=await Promise.all([e.readContract({address:eI(t,"Airlock"),abi:l.airlockAbi,functionName:"getModuleState",args:[r[4]],blockNumber:i}),e.readContract({address:eI(t,"Airlock"),abi:l.airlockAbi,functionName:"getModuleState",args:[r[3]],blockNumber:i})]);if(3!==s||4!==u)throw new ew("The pool's deployment modules are not currently enabled.");let{pool:d,lifecycle:p,buyEnabled:y}=await eM({client:e,chainId:t,address:n,asset:r,blockNumber:i}
1),c="v4"===d.kind?d.poolKey:d,m=c.currency0.toLowerCase()===n.toLowerCase()?c.currency1:c.currency0,T=async t=>{if(t===o.zeroAddress)return{address:t,symbol:a.nativeCurrency.symbol,decimals:a.nativeCurrency.decimals};let[n,r]=await Promise.all([e.readContract({address:t,abi:eE.erc20Abi,functionName:"symbol",blockNumber:i}),e.readContract({address:t,abi:eE.erc20Abi,functionName:"decimals",blockNumber:i})]);return{address:t,symbol:n,decimals:r}},[f,h]=await Promise.all([T(n),T(m)]),b=(0,ek.keccak256)((0,Q.stringToHex)(JSON.stringify([t,n.toLowerCase(),d,p,h.address.toLowerCase(),f.decimals,h.decimals])));return{...f,chainId:t,numeraire:h,pool:d,stateId:b,buyEnabled:y}}async function eq(e,t,n){if((0,d.getCompatibilityDeployment)(t)?.routerEncoding!=="universal-router-2")throw Error("The route has no verified router encoding");let a=await eU(e,t,n.asset),i=n.route.find(e=>[e.fromToken,e.toToken].some(e=>e.toLowerCase()===n.asset.toLowerCase()));if(!i||i.protocol!==a.pool.kind)throw Error("Pool changed; refresh the quote before swapping");let r=i.toToken.toLowerCase()===n.asset.toLowerCase();if(r&&!a.buyEnabled)throw Error("This pool is not accepting buys");if((r?i.fromToken:i.toToken).toLowerCase()!==a.numeraire.address.toLowerCase())throw Error("Pool currencies changed; refresh the quote");if("v4"===i.protocol&&"v4"===a.pool.kind){let e=a.pool.poolKey,t=i.poolKey;if(t.currency0.toLowerCase()!==e.currency0.toLowerCase()||t.currency1.toLowerCase()!==e.currency1.toLowerCase()||t.hooks.toLowerCase()!==e.hooks.toLowerCase()||t.fee!==e.fee||t.tickSpacing!==e.tickSpacing||i.zeroForOne!==(i.fromToken.toLowerCase()===e.currency0.toLowerCase()))throw Error("Pool key changed; refresh the quote")}if("v3"===i.protocol&&"v3"===a.pool.kind&&i.fee!==a.pool.fee)throw Error("Pool fee changed; refresh the quote");return a.stateId}e.s(["compatibilityMigratorAbi",0,eD,"compatibilityPermit2Abi",0,eP,"compatibilityStateAbi",0,eA,"compatibilityV2Abi",0,eN,"compatibilityV3StateAbi",0,eR],695171),e.s(["readCompatibilityToken",0,eU],90832),e.s(["verifyIndexedCompatibilityRoute",0,eq],901900);let eB=e=>[e.amountIn,e.minAmountOut,e.amountOut,e.amountInMaximum].map(String).join(":"),eV=(e,t)=>{(0,W.isProduction)()||console.log(`[swap-route-debug] ${e}`,t)};async function ej(e,t){let n=t(e);if(!n)return!1;let a=await n.getBlockNumber(),i=Date.now()+2e4;for(;Date.now()<i;)if(await new Promise(e=>setTimeout(e,1e3)),await n.getBlockNumber()>a)return!0;return!1}e.s(["useSwapRoute",0,function(e,t,n){var a;let i,o,u,d,p=(0,D.useGetPublicClient)(),{address:y,sendTransaction:c,switchChain:m}=(0,N.useWallet)(),T=(a={chainId:e,route:t,walletAddress:y,identity:n,client:e?p(e):void 0},i=(0,em.useConfig)(),o="string"==typeof a.identity?{assetAddress:a.identity,inputKey:"",quoteUpdatedAt:0}:a.identity,u=JSON.stringify([a.chainId,a.route,a.walletAddress?.toLowerCase(),o?.assetAddress,o?.inputKey]),d=(0,ec.useRef)(u),(0,ec.useLayoutEffect)(()=>(d.current=u,()=>{d.current=void 0}),[u]),async e=>{let{chainId:t,client:n,route:r}=a,l=void 0!==e.amountOut?"exactOut":"exactIn",p=C(t,r,l);if("unavailable"===p.provider)throw Error(p.reason);if(!p.deployment)return;if(!t)throw Error("Swaps are unavailable for this network.");if(!n||!o||!a.walletAddress)throw Error("A connected wallet and verified asset are required");if(!Number.isFinite(o.quoteUpdatedAt)||o.quoteUpdatedAt<=0)throw Error("A fresh quote is required");let y=o.quoteUpdatedAt+3e4,c=eB(e),m=e=>{if(d.current!==u||Date.now()>=y||eB(e)!==c||C(t,r,l).cacheKey!==p.cacheKey)throw Error("Swap quote changed or expired; refresh before continuing")};m(e);let T=(0,s.toEvmChainId)(t),f=async()=>{let e=await (0,eT.getWalletClient)(i,{chainId:T}),[t,n]=await Promise.all([e.getChainId(),e.getAddresses()]);if(t!==T||n[0]?.toLowerCase()!==a.walletAddress?.toLowerCase())throw Error("Wallet account or network changed; reconnect before continuing")};await f(),await eS(n,p.deployment);let h=await eq(n,T,{asset:o.assetAddress,route:r});return m(e),{expiresAt:y,capabilityKey:p.cacheKey,async verify(e){if(m(e),await f(),await eq(n,T,{asset:o.assetAddress,route:r})!==h)throw Error("Pool state changed; refresh the quote");await f(),m(e)}}}),f=async({amountIn:n,minAmountOut:a,amountOut:i,amountInMaximum:o,permit:u,permitSignature:d,followedFreshApproval:T,compatibilityGuard:f})=>{if(!y)throw Error(ey.ERROR_ACCOUNT_MUST_BE_CONNECTED);if(!c)throw Error(ey.ERROR_NO_TRANSACTION_METHOD);if(!t||0===t.length)throw Error("Route is required");if(!e)throw Error("Swap unavailable for this pool");let h=void 0!==i&&void 0!==o,b=C(e,t,h?"exactOut":"exactIn");
1if("unavailable"===b.provider)throw Error(b.reason);let g=(0,s.toEvmChainId)(e),{universalRouter:v,weth:w}=S(g);if(!v||v===l.ZERO_ADDRESS)throw Error(`No Universal Router address found for chain ${g}`);if(!w||w===l.ZERO_ADDRESS)throw Error(`WETH address not configured for chain ${g}`);let x=p(e),I={amountIn:n,minAmountOut:a,amountOut:i,amountInMaximum:o};if(b.deployment&&(!f||f.capabilityKey!==b.cacheKey))throw Error("Verify the swap quote before approving or submitting");await f?.verify(I);let E=h?o:n;if(void 0===E||E<=0n)throw Error(h?"Exact-output amountInMaximum is required":"Exact-input amountIn is required");let[k,R]=h?ed({route:t,amountOut:i,amountInMaximum:o,account:y,universalRouterAddress:v,weth:w,permit:u,permitSignature:d}):ep({route:t,amountIn:n,minAmountOut:a,account:y,universalRouterAddress:v,weth:w,chainId:g,permit:u,permitSignature:d}),D=BigInt(f?Math.floor(f.expiresAt/1e3):Math.floor(Date.now()/1e3)+1800),N=t[0].fromToken,P=N.toLowerCase()===w.toLowerCase(),_=N.toLowerCase()===l.ZERO_ADDRESS,M=P||_?E:0n;await m({chainId:e}),await f?.verify(I);let L={to:v,data:(0,A.encodeFunctionData)({abi:O,functionName:"execute",args:[k,R,D]}),...M>0n&&{value:M}},F=await (0,r.withRobinhoodTransactionFeeOverridesIfAvailable)({chainId:g,publicClient:x,request:L}),U=async()=>(await f?.verify(I),(await c(F)).hash),q=async()=>{if(await f?.verify(I),x)return x.estimateGas({account:y,...L})};eV("preflight",{chainId:e,walletAddress:y,txSender:y,followedFreshApproval:!!T,amountIn:E.toString(),minAmountOut:(h?i:a)?.toString(),ethValue:M.toString(),routeProtocols:t.map(e=>e.protocol)});try{let t=await q();eV("estimate-success",{chainId:e,txSender:y,estimatedGas:t?.toString()})}catch(t){if(eV("estimate-failed",{chainId:e,txSender:y,followedFreshApproval:!!T,error:t instanceof Error?t.message:String(t)}),T){let t=await ej(e,p);eV("estimate-retry-after-block",{chainId:e,txSender:y,sawNextBlock:t});try{let t=await q();return eV("estimate-retry-success",{chainId:e,txSender:y,estimatedGas:t?.toString()}),await U()}catch(t){throw eV("estimate-retry-failed",{chainId:e,txSender:y,error:t instanceof Error?t.message:String(t)}),Error(ey.ERROR_SWAP_APPROVAL_PROPAGATING)}}throw Error(ey.ERROR_SWAP_PREFLIGHT_FAILED)}return await U()};return{...(0,E.useMutation)({mutationFn:f,retry:!1}),prepareSwap:T}}],361309),e.s(["useBuyWithAcross",0,function(e,t,n,a){let i=(0,s.toEvmChainId)(e),{address:o,switchChain:u,sendTransaction:d}=(0,N.useWallet)(),p=(0,D.useSupportedPurchaseCurrencyChains)(),y=async({permit:y,permitSignature:c,minAmountOutAsset:m,minAmountOutAcross:T,exclusiveRelayer:f,quoteTimestamp:h,fillDeadline:b,exclusivityDeadline:g})=>{if(!o||!o.startsWith("0x"))throw Error(ey.ERROR_ACCOUNT_MUST_BE_CONNECTED);if(!d)throw Error(ey.ERROR_NO_TRANSACTION_METHOD);if(!a)throw Error("Source chain not supported");if(!t||0===t.length)throw Error("Route is required for bridge swap");let v=p.find(e=>(0,s.chainIdEquals)(e.id,a))?.spokePool,w=p.find(t=>(0,s.chainIdEquals)(t.id,e))?.spokePool;if(!v||!w)throw Error("Source chain not supported");let{universalRouter:x,weth:I}=(0,r.getDopplerAddresses)(i);if(!x||x===l.ZERO_ADDRESS)throw Error(`Universal Router not configured for chain ${i}`);if(!I||I===l.ZERO_ADDRESS)throw Error(`WETH address not configured for chain ${i}`);let[S,C]=ep({route:t,amountIn:T,minAmountOut:m,account:o,universalRouterAddress:x,weth:I,chainId:i,permit:y,permitSignature:c});try{let t=(0,k.encodeAbiParameters)((0,R.parseAbiParameters)("((address target, bytes callData, uint256 value)[], address fallbackRecipient)"),[[[{target:I,callData:(0,A.encodeFunctionData)({abi:_,functionName:"withdraw",args:[T]}),value:0n},{target:x,callData:(0,A.encodeFunctionData)({abi:O,functionName:"execute",args:[S,C]}),value:T}],o]]);await u({chainId:a}),await new Promise(e=>setTimeout(e,500));let r=p.find(e=>(0,s.chainIdEquals)(e.id,a)),l=p.find(t=>(0,s.chainIdEquals)(t.id,e)),y={address:v,abi:P,functionName:"depositV3",args:[o,l?.acrossMulticallHandler,r?.nativeToken,l?.nativeToken,n,T,i,f,h,b,g,t],account:o,value:n},c=(0,A.encodeFunctionData)({abi:y.abi,functionName:y.functionName,args:y.args});return(await d({to:y.address,value:y.value,data:c})).hash}catch(e){throw console.log("error",e),e}};return(0,E.useMutation)({mutationFn:y,retry:!1})}],481825),e.s(["getDrift",0,function(e,t,n){if(!t)throw Error(`No public client found for chainId: ${e}`);return{read:({address:e,abi:n,fn:a,args:i})=>t.readContract({address:e,abi:n,functionName:a,args:i})}}],487855),e.s(["getPoolQuoterType",0,function(e){var t;let n=e.address?e.address.length:0,a=!!(t=e.address)&&64===(t.startsWith("0x")?t.slice(2):t).length;if(e.asset?.migrated)return{quoterType:"V2_QUOTER",reason:"Pool is graduated/migrated",isZoraPool:!1,addressLength:n};if("v4"===e.type)if(a)return{quoterType:"UNISWAP_V4_QUOTER",reason:`Zora V4 pool (32-byte poolId address: ${n} chars)`,isZoraPool:!0,addressLength:n};else return{quoterType:"DOPPLER_V4_QUOTER",reason:`Doppler V4 pool (20-byte hook address: ${n} chars)`,isZoraPool:!1,addressLength:n};return{quoterType:"V3_QUOTER",reason:"V3 pool",isZoraPool:!1,addressLength:n}}],619464)},379681,539228,853293,e=>{"use strict";var t=e.i(261526),n=e.i(444220),a=e.i(286879),i=e.i(29529);e.i(487855);var r=e.i(131981),s=e.i(786516),o=e.i(899582);e.i(831368);var l=e.i(52805);e.i(619464);var u=e.i(630136);async function d(e){let{uniswapV4Quoter:t,dopplerQuoter:n,poolKey:a,zeroForOne:i,exactAmount:r}=e;try{let e=await t.quoteExactInputV4Quoter({poolKey:a,zeroForOne:i,exactAmount:r,hookData:"0x"}),n=e?.amountOut??0n;if(n>0n)return n}catch{}try{let e=await n.quoteExactInputV4({poolKey:a,zeroForOne:i,exactAmount:r,hookData:"0x"});return e?.amountOut??0n}catch{return 0n}}var p=e.i(340550),y=e.i(412682),c=e.i(570635),m=e.i(276812);let T=(0,c.parseAbi)(["function factory() view returns (address)","function getPair(address,address) view returns (address)"]),f=(0,c.parseAbi)(["function getReserves() view returns (uint112,uint112,uint32)","function token0() view returns (address)","function token1() view returns (address)"]);async function h(e,t,n){let a=t.UniswapV2Factory;if(!a||a===m.zeroAddress)throw Error("V2 factory deployment unavailable");if(t.UniswapV2MigratorSplit&&(await e.readContract({address:t.UniswapV2MigratorSplit,abi:T,functionName:"factory"})).toLowerCase()!==a.toLowerCase())throw Error("V2 migrator factory mismatch");if(2!==n.path.length)throw Error("Indexed V2 quotes require one hop");let[i,r]=n.path,s=await e.readContract({address:a,abi:T,functionName:"getPair",args:[i,r]});if(s===m.zeroAddress)throw Error("V2 pair unavailable");let[o,l,u]=await Promise.all([e.readContract({address:s,abi:f,functionName:"getReserves"}),e.readContract({address:s,abi:f,functionName:"token0"}),e.readContract({address:s,abi:f,functionName:"token1"})]),d=i.toLowerCase()===l.toLowerCase();if((d?u:l).toLowerCase()!==r.toLowerCase()||(d?l:u).toLowerCase()!==i.toLowerCase())throw Error("V2 pair currencies mismatch");let[p,y]=d?[o[0],o[1]]:[o[1],o[0]];if(p<=0n||y<=0n)throw Error("V2 pair has no liquidity");if(n.exactOutput){if(n.amount>=y)throw Error("V2 output exceeds reserves");return[p*n.amount*1000n/((y-n.amount)*997n)+1n,n.amount]}let c=997n*n.amount;return[n.amount,c*y/(1000n*p+c)]}var b=e.i(958774);function g(e,t){let n=(0,b.resolveQuoteCapability)(e);switch(n.provider){case"unavailable":return;case"local":{var a;
1let i,s,l=t((0,r.fromEvmNumericId)(e.chainId));return l?(a=n.deployment.addresses,i=async e=>{if(!a.UniswapV4Quoter)throw Error("V4 quoter deployment unavailable");let t=e.hookData??"0x";if(!(0,y.isHex)(t))throw Error("Invalid V4 hook data");let{result:n}=await l.simulateContract({address:a.UniswapV4Quoter,abi:o.v4QuoterAbi,functionName:"quoteExactInputSingle",args:[{...e,hookData:t}]});return{amountOut:n[0],gasEstimate:n[1]}},{quoteExactInputV4:i,quoteExactOutputV4:s=async e=>{if(!a.UniswapV4Quoter)throw Error("V4 quoter deployment unavailable");let t=e.hookData??"0x";if(!(0,y.isHex)(t))throw Error("Invalid V4 hook data");let{result:n}=await l.simulateContract({address:a.UniswapV4Quoter,abi:o.v4QuoterAbi,functionName:"quoteExactOutputSingle",args:[{...e,hookData:t}]});return{amountIn:n[0],gasEstimate:n[1]}},quoteExactInputV4Quoter:i,quoteExactOutputV4Quoter:s,async quoteExactInputV3(e){if(!a.UniswapV3Quoter)throw Error("V3 quoter deployment unavailable");let{result:t}=await l.simulateContract({address:a.UniswapV3Quoter,abi:o.quoterV2Abi,functionName:"quoteExactInputSingle",args:[{...e,sqrtPriceLimitX96:e.sqrtPriceLimitX96??0n}]});return{amountOut:t[0],sqrtPriceX96After:t[1],initializedTicksCrossed:t[2],gasEstimate:t[3]}},async quoteExactOutputV3(e){if(!a.UniswapV3Quoter)throw Error("V3 quoter deployment unavailable");let{result:t}=await l.simulateContract({address:a.UniswapV3Quoter,abi:o.quoterV2Abi,functionName:"quoteExactOutputSingle",args:[{tokenIn:e.tokenIn,tokenOut:e.tokenOut,amount:e.amountOut,fee:e.fee,sqrtPriceLimitX96:e.sqrtPriceLimitX96??0n}]});return{amountIn:t[0],sqrtPriceX96After:t[1],initializedTicksCrossed:t[2],gasEstimate:t[3]}},quoteExactInputV2:async e=>h(l,a,{path:e.path,amount:e.amountIn,exactOutput:!1}),quoteExactOutputV2:async e=>h(l,a,{path:e.path,amount:e.amountOut,exactOutput:!0})}):void 0}case"sdk":{let n=t((0,r.fromEvmNumericId)(e.chainId));return n?(0,p.createDopplerQuoter)(e.chainId,()=>n):void 0}}}function v(e,t,n){let a={chainId:(e?(0,r.tryEvmChainId)(e):void 0)??-1,source:"indexed",mode:n},i=(0,b.resolveQuoteCapability)(a);for(let e of t){let t=(0,b.resolveQuoteCapability)({...a,protocol:e.protocol});if("unavailable"===t.provider)return t}return i}async function w({quoter:e,chainId:t,amountIn:n,route:a}){if(!e||!t||!n||n<=0n||!a||0===a.length)return 0n;let i=n;for(let t of a){if(i<=0n)return 0n;if("v4"===t.protocol){let n=(0,u.normalizePoolKey)(t.poolKey);if(!n)return 0n;i=await d({uniswapV4Quoter:e,dopplerQuoter:e,poolKey:n,zeroForOne:t.zeroForOne,exactAmount:i})}else if("v3"===t.protocol){let n=await e.quoteExactInputV3({tokenIn:(0,l.requireEvmAddress)(t.fromToken,"route input token"),tokenOut:(0,l.requireEvmAddress)(t.toToken,"route output token"),amountIn:i,fee:t.fee,sqrtPriceLimitX96:0n});i=n?.amountOut??0n}else{let n=await e.quoteExactInputV2({amountIn:i,path:[(0,l.requireEvmAddress)(t.fromToken,"route input token"),(0,l.requireEvmAddress)(t.toToken,"route output token")]});i=Array.isArray(n)&&n.length>0?n[n.length-1]??0n:0n}if(!i||i<=0n)return 0n}return i}async function x({quoter:e,chainId:t,amountOut:n,route:a}){if(!e||!t||!n||n<=0n||!a||0===a.length)return 0n;let i=n;for(let t of[...a].reverse()){if(i<=0n)return 0n;if("v4"===t.protocol){let n=(0,u.normalizePoolKey)(t.poolKey);if(!n)return 0n;try{let a=await e.quoteExactOutputV4Quoter({poolKey:n,zeroForOne:t.zeroForOne,exactAmount:i,hookData:"0x"});i=a?.amountIn??0n}catch{try{let a=await e.quoteExactOutputV4({poolKey:n,zeroForOne:t.zeroForOne,exactAmount:i,hookData:"0x"});i=a?.amountIn??0n}catch{return 0n}}}else if("v3"===t.protocol){let n=await e.quoteExactOutputV3({tokenIn:(0,l.requireEvmAddress)(t.fromToken,"route input token"),tokenOut:(0,l.requireEvmAddress)(t.toToken,"route output token"),amountOut:i,fee:t.fee,sqrtPriceLimitX96:0n});i=n?.amountIn??0n}else{let n=await e.quoteExactOutputV2({amountOut:i,path:[(0,l.requireEvmAddress)(t.fromToken,"route input token"),(0,l.requireEvmAddress)(t.toToken,"route output token")]});i=Array.isArray(n)&&n.length>0?n[0]??0n:0n}if(!i||i<=0n)return 0n}return i}e.s(["createQuoteProvider",0,g,"getQuoteAddresses",0,function(e){let t=(0,b.resolveQuoteCapability)({chainId:e,source:"indexed"});switch(t.provider){case"unavailable":return;case"local":return{weth:t.deployment.addresses.WrappedNative};case"sdk":return(0,p.getDopplerAddresses)(e)}},"resolveRouteQuoteCapability",0,v,"safeCreateQuoterFromChainId",0,function(e,t){let n=(0,r.tryEvmChainId)(e);return void 0===n?void 0:g({chainId:n,source:"indexed"},t)}],539228),e.s(["quoteRouteAmount",0,w,"quoteRouteExactOutputAmount",0,x],853293);var I=e.i(901900);e.s(["useRouteExactOutputQuote",0,(e,o,l,u)=>{let d=(0,i.useGetPublicClient)(),p=(0,a.useClientFlag)("clientUseConsolidatedIndexerFlag")?"consolidated":"legacy",y=!!(o&&(0,s.getChainCompatibility)(o,p).indexer),c=v(o,e,"exactOut"),m=(0,n.useMemo)(()=>o?g({chainId:(0,r.toEvmChainId)(o),source:"indexed",mode:"exactOut"},d):void 0,[o,d]);return(0,t.useQuery)({queryKey:["routeExactOutputQuote",u,p,c.cacheKey,o?(0,r.serializeChainId)(o):"unsupported-chain",l?.toString?.()||String(l??0),e?.map(e=>"v4"===e.protocol?["v4",e.fromToken,e.toToken,e.zeroForOne,e.poolKey?.currency0,e.poolKey?.currency1,e.poolKey?.fee,e.poolKey?.tickSpacing,e.poolKey?.hooks].join(":"):"v3"===e.protocol?["v3",e.fromToken,e.toToken,e.fee].join(":"):["v2",e.fromToken,e.toToken].join(":"))],enabled:!!(y&&"unavailable"!==c.provider&&m&&o&&l&&l>0n&&e&&e.length>0),staleTime:6e4,retry:!1,retryOnMount:!1,refetchInterval:3e3,refetchIntervalInBackgroun
1d:!1,refetchOnReconnect:"always",refetchOnWindowFocus:"always",refetchOnMount:!0,queryFn:async()=>{if(!y||"unavailable"===c.provider||!o)throw Error("This indexed quote is unavailable.");if(o&&c.deployment){let t=d(o);if(!t||!u)throw Error("A verified asset is required to quote this route");await (0,I.verifyIndexedCompatibilityRoute)(t,(0,r.toEvmChainId)(o),{asset:u,route:e})}return x({quoter:m,chainId:o,amountOut:l,route:e})}})},"useRouteQuote",0,(e,o,l,u)=>{let d=(0,i.useGetPublicClient)(),p=(0,a.useClientFlag)("clientUseConsolidatedIndexerFlag")?"consolidated":"legacy",y=!!(o&&(0,s.getChainCompatibility)(o,p).indexer),c=v(o,e,"exactIn"),m=(0,n.useMemo)(()=>o?g({chainId:(0,r.toEvmChainId)(o),source:"indexed",mode:"exactIn"},d):void 0,[o,d]);return(0,t.useQuery)({queryKey:["routeQuote",u,p,c.cacheKey,o?(0,r.serializeChainId)(o):"unsupported-chain",l?.toString?.()||String(l??0),e?.map(e=>"v4"===e.protocol?["v4",e.fromToken,e.toToken,e.zeroForOne,e.poolKey?.currency0,e.poolKey?.currency1,e.poolKey?.fee,e.poolKey?.tickSpacing,e.poolKey?.hooks].join(":"):"v3"===e.protocol?["v3",e.fromToken,e.toToken,e.fee].join(":"):["v2",e.fromToken,e.toToken].join(":"))],enabled:!!(y&&"unavailable"!==c.provider&&m&&o&&l&&l>0n&&e&&e.length>0),staleTime:6e4,retry:!1,retryOnMount:!1,refetchInterval:3e3,refetchIntervalInBackground:!1,refetchOnReconnect:"always",refetchOnWindowFocus:"always",refetchOnMount:!0,queryFn:async()=>{if(!y||"unavailable"===c.provider||!o)throw Error("This indexed quote is unavailable.");if(!m||!o)return 0n;if(c.deployment){let t=d(o);if(!t||!u)throw Error("A verified asset is required to quote this route");await (0,I.verifyIndexedCompatibilityRoute)(t,(0,r.toEvmChainId)(o),{asset:u,route:e})}return w({quoter:m,chainId:o,amountIn:l,route:e})}})}],379681)},931083,227855,389666,345448,142900,796904,567484,402787,901703,897705,e=>{"use strict";var t,n,a,i,r=e.i(261526),s=e.i(899582),o=e.i(722487),l=e.i(831368),u=e.i(29529),d=e.i(131981),p=e.i(52805),y=e.i(630136),c=e.i(425152),m=e.i(276812),T=e.i(340550),f=e.i(958774);let h=[{type:"function",name:"getPool",stateMutability:"view",inputs:[{type:"address"},{type:"address"},{type:"uint24"}],outputs:[{type:"address"}]}],b=[{type:"function",name:"liquidity",stateMutability:"view",inputs:[],outputs:[{type:"uint128"}]}],g=[100,500,3e3,1e4],v={[d.CHAIN_IDS.BASE.reference]:l.USDC_TOKEN_ADDRESS,[d.CHAIN_IDS.BASE_SEPOLIA.reference]:l.USDC_SEPOLIA_TOKEN_ADDRESS,[d.CHAIN_IDS.MONAD.reference]:l.MONAD_USDC_TOKEN_ADDRESS,[d.CHAIN_IDS.ROBINHOOD.reference]:l.ROBINHOOD_USDG_TOKEN_ADDRESS},w=new Map;function x(e){let t={chainId:e.chainId,source:"indexed",protocol:"v3",mode:"exactIn"},n=(0,f.resolveQuoteCapability)(t),a=(0,f.resolveSwapCapability)(t);if("unavailable"===n.provider||"unavailable"===a.provider)return;let i="sdk"===n.provider&&"sdk"===a.provider?(0,T.getDopplerAddresses)(e.chainId):void 0,r=n.deployment?.addresses.UniswapV3Factory??i?.uniswapV3Factory,s=a.deployment?.addresses.WrappedNative??i?.weth;if(![r,s,n.deployment?.addresses.UniswapV3Quoter??i?.v3Quoter,a.deployment?.addresses.UniversalRouter??i?.universalRouter,a.deployment?.addresses.Permit2??i?.permit2].some(e=>!e||e.toLowerCase()===m.zeroAddress)&&r&&s)return{...e,factory:r,wrappedNative:s}}async function I(e,t){let n,a=t.publicClient;if(a){for(let i of(await Promise.allSettled(g.map(async n=>{let i=await a.readContract({address:t.factory,abi:h,functionName:"getPool",args:[...e,n]});if("string"!=typeof i||!(0,c.isAddress)(i)||i.toLowerCase()===m.zeroAddress)return;let r=await a.readContract({address:i,abi:b,functionName:"liquidity"});return"bigint"==typeof r&&r>0n?{fee:n,liquidity:r}:void 0}))))"fulfilled"===i.status&&i.value&&(!n||i.value.liquidity>n.liquidity)&&(n=i.value);return n?{fee:n.fee}:void 0}}async function S(e,t){let n=x(t);if(!n||!t.publicClient||e[0].toLowerCase()===e[1].toLowerCase())return;let a=[t.chainId,n.factory.toLowerCase(),...e.map(e=>e.toLowerCase()).sort()].join(":"),i=w.get(a);if(i&&i.expiresAt>Date.now())return i.result;let r=I(e,n);return w.set(a,{result:r,expiresAt:Date.now()+6e4}),await r||w.delete(a),r}
1function C(e,t,n){return{protocol:"v3",fromToken:(0,p.requireEvmAddress)(e,"V3 input"),toToken:(0,p.requireEvmAddress)(t,"V3 output"),fee:n}}async function E(e,t){let n=e.at(-1)?.toToken;if(!n||!t.publicClient||n.toLowerCase()===m.zeroAddress)return e;let a=x(t);if(!a||n.toLowerCase()===a.wrappedNative.toLowerCase())return e;let i=a.wrappedNative,r=await S([n,i],t);if(r)return[...e,C(n,i,r.fee)];let s=v[t.chainId];if(!s||s.toLowerCase()===n.toLowerCase()||s.toLowerCase()===i.toLowerCase()||e.some(e=>e.fromToken.toLowerCase()===s.toLowerCase()))return e;let[o,l]=await Promise.all([S([n,s],t),S([s,i],t)]);return o&&l?[...e,C(n,s,o.fee),C(s,i,l.fee)]:e}var k=e.i(444220),A=e.i(417349),R=e.i(917620),D=e.i(634648),N=e.i(277733);let P=d.CHAIN_IDS.ROBINHOOD,O=(0,R.defineChain)({id:P.reference,name:"Robinhood",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:[(0,N.getClientRpcUrl)("robinhood")]}},contracts:{}});function _(e){return e instanceof Error?e.message:"Unknown error"}function M(e,t){return!!(t&&(0,d.tryEvmChainId)(t)===P.reference&&e?.length===1&&e[0]?.protocol==="v4")}function L(e,t){let n=(0,y.normalizePoolKey)(t);if(!n)return[];let a=(0,p.requireEvmAddress)(e.address,"token address"),i=a.toLowerCase(),r=n.currency0.toLowerCase(),s=n.currency1.toLowerCase(),o=r===i?n.currency1:s===i?n.currency0:void 0;return o&&o.toLowerCase()!==i?[{protocol:"v4",fromToken:a,toToken:(0,p.requireEvmAddress)(o,"Robinhood route output token"),poolKey:n,zeroForOne:r===i}]:[]}async function F(e,t){return E(e,{chainId:P.reference,publicClient:t})}async function U(e,t){let n=(0,d.tryCoerceChainId)(e.chainId);if((n?(0,d.tryEvmChainId)(n):void 0)!==P.reference)return;let a=L(e,e.pool.poolKey??e.pool.v4Pool?.poolKey??e.pool.v4Pool);if(a.length>0)return F(a,t);let i=function(e){let t=e.pool,n=t.v4Pool?.hooks??t.hooks??t.address;if(n&&"0x0000000000000000000000000000000000000000"!==n.toLowerCase())return(0,p.requireEvmAddress)(n,"Robinhood pool key reader")}(e);if(!i||!t)return;let r=L(e,await t.readContract({address:i,abi:s.dopplerHookAbi,functionName:"poolKey"}));if(0===r.length)throw Error("pathfinder:poolkey-route-mismatch");return F(r,t)}async function q({quoter:e,amountIn:t,route:n}){if(t<=0n||1!==n.length)return 0n;let a=n[0];if(!a||"v4"!==a.protocol)return 0n;let i=(0,y.normalizePoolKey)(a.poolKey);if(!i)throw Error("Robinhood route is missing a valid V4 pool key.");let r={poolKey:i,zeroForOne:a.zeroForOne,exactAmount:t,hookData:"0x"};try{let t=(await e.quoteExactInputV4Quoter(r)).amountOut??0n;if(t>0n)return t}catch(t){try{return(await e.quoteExactInputV4(r)).amountOut??0n}catch(e){throw Error(`Robinhood Universal Router 2.1.1 quote failed: ${_(t)}; fallback failed: ${_(e)}`)}}return(await e.quoteExactInputV4(r)).amountOut??0n}function B(e,t,n,a,i){return{protocol:"v3",fromToken:(0,p.requireEvmAddress)(e,t),toToken:(0,p.requireEvmAddress)(n,a),fee:i}}function V(e,t,n){return a=>[B(e,t,a,"native token",n)]}function j(...e){return t=>e.flatMap(e=>e(t))}function $(e,t,n){let a=e.currency0.toLowerCase(),i=e.currency1.toLowerCase(),r=t.toLowerCase(),s=n.toLowerCase();return a===r&&i===s||a===s&&i===r}function K(e,t){let n=function(e,t){let n=e.findIndex(e=>e.toToken.toLowerCase()===t.toLowerCase());if(-1!==n)return e.slice(0,n+1)}(e,t);if(n)return G(n)}e.s(["findRobinhoodUniversalRouter211RouteToNativeToken",0,U,"isRobinhoodUniversalRouter211Route",0,M,"useRobinhoodUniversalRouter211RouteQuote",0,function(e,t,n){let a=(0,k.useMemo)(()=>(0,A.createPublicClient)({chain:O,transport:(0,D.http)((0,N.getClientRpcUrl)("robinhood"))}),[]),i=M(e,t)&&n>0n,o=(0,k.useMemo)(()=>i?new s.Quoter(a,P.reference):void 0,[a,i]);return(0,r.useQuery)({queryKey:["robinhoodUniversalRouter211RouteQuote",(0,d.serializeChainId)(P),n.toString(),e.map(e=>"v4"===e.protocol?["v4",e.fromToken,e.toToken,e.zeroForOne,e.poolKey.currency0,e.poolKey.currency1,e.poolKey.fee,e.poolKey.tickSpacing,e.poolKey.hooks].join(":"):[e.protocol,e.fromToken,e.toToken].join(":"))],enabled:i,placeholderData:e=>e,staleTime:6e4,retry:!1,retryOnMount:!1,refetchInterval:3e3,refetchIntervalInBackgroun
1d:!1,refetchOnReconnect:"always",refetchOnWindowFocus:"always",refetchOnMount:!0,queryFn:async()=>o?q({quoter:o,amountIn:n,route:e}):0n})}],227855);let H=function({fromToken:e,fromTokenLabel:t,nativeTokenAddressOverride:n,nativeTokenLabel:a="native token",fee:i,tickSpacing:r,hooks:s,hooksLabel:o,poolOrder:l,zeroForOne:u}){return d=>{let y=(0,p.requireEvmAddress)(e,t),c=(0,p.requireEvmAddress)(n??d,a);return[{protocol:"v4",fromToken:y,toToken:c,poolKey:{currency0:"native-first"===l?c:y,currency1:"native-first"===l?y:c,fee:i,tickSpacing:r,hooks:(0,p.requireEvmAddress)(s,o)},zeroForOne:u}]}}({fromToken:l.MONAD_USDC_TOKEN_ADDRESS,fromTokenLabel:"Monad USDC token",nativeTokenAddressOverride:s.ZERO_ADDRESS,nativeTokenLabel:"Monad native MON token",fee:500,tickSpacing:10,hooks:s.ZERO_ADDRESS,hooksLabel:"Monad no-hook pool",poolOrder:"native-first",zeroForOne:!1}),W={[d.CHAIN_IDS.BASE.reference]:{[l.USDC_TOKEN_ADDRESS.toLowerCase()]:V(l.USDC_TOKEN_ADDRESS,"USDC token",3e3),[l.USDT_TOKEN_ADDRESS.toLowerCase()]:V(l.USDT_TOKEN_ADDRESS,"USDT token",500),[l.ZORA_TOKEN_ADDRESS.toLowerCase()]:V(l.ZORA_TOKEN_ADDRESS,"ZORA token",3e3),[l.FXH_TOKEN_ADDRESS.toLowerCase()]:V(l.FXH_TOKEN_ADDRESS,"FXH token",1e4),[l.NOICE_TOKEN_ADDRESS.toLowerCase()]:V(l.NOICE_TOKEN_ADDRESS,"NOICE token",1e4),[l.EURC_TOKEN_ADDRESS.toLowerCase()]:j((t=l.EURC_TOKEN_ADDRESS,n=l.USDC_TOKEN_ADDRESS,()=>[B(t,"EURC token",n,"USDC token",500)]),V(l.USDC_TOKEN_ADDRESS,"USDC token",500))},[d.CHAIN_IDS.BASE_SEPOLIA.reference]:{[l.USDC_SEPOLIA_TOKEN_ADDRESS.toLowerCase()]:V(l.USDC_SEPOLIA_TOKEN_ADDRESS,"USDC Sepolia token",3e3),[l.USDT_SEPOLIA_TOKEN_ADDRESS.toLowerCase()]:V(l.USDT_SEPOLIA_TOKEN_ADDRESS,"USDT Sepolia token",500)},[d.CHAIN_IDS.MONAD.reference]:{[l.MONAD_USDC_TOKEN_ADDRESS.toLowerCase()]:H,[l.MONAD_USDT0_TOKEN_ADDRESS.toLowerCase()]:j((a=l.MONAD_USDT0_TOKEN_ADDRESS,i=l.MONAD_USDC_TOKEN_ADDRESS,()=>[B(a,"Monad USDT0 token",i,"Monad USDC token",100)]),H)}};function z({numericChainId:e,tokenAddress:t,nativeTokenAddress:n}){return W[e]?.[t.toLowerCase()]?.(n)}async function Q(e,t,n={}){let{maxHops:a=6}=n,i=new Set,r=(0,d.tryCoerceChainId)(e.chainId),u=r?(0,d.tryEvmChainId)(r):void 0,c=t?(0,p.requireEvmAddress)(t,"native token"):void 0,m=c?.toLowerCase(),T=[],f=await U(e,n.publicClient);if(f)return f;let h=(0,p.requireEvmAddress)(e.address,"token address");for(let t=0;t<a;
1t++){if(!h)throw Error("pathfinder:no-current-token");let t=h.toLowerCase();if(i.has(t))throw Error("pathfinder:cycle-detected");if(i.add(t),u&&c){let e=z({numericChainId:u,tokenAddress:h,nativeTokenAddress:c});if(e)return T.push(...e),T}let a=e.pool,r=a.migrationType?.toLowerCase?.()||a.asset?.migrationType?.toLowerCase?.(),d=!!(a.migrated||a.asset?.migrated),f=!!(d&&"v2"===r),b=!!(d&&"v3"===r),g=!!(d&&("v4"===r||"dhook"===r||"dopplerhook"===r)),v=a.quoteToken?.address?(0,p.requireEvmAddress)(a.quoteToken.address,"quote token address"):void 0;!v&&(f||b)&&c&&(v=c);let w=v?.toLowerCase(),x=m===l.WETH_TOKEN_ADDRESS&&a.isQuoteEth||!!(w&&m&&w===m);if(b&&v){if(v===s.ZERO_ADDRESS&&(v=c),!v)throw Error("pathfinder:missing-quote-token");let e=(0,l.isUsableStaticFee)(a.fee)?a.fee:l.MIGRATED_V3_POOL_FEE;T.push({protocol:"v3",fromToken:h,toToken:v,fee:e})}else if((0,o.getForceV3Token)(h)){let e=(0,o.getForceV3Token)(h);if(!c)throw Error("pathfinder:missing-native-token");T.push({protocol:"v3",fromToken:h,toToken:c,fee:e.fee})}else if(f&&v){if(v===s.ZERO_ADDRESS&&(v=c),!v)throw Error("pathfinder:missing-quote-token");T.push({protocol:"v2",fromToken:h,toToken:v})}else if(g&&v){let e=(0,y.normalizePoolKey)(a.v4Pool?.poolKey),n=e?{...e,fee:e.fee||l.MIGRATED_V4_POOL_DEFAULTS.fee,tickSpacing:e.tickSpacing||l.MIGRATED_V4_POOL_DEFAULTS.tickSpacing}:void 0,i=n??(0,y.normalizePoolKey)(a.poolKey);if(!i)throw Error("pathfinder:invalid-poolkey");let r=n?i:{...i,fee:a?.v4Pool?.fee||l.MIGRATED_V4_POOL_DEFAULTS.fee,tickSpacing:a?.v4Pool?.tickSpacing||l.MIGRATED_V4_POOL_DEFAULTS.tickSpacing,hooks:(a?.v4Pool?.hooks?(0,p.requireEvmAddress)(a.v4Pool.hooks,"pool hook"):void 0)||i.hooks};if(!$(r,h,v))throw Error("pathfinder:poolkey-route-mismatch");let s=r.currency0.toLowerCase()===t;T.push({protocol:"v4",fromToken:h,toToken:v,poolKey:r,zeroForOne:s})}else if(("v4"===a.type||"zora"===a.type||"multicurve"===a.type||"scheduled-multicurve"===a.type||"decay-multicurve"===a.type||"rehype"===a.type||"dhook"===a.type)&&a.poolKey&&v){let e=(0,y.normalizePoolKey)(a.poolKey);if(!e)throw Error("pathfinder:invalid-poolkey");if(!$(e,h,v))throw Error("pathfinder:poolkey-route-mismatch");let n=e.currency0.toLowerCase()===t;T.push({protocol:"v4",fromToken:h,toToken:v,poolKey:e,zeroForOne:n})}else if("v3"===a.type&&v){let e="number"==typeof a.fee?a.fee:3e3;T.push({protocol:"v3",fromToken:h,toToken:v,fee:e})}if(x||m&&v&&v.toLowerCase()===m)return T;let I=a.isQuoteZora?l.ZORA_TOKEN_ADDRESS:v;if(u&&c&&I){let e=z({numericChainId:u,tokenAddress:I,nativeTokenAddress:c});if(e)return T.push(...e),T}if(!v)throw Error("pathfinder:missing-quote-token");if(v.toLowerCase()===t)throw Error("pathfinder:cycle-detected");if(T.length>0&&u)return E(T,{chainId:u,publicClient:n.publicClient});h=v}throw Error("pathfinder:max-hops")}function G(e){return[...e].slice().reverse().map(e=>"v4"===e.protocol?{protocol:"v4",fromToken:e.toToken,toToken:e.fromToken,poolKey:e.poolKey,zeroForOne:!e.zeroForOne}:"v2"===e.protocol?{protocol:"v2",fromToken:e.toToken,toToken:e.fromToken}:{protocol:"v3",fromToken:e.toToken,toToken:e.fromToken,fee:e.fee})}async function X(e,t,n={}){return G(await Q(e,t,n))}async function Y(e,t,n,a={}){let i=(0,d.tryCoerceChainId)(e.chainId),r=i?(0,d.tryEvmChainId)(i):void 0,o=n?.toLowerCase();if(!n||!o||!r)throw Error("pathfinder:missing-native-token");if("native"===t.kind||t.address.toLowerCase()===o){let t=await X(e,n,a),i=t[0]?.fromToken.toLowerCase();if(i!==o&&i!==s.ZERO_ADDRESS)throw Error("pathfinder:no-native-route");return t}let u=(0,p.requireEvmAddress)(t.address,"buy currency"),y=await Q(e,n,a),c=K(y,u);if(c)return c;let m=function({numericChainId:e,currencyAddress:t,toNativeRoute:n}){for(let[a,i]of n.entries()){let r=function({numericChainId:e,inputAddress:t,outputAddress:n}){let a=t.toLowerCase(),i=n.toLowerCase();if(a===i)return[];let r={[d.CHAIN_IDS.BASE.reference]:[[l.USDC_TOKEN_ADDRESS,l.USDT_TOKEN_ADDRESS]],[d.CHAIN_IDS.BASE_SEPOLIA.reference]:[[l.USDC_SEPOLIA_TOKEN_ADDRESS,l.USDT_SEPOLIA_TOKEN_ADDRESS]],[d.CHAIN_IDS.MONAD.reference]:[[l.MONAD_USDC_TOKEN_ADDRESS,l.MONAD_USDT0_TOKEN_ADDRESS]]};if(r[e]?.find(([e,t])=>e.toLowerCase()===a&&t.toLowerCase()===i||t.toLowerCase()===a&&e.toLowerCase()===i))return[{protocol:"v3",fromToken:t,toToken:n,fee:100}]}({numericChainId:e,inputAddress:t,outputAddress:i.toToken});if(r&&r.length>0)return[...r,...G(n.slice(0,a+1))]}}({numericChainId:r,currencyAddress:u,toNativeRoute:y});if(m)return m;let T=z({numericChainId:r,tokenAddress:u,nativeTokenAddress:n});if(!T)throw Error("pathfinder:unsupported-buy-currency");return function(e,t,n){for(let n=0;n<e.length;n++){let a=K(t,e[n].toToken);if(a)return[...e.slice(0,n+1),...a]}let a=e.at(-1)?.toToken.toLowerCase(),i=t.at(-1)?.toToken.toLowerCase(),r=n.toLowerCase(),o=(a===r||a===s.ZERO_ADDRESS)&&(i===r||i===s.ZERO_ADDRESS);if(a&&a===i||o)return[...e,...G(t)];throw Error("pathfinder:unsupported-buy-currency")}(T,y,n)}e.s(["useRouteFromBuyCurrency",0,function(e,t){let n=(0,u.useGetChain)(),a=(0,u.useGetPublicClient)(),i=e?(0,d.tryCoerceChainId)(e.chainId):void 0,s=i?(0,d.tryEvmChainId)(i):void 0;return(0,r.useQuery)({queryKey:["routeFromBuyCurrency",e?.chainId,e?.address,t?.chainId,t?.address,t?.kind],queryFn:()=>
1e&&t&&s?Y(e,t,n((0,d.fromEvmNumericId)(s))?.nativeToken?(0,p.requireEvmAddress)(n((0,d.fromEvmNumericId)(s)).nativeToken,"native token"):void 0,{publicClient:a((0,d.fromEvmNumericId)(s))}):[],enabled:!!(e?.chainId&&e?.address&&t?.address),staleTime:6e4,retry:!1})},"useRouteFromNativeToken",0,function(e){let t=(0,u.useGetChain)(),n=(0,u.useGetPublicClient)(),a=e?(0,d.tryCoerceChainId)(e.chainId):void 0,i=a?(0,d.tryEvmChainId)(a):void 0,s=i?(0,d.fromEvmNumericId)(i):void 0,o=s?t(s)?.nativeToken:void 0;return(0,r.useQuery)({queryKey:["routeFromNativeToken",e?.chainId,e?.address],queryFn:()=>e&&i?X(e,o?(0,p.requireEvmAddress)(o,"native token"):void 0,{publicClient:n((0,d.fromEvmNumericId)(i))}):[],enabled:!!e?.chainId&&!!e?.address,staleTime:6e4,retry:!1})},"useRouteToNativeToken",0,function(e){let t=(0,u.useGetChain)(),n=(0,u.useGetPublicClient)(),a=e?(0,d.tryCoerceChainId)(e.chainId):void 0,i=a?(0,d.tryEvmChainId)(a):void 0,s=i?(0,d.fromEvmNumericId)(i):void 0,o=s?t(s)?.nativeToken:void 0;return(0,r.useQuery)({queryKey:["routeToNativeToken",e?.chainId,e?.address],queryFn:()=>e&&i?Q(e,o?(0,p.requireEvmAddress)(o,"native token"):void 0,{publicClient:n((0,d.fromEvmNumericId)(i))}):[],enabled:!!e?.chainId&&!!e?.address,staleTime:6e4,retry:!1})}],931083);var Z=e.i(120307);function J(e){let{asset:t,type:n,amount:a,txHash:i,errorType:r,additionalFields:s={}}=e,o={[Z.TOKEN_NAME]:t.tokenName,[Z.TOKEN_ADDRESS]:t.tokenAddress,[Z.CHAIN_ID]:t.chainId,...s};return"click"===n||"success"===n?{...o,...a?{[Z.AMOUNT]:a}:{},...i?{[Z.TRANSACTION_HASH]:i}:{}}:{...o,error:r||"unknown"}}e.s(["buildSwapAnalyticsPayload",0,function(e){let{pool:t,...n}=e;return J({asset:{tokenName:t.baseToken.name,tokenAddress:t.baseToken.address,chainId:t.chainId.toString()},...n})},"buildTokenSwapAnalyticsPayload",0,function(e){let{tokenName:t,tokenAddress:n,chainId:a,...i}=e;return J({asset:{tokenName:t,tokenAddress:n,chainId:a},...i})}],389666);var ee=e.i(768421),et=e.i(602208),en=e.i(722396),ea=e.i(456848),ei=e.i(290922),er=e.i(134537),es=e.i(309918),eo=e.i(248106);let el=new Set(["usdc","usdc sepolia","usdt","usdt sepolia","usdt0"]);function eu({currency:e,size:t,avatarClassName:n}){return(0,eo.isBuyCurrencyNative)(e)?(0,ee.jsx)(en.default,{chainId:e.chainId,size:t,className:"flex-shrink-0"}):el.has(e.symbol.toLowerCase())?(0,ee.jsx)(ei.default,{symbol:e.symbol,size:t,className:"flex-shrink-0"}):(0,ee.jsx)("div",{className:n,children:(0,ee.jsx)(ea.TokenMeshAvatar,{address:e.address,symbol:`$${e.symbol}`,size:"sm",maxChars:2,className:"w-full h-full"})})}e.s(["BuyCurrencySelector",0,({options:e,selectedCurrency:t,onSelectCurrency:n,balances:a})=>{let[i,r]=(0,k.useState)(!1),s=(0,k.useRef)(null);(0,k.useEffect)(()=>{let e=e=>{s.current&&!s.current.contains(e.target)&&r(!1)};return i&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let o=e.length>1;return(0,ee.jsxs)("div",{className:"relative",ref:s,children:[(0,ee.jsxs)("button",{type:"button",className:"bg-overlay-hover rounded-lg px-2 py-1.5 flex items-center gap-2 cursor-pointer min-w-0",onClick:()=>o&&r(!i),"data-testid":es.SELECTORS.BUY_SOURCE_CHAIN_TRIGGER,children:[(0,ee.jsx)(eu,{currency:t,size:24,avatarClassName:"w-6 h-6 flex-shrink-0"}),(0,ee.jsx)("span",{className:"text-md font-medium text-text-primary truncate",children:t.symbol}),o&&(0,ee.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:`text-text-secondary transition-transform ${i?"rotate-180":""}`,children:(0,ee.jsx)("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),(0,ee.jsx)("div",{className:"absolute top-full right-0 mt-2 z-50",children:(0,ee.jsx)(er.AnimatedDropdown,{isOpen:i,position:"top-right",children:(0,ee.jsx)("div",{className:"flex w-[200px] p-1 flex-col items-start rounded-lg border border-default bg-bg-default dark:bg-bg-ghost shadow-md",children:e.map(e=>{var i;let s=a[e.balanceKey],o=e.balanceKey===t.balanceKey;return(0,ee.jsxs)("button",{type:"button",className:`flex w-full items-center gap-2.5 px-2 py-2 rounded-md text-left transition-colors cursor-pointer ${o?"bg-overlay-hover":"hover:bg-overlay-hover active:bg-overlay-pressed"}`,onClick:()=>{n(e),r(!1)},"data-testid":es.SELECTORS.BUY_SOURCE_CHAIN_OPTION(e.symbol.toLowerCase()),children:[(0,ee.jsx)(eu,{currency:e,size:20,avatarClassName:"w-5 h-5 flex-shrink-0"}),(0,ee.jsxs)("div",{className:"flex flex-col flex-1 min-w-0",children:[(0,ee.jsx)("span",{className:"text-sm font-medium text-text-primary truncate",children:e.chainName}),(0,ee.jsxs)("span",{className:"text-xs text-text-secondary truncate",children:[(i=e.decimals,void 0===s||0n===s?"0":parseFloat((0,et.formatUnits)(s,i)).toLocaleStr
1ing(void 0,{maximumFractionDigits:4}))," ",e.symbol]})]}),o&&(0,ee.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"flex-shrink-0 text-text-primary",children:(0,ee.jsx)("path",{d:"M13.3 4.3L6 11.6L2.7 8.3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]},e.balanceKey)})})})})]})}],345448);var ed=e.i(428176),ep=e.i(253934),ey=e.i(868616);let ec=(e,t=20)=>e.length>t?`${e.slice(0,t)}...`:e;e.s(["truncateSymbol",0,ec],142900),e.s(["useSwapState",0,()=>{let[e,t]=(0,k.useState)(!1),[n,a]=(0,k.useState)(),[i,r]=(0,k.useState)(!1),[s,o]=(0,k.useState)(),l=(0,k.useCallback)(()=>{a(void 0),r(!1)},[]);return{awaitingWalletAction:e,setAwaitingWalletAction:t,txHash:n,setTxHash:a,txConfirmed:i,setTxConfirmed:r,error:s,setError:o,resetSwapState:l}},"useTransactionOrchestrator",0,({pool:e,eventName:t,direction:n,swapState:a,getAnalyticsPayload:i,onSuccess:r})=>{let{setAwaitingWalletAction:s,setTxHash:o,setTxConfirmed:l,setError:d}=a,p=(0,u.useGetPublicClient)(),y=(0,k.useRef)(!1);return{executeTransaction:(0,k.useCallback)(async(a,u)=>{if(!y.current){y.current=!0,d(void 0),s(!0);try{let s=await a();o(s);let y=await p(u).waitForTransactionReceipt({hash:s});"success"===y.status?((0,ed.trackEvent)(t,Z.SUCCESS,i("success",{txHash:s})),l(!0),await Promise.all([ep.queryClient.invalidateQueries({queryKey:["quote"]}),ep.queryClient.invalidateQueries({queryKey:["routeQuote"]}),ep.queryClient.invalidateQueries({queryKey:["maxSellableAmount"]}),ep.queryClient.invalidateQueries({queryKey:["balance"]}),ep.queryClient.invalidateQueries({queryKey:["buyCurrencyBalances"]}),ep.queryClient.invalidateQueries({queryKey:["portfolioQuery"]}),ep.queryClient.invalidateQueries({queryKey:["userCreatedTokensQuery"]}),ep.queryClient.invalidateQueries({queryKey:["multichainBalances"]})]),r?.()):((0,ed.trackEvent)(t,Z.ERROR,i("error",{errorType:"transaction-failed"})),d(`There was an error ${n.toLowerCase()}ing $${ec(e.baseToken.symbol)}.`))}catch(n){let e=(0,ey.default)(n);if("user-rejected"===e.eventError)return void(0,ed.trackEvent)(t,Z.ERROR,i("error",{errorType:e.eventError}));(0,ed.trackEvent)(t,Z.ERROR,i("error",{errorType:e.eventError})),d(e.userMessage)}finally{s(!1),y.current=!1}}},[t,n,e.baseToken.symbol,s,o,l,d,i,r,p])}}],796904);let em=["0.01","0.05","0.1","0.5","1"],eT=["33","333","3333","33333","333333"],ef=["10","25","50","100"];e.s(["USD_BUY_PRESETS",0,ef,"getBuyPresetsForCurrency",0,function(e,t){return"USDC"===e||"USDT"===e||"USDG"===e?ef:t?eT:em}],567484);var eh=e.i(244598),eb=e.i(507740),eg=e.i(413734),ev=e.i(263876),ew=e.i(766105),ex=e.i(168533),eI=e.i(732832);e.s(["SwapActionLayout",0,({isInModal:e,balanceContent:t,amountField:n,tokenSelector:a,presets:i=[],helperRow:r,receivingContent:s,feeInfo:o,error:l,errorTestId:u,button:d,footerContent:p})=>{var y;return(0,ee.jsxs)("div",{className:"space-y-6 md:space-y-4",children:[(0,ee.jsxs)("div",{className:"flex justify-between text-sm gap-2",children:[(0,ee.jsx)("span",{className:"text-text-secondary",children:"Amount"}),(0,ee.jsx)("span",{className:"text-text-primary truncate",children:t})]}),(0,ee.jsx)("div",{className:"space-y-2",children:(0,ee.jsxs)("div",{className:(0,eI.cn)("rounded-xl p-3 flex items-center justify-between",e?"bg-bg-ghost":"bg-[var(--color-overlay-elevated)]"),children:[(0,ee.jsx)(ew.Field,{value:n.value,onChange:n.onChange,className:"!border-0 !bg-transparent text-lg font-semibold flex-1 mr-3",placeholder:n.placeholder,"aria-label":n.ariaLabel,size:"lg","data-testid":n.dataTestId}),a]})}),i.length>0&&(0,ee.jsx)("div",{className:"flex gap-2",children:i.map(({key:e,label:t,selected:n,onSelect:a,disabled:i})=>(0,ee.jsx)(ev.Chip,{value:e,selected:n,onChange:a,size:"md",disabled:i,children:t},e))}),r&&(0,ee.jsxs)("div",{className:"flex justify-between items-center text-sm gap-2",children:[(0,ee.jsx)("span",{className:"text-text-secondary",children:r.label}),(0,ee.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ee.jsx)("span",{className:"text-text-primary","data-testid":r.valueTestId,children:r.value}),r.actionLabel&&r.onAction&&(0,ee.jsx)("button",{type:"button",className:"text-text-primary underline disabled:text-text-tertiary disabled:no-underline",onClick:r.onAction,disabled:r.actionDisabled,"data-testid":r.actionTestId,children:r.actionLabel})]})]}),(0,ee.jsxs)("div",{className:"flex justify-between text-sm gap-2",children:[(0,ee.jsx)("span",{className:"text-text-secondary",children:"Receiving"}),(0,ee.jsx)("span",{className:"text-text-primary truncate",children:s})]}),o&&(0,ee.jsxs)("div",{className:"flex justify-between text-sm gap-2",children:[(0,ee.jsx)("span",{className:"text-text-secondary",children:"Fee"}),void 0!==o.fee?o.isDynamic?(0,ee.jsxs)("span",{className:"text-text-primary flex items-center",children:[(0,ee.jsx)(eg.SlidingNumber,{value:o.fee/1e4,decimalPlaces:2}),(0,ee.jsx)("span",{children:"%"}),(0,ee.jsx)(eh.AnimatePresence,{children:o.isDecaying&&(0,ee.jsx)(eb.motion.span,{initial:{opacity:1,width:"auto",marginLeft:4}
1,animate:{opacity:1,width:"auto",marginLeft:4},exit:{opacity:0,width:0,marginLeft:0},transition:{duration:.6,ease:"easeInOut"},className:"inline-flex text-xs text-green-500 overflow-hidden",children:"↓"})})]}):(0,ee.jsx)("span",{className:"text-text-primary",children:(y=o.fee,`${(y/1e4).toFixed(2*(y%1e4!=0))}%`)}):(0,ee.jsx)("span",{className:"text-text-primary",children:"-"})]}),l&&(0,ee.jsx)("div",{className:"text-sm text-red-500 text-center","data-testid":u,children:l}),(0,ee.jsx)(ex.StatefulButton,{state:d.state,variant:"primary",emphasis:"high",size:"lg",className:(0,eI.cn)("w-full",d.shouldGloss&&"button-gloss",d.className),disabled:d.disabled,onClick:d.onClick,loadingText:d.loadingText,successText:d.successText,successDuration:d.successDuration,"data-testid":d.dataTestId,children:d.text}),p]})}],402787);var eS=e.i(342416),eC=e.i(619041);class eE extends Error{url;status;constructor(e,t){super(e.message,t),this.name=e.name??"HttpError",this.url=e.url,this.status=e.status}}class ek extends eE{constructor(e,t){super({...e,name:e.name??"AcrossApiError"},t)}}class eA extends ek{transaction;constructor(e,t){super({...e,name:"AcrossApiSimulationError",status:400,code:"SIMULATION_ERROR"},t),this.transaction=e.transaction}}
1class eR extends Error{simulationId;simulationUrl;constructor(e,t){super(e.message,t),this.name="SimulationError",this.simulationId=e.simulationId,this.simulationUrl=e.simulationUrl}}class eD extends Error{url;constructor(e,t,n){super(t),this.name=n??"Indexer Error",this.url=e}}class eN extends Error{constructor(e){super(e),this.name="Config Error"}}class eP extends Error{constructor(e,t){super(`Unable to parse depositV3 log for tx ${e} on chain ${t}`),this.name="Deposit Log Not Found"}}class eO extends Error{constructor(e,t,n){super(`Unable to find fill log on chain ${t} for deposit id #${e.toString()} ${n?`with depositTxHash ${n}`:"."}`),this.name="Fill Log Not Found"}}function e_(e){return!!(e.status>=200)&&!!(e.status<300)||304===e.status}function eM(e,t){return async(n,a,i)=>{let r,s=function(e){let t=new URLSearchParams;for(let n in e){let a=e[n];null!=a&&(Array.isArray(a)?a.forEach(e=>t.append(n,String(e))):t.append(n,String(a)))}return t.toString()}(a),o=`${n}?${s}`;i?.debug(`Fetching ${e}...`,o);let l=await fetch(o);try{r=await l.json()}catch(e){r=await l.text()}if(e_(l))return i?.debug("OK response",r),r;throw i?.debug("Error response",{status:l.status}),t&&t(l,r,o),new eE({status:l.status,message:"string"==typeof r?r:JSON.stringify(r),url:o})}}let eL=eM("Across API",(e,t,n)=>{if("object"==typeof t&&null!==t&&"type"in t&&"AcrossApiError"===t.type){if("SIMULATION_ERROR"===t.code)throw new eA({message:t.message,url:n,transaction:t.transaction});throw new ek({status:e.status,message:t.message,url:n,code:t.code})}}),eF=eM("Indexer API",(e,t,n)=>{if("object"==typeof t&&null!==t&&"error"in t)throw new eD(n,t?.message,t?.error)}),eU="https://app.across.to/api",eq="https://indexer.api.across.to";async function eB({apiUrl:e=eU,logger:t,...n}){return(await eL(`${e}/available-routes`,n,t)).map(e=>({isNative:e.isNative,originChainId:e.originChainId,inputToken:e.originToken,destinationChainId:e.destinationChainId,outputToken:e.destinationToken,inputTokenSymbol:e.originTokenSymbol,outputTokenSymbol:e.destinationTokenSymbol}))}async function eV({apiUrl:e=eU,logger:t,...n}){var a;return{...a=await eL(`${e}/suggested-fees`,n,t),outputAmount:BigInt(a.outputAmount),estimatedFillTimeSec:a.estimatedFillTimeSec,capitalFeePct:Number(a.capitalFeePct),capitalFeeTotal:BigInt(
1a.capitalFeeTotal),relayGasFeePct:Number(a.relayGasFeePct),relayGasFeeTotal:BigInt(a.relayGasFeeTotal),relayFeePct:Number(a.relayFeePct),relayFeeTotal:BigInt(a.relayFeeTotal),lpFeePct:a.lpFeePct,timestamp:Number(a.timestamp),isAmountTooLow:a.isAmountTooLow,quoteBlock:Number(a.quoteBlock),exclusiveRelayer:a.exclusiveRelayer,exclusivityDeadline:a.exclusivityDeadline,spokePoolAddress:a.spokePoolAddress,destinationSpokePoolAddress:a.destinationSpokePoolAddress,fillDeadline:Number(a.fillDeadline),totalRelayFee:{pct:BigInt(a.totalRelayFee.pct),total:BigInt(a.totalRelayFee.total)},relayerCapitalFee:{pct:BigInt(a.relayerCapitalFee.pct),total:BigInt(a.relayerCapitalFee.total)},relayerGasFee:{pct:BigInt(a.relayerGasFee.pct),total:BigInt(a.relayerGasFee.total)},lpFee:{pct:BigInt(a.lpFee.pct),total:BigInt(a.lpFee.total)},limits:{minDeposit:BigInt(a.limits.minDeposit),maxDeposit:BigInt(a.limits.maxDeposit),maxDepositInstant:BigInt(a.limits.maxDepositInstant),maxDepositShortDelay:BigInt(a.limits.maxDepositShortDelay),recommendedDepositInstant:BigInt(a.limits.recommendedDepositInstant)},inputToken:{address:a.inputToken.address,symbol:a.inputToken.symbol,decimals:a.inputToken.decimals,chainId:a.inputToken.chainId},outputToken:{address:a.outputToken.address,symbol:a.outputToken.symbol,decimals:a.outputToken.decimals,chainId:a.outputToken.chainId}}}async function ej({apiUrl:e=eU,logger:t,...n}){let a=await eL(`${e}/limits`,n,t);return{minDeposit:BigInt(a.minDeposit),maxDeposit:BigInt(a.maxDeposit),maxDepositInstant:BigInt(a.maxDepositInstant)}}var e$=e.i(412682),eK=e.i(969651),eH=e.i(101223);function eW(e){let t=(0,eH.parseAbiParameters)("((address target, bytes callData, uint256 value)[], address fallbackRecipient)");return(0,eK.encodeAbiParameters)(t,[[e.actions.map(({target:e,callData:t,value:n})=>({target:e,callData:t,value:BigInt(n)})),e.fallbackRecipient]])}let ez=[{inputs:[{internalType:"uint256",name:"index",type:"uint256"},{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"value",type:"uint256"}],internalType:"struct MulticallHandler.Call[]",name:"calls",type:"tuple[]"}],name:"CallReverted",type:"error"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"},{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"value",type:"uint256"}],internalType:"struct MulticallHandler.Call[]",name:"calls",type:"tuple[]"}],name:"InvalidCall",type:"error"},{anonymous:!1,inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"value",type:"uint256"}],indexed:!1,internalType:"struct MulticallHandler.Call[]",name:"calls",type:"tuple[]"},{indexed:!0,internalType:"address",name:"fallbackRecipient",type:"address"}],name:"CallsFailed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"uint256",name:"amount",type:"uint256"}],name:"DrainedTokens",type:"event"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"value",type:"uint256"}],internalType:"struct MulticallHandler.Call[]",name:"calls",type:"tuple[]"}],name:"attemptCalls",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address payable",name:"destination",type:"address"}],name:"drainLeftoverTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"},{internalType:"bytes",name:"message",type:"bytes"}],name:"handleV3AcrossMessage",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}];async function eQ(e){let{route:t,recipient:n,inputAmount:a,crossChainMessage:i,logger:r,apiUrl:s}=e,o="0x",l=n;if((0,e$.isHex)(i)&&(o=i),i&&"object"==typeof i){if(0===i.actions.length)throw Error("No 'crossChainMessage.actions' provided");r?.debug("Building cross chain message for actions:",i.actions),o=eW({actions:i.actions,fallbackRecipient:i.fallbackRecipient}),r?.debug("Original message:",o),l=function(e){switch(e){case 324:return"0x863859ef502F0Ee9676626ED5B418037252eFeb2";case 59144:return"0x1015c58894961F4F7Dd7D68ba033e28Ed3ee1cDB";default:return"0x924a9f036260DdD5808007E1AA95f08eD08aA569"}}(t.destinationChainId),r?.debug(`Recipient ${l}`)}let{outputAmount:u,...d}=await eV({...t,amount:a,recipient:l,message:o,logger:r,apiUrl:s,allowUnmatchedDecimals:!0});if(r?.debug("fees",d),i&&"object"==typeof i){for(let e of i.actions){let t=e.callData,n=BigInt(e.value);if(e?.update){let a=e.update(u);if(a instanceof Promise){let e=await a;e?.callData&&(t=e.callData),e?.value&&(n=e?.value)}else a?.callData&&(t=a.callData),a?.value&&(n=a?.value)}e.callData=t,e.value=n,r?.debug("Updated calldata:",e.callData),r?.debug("Updated value:",e.value)}o=eW({actions:i.actions,fallbackRecipient:i.fallbackRecipient}
1),r?.debug(`Updated message with output amount ${u}`,o)}let{timestamp:p,exclusiveRelayer:y,exclusivityDeadline:c,spokePoolAddress:m,destinationSpokePoolAddress:T,isAmountTooLow:f,limits:h,lpFee:b,relayerGasFee:g,relayerCapitalFee:v,totalRelayFee:w,estimatedFillTimeSec:x,fillDeadline:I}=d;return{deposit:{inputAmount:BigInt(a),outputAmount:u,recipient:l,message:o,quoteTimestamp:Number(p),exclusiveRelayer:y,exclusivityDeadline:c,spokePoolAddress:m,destinationSpokePoolAddress:T,fillDeadline:I,...t},limits:h,fees:{lpFee:b,relayerGasFee:g,relayerCapitalFee:v,totalRelayFee:w},isAmountTooLow:f,estimatedFillTimeSec:x}}var eG=e.i(232496);let eX=[{inputs:[],name:"ClaimedMerkleLeaf",type:"error"},{inputs:[],name:"DepositsArePaused",type:"error"},{inputs:[],name:"DisabledRoute",type:"error"},{inputs:[],name:"ExpiredFillDeadline",type:"error"},{inputs:[],name:"FillsArePaused",type:"error"},{inputs:[],name:"InsufficientSpokePoolBalanceToExecuteLeaf",type:"error"},{inputs:[],name:"InvalidBytes32",type:"error"},{inputs:[],name:"InvalidChainId",type:"error"},{inputs:[],name:"InvalidCrossDomainAdmin",type:"error"},{inputs:[],name:"InvalidDepositorSignature",type:"error"},{inputs:[],name:"InvalidExclusiveRelayer",type:"error"},{inputs:[],name:"InvalidFillDeadline",type:"error"},{inputs:[],name:"InvalidMerkleLeaf",type:"error"},{inputs:[],name:"InvalidMerkleProof",type:"error"},{inputs:[],name:"InvalidPayoutAdjustmentPct",type:"error"},{inputs:[],name:"InvalidQuoteTimestamp",type:"error"},{inputs:[],name:"InvalidRelayerFeePct",type:"error"},{inputs:[],name:"InvalidSlowFillRequest",type:"error"},{inputs:[],name:"InvalidWithdrawalRecipient",type:"error"},{inputs:[{internalType:"bytes",name:"data",type:"bytes"}],name:"LowLevelCallFailed",type:"error"},{inputs:[],name:"MaxTransferSizeExceeded",type:"error"},{inputs:[],name:"MsgValueDoesNotMatchInputAmount",type:"error"},{inputs:[],name:"NoRelayerRefundToClaim",type:"error"},{inputs:[],name:"NoSlowFillsInExclusivityWindow",type:"error"},{inputs:[],name:"NotEOA",type:"error"},{inputs:[],name:"NotExclusiveRelayer",type:"error"},{inputs:[],name:"RelayFilled",type:"error"},{inputs:[],name:"WrongERC7683OrderId",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"beacon",type:"address"}],name:"BeaconUpgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"l2TokenAddress",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"refundAddress",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!0,internalType:"address",name:"caller",type:"address"}],name:"ClaimedRelayerRefund",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"rootBundleId",type:"uint256"}],name:"EmergencyDeletedRootBundle",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"originToken",type:"address"},{indexed:!0,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!1,internalType:"bool",name:"enabled",type:"bool"}],name:"EnabledDepositRoute",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amountToReturn",type:"uint256"},{indexed:!0,internalType:"uint256",name:"chainId",type:"uint256"},{indexed:!1,internalType:"uint256[]",name:"refundAmounts",type:"uint256[]"},{indexed:!0,internalType:"uint32",name:"rootBundleId",type:"uint32"},{indexed:!0,internalType:"uint32",name:"leafId",type:"uint32"},{indexed:!1,internalType:"address",name:"l2TokenAddress",type:"address"},{indexed:!1,internalType:"address[]",name:"refundAddresses",type:"address[]"},{indexed:!1,internalType:"bool",name:"deferredRefunds",type:"bool"},{indexed:!1,internalType:"address",name:"caller",type:"address"}],name:"ExecutedRelayerRefundRoot",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"inputToken",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"outputToken",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"repaymentChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"depositId",type:"uint256"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!1,internalType:"bytes32",name:"exclusiveRelayer",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"relayer",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"depositor",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"recipient",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"messageHash",type:"bytes32"},{components:[{internalType:"bytes32",name:"updatedRecipient",type:"bytes32"},{internalType:"bytes32",name:"updatedMessageHash",type:"bytes32"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"enum V3SpokePoolInterface.FillType",name:"fillType",type:"uint8"}],indexed:!1,internalType:"struct V3SpokePoolInterface.V3RelayExecutionEventInfo",name:"relayExecutionInfo",type:"tuple"}],name:"FilledRelay",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"inputToken",type:"address"},{indexed:!1,internalType:"address",name:"outputToken",type:"address"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"repaymentChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!1,internalType:"address",name:"exclusiveRelayer",type:"address"},{indexed:!0,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"},{components:[{internalType:"address",name:"updatedRecipient",type:"address"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"enum V3SpokePoolInterface.FillType",name:"fillType",type:"uint8"}],indexed:!1,internalType:"struct V3SpokePoolInterface.LegacyV3RelayExecutionEventInfo",name:"relayExecutionInfo",type:"tuple"}],name:"FilledV3Relay",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"inputToken",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"outputToken",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!0,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"depositId",type:"uint256"},{indexed:!1,internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!0,internalType:"bytes32",name:"depositor",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"recipient",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"exclusiveRelayer",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"}
1],name:"FundsDeposited",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"isPaused",type:"bool"}],name:"PausedDeposits",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"isPaused",type:"bool"}],name:"PausedFills",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint32",name:"rootBundleId",type:"uint32"},{indexed:!0,internalType:"bytes32",name:"relayerRefundRoot",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"slowRelayRoot",type:"bytes32"}],name:"RelayedRootBundle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"inputToken",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"outputToken",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!0,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"depositId",type:"uint256"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!1,internalType:"bytes32",name:"exclusiveRelayer",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"depositor",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"recipient",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"messageHash",type:"bytes32"}],name:"RequestedSlowFill",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{indexed:!0,internalType:"uint256",name:"depositId",type:"uint256"},{indexed:!0,internalType:"bytes32",name:"depositor",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"updatedRecipient",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"updatedMessage",type:"bytes"},{indexed:!1,internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"RequestedSpeedUpDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"updatedRecipient",type:"address"},{indexed:!1,internalType:"bytes",name:"updatedMessage",type:"bytes"},{indexed:!1,internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"RequestedSpeedUpV3Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"inputToken",type:"address"},{indexed:!1,internalType:"address",name:"outputToken",type:"address"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!0,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!1,internalType:"address",name:"exclusiveRelayer",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"}],name:"RequestedV3SlowFill",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newWithdrawalRecipient",type:"address"}],name:"SetWithdrawalRecipient",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newAdmin",type:"address"}],name:"SetXDomainAdmin",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amountToReturn",type:"uint256"},{indexed:!0,internalType:"uint256",name:"chainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"leafId",type:"uint32"},{indexed:!0,internalType:"bytes32",name:"l2TokenAddress",type:"bytes32"},{indexed:!1,internalType:"address",name:"caller",type:"address"}],name:"TokensBridged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"inputToken",type:"address"},{indexed:!1,internalType:"address",name:"outputToken",type:"address"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!0,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"address",name:"exclusiveRelayer",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"}],name:"V3FundsDeposited",type:"event"},{inputs:[],name:"EMPTY_RELAYER",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"EMPTY_REPAYMENT_CHAIN_ID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"INFINITE_FILL_DEADLINE",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"MAX_EXCLUSIVITY_PERIOD_SECONDS",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"MAX_TRANSFER_SIZE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"UPDATE_ADDRESS_DEPOSIT_DETAILS_HASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"UPDATE_BYTES32_DEPOSIT_DETAILS_HASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32",name:"_initialDepositId",type:"uint32"},{internalType:"address",name:"_crossDomainAdmin",type:"address"},{internalType:"address",name:"_withdrawalRecipient",type:"address"}],name:"__SpokePool_init",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"chainId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"l2TokenAddress",type:"bytes32"},{internalType:"bytes32",name:"refundAddress",type:"bytes32"}],name:"claimRelayerRefund",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"crossDomainAdmin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"depositor",type:"bytes32"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"bytes32",name:"inputToken",type:"bytes32"},{internalType:"bytes32",name:"outputToken",type:"bytes32"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"bytes32",name:"exclusiveRelayer",type:"bytes32"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityParameter",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"originToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"uint256",name:"",type:"uint256"}],name:"depositDeprecated_5947912356",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"originToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"uint256",name:"",type:"uint256"}],name:"depositFor",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"depositor",type:"bytes32"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"bytes32",name:"inputToken",type:"bytes32"},{internalType:"bytes32",name:"outputToken",type:"bytes32"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"bytes32",name:"exclusiveRelayer",type:"bytes32"},{internalType:"uint32",name:"fillDeadlineOffset",type:"uint32"},{internalType:"uint32",name:"exclusivityPeriod",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],name:"depositNow",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"depositQuoteTimeBuffer",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityParameter",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],name:"depositV3",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"uint32",name:"fillDeadlineOffset",type:"uint32"},{internalType:"uint32",name:"exclusivityPeriod",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],name:"depositV3Now",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"rootBundleId",type:"uint256"}],name:"emergencyDeleteRootBundle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"enabledDepositRoutes",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32",name:"rootBundleId",type:"uint32"},{components:[{internalType:"uint256",name:"amountToReturn",type:"uint256"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"uint256[]",name:"refundAmounts",type:"uint256[]"},{internalType:"uint32",name:"leafId",type:"uint32"},{internalType:"address",name:"l2TokenAddress",type:"address"},{internalType:"address[]",name:"refundAddresses",type:"address[]"}],internalType:"struct SpokePoolInterface.RelayerRefundLeaf",name:"relayerRefundLeaf",type:"tuple"},{internalType:"bytes32[]",name:"proof",type:"bytes32[]"}],name:"executeRelayerRefundLeaf",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"bytes32",name:"depositor",type:"bytes32"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"bytes32",name:"exclusiveRelayer",type:"bytes32"},{internalType:"bytes32",name:"inputToken",type:"bytes32"},{internalType:"bytes32",name:"outputToken",type:"bytes32"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"uint256",name:"depositId",type:"uint256"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],internalType:"struct V3SpokePoolInterface.V3RelayData",name:"relayData",type:"tuple"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"}],internalType:"struct V3SpokePoolInterface.V3SlowFill",name:"slowFillLeaf",type:"tuple"},{internalType:"uint32",name:"rootBundleId",type:"uint32"},{internalType:"bytes32[]",name:"proof",type:"bytes32[]"}],name:"executeSlowRelayLeaf",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"orderId",type:"bytes32"},{internalType:"bytes",name:"originData",type:"bytes"},{internalType:"bytes",name:"fillerData",type:"bytes"}],name:"fill",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"fillDeadlineBuffer",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"bytes32",name:"depositor",type:"bytes32"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"bytes32",name:"exclusiveRelayer",type:"bytes32"},{internalType:"bytes32",name:"inputToken",type:"bytes32"},{internalType:"bytes32",name:"outputToken",type:"bytes32"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"uint256",name:"depositId",type:"uint256"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],internalType:"struct V3SpokePoolInterface.V3RelayData",name:"relayData",type:"tuple"},{internalType:"uint256",name:"repaymentChainId",type:"uint256"},{internalType:"bytes32",name:"repaymentAddress",type:"bytes32"}],name:"fillRelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"bytes32",name:"depositor",type:"bytes32"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"bytes32",name:"exclusiveRelayer",type:"bytes32"},{internalType:"bytes32",name:"inputToken",type:"bytes32"},{internalType:"bytes32",name:"outputToken",type:"bytes32"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"uint256",name:"depositId",type:"uint256"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],internalType:"struct V3SpokePoolInterface.V3RelayData",name:"relayData",type:"tuple"},{internalType:"uint256",name:"repaymentChainId",type:"uint256"},{internalType:"bytes32",name:"repaymentAddress",type:"bytes32"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"bytes32",name:"updatedRecipient",type:"bytes32"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"fillRelayWithUpdatedDeposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"
1",type:"bytes32"}],name:"fillStatuses",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],internalType:"struct V3SpokePoolInterface.V3RelayDataLegacy",name:"relayData",type:"tuple"},{internalType:"uint256",name:"repaymentChainId",type:"uint256"}],name:"fillV3Relay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"getCurrentTime",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"l2TokenAddress",type:"address"},{internalType:"address",name:"refundAddress",type:"address"}],name:"getRelayerRefund",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"msgSender",type:"address"},{internalType:"bytes32",name:"depositor",type:"bytes32"},{internalType:"uint256",name:"depositNonce",type:"uint256"}],name:"getUnsafeDepositId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"numberOfDeposits",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bool",name:"pause",type:"bool"}],name:"pauseDeposits",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bool",name:"pause",type:"bool"}],name:"pauseFills",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"pausedDeposits",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"pausedFills",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"relayerRefundRoot",type:"bytes32"},{internalType:"bytes32",name:"slowRelayRoot",type:"bytes32"}],name:"relayRootBundle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"relayerRefund",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"bytes32",name:"depositor",type:"bytes32"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"bytes32",name:"exclusiveRelayer",type:"bytes32"},{internalType:"bytes32",name:"inputToken",type:"bytes32"},{internalType:"bytes32",name:"outputToken",type:"bytes32"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"uint256",name:"depositId",type:"uint256"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],internalType:"struct V3SpokePoolInterface.V3RelayData",name:"relayData",type:"tuple"}],name:"requestSlowFill",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"rootBundles",outputs:[{internalType:"bytes32",name:"slowRelayRoot",type:"bytes32"},{internalType:"bytes32",name:"relayerRefundRoot",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newCrossDomainAdmin",type:"address"}],name:"setCrossDomainAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"originToken",type:"address"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"bool",name:"enabled",type:"bool"}],name:"setEnableRoute",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newWithdrawalRecipient",type:"address"}],name:"setWithdrawalRecipient",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"depositor",type:"bytes32"},{internalType:"uint256",name:"depositId",type:"uint256"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"bytes32",name:"updatedRecipient",type:"bytes32"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"speedUpDeposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"uint256",name:"depositId",type:"uint256"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"address",name:"updatedRecipient",type:"address"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"speedUpV3Deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"tryMulticall",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct MultiCallerUpgradeable.Result[]",name:"results",type:"tuple[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"depositor",type:"bytes32"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"bytes32",name:"inputToken",type:"bytes32"},{internalType:"bytes32",name:"outputToken",type:"bytes32"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"bytes32",name:"exclusiveRelayer",type:"bytes32"},{internalType:"uint256",name:"depositNonce",type:"uint256"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityParameter",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],name:"unsafeDeposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"withdrawalRecipient",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"wrappedNativeToken",outputs:[{internalType:"contract WETH9Interface",name:"",type:"address"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}];var eY=e.i(296407),eZ=e.i(243343);function eJ(e){if(!(0,e$.isHex)(e)||6!==e.length)throw Error(`Invalid integrator ID: ${e}. Needs to be 2 bytes hex string.`);return!0}function e0(e){if(!(0,e$.isHex)(e))throw Error("Invalid hex input");if(66===e.length)return e;if(!(0,c.isAddress)(e))throw Error("Invalid Address, cannot convert to bytes32");return(0,eZ.padHex)(e,{dir:"left",size:32})}function e2(e){if(!(0,e$.isHex)(e))throw Error("Invalid hex input");if(42===e.length)return e;let t=e.slice(2,26);if(/^0{24}$/.test(t)){let t=`0x${e.slice(-40)}`;if(!(0,c.isAddress)(t))throw Error("Invalid address extracted from bytes32");return t}return e}function e1(e,t){let n={depositTxHash:e[0].blockHash,depositTxBlock:e[0].blockNumber}
1,a=(0,eG.parseEventLogs)({abi:eX,eventName:"FundsDeposited",logs:e,args:t}),i=a?.[0];if(i)return{...n,depositId:i.args.depositId,inputToken:e2(i.args.inputToken),outputToken:e2(i.args.outputToken),inputAmount:i.args.inputAmount,outputAmount:i.args.outputAmount,destinationChainId:Number(i.args.destinationChainId),message:i.args.message,depositor:e2(i.args.depositor),recipient:e2(i.args.recipient),exclusiveRelayer:e2(i.args.exclusiveRelayer),quoteTimestamp:i.args.quoteTimestamp,fillDeadline:i.args.fillDeadline,exclusivityDeadline:i.args.exclusivityDeadline,status:"pending"};let r=(0,eG.parseEventLogs)({abi:eX,eventName:"V3FundsDeposited",logs:e,args:t}),s=r?.[0];if(s)return{...n,depositId:BigInt(s.args.depositId),inputToken:s.args.inputToken,outputToken:s.args.outputToken,inputAmount:s.args.inputAmount,outputAmount:s.args.outputAmount,destinationChainId:Number(s.args.destinationChainId),message:s.args.message,depositor:s.args.depositor,recipient:s.args.recipient,exclusiveRelayer:s.args.exclusiveRelayer,quoteTimestamp:s.args.quoteTimestamp,fillDeadline:s.args.fillDeadline,exclusivityDeadline:s.args.exclusivityDeadline,status:"pending"}}function e3(e){let{originChainId:t,receipt:n,filter:a}=e,i=e1(n.logs,a);if(!i)throw Error("No deposit log found.");return{...i,depositTxHash:n.transactionHash,depositTxBlock:n.blockNumber,originChainId:t}}async function e6(e){let{transactionHash:t,originChainId:n,publicClient:a}=e,i=await a.waitForTransactionReceipt({hash:t}),r=e3({originChainId:n,receipt:i});if(!r||!r.depositId)throw new eP(i.transactionHash,a.chain.id);return{depositTxReceipt:i,depositId:r.depositId}}var e5=e.i(298216),e4=e.i(125500),e8=e.i(916067),e9=e.i(156884),e7=e.i(256881);function te(e){let t;if("string"==typeof e)t=(0,e7.parseSignature)(e);else{let n=(0,e9.parseStructs)(e),a=e.length;for(let i=0;i<a;i++){let a=e[i];if(!(0,e8.isStructSignature)(a)){t=(0,e7.parseSignature)(a,n);break}}}if(!t)throw new e4.InvalidAbiItemError({signature:e});return t}let tt=[{inputs:[],name:"DepositsArePaused",type:"error"},{inputs:[],name:"DisabledRoute",type:"error"},{inputs:[],name:"ExpiredFillDeadline",type:"error"},{inputs:[],name:"FillsArePaused",type:"error"},{inputs:[],name:"InvalidChainId",type:"error"},{inputs:[],name:"InvalidDepositorSignature",type:"error"},{inputs:[],name:"InvalidExclusiveRelayer",type:"error"},{inputs:[],name:"InvalidExclusivityDeadline",type:"error"},{inputs:[],name:"InvalidFillDeadline",type:"error"},{inputs:[],name:"InvalidQuoteTimestamp",type:"error"},{inputs:[],name:"InvalidRelayerFeePct",type:"error"},{inputs:[],name:"MaxTransferSizeExceeded",type:"error"},{inputs:[],name:"MsgValueDoesNotMatchInputAmount",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"totalFilledAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fillAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"repaymentChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!1,internalType:"int64",name:"relayerFeePct",type:"int64"},{indexed:!1,internalType:"int64",name:"realizedLpFeePct",type:"int64"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"address",name:"destinationToken",type:"address"},{indexed:!1,internalType:"address",name:"relayer",type:"address"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"},{components:[{internalType:"address",name:"recipient",type:"address"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"bool",name:"isSlowRelay",type:"bool"},{internalType:"int256",name:"payoutAdjustmentPct",type:"int256"}],indexed:!1,internalType:"struct SpokePool.RelayExecutionInfo",name:"updatableRelayData",type:"tuple"}],name:"FilledRelay",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"inputToken",type:"address"},{indexed:!1,internalType:"address",name:"outputToken",type:"address"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"repaymentChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!1,internalType:"address",name:"exclusiveRelayer",type:"address"},{indexed:!0,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"},{components:[{internalType:"address",name:"updatedRecipient",type:"address"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"enum V3SpokePoolInterface.FillType",name:"fillType",type:"uint8"}],indexed:!1,internalType:"struct V3SpokePoolInterface.V3RelayExecutionEventInfo",name:"relayExecutionInfo",type:"tuple"}],name:"FilledV3Relay",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!1,internalType:"int64",name:"relayerFeePct",type:"int64"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{indexed:!1,internalType:"address",name:"originToken",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"}
1],name:"FundsDeposited",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"int64",name:"newRelayerFeePct",type:"int64"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"updatedRecipient",type:"address"},{indexed:!1,internalType:"bytes",name:"updatedMessage",type:"bytes"},{indexed:!1,internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"RequestedSpeedUpDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"updatedRecipient",type:"address"},{indexed:!1,internalType:"bytes",name:"updatedMessage",type:"bytes"},{indexed:!1,internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"RequestedSpeedUpV3Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"inputToken",type:"address"},{indexed:!1,internalType:"address",name:"outputToken",type:"address"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!0,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!1,internalType:"address",name:"exclusiveRelayer",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"}],name:"RequestedV3SlowFill",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amountToReturn",type:"uint256"},{indexed:!0,internalType:"uint256",name:"chainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"leafId",type:"uint32"},{indexed:!0,internalType:"address",name:"l2TokenAddress",type:"address"},{indexed:!1,internalType:"address",name:"caller",type:"address"}],name:"TokensBridged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"inputToken",type:"address"},{indexed:!1,internalType:"address",name:"outputToken",type:"address"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!0,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"address",name:"exclusiveRelayer",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"}],name:"V3FundsDeposited",type:"event"},{inputs:[],name:"EMPTY_RELAYER",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"EMPTY_REPAYMENT_CHAIN_ID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"INFINITE_FILL_DEADLINE",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"MAX_TRANSFER_SIZE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"UPDATE_V3_DEPOSIT_DETAILS_HASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"chainId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"originToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"uint256",name:"",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadlineOffset",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],name:"depositExclusive",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"originToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"int64",name:"relayerFeePct",type:"int64"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"uint256",name:"",type:"uint256"}],name:"depositFor",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"depositQuoteTimeBuffer",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],name:"depositV3",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"uint32",name:"fillDeadlineOffset",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],name:"depositV3Now",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"enabledDepositRoutes",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"fillDeadlineBuffer",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"fillStatuses",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],internalType:"struct V3SpokePoolInterface.V3RelayData",name:"relayData",type:"tuple"},{internalType:"uint256",name:"repaymentChainId",type:"uint256"}],name:"fillV3Relay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],internalType:"struct V3SpokePoolInterface.V3RelayData",name:"relayData",type:"tuple"},{internalType:"uint256",name:"repaymentChainId",type:"uint256"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"address",name:"updatedRecipient",type:"address"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"fillV3RelayWithUpdatedDeposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"getCurrentTime",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"numberOfDeposits",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"depositor",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"address",name:"exclusiveRelayer",type:"address"},{internalType:"address",name:"inputToken",type:"address"},{internalType:"address",name:"outputToken",type:"address"},{internalType:"uint256",name:"inputAmount",type:"uint256"},{internalType:"uint256",name:"outputAmount",type:"uint256"},{internalType:"uint256",name:"originChainId",type:"uint256"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"uint32",name:"fillDeadline",type:"uint32"},{internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{internalType:"bytes",name:"message",type:"bytes"}],internalType:"struct V3SpokePoolInterface.V3RelayData",name:"relayData",type:"tuple"}],name:"requestV3SlowFill",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"depositor",type:"address"},{internalType:"uint32",name:"depositId",type:"uint32"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"address",name:"updatedRecipient",type:"address"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"bytes",name:"depositorSignature",type:"bytes"}],name:"speedUpV3Deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"tryMulticall",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct MultiCallerUpgradeable.Result[]",name:"results",type:"tuple[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"wrappedNativeToken",outputs:[{internalType:"contract WETH9Interface",name:"",type:"address"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}];async function tn(e){try{return await ta(e)}catch(n){let t="Event filtering currently disabled for this RPC provider, switching to getFillByDepositTx()";return e?.logger?e.logger.error(t,{cause:n}):console.error(t,{cause:n}),await tl({...e,deposit:{...e.deposit,depositTxHash:e.depositTxHash,depositId:e.depositId}})}}async function ta(e){let{logger:t}=e;try{return await ti(e)}catch(e){throw t?t.error("Error waiting for fill events",e):console.error("Error waiting for fill events",e),e}}async function ti(e){let{depositId:t,destinationChainClient:n,deposit:a,fromBlock:i,logger:r}=e;return new Promise((e,s)=>{let o=n.watchContractEvent({address:a.destinationSpokePoolAddress,abi:eX,eventName:"FilledRelay",args:{depositId:BigInt(t),originChainId:BigInt(a.originChainId)},fromBlock:i,onError:async e=>{r?r.error("Watch FilledRelay event error",e):console.error("Watch FilledRelay event error",e),o(),s(e)},onLogs:async t=>{t.length&&(r?r.debug("V3_5 Fill events found in block",t):console.log("V3_5 Fill events found in block",t));let[i]=t;if(i)try{var l;let[t,s]=await Promise.all([n.getTransactionReceipt({hash:i.transactionHash}),n.getBlock({blockNumber:i.blockNumber})]),u=tr([i]);if(o(),l=a.message,""!==l&&"0x"!==l&&"0x0000000000000000000000000000000000000000000000000000000000000000"!==l){let n=(0,eG.parseEventLogs)({abi:ez,logs:t.logs});r?.debug("Fill Logs",n);let a=!n.some(e=>
1"CallsFailed"===e.eventName);e({actionSuccess:a,fillTxReceipt:t,fillTxTimestamp:s.timestamp,parsedFillEvent:u})}e({fillTxReceipt:t,fillTxTimestamp:s.timestamp,parsedFillEvent:u})}catch(e){o(),s(e)}}})})}function tr(e,t){let n={depositTxHash:e[0].blockHash,depositTxBlock:e[0].blockNumber},a=(0,eG.parseEventLogs)({abi:eX,eventName:"FilledRelay",logs:e,args:{...t,depositId:t?.depositId?BigInt(t?.depositId):void 0}}),i=a?.[0];if(i)return{...n,inputToken:e2(i.args.inputToken),outputToken:e2(i.args.outputToken),inputAmount:i.args.inputAmount,outputAmount:i.args.outputAmount,repaymentChainId:i.args.repaymentChainId,originChainId:i.args.originChainId,depositId:i.args.depositId,fillDeadline:i.args.fillDeadline,exclusivityDeadline:i.args.exclusivityDeadline,exclusiveRelayer:e2(i.args.exclusiveRelayer),relayer:e2(i.args.relayer),depositor:e2(i.args.depositor),recipient:e2(i.args.recipient),messageHash:i.args.messageHash,relayExecutionInfo:{...i.args.relayExecutionInfo,updatedRecipient:e2(i.args.relayExecutionInfo.updatedRecipient),fillType:ts?.[i.args.relayExecutionInfo.fillType]}};let r=(0,eG.parseEventLogs)({abi:tt,eventName:"FilledV3Relay",logs:e,args:{...t,depositId:Number(t?.depositId)}}),s=r?.[0];if(s)return{...n,inputToken:s.args.inputToken,outputToken:s.args.outputToken,inputAmount:s.args.inputAmount,outputAmount:s.args.outputAmount,repaymentChainId:s.args.repaymentChainId,originChainId:s.args.originChainId,depositId:s.args.depositId,fillDeadline:s.args.fillDeadline,exclusivityDeadline:s.args.exclusivityDeadline,exclusiveRelayer:s.args.exclusiveRelayer,relayer:s.args.relayer,depositor:s.args.depositor,recipient:s.args.recipient,message:s.args.message,relayExecutionInfo:{...s.args.relayExecutionInfo,fillType:ts?.[s.args.relayExecutionInfo.fillType]}}}let ts={0:"FastFill",1:"ReplacedSlowFill",2:"SlowFill"};async function to(e){let{indexerUrl:t=eq,logger:n}=e;try{let n=await eF(`${t}/deposit/status`,{depositId:BigInt(e.deposit.depositId),originChainId:e.deposit.originChainId});if(n?.status==="filled"&&n?.fillTx){let t=await e.destinationChainClient.getTransactionReceipt({hash:n.fillTx}),a=await e.destinationChainClient.getBlock({blockNumber:t.blockNumber}),i=tr(t.logs);if("0x"!==e.deposit.message){let[e]=(0,eG.parseEventLogs)({abi:[te("event CallsFailed(Call[] calls, address indexed fallbackRecipient)")],logs:t.logs});return{actionSuccess:!e,fillTxReceipt:t,fillTxTimestamp:a.timestamp,parsedFillEvent:i}}return{fillTxReceipt:t,fillTxTimestamp:a.timestamp,parsedFillEvent:i}}}catch(e){n?.warn(`Failed to get fill status from indexer: ${e}`)}let[a]=await tu(e);if(!a)throw new eO(BigInt(e.deposit.depositId),e.deposit.destinationChainId,e.deposit.depositTxHash);let[i,r]=await Promise.all([e.destinationChainClient.getTransactionReceipt({hash:a.transactionHash}),e.destinationChainClient.getBlock({blockNumber:a.blockNumber})]),s=tr(i.logs);if("0x"!==e.deposit.message){let[e]=(0,eG.parseEventLogs)({abi:[te("event CallsFailed(Call[] calls, address indexed fallbackRecipient)")],logs:i.logs});return{actionSuccess:!e,fillTxReceipt:i,fillTxTimestamp:r.timestamp,parsedFillEvent:s}}return{fillTxReceipt:i,fillTxTimestamp:r.timestamp,parsedFillEvent:s}}async function tl(e){let t=e?.pollingInterval??e.destinationChainClient.pollingInterval;return new Promise(n=>{let a=()=>{to(e).then(e=>{e.fillTxReceipt?n(e):setTimeout(a,t)}).catch(n=>{e?.logger?e.logger.error(n):console.log(n),setTimeout(a,t)})};a()})}async function tu(e){let{deposit:t,fromBlock:n,destinationChainClient:a}=e,[i,r]=await Promise.all([a.getLogs({address:t.destinationSpokePoolAddress,event:{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"inputToken",type:"address"},{indexed:!1,internalType:"address",name:"outputToken",type:"address"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"repaymentChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!1,internalType:"address",name:"exclusiveRelayer",type:"address"},{indexed:!0,internalType:"address",name:"relayer",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"},{components:[{internalType:"address",name:"updatedRecipient",type:"address"},{internalType:"bytes",name:"updatedMessage",type:"bytes"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"enum V3SpokePoolInterface.FillType",name:"fillType",type:"uint8"}],indexed:!1,internalType:"struct V3SpokePoolInterface.V3RelayExecutionEventInfo",name:"relayExecutionInfo",type:"tuple"}],name:"FilledV3Relay",type:"event"},args:{depositId:Number(t.depositId),originChainId:BigInt(t.originChainId)},fromBlock:n??0n}),a.getLogs({address:t.destinationSpokePoolAddress,event:{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"inputToken",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"outputToken",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"repaymentChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"originChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"depositId",type:"uint256"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!1,internalType:"bytes32",name:"exclusiveRelayer",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"relayer",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"depositor",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"recipient",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"messageHash",type:"bytes32"},{components:[{internalType:"bytes32",name:"updatedRecipient",type:"bytes32"},{internalType:"bytes32",name:"updatedMessageHash",type:"bytes32"},{internalType:"uint256",name:"updatedOutputAmount",type:"uint256"},{internalType:"enum V3SpokePoolInterface.FillType",name:"fillType",type:"uint8"}],indexed:!1,internalType:"struct V3SpokePoolInterface.V3RelayExecutionEventInfo",name:"relayExecutionInfo",type:"tuple"}],name:"FilledRelay",type:"event"},args:{depositId:BigInt(t.depositId),originChainId:BigInt(t.originChainId)},fromBlock:n??0n})]);return i??r}async function td(e){let t,{originChainClient:n,destinationChainClient:a,findBy:i,depositLogFromBlock:r,fillLogFromBlock:s,indexerUrl:o}=e,{originChainId:l,destinationSpokePoolAddress:u}=i;if(!(i.depositTxHash||i.depositId&&i.originSpokePoolAddress))throw Error("You must provide either a 'depositTxHash' or 'depositId' + 'spokePoolAddress'");if(i.depositTxHash){let e=i.depositTxHash;if(!(0,e5.isHash)(e))throw Error(`Can't get receipt for tx hash: ${e}`);let a=await n.getTransactionReceipt({hash:e});if(!a)throw Error(`No receipt found for tx hash: ${e}`);t=e3({originChainId:l,receipt:a})}else if(i.depositId&&i.originSpokePoolAddress){let{depositId:n,originSpokePoolAddress:a}=i,s=BigInt(i.depositId),o=await tp({depositId:n,depositLogFromBlock:r,originChainClient:e.originChainClient,originSpokePoolAddress:a});if(!o?.length)throw Error(`No deposit logs found for deposit id: ${n}`);let u=e1(o);if(!u)throw Error(`Unable to parse Deposit logs for deposit id: ${n}`);t={...u,depositId:s,originChainId:l}}if(!t)throw Error(`No deposit found for ${JSON.stringify(i)}`);try{let e=await to({deposit:{depositId:t.depositId,originChainId:t.originChainId,destinationSpokePoolAddress:u,message:t.message,depositTxHash:t.depositTxHash,destinationChainId:t.destinationChainId},fromBlock:s,destinationChainClient:a,indexerUrl:o});
1t.fillTxHash=e.fillTxReceipt.transactionHash,t.fillTxBlock=e.fillTxReceipt.blockNumber,t.status="filled",t.actionSuccess=e.actionSuccess}catch(e){if(e instanceof eO);else throw e}return t}async function tp({depositId:e,depositLogFromBlock:t,originChainClient:n,originSpokePoolAddress:a}){let[i,r]=await Promise.all([n.getLogs({address:a,event:{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"inputToken",type:"address"},{indexed:!1,internalType:"address",name:"outputToken",type:"address"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!0,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!0,internalType:"uint32",name:"depositId",type:"uint32"},{indexed:!1,internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"address",name:"exclusiveRelayer",type:"address"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"}],name:"V3FundsDeposited",type:"event"},args:{depositId:Number(e)},fromBlock:t??0n}),n.getLogs({address:a,event:{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"inputToken",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"outputToken",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"inputAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"outputAmount",type:"uint256"},{indexed:!0,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"depositId",type:"uint256"},{indexed:!1,internalType:"uint32",name:"quoteTimestamp",type:"uint32"},{indexed:!1,internalType:"uint32",name:"fillDeadline",type:"uint32"},{indexed:!1,internalType:"uint32",name:"exclusivityDeadline",type:"uint32"},{indexed:!0,internalType:"bytes32",name:"depositor",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"recipient",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"exclusiveRelayer",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"message",type:"bytes"}],name:"FundsDeposited",type:"event"},args:{depositId:BigInt(e)},fromBlock:t??0n})]);return i??r}async function ty(e){let{walletClient:t,deposit:n,publicClient:a,integratorId:i,logger:r}=e,{originChainId:s,destinationChainId:o,inputToken:l,outputToken:u,inputAmount:d,outputAmount:p,recipient:y,message:c,isNative:T,spokePoolAddress:f,fillDeadline:h,exclusiveRelayer:b,exclusivityDeadline:g,quoteTimestamp:v}=n,w=t.account;if(!w)throw Error("Wallet account has to be set");let x=await t.getChainId();if(x!==s)throw Error(`Connected chainId ${x} does not match originChainId ${s}`);let I=b!==m.zeroAddress&&g>0;r?.debug(`Using exclusive relayer: ${I}`);let S=await a.simulateContract({account:t.account,abi:eX,address:f,functionName:"deposit",args:[e0(w.address),e0(y??w.address),e0(l),e0(u),BigInt(d),p,BigInt(o),e0(b),v,h,g,c],value:T?BigInt(d):0n,dataSuffix:(eJ(i),(0,eY.concat)(["0x1dc0de",i]))});return r?.debug("Simulation result",S),S}var tc=e.i(303028),tm=e.i(570635);async function tT(e){let{walletClient:t,publicClient:n,spender:a,approvalAmount:i,tokenAddress:r}=e;if(!t.account)throw Error("Wallet account has to be set");return await n.simulateContract({account:t.account,abi:(0,tm.parseAbi)(["function approve(address spender, uint256 amount) public returns (bool)"]),address:e2(r),functionName:"approve",args:[e2(a),i]})}async function tf(e){let t,n,{integratorId:a,deposit:i,walletClient:r,originClient:s,destinationClient:o,skipAllowanceCheck:l,infiniteApproval:u,throwOnError:d=!0,forceOriginChain:p,onProgress:y,logger:c}=e,m=y||(e=>{var t,n;return t=e,void((n=c)&&n.debug("Progress",t))}),T={status:"idle",step:"approve"};try{let e=r.account;if(!e)throw Error("Wallet account has to be set");p&&await r.switchChain({id:i.originChainId});let d=await r.getChainId();if(d!==i.originChainId)throw Error(`Connected chain ${d} does not match 'originChainId' ${i.originChainId}`);let{inputToken:y,inputAmount:f,spokePoolAddress:h}=i;if(!l&&!i.isNative){let a=await s.readContract({address:y,abi:(0,tm.parseAbi)(["function allowance(address owner, address spender) public view returns (uint256)"]),functionName:"allowance",args:[e.address,h]});if(c?.debug("Allowance",{allowance:a,owner:e.address,spender:h,inputToken:y}),BigInt(f)>a){let a=u?tc.maxUint256:BigInt(f);n={approvalAmount:a,spender:h},T={step:"approve",status:"simulationPending",meta:n},m(T);let{request:i}=await tT({walletClient:r,publicClient:s,spender:h,approvalAmount:a,tokenAddress:y});t=i,T={...T,status:"simulationSuccess",txRequest:i},m(T);let o=await r.writeContract({account:e,...t});T={...T,status:"txPending",txHash:o},m(T);let l=await s.waitForTransactionReceipt({hash:o});T={...T,status:"txSuccess",txReceipt:l},m(T)}}n={deposit:i},T={step:"deposit",status:"simulationPending",meta:n},m(T);let{request:b}=await ty({walletClient:r,publicClient:s,deposit:i,integratorId:a,logger:c});t=b,T={...T,status:"simulationSuccess",txRequest:b},m(T);let g=await r.writeContract({account:e,...t});T={...T,status:"txPending",txHash:g},m(T);let v=await o.getBlockNumber(),{depositId:w,depositTxReceipt:x}=await e6({originChainId:i.originChainId,transactionHash:g,publicClient:s}),I=e1(x.logs);T={...T,status:"txSuccess",txReceipt:x,depositId:w,depositLog:I},m(T),n={depositId:w,deposit:i},T={step:"fill",status:"txPending",meta:n},m(T);let{fillTxReceipt:S,fillTxTimestamp:C,actionSuccess:E}=await tn({deposit:i,depositId:w,depositTxHash:g,destinationChainClient:o,fromBlock:v-100n}),k=tr(S.logs);return T={...T,status:"txSuccess",txReceipt:S,fillTxTimestamp:C,actionSuccess:E,fillLog:k},m(T),{depositId:w,depositTxReceipt:x,fillTxReceipt:S}}catch(t){let e="txPending"===T.status?"txError":"simulationPending"===T.status?"simulationError":"error";if(m({...T,status:e,error:t,meta:n}),!d)return{error:t};throw t}}async function th(e){let{walletClient:t,depositId:n,originChainId:a,updatedMessage:i,updatedOutputAmount:r,updatedRecipient:s}=e,o=t.account;if(!o)throw Error("Wallet account has to be set");return await t.signTypedData(function({signerAddress:e,originChainId:t,depositId:n,updatedMessage:a,updatedOutputAmount:i,updatedRecipient:r}){return{account:e,domain:{name:"ACROSS-V2",version:"1.0.0",chainId:Number(t)},types:{UpdateDepositDetails:[{name:"depositId",type:"uint256"},{name:"originChainId",type:"uint256"},{name:"updatedOutputAmount",type:"uint256"},{name:"updatedRecipient",type:"address"},{name:"updatedMessage",type:"bytes"}]},primaryType:"UpdateDepositDetails",message:{depositId:BigInt(n),originChainId:BigInt(t),updatedOutputAmount:i,updatedRecipient:r,updatedMessage:a}}}({signerAddress:o.address,originChainId:a,depositId:n,updatedMessage:i,updatedOutputAmount:r,updatedRecipient:s}))}async function tb(e){let{walletClient:t,deposit:n,update:a,originChainClient:i,destinationChainClient:r,logger:s,apiUrl:o}=e,{originChainId:l,originSpokePoolAddress:u,destinationChainId:d,destinationSpokePoolAddress:p,depositId:y}=n,c=t.account;if(!c)throw Error("Wallet account has to be set");let m=await t.getChainId();if(m!==l)throw Error(`Connected chainId ${m} does not match originChainId ${l}`);let T=await td({originChainClient:i,destinationChainClient:r,findBy:{depositId:y,originChainId:l,destinationChainId:d,destinationSpokePoolAddress:p}});if(T.depositor!==c.address)throw Error(`Connected account ${c.address} does not match depositor ${T.depositor}`);let f=a.recipient??T.recipient,h=await eQ({route:{originChainId:l,destinationChainId:d,inputToken:T.inputToken,outputToken:T.outputToken},inputAmount:T.inputAmount,recipient:f,crossChainMessage:a.crossChainMessage??T.message,logger:s,apiUrl:o});if(a.outputAmount&&a.outputAmount<h.deposit.outputAmount)throw Error(`Provided 'update.outputAmount' ${a.outputAmount} is less than the required ${h.deposit.outputAmount}`);let b=a.outputAmount??h.deposit.outputAmount,g=h.deposit.message,v=await th({walletClient:t,updatedMessage:g,updatedOutputAmount:b,updatedRecipient:f,originChainId:l,depositId:y}),w=await i.simulateContract({account:c,abi:eX,address:u,functionName:"speedUpV3Deposit",args:[c.address,T.depositId,b,f,g,v]});return s?.debug("'speedUpV3Deposit' sim result",w),w}let tg={DEBUG:3,INFO:2,WARN:1,ERROR:0};class tv{logLevel;secondaryLabel="@across-protocol/app-sdk";logPrefix=">";constructor(e){this.logLevel=e}createLogLevelLabel=e=>({label:`${tx(tI[e].primary)} ${e} ${tw}${tx(tI[e].secondary)} ${this.secondaryLabel}${tw}`,prefix:`${tx(tI[e].secondary)}${this.logPrefix}${tw}`});log(e,...t){let{label:n,prefix:a}=this.createLogLevelLabel(e);console.log(`${n}
2`),t.forEach(e=>{console.log(a,e,"\n")})}debug(...e){tg.DEBUG<=tg[this.logLevel]&&this.log("DEBUG",...e)}info(...e){tg.INFO<=tg[this.logLevel]&&this.log("INFO",...e)}warn(...e){tg.WARN<=tg[this.logLevel]&&this.log("WARN",...e)}error(...e){tg.ERROR<=tg[this.logLevel]&&this.log("ERROR",...e)}}let tw="\x1b[0m",tx=e=>`\x1b[${e}m`,tI={DEBUG:{primary:44,secondary:34},INFO:{primary:46,secondary:36},WARN:{primary:43,secondary:33},ERROR:{primary:41,secondary:31}};var tS=e.i(422642),tC=e.i(495207);e.i(558697);var tE=e.i(538813),tk=e.i(17344),tA=e.i(467075);let tR=new Map;async function tD(e){let{getSocket:t,keepAlive:n=!0,key:a="socket",reconnect:i=!0,url:r}=e,{interval:s=3e4}="object"==typeof n?n:{},{attempts:o=5,delay:l=2e3}="object"==typeof i?i:{},u=JSON.stringify({keepAlive:n,key:a,url:r,reconnect:i}),d=tR.get(u);if(d)return d;let p=0,{schedule:y}=(0,tE.createBatchScheduler)({id:u,fn:async()=>{let e,a,y,c,m=new Map,T=new Map,f=!1,h=!1;function b(){i&&!h&&p<o?f||(f=!0,p++,a?.close(),c=setTimeout(async()=>{if(c=void 0,h){f=!1;return}await g().catch(console.error),f=!1},l)):(m.clear(),T.clear())}async function g(){let o=await t({onClose(){for(let e of m.values())e.onError?.(new tS.SocketClosedError({url:r}));for(let e of T.values())e.onError?.(new tS.SocketClosedError({url:r}));b()},onError(t){for(let n of(e=t,m.values()))n.onError?.(e);for(let t of T.values())t.onError?.(e);b()},onOpen(){e=void 0,p=0},onResponse(e){let t="eth_subscription"===e.method,n=t?e.params.subscription:e.id,a=t?T:m,i=a.get(n);i&&i.onResponse(e),t||a.delete(n)}});if(h)return o.close(),o;if(a=o,n&&(y&&clearInterval(y),y=setInterval(()=>a.ping?.(),s)),i&&T.size>0)for(let[e,{onResponse:t,body:n,onError:a}]of T.entries())n&&(T.delete(e),d?.request({body:n,onResponse:t,onError:a}));return o}return await g(),e=void 0,d={close(){h=!0,y&&clearInterval(y),c&&(clearTimeout(c),c=void 0,f=!1),a.close(),tR.delete(u)},get socket(){return a},request({body:t,onError:n,onResponse:i}){e&&n&&n(e);let r=t.id??tA.idCache.take(),s=e=>{("number"!=typeof e.id||r===e.id)&&("eth_subscribe"===t.method&&"string"==typeof e.result&&T.set(e.result,{onResponse:s,onError:n,body:t}),i(e))};"eth_unsubscribe"===t.method&&T.delete(t.params?.[0]),m.set(r,{onResponse:s,onError:n});try{a.request({body:{jsonrpc:"2.0",id:r,...t}})}catch(e){n?.(e)}},requestAsync({body:e,timeout:t=1e4}){return(0,tk.withTimeout)(()=>new Promise((t,n)=>this.request({body:e,onError:n,onResponse:t})),{errorInstance:new tS.TimeoutError({body:e,url:r}),timeout:t})},requests:m,subscriptions:T,url:r},tR.set(u,d),[d]}}),[c,[m]]=await y();return m}async function tN(t,n={}){let{keepAlive:a,reconnect:i}=n;return tD({async getSocket({onClose:n,onError:a,onOpen:i,onResponse:r}){let s=await e.A(856899).then(e=>e.WebSocket),o=new s(t);function l(){o.removeEventListener("close",l),o.removeEventListener("message",u),o.removeEventListener("error",a),o.removeEventListener("open",i),n()}function u({data:e}){if("string"!=typeof e||0!==e.trim().length)try{let t=JSON.parse(e);r(t)}catch(e){a(e)}}o.addEventListener("close",l),o.addEventListener("message",u),o.addEventListener("error",a),o.addEventListener("open",i),o.readyState===s.CONNECTING&&await new Promise((e,t)=>{o&&(o.onopen=e,o.onerror=t)});let{close:d}=o;return Object.assign(o,{close(){d.bind(o)(),l()},ping(){try{if(o.readyState===o.CLOSED||o.readyState===o.CLOSING)throw new tS.WebSocketRequestError({url:o.url,cause:new tS.SocketClosedError({url:o.url})});o.send(JSON.stringify({jsonrpc:"2.0",id:null,method:"net_version",params:[]}))}catch(e){a(e)}},request({body:e}){if(o.readyState===o.CLOSED||o.readyState===o.CLOSING)throw new tS.WebSocketRequestError({body:e,url:o.url,cause:new tS.SocketClosedError({url:o.url})});return o.send(JSON.stringify(e))}})},keepAlive:a,reconnect:i,url:t})}async function tP(e){let t=await tN(e);return Object.assign(t.socket,{requests:t.requests,subscriptions:t.subscriptions})}var tO=e.i(947266);async function t_({logger:e,apiUrl:t=eU,...n}){return await eL(`${t}/chains`,n,e)}async function tM(e){let t=`https://api.tenderly.co/api/v1/account/${e.accountSlug}/project/${e.projectSlug}/simulate`,n=await fetch(t,{method:"POST",headers:{"X-Access-Key":e.accessKey},body:JSON.stringify({network_id:e.networkId,from:e.from,to:e.to,input:e.data,gas:e.gas?Number(e.gas):void 0,block_number:e.blockNumber,save:!0})});
2if(!e_(n))throw new eE({status:n.status,url:t,message:`Failed to simulate tx on Tenderly - ${n.status} ${n.statusText} - ${await n.text()}`});let a=(await n.json()).simulation.id;if(e.enableShare){let t=`https://api.tenderly.co/api/v1/account/${e.accountSlug}/project/${e.projectSlug}/simulations/${a}/share`,n=await fetch(t,{method:"POST",headers:{"X-Access-Key":e.accessKey}});if(!e_(n))throw new eE({status:n.status,url:t,message:`Failed to enable sharing Tenderly simulation - ${n.status} ${n.statusText} - ${await n.text()}`})}let i=e.enableShare?`https://www.tdly.co/shared/simulation/${a}`:`https://dashboard.tenderly.co/${e.accountSlug}/${e.projectSlug}/simulator/${a}`;return{simulationId:a,simulationUrl:i}}class tL{static instance=null;integratorId;publicClients;chainInfo;walletClient;apiUrl;indexerUrl;logger;tenderly;get isTenderlyEnabled(){return!!(this.tenderly?.accessKey&&this.tenderly?.accountSlug&&this.tenderly?.projectSlug)}constructor(e){const t=e?.integratorId??"0xdead";eJ(t),this.integratorId=t,this.walletClient=e?.walletClient,this.publicClients=function(e,t,n){return new Map(e.map(e=>{let a=n?.[e.id],i=(void 0)??(a?.startsWith("ws")?function(e,t={}){let{keepAlive:n,key:a="webSocket",methods:i,name:r="WebSocket JSON-RPC",reconnect:s,retryDelay:o}=t;return({chain:l,retryCount:u,timeout:d})=>{let p=t.retryCount??u,y=d??t.timeout??1e4,c=e||l?.rpcUrls.default.webSocket?.[0],m={keepAlive:n,reconnect:s};if(!c)throw new tC.UrlRequiredError;return(0,tO.createTransport)({key:a,methods:i,name:r,async request({method:e,params:t}){let n={method:e,params:t},a=await tN(c,m),{error:i,result:r}=await a.requestAsync({body:n,timeout:y});if(i)throw new tS.RpcRequestError({body:n,error:i,url:c});return r},retryCount:p,retryDelay:o,timeout:y,type:"webSocket"},{getSocket:()=>tP(c),getRpcClient:()=>tN(c,m),async subscribe({params:e,onData:t,onError:n}){let a=await tN(c,m),{result:i}=await new Promise((i,r)=>a.request({body:{method:"eth_subscribe",params:e},onError(e){r(e),n?.(e)},onResponse(e){if(e.error){r(e.error),n?.(e.error);return}"number"==typeof e.id?i(e):"eth_subscription"===e.method&&t(e.params)}}));return{subscriptionId:i,unsubscribe:async()=>new Promise(e=>a.request({body:{method:"eth_unsubscribe",params:[i]},onResponse:e}))}}})}}(a):(0,D.http)(a));return[e.id,(0,A.createPublicClient)({chain:e,pollingInterval:t,key:e.id.toString(),transport:i,batch:{multicall:!0}})]}))}(e.chains,e.pollingInterval??3e3,e?.rpcUrls),this.indexerUrl=e?.useTestnet===!0?"https://dev.indexer.api.across.to":eq,this.apiUrl=e?.useTestnet===!0?"https://testnet.across.to/api":eU,this.logger=e?.logger??new tv(e?.logLevel??"ERROR"),this.tenderly=e.tenderly,this.tenderly&&(this.tenderly.simOnError=e.tenderly?.simOnError??!0),this.logger.debug("Client created with args: \n",e)}static create(e){return null===this.instance&&(this.instance=new tL(e)),this.instance}static getInstance(){if(null===this.instance)throw Error("AcrossClient has not been initialized. Call create() first.");return this.instance}update(e){this.walletClient=e.walletClient}getPublicClient(e){let t=this.publicClients.get(e);if(!t)throw new eN(`SDK not configured for chain with id ${e}.`);return this.logger.debug(`Using configured public client for chain ${e}.`),t}async getSpokePoolAddress(e){return(await this.getChainInfo(e)).spokePool}
2async getChainInfo(e){if(!this.chainInfo){let e=await this.getSupportedChains({chainId:Array.from(this.publicClients.keys())});this.chainInfo=new Map(e.map(e=>[e.chainId,e]))}if(!this.chainInfo.has(e))throw Error(`Could not find chainInfo for chain with id ${e}`);return this.chainInfo.get(e)}async executeQuote(e){let t=e?.logger??this.logger,n=e?.originClient??this.getPublicClient(e.deposit.originChainId),a=e?.destinationClient??this.getPublicClient(e.deposit.destinationChainId),i=e?.integratorId??this.integratorId,r=e?.walletClient??this?.walletClient;if(!r)throw new eN("WalletClient needs to be set to call 'executeQuote'");try{await tf({...e,integratorId:i,logger:t,walletClient:r,originClient:n,destinationClient:a})}catch(s){if(!this.isTenderlyEnabled||!this.tenderly?.simOnError||!(s instanceof eA||s instanceof eS.ContractFunctionExecutionError))throw s;let t=s instanceof eA,n=t?{networkId:e.deposit.destinationChainId.toString(),from:s.transaction.from,to:s.transaction.to,data:s.transaction.data}:{networkId:e.deposit.originChainId.toString(),from:s.sender,to:s.contractAddress,data:(0,eC.encodeFunctionData)({abi:s.abi,functionName:s.functionName,args:s.args})},{simulationId:a,simulationUrl:i}=await this.simulateTxOnTenderly({value:e.deposit.isNative?String(e.deposit.inputAmount):"0",...n}),r=t?s.message:s.shortMessage;throw new eR({simulationId:a,simulationUrl:i,message:`simulation failed while executing quote: ${r}`})}}async getAvailableRoutes(e){return eB({...e,apiUrl:e?.apiUrl||this.apiUrl,logger:e?.logger??this.logger})}async getSuggestedFees(e){try{return await eV({...e,apiUrl:e?.apiUrl??this.apiUrl,logger:e?.logger??this.logger})}catch(a){if(!this.isTenderlyEnabled||!this.tenderly?.simOnError||!(a instanceof eA))throw a;let{simulationId:t,simulationUrl:n}=await this.simulateTxOnTenderly({networkId:e.destinationChainId.toString(),to:a.transaction.to,data:a.transaction.data,from:a.transaction.from,value:a.transaction.value??"0"});throw new eR({simulationId:t,simulationUrl:n,message:`simulation failed while fetching suggested fees: ${a.message}`})}}async getLimits(e){try{return await ej({...e,apiUrl:e?.apiUrl??this.apiUrl,logger:e?.logger??this.logger})}catch(a){if(!this.tenderly?.simOnError||!(a instanceof eA))throw a;let{simulationId:t,simulationUrl:n}=await this.simulateTxOnTenderly({networkId:e.destinationChainId.toString(),to:a.transaction.to,data:a.transaction.data,from:a.transaction.from,value:a.transaction.value??"0"});throw new eR({simulationId:t,simulationUrl:n,message:`simulation failed while fetching limits: ${a.message}`})}}async getQuote(e){try{return await eQ({...e,logger:e?.logger??this.logger,apiUrl:e?.apiUrl??this.apiUrl})}catch(a){if(!this.tenderly?.simOnError||!(a instanceof eA))throw a;let{simulationId:t,simulationUrl:n}=await this.simulateTxOnTenderly({networkId:e.route.originChainId.toString(),to:a.transaction.to,data:a.transaction.data,from:a.transaction.from,value:a.transaction.value??"0"});throw new eR({simulationId:t,simulationUrl:n,message:`simulation failed while fetching quote: ${a.message}`})}}async simulateDepositTx(e){try{return await ty({...e,integratorId:e?.integratorId??this.integratorId,publicClient:e?.publicClient??this.getPublicClient(e.deposit.originChainId),logger:e?.logger??this.logger})}catch(a){if(!this.tenderly?.simOnError||!this.isTenderlyEnabled||!(a instanceof eS.ContractFunctionExecutionError))throw a;let{simulationId:t,simulationUrl:n}=await this.simulateTxOnTenderly({networkId:e.deposit.originChainId.toString(),from:a.sender,to:a.contractAddress,data:(0,eC.encodeFunctionData)({abi:a.abi,functionName:a.functionName,args:a.args}),value:e.deposit.isNative?String(e.deposit.inputAmount):"0"});throw new eR({simulationId:t,simulationUrl:n,message:`deposit simulation failed: ${a.shortMessage}`})}}async simulateUpdateDepositTx(e){try{return await tb({logger:this.logger,apiUrl:this.apiUrl,...e,originChainClient:e.originChainClient??this.getPublicClient(e.deposit.originChainId),destinationChainClient:e.destinationChainClient??this.getPublicClient(e.deposit.destinationChainId)})}catch(a){if(!this.tenderly?.simOnError||!this.isTenderlyEnabled||!(a instanceof eS.ContractFunctionExecutionError))throw a;let{simulationId:t,simulationUrl:n}=await this.simulateTxOnTenderly({networkId:e.deposit.originChainId.toString(),from:a.sender,to:a.contractAddress,data:(0,eC.encodeFunctionData)({abi:a.abi,functionName:a.functionName,args:a.args}),value:"0"});throw new eR({simulationId:t,simulationUrl:n,message:`speedUpV3Deposit simulation failed: ${a.shortMessage}`})}}async signUpdateDepositTypedData(e){if(!this.walletClient)throw new eN("'walletClient' needs to be set to sign");return th({walletClient:this.walletClient,...e})}async waitForDepositTx(e){return e6({...e,publicClient:e?.publicClient??this.getPublicClient(e.originChainId)})}async getFillByDepositTx(e){return to({...e,destinationChainClient:e?.de
2stinationChainClient??this.getPublicClient(e.deposit.destinationChainId),indexerUrl:e?.indexerUrl??this.indexerUrl,logger:e?.logger??this.logger})}async waitForFillTx(e){return tn({...e,destinationChainClient:e?.destinationChainClient??this.getPublicClient(e.deposit.destinationChainId),logger:e?.logger??this.logger})}async getDeposit(e){let t=e.findBy.originSpokePoolAddress??await this.getSpokePoolAddress(e.findBy.originChainId),n=e.findBy.destinationSpokePoolAddress??await this.getSpokePoolAddress(e.findBy.destinationChainId);return td({...e,findBy:{...e.findBy,originSpokePoolAddress:t,destinationSpokePoolAddress:n},indexerUrl:e?.indexerUrl??this.indexerUrl,originChainClient:e?.originChainClient??this.getPublicClient(e.findBy.originChainId),destinationChainClient:e?.destinationChainClient??this.getPublicClient(e.findBy.destinationChainId)})}async getSupportedChains(e){return t_({...e,logger:e?.logger??this.logger,apiUrl:e?.apiUrl??this.apiUrl})}async simulateTxOnTenderly(e){let t=e?.accessKey??this.tenderly?.accessKey,n=e?.accountSlug??this.tenderly?.accountSlug,a=e?.projectSlug??this.tenderly?.projectSlug,i=e?.enableShare??!0;if(!t||!n||!a)throw new eN("Tenderly credentials not set. Client needs to be configured with 'tenderly.accessKey', 'tenderly.accountSlug', and 'tenderly.projectSlug'.");return tM({...e,accessKey:t,accountSlug:n,projectSlug:a,enableShare:i})}}e.s(["useBridgeQuote",0,({pool:e,chainContext:t,parsedAmountInput:n,userAddress:a,enoughFundsOnSourceChain:i})=>{let r=(0,d.fromEvmNumericId)(Number(e.chainId)),s=(0,k.useMemo)(()=>t.source&&t.sourceWeth&&t.destinationWeth?{originChainId:t.source.id,destinationChainId:r,inputToken:t.sourceWeth,outputToken:t.destinationWeth}:null,[t,r]),o=!!(s&&i&&n>0n&&a),{data:l,status:p}=function({originChainId:e,destinationChainId:t,inputToken:n,outputToken:a,inputAmount:i,recipient:r,message:s}
2){let o=(0,u.useSupportedPurchaseCurrencyChains)(),l=(0,d.serializeChainId)(e),p=(0,d.serializeChainId)(t),y=JSON.stringify([l,p,n,a,i.toString(),r,s]),c=0n!==i&&!!(n&&a&&r),[m,T]=(0,k.useState)(()=>({data:null,error:null,requestKey:y,status:c?"loading":"complete",supportedChains:o})),f=m.requestKey===y&&m.supportedChains===o;return(f||T({data:null,error:null,requestKey:y,status:c?"loading":"complete",supportedChains:o}),(0,k.useEffect)(()=>{let e=e=>{T({...e,requestKey:y,supportedChains:o})};if(!c||!n||!a||!r)return;let t=!0;return(async()=>{let u=(0,d.deserializeChainId)(l),y=(0,d.deserializeChainId)(p),c={originChainId:(0,d.toEvmChainId)(u),destinationChainId:(0,d.toEvmChainId)(y),inputToken:n,outputToken:a},m=o.find(e=>(0,d.chainIdEquals)(e.id,u)),T=o.find(e=>(0,d.chainIdEquals)(e.id,y));if(!m||!T)return e({data:null,error:"Origin and destination chains must have the same testnet status",status:"error"});try{let n=(({testnet:e,supportedChains:t})=>{let n=Object.values(t).map(e=>e.viemChain).filter(e=>e?.testnet===!0),a=Object.values(t).map(e=>e.viemChain).filter(e=>null!=e&&!e.testnet);return tL.create({integratorId:"0xdead",chains:e?n:a,useTestnet:e})})({testnet:m.viemChain?.testnet??!1,supportedChains:o}),a=await n.getQuote({route:c,inputAmount:i,recipient:r,crossChainMessage:s});if(!t)return;e({data:a,error:null,status:"complete"})}catch(n){if(!t)return;console.error("Error:",n),e({data:null,error:n instanceof Error?n.message:String(n),status:"error"})}})(),()=>{t=!1}},[p,i,n,c,s,l,a,r,y,o]),f)?{data:m.data,error:m.error,status:m.status}:{data:null,error:null,status:c?"loading":"complete"}}({originChainId:s?.originChainId??r,destinationChainId:s?.destinationChainId??r,inputToken:s?.inputToken,outputToken:s?.outputToken,inputAmount:o?n:0n,recipient:a}),y=!!(o&&"complete"===p&&l),c=o?y?l?.deposit.outputAmount??0n:0n:n;return{acrossQuote:l,status:p,isAvailable:y,amountAfterBridge:c}}],901703),e.s(["useChainEnvironment",0,(e,t)=>
2{let n=(0,u.useSupportedPurchaseCurrencyChains)();return{chainContext:(0,k.useMemo)(()=>{let a=n.find(t=>(0,d.chainIdEquals)(t.id,e)),i=null==t||(0,d.chainIdEquals)(t,e)?void 0:n.find(e=>(0,d.chainIdEquals)(e.id,t));return{destination:a,source:i,destinationNativeToken:a?.nativeToken,destinationNativeTokenLower:a?.nativeToken?.toLowerCase(),sourceWeth:i?.nativeToken,destinationWeth:a?.nativeToken}},[n,e,t]),chainIds:(0,k.useMemo)(()=>n.map(e=>e.id),[n])}}],897705)},204483,270564,692772,e=>{"use strict";var t=e.i(768421),n=e.i(244598),a=e.i(444220),i=e.i(358491),r=e.i(134537),s=e.i(469306),o=e.i(256931),l=e.i(746798),u=e.i(897822),d=e.i(120307),p=e.i(230940),y=e.i(846660),c=e.i(131981),m=e.i(732832),T=e.i(428176),f=e.i(602208),h=e.i(46707),b=e.i(276812),g=e.i(153155),v=e.i(377137),w=e.i(829695),x=e.i(399445),I=e.i(309918),S=e.i(286879),C=e.i(29529),E=e.i(63350),k=e.i(875516),A=e.i(363762),R=e.i(73340),D=e.i(816919),N=e.i(947513),P=e.i(136927),O=e.i(481825),_=e.i(379681),M=e.i(931083),L=e.i(361309),F=e.i(116193),U=e.i(36305),q=e.i(389666),B=e.i(248106),V=e.i(345448),j=e.i(796904),$=e.i(567484),K=e.i(402787),H=e.i(901703),W=e.i(310072),z=e.i(897705),Q=e.i(261526),G=e.i(899582),X=e.i(764804),Y=e.i(969651),Z=e.i(422642),J=e.i(245522),ee=e.i(36320),et=e.i(831368),en=e.i(923288),ea=e.i(340550),ei=e.i(630136);function er(e,t,n,a){return a>=n?t:Math.round(e-Math.max(0,a)/n*(e-t))}function es(e){return!!e&&(e.durationSeconds>0||e.startFee>0||e.endFee>0)}let eo=/^0x[0-9a-fA-F]{64}$/,el=[{type:"function",name:"extsload",inputs:[{name:"slot",type:"bytes32"}],outputs:[{name:"",type:"bytes32"}],stateMutability:"view"}];function eu(e){if(e instanceof X.BaseError&&e.walk(e=>e instanceof Z.HttpRequestError||e instanceof Z.TimeoutError))throw e}function ed(e,t,n,i,r,s,o){let l=(0,C.useGetPublicClient)(),u=void 0!==e&&(e&et.V4_DYNAMIC_FEE_FLAG)!=0,d="decay-multicurve"===i,p="rehype"===i||"dhook"===i,y=(0,en.useTick)(),m=(0,a.useMemo)(()=>{if(u&&t)return(0,ei.normalizePoolKey)(t)},[u,t]),T=(0,a.useMemo)(()=>{try{return(0,ea.getDopplerAddresses)(n)}catch{let e=(0,ee.getCompatibilityDeployment)(n)?.addresses;return{poolManager:e?.PoolManager,dopplerHookInitializer:e?.DopplerHookInitializer,rehypeDopplerHookInitializer:e?.RehypeDopplerHookInitializer}}},[n]),f=(0,a.useRef)(void 0),{data:h}=(0,Q.useQuery)({queryKey:["feeSchedule",n,o],enabled:d&&u&&!!o,staleTime:1/0,retry:2,queryFn:async()=>{if(!o)return null;let e=(0,ea.getDopplerPublicClient)(n,l),t=new G.DopplerSDK({publicClient:e,chainId:n});return(await t.getMulticurvePool(o)).getFeeSchedule()}}),g=h?.startFee??8e5,v=h?.endFee??12e3,w=h?.durationSeconds??10,x=y/1e3-(h?.startingTime??Number(r)),I=d&&u&&x>=0&&x<w,{data:S}=(0,Q.useQuery)({queryKey:["hookModuleFee",n,o],enabled:p&&u&&!!o,staleTime:1/0,queryFn:async()=>{var e,t;let a,i,r,u,d=l((0,c.fromEvmNumericId)(n));if(!d||!o)return null;let p=[m?.hooks,T?.dopplerHookInitializer,T?.rehypeDopplerHookInitializer].filter(e=>"string"==typeof e&&e!==b.zeroAddress),y=new Set;for(let e of p)if(!y.has(e.toLowerCase())){y.add(e.toLowerCase());try{let t=await d.readContract({address:e,abi:G.dopplerHookInitializerAbi,functionName:"getState",args:[o]});if(t[2]!==b.zeroAddress){a=t[2],i=(0,ei.normalizePoolKey)(t[5]);break}}catch(e){eu(e)}}if(!a)return null;let f=i??m,h=s&&eo.test(s)?s:f?(0,G.computePoolId)(f):void 0;if(!h)return null;let g=new G.DopplerSDK({publicClient:(0,ea.getDopplerPublicClient)(n,l),chainId:n}),v=await g.getRehypeDopplerHook(a);try{r=await v.getFeeSchedule(h)}catch(e){eu(e)}if(!es(r))try{u=(await v.getHookFees(h)).customFee}catch(e){eu(e)}return e=r,t=u,es(e)?{kind:"schedule",schedule:e}:void 0!==t?{kind:"static",fee:t}:null}}),{data:E}=(0,Q.useQuery)({queryKey:["dynamicPoolFee",n,s,m?.currency0],enabled:u&&!!T?.poolManager&&(!!m||!!s)&&(!p||null===S),staleTime:12e3,refetchInterval:12e3,retry:1,queryFn:async()=>{let e=l((0,c.fromEvmNumericId)(n));if(!e||!T?.poolManager)return;let t=m,a=!t&&s&&eo.test(s)?s:void 0;if(!t&&!a&&s){let n=await e.readContract({address:s,abi:G.dopplerHookAbi,functionName:"poolKey"});
2t={currency0:n[0],currency1:n[1],fee:Number(n[2]),tickSpacing:Number(n[3]),hooks:n[4]}}if(!t&&!a)return;let i=a??(0,G.computePoolId)(t),r=(0,J.keccak256)((0,Y.encodeAbiParameters)([{type:"bytes32"},{type:"uint256"}],[i,6n])),o=BigInt(await e.readContract({address:T.poolManager,abi:el,functionName:"extsload",args:[r]})),u=Number(o>>208n&16777215n);if(0!==u||0n!==o)return u}});if(d&&u)return h?I?{fee:er(g,v,w,x),isDynamic:!0,isDecaying:!0}:{fee:v,isDynamic:!0,isDecaying:!1}:{fee:void 0,isDynamic:!0,isDecaying:!1};if(p&&u){if(S){let e=function(e,t){if("static"===e.kind)return{fee:e.fee,isDecaying:!1};let{startingTime:n,startFee:a,endFee:i,durationSeconds:r}=e.schedule,s=t-n;return s<0?{fee:a,isDecaying:!1}:s<r?{fee:er(a,i,r,s),isDecaying:!0}:{fee:i,isDecaying:!1}}(S,y/1e3);return{fee:e.fee,isDynamic:!0,isDecaying:e.isDecaying}}return{fee:E||void 0,isDynamic:!0,isDecaying:!1}}let k=u?E:e,A=u&&void 0!==f.current&&void 0!==k&&k<f.current;return void 0!==k&&k!==f.current&&(f.current=k),{fee:u?E:e,isDynamic:u,isDecaying:A}}let ep=(e,t=18)=>void 0===e?"-":parseFloat((0,f.formatUnits)(e,t)).toLocaleString(void 0,{maximumFractionDigits:4});var ey=e.i(706502),ec=e.i(342416),em=e.i(344940),eT=e.i(341909),ef=e.i(425152);let eh=(0,e.i(570635).parseAbi)(["function tokenURI() view returns (string)"]);async function eb(e){try{return await e}catch(e){if(e instanceof X.BaseError){let t=e.walk(e=>e instanceof ec.ContractFunctionRevertedError||e instanceof ec.ContractFunctionZeroDataError);if(t instanceof ec.ContractFunctionRevertedError||t instanceof ec.ContractFunctionZeroDataError)return null}if(e instanceof ec.ContractFunctionRevertedError||e instanceof ec.ContractFunctionZeroDataError)return null;throw e}}async function eg(e,t,n){if(!(0,ef.isAddress)(n))return{source:"rpc",status:"invalid-address",token:null};if(!e)return{source:"rpc",status:"rpc-error",token:null};let a=(0,eT.getAddress)(n);try{let n=await e.getCode({address:a});if(!n||"0x"===n)return{source:"rpc",status:"not-contract",token:null};let[i,r,s,o,l]=await Promise.all([eb(e.readContract({address:a,abi:em.erc20Abi,functionName:"name"})),eb(e.readContract({address:a,abi:em.erc20Abi,functionName:"symbol"})),eb(e.readContract({address:a,abi:em.erc20Abi,functionName:"decimals"})),eb(e.readContract({address:a,abi:em.erc20Abi,functionName:"totalSupply"})),eb(e.readContract({address:a,abi:eh,functionName:"tokenURI"}))]);return{source:"rpc",status:"ready",token:{chainId:t,address:a,name:i,symbol:r,decimals:s,totalSupply:o?.toString()??null,tokenUri:l}}}catch(e){return console.error("RPC token details read failed",e instanceof Error?e.message:"Unknown RPC failure"),{source:"rpc",status:"rpc-error",token:null}}}function ev({chainId:e,tokenAddress:t,initialData:n,enabled:a=!0}){let i=(0,C.useGetPublicClient)(),r=n?.status==="ready"&&(0,c.chainIdEquals)(n.token.chainId,e)&&n.token.address.toLowerCase()===t.toLowerCase()?n:void 0;return(0,Q.useQuery)({queryKey:["tokenDetails","rpc",(0,c.serializeChainId)(e),t.toLowerCase()],queryFn:()=>eg(i(e),e,t),enabled:a,initialData:r,staleTime:15e3,refetchInterval:3e4})}function ew(e,t){let n=(0,C.useGetChain)(),a=t?.address,i=a?.toLowerCase(),r=(0,c.chainIdEquals)(e,c.CHAIN_IDS.ARC)&&i===et.ARC_USDC_TOKEN_ADDRESS,s=!!("eip155"===e.namespace&&i&&i!==b.zeroAddress&&(r||i!==n(e)?.nativeToken.toLowerCase())),o=s&&(0,ey.isRobinhoodChainId)(e),l=o?(0,x.getRobinhoodStockToken)(a):void 0,u=o&&i===et.ROBINHOOD_USDG_TOKEN_ADDRESS,d=l?.symbol??(r?"USDC":u?"USDG":t?.symbol),p=l?x.ROBINHOOD_STOCK_TOKEN_DECIMALS:r?et.ARC_USDC_DECIMALS:u?et.ROBINHOOD_USDG_DECIMALS:t?.decimals,{data:y}=ev({chainId:e,tokenAddress:a??"",enabled:s&&(!d||null==p)}),m=y?.status==="ready"?y.token:void 0,T=d||m?.symbol,f=p??m?.decimals,h=s&&a&&T&&null!=f?{address:a,symbol:T,decimals:f}:void 0;return{isNonNativeQuote:s,token:h}}e.s(["useTokenDetailsRpc",0,ev],270564);var ex=e.i(227855);let eI=(e,t,n,a)=>{let i=(0,ex.isRobinhoodUniversalRouter211Route)(e,t),{data:r,isLoading:s,isPlaceholderData:o,error:l,dataUpdatedAt:u}=(0,_.useRouteQuote)(i?[]:e||[],i?void 0:t,i?0n:n,a),{data:d,isLoading:p,isPlaceholderData:y,error:c,dataUpdatedAt:m}=(0,ex.useRobinhoodUniversalRouter211RouteQuote)(e||[],t,n),T=i?d:r;return{quote:n&&T?T:0n,quoteIsLoading:i?!!(p||y):!!(s||o),quoteError:!!(i?c:l),quoteUpdatedAt:i?m:u}};function eS(e,t,n,i){let r=(0,a.useRef)(void 0),s=(0,a.useRef)(i),o=(0,a.useRef)(n);(0,a.useEffect)(()=>{s.current=i}),(0,a.useEffect)(()=>{o.current=n});let[l,u]=(0,a.useState)(t),[d,p]=(0,a.useState)(0),[y,c]=(0,a.useState)(!1);return l!==t&&(u(t),t&&(p(e=>e+1),c(!0))),(0,a.useEffect)(()=>{e&&(r.current=o.current)},[e]),(0,a.useEffect)(()=>
2{if(0===d)return;let e=!1,t=setInterval(async()=>{if(e)return;let n=await s.current();e||n.data===r.current||(e=!0,clearInterval(t),c(!1))},1e3),n=setTimeout(()=>{e||(e=!0,clearInterval(t),c(!1))},3e4);return()=>{e=!0,clearInterval(t),clearTimeout(n)}},[d]),y}e.i(244005);var eC=e.i(952931);let eE=e=>{let{setOpen:t}=(0,eC.useWalletModal)(),n=(0,C.useGetChain)();return(0,a.useMemo)(()=>{let{isConnected:a,hasWallet:i,isAuthenticated:r,walletAlignmentStatus:s,isAligningWallet:o,onEnsureWalletAlignment:l,poolChainId:u,currentChainId:p,isDisabled:y,actionText:m,onSwitchChain:f,onAction:h,hasInsufficientBalance:b,canBridge:g,acrossQuote:v,shouldPromptSwitchToPoolChain:w,walletModalSource:x,isFailedAuction:I,isHardSwapBanned:S}=e,C=s??"aligned",E=n(u)?.name??"target network";return S?{text:"Swaps disabled",disabled:!0,shouldGloss:!1,onClick:()=>{}}:I?{text:"Auction ended - buy disabled",disabled:!0,shouldGloss:!1,onClick:()=>{}}:i??a?r??a?o?{text:"Preparing wallet...",disabled:!0,shouldGloss:!1,onClick:()=>{}}:"mismatch_linked"===C?{text:`Use ${E} wallet`,disabled:!1,shouldGloss:!1,onClick:f}:"mismatch_unlinked"===C?{text:m,disabled:y,shouldGloss:!y,onClick:()=>{y||(async()=>{l&&await l()||((0,T.trackEvent)(d.CONNECT_WALLET,d.CLICK,{source:x??"swap"}),t(!0))})()}}:!w&&(void 0===p||(0,c.chainIdEquals)(u,p)||g)?g?{text:"Bridge & Buy",disabled:y,shouldGloss:!y,onClick:y||!v?()=>{}:h}:b?{text:"Insufficient balance",disabled:!0,shouldGloss:!1,onClick:()=>{}}:{text:m,disabled:y,shouldGloss:!0,onClick:h}:{text:`Switch to ${E}`,disabled:!1,shouldGloss:!1,onClick:f}:{text:m,disabled:y,shouldGloss:!y,onClick:()=>{y||((0,T.trackEvent)(d.CONNECT_WALLET,d.CLICK,{source:x??"swap"}),t(!0))}}:{text:"Connect wallet",disabled:!1,shouldGloss:!1,onClick:()=>{(0,T.trackEvent)(d.CONNECT_WALLET,d.CLICK,{source:x??"swap"}),t(!0)}}},[e,n,t])},ek=({txConfirmed:e,reset:t,delay:n=3e3,onSuccess:i})=>{(0,a.useEffect)(()=>{if(!e)return;i?.();let a=setTimeout(()=>{t()},n);return()=>clearTimeout(a)},[e,n,i,t])};var eA=e.i(142900);let eR=(0,h.parseUnits)("0.001",18),eD=({pool:e,isInModal:n=!1,slippage:i,onVortexTrigger:r,isFailedAuction:s,isHardSwapBanned:o,initialAmount:l})=>{let u=(0,c.tryCoerceChainId)(e.chainId),p=u?(0,c.tryEvmChainId)(u):void 0,y=(0,c.fromEvmNumericId)(p??8453),Q=143===p,G=l||(Q?"100":"0.01"),{dashboardTokensState:X}=(0,R.useDashboardTokens)(),Y=(0,C.useGetChain)(),Z=(0,C.useSupportedPurchaseCurrencyChains)(),J=(0,S.useClientFlag)("clientEnableRobinhoodStockNumeraires"),ee=(0,x.isRobinhoodStockTokenQuote)(e.chainId,e.quoteToken?.address)&&!J,et=ee?"Trading pools quoted in stock tokens is not enabled yet.":void 0,{isNonNativeQuote:en,token:ea}=ew(y,e.quoteToken),{data:ei}=(0,M.useRouteFromNativeToken)(X.selectedPool),er=ei?.[0]?.fromToken.toLowerCase(),es=!!(er&&(er===b.zeroAddress||er===Y(y)?.nativeToken.toLowerCase())),eo=(0,a.useMemo)(()=>en&&!ea?[]:(0,B.getConfiguredBuyCurrencies)(Z,y,ea?{token:ea,nativeRouteAvailable:es,routeTokenAddresses:ei?.map(e=>e.fromToken)??[]}:void 0),[y,Z,ea,en,es,ei]),el=eo[0],eu=(0,$.getBuyPresetsForCurrency)(el?.symbol,Q),ey=(0,S.useClientFlag)("clientDn404Flag"),ec=(0,D.getDn404AssetModeAmount)(e.baseToken),em=ey&&ec>0n&&!(0,U.isUniversalRouter211Chain)(p),[eT,ef]=(0,a.useState)("fungible"),eh=em&&"asset"===eT,[eb,eg]=(0,a.useState)(G),[ev,ex]=(0,a.useState)(eu.includes(G)?G:""),[eC,eD]=(0,a.useState)(y),[eN,eP]=(0,a.useState)(el?.balanceKey??""),[eO,e_]=(0,a.useState)(null),{show:eM}=(0,k.useShareToast)(),eL=(0,j.useSwapState)(),{awaitingWalletAction:eF,setAwaitingWalletAction:eU,txHash:eq,txConfirmed:eB,error:eV,setError:ej,resetSwapState:e$}=eL,{isConnected:eK,hasWallet:eH,isAuthenticated:eW,walletAlignmentStatus:ez,isAligningWallet:eQ,ensureWalletAlignment:eG,address:eX,chainId:eY,sendTransaction:eZ,switchChain:eJ}=(0,E.useWallet)(),e0=(0,g.useChainId)(),e2=eY??(0,c.fromEvmNumericId)(e0),e1=(0,a.useMemo)(()=>eo.find(e=>e.balanceKey===eN)??el,[eo,el,eN]),e3=e1?.decimals??18,e6=e1?.symbol??Y(y)?.nativeCurrency??"ETH",e5="USDC"===e6||"USDT"===e6||"USDG"===e6,e4=(0,$.getBuyPresetsForCurrency)(e1?.symbol,Q),e8=!!(e1&&(0,B.isBridgeBuyCurrency)(e1)),e9=(()=>
2{if(!e1||!(0,N.isValidAmountForParsing)(eb))return 0n;try{return(0,h.parseUnits)(eb,e3)}catch{return 0n}})(),{chainContext:e7}=(0,z.useChainEnvironment)(y,eC),{balances:te,refetch:tt}=(0,W.useBuyCurrencyBalances)(eo,eX,{enabled:eW}),tn=(0,a.useMemo)(()=>(0,B.getVisibleBuyCurrencies)(eo,te),[eo,te]),ta=e7.source?.id,ti=e1?te[e1.balanceKey]:void 0,tr=e8&&!eh,ts=e9>=eR,to=void 0!==ti&&ti>=e9,tl=tr&&e9>0n&&!ts,tu=tr&&ts&&to,{acrossQuote:td,status:tp,isAvailable:ty,amountAfterBridge:tc}=(0,H.useBridgeQuote)({pool:e,chainContext:e7,parsedAmountInput:e9,userAddress:eX,enoughFundsOnSourceChain:to});ek({txConfirmed:eB,reset:e$,onSuccess:r});let{data:tm}=(0,M.useRouteFromBuyCurrency)(X.selectedPool,e1),tT=(0,F.isRouteExactOutputSupported)(tm),tf=eh&&!tT?"Buy 1 NFT is not available for the selected pay token route.":void 0,{quote:th,quoteIsLoading:tb,quoteError:tg,quoteUpdatedAt:tv}=eI(tm,y,tc,e.baseToken.address),{data:tw=0n,isLoading:tx,isPlaceholderData:tI,error:tS,dataUpdatedAt:tC}=(0,_.useRouteExactOutputQuote)(tm||[],y,eh&&tT?ec:0n,e.baseToken.address),tE=(0,a.useMemo)(()=>tw?tw+tw*BigInt(i)/100n:0n,[tw,i]),tk=eh?ec:th,tA=eh?tx||tI:tb,tR=eh?tf||tS:tg,tD=eh?tE:e9,tN=(0,a.useMemo)(()=>{try{return(0,P.getSwapDeploymentAddresses)((0,c.toEvmChainId)(y))}catch{return}},[y]),tP=tN?.permit2,tO=tN?.universalRouter,{requestPermit:t_,isProcessing:tM,error:tL}=(0,A.usePermit2Approval)({chainId:y,currentChainId:e2??void 0,token:e1?.address??el?.address??Y(y)?.nativeToken,amount:tD,spender:tO,owner:eX,sendTransaction:eZ??void 0,switchChain:eJ,permit2Address:tP});(0,a.useEffect)(()=>{!el||eN&&eo.some(e=>e.balanceKey===eN)||eP(el.balanceKey)},[eo,el,eN]);let tF=(0,a.useRef)(!1),tU=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(!es||tU.current||tF.current)return;let e=eo.find(B.isBuyCurrencyNative);e&&(tU.current=!0,eP(e.balanceKey))},[es,eo]),(0,a.useEffect)(()=>{!e1||0===tn.length||tn.some(e=>e.balanceKey===e1.balanceKey)||eP(tn[0].balanceKey)},[e1,tn]),(0,a.useEffect)(()=>{e1&&eD(e1.chainId)},[e1]),(0,a.useEffect)(()=>{tL&&ej(tL)},[tL,ej]);let tq=eS(eF,eB,ti,(0,a.useCallback)(async()=>{let e=await tt();return{data:e.data?.[eN]}},[tt,eN])),tB=!ty&&void 0!==ti&&tD>0n&&ti<tD,tV=!e1||!tm?.length||!tD||tA||!!tR||!tk||tu&&("loading"===tp||!ty)||tB||!!eq||eF||tM||tq||!!s||!!o||ee,{mutateAsync:tj,prepareSwap:t$}=(0,L.useSwapRoute)(y,tm||[],{assetAddress:e.baseToken.address,quoteUpdatedAt:eh?tC:tv,inputKey:JSON.stringify([eb,i,e1?.balanceKey,eh,tk.toString()])}),{mutateAsync:tK}=(0,O.useBuyWithAcross)(y,ei||[],e9,ta),tH=(0,a.useCallback)(async()=>{eU(!0);try{eD(y),el&&eP(el.balanceKey),await eJ({chainId:y})}catch{(0,T.trackEvent)(d.BUY_BUTTON,d.NETWORK_ERROR,{[d.TOKEN_NAME]:e.baseToken.name,[d.TOKEN_ADDRESS]:e.baseToken.address,error:"chain-switch-failed",targetChainId:e.chainId.toString()})}finally{eU(!1)}},[el,e.baseToken.address,e.baseToken.name,e.chainId,y,eU,eJ]),{executeTransaction:tW}=(0,j.useTransactionOrchestrator)({pool:e,eventName:d.BUY_BUTTON,direction:"Buy",swapState:eL,getAnalyticsPayload:(t,n)=>(0,q.buildSwapAnalyticsPayload)({pool:e,type:t,amount:eb,txHash:n?.txHash,errorType:n?.errorType})}),tz=(0,a.useCallback)(async()=>{let t;if((0,T.trackEvent)(d.BUY_BUTTON,d.CLICK,{[d.TOKEN_NAME]:e.baseToken.name,[d.TOKEN_ADDRESS]:e.baseToken.address,[d.CHAIN_ID]:e.chainId.toString(),[d.AMOUNT]:eb}),!eX||!tk)return;ej(void 0);let n=eh?{amountOut:ec,amountInMaximum:tE}:{amountIn:e9,minAmountOut:(0,m.applySlippage)(tk,i)};try{t=await t$(n)}catch(e){ej(e instanceof Error?e.message:"Swap verification failed");return}let a=e1&&!(0,B.isBuyCurrencyNative)(e1)?await t_(()=>t?.verify(n)??Promise.resolve()):void 0,r=!!(a&&(a.didSendPermit2Approval||a.didSendTokenApproval));await tW(async()=>{if(tu){if(!ta||!ty||!td)throw Error("Bridge quote is not available");return await eJ({chainId:ta}),await tK({minAmountOutAsset:(0,m.applySlippage)(tk,i),minAmountOutAcross:td.deposit.outputAmount,exclusiveRelayer:td.deposit.exclusiveRelayer,quoteTimestamp:td.deposit.quoteTimestamp,fillDeadline:td.deposit.fillDeadline,exclusivityDeadline:td.deposit.exclusivityDeadline})}if(eh){if(!tT)throw Error(tf);if(!tE)throw Error("Exact-output quote is not available");return await tj({amountOut:ec,amountInMaximum:tE,followedFreshApproval:r,compatibilityGuard:t})}let e=(0,m.applySlippage)(tk,i);return await tj({amountIn:e9,minAmountOut:e,followedFreshApproval:r,compatibilityGuard:t})},tu&&ta?ta:y)},[tE,tT,tf,ec,eh,eb,tW,ty,tK,tj,e9,e.baseToken.address,e.baseToken.name,e.chainId,tk,t_,t$,e1,ej,i,eX,td,y,ta,tu,eJ]),tQ=(0,a.useRef)(!1);(0,a.useEffect)(()=>{l&&!tQ.current&&tk&&!tA&&!tV&&eK&&(tQ.current=!0,tz())},[l,tk,tA,tV,eK,tz]);let tG=void 0!==ti&&tD>0n&&ti<tD,tX=eE({isConnected:eK,hasWallet:eH,isAuthenticated:eW,walletAlignmentStatus:ez,isAligningWallet:eQ,onEnsureWalletAlignment:eG,poolChainId:y,currentChainId:e2??void 0,isDisabled:tV,actionText:eh?"Buy 1 NFT":`Buy ${(0,eA.truncateSymbol)(e.baseToken.symbol)}`,onSwitchChain:tH,onAction:tz,hasInsufficientBalance:tG,canBridge:tu,acrossQuote:td,shouldPromptSwitchToPoolChain:tl,walletModalSource:"buy-token",isFailedAuction:s,isHardSwapBanned:o}),tY=ed(e.fee,e.poolKey,(0,c.toEvmChainId)(y),e.type,e.createdAt,e.address,e.baseToken?.address),tZ=Y(y),tJ=(0,a.useRef)(tk);tJ.current=tk,(0,a.useEffect)(()=>
2{if(!eB||!tJ.current||!tZ?.route)return;let t={kind:"swap",direction:"buy",chainRoute:tZ.route,chainName:tZ.name,tokenAddress:e.baseToken.address,tokenName:e.baseToken.name,tokenSymbol:e.baseToken.symbol,spentAmount:eb,spentSymbol:e6,receivedAmount:Number((0,f.formatUnits)(tJ.current,e.baseToken.decimals)).toLocaleString(void 0,{maximumFractionDigits:6}),receivedSymbol:e.baseToken.symbol.replace(/^\$/,""),txHash:eq};e_(t),eM(t)},[tZ?.name,tZ?.route,eb,e.baseToken.address,e.baseToken.decimals,e.baseToken.name,e.baseToken.symbol,e6,eM,eB,eq]),(0,a.useEffect)(()=>{e_(null)},[eb,eN]);let t0=ep(ti,e3),t2=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-text-secondary",children:"Balance "}),tq?"...":t0," ",e6]}),t1=eB?"success":eF||tM?"loading":"idle",t3=eB?I.SELECTORS.CONFIRM_BUY_BUTTON_SUCCESS:I.SELECTORS.CONFIRM_BUY_BUTTON,t6=eB?eh?"Bought 1 NFT!":`Bought ${(0,eA.truncateSymbol)(e.baseToken.symbol)}!`:"Transaction Cancelled";return(0,t.jsx)(K.SwapActionLayout,{isInModal:n,balanceContent:t2,amountField:{value:eb,onChange:e=>{let t=(0,N.processNumericInput)(e.target.value);if(!t.isValid)return;let n=t.value;ef("fungible"),eg(n),ex(e4.includes(n)?n:"")},placeholder:G,dataTestId:I.SELECTORS.BUY_AMOUNT_INPUT},tokenSelector:e1?(0,t.jsx)(V.BuyCurrencySelector,{options:tn,selectedCurrency:e1,onSelectCurrency:e=>{let t=(0,$.getBuyPresetsForCurrency)(e.symbol,Q)[0];tF.current=!0,eP(e.balanceKey),ef("fungible"),eg(t),ex(t)},balances:te}):null,presets:[...e4.map(e=>({key:e,label:e5?`$${e}`:e,selected:ev===e&&!eh,disabled:!1,onSelect:()=>{ef("fungible"),eg(e),ex(e)}})),...em?[{key:"buy-1-nft",label:"Buy 1 NFT",selected:eh,disabled:!tT,onSelect:()=>{ef("asset"),ex("")}}]:[]],helperRow:eh?{label:"Exact output",value:tw?`1 NFT \xb7 max ${Number((0,f.formatUnits)(tE,e3)).toLocaleString(void 0,{maximumFractionDigits:6})} ${e6}`:"1 NFT",valueTestId:"buy-dn404-exact-output-helper"}:void 0,feeInfo:tY,receivingContent:(0,t.jsx)(v.default,{price:Number((0,f.formatUnits)(tk,e.baseToken.decimals)),suffix:` ${e.baseToken.symbol}`,metricThreshold:1/0,replaceNegativeWith:"-"}),error:eV||("mismatch_unlinked"===ez?"Wallet changed. Continue with your current wallet to trade.":void 0)||tf||et,errorTestId:"buy-error",button:{state:t1,text:tX.text,disabled:tX.disabled,onClick:tX.onClick,shouldGloss:tX.shouldGloss,loadingText:"Confirm in wallet...",successText:t6,successDuration:3e3,dataTestId:t3},footerContent:eO?(0,t.jsxs)("div",{className:"rounded-xl border border-default bg-bg-subtle/70 p-3",children:[(0,t.jsx)("div",{className:"mb-2 text-sm text-text-secondary",children:"Share this trade"}),(0,t.jsx)(w.SocialShareActions,{payload:eO})]}):null})};var eN=e.i(578255),eP=e.i(901834),eO=e.i(52805);function e_(e){let{currentAmount:t,tokenBalance:n,presets:a,decimals:i}=e;if(!n||0n===n)return"";try{let e=(0,h.parseUnits)(t||"0",i),r=n/1000000n;return a.find(t=>{let a=n*BigInt(t)/100n;return e>=a-r&&e<=a+r})||""}catch{return""}}var eM=e.i(722396),eL=e.i(456848),eF=e.i(290922),eU=e.i(770893),eq=e.i(95367),eB=e.i(686960);let eV=({symbol:e="ETH",chainId:n="1",tokenAddress:i,preferNumeraireIcon:r=!1})=>{let s=(0,C.useGetChain)(),o=Number(n),l=("string"==typeof n&&/^\d+$/.test(n)?(0,eB.fromSolanaIndexerChainId)(o):void 0)??(0,c.tryCoerceChainId)(n)??(Number.isFinite(o)&&o>0?(0,c.fromEvmNumericId)(o):c.CHAIN_IDS.BASE),u=s(l),d=e!==(u?.viemChain?.nativeCurrency.symbol??u?.nativeCurrency??((0,c.isSolana)(l)?"SOL":"ETH")),p=r&&(0,eF.hasNumeraireIcon)(e),[y,m]=(0,a.useState)(!1);return(0,t.jsxs)("div",{className:"bg-overlay-hover rounded-lg px-2 py-1.5 flex items-center gap-2 cursor-pointer min-w-0",children:[p?(0,t.jsx)("div",{className:"w-5 h-5 rounded-md overflow-hidden flex-shrink-0 flex items-center justify-center",children:(0,t.jsx)(eF.default,{symbol:e,size:20})}):d?(0,t.jsx)("div",{className:"w-5 h-5 rounded-md overflow-hidden relative flex-shrink-0",children:i&&!y?(0,t.jsx)(eU.Image,{src:(0,eq.buildImageApiUrl)(l,i)||"",alt:e,className:"w-full h-full object-cover",onError:()=>m(!0),size:"xs"}):(0,t.jsx)(eL.TokenMeshAvatar,{address:i,symbol:`$${e}`,size:"sm",maxChars:2,className:"w-full h-full"})}):(0,t.jsx)(eM.default,{chainId:n,size:24,className:"flex-shrink-0"}),(0,t.jsx)("span",{className:"text-md font-medium text-text-primary truncate",children:e})]})};var ej=e.i(786516);async function e$({maxAmount:e,tryQuote:t,decimals:n}){let a=performance.now(),i=0,r=(e,t)=>({amount:e,iterations:i,durationMs:Math.round(performance.now()-a),hitIterationCap:t});if(e<=0n)return r(0n,!1);let s=n<=4?1n:10n**BigInt(n-4),o=s>=e?1n:s;if(i+=1,await t(e)>0n)return r(e,!1);let l=1n,u=e-1n,d=0n,p=!1;for(;l<=u&&u-l>o;){if(i>=80){p=!0;break}i+=1;let e=(l+u)/2n;if(await t(e)>0n){d=e,l=e+1n;continue}u=e-1n}for(let n of[u,l,d+1n,d+o].filter(t=>t>d&&t>0n&&t<=e).sort((e,t)=>
2e>t?-1:1)){if(i>=80){p=!0;break}if(i+=1,await t(n)>0n){d=n;break}}return 0n===d&&l>0n&&l<=e&&i<80&&(i+=1,await t(l)>0n&&(d=l)),r(d,p)}var eK=e.i(539228),eH=e.i(853293),eW=e.i(901900);let ez=({pool:e,isInModal:n=!1,slippage:i,isHardSwapBanned:r})=>{let[s,o]=(0,a.useState)("0"),[l,u]=(0,a.useState)(""),[p,y]=(0,a.useState)(null),{show:b}=(0,k.useShareToast)(),D=(0,j.useSwapState)(),{awaitingWalletAction:O,setAwaitingWalletAction:_,txHash:F,txConfirmed:U,error:B,setError:V,resetSwapState:$}=D,{isConnected:H,hasWallet:W,isAuthenticated:z,walletAlignmentStatus:X,isAligningWallet:Y,ensureWalletAlignment:Z,address:J,isEmbeddedWallet:ee,chainId:en,sendTransaction:ea,switchChain:ei}=(0,E.useWallet)(),{address:er}=(0,eN.useAccount)(),es=(0,g.useChainId)(),eo=ee?en:(0,c.fromEvmNumericId)(es),el=(0,C.useGetChain)(),eu=["25","50","75","100"],ey=(0,N.isValidAmountForParsing)(s)?(0,h.parseUnits)(s,e.baseToken.decimals):0n,{dashboardTokensState:ec}=(0,R.useDashboardTokens)(),em=(0,c.tryCoerceChainId)(e.chainId),eT=em?(0,c.tryEvmChainId)(em):void 0,ef=void 0!==eT,eh=(0,S.useClientFlag)("clientEnableRobinhoodStockNumeraires"),eb=!!((0,x.isRobinhoodStockTokenQuote)(e.chainId,e.quoteToken?.address)?(0,x.getRobinhoodStockToken)(e.quoteToken?.address):void 0)&&!eh,eg=(0,c.fromEvmNumericId)(eT??8453),{isNonNativeQuote:ev,token:ex}=ew(eg,e.quoteToken),eC=ev&&!ex,eR=(0,a.useMemo)(()=>{if(void 0!==eT)try{return(0,P.getSwapDeploymentAddresses)(eT)}catch{return}},[eT]),eD=eR?.permit2&&eR.permit2!==G.ZERO_ADDRESS?eR.permit2:void 0,eM=eR?.universalRouter&&eR.universalRouter!==G.ZERO_ADDRESS?eR.universalRouter:void 0,eL=(0,a.useMemo)(()=>J??er,[J,er]),eF={chainId:eg,currentChainId:eo??void 0,token:e.baseToken.address,amount:ey,spender:eM,owner:eL,permit2Address:eD},{requestPermit:eU,isProcessing:eq,error:eB}=(0,A.usePermit2Approval)({...eF,sendTransaction:ea??void 0,switchChain:ei});(0,a.useEffect)(()=>{eB&&V(eB)},[eB,V]),ek({txConfirmed:U,reset:$});let{data:ez}=(0,M.useRouteToNativeToken)(ec.selectedPool),eQ=!ef||eb||eC?void 0:ez,{quote:eG,quoteIsLoading:eX,quoteError:eY,quoteUpdatedAt:eZ}=eI(eQ,ef?eg:void 0,ef?ey:0n,e.baseToken.address),{data:eJ,refetch:e0}=function(e,t){let{address:n,isConnected:a}=(0,E.useWallet)(),i=(0,C.useGetPublicClient)(),r=t?.enabled??!0,s=async()=>n?await i((0,c.fromEvmNumericId)(Number(e.chainId))).readContract({address:(0,eO.requireEvmAddress)(e.address,"asset address"),abi:[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],functionName:"balanceOf",args:[(0,eO.requireEvmAddress)(n,"wallet address")]}):BigInt(0);return(0,Q.useQuery)({queryKey:["balance",e.address,e.chainId,n],queryFn:s,enabled:!!n&&a&&r,refetchInterval:12e3,refetchIntervalInBackground:!1})}(e.baseToken,{enabled:z}),e2=eS(O,U,eJ,e0),e1=parseFloat(eJ?(0,f.formatUnits)(eJ,e.baseToken.decimals||18):"0")>0,e3=(eQ?.length??0)>0,e6=!!eJ&&ey<=eJ,e5=void 0!==eJ&&ey>eJ,e4=function({parsedAmountInput:e,hasTokenBalance:t,isWithinWalletBalance:n,hasSellRoute:a,quoteIsLoading:i,quoteError:r,quote:s}){return e>0n&&t&&n&&a&&!i&&(r||!i&&0n===s)}({parsedAmountInput:ey,hasTokenBalance:e1,isWithinWalletBalance:e6,hasSellRoute:e3,quoteIsLoading:eX,quoteError:eY,quote:eG}),{data:e8,isLoading:e9,isFetching:e7}=function({chainId:e,route:t,decimals:n,maxBalance:i,enabled:r,assetAddress:s}){let o=(0,C.useGetPublicClient)(),l=(0,S.useClientFlag)("clientUseConsolidatedIndexerFlag")?"consolidated":"legacy",u=(0,ej.getChainCompatibility)(e,l).indexer,d=(0,eK.resolveRouteQuoteCapability)(e,t,"exactIn"),p=(0,a.useMemo)(()=>{try{return(0,eK.safeCreateQuoterFromChainId)(e,o)}catch{return}},[e,o]);return(0,Q.useQuery)({queryKey:["maxSellableAmount",(0,c.serializeChainId)(e),l,d.cacheKey,i.toString(),n,t,s],enabled:!!(r&&u&&"unavailable"!==d.provider&&p&&t.length>0&&i>0n),staleTime:15e3,queryFn:async()=>{if(!u||"unavailable"===d.provider)throw Error("This indexed quote is unavailable.");if(!p||0===t.length||i<=0n)return{amount:0n,iterations:0,durationMs:0,hitIterationCap:!1};if(d.deployment){let n=o(e);if(!n||!s)throw Error("A verified asset is required to quote this route");await (0,eW.verifyIndexedCompatibilityRoute)(n,(0,c.toEvmChainId)(e),{asset:s,route:t})}let a=await e$({maxAmount:i,tryQuote:async n=>(0,eH.quoteRouteAmount)({quoter:p,chainId:e,amountIn:n,route:t}),decimals:n});return!(0,eP.isProduction)()&&(console.log(`[sell-max] took ${a.iterations} loops in ${a.durationMs}ms`),a.hitIterationCap&&console.log("[sell-max] reached max iteration cap")),a}})}({assetAddress:e.baseToken.address,chainId:eg,route:eQ||[],decimals:e.baseToken.decimals||18,maxBalance:eJ??0n,enabled:ef&&e4}),te=e8?.amount??0n,tt=e9||e7,tn=te>0n,ta=tn?`~${parseFloat((0,f.formatUnits)(te,e.baseToken.decimals||18)).toLocaleStr
2ing(void 0,{maximumFractionDigits:4})} ${e.baseToken.symbol}`:"Unavailable",ti=!ef||eC||!ey||eX||eY||!eG||!e1||!eJ||ey>eJ||!!F||O||eq||!!r||e2||eb,tr=ef?eb?"Trading pools quoted in stock tokens is not enabled yet.":e4?"Amount too large for current pool depth. Try a smaller amount or Use Max.":void 0:"Selling is unavailable for unsupported pool chains.",ts=e4?{label:"Max sellable now",value:tt?"Calculating...":ta,actionLabel:!tt&&tn?"Use Max":void 0,actionDisabled:!tn,onAction:()=>{var t;let n;if(!tn)return;let a=(t=e.baseToken.decimals||18,(n=(0,f.formatUnits)(te,t)).includes(".")?n.replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1"):n);o(a),u(e_({currentAmount:a,tokenBalance:eJ||0n,presets:eu,decimals:e.baseToken.decimals||18}))},valueTestId:"sell-max-amount",actionTestId:"sell-use-max"}:void 0,{mutateAsync:to,prepareSwap:tl}=(0,L.useSwapRoute)(ef?eg:void 0,eQ||[],{assetAddress:e.baseToken.address,quoteUpdatedAt:eZ,inputKey:JSON.stringify([s,i,eG.toString()])}),tu=(0,a.useCallback)(async()=>{if(ef){_(!0);try{await ei({chainId:eg})}finally{_(!1)}}},[ef,eg,_,ei]),{executeTransaction:td}=(0,j.useTransactionOrchestrator)({pool:e,eventName:d.SWAP_BUTTON,direction:"Sell",swapState:D,getAnalyticsPayload:(t,n)=>(0,q.buildSwapAnalyticsPayload)({pool:e,type:t,txHash:n?.txHash,errorType:n?.errorType,additionalFields:{[d.SWAP_DIRECTION]:"Sell"}})}),tp=(0,a.useCallback)(async()=>{let t;if((0,T.trackEvent)(d.SWAP_BUTTON,d.CLICK,{[d.SWAP_DIRECTION]:"Sell",[d.TOKEN_NAME]:e.baseToken.name}),!ef||!J||!eG)return;V(void 0);try{t=await tl({amountIn:ey,minAmountOut:(0,m.applySlippage)(eG,i)})}catch(e){V(e instanceof Error?e.message:"Swap verification failed");return}let n=await eU(()=>t?.verify({amountIn:ey,minAmountOut:(0,m.applySlippage)(eG,i)})??Promise.resolve()),a=n.didSendPermit2Approval||n.didSendTokenApproval;await td(async()=>{var r;let s=(0,m.applySlippage)(eG,i);return r={walletAddress:J,wagmiAddress:er,walletChainId:en,wagmiChainId:es,poolChainId:Number(e.chainId),quote:eG.toString(),minAmountOut:s.toString(),followedFreshApproval:a,permit2ApprovalTxHash:n.permit2ApprovalTxHash,tokenApprovalTxHash:n.tokenApprovalTxHash},(0,eP.isProduction)()||console.log("[sell-debug] pre-submit",r),await to({amountIn:ey,minAmountOut:s,followedFreshApproval:a,compatibilityGuard:t})},eg)},[J,eG,eU,tl,td,ef,i,en,es,e.chainId,e.baseToken.name,to,ey,er,eg,V]),ty=eE({isConnected:H,hasWallet:W,isAuthenticated:z,walletAlignmentStatus:X,isAligningWallet:Y,onEnsureWalletAlignment:Z,poolChainId:eg,currentChainId:eo??void 0,isDisabled:ti,actionText:e4?"Amount too large":`Sell ${(0,eA.truncateSymbol)(e.baseToken.symbol)}`,onSwitchChain:tu,onAction:tp,hasInsufficientBalance:e5,walletModalSource:"sell-token",isHardSwapBanned:r}),tc=ep(eJ,e.baseToken.decimals||18),tm=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-text-secondary",children:"Balance "}),(0,t.jsxs)("span",{"data-testid":"balance-amount",children:[e2?"...":tc," "]}),e.baseToken.symbol]}),tT=ed(e.fee,e.poolKey,Number(e.chainId),e.type,e.createdAt,e.address,e.baseToken?.address),tf=el(eg)?.viemChain?.nativeCurrency.symbol??"ETH",th=eQ?.at(-1)?.toToken,tb=!!(ex&&th?.toLowerCase()===ex.address.toLowerCase()),tg=(0,x.getRobinhoodStockToken)(th),tv=th?.toLowerCase()===et.ROBINHOOD_USDG_TOKEN_ADDRESS,tw=tb?ex?.symbol:tg?.symbol??(tv?"USDG":tf),tx=tb?ex?.decimals:tv?et.ROBINHOOD_USDG_DECIMALS:18,tI=el(eg),tS=(0,a.useRef)(eG);tS.current=eG,(0,a.useEffect)(()=>{if(!U||void 0===tS.current||!tI?.route||void 0===tx||!tw)return;let t={kind:"swap",direction:"sell",chainRoute:tI.route,chainName:tI.name,tokenAddress:e.baseToken.address,tokenName:e.baseToken.name,tokenSymbol:e.baseToken.symbol,spentAmount:s,spentSymbol:e.baseToken.symbol.replace(/^\$/,""),receivedAmount:Number((0,f.formatUnits)(tS.current,tx)).toLocaleString(void 0,{maximumFractionDigits:6}),receivedSymbol:tw,txHash:F};y(t),b(t)},[tI?.name,tI?.route,s,tw,tx,e.baseToken.address,e.baseToken.name,e.baseToken.symbol,b,U,F]),(0,a.useEffect)(()=>{y(null)},[s]);let tC=U?"success":O||eq?"loading":"idle",tE=U?I.SELECTORS.CONFIRM_SELL_BUTTON_SUCCESS:"loading"===tC?I.SELECTORS.CONFIRM_SELL_BUTTON_LOADING:I.SELECTORS.CONFIRM_SELL_BUTTON,tk=`Sold ${(0,eA.truncateSymbol)(e.baseToken.symbol)}!`;return(0,t.jsx)(K.SwapActionLayout,{isInModal:n,balanceContent:tm,amountField:{value:s,dataTestId:"sell-amount",placeholder:"0",onChange:t=>{let n=(0,N.processNumericInput)(t.target.value);
2n.isValid&&(o(n.value),u(e_({currentAmount:n.value,tokenBalance:eJ||0n,presets:eu,decimals:e.baseToken.decimals||18})))}},tokenSelector:(0,t.jsx)(eV,{symbol:e.baseToken.symbol.replace("$",""),chainId:e.chainId.toString(),tokenAddress:e.baseToken.address}),presets:eu.map(t=>({key:t,label:`${t}%`,selected:l===t,disabled:!e1||e2,onSelect:()=>(t=>{if(!eJ)return;let n=eJ*BigInt(t)/100n;o((0,f.formatUnits)(n,e.baseToken.decimals||18)),u(t)})(t)})),feeInfo:tT,receivingContent:void 0===eG||eC||void 0===tx?"-":(0,t.jsx)(v.default,{price:Number((0,f.formatUnits)(eG,tx)),suffix:` ${tw}`,metricThreshold:1/0,replaceNegativeWith:"-"}),helperRow:ts,error:B||("mismatch_unlinked"===X?"Wallet changed. Continue with your current wallet to trade.":void 0)||tr,errorTestId:"sell-error",button:{state:tC,text:ty.text,disabled:ty.disabled,onClick:ty.onClick,successText:tk,successDuration:3e3,dataTestId:tE},footerContent:p?(0,t.jsxs)("div",{className:"rounded-xl border border-default bg-bg-subtle/70 p-3",children:[(0,t.jsx)("div",{className:"mb-2 text-sm text-text-secondary",children:"Share this trade"}),(0,t.jsx)(w.SocialShareActions,{payload:p})]}):null})};var eQ=e.i(263876);function eG({slippage:e,onChange:n,className:a}){return(0,t.jsx)("div",{className:(0,m.cn)("flex gap-2",a),children:[{value:1,label:"1%"},{value:5,label:"5%"},{value:10,label:"10%"},{value:15,label:"15%"}].map(a=>(0,t.jsx)(eQ.Chip,{value:a.value,selected:e===a.value,onChange:()=>n(a.value),size:"md",children:a.label},a.label))})}let eX=({slippage:e,onChange:n})=>(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("div",{className:"flex justify-between text-sm",children:(0,t.jsx)("span",{className:"text-text-secondary",children:"Max Slippage"})}),(0,t.jsx)(eG,{slippage:e,onChange:n})]});e.s(["SlippageSettings",0,eX],692772);var eY=e.i(238117),eZ=e.i(72231),eJ=e.i(678586),e0=e.i(389999),e2=e.i(781780),e1=e.i(695798),e3=e.i(272055),e6=e.i(762419),e5=e.i(278945),e4=e.i(898570),e8=e.i(280560),e9=e.i(277733),e7=e.i(643304),te=e.i(868616),tt=e.i(697301);let tn="Exclusive Doppler App Trading",ta=["0.1","0.25","0.5","1"],ti=["25","50","75","100"],tr={skipPreflight:!1,preflightCommitment:"confirmed",maxRetries:5},ts=(e,t,n,a=4)=>{let i=Number((0,f.formatUnits)(e,t)).toLocaleString(void 0,{maximumFractionDigits:a});return`${i} ${n}`},to=(e,t)=>e&&"object"==typeof e?e[t]:void 0,tl=e=>"string"==typeof e&&e.trim()?e:"number"==typeof e||"boolean"==typeof e||"bigint"==typeof e?String(e):void 0,tu=e=>{let t=tl(e);if(t)return t;if(e instanceof Error&&e.message)return e.message;for(let t of["message","shortMessage","reason","details"]){let n=tl(to(e,t));if(n)return n}let n=to(e,"error");if(n&&n!==e){let e=tu(n);if(e)return e}let a=to(e,"cause");if(a&&a!==e){let e=tu(a);if(e)return e}},td=e=>{let t,n=tu(e);if("unexpected error"===(t=n?.trim().toLowerCase())||"unknown error"===t||"an unexpected error occurred"===t){let t=to(e,"error"),a=to(e,"cause"),i=(t&&t!==e?tu(t):void 0)||(a&&a!==e?tu(a):void 0);if(i&&i!==n)return`${n}: ${i}`;let r=to(e,"logs")??to(t,"logs");if(Array.isArray(r)&&r.length>0)return`${n}: ${r.slice(-3).join(" | ")}`}return n??"Unable to submit Solana transaction."};function tp({token:e,activeTab:n,isInModal:i=!1,onVortexTrigger:r}){let{wallets:o}=(0,eJ.useWallets)(),{signAndSendTransaction:l}=(0,eZ.useSignAndSendTransaction)(),{signTransaction:u}=(0,eZ.useSignTransaction)(),{login:p,getAccessToken:y}=(0,eY.usePrivy)(),{address:m,isAuthenticated:b,isEmbeddedWallet:g,switchChain:v}=(0,E.useWallet)(),{show:w}=(0,k.useShareToast)(),x=(0,S.useClientFlag)("clientSolanaTxDebugFlag"),I=(0,S.useClientFlag)("clientEnableSolanaUsdcCpmmRouting"),C=(0,S.useClientFlag)("clientSolanaMaxBuySupplyFractionFlag"),[A,R]=(0,a.useState)(null),[D,P]=(0,a.useState)(!1),[O,_]=(0,a.useState)(null),M=O&&O.forTab===n?O.value:"buy"===n?"0.1":"10",[L,F]=(0,a.useState)(null),U=L&&L.forTab===n?L.value:"buy"===n?"0.1":"",B=e=>_({forTab:n,value:e}),V=e=>F({forTab:n,value:e}),[j,H]=(0,a.useState)(null),[W,z]=(0,a.useState)(null),[Q,G]=(0,a.useState)(9),[X,Y]=(0,a.useState)(null),[Z,J]=(0,a.useState)(null),[ee,et]=(0,a.useState)(null),[ea,ei]=(0,a.useState)(null),[er,es]=(0,a.useState)(null),[eo,el]=(0,a.useState)(null),[eu,ed]=(0,a.useState)(!1),[ep,ey]=(0,a.useState)(!1),[ec,em]=(0,a.useState)(!1),[eT,ef]=(0,a.useState)(!1),[eh,eb]=(0,a.useState)(null),[eg,ev]=(0,a.useState)(null),[ew,ex]=(0,a.useState)(null),[eI,eC]=(0,a.useState)(null),eE=(0,a.useMemo)(()=>
2(0,c.tryCoerceChainId)(e.chainId)??c.CHAIN_IDS.SOLANA_DEVNET,[e.chainId]),ek="solana-initializer-curve"===e.pool?.type,eR=(0,c.chainIdEquals)(eE,c.CHAIN_IDS.SOLANA_MAINNET),eD=(0,e9.getRuntimeClientRpcUrl)(eR?"solana-mainnet":"solana-devnet"),eN=(0,a.useMemo)(()=>new e2.Connection(eD,"confirmed"),[eD]),eP=(0,a.useMemo)(()=>(0,e5.findLocalSolanaToken)(e.address),[e.address]),eO=(0,a.useMemo)(()=>eP?(0,e5.calculateLocalSolanaHeldBalance)(eP):0n,[eP]),e_=e.pool?.address??void 0,eM=eP?.launchAddress??e_;(0,a.useEffect)(()=>{let e=!1;return eC(null),(0,e6.getSolanaDeployment)(eE).then(t=>{e||eC(t)}),()=>{e=!0}},[eE]),(0,a.useEffect)(()=>{let e=!1;return eM&&eI?((async()=>{try{let t=await (0,e4.fetchSolanaLaunchState)({connection:eN,launchAddress:eM,deployment:eI});e||et(t)}catch{e||et(null)}})(),()=>{e=!0}):void et(null)},[eN,eI,eM]);let eL=(0,a.useMemo)(()=>ee&&eM&&ee.baseMint===e.address?{launchAddress:eM,launchAuthority:ee.launchAuthority,baseVault:ee.baseVault,quoteVault:ee.quoteVault,quoteMint:ee.quoteMint,curveVirtualBase:ee.curveVirtualBase,curveVirtualQuote:ee.curveVirtualQuote,curveFeeBps:ee.curveFeeBps,allowBuy:ee.allowBuy,allowSell:ee.allowSell,baseForDistribution:ee.baseForDistribution,baseForLiquidity:ee.baseForLiquidity,baseForCurve:ee.baseForCurve}:null,[eM,ee,e.address]),eF=!!eL,eU=function({hasCpmmPoolState:e,hasLaunchCurve:t}){return e||t}({hasCpmmPoolState:!!Z,hasLaunchCurve:eF}),eq=!Z&&ee?.phase===e1.initializer.PHASE_TRADING,ej=Z?String(Z.pool.hookProgram):eq?ee?.hookProgram??null:null,e$=Z?Z.pool.hookFlags:void 0,eK=eq&&!!eI&&!!ej&&e6.VALID_SOLANA_COSIGNER_HOOK_PROGRAMS.has(ej),eH=eq&&!!eI&&!!ej&&ej===String(eI.dynamicFeeHookProgram),eW=eq&&!!eI?.dopplerLaunchHookV2Program&&ej===String(eI.dopplerLaunchHookV2Program),ez=eH&&(0,e4.getSolanaDynamicFeeGatePayload)(ee?.hookPayload).length>0,eQ=!!eI&&!!ej&&!(0,e4.isSolanaSwapHookSupported)({hookProgram:ej,hookFlags:e$,deployment:eI,allowCosignerCurveSwap:!Z,allowDynamicFeeCurveSwap:!Z,allowFeeRehypothecationCurveSwap:eW}),eG=(0,a.useMemo)(()=>eW?(0,e4.decodeSolanaFeeRehypothecationDynamicFeeSchedule)(ee?.hookPayload):eH?(0,e4.decodeSolanaDynamicFeeSchedule)(ee?.hookPayload):null,[eH,eW,ee?.hookPayload]),[eX,to]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(!eG&&!eK&&!ez)return void to(null);let e=!1;return(async()=>{try{let t=await (0,e4.getSolanaChainUnixTime)(eN);e||to(t-Math.floor(Date.now()/1e3))}catch{e||to(0)}})(),()=>{e=!0}},[eN,eG,eK,ez]);let tl=(0,en.useTick)(),tu=null!==eX?Math.floor(tl/1e3)+eX:null,ty=eG&&null!==tu?(0,e4.getSolanaDynamicFeeBpsAt)(eG,tu):null,tc=function({dynamicFeeSchedule:e,dynamicCurveFeeBps:t,cpmmSwapFeeBps:n,curveFeeBps:a}){if(e)return null===t?{fee:void 0,isDynamic:!0,isDecaying:!1}:{fee:100*t,isDynamic:!0,isDecaying:t>e.endFeeBps};let i=n??a;return{fee:void 0===i?void 0:100*i,isDynamic:!1,isDecaying:!1}}({dynamicFeeSchedule:eG,dynamicCurveFeeBps:ty,cpmmSwapFeeBps:Z?.pool.swapFeeBps,curveFeeBps:eL?.curveFeeBps}),tm=eK||ez,tT=function({isGateEnforced:e,gateExpiryUnixSeconds:t,chainNowUnixSeconds:n}){if(e)return null===t||null===n||t<=n?{label:tn}:{label:tn,value:function(e){let t=Math.max(1,Math.ceil(e/60));if(t<60)return`${t}m left`;let n=Math.floor(t/60),a=t%60;return a>0?`${n}h ${a}m left`:`${n}h left`}(t-n)}}({isGateEnforced:tm&&null!==tu&&(eK?(0,e4.isSolanaCosignerGateEnforced)(ee?.hookPayload,tu):(0,e4.isSolanaDynamicFeeCosignerGateEnforced)(ee?.hookPayload,tu)),gateExpiryUnixSeconds:tm?(0,e4.getSolanaCosignerGateUnixExpiry)(ee?.hookPayload,{isDynamicFeeHook:eH}):null,chainNowUnixSeconds:tu}),tf=function({localQuoteMintAddress:e,indexedQuoteMintAddress:t}){return e||(t&&!t.startsWith("0x")?t:void 0)}({localQuoteMintAddress:eL?.quoteMint,indexedQuoteMintAddress:e.pool?.quoteToken?.address}),th=Z?.quoteMintAddress??tf??e4.SOLANA_WSOL_MINT,tb=th===e4.SOLANA_WSOL_MINT,tg=(0,e7.resolveSolanaQuoteSymbol)(th,e.pool?.quoteToken?.symbol)??"QUOTE",tv=(0,e7.isSolanaUsdcMint)(th),tw=I&&"buy"===n&&tv&&!!Z&&!!A,tx=D&&tw;(0,a.useEffect)(()=>{if(!I||"buy"!==n||!tv||!eI)return void R(null);let e=!1;return(0,e4.fetchSolanaCpmmPoolState)({connection:eN,baseMintAddress:e4.SOLANA_WSOL_MINT,quoteMintAddress:th,deployment:eI}).then(t=>{e||R(t)}).catch(()=>{e||R(null)}),()=>{e=!0}},[I,n,tv,eI,eN,th]),(0,a.useEffect)(()=>()=>P(!1),[n,e.address]);let tI=(0,a.useMemo)(()=>(0,E.resolveActiveSolanaWallet)({currentWalletAddress:m,isAuthenticated:b,isEmbeddedWallet:g,solanaWallets:o}),[m,b,g,o]),tS=tI?.address;(0,a.useEffect)(()=>()=>{_(null),F(null),eb(null),ev(null),ef(!1)},[n]),(0,a.useEffect)(()=>
2{if(!eT)return;let e=window.setTimeout(()=>{ef(!1)},3e3);return()=>window.clearTimeout(e)},[eT]),(0,a.useEffect)(()=>{let t=!1;return async function(){if(!eI||ek){J(null),ey(!1);return}ey(!0);try{let n=await (0,e4.fetchSolanaCpmmPoolState)({connection:eN,baseMintAddress:e.address,quoteMintAddress:tf,deployment:eI});t||J(n)}catch{t||J(null)}finally{t||ey(!1)}}(),()=>{t=!0}},[eN,eI,tf,ek,eg,e.address]),(0,a.useEffect)(()=>{let e=!1;return async function(){if(tb)return G(9);try{let t=await (0,e4.getSolanaTokenMintDecimals)({connection:eN,mintAddress:th});e||G(t)}catch{e||G(6)}}(),()=>{e=!0}},[eN,tb,th]),(0,a.useEffect)(()=>{let e=!1;return async function(){if(!eL){ei(null),es(null),el(null);return}try{let[t,n,a]=await Promise.all([(0,e4.fetchSolanaLaunchFeeState)({connection:eN,launchAddress:eL.launchAddress,deployment:eI??void 0}).catch(()=>null),eN.getTokenAccountBalance(new e2.PublicKey(eL.baseVault),"confirmed").catch(()=>null),eN.getTokenAccountBalance(new e2.PublicKey(eL.quoteVault),"confirmed").catch(()=>null)]);if(e)return;ei(t),es(n&&"object"==typeof n&&"value"in n?BigInt(n.value.amount):null),el(a&&"object"==typeof a&&"value"in a?BigInt(a.value.amount):null)}catch{e||(ei(null),es(null),el(null))}}(),()=>{e=!0}},[eN,eI,eL,eg]);let tC=(0,a.useRef)(0),tE=(0,a.useCallback)(async()=>{let t=++tC.current;if(!tS)return tC.current===t&&(H(null),z(null),Y(null)),null;ed(!0);try{let n=new e2.PublicKey(tS),a=(0,e0.getAssociatedTokenAddressSync)(new e2.PublicKey(e.address),n),i=(0,e0.getAssociatedTokenAddressSync)(new e2.PublicKey(th),n),[r,s,o]=await Promise.all([eN.getBalance(n,"confirmed"),eU?eN.getTokenAccountBalance(a,"confirmed").catch(()=>null):null,eU&&!tb?eN.getTokenAccountBalance(i,"confirmed").catch(()=>null):null]),l=BigInt(r),u=o&&"object"==typeof o&&"value"in o?BigInt(o.value.amount):tb?null:0n,d=s&&"object"==typeof s&&"value"in s?BigInt(s.value.amount):eU?0n:eO;return tC.current===t&&(H(l),z(u),Y(d)),{solBalanceLamports:l,quoteBalanceRaw:u,tokenBalanceRaw:d}}catch{let e=tb?null:0n,n=eU?0n:eO;return tC.current===t&&(H(null),z(e),Y(n)),{solBalanceLamports:null,quoteBalanceRaw:e,tokenBalanceRaw:n}}finally{tC.current===t&&ed(!1)}},[tS,eN,eO,eU,tb,th,e.address]);(0,a.useEffect)(()=>{tE()},[tE,eg]);let tk=ew??n,tA=eS(ec,eT,"buy"===tk?tb?j:W:X,(0,a.useCallback)(async()=>{let e=await tE();return e?{data:"buy"===tk?tb?e.solBalanceLamports:e.quoteBalanceRaw:e.tokenBalanceRaw}:{data:void 0}},[tk,tb,tE]))&&ew===n,tR="buy"===n?tx?9:Q:e.decimals||9,tD="buy"===n?tx?"SOL":tg:e.symbol,tN=(()=>{if(!(0,N.isValidAmountForParsing)(M))return 0n;try{return(0,h.parseUnits)(M,tR)}catch{return 0n}})(),tP=(0,a.useMemo)(()=>{if(tN<=0n)return null;if(Z){let t=Z.pool.token0Mint===e.address,a="buy"===n?+!!t:+!t;return e1.cpmm.getSwapQuote(Z.pool,tN,a)}if(!eL||!ea||null===er||null===eo||eG&&null===ty)return null;let t=(0,e4.calculateLaunchBaseReserve)({baseVaultAmount:er,baseForDistribution:eL.baseForDistribution,baseForLiquidity:eL.baseForLiquidity,baseForCurve:eL.baseForCurve,pendingBaseFees:ea.pendingBaseFees}),a=(0,e4.calculateLaunchQuoteReserve)({quoteVaultAmount:eo,pendingQuoteFees:ea.pendingQuoteFees});return(0,e4.quoteSolanaLaunchSwap)({direction:n,amountIn:tN,baseReserve:t,quoteReserve:a,curveVirtualBase:eL.curveVirtualBase,curveVirtualQuote:eL.curveVirtualQuote,curveFeeBps:ty??eL.curveFeeBps})},[n,er,Z,ty,eG,eL,ea,tN,eo,e.address]),tO=(0,a.useMemo)(()=>{if(!tx||tN<=0n||!A||!Z)return null;let e=A.pool.token0Mint===e4.SOLANA_WSOL_MINT,t=e1.cpmm.getSwapQuote(A.pool,tN,+!e).amountOut,n=(0,e4.calculateMinimumAmountOut)(t);if(n<=0n)return null;let a=Z.pool.token0Mint===th;return{amountOut:e1.cpmm.getSwapQuote(Z.pool,n,+!a).amountOut}},[tx,tN,A,Z,th]),t_=tx?tO:tP,tM="buy"===n&&(eK||ez)&&!!ee&&!!t_&&(0,e4.solanaBuyExceedsSupplyCap)({expectedBaseOut:t_.amountOut,baseTotalSupply:ee.baseTotalSupply,maxSupplyFraction:C}),tL=tM?`This buy exceeds the maximum ${(0,e4.formatSolanaSupplyCapPercent)(C)} of total supply allowed per purchase. Try a smaller amount.`:void 0,tF=tv&&!tx?$.USD_BUY_PRESETS:ta,tU=("buy"===n?tF:ti).map(t=>({key:t,label:"buy"===n?t:`${t}%`,selected:U===t,disabled:tA,onSelect:()=>(t=>{if(eb(null),"sell"===n){let n=BigInt(t);B((0,f.formatUnits)(tq*n/100n,e.decimals||9)),V(t);return}B(t),V(t)})(t)})),tq=X??eO,tB=tb?j??0n:W??0n,tV=tx?j??0n:tB,tj=("buy"===n?tx||tb?null!==j:null!==W:null!==X)&&tN>0n&&("buy"===n?tV<tN:tq<tN),t$=tA?`... ${tD}`:"buy"===n?eu?"Loading...":ts(tV,tR,tD):ts(tq,e.decimals||9,e.symbol),tK=ts(t_?.amountOut??0n,"buy"===n?e.decimals||9:Q,"buy"===n?e.symbol:tg),tH=eI&&ep||eU?void 0:"Quotes unavailable: the Solana indexer has not reported a tradable pool or launch curve for this token yet.",tW=eQ?"This token uses a custom trading hook that isn't supported here.":void 0,tz=function({hasCpmmPoolState:e,hasLaunchCurve:t,direction:n,allowBuy:a,allowSell:i}){if(!e&&t)return"buy"===n?!1===a?"Buys are disabled by this token's Solana launch configuration.":void 0:!1===i?"Sells are disabled by this token's Solana launch configuration.":void 0}({hasCpmmPoolState:!!Z,hasLaunchCurve:eF,direction:n,allowBuy:eL?.allowBuy,allowSell:eL?.allowSell}),tQ=function({hasCpmmPoolState:e,hasLaunchCurve:t,allowBuy:n,allowSell:a}){if(!e&&t){if(!1===n&&!1===a)return"Buys and sells are disabled by this token's Solana launch configuration.";if(!1===n)return"Buys are disabled by this token's Solana launch configuration. Selling remains available.";if(!1===a)return"Sells are disabled by this token's Solana launch configuration. Buying remains available."}}({hasCpmmPoolState:!!Z,hasLaunchCurve:eF,allowBuy:eL?.allowBuy,allowSell:eL?.allowSell}),tG=tj?"Insufficient balance":"buy"===n?`Buy ${e.symbol}`:`Sell ${e.symbol}`,tX="buy"===n?d.BUY_BUTTON:d.SWAP_BUTTON,tY=(0,c.serializeChainId)(eE),tZ="buy"===n?`Bought ${(0,eA.truncateSymbol)(e.symbol)}!`:`Sold ${(0,eA.truncateSymbol)(e.symbol)}!`,tJ=tN<=0n||ec||ep||!eU||eQ||!!tz||tj||!t_?.amountOut||tM||tA,t0=(0,a.useCallback)((t,a)=>
2(0,q.buildTokenSwapAnalyticsPayload)({tokenName:e.name,tokenAddress:e.address,chainId:tY,type:t,amount:"buy"===n?M:void 0,txHash:a?.txHash,errorType:a?.errorType,additionalFields:"sell"===n?{[d.SWAP_DIRECTION]:"Sell"}:void 0}),[n,M,tY,e.address,e.name]),t2=async()=>{if(!tS)return((0,T.trackFunnelEvent)(d.WALLET_CONNECTION.BUTTON_CLICKED,{source:"solana-swap",chainId:(0,c.serializeChainId)(eE),walletChainType:"solana-only"}),b)?void await v({chainId:eE}):void p({loginMethods:["wallet","email"],walletChainType:"solana-only"});if(!eU||!Z&&!eL)return void eb("Trading is only available for Solana tokens with a discoverable pool or active launch curve.");if(eQ)return void eb(tW??"This token uses a custom trading hook that isn't supported here.");if(!tz&&!(tN<=0n)&&t_?.amountOut&&!tM){if("buy"===n&&tV<tN)return void eb(`Insufficient ${tD} balance.`);if("sell"===n&&tq<tN)return void eb(`Insufficient ${e.symbol} balance.`);"buy"===n?(0,T.trackEvent)(tX,d.CLICK,t0("click")):(0,T.trackEvent)(tX,d.CLICK,{[d.SWAP_DIRECTION]:"Sell",[d.TOKEN_NAME]:e.name}),ex(n),em(!0),ef(!1),eb(null),ev(null);try{let t,a;if(!eI)return void eb("Solana deployment configuration is still loading. Try again in a moment.");let i=t_,s=!1;if(tx){let n=await (0,e4.buildSolanaSolToTokenSwapBrowserSigningPlan)({connection:eN,walletAddress:tS,baseMintAddress:e.address,usdcMintAddress:th,amountInLamports:tN,deployment:eI});t=n.plan,i={amountOut:n.quotedTokenOut}}else{try{let t=await (0,e4.fetchSolanaCpmmPoolState)({connection:eN,baseMintAddress:e.address,quoteMintAddress:th,deployment:eI}),a=t.pool.token0Mint===e.address,r="buy"===n?+!!a:+!a;i=e1.cpmm.getSwapQuote(t.pool,tN,r)}catch{i=Z?tP:null}if((!i||i.amountOut<=0n)&&eL){let[e,t,a]=await Promise.all([(0,e4.fetchSolanaLaunchFeeState)({connection:eN,launchAddress:eL.launchAddress,deployment:eI??void 0}),eN.getTokenAccountBalance(new e2.PublicKey(eL.baseVault),"confirmed"),eN.getTokenAccountBalance(new e2.PublicKey(eL.quoteVault),"confirmed")]);if(!e)return void eb("Unable to read the latest Solana launch fee state. Try again in a moment.");let r=BigInt(t.value.amount),s=BigInt(a.value.amount),o=(0,e4.calculateLaunchBaseReserve)({baseVaultAmount:r,baseForDistribution:eL.baseForDistribution,baseForLiquidity:eL.baseForLiquidity,baseForCurve:eL.baseForCurve,pendingBaseFees:e.pendingBaseFees}),l=(0,e4.calculateLaunchQuoteReserve)({quoteVaultAmount:s,pendingQuoteFees:e.pendingQuoteFees}),u=eL.curveFeeBps;if(eG)try{u=(0,e4.getSolanaDynamicFeeBpsAt)(eG,await (0,e4.getSolanaChainUnixTime)(eN))}catch{u=ty??(0,e4.getSolanaDynamicFeeBpsAt)(eG,Math.floor(Date.now()/1e3))}i=(0,e4.quoteSolanaLaunchSwap)({direction:n,amountIn:tN,baseReserve:o,quoteReserve:l,curveVirtualBase:eL.curveVirtualBase,curveVirtualQuote:eL.curveVirtualQuote,curveFeeBps:u})}if(!i||i.amountOut<=0n)return void eb("Unable to quote this swap with the latest launch state. Try a smaller amount.");let a=(0,e4.calculateMinimumAmountOut)(i.amountOut),r={walletAddress:tS,baseMintAddress:e.address,quoteMintAddress:th,...eL?{launchAddress:eL.launchAddress,launchAuthorityAddress:eL.launchAuthority,baseVaultAddress:eL.baseVault,quoteVaultAddress:eL.quoteVault}:{},amountIn:tN,minAmountOut:a,direction:n};if(eK)try{let e=await (0,e4.getSolanaChainUnixTime)(eN);s=(0,e4.isSolanaCosignerGateEnforced)(ee?.hookPayload,e)}catch{s=!0}else if(ez)try{let e=await (0,e4.getSolanaChainUnixTime)(eN);s=(0,e4.isSolanaDynamicFeeCosignerGateEnforced)(ee?.hookPayload,e)}catch{s=!0}t=await (0,e4.buildSolanaLaunchSwapBrowserSigningPlan)({connection:eN,...r,deployment:eI,cosignerGated:eK,cosignerHookProgram:eK?ej:void 0,launchNamespace:ee?.namespace,cosignerGateEnforced:s,dynamicFee:eH&&ee?{namespace:ee.namespace,gated:ez}:void 0,feeRehypothecation:eW&&ee?{namespace:ee.namespace,hookPayload:ee.hookPayload}:void 0,launchHookPayload:ee?.hookPayload})}if(!tI)return void eb("Unable to submit Solana transaction with the connected wallet.");let o=await (0,e8.validateSolanaTransactionBeforeSigning)({connection:eN,transaction:t.transaction});if(x){let e="wallet-only"===t.kind?s?"sign-transaction":"sign-and-send-transaction":t;await (0,e3.logSolanaSwapTransactionDiagnostic)({direction:n,gateState:s?"gated":"ungated",planKind:t.kind,safetyValidation:o,serializedTransaction:t.transaction,walletMethod:e})}if(s){let e=await y();if(!e)return void eb("You must be signed in to complete this swap.");let{signedTransaction:n}=await u({transaction:t.transaction,wallet:tI,chain:(0,e8.getSolanaWalletCaip2)(eE)}),i=await (0,e8.completeSolanaTransactionAfterWalletSignature)({plan:t,walletSignedTransaction:n}),r=await (0,e8.requestSolanaCosignedSwap)({signedTransaction:i,chainId:eE,accessToken:e});a=await eN.sendRawTransaction(r,tr)}else a=(0,e8.decodeSolanaSignature)((await l({transaction:t.transaction,wallet:tI,chain:(0,e8.getSolanaWalletCaip2)(eE),options:{commitment:"confirmed",preflightCommitment:"confirmed",skipPreflight:!1}})).signature);await (0,tt.confirmSolanaSwapSucceeded)({connection:eN,signature:a});let p={kind:"swap",direction:n,chainRoute:eR?"solana":"solana-devnet",chainName:eR?"Solana":"Solana Devnet",tokenAddress:e.address,tokenName:e.n
2ame,tokenSymbol:e.symbol,spentAmount:M,spentSymbol:"buy"===n?tD:e.symbol.replace(/^\$/,""),receivedAmount:Number((0,f.formatUnits)(i.amountOut,"buy"===n?e.decimals||9:Q)).toLocaleString(void 0,{maximumFractionDigits:6}),receivedSymbol:"buy"===n?e.symbol.replace(/^\$/,""):tg,txHash:a};w(p),"buy"===n&&r?.(),(0,T.trackEvent)(tX,d.SUCCESS,t0("success",{txHash:a})),ev(a),ef(!0)}catch(a){let e,t=td(a),n=(e=td(a instanceof Error?a:Error(t)),(0,te.default)(Error(e)));(0,T.trackEvent)(tX,d.ERROR,t0("error",{errorType:n.eventError})),eb(t)}finally{em(!1)}}},t1=b?"Switch to Solana wallet":"Connect Solana wallet",t3=tS?tG:t1,t6="buy"===n&&tb?tN+2500000n:2500000n,t5=!!tS&&null!==j&&j<t6,t4=(0,f.formatUnits)(t6,9);return(0,t.jsxs)("div",{className:"space-y-4",children:[tw&&(0,t.jsxs)("label",{className:"flex items-center justify-between rounded-lg bg-overlay-hover px-3 py-2 cursor-pointer","data-testid":"solana-pay-with-sol-toggle",children:[(0,t.jsxs)("span",{className:"text-sm font-medium text-text-primary",children:["Pay with SOL",(0,t.jsx)("span",{className:"ml-1 text-xs text-text-secondary",children:"(routes via USDC)"})]}),(0,t.jsx)("input",{type:"checkbox",checked:D,onChange:e=>P(e.target.checked),className:"h-4 w-4 accent-text-primary"})]}),t5&&(0,t.jsxs)(s.Banner,{variant:"warning",size:"sm","data-testid":"solana-low-sol-balance-warning",children:["Your SOL balance is below ",t4," SOL. You may not have enough to cover transaction fees."]}),tQ&&(0,t.jsx)(s.Banner,{variant:"warning",size:"sm","data-testid":"solana-launch-swap-restriction-banner",children:tQ}),(0,t.jsx)(K.SwapActionLayout,{isInModal:i,balanceContent:t$,amountField:{value:M,onChange:e=>{B((0,N.processNumericInput)(e.target.value).value),V(""),eb(null)},placeholder:"buy"===n?"0.1":"10",dataTestId:`solana-${n}-amount-input`},presets:tU,tokenSelector:"buy"===n?(0,t.jsx)(eV,{symbol:tD,chainId:String((0,eB.toRequiredSolanaIndexerChainId)(eE)),tokenAddress:tx||tb?void 0:th,preferNumeraireIcon:!0}):(0,t.jsx)(eV,{symbol:e.symbol,chainId:String(e.chainId),tokenAddress:e.address}),helperRow:tT?{label:tT.label,value:tT.value,valueTestId:"solana-cosigner-gate-countdown"}:void 0,receivingContent:(0,t.jsx)("span",{className:"text-text-primary",children:tK}),feeInfo:tc,error:tL??tW??tH??eh??void 0,errorTestId:`solana-${n}-error`,button:{state:ec?"loading":eT?"success":"idle",text:t3,disabled:!!tS&&tJ,onClick:t2,shouldGloss:!!tS&&!tJ,loadingText:"Confirm in wallet...",successText:tZ,successDuration:3e3,dataTestId:`solana-${n}-submit`}})]})}e.s(["Swap",0,({token:e,isInModal:f=!1,showUnknownMetricsBanner:h=!1,isFailedAuction:b=!1,isHardSwapBanned:g=!1,initialAmount:v})=>{var w;let[x,I]=(0,a.useState)("buy"),S=b?"sell":x,[C,E]=(0,a.useState)(()=>{let e=(e=>{if("u"<typeof document)return null;let t=document.cookie.match(RegExp(`(^| )${e}=([^;]+)`));return t?t[2]:null})(p.COOKIE_NAMES.SWAP_SLIPPAGE);return e?Number(e):m.DEFAULT_SLIPPAGE_PERCENT}),[k,A]=(0,a.useState)(!1),[R,D]=(0,a.useState)(!1),N=(0,a.useRef)(null),P=(w=(0,c.tryCoerceChainId)(e.chainId))&&(0,c.isSolana)(w)?"solana-devnet":"default";(0,y.useClickOutside)(N,()=>A(!1)),(0,a.useEffect)(()=>{var e,t;e=p.COOKIE_NAMES.SWAP_SLIPPAGE,t=C.toString(),"u">typeof document&&(document.cookie=`${e}=${t}; path=/; max-age=31536000; SameSite=Lax`)},[C]);let O=t=>{if("buy"!==t&&"sell"!==t||b&&"buy"===t)return;let n="buy"===t?d.BUY_TOKEN_TAB:d.SELL_TOKEN_TAB;(0,T.trackEvent)(n,d.CLICK,{tokenAddress:e.address,chainId:e.chainId.toString(),fromTab:S,toTab:t}),I(t)},_=()=>{D(!0),setTimeout(()=>{D(!1)},5e3)};return"solana-devnet"===P?(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(n.AnimatePresence,{children:R&&(0,t.jsx)(u.Vortex,{backgroundColor:"transparent",particleCount:500,className:"absolute inset-0 z-10 pointer-events-none",containerClassName:"absolute inset-0 z-10 pointer-events-none"})}),(0,t.jsxs)("div",{className:`space-y-6 md:space-y-4 relative z-20 ${f?"px-4 md:px-6 pt-5 pb-7 md:py-6":"p-4"}`,children:[(0,t.jsx)(o.SegmentedController,{options:[{value:"buy",label:"Buy",disabled:b},{value:"sell",label:"Sell"}],value:S,onChange:O,size:"md"}),(0,t.jsx)(tp,{token:e,activeTab:S,isInModal:f,onVortexTrigger:_})]})]}):(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(n.AnimatePresence,{children:R&&(0,t.jsx)(u.Vortex,{backgroundColor:"transparent",particleCount:500,className:"absolute inset-0 z-10 pointer-events-none",containerClassName:"absolute inset-0 z-10 pointer-events-none"})}),(0,t.jsxs)("div",{className:`space-y-6 md:space-y-4 relative z-20 ${f?"px-4 md:px-6 pt-5 pb-7 md:py-6":"p-4"}`,children:[h&&!f&&(0,t.jsx)(s.Banner,{className:"hidden lg:block","data-testid":"unknown-metrics-banner-desktop",variant:"warning",size:"sm",children:"This coin has unknown metrics, trade carefully"}),(0,t.jsxs)("div",{className:"flex justify-between items-center w-full",children:[(0,t.jsx)(o.SegmentedController,{options:[{value:"buy",label:"Buy",disabled:b},{value:"sell",label:"Sell"}],value:S,onChange:O,size:"lg","data-testid":"swap-tab-controller"}),(0,t.jsxs)("div",{className:"relative flex items-center",ref:N,children:[(0,t.jsx)(l.Tooltip,{content:"Transaction settings",position:"bottom-end",children:(0,t.jsx)("button",{onClick:()=>{let t=!k;t&&(0,T.trackEvent)(d.TRANSACTION_SETTINGS,d.OPEN,{tokenAddress:e.address,chainId:e.chainId.toString(),activeTab:S}),A(t)},className:"cursor-pointer p-1 rounded-lg hover:bg-overlay-hover active:bg-overlay-pressed data-[selected=true]:bg-overlay-selected transition-colors","data-selected":k,children:(0,t.jsx)(i.SettingsIcon,{size:24})})}),(0,t.jsx)(r.AnimatedDropdown,{isOpen:k,position:"bottom-right",className:"absolute top-full right-0 mt-2 z-50",children:(0,t.jsx)("div",{className:"bg-bg-default border border-default rounded-xl p-4 shadow-lg min-w-[280px]",children:(0,t.jsx)(eX,{slippage:C,onChange:E})})})]})]}),e.pool&&(0,t.jsx)("div",{className:"space-y-2",children:"buy"===S?(0,t.jsx)(eD,{pool:e.pool,isInModal:f,slippage:C,onVortexTrigger:_,isFailedAuction:b,isHardSwapBanned:g,initialAmount:v},`buy-${e.pool.address}-${S}`):(0,t.jsx)(ez,{pool:e.pool,isInModal:f,slippage:C,isHardSwapBanned:g},`sell-${e.pool.address}-${S}`)})]})]})}],204483)}]);

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.