PageSourceSearch

https://dex.guru/static/js/1028.291b00ad.js

js dex.guru collected 2026-10-02 11:00:30 UTC 12,824 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdexguru=self.webpackChunkdexguru||[]).push([[1028],{92222:(t,e,n)=>{n.d(e,{A:()=>a});var i=n(62079),o=n(37363),s=n(31242);class a{constructor(t,e,n){this.shouldUpdate=!0,this.initExecutionObject=t=>{const e=t.execution||(0,o.I8)(i.Tr);return t.execution||(t.execution=e,t.execution.status="PENDING",this.updateStepInRoute(t)),"FAILED"===e.status&&(e.status="PENDING",this.updateStepInRoute(t)),e},this.findOrCreateProcess=(t,e,n)=>{var i;if(!(null===(i=t.execution)||void 0===i?void 0:i.process))throw new Error("Execution hasn't been initialized.");const o=t.execution.process.find((t=>t.type===e));if(o)return n&&o.status!==n&&(o.status=n,this.updateStepInRoute(t)),o;const a={type:e,startedAt:Date.now(),message:(0,s.zy)(e,null!==n&&void 0!==n?n:"STARTED"),status:null!==n&&void 0!==n?n:"STARTED"};return t.execution.process.push(a),this.updateStepInRoute(t),a},this.updateProcess=(t,e,n,i)=>{var o,a,r;if(!t.execution)throw new Error("Can't update an empty step execution.");const c=null===(o=null===t||void 0===t?void 0:t.execution)||void 0===o?void 0:o.process.find((t=>t.type===e));if(!c)throw new Error("Can't find a process for the given type.");switch(n){case"CANCELLED":case"DONE":c.doneAt=Date.now();break;case"FAILED":c.doneAt=Date.now(),t.execution.status="FAILED";break;case"PENDING":t.execution.status="PENDING";break;case"ACTION_REQUIRED":t.execution.status="ACTION_REQUIRED"}if(c.status=n,c.message=(0,s.zy)(e,n),i)for(const[s,u]of Object.entries(i))c[s]=u;return t.execution.process=[...null===(a=null===t||void 0===t?void 0:t.execution)||void 0===a?void 0:a.process.filter((t=>"DONE"===t.status)),...null===(r=null===t||void 0===t?void 0:t.execution)||void 0===r?void 0:r.process.filter((t=>"DONE"!==t.status))],this.updateStepInRoute(t),c},this.removeProcess=(t,e)=>{if(!t.execution)throw new Error("Execution hasn't been initialized.");const n=t.execution.process.findIndex((t=>t.type===e));t.execution.process.splice(n,1),this.updateStepInRoute(t)},this.updateStepInRoute=t=>{if(!this.shouldUpdate)return t;const e=this.route.steps.findIndex((e=>e.id===t.id));if(-1===e)throw new Error("Couldn't find a step to update.");return this.route.steps[e]=Object.assign(this.route.steps[e],t),this.settings.updateCallback(this.route),this.internalUpdateRouteCallback(this.route),this.route.steps[e]},this.route=t,this.settings=e,this.internalUpdateRouteCallback=n}updateExecution(t,e,n){if(!t.execution)throw Error("Can't update empty execution.");return t.execution.status=e,n&&(t.execution=Object.assign(Object.assign({},t.execution),n)),this.updateStepInRoute(t),t}allowUpdates(t){this.shouldUpdate=t}}},79696:(t,e,n)=>{n.d(e,{u:()=>w});var i=n(7965),o=n(94665),s=n(59729),a=n(21925),r=n(75720),c=n(13792),u=n(94145),d=n(37363),l=n(31242),h=function(t,e,n,i){return new(n||(n=Promise))((function(o,s){function a(t){try{c(i.next(t))}catch(e){s(e)}}function r(t){try{c(i.throw(t))}catch(e){s(e)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,r)}c((i=i.apply(t,e||[])).next())}))};var p=function(t,e,n,i){return new(n||(n=Promise))((function(o,s){function a(t){try{c(i.next(t))}catch(e){s(e)}}function r(t){try{c(i.throw(t))}catch(e){s(e)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,r)}c((i=i.apply(t,e||[])).next())}))};const f=(t,e,n,i,o)=>p(void 0,void 0,void 0,(function*(){if((yield t.getChainId())===n.action.fromChainId)return t;n.execution=e.initExecutionObject(n),e.updateExecution(n,"ACTION_REQUIRED");let s=e.findOrCreateProcess(n,"SWITCH_CHAIN","ACTION_REQUIRED");if(o)try{const t=yield i(n.action.fromChainId);if((yield null===t||void 0===t?void 0:t.getChainId())!==n.action.fromChainId)throw new r.kb(r.GL.ChainSwitchError,"Chain switch required.");return s=e.updateProcess(n,s.type,"DONE"),e.updateExecution(n,"PENDING"),t}catch(a){throw e.updateProcess(n,s.type,"FAILED",{error:{message:a.message,code:r.GL.ChainSwitchError}}),e.updateExecution(n,"FAILED"),a}}));var E=function(t,e,n,i){return new(n||(n=Promise))((function(o,s){function a(t){try{c(i.next(t))}catch(e){s(e)}}function r(t){try{c(i.throw(t))}catch(e){s(e)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,r)}c((i=i.apply(t,e||[])).next())}))};class g{constructor(){this.allowUserInteraction=!0,this.allowInteraction=t=>{this.allowUserInteraction=t},this.execute=t=>{let{signer:e,step:n,statusManager:p,settings:g}=t;return E(this,void 0,void 0,(function*(){var t,E,I,x;n.execution=p.initExecutionObject(n);const w=a.Z.getInstance(),v=yield w.getChainById(n.action.fromChainId),N=yield w.getChainById(n.action.toChainId),m=v.id!==N.id,y=m?"CROSS_CHAIN":"SWAP",A=n.execution.process.find((t=>t.type===y));(null===A||void 0===A?void 0:A.txHash)||(0,d.uO)(n.action.fromToken.address)||(yield(0,i.Ye)(e,n,p,g,v,this.allowUserInteraction));let D=p.findOrCreateProcess(n,y);if("DONE"!==D.status)try{let t;if(D.txHash){const i=yield f(e,p,n,g.switchChainHook,this.allowUserInteraction);if(!i)return n.execution;e=i,t=yield(0,c.V)(e).getTransaction(D.txHash)}else{if(D=p.updateProcess(n,D.type,"STARTED"),yield(0,o.cr)(e,n),!n.transactionRequest){const t=yield(0,d.uE)(e,n),i=yield s.Z.getStepTransaction(t),o=yield((t,e,n,i,o)=>h(void 0,void 0,void 0,(function*(){var s;if((0,l.Y0)(e,n))return t.updateStepInRoute(n);const a=null!==(s=i.acceptExchangeRateUpdateHook)&&void 0!==s?s:i.acceptSlippageUpdateHook;let c;if(o&&(c=yield a({oldToAmount:e.estimate.toAmount,newToAmount:n.estimate.toAmount,toToken:n.action.toToken,oldSlippage:e.action.slippage,newSlippage:n.action.slippage})),!c)throw new r.qw(r.GL.TransactionCanceled,"Exchange rate has changed!","Transaction was not sent, your funds are still in your wallet.\n      The exchange rate has changed and the previous estimation can not be fulfilled due to value loss.");return t.updateStepInRoute(n)})))(p,t,i,g,this.allowUserInteraction);n=Object.assign(Object.assign({},o),{execution:n.execution})}const{transactionRequest:i}=n;if(!i)throw new r.qw(r.GL.TransactionUnprepared,"Unable to prepare transaction.");const a=yield f(e,p,n,g.switchChainHook,this.allowUserInteraction);if(!a)return n.execution;if(e=a,D=p.updateProcess(n,D.type,"ACTION_REQUIRED"),!this.allowUserInteraction)return n.execution;t=yield e.sendTransaction(i),D=p.updateProcess(n,D.type,"PENDING",{txHash:t.hash,txLink:v.metamask.blockExplorerUrls[0]+"tx/"+t.hash})}yield t.wait(),D=p.updateProcess(n,D.type,"PENDING",{txHash:t.hash,txLink:v.metamask.blockExplorerUrls[0]+"tx/"+t.hash}),m&&(D=p.updateProcess(n,D.type,"DONE"))}catch(O){if("TRANSACTION_REPLACED"!==O.code||!O.replacement){const t=yield(0,u.nU)(O,n,D);throw D=p.updateProcess(n,D.type,"FAILED",{error:{message:t.message,htmlMessage:t.htmlMessage,code:t.code}}),p.updateExecution(n,"FAILED"),t}D=p.updateProcess(n,D.type,"DONE",{txHash:O.replacement.hash,txLink:v.metamask.blockExplorerUrls[0]+"tx/"+O.replacement.hash})}const C=D.txHash;let T;m&&(D=p.findOrCreateProcess(n,"RECEIVING_CHAIN","PENDING"));try{if(!C)throw new Error("Transaction hash is undefined.");T=yield(0,l.O3)(C,p,D.type,n),D=p.updateProcess(n,D.type,"DONE",{substatus:T.substatus,substatusMessage:T.substatusMessage||(0,l.nY)(T.status,T.substatus),txHash:null===(t=T.receiving)||void 0===t?void 0:t.txHash,txLink:N.metamask.blockExplorerUrls[0]+"tx/"+(null===(E=T.receiving)||void 0===E?void 0:E.txHash)}),p.updateExecution(n,"DONE",{fromAmount:T.sending.amount,toAmount:null===(I=T.receiving)||void 0===I?void 0:I.amount,toToken:null===(x=T.receiving)||void 0===x?void 0:x.token,gasAmount:T.sending.gasAmount,gasAmountUSD:T.sending.gasAmountUSD,gasPrice:T.sending.gasPrice,gasToken:T.sending.gasToken,gasUsed:T.sending.gasUsed})}catch(O){throw D=p.updateProcess(n,D.type,"FAILED",{error:{code:r.GL.TransactionFailed,message:"Failed while waiting for receiving chain.",htmlMessage:(0,u.Xh)(n,D.txLink)}}),p.updateExecution(n,"FAILED"),console.warn(O),O}return n.execution}))}}}
1var I=function(t,e,n,i){return new(n||(n=Promise))((function(o,s){function a(t){try{c(i.next(t))}catch(e){s(e)}}function r(t){try{c(i.throw(t))}catch(e){s(e)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,r)}c((i=i.apply(t,e||[])).next())}))};const x={allowInteraction:!0,allowUpdates:!0,stopExecution:!1};class w{constructor(t,e){this.allowUserInteraction=!0,this.executionStopped=!1,this.setInteraction=t=>{const e=Object.assign(Object.assign({},x),t);this.allowUserInteraction=e.allowInteraction,this.executionManager.allowInteraction(e.allowInteraction),this.statusManager.allowUpdates(e.allowUpdates),this.executionStopped=e.stopExecution},this.checkChain=()=>{throw new Error("checkChain is not implemented.")},this.executeStep=(t,e)=>I(this,void 0,void 0,(function*(){const n=yield f(t,this.statusManager,e,this.settings.switchChainHook,this.allowUserInteraction);if(!n)return e;const i={signer:t=n,step:e,settings:this.settings,statusManager:this.statusManager};return yield this.executionManager.execute(i),e})),this.executionManager=new g,this.statusManager=t,this.settings=e}}},31242:(t,e,n)=>{n.d(e,{O3:()=>u,zy:()=>h,nY:()=>p,Y0:()=>f});var i=n(48626),o=n(59729),s=n(75720),a=n(37363),r=function(t,e,n,i){return new(n||(n=Promise))((function(o,s){function a(t){try{c(i.next(t))}catch(e){s(e)}}function r(t){try{c(i.throw(t))}catch(e){s(e)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,r)}c((i=i.apply(t,e||[])).next())}))};const c={};function u(t,e,n,i){return r(this,void 0,void 0,(function*(){const u=()=>new Promise(((s,a)=>r(this,void 0,void 0,(function*(){let r;try{r=yield o.Z.getStatus({bridge:i.tool,fromChain:i.action.fromChainId,toChain:i.action.toChainId,txHash:t})}catch(c){return console.debug("Fetching status from backend failed.",c),s(void 0)}switch(r.status){case"DONE":return s(r);case"PENDING":return null===e||void 0===e||e.updateProcess(i,n,"PENDING",Object.assign({substatus:r.substatus,substatusMessage:r.substatusMessage||p(r.status,r.substatus)},r.bridgeExplorerLink&&{txLink:r.bridgeExplorerLink})),s(void 0);case"NOT_FOUND":return s(void 0);default:return a()}}))));let d;if(t in c||(c[t]=(0,a.ku)(u,5e3)),d=yield c[t],!d.receiving)throw new s.nl("Status doesn't contain receiving information.");return d}))}const d={TOKEN_ALLOWANCE:{STARTED:"Setting token allowance.",PENDING:"Waiting for token allowance.",DONE:"Token allowance set."},SWITCH_CHAIN:{PENDING:"Chain switch required.",DONE:"Chain switched successfully."},SWAP:{STARTED:"Preparing swap transaction.",ACTION_REQUIRED:"Please sign the transaction.",PENDING:"Waiting for swap transaction.",DONE:"Swap completed."},CROSS_CHAIN:{STARTED:"Preparing bridge transaction.",ACTION_REQUIRED:"Please sign the transaction.",PENDING:"Waiting for bridge transaction.",DONE:"Bridge transaction confirmed."},RECEIVING_CHAIN:{PENDING:"Waiting for destination chain.",DONE:"Bridge completed."},TRANSACTION:{}},l={PENDING:{BRIDGE_NOT_AVAILABLE:"Bridge communication is temporarily unavailable.",CHAIN_NOT_AVAILABLE:"RPC communication is temporarily unavailable.",NOT_PROCESSABLE_REFUND_NEEDED:"The transfer cannot be completed successfully. A refund operation is required.",UNKNOWN_ERROR:"An unexpected error occurred. Please seek assistance in the LI.FI discord server.",WAIT_SOURCE_CONFIRMATIONS:"The bridge deposit has been received. The bridge is waiting for more confirmations to start the off-chain logic.",WAIT_DESTINATION_TRANSACTION:"The bridge off-chain logic is being executed. Wait for the transaction to appear on the destination chain."},DONE:{PARTIAL:"Some of the received tokens are not the requested destination tokens.",REFUNDED:"The tokens were refunded to the sender address.",COMPLETED:"The transfer is complete."},FAILED:{},INVALID:{},NOT_FOUND:{}};function h(t,e){return d[t][e]}function p(t,e){if(!e)return;return l[t][e]}function f(t,e){const n=new i.Z(t.action.slippage),o=new i.Z(t.estimate.toAmountMin),s=new i.Z(e.estimate.toAmountMin),a=o.minus(s).dividedBy(o);return s.gte(o)&&a.lte(n)}},73214:(t,e,n)=>{n.d(e,{xT:()=>o,n2:()=>s,$8:()=>a});n(14297);
1var i=function(t,e,n,i){return new(n||(n=Promise))((function(o,s){function a(t){try{c(i.next(t))}catch(e){s(e)}}function r(t){try{c(i.throw(t))}catch(e){s(e)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,r)}c((i=i.apply(t,e||[])).next())}))};const o=(t,e)=>Math.floor(Math.random()*(e-t+1)+t),s=(t,e)=>t.chainId===e.chainId&&t.address.toLowerCase()===e.address.toLowerCase();const a=(t,e,n)=>i(void 0,void 0,void 0,(function*(){}))},15224:(t,e,n)=>{n.d(e,{nl:()=>s.nl,ZP:()=>a,xT:()=>o.xT});var i=n(33360),o=(n(92222),n(73214)),s=(n(62079),n(75720));const a=i.Z}}]);

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.