@tokenflight/swap 0.2.0-rc.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as ee,Q as te,R as ne,S as g,T as _,U as v,V as y,W as b,X as x,Y as S,Z as C,_ as w,a as T,at as E,b as D,c as re,ct as O,d as ie,dt as k,et as ae,f as oe,ft as A,g as se,h as ce,i as le,it as j,j as M,k as N,l as P,lt as F,m as I,mt as L,n as R,nt as z,o as B,ot as V,p as H,pt as U,q as W,r as ue,rt as G,s as de,st as K,t as q,tt as J,u as fe,ut as pe,v as me,w as he,x as ge,y as _e,z as Y}from"./register-widget-BBJXAjbv.js";var X=[he,r,g,ge,D,_e,me,w,se,ce,I,H,oe,ie,fe,P,re,de,B].join(`
1
+ import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as ee,Q as te,R as ne,S as g,T as _,U as v,V as y,W as b,X as x,Y as S,Z as C,_ as w,a as T,at as E,b as D,c as re,ct as O,d as ie,dt as k,et as ae,f as oe,ft as A,g as se,h as ce,i as le,it as j,j as M,k as N,l as P,lt as F,m as I,mt as L,n as R,nt as z,o as B,ot as V,p as H,pt as U,q as W,r as ue,rt as G,s as de,st as K,t as q,tt as J,u as fe,ut as pe,v as me,w as he,x as ge,y as _e,z as Y}from"./register-widget-BjfDwWgS.js";var X=[he,r,g,ge,D,_e,me,w,se,ce,I,H,oe,ie,fe,P,re,de,B].join(`
2
2
  `),ve=n((e,t,n)=>k(_,{config:e,walletAdapter:t,callbacks:n}),()=>X),ye=class{constructor(){this.name=`Mock Wallet`,this.icon=void 0,this.supportedActionTypes=[`eip1193_request`,`solana_signAndSendTransaction`],this.connected=!1,this.address=`0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045`,this.listeners=new Map}async connect(e){this.connected=!0,this.emit(`connect`,{address:this.address})}async disconnect(){this.connected=!1,this.emit(`disconnect`)}isConnected(e){return this.connected}async getAddress(e){return this.connected?this.address:null}async executeWalletAction(e){return await new Promise(e=>setTimeout(e,1e3)),{success:!0,txHash:`0x`+`a`.repeat(64)}}async signMessage(e){return`0x`+`b`.repeat(130)}async openAccountModal(){}on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e,t){let n=this.listeners.get(e);if(n)for(let r of n)r({type:e,data:t})}},be=S(`<style>`);function Z(e){e&&J(e),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-swap`)||R(`tokenflight-swap`,{"api-endpoint":``,"from-token":``,"to-token":``,recipient:``,"title-text":``,"title-image":``,theme:``,locale:``,"csp-nonce":``,"hide-title":!1,"hide-powered-by":!1,"no-background":!1,"no-border":!1},(e,{element:t})=>{let n={apiEndpoint:e[`api-endpoint`]||z()||void 0,fromToken:e[`from-token`]||void 0,toToken:e[`to-token`]||void 0,recipient:e.recipient||void 0,titleText:e[`title-text`]||void 0,titleImageUrl:e[`title-image`]||void 0,theme:e.theme||V()||`light`,locale:e.locale||E()||`en-US`,hideTitle:O(e[`hide-title`]),hidePoweredBy:O(e[`hide-powered-by`]),noBackground:O(e[`no-background`]),noBorder:O(e[`no-border`])},r=e[`csp-nonce`]||void 0,[i,a]=U(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);L(s(e=>{a(e===v)}));let o=t.__customColors,l=A(()=>{let t=e.theme||V()||`light`,n=(t===`auto`?i():t===`dark`)?v:b,r=j();return`${X}\n:host { ${c(r||o?{...n,...r,...o}:n)} }`}),f=t.__walletAdapter,p=t.__callbacks;return[(()=>{var e=be();return u(e,`nonce`,r),W(e,l),e})(),k(d,{client:y,get children(){return k(_,{config:n,get walletAdapter(){return f??K()},get callbacks(){return p?{...G(),...p}:G()}})}})]}))}var xe=S(`<style>`);function Se(e){if(!e)return``;let t=e.trim();if(t.startsWith(`[`))try{let e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return t}function Ce(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function we(e){if(e)return e.map(e=>e===`wallet`?`crypto`:`card`)}function Q(e){e&&J(e),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-deposit`)||R(`tokenflight-deposit`,{"api-endpoint":``,target:``,amount:``,"from-token":``,recipient:``,methods:``,"target-icon":``,"fiat-currency":``,"title-text":``,"title-image":``,theme:``,locale:``,"csp-nonce":``,"hide-title":!1,"hide-powered-by":!1,"no-background":!1,"no-border":!1},(e,{element:t})=>{let n=Ce(e.methods),r={apiEndpoint:e[`api-endpoint`]||z()||void 0,toToken:Se(e.target),fromToken:e[`from-token`]||void 0,tradeType:e.amount?`EXACT_OUTPUT`:`EXACT_INPUT`,amount:e.amount||void 0,recipient:e.recipient||void 0,methods:we(n),icon:e[`target-icon`]||void 0,fiatCurrency:e[`fiat-currency`]||void 0,titleText:e[`title-text`]||void 0,titleImageUrl:e[`title-image`]||void 0,theme:e.theme||V()||`light`,locale:e.locale||E()||`en-US`,hideTitle:O(e[`hide-title`]),hidePoweredBy:O(e[`hide-powered-by`]),noBackground:O(e[`no-background`]),noBorder:O(e[`no-border`])},i=e[`csp-nonce`]||void 0,[a,o]=U(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);L(s(e=>{o(e===v)}));let l=t.__customColors,f=A(()=>{let t=e.theme||V()||`light`,n=(t===`auto`?a():t===`dark`)?v:b,r=j();return`${le}\n:host { ${c(r||l?{...n,...r,...l}:n)} }`}),p=t.__walletAdapter,m=t.__callbacks;return[(()=>{var e=xe();return u(e,`nonce`,i),W(e,f),e})(),k(d,{client:y,get children(){return k(T,{config:r,get walletAdapter(){return p??K()},get callbacks(){return m?{...G(),...m}:G()}})}})]}))}function $(e={}){J(e),Z(),Q(),q()}typeof window<`u`&&$();export{te as DEFAULT_API_ENDPOINT,ae as ErrorCode,ye as MockWalletAdapter,t as SOLANA_CHAIN_ID,e as TERMINAL_FIAT_STATUSES,C as TERMINAL_ORDER_STATUSES,x as TokenFlightError,ve as TokenFlightSwap,ue as TokenFlightWidget,o as addThousandsSeparator,a as buildOffersForRanking,N as clearTokenCache,l as computeExchangeRate,f as formatDisplayAmount,i as getBestOverallRouteId,M as getChainType,pe as getDefaults,p as isCrossChainSwap,m as isEvmChain,ee as isSolanaChain,h as rankOffers,Q as registerDepositElement,$ as registerElements,Z as registerSwapElement,q as registerWidgetElement,F as setTextOverrides,ne as toBaseUnits,Y as toDisplayAmount};