PageSourceSearch

https://app.hotstuff.trade/_next/static/chunks/05btl-e48en_f.js?dpl=dpl_2UkkgYJtZRL8qYawe9FfkxiApWHv

js hotstuff.trade collected 2026-10-07 04:33:41 UTC 74,816 bytes, 5 lines download raw bytes

1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="58ca6846-bf2d-fb24-43df-c18df8966b5b")}catch(e){}}();
2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,377379,(e,t,r)=>{"use strict";var n=e.r(271645),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=n.useState,a=n.useEffect,o=n.useLayoutEffect,c=n.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!s(e,r)}catch(e){return!0}}var l="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=i({inst:{value:r,getSnapshot:t}}),s=n[0].inst,l=n[1];return o(function(){s.value=r,s.getSnapshot=t,u(s)&&l({inst:s})},[e,r,t]),a(function(){return u(s)&&l({inst:s}),e(function(){u(s)&&l({inst:s})})},[e]),c(r),r};r.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:l},193490,(e,t,r)=>{"use strict";t.exports=e.r(377379)},731097,(e,t,r)=>{"use strict";var n=e.r(271645),s=e.r(193490),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=s.useSyncExternalStore,o=n.useRef,c=n.useEffect,u=n.useMemo,l=n.useDebugValue;r.useSyncExternalStoreWithSelector=function(e,t,r,n,s){var h=o(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;var p=a(e,(h=u(function(){function e(e){if(!c){if(c=!0,a=e,e=n(e),void 0!==s&&d.hasValue){var t=d.value;if(s(t,e))return o=t}return o=e}if(t=o,i(a,e))return t;var r=n(e);return void 0!==s&&s(t,r)?(a=e,t):(a=e,o=r)}var a,o,c=!1,u=void 0===r?null:r;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,r,n,s]))[0],h[1]);return c(function(){d.hasValue=!0,d.value=p},[p]),l(p),p}},451797,(e,t,r)=>{"use strict";t.exports=e.r(731097)},982615,574983,210920,e=>{"use strict";var t=e.i(828646),r=e.i(909744),n=e.i(271645),s=e.i(337917);function i(e){let{children:t,config:r,initialState:i,reconnectOnMount:a=!0}=e,{onMount:o}=function(e,t){let{initialState:r,reconnectOnMount:n}=t;return r&&!e._internal.store.persist.hasHydrated()&&e.setState({...r,chainId:e.chains.some(e=>e.id===r.chainId)?r.chainId:e.chains[0].id,connections:n?r.connections:new Map,status:n?"reconnecting":"disconnected"}),{async onMount(){e._internal.ssr&&(await e._internal.store.persist.rehydrate(),e._internal.mipd&&e._internal.connectors.setState(t=>{let r=new Set;for(let e of t??[])if(e.rdns)for(let t of Array.isArray(e.rdns)?e.rdns:[e.rdns])r.add(t);let n=[];for(let t of e._internal.mipd?.getProviders()??[]){if(r.has(t.info.rdns))continue;let s=e._internal.connectors.providerDetailToConnector(t),i=e._internal.connectors.setup(s);n.push(i)}return[...t,...n]})),n?(0,s.reconnect)(e):e.storage&&e.setState(e=>({...e,connections:new Map}))}}}(r,{initialState:i,reconnectOnMount:a});r._internal.ssr||o();let c=(0,n.useRef)(!0);return(0,n.useEffect)(()=>{if(c.current&&r._internal.ssr)return o(),()=>{c.current=!1}},[]),t}let a=(0,n.createContext)(void 0);e.s(["WagmiContext",0,a,"WagmiProvider",0,function(e){let{children:t,config:r}=e;return(0,n.createElement)(i,e,(0,n.createElement)(a.Provider,{value:r},t))}],574983);var o=e.i(191346);class c extends o.BaseError{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return"[email protected]"}}class u extends c{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function l(e={}){let t=e.config??(0,n.useContext)(a);if(!t)throw new u;return t}e.s(["useConfig",0,l],210920);var h=e.i(365087),d=e.i(451797);let p=e=>"object"==typeof e&&!Array.isArray(e);e.s(["useAccount",0,function(e={}){let s=l(e);return function(e,t,r=t,s=h.deepEqual){let i=(0,n.useRef)([]),a=(0,d.useSyncExternalStoreWithSelector)(e,t,r,e=>e,(e,t)=>{if(p(e)&&p(t)&&i.current.length){for(let r of i.current)if(!s(e[r],t[r]))return!1;return!0}return s(e,t)});return(0,n.useMemo)(()=>
2{if(p(a)){let e={...a},t={};for(let[r,n]of Object.entries(e))t={...t,[r]:{configurable:!1,enumerable:!0,get:()=>(i.current.includes(r)||i.current.push(r),n)}};return Object.defineProperties(e,t),e}return a},[a])}(e=>(0,r.watchAccount)(s,{onChange:e}),()=>(0,t.getAccount)(s))}],982615)},31066,789938,e=>{"use strict";var t=e.i(414639),r=e.i(44563);async function n(e,s={}){return(await (0,r.getConnectorClient)(e,s)).extend(t.walletActions)}e.s(["getWalletClient",0,n],31066);var s=e.i(271707),i=e.i(425748),a=e.i(831095);async function o(e){let t=(0,i.encode)(e.action),r=(0,a.keccak256)(t),n={source:"mainnet"===e.env?"Mainnet":"Testnet",hash:r,txType:e.txType};return await e.wallet.signTypedData({domain:{name:"HotstuffCore",version:"1",chainId:1,verifyingContract:"0x1234567890123456789012345678901234567890"},types:{Action:[{name:"source",type:"string"},{name:"hash",type:"bytes32"},{name:"txType",type:"uint16"}]},primaryType:"Action",message:n})}class c{constructor(){this.lastNonce=0}getNonce(){let e=Date.now();return e<=this.lastNonce?e=++this.lastNonce:this.lastNonce=e,e}}var u=e.i(736837);e.s(["ExchangeClient",0,class{constructor(e){this.transport=e.transport,this.wallet=e.wallet,this.nonce=e.nonce??new c().getNonce}async addAgent(e,t=!0,r){let n=await this.nonce(),i=(0,u.privateKeyToAccount)(e.agentPrivateKey),a=await o({wallet:i,action:{signer:e.signer,nonce:n},txType:s.ACTIONS_OP_CODES.addAgent,env:this.transport.env});return e={agentName:e.agentName,agent:e.agent,forAccount:e.forAccount,signature:a,validUntil:e.validUntil,nonce:n},this._executeAction({action:"addAgent",params:e},r?.signal,t)}async createSubAccount(e,t){return this._executeAction({action:"createSubAccount",params:e},t?.signal)}async updatePerpInstrumentLeverage(e,t){return this._executeAction({action:"updatePerpInstrumentLeverage",params:e},t?.signal)}async updateIsolatedMargin(e,t){return this._executeAction({action:"updateIsolatedMargin",params:e},t?.signal)}async updateMarginMode(e,t){return this._executeAction({action:"updateMarginMode",params:e},t?.signal)}async updateHedgeMode(e,t){return this._executeAction({action:"updateHedgeMode",params:e},t?.signal)}async approveBrokerFee(e,t){return this._executeAction({action:"approveBrokerFee",params:e},t?.signal)}async createReferralCode(e,t){return this._executeAction({action:"createReferralCode",params:e},t?.signal)}async setReferrer(e,t){return this._executeAction({action:"setReferrer",params:e},t?.signal)}async claimReferralRewards(e,t){return this._executeAction({action:"claimReferralRewards",params:e},t?.signal)}async revokeAgent(e,t){return this._executeAction({action:"revokeAgent",params:e},t?.signal)}async placeOrder(e,t){return this._executeAction({action:"placeOrder",params:e},t?.signal)}async placeTWAPOrder(e,t){return this._executeAction({action:"placeTWAPOrder",params:e},t?.signal)}async cancelTWAPOrder(e,t){return this._executeAction({action:"cancelTWAPOrder",params:e},t?.signal)}async cancelByOid(e,t){return this._executeAction({action:"cancelByOid",params:e},t?.signal)}async editByOid(e,t){return this._executeAction({action:"editByOid",params:e},t?.signal)}async cancelAll(e,t){return this._executeAction({action:"cancelAll",params:e},t?.signal)}async cancelByCloid(e,t){return this._executeAction({action:"cancelByCloid",params:e},t?.signal)}async cancelByInstrument(e,t){return this._executeAction({action:"cancelByInstrument",params:e},t?.signal)}async cancelByInstrumentKind(e,t){return this._executeAction({action:"cancelByInstrumentKind",params:e},t?.signal)}async accountSpotWithdrawRequest(e,t){return this._executeAction({action:"accountSpotWithdrawRequest",params:e},t?.signal)}async accountDerivativeWithdrawRequest(e,t){return this._executeAction({action:"accountDerivativeWithdrawRequest",params:e},t?.signal)}async accountSpotBalanceTransferRequest(e,t){return this._executeAction({action:"accountSpotBalanceTransferRequest",params:e},t?.signal)}async accountDerivativeBalanceTransferRequest(e,t){return this._executeAction({action:"accountDerivativeBalanceTransferRequest",params:e},t?.signal)}
2async accountInternalBalanceTransferRequest(e,t){return this._executeAction({action:"accountInternalBalanceTransferRequest",params:e},t?.signal)}async accountSpotWithdrawRequestAction1(e,t){return this._executeAction({action:"accountSpotWithdrawRequestAction1",params:e},t?.signal)}async accountDerivativeWithdrawRequestAction1(e,t){return this._executeAction({action:"accountDerivativeWithdrawRequestAction1",params:e},t?.signal)}async createVault(e,t){return this._executeAction({action:"createVault",params:e},t?.signal)}async depositToVault(e,t){return this._executeAction({action:"depositToVault",params:e},t?.signal)}async redeemFromVault(e,t){return this._executeAction({action:"redeemFromVault",params:e},t?.signal)}async addSubVault(e,t){return this._executeAction({action:"addSubVault",params:e},t?.signal)}async removeSubVault(e,t){return this._executeAction({action:"removeSubVault",params:e},t?.signal)}async sendToSubVault(e,t){return this._executeAction({action:"sendToSubVault",params:e},t?.signal)}async withdrawFromSubVault(e,t){return this._executeAction({action:"withdrawFromSubVault",params:e},t?.signal)}async _executeAction(e,t,r=!0){let{action:n,params:i}=e;i.nonce=i.nonce??await this.nonce();let a=await o({wallet:this.wallet,action:i,txType:s.ACTIONS_OP_CODES[n],env:this.transport.env});return r?await this.transport.request("exchange",{action:{data:i,type:String(s.ACTIONS_OP_CODES[n])},signature:a,nonce:i.nonce},t):{params:i,signature:a}}}],789938)},120785,e=>{"use strict";var t=e.i(330688);e.s(["usePrivy",()=>t.u])},206287,e=>{"use strict";var t=e.i(999863);e.s(["useWallets",()=>t.u])},965192,942290,e=>{"use strict";var t=e.i(271645),r=e.i(500932),n=e.i(982615),s=e.i(31066);e.i(732839);var i=e.i(789938),a=e.i(149691),o=e.i(268407),c=e.i(57159),u=e.i(110163),l=e.i(911347),h=e.i(736837),d=e.i(321960),p=e.i(215772),f=e.i(103439),y=e.i(120785),m=e.i(206287);e.i(842917);var v=e.i(68043);let g=e=>new Promise(t=>setTimeout(t,e));var b=e.i(858532),w=e.i(183282);let S=e=>{try{if(e instanceof Error&&"string"!=typeof e)return JSON.parse(e.message)?.error;return String(e)}catch{return String(e)}},C=[{originalError:"Failed to fetch",skip:!0},{originalError:"Internal server error",overrideError:"Something went wrong",strategy:"includes"},{originalError:"Signal time",overrideError:"Something went wrong",strategy:"includes"},{originalError:"UserRejectedRequestError",skip:!0}],T=e=>{for(let t of C){if(!0===t.skip)if(e.includes(t.originalError))return!1;else continue;if("includes"===t.strategy&&e.includes(t.originalError)||"exact"===t.strategy&&e===t.originalError)return t.overrideError}return e};e.s(["getErrorMessage",0,S,"getErrorOverride",0,T],942290);let R=(e,t)=>`${(0,w.capitalize)(e)}: ${t}`,A=async(e,t,r={})=>{let n=e?.[t];if(!n)return{message:R(e.name,t)};let s="function"==typeof n?await n(r):n;return{message:s.title??R(e.name,t),description:s?.description,error:s?.error,silent:s?.silent}};e.s(["useActionWrapper",0,function(){let{createUserClient:e,createL1Client:w}=function(){let e,t,b,w=(0,r.c)(10),{isConnected:S}=(0,n.useAccount)(),{getAgents:C,address:T,master:R}=(0,o.useAuthStore)(),{authenticated:A}=(0,y.usePrivy)(),{wallets:E}=(0,m.useWallets)();w[0]!==A||w[1]!==S||w[2]!==R||w[3]!==E?(e=async(e,t)=>{let r=void 0===e?5:e,n=void 0===t?100:t,o=null;for(let e=0;e<r;e++){let t;if(A&&E.length>0){let s=E[0];if(!s){if(e<r-1){let t=n*Math.pow(2,e);await g(t);continue}return null}try{let e=await s.getEthereumProvider();t=(0,c.createWalletClient)({account:R,chain:d.mainnet,transport:(0,l.custom)(e)})}catch(t){if(o=t instanceof Error?t:Error(String(t)),e<r-1){let t=n*Math.pow(2,e);await g(t);continue}return null}}else if(!(t=await (0,s.getWalletClient)(f.wagmiConfig,{account:R}))||!S){if(e<r-1){let t=n*Math.pow(2,e);await g(t);continue}return null}try{let e=new a.HttpTransport({env:(0,v.getSdkEnv)(),...p.default.http});return await t.switchChain(d.mainnet),new i.ExchangeClient({transport:e,wallet:t})}catch(t){if(o=t instanceof Error?t:Error(String(t)),e<r-1){let t=n*Math.pow(2,e);await g(t)}}}return console.error("Failed to create user wallet client after retries:",o),null},w[0]=A,w[1]=S,w[2]=R,w[3]=E,w[4]=e):e=w[4];let O=e;w[5]!==T?(t=()=>{let e=o.useAuthStore.getState().agents[T]||null;if(!e?.privateKey)return null;try{let t=(0,h.privateKeyToAccount)(e.privateKey),r=new a.HttpTransport({env:(0,v.getSdkEnv)(),...p.default.http}),n=(0,c.createWalletClient)({account:t,chain:d.mainnet,transport:(0,u.http)()});return new i.ExchangeClient({transport:r,wallet:n})}catch(e){return console.error("Failed to create agent wallet client:",e),null}},w[5]=T,w[6]=t):t=w[6];let I=t;return w[7]!==I||w[8]!==O?(b={createUserClient:O,createL1Client:I},w[7]=I,w[8]=O,w[9]=b):b=w[9],b}();return{executeUserAction:(0,t.useCallback)(async(t,r,n=!1,s={})=>{let i="string"==typeof t?{name:t}:t;try{let t=await e();if(!t)throw Error("Failed to create user client");let a=await r(t);if(!n){let e=await A(i,"success",{...s,data:a});if(e.error)return b.showToast.error(e),{success:!1,error:e.description};e.silent||b.showToast.success(e)}return{success:!0,data:a}}catch(t){let e=S(t);if(!n)if(e){let t=T(e);!1!==t&&b.showToast.error(await A(i,"error",{...s,error:t??e}))}else b.showToast.error(await A(i,"error",{...s,message:"Something went wrong"}));return{success:!1,error:e}}},[e]),executeL1Action:(0,t.useCallback)(async(e,t,r=!1,n={})=>{let s="string"==typeof e?{name:e}:e;try{let e=w();if(!e){let e="Failed to create L1 client";return console.error(e),{success:!1,error:e}}let i=await t(e),a=i?.data?.status?.[0]?.error?.error;if(a){let e=T(a);return r||!1===e||b.showToast.error(await A(s,"error",{...n,error:e??a,data:i})),{success:!1,error:a}}let o=await A(s,"success",{...n,data:i});if(!r){if(o.error)return b.showToast.error(o),{success:!1,error:o.description};o.silent||b.showToast.success(o)}return{success:!0,data:i}}catch(t){let e=S(t);if(e){let t=T(e);r||!1===t||b.showToast.error(await A(s,"error",{...n,error:t??e}))}else r||b.showToast.error(await A(s,"error",{...n,message:"Something went wrong"}));return{success:!1,error:e}}},[w]),userClient:e,l1Client:w}}],965192)},727726,e=>{"use strict";var t=e.i(500932),r=e.i(965192),n=e.i(671248);e.s(["useAccountActions",0,function(){let e,s,i,a,o,c,u,l,h,d,p,f=(0,t.c)(31),{executeUserAction:y,executeL1Action:m}=(0,r.useActionWrapper)();f[0]!==y?(e=async(e,t,r,s,i,a,o,c)=>{let u=c?.context??{},l=c?.skipToast??!1;return void 0===o||o?y(n.actions.addAgent,n=>n.addAgent({agentName:e,agent:t,forAccount:s,agentPrivateKey:r,validUntil:i,signer:a}),l,u):y(n.actions.addAgent,n=>n.addAgent({agentName:e,agent:t,forAccount:s,agentPrivateKey:r,validUntil:i,signer:a},!1),l,u)},f[0]=y,f[1]=e):e=f[1];let v=e;f[2]!==m?(s=async e=>m("Create SubAccount",t=>t.createSubAccount({name:e})),f[2]=m,f[3]=s):s=f[3];let g=s;f[4]!==m?(i=async(e,t)=>m(n.actions.updatePerpInstrumentLeverage,r=>r.updatePerpInstrumentLeverage({instrumentId:e,leverage:t})),f[4]=m,f[5]=i):i=f[5];let b=i;f[6]!==m?(a=async(e,t,r)=>m(n.actions.updateIsolatedMargin,n=>n.updateIsolatedMargin({instrumentId:e,side:t,ntli:r})),f[6]=m,f[7]=a):a=f[7];let w=a;f[8]!==m?(o=async(e,t)=>m(n.actions.updateMarginMode,r=>r.updateMarginMode({instrumentId:e,mode:t})),f[8]=m,f[9]=o):o=f[9];let S=o;f[10]!==y?(c=async(e,t)=>y("Approve Builder Fee",r=>r.approveBrokerFee({broker:e,maxFeeRate:t})),f[10]=y,f[11]=c):c=f[11];let C=c;f[12]!==m?(u=async e=>m(n.actions.createReferralCode,t=>t.createReferralCode({code:e})),f[12]=m,f[13]=u):u=f[13];let T=u;f[14]!==m?(l=async e=>m("Set Referrer",t=>t.setReferrer({code:e})),f[14]=m,f[15]=l):l=f[15];let R=l;f[16]!==m?(h=async(e,t)=>m("Claim Referral Rewards",r=>r.claimReferralRewards({collateralId:e,spot:t})),f[16]=m,f[17]=h):h=f[17];let A=h;f[18]!==y?(d=async(e,t)=>y(n.actions.revokeAgent,r=>r.revokeAgent({agent:e,forAccount:t})),f[18]=y,f[19]=d):d=f[19];let E=d;return f[20]!==v||f[21]!==C||f[22]!==A||f[23]!==T||f[24]!==g||f[25]!==E||f[26]!==R||f[27]!==w||f[28]!==S||f[29]!==b?(p={addAgent:v,createSubAccount:g,updatePerpInstrumentLeverage:b,updateIsolatedMargin:w,updateMarginMode:S,approveBrokerFee:C,createReferralCode:T,setReferrer:R,claimReferralRewards:A,revokeAgent:E},f[20]=v,f[21]=C,f[22]=A,f[23]=T,f[24]=g,f[25]=E,f[26]=R,f[27]=w,f[28]=S,f[29]=b,f[30]=p):p=f[30],p}])},126996,e=>{"use strict";var t=e.i(500932),r=e.i(965192),n=e.i(671248);function s(e){return e.cancelAll({expiresAfter:Date.now()+36e5})}function i(e){return e.cloid}e.s(["useTradeActions",0,function(){let e,a,o,c,u,l,h,d,p,f,y,m,v,g=(0,t.c)(37),{executeL1Action:b}=(0,r.useActionWrapper)();g[0]!==b?(e=async(e,t,r,s,i,a,o,c,u,l,h,d)=>{let p=void 0!==u&&u,f=void 0===l?"":l,y={instrumentId:e,side:t,positionSide:r,price:s,size:i,tif:a,ro:o,po:c,cloid:f,triggerPx:"",isMarket:p,tpsl:"",grouping:""};
2return h?.length&&(y.childOrders=h),d&&(y.spotOrderType="rfq"),b(n.actions.placeOrder,e=>e.placeOrder({orders:[y],expiresAfter:Date.now()+36e5}),!1,{isMarket:p,cloid:f,isSpotRfq:!!d})},g[0]=b,g[1]=e):e=g[1];let w=e;g[2]!==b?(a=async(e,t,r,s,i,a)=>b(n.actions.placeTWAPOrder,n=>n.placeTWAPOrder({instrumentId:e,side:t,positionSide:r,size:s,reduceOnly:i,duration:a,frequency:30}),!0),g[2]=b,g[3]=a):a=g[3];let S=a;g[4]!==b?(o=async e=>b(n.actions.cancelTWAPOrder,t=>t.cancelTWAPOrder({oid:e})),g[4]=b,g[5]=o):o=g[5];let C=o;g[6]!==b?(c=async e=>b(n.actions.placeOrder,t=>t.placeOrder({orders:e,expiresAfter:Date.now()+36e5}),!0,{cloids:e.map(i)}),g[6]=b,g[7]=c):c=g[7];let T=c;g[8]!==b?(u=async(e,t,r,s,i,a,o,c,u,l)=>{let h=[],d="b"===t?"s":"b";return i&&a&&h.push({instrumentId:e,side:d,positionSide:r,price:a,size:s,tif:"GTC",ro:!0,po:!1,cloid:"",triggerPx:i,isMarket:o,tpsl:"tp",grouping:"position"}),c&&u&&h.push({instrumentId:e,side:d,positionSide:r,price:u,size:s,tif:"GTC",ro:!0,po:!1,cloid:"",triggerPx:c,isMarket:l,tpsl:"sl",grouping:"position"}),b(n.actions.placeOrder,e=>e.placeOrder({orders:h,expiresAfter:Date.now()+36e5}))},g[8]=b,g[9]=u):u=g[9];let R=u;g[10]!==b?(l=async(e,t)=>b(n.actions.cancelByOrderId,r=>r.cancelByOid({cancels:[{oid:e,instrumentId:t}],expiresAfter:Date.now()+36e5})),g[10]=b,g[11]=l):l=g[11];let A=l;g[12]!==b?(h=async e=>{if(e.length)return b(n.actions.cancelAll,t=>t.cancelByOid({cancels:e,expiresAfter:Date.now()+36e5}))},g[12]=b,g[13]=h):h=g[13];let E=h;g[14]!==b?(d=async(e,t,r,s,i,a,o,c,u,l)=>
2b(n.actions.editByOrderId,n=>n.editByOid({oid:e,order:[{instrumentId:t,side:r,positionSide:s,price:i,size:a,tif:o,ro:c,po:u,cloid:l}],expiresAfter:Date.now()+36e5})),g[14]=b,g[15]=d):d=g[15];let O=d;g[16]!==b?(p=async()=>b(n.actions.cancelAll,s),g[16]=b,g[17]=p):p=g[17];let I=p;g[18]!==b?(f=async(e,t)=>b(n.actions.cancelByCloid,r=>r.cancelByCloid({cancels:[{cloid:e,instrumentId:t}],expiresAfter:Date.now()+36e5})),g[18]=b,g[19]=f):f=g[19];let x=f;g[20]!==b?(y=async e=>b(n.actions.cancelByInstrument,t=>t.cancelByInstrument({instrumentId:e,expiresAfter:Date.now()+36e5})),g[20]=b,g[21]=y):y=g[21];let P=y;g[22]!==b?(m=async e=>b(n.actions.cancelByInstrumentKind,t=>t.cancelByInstrumentKind({kind:e,expiresAfter:Date.now()+36e5})),g[22]=b,g[23]=m):m=g[23];let D=m;return g[24]!==I||g[25]!==x||g[26]!==P||g[27]!==D||g[28]!==A||g[29]!==E||g[30]!==C||g[31]!==O||g[32]!==w||g[33]!==T||g[34]!==S||g[35]!==R?(v={placeOrder:w,placeOrders:T,placeTpSlOrder:R,placeTWAPOrder:S,cancelTWAPOrder:C,cancelByOrderId:A,cancelByOrderIds:E,editByOrderId:O,cancelAll:I,cancelByCloid:x,cancelByInstrument:P,cancelByInstrumentKind:D},g[24]=I,g[25]=x,g[26]=P,g[27]=D,g[28]=A,g[29]=E,g[30]=C,g[31]=O,g[32]=w,g[33]=T,g[34]=S,g[35]=R,g[36]=v):v=g[36],v}])},191182,e=>{"use strict";var t=e.i(500932),r=e.i(965192),n=e.i(671248);e.s(["useTransferActions",0,function(){let e,s,i,a,o,c,u,l,h=(0,t.c)(22),{executeUserAction:d}=(0,r.useActionWrapper)();h[0]!==d?(e=async(e,t,r)=>d(n.actions.accountSpotWithdrawRequest,n=>n.accountSpotWithdrawRequest({collateralId:e,amount:t,chainId:r})),h[0]=d,h[1]=e):e=h[1];let p=e;h[2]!==d?(s=async(e,t,r)=>d(n.actions.accountDerivativeWithdrawRequest,n=>n.accountDerivativeWithdrawRequest({collateralId:e,amount:t,chainId:r})),h[2]=d,h[3]=s):s=h[3];let f=s;h[4]!==d?(i=async(e,t,r,s)=>d(n.actions.accountSpotBalanceTransferRequest,n=>n.accountSpotBalanceTransferRequest({collateralId:e,amount:t,destination:r}),!1,s||{}),h[4]=d,h[5]=i):i=h[5];let y=i;h[6]!==d?(a=async(e,t,r,s)=>d(n.actions.accountDerivativeBalanceTransferRequest,n=>n.accountDerivativeBalanceTransferRequest({collateralId:e,amount:t,destination:r}),!1,s||{}),h[6]=d,h[7]=a):a=h[7];let m=a;h[8]!==d?(o=async(e,t,r)=>d(n.actions.accountInternalBalanceTransferRequest,n=>n.accountInternalBalanceTransferRequest({collateralId:e,amount:t,toDerivativesAccount:r})),h[8]=d,h[9]=o):o=h[9];let v=o;h[10]!==d?(c=async(e,t,r,s)=>d(n.actions.accountSpotWithdrawRequestAction1,n=>n.accountSpotWithdrawRequestAction1({collateralId:e,destination:t,amount:r,chainId:s})),h[10]=d,h[11]=c):c=h[11];let g=c;h[12]!==d?(u=async(e,t,r,s)=>d(n.actions.accountDerivativeWithdrawRequestAction1,n=>n.accountDerivativeWithdrawRequestAction1({collateralId:e,destination:t,amount:r,chainId:s})),h[12]=d,h[13]=u):u=h[13];let b=u;return h[14]!==m||h[15]!==f||h[16]!==b||h[17]!==v||h[18]!==y||h[19]!==p||h[20]!==g?(l={accountSpotWithdrawRequest:p,accountDerivativeWithdrawRequest:f,accountSpotBalanceTransferRequest:y,accountDerivativeBalanceTransferRequest:m,accountInternalBalanceTransferRequest:v,accountSpotWithdrawRequestAction1:g,accountDerivativeWithdrawRequestAction1:b},h[14]=m,h[15]=f,h[16]=b,h[17]=v,h[18]=y,h[19]=p,h[20]=g,h[21]=l):l=h[21],l}])},475977,344407,e=>{"use strict";let t=[{type:"function",name:"deposit",inputs:[{name:"token",type:"address",internalType:"address"},{name:"amount",type:"uint256",internalType:"uint256"},{name:"receiver",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"depositWithPermit",inputs:[{name:"request",type:"tuple",internalType:"struct IBridge.DepositRequest",components:[{name:"owner",type:"address",internalType:"address"},{name:"token",type:"address",internalType:"address"},{name:"amount",type:"uint256",internalType:"uint256"},{name:"deadline",type:"uint256",internalType:"uint256"},{name:"v",type:"uint8",internalType:"uint8"},{name:"r",type:"bytes32",internalType:"bytes32"},{name:"s",type:"bytes32",internalType:"bytes32"}]}],outputs:[],stateMutability:"nonpayable"}];e.s(["BRIDGE_ABI",0,t],475977),e.s(["ERC20_ABI",0,[{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}]],344407)},954616,180166,540143,619273,88587,915823,175555,814448,793803,936553,114272,912598,e=>{"use strict";let t,r,n,s,i,a;var o=e.i(271645);e.i(247167);var c={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},u=new class{#e=c;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function l(e){setTimeout(e,0)}e.s(["systemSetTimeoutZero",0,l,"timeoutManager",0,u],180166);var h=(t=[],r=0,n=e=>{e()},s=e=>{e()},i=l,{batch:e=>{let a;r++;try{a=e()}finally{let e;--r||(e=t,t=[],e.length&&i(()=>{s(()=>
2{e.forEach(e=>{n(e)})})}))}return a},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a=e=>{r?t.push(e):i(()=>{n(e)})},setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{s=e},setScheduler:e=>{i=e}});e.s(["notifyManager",0,h],540143);var d="u"<typeof window||"Deno"in globalThis;function p(){}function f(e){return"number"==typeof e&&e>=0&&e!==1/0}function y(e,t){return(t?.queryKeyHashFn||m)(e)}function m(e){return JSON.stringify(e,(e,t)=>C(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function v(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(r=>v(e[r],t[r]))}var g=Object.prototype.hasOwnProperty;function b(e,t){if(e===t)return e;let r=S(e)&&S(t);if(!r&&!(C(e)&&C(t)))return t;let n=(r?e:Object.keys(e)).length,s=r?t:Object.keys(t),i=s.length,a=r?Array(i):{},o=0;for(let c=0;c<i;c++){let i=r?c:s[c],u=e[i],l=t[i];if(u===l){a[i]=u,(r?c<n:g.call(e,i))&&o++;continue}if(null===u||null===l||"object"!=typeof u||"object"!=typeof l){a[i]=l;continue}let h=b(u,l);a[i]=h,h===u&&o++}return n===i&&o===n?e:a}function w(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}function S(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function C(e){if(!T(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!T(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function T(e){return"[object Object]"===Object.prototype.toString.call(e)}function R(e){return new Promise(t=>{u.setTimeout(t,e)})}var A=Symbol();function E(e,t){return"function"==typeof e?e(...t):!!e}e.s(["addToEnd",0,function(e,t,r=0){let n=[...e,t];return r&&n.length>r?n.slice(1):n},"addToStart",0,function(e,t,r=0){let n=[t,...e];return r&&n.length>r?n.slice(0,-1):n},"ensureQueryFn",0,function(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==A?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))},"functionalUpdate",0,function(e,t){return"function"==typeof e?e(t):e},"hashKey",0,m,"hashQueryKeyByOptions",0,y,"isServer",0,d,"isValidTimeout",0,f,"matchMutation",0,function(e,t){let{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(m(t.options.mutationKey)!==m(i))return!1}else if(!v(t.options.mutationKey,i))return!1}return(!n||t.state.status===n)&&(!s||!!s(t))},"matchQuery",0,function(e,t){let{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:a,stale:o}=e;if(a){if(n){if(t.queryHash!==y(a,t.options))return!1}else if(!v(t.queryKey,a))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof o||t.isStale()===o)&&(!s||s===t.state.fetchStatus)&&(!i||!!i(t))},"noop",0,p,"partialMatchKey",0,v,"replaceData",0,function(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?b(e,t):t},"replaceEqualDeep",0,b,"resolveEnabled",0,function(e,t){return"function"==typeof e?e(t):e},"resolveStaleTime",0,function(e,t){return"function"==typeof e?e(t):e},"shallowEqualObjects",0,w,"shouldThrowError",0,E,"skipToken",0,A,"sleep",0,R,"timeUntilStale",0,function(e,t){return Math.max(e+(t||0)-Date.now(),0)}],619273);var O=class{#r;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),f(this.gcTime)&&(this.#r=u.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(d?1/0:3e5))}clearGcTimeout(){this.#r&&(u.clearTimeout(this.#r),this.#r=void 0)}};e.s(["Removable",0,O],88587);var I=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};e.s(["Subscribable",0,I],915823);var x=new class extends I{#n;#s;#i;constructor(){super(),this.#i=e=>{if(!d&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#s||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#s?.(),this.#s=void 0)}setEventListener(e){this.#i=e,this.#s?.(),this.#s=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#n!==e&&(this.#n=e,this.onFocus())}onFocus(){let e=this.isFocused();
2this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#n?this.#n:globalThis.document?.visibilityState!=="hidden"}};e.s(["focusManager",0,x],175555);var P=new class extends I{#a=!0;#s;#i;constructor(){super(),this.#i=e=>{if(!d&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#s||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#s?.(),this.#s=void 0)}setEventListener(e){this.#i=e,this.#s?.(),this.#s=e(this.setOnline.bind(this))}setOnline(e){this.#a!==e&&(this.#a=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#a}};function D(){let e,t,r=new Promise((r,n)=>{e=r,t=n});function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}function M(e){return Math.min(1e3*2**e,3e4)}function _(e){return(e??"online")!=="online"||P.isOnline()}e.s(["onlineManager",0,P],814448),e.s(["pendingThenable",0,D],793803);var k=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function F(e){let t,r=!1,n=0,s=D(),i=()=>x.isFocused()&&("always"===e.networkMode||P.isOnline())&&e.canRun(),a=()=>_(e.networkMode)&&e.canRun(),o=e=>{"pending"===s.status&&(t?.(),s.resolve(e))},c=e=>{"pending"===s.status&&(t?.(),s.reject(e))},u=()=>new Promise(r=>{t=e=>{("pending"!==s.status||i())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,"pending"===s.status&&e.onContinue?.()}),l=()=>{let t;if("pending"!==s.status)return;let a=0===n?e.initialPromise:void 0;try{t=a??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(o).catch(t=>{if("pending"!==s.status)return;let a=e.retry??3*!d,o=e.retryDelay??M,h="function"==typeof o?o(n,t):o,p=!0===a||"number"==typeof a&&n<a||"function"==typeof a&&a(n,t);r||!p?c(t):(n++,e.onFail?.(n,t),R(h).then(()=>i()?void 0:u()).then(()=>{r?c(t):l()}))})};return{promise:s,status:()=>s.status,cancel:t=>{if("pending"===s.status){let r=new k(t);c(r),e.onCancel?.(r)}},continue:()=>(t?.(),s),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:a,start:()=>(a()?l():u().then(l),s)}}e.s(["CancelledError",0,k,"canFetch",0,_,"createRetryer",0,F],936553);var U=class extends O{#o;#c;#u;#l;constructor(e){super(),this.#o=e.client,this.mutationId=e.mutationId,this.#u=e.mutationCache,this.#c=[],this.state=e.state||q(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#c.includes(e)||(this.#c.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#c=this.#c.filter(t=>t!==e),this.scheduleGc(),this.#u.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#c.length||("pending"===this.state.status?this.scheduleGc():this.#u.remove(this))}continue(){return this.#l?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#h({type:"continue"})},r={client:this.#o,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#l=F({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#h({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#h({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#u.canRun(this)});let n="pending"===this.state.status,s=!this.#l.canStart();try{if(n)t();else{this.#h({type:"pending",variables:e,isPaused:s}),await this.#u.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#h({type:"pending",context:t,variables:e,isPaused:s})}let i=await this.#l.start();return await this.#u.config.onSuccess?.(i,e,this.state.context,this,r),await this.options.onSuccess?.(i,e,this.state.context,r),await this.#u.config.onSettled?.(i,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(i,null,e,this.state.context,r),this.#h({type:"success",data:i}),i}catch(t){try{throw await this.#u.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#u.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#h({type:"error",error:t})}}finally{this.#u.runNext(this)}}#h(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};
2case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),h.batch(()=>{this.#c.forEach(t=>{t.onMutationUpdate(e)}),this.#u.notify({mutation:this,type:"updated",action:e})})}};function q(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}e.s(["Mutation",0,U,"getDefaultState",0,q],114272);var Q=class extends I{#o;#d=void 0;#p;#f;constructor(e,t){super(),this.#o=e,this.setOptions(t),this.bindMethods(),this.#y()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#o.defaultMutationOptions(e),w(this.options,t)||this.#o.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#p,observer:this}),t?.mutationKey&&this.options.mutationKey&&m(t.mutationKey)!==m(this.options.mutationKey)?this.reset():this.#p?.state.status==="pending"&&this.#p.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#p?.removeObserver(this)}onMutationUpdate(e){this.#y(),this.#m(e)}getCurrentResult(){return this.#d}reset(){this.#p?.removeObserver(this),this.#p=void 0,this.#y(),this.#m()}mutate(e,t){return this.#f=t,this.#p?.removeObserver(this),this.#p=this.#o.getMutationCache().build(this.#o,this.options),this.#p.addObserver(this),this.#p.execute(e)}#y(){let e=this.#p?.state??q();this.#d={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#m(e){h.batch(()=>{if(this.#f&&this.hasListeners()){let t=this.#d.variables,r=this.#d.context,n={client:this.#o,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type==="success"?(this.#f.onSuccess?.(e.data,t,r,n),this.#f.onSettled?.(e.data,null,t,r,n)):e?.type==="error"&&(this.#f.onError?.(e.error,t,r,n),this.#f.onSettled?.(void 0,e.error,t,r,n))}this.listeners.forEach(e=>{e(this.#d)})})}},B=e.i(474076),L=o.createContext(void 0),j=e=>{let t=o.useContext(L);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t};e.s(["QueryClientProvider",0,({client:e,children:t})=>(o.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,B.jsx)(L.Provider,{value:e,children:t})),"useQueryClient",0,j],912598),e.s(["useMutation",0,function(e,t){let r=j(t),[n]=o.useState(()=>new Q(r,e));o.useEffect(()=>{n.setOptions(e)},[n,e]);let s=o.useSyncExternalStore(o.useCallback(e=>n.subscribe(h.batchCalls(e)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=o.useCallback((e,t)=>{n.mutate(e,t).catch(p)},[n]);if(s.error&&E(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}],954616)},913849,789408,286491,869230,469637,266027,348396,170778,645037,423028,e=>{"use strict";let t;var r=e.i(475977),n=e.i(344407),s=e.i(271645),i=e.i(309682),a=e.i(307075),o=e.i(110163),c=e.i(668375),u=e.i(488003),l=e.i(321960),h=e.i(982615),d=e.i(954616),p=e.i(401512),f=e.i(210920),y=e.i(912598),m=e.i(31066),v=e.i(619273);function g(e){return JSON.stringify(e,(e,t)=>!function(e){if(!b(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!b(r)&&!!r.hasOwnProperty("isPrototypeOf")}(t)?"bigint"==typeof t?t.toString():t:Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}))}function b(e){return"[object Object]"===Object.prototype.toString.call(e)}function w(e){let{_defaulted:t,behavior:r,gcTime:n,initialData:s,initialDataUpdatedAt:i,maxPages:a,meta:o,networkMode:c,queryFn:u,queryHash:l,queryKey:h,queryKeyHashFn:d,retry:p,retryDelay:f,structuralSharing:y,getPreviousPageParam:m,getNextPageParam:v,initialPageParam:g,_optimisticResults:b,enabled:w,notifyOnChangeProps:S,placeholderData:C,refetchInterval:T,refetchIntervalInBackgroun
2d:R,refetchOnMount:A,refetchOnReconnect:E,refetchOnWindowFocus:O,retryOnMount:I,select:x,staleTime:P,suspense:D,throwOnError:M,config:_,connector:k,query:F,...U}=e;return U}e.s(["filterQueryOptions",0,w,"hashFn",0,g,"structuralSharing",0,function(e,t){return(0,v.replaceEqualDeep)(e,t)}],789408);var S=e.i(175555),C=e.i(540143);e.i(247167);var T=e.i(936553),R=e.i(88587),A=class extends R.Removable{#v;#g;#b;#o;#l;#w;#S;constructor(e){super(),this.#S=!1,this.#w=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#o=e.client,this.#b=this.#o.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#v=I(this.options),this.state=e.state??this.#v,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#l?.promise}setOptions(e){if(this.options={...this.#w,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=I(this.options);void 0!==e.data&&(this.setState(O(e.data,e.dataUpdatedAt)),this.#v=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#b.remove(this)}setData(e,t){let r=(0,v.replaceData)(this.state.data,e,this.options);return this.#h({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#h({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#l?.promise;return this.#l?.cancel(e),t?t.then(v.noop).catch(v.noop):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#v)}isActive(){return this.observers.some(e=>!1!==(0,v.resolveEnabled)(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===v.skipToken||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===(0,v.resolveStaleTime)(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!(0,v.timeUntilStale)(this.state.dataUpdatedAt,e))}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#l?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#l?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#b.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#l&&(this.#S?this.#l.cancel({revert:!0}):this.#l.cancelRetry()),this.scheduleGc()),this.#b.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#h({type:"invalidate"})}async fetch(e,t){let r;if("idle"!==this.state.fetchStatus&&this.#l?.status()!=="rejected"){if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#l)return this.#l.continueRetry(),this.#l.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,s=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#S=!0,n.signal)})},i=()=>{let e,r=(0,v.ensureQueryFn)(this.options,t),n=(s(e={client:this.#o,queryKey:this.queryKey,meta:this.meta}),e);return(this.#S=!1,this.options.persister)?this.options.persister(r,n,this):r(n)},a=(s(r={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#o,state:this.state,fetchFn:i}),r);this.options.behavior?.onFetch(a,this),this.#g=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#h({type:"fetch",meta:a.fetchOptions?.meta}),this.#l=(0,T.createRetryer)({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof T.CancelledError&&e.revert&&this.setState({...this.#g,fetchStatus:"idle"}),n.abort()},onFail:(e,t)=>{this.#h({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#h({type:"pause"})},onContinue:()=>{this.#h({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#l.start();if(void 0===e)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#b.config.onSuccess?.(e,this),this.#b.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof T.CancelledError){if(e.silent)return this.#l.promise;else if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#h({type:"error",error:e}),this.#b.config.onError?.(e,this),this.#b.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#h(e){let t=t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...E(t.data,this.options),fetchMeta:e.meta??null};case"success":let r={...t,...O(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#g=e.manual?r:void 0,r;case"error":let n=e.error;
2return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),C.notifyManager.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#b.notify({query:this,type:"updated",action:e})})}};function E(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:(0,T.canFetch)(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function O(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function I(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}e.s(["Query",0,A,"fetchState",0,E],286491);var x=e.i(915823),P=e.i(793803),D=e.i(180166),M=class extends x.Subscribable{constructor(e,t){super(),this.options=t,this.#o=e,this.#C=null,this.#T=(0,P.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#o;#R=void 0;#A=void 0;#d=void 0;#E;#O;#T;#C;#I;#x;#P;#D;#M;#_;#k=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#R.addObserver(this),_(this.#R,this.options)?this.#F():this.updateResult(),this.#U())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return k(this.#R,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return k(this.#R,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#q(),this.#Q(),this.#R.removeObserver(this)}setOptions(e){let t=this.options,r=this.#R;if(this.options=this.#o.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,v.resolveEnabled)(this.options.enabled,this.#R))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#B(),this.#R.setOptions(this.options),t._defaulted&&!(0,v.shallowEqualObjects)(this.options,t)&&this.#o.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#R,observer:this});let n=this.hasListeners();n&&F(this.#R,r,this.options,t)&&this.#F(),this.updateResult(),n&&(this.#R!==r||(0,v.resolveEnabled)(this.options.enabled,this.#R)!==(0,v.resolveEnabled)(t.enabled,this.#R)||(0,v.resolveStaleTime)(this.options.staleTime,this.#R)!==(0,v.resolveStaleTime)(t.staleTime,this.#R))&&this.#L();let s=this.#j();n&&(this.#R!==r||(0,v.resolveEnabled)(this.options.enabled,this.#R)!==(0,v.resolveEnabled)(t.enabled,this.#R)||s!==this.#_)&&this.#W(s)}getOptimisticResult(e){var t,r;let n=this.#o.getQueryCache().build(this.#o,e),s=this.createResult(n,e);return t=this,r=s,(0,v.shallowEqualObjects)(t.getCurrentResult(),r)||(this.#d=s,this.#O=this.options,this.#E=this.#R.state),s}getCurrentResult(){return this.#d}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#T.status||this.#T.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#k.add(e)}getCurrentQuery(){return this.#R}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#o.defaultQueryOptions(e),r=this.#o.getQueryCache().build(this.#o,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#F({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#d))}#F(e){this.#B();let t=this.#R.fetch(this.options,e);return e?.throwOnError||(t=t.catch(v.noop)),t}#L(){this.#q();let e=(0,v.resolveStaleTime)(this.options.staleTime,this.#R);if(v.isServer||this.#d.isStale||!(0,v.isValidTimeout)(e))return;let t=(0,v.timeUntilStale)(this.#d.dataUpdatedAt,e);this.#D=D.timeoutManager.setTimeout(()=>{this.#d.isStale||this.updateResult()},t+1)}#j(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#R):this.options.refetchInterval)??!1}#W(e){this.#Q(),this.#_=e,!v.isServer&&!1!==(0,v.resolveEnabled)(this.options.enabled,this.#R)&&(0,v.isValidTimeout)(this.#_)&&0!==this.#_&&(this.#M=D.timeoutManager.setInterval(()=>
2{(this.options.refetchIntervalInBackground||S.focusManager.isFocused())&&this.#F()},this.#_))}#U(){this.#L(),this.#W(this.#j())}#q(){this.#D&&(D.timeoutManager.clearTimeout(this.#D),this.#D=void 0)}#Q(){this.#M&&(D.timeoutManager.clearInterval(this.#M),this.#M=void 0)}createResult(e,t){let r,n=this.#R,s=this.options,i=this.#d,a=this.#E,o=this.#O,c=e!==n?e.state:this.#A,{state:u}=e,l={...u},h=!1;if(t._optimisticResults){let r=this.hasListeners(),i=!r&&_(e,t),a=r&&F(e,n,t,s);(i||a)&&(l={...l,...E(u.data,e.options)}),"isRestoring"===t._optimisticResults&&(l.fetchStatus="idle")}let{error:d,errorUpdatedAt:p,status:f}=l;r=l.data;let y=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===f){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,y=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#P?.state.data,this.#P):t.placeholderData,void 0!==e&&(f="success",r=(0,v.replaceData)(i?.data,e,t),h=!0)}if(t.select&&void 0!==r&&!y)if(i&&r===a?.data&&t.select===this.#I)r=this.#x;else try{this.#I=t.select,r=t.select(r),r=(0,v.replaceData)(i?.data,r,t),this.#x=r,this.#C=null}catch(e){this.#C=e}this.#C&&(d=this.#C,r=this.#x,p=Date.now(),f="error");let m="fetching"===l.fetchStatus,g="pending"===f,b="error"===f,w=g&&m,S=void 0!==r,C={status:f,fetchStatus:l.fetchStatus,isPending:g,isSuccess:"success"===f,isError:b,isInitialLoading:w,isLoading:w,data:r,dataUpdatedAt:l.dataUpdatedAt,error:d,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>c.dataUpdateCount||l.errorUpdateCount>c.errorUpdateCount,isFetching:m,isRefetching:m&&!g,isLoadingError:b&&!S,isPaused:"paused"===l.fetchStatus,isPlaceholderData:h,isRefetchError:b&&S,isStale:U(e,t),refetch:this.refetch,promise:this.#T,isEnabled:!1!==(0,v.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=e=>{"error"===C.status?e.reject(C.error):void 0!==C.data&&e.resolve(C.data)},r=()=>{t(this.#T=C.promise=(0,P.pendingThenable)())},s=this.#T;switch(s.status){case"pending":e.queryHash===n.queryHash&&t(s);break;case"fulfilled":("error"===C.status||C.data!==s.value)&&r();break;case"rejected":("error"!==C.status||C.error!==s.reason)&&r()}}return C}updateResult(){let e=this.#d,t=this.createResult(this.#R,this.options);if(this.#E=this.#R.state,this.#O=this.options,void 0!==this.#E.data&&(this.#P=this.#R),(0,v.shallowEqualObjects)(t,e))return;this.#d=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#k.size)return!0;let n=new Set(r??this.#k);return this.options.throwOnError&&n.add("error"),Object.keys(this.#d).some(t=>this.#d[t]!==e[t]&&n.has(t))};this.#m({listeners:r()})}#B(){let e=this.#o.getQueryCache().build(this.#o,this.options);if(e===this.#R)return;let t=this.#R;this.#R=e,this.#A=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#U()}#m(e){C.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#d)}),this.#o.getQueryCache().notify({query:this.#R,type:"observerResultsUpdated"})})}};function _(e,t){return!1!==(0,v.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&k(e,t,t.refetchOnMount)}function k(e,t,r){if(!1!==(0,v.resolveEnabled)(t.enabled,e)&&"static"!==(0,v.resolveStaleTime)(t.staleTime,e)){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&U(e,t)}return!1}function F(e,t,r,n){return(e!==t||!1===(0,v.resolveEnabled)(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&U(e,r)}function U(e,t){return!1!==(0,v.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,v.resolveStaleTime)(t.staleTime,e))}e.s(["QueryObserver",0,M],869230),e.i(474076);var q=s.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),Q=s.createContext(!1);Q.Provider;var B=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function L(e,t,r){let n=s.useContext(Q),i=s.useContext(q),a=(0,y.useQueryClient)(r),o=a.defaultQueryOptions(e);if(a.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=n?"isRestoring":"optimistic",o.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=o.staleTime;o.staleTime="function"==typeof t?(...r)=>e(t(...r)):e(t),"number"==typeof o.gcTime&&(o.gcTime=Math.max(o.gcTime,1e3))}(o.suspense||o.throwOnError||o.experimental_prefetchInRender)&&!i.isReset()&&(o.retryOnMount=!1),s.useEffect(()=>{i.clearReset()},[i]);let c=!a.getQueryCache().get(o.queryHash),[u]=s.useState(()=>new t(a,o)),l=u.getOptimisticResult(o),h=!n&&!1!==e.subscribed;if(s.useSyncExternalStore(s.useCallback(e=>{let t=h?u.subscribe(C.notifyManager.batchCalls(e)):v.noop;return u.updateResult(),t},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),s.useEffect(()=>{u.setOptions(o)},[o,u]),o?.suspense&&l.isPending)throw B(o,u,i);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s}
2)=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&void 0===e.data||(0,v.shouldThrowError)(r,[e.error,n])))({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if(a.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.experimental_prefetchInRender&&!v.isServer&&l.isLoading&&l.isFetching&&!n){let e=c?B(o,u,i):a.getQueryCache().get(o.queryHash)?.promise;e?.catch(v.noop).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?l:u.trackResult(l)}function j(e,t){return L(e,M,t)}function W(e){let t=j({...e,queryKeyHashFn:g});return t.queryKey=e.queryKey,t}function K(e){return e.state.chainId}function N(e={}){let t=(0,f.useConfig)(e);return(0,s.useSyncExternalStore)(e=>(function(e,t){let{onChange:r}=t;return e.subscribe(e=>e.chainId,r)})(t,{onChange:e}),()=>K(t),()=>K(t))}function V(e={}){let{query:t={},...r}=e,n=(0,f.useConfig)(r),i=(0,y.useQueryClient)(),{address:a,connector:o,status:c}=(0,h.useAccount)({config:n}),u=N({config:n}),l=e.connector??o,{queryKey:d,...p}=function(e,t={}){return{gcTime:0,async queryFn({queryKey:r}){let{connector:n}=t,{connectorUid:s,scopeKey:i,...a}=r[1];return(0,m.getWalletClient)(e,{...a,connector:n})},queryKey:function(e={}){let{connector:t,...r}=e;return["walletClient",{...w(r),connectorUid:t?.uid}]}(t)}}(n,{...e,chainId:e.chainId??u,connector:e.connector??o}
2),v=!!(("connected"===c||"reconnecting"===c&&l?.getProvider)&&(t.enabled??!0)),g=(0,s.useRef)(a);return(0,s.useEffect)(()=>{let e=g.current;!a&&e?(i.removeQueries({queryKey:d}),g.current=void 0):a!==e&&(i.invalidateQueries({queryKey:d}),g.current=a)},[a,i]),W({...t,...p,queryKey:d,enabled:v,staleTime:1/0})}e.s(["useBaseQuery",0,L],469637),e.s(["useQuery",0,j],266027),e.s(["useQuery",0,W],348396),e.s(["useChainId",0,N],170778),e.s(["useWalletClient",0,V],645037);var G=e.i(505359),z=e.i(365087);let H=[];function $(e){let t=e.chains;return(0,z.deepEqual)(H,t)?H:(H=t,t)}var Y=e.i(858532),X=e.i(268407);e.i(842917);var J=e.i(68043);let Z={sepolia:[J.env.NEXT_PUBLIC_RPC_URL,"https://0xrpc.io/sep","https://ethereum-sepolia-rpc.publicnode.com","https://sepolia.drpc.org"],mainnet:["https://ethereum-mainnet.gateway.tatum.io","https://eth.rpc.blxrbdn.com","https://eth.blockrazor.xyz","https://0xrpc.io/eth","https://eth.drpc.org","https://1rpc.io/eth","https://rpc.mevblocker.io","https://rpc.mevblocker.io/fast","https://ethereum-rpc.publicnode.com","https://rpc.flashbots.net/fast","https://eth1.lava.build",J.env.NEXT_PUBLIC_RPC_URL]},ee=3e5,et={timeout:3e3,retryCount:2,retryDelay:1e3};e.s(["useDepositActions",0,()=>{let{address:e,chain:t}=(0,h.useAccount)(),{data:y}=V(),m=(0,X.useTradingDataStore)(e=>e.supportedCollateral),{writeContractAsync:v}=function(e={}){var t;let{mutation:r}=e,n=(t=(0,f.useConfig)(e),{mutationFn:e=>(0,p.writeContract)(t,e),mutationKey:["writeContract"]}),{mutate:s,mutateAsync:i,...a}=(0,d.useMutation)({...r,...n});return{...a,writeContract:s,writeContractAsync:i}}(),{switchChainAsync:g}=function(e={}){let{mutation:t}=e,r=(0,f.useConfig)(e),n={mutationFn:e=>(0,G.switchChain)(r,e),mutationKey:["switchChain"]},{mutate:i,mutateAsync:a,...o}=(0,d.useMutation)({...t,...n});return{...o,chains:function(e={}){let t=(0,f.useConfig)(e);return(0,s.useSyncExternalStore)(e=>(function(e,t){let{onChange:r}=t;return e._internal.chains.subscribe((e,t)=>{r(e,t)})})(t,{onChange:e}),()=>$(t),()=>$(t))}({config:r}),switchChain:i,switchChainAsync:a}}(),b=(0,s.useMemo)(()=>J.isMainnet?l.mainnet:u.sepolia,[J.isMainnet]),w=(0,s.useMemo)(()=>J.isMainnet?l.mainnet:u.sepolia,[J.isMainnet]),S=(0,s.useMemo)(()=>{let e=J.isMainnet?Z.mainnet:Z.sepolia;return(0,i.createPublicClient)({chain:b,transport:(0,a.fallback)(e.map(e=>(0,o.http)(e,et)))})},[b]),C=(0,s.useCallback)(async(e,t=ee)=>S.waitForTransactionReceipt({hash:e,timeout:t}),[S]),T=(0,s.useCallback)(async t=>Number(await S.readContract({address:m[t]?.bridge_by_chain[0].tokenAddress,abi:n.ERC20_ABI,functionName:"balanceOf",args:[e]}))/10**Number(m[t]?.decimals??6),[e,S,m]),R=(0,s.useCallback)(async(e,t,r)=>await S.readContract({address:e,abi:n.ERC20_ABI,functionName:"allowance",args:[t,r]}),[S]),A=(0,s.useCallback)(async()=>{if(!y)throw Error("Wallet not connected");if(t?.id!==w.id)try{await g({chainId:w.id})}catch(e){throw console.error("Failed to switch chain:",e instanceof Error?e:Error(String(e))),Error(`Failed to switch to ${w.name}`)}},[y,t,w,g]),E=(0,s.useCallback)(()=>t?.id===w.id,[t,w]);return{getBalance:T,deposit:(0,s.useCallback)(async(t,s)=>{try{let i=m[t];if(!i)throw Error(`Token ${t} not found`);await A();let a=(0,c.parseUnits)(s.toString(),i.decimals??6),o=i.bridge_by_chain[0].tokenAddress,u=i.bridge_by_chain[0].bridgeContractAddress,l=async e=>{let t=await v({address:o,abi:n.ERC20_ABI,functionName:"approve",args:[u,e],gas:BigInt(1e5)}),r=await C(t);if("success"!==r.status)throw Error("Approve transaction failed");return{hash:t,receipt:r}},h=await R(o,e,u),d=[];if(h>=a);else if(h===BigInt(0)){let e=await l(a);d.push(e.hash)}else{let e=await l(BigInt(0));d.push(e.hash);let t=await l(a);d.push(t.hash)}let p=await v({address:u,abi:r.BRIDGE_ABI,functionName:"deposit",args:[o,a,e]}),f=await C(p);if("success"!==f.status)throw Error("Deposit transaction failed");return Y.showToast.success({message:"Deposit successful!",description:"Your balance will update in 1-2 minutes."}),{approveHashes:d,depositHash:p,depositReceipt:f}}catch(t){let e=t instanceof Error?t:Error(String(t));if(console.error("Deposit failed:",e),e.message?.includes("timeout")||e.message?.includes("408"))throw Error("Transaction is taking longer than expected due to network congestion. Your transaction may still be processing on the blockchain (can take up to 5 minutes). Please check your transaction on a block explorer.");if(e.message?.includes("insufficient funds"))throw Error("Insufficient funds for gas fees. Please ensure you have enough 
2ETH in your wallet.");if(e.message?.includes("User rejected"))throw Error("Transaction was rejected by user.");else if(e.message?.includes("nonce"))throw Error("Transaction nonce issue. Please try again.");else throw Error(`Deposit failed: ${e.message||"Unknown error occurred"}`)}},[v,e,A,C,m,R]),isCorrectNetwork:E,checkAndSwitchNetwork:A,isMainnet:J.isMainnet,selectedChain:w}}],913849);var er=e.i(500932),en=e.i(965192),es=e.i(671248);e.s(["useVaultActions",0,function(){let e,t,r,n,s,i=(0,er.c)(13),{executeL1Action:a}=(0,en.useActionWrapper)();i[0]!==a?(e=async(e,t)=>a(es.actions.depositToVault,r=>r.depositToVault({vaultAddress:e,amount:t})),i[0]=a,i[1]=e):e=i[1];let o=e;i[2]!==a?(t=async(e,t)=>a(es.actions.redeemFromVault,r=>r.redeemFromVault({vaultAddress:e,shares:t})),i[2]=a,i[3]=t):t=i[3];let c=t;i[4]!==a?(r=async(e,t,r)=>a(es.actions.sendToSubVault,n=>n.sendToSubVault({parentProtocolVault:e,subVaultAddress:[t],amounts:[r]})),i[4]=a,i[5]=r):r=i[5];let u=r;i[6]!==a?(n=async(e,t,r)=>a(es.actions.withdrawFromSubVault,n=>n.withdrawFromSubVault({parentProtocolVault:e,subVaultAddress:[t],amounts:[r]})),i[6]=a,i[7]=n):n=i[7];let l=n;return i[8]!==o||i[9]!==c||i[10]!==u||i[11]!==l?(s={depositToVault:o,redeemFromVault:c,sendToSubVault:u,withdrawFromSubVault:l},i[8]=o,i[9]=c,i[10]=u,i[11]=l,i[12]=s):s=i[12],s}],423028)},906331,e=>{"use strict";var t=e.i(338456);e.s(["useSendTransaction",()=>t.az])},949656,603184,e=>{"use strict";var t=e.i(271645),r=e.i(120785),n=e.i(206287),s=e.i(906331),i=e.i(309682),a=e.i(57159),o=e.i(911347),c=e.i(110163),u=e.i(668375),l=e.i(656679),h=e.i(307075),d=e.i(488003),p=e.i(321960),f=e.i(268407),y=e.i(475977),m=e.i(344407),v=e.i(858532);e.i(842917);var g=e.i(68043),b=e.i(536387);e.i(816790);let w={USDC:10,USDT:10,PYUSD:10,RLUSD:10,USDe:10,USDP:10,USD1:10,WETH:.0033,WBTC:1e-4,SPYx:.02,TSLAx:.04,CRCLx:.12,MSTRx:.02,NVDAx:.06,QQQx:.02,GOOGLx:.05,GLDx:.02,AAPLx:.04};function S(e){let t=e.trim();if(void 0!==w[t])return w[t];let r=t.toUpperCase(),n=Object.keys(w).find(e=>e.toUpperCase()===r);return void 0!==n?w[n]:.1}e.s(["getMinAmountForAssetSymbol",0,S],603184);let C=new Set(["USDC","USDT"]),T={sepolia:[g.env.NEXT_PUBLIC_RPC_URL,"https://0xrpc.io/sep","https://ethereum-sepolia-rpc.publicnode.com","https://sepolia.drpc.org"],mainnet:["https://ethereum-mainnet.gateway.tatum.io","https://eth.rpc.blxrbdn.com","https://eth.blockrazor.xyz","https://0xrpc.io/eth","https://eth.drpc.org","https://1rpc.io/eth","https://rpc.mevblocker.io","https://rpc.mevblocker.io/fast","https://ethereum-rpc.publicnode.com","https://rpc.flashbots.net/fast","https://eth1.lava.build"]},R={timeout:3e4,retryCount:2,retryDelay:1e3};e.s(["usePrivyDepositAction",0,()=>{let{authenticated:e}=(0,r.usePrivy)(),{wallets:w}=(0,n.useWallets)(),{sendTransaction:A}=(0,s.useSendTransaction)(),E=(0,f.useTradingDataStore)(e=>e.supportedCollateral),O=(0,f.useAuthStore)(e=>e.address),[I,x]=(0,t.useState)(new Set),P=(0,t.useRef)(null),D=(0,t.useRef)(new Set),M=(0,t.useMemo)(()=>w.find(e=>"privy"===e.walletClientType&&e.address.toLowerCase()===O?.toLowerCase())||w.find(e=>"privy"===e.walletClientType),[w,O]),_=e&&!!M;(0,t.useEffect)(()=>{D.current=I},[I]);let{selectedChain:k,rpcUrl:F}=(0,t.useMemo)(()=>({selectedChain:g.isMainnet?p.mainnet:d.sepolia,rpcUrl:g.env.NEXT_PUBLIC_RPC_URL}),[]),U=(0,t.useMemo)(()=>{let e=g.isMainnet?T.mainnet:T.sepolia;return(0,i.createPublicClient)({chain:k,transport:(0,h.fallback)(e.map(e=>(0,c.http)(e,R)))})},[k]),q=(0,t.useCallback)(async()=>{if(!M)throw Error("No Privy embedded wallet available");let e=await M.getEthereumProvider(),[t]=await e.request({method:"eth_accounts"});return{client:(0,a.createWalletClient)({account:t,chain:k,transport:(0,o.custom)(e)}),address:t,provider:e}},[M,k]),Q=(0,t.useCallback)(async()=>{if(!M)throw Error("No Privy embedded wallet available");let e=await M.getEthereumProvider(),t=parseInt(await e.request({method:"eth_chainId"}),16),r=k.id;if(t!==r)try{await e.request({method:"wallet_switchEthereumChain",params:[{chainId:`0x${r.toString(16)}`}]})}catch(t){if(4902===t.code||t?.message?.includes("Unrecognized chain ID"))await e.request({method:"wallet_addEthereumChain",params:[{chainId:`0
2x${r.toString(16)}`,chainName:k.name,nativeCurrency:k.nativeCurrency,rpcUrls:[F],blockExplorerUrls:k.blockExplorers?.default?.url?[k.blockExplorers.default.url]:void 0}]});else throw t}},[M,k,F]),B=(0,t.useCallback)(async e=>{let t=E[e];if(!t?.bridge_by_chain?.[0])throw Error("Token not configured");await Q();let{address:r}=await q();return Number(await U.readContract({address:t.bridge_by_chain[0].tokenAddress,abi:m.ERC20_ABI,functionName:"balanceOf",args:[r]}))/10**t.decimals},[E,U,q,Q]),L=(0,t.useCallback)(async(e,t)=>{let r=E[e];if(!r?.bridge_by_chain?.[0])throw Error("Token not configured");await Q();let{address:n}=await q(),{tokenAddress:s,bridgeContractAddress:i}=r.bridge_by_chain[0],a=(0,u.parseUnits)(t.toString(),r.decimals),o=async e=>{let t=(0,l.encodeFunctionData)({abi:m.ERC20_ABI,functionName:"approve",args:[i,e]}),r=await A({to:s,data:t,chainId:k.id,from:n},{sponsor:!0,address:n});if("success"!==(await U.waitForTransactionReceipt({hash:r.hash,timeout:3e5})).status)throw Error("Approve failed");return r.hash},c=await U.readContract({address:s,abi:m.ERC20_ABI,functionName:"allowance",args:[n,i]}),h=[];c>=a||(c===BigInt(0)||h.push(await o(BigInt(0))),h.push(await o(a)));let d=(0,l.encodeFunctionData)({abi:y.BRIDGE_ABI,functionName:"deposit",args:[s,a,n]}),p=(await A({to:i,data:d,chainId:k.id,from:n},{sponsor:!0,address:n})).hash;if("success"!==(await U.waitForTransactionReceipt({hash:p,timeout:3e5})).status)throw Error("Deposit failed");return{approveHashes:h,bridgeHash:p}},[E,U,q,Q,A,k.id]),j=(0,t.useCallback)(async e=>{if(b.PRIVY_AUTO_BRIDGE_ENABLED&&!D.current.has(e.symbol))try{let t=await B(e.symbol),r=S(e.symbol);if(t<r)return;x(t=>new Set(t).add(e.symbol)),await L(e.symbol,t),v.showToast.success({message:`Successfully bridged ${t} ${e.symbol}.`,description:"Balance will update in 1-2 minutes."})}catch(r){let t=r instanceof Error?r.message:"Unknown error";t.includes("chain")||t.includes("network")?(k.name,e.symbol):t.includes("User rejected")||t.includes("user rejected")}finally{x(t=>{let r=new Set(t);return r.delete(e.symbol),r})}},[B,L,k]),W=(0,t.useCallback)(async()=>{if(!b.PRIVY_AUTO_BRIDGE_ENABLED||!_)return;let e=Object.values(E).filter(e=>C.has(e.symbol));0!==e.length&&await Promise.allSettled(e.map(j))},[_,E,j]);return(0,t.useEffect)(()=>{if(!b.PRIVY_AUTO_BRIDGE_ENABLED||!_||0===Object.keys(E).length){P.current&&(clearInterval(P.current),P.current=null);return}if(!P.current)return W(),P.current=setInterval(W,12e4),()=>{P.current&&(clearInterval(P.current),P.current=null)}},[_,E,W]),{isPolling:!!P.current,isPrivyWallet:_,processingTokens:Array.from(I)}}],949656)},849387,925450,e=>{"use strict";e.i(727726),e.i(126996),e.i(191182),e.i(913849),e.i(423028),e.i(949656),e.s([],849387);var t=e.i(500932),r=e.i(271645);e.i(842917);var n=e.i(68043);function s(e){let t=new Date,r=e.getTime()-t.getTime();return r<=0?{isActive:!1,timeLeft:{days:0,hours:0,minutes:0,seconds:0},targetDate:e}:{isActive:!0,timeLeft:{days:Math.floor(r/864e5),hours:Math.floor(r/36e5%24),minutes:Math.floor(r/1e3/60%60),seconds:Math.floor(r/1e3%60)},targetDate:e}}function i(){return new Date(n.env.NEXT_PUBLIC_COUNTDOWN_END_DATE)}e.s(["useCountdownStatus",0,function(){let e,n,a,o=(0,t.c)(5),[c]=(0,r.useState)(i);o[0]!==c?(e=()=>s(c),o[0]=c,o[1]=e):e=o[1];let[u,l]=(0,r.useState)(e);return o[2]!==c?(n=()=>{let e=setInterval(()=>{let t=s(c);l(t),t.isActive||clearInterval(e)},1e3);return()=>clearInterval(e)},a=[c],o[2]=c,o[3]=n,o[4]=a):(n=o[3],a=o[4]),(0,r.useEffect)(n,a),u}],925450)},249994,e=>{"use strict";var t=e.i(954616),r=e.i(6110),n=e.i(210920),s=e.i(324307),i=e.i(331587),a=e.i(271645);e.s(["useDisconnect",0,function(e={}){let{mutation:o}=e,c=(0,n.useConfig)(e),u={mutationFn:e=>(0,r.disconnect)(c,e),mutationKey:["disconnect"]},{mutate:l,mutateAsync:h,...d}=(0,t.useMutation)({...o,...u});return{...d,connectors:(function(e={}){let t=(0,n.useConfig)(e);return(0,a.useSyncExternalStore)(e=>(0,i.watchConnections)(t,{onChange:e}),()=>(0,s.getConnections)(t),()=>(0,s.getConnections)(t))})({config:c}).map(e=>e.connector),disconnect:l,disconnectAsync:h}}],249994)},279582,e=>{"use strict";var t=e.i(271645),r=e.i(982615),n=e.i(249994),s=e.i(120785),i=e.i(268407),a=e.i(103439),o=e.i(344873);e.s(["useAuthController",0,function(){let[e,c]=(0,t.useState)(!1),u=(0,t.useRef)(null),l=(0,t.useRef)(!1),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{c(!0)},[]);let{isConnected:d,address:p,isReconnecting:f}=(0,r.useAccount)(),{disconnect:y}=(0,n.useDisconnect)(),{authenticated:m,ready:v,logout:g,user:b}=(0,s.usePrivy)(),w=(0,t.useMemo)(()=>m&&b?.linkedAccounts?b.linkedAccounts.filter(e=>"wallet"===e.type&&"walletClientType"in e&&"privy"===e.walletClientType).map(e=>e.address.toLowerCase()):[],[m,b?.linkedAccounts]),S=(0,t.useMemo)(()=>
2{if(!m)return null;let e=i.useAuthStore.getState().address;return e&&"0x0000000000000000000000000000000000000000"!==e&&w.includes(e.toLowerCase())?e:b?.wallet?.address?(0,o.normalizeAddress)(b.wallet.address):null},[m,b?.wallet?.address,w]),C=!f,T=C&&v&&e,R=(0,t.useMemo)(()=>T?d&&p?{isInitialized:!0,activeSource:"wagmi",address:(0,o.normalizeAddress)(p)}:m&&S?{isInitialized:!0,activeSource:"privy",address:S}:{isInitialized:!0,activeSource:"none",address:null}:{isInitialized:!1,activeSource:"none",address:null},[T,d,p,m,S]);(0,t.useEffect)(()=>{if(!e||!R.isInitialized)return;let{address:t}=R;if(u.current!==t||!l.current)if(l.current=!0,t)u.current!==t&&(u.current=t,h.current=!1,"connect-wallet"===i.useActionStore.getState().modal&&i.useActionStore.getState().setModal(null),i.useAuthStore.getState().updateStatusOnConnect(t));else{let e=i.useAuthStore.getState(),t="0x0000000000000000000000000000000000000000"!==e.address&&e.agents[e.address];if(t){u.current=null,"qr-code"!==t.name&&i.useAuthStore.getState().setStatus("disconnected");return}h.current||(u.current=null,h.current=!0,i.useAuthStore.getState().setAddress("0x0000000000000000000000000000000000000000"),i.useAuthStore.getState().setStatus("disconnected"))}},[e,R]);let A=(0,t.useCallback)(async()=>{if(!e)return;let{activeSource:t}=R;try{if(a.appKit)try{await a.appKit.disconnect()}catch{}if("wagmi"===t||d){for(let e of Array.from(a.wagmiConfig.state.connections.values()))try{await y({connector:e.connector})}catch(t){console.error(`Failed to disconnect ${e.connector.id}:`,t)}a.wagmiConfig.state.connections.clear(),a.wagmiConfig.storage&&await a.wagmiConfig.storage.removeItem("recentConnectorId")}if("privy"===t||m)try{await g()}catch(e){console.error("Failed to logout from Privy:",e)}i.useGlobalStore.getState().persistTradingConnection?i.useAuthStore.getState().clearAuth():i.useAuthStore.getState().clearPersistedAuth(),i.useUserTradingDataStore.getState().clearUserTradingData(),u.current=null,h.current=!0}catch(e){throw console.error("Logout failed:",e),e}},[e,R,d,y,m,g]);return{isInitialized:R.isInitialized,isFullyReady:T,activeSource:R.activeSource,address:R.address,isWagmiReady:C,isPrivyReady:v,isConnected:null!==R.address,logout:A}}])},164485,77934,392953,e=>{"use strict";e.s([],164485),e.i(832550),e.i(849387),e.i(925450),e.i(279582);var t=e.i(500932),r=e.i(271645),n=e.i(68043);let s=new Date("2026-02-27T14:00:00Z"),i=new Date("2026-02-28T14:00:00Z"),a=new Date("2026-02-27T16:00:00Z");function o(e){let t=e=>e.toString().padStart(2,"0");return`${t(e.hours)}:${t(e.minutes)}:${t(e.seconds)}`}function c(){let e=new Date,t=s.getTime(),r=i.getTime(),n=a.getTime(),c=e.getTime(),u=c>=n;if(c<t){let e=t-c,r={hours:Math.floor(e/36e5),minutes:Math.floor(e/1e3/60%60),seconds:Math.floor(e/1e3%60)};return{phase:"before",timeLeft:r,formattedTime:o(r),isDepositEnabled:!0,isWithdrawalEnabled:u,message:"Points allocation are live now in"}}if(c>=t&&c<r){let e=r-c,t={hours:Math.floor(e/36e5),minutes:Math.floor(e/1e3/60%60),seconds:Math.floor(e/1e3%60)};return{phase:"active",timeLeft:t,formattedTime:o(t),isDepositEnabled:!0,isWithdrawalEnabled:u,message:"The Points Season Has Begun! -"}}return{phase:"after",timeLeft:{hours:0,minutes:0,seconds:0},formattedTime:"00:00:00",isDepositEnabled:!0,isWithdrawalEnabled:u,message:""}}let u={phase:"after",timeLeft:{hours:0,minutes:0,seconds:0},formattedTime:"00:00:00",isDepositEnabled:!0,isWithdrawalEnabled:!0,message:""};function l(){return n.isMainnet?c():u}e.s(["useVaultCountdown",0,function(){let e,s,i=(0,t.c)(2),[a,o]=(0,r.useState)(l);return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{if(!n.isMainnet)return;let e=setInterval(()=>{let t=c();o(t),"after"===t.phase&&clearInterval(e)},1e3);return()=>clearInterval(e)},s=[],i[0]=e,i[1]=s):(e=i[0],s=i[1]),(0,r.useEffect)(e,s),a}],77934);var h=e.i(268407);let d=e.i(421852).EASTER_BUTTON_POOL_MAP;e.s(["BUTTON",0,d,"useEasterEgg",0,function(e,t){let n=(0,h.useEasterStore)(t=>t.buttonEggMap[e]),s=(0,h.useEasterStore)(e=>e.showCard),i=t?.passthrough??!1;return(0,r.useCallback)(e=>e,[n,s,i])}],392953)},832550,542328,366181,e=>{"use strict";e.s(["useAuthActions",()=>m],832550);var t=e.i(500932),r=e.i(268407),n=e.i(271645);e.s(["AuthProvider",()=>y,"useLogout",()=>f],366181);
2var s=e.i(474076);e.i(164485);var i=e.i(279582),a=e.i(949656),o=e.i(618566),c=e.i(685720),u=e.i(393653);async function l(e,t){let{setAddress:r,setMaster:n,setAgent:s,setStatus:i,setModal:a}=t;try{let t,{signature:o,typedData:l,message:h,agent:d,signer:p}=JSON.parse(decodeURIComponent(escape(atob(e))))||{};if(!o||!l){if(d?.address&&d?.privateKey&&p)return r(p),n(p),s(p,{name:d.name??"qr-code",address:d.address,privateKey:d.privateKey}),i("trading-enabled"),a(null),{success:!0,signer:p};throw Error("Invalid QR payload")}if(l){let e={...l.message,nonce:BigInt(l.message?.nonce??0)};t=await (0,u.recoverTypedDataAddress)({domain:l.domain,types:l.types,primaryType:l.primaryType,message:e,signature:o})}else t=await (0,c.recoverMessageAddress)({message:h,signature:o});let f=p??t;return r(f),n(f),d?.address&&d?.privateKey?(s(f,{name:d.name??"qr-wallet",address:d.address,privateKey:d.privateKey}),i("trading-enabled")):i("connected"),a(null),{success:!0,signer:f}}catch(e){return console.error("QR link login failed",e),{success:!1,error:e}}}function h(e){try{let t=new URL(e).searchParams.get("link");if(t)return t}catch{}return e}e.s(["extractLinkParam",0,h,"recoverFromQrPayload",0,l],542328);let d=()=>{let e=(0,o.useSearchParams)(),{setAddress:t,setStatus:s,setAgent:i,setMaster:a}=(0,r.useAuthStore)(),{setModal:c}=(0,r.useActionStore)();return(0,n.useEffect)(()=>{let r=e.get("link");r&&(async()=>{let e=h(r);await l(e,{setAddress:t,setMaster:a,setAgent:i,setStatus:s,setModal:c})})()},[]),null},p=(0,n.createContext)(null),f=()=>{let e=(0,n.useContext)(p);if(!e)throw Error("useLogout must be used within AuthProvider");return e.logout},y=e=>{let r,o,c,u=(0,t.c)(6),{children:l}=e,{logout:h}=(0,i.useAuthController)();return(0,a.usePrivyDepositAction)(),u[0]!==h?(r={logout:h},u[0]=h,u[1]=r):r=u[1],u[2]===Symbol.for("react.memo_cache_sentinel")?(o=(0,s.jsx)(n.Suspense,{fallback:null,children:(0,s.jsx)(d,{})}),u[2]=o):o=u[2],u[3]!==l||u[4]!==r?(c=(0,s.jsxs)(p.Provider,{value:r,children:[o,l]}),u[3]=l,u[4]=r,u[5]=c):c=u[5],c},m=()=>{let e,s,i=(0,t.c)(8),a=(0,r.useGlobalStore)(),{setStatus:o}=(0,r.useAuthStore)(),[c]=(0,n.useState)(!1),u=f();i[0]!==a||i[1]!==o?(e=()=>{let e=!a.persistTradingConnection,t=r.useAuthStore.getState().status;e?(0,r.migrateAuthData)(sessionStorage,localStorage):(0,r.migrateAuthData)(localStorage,sessionStorage),a.setPersistTradingConnection(e),o(t)},i[0]=a,i[1]=o,i[2]=e):e=i[2];let l=e;return i[3]!==a.persistTradingConnection||i[4]!==c||i[5]!==u||i[6]!==l?(s={toggleTradingPersistence:l,persistTradingConnection:a.persistTradingConnection,isLoading:c,logout:u},i[3]=a.persistTradingConnection,i[4]=c,i[5]=u,i[6]=l,i[7]=s):s=i[7],s}}]);
3
4//# debugId=58ca6846-bf2d-fb24-43df-c18df8966b5b
5//# sourceMappingURL=1739w6aj9.b5c.js.map

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.