@tokenflight/swap 0.2.3 → 0.3.0-rc.1

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.
Files changed (41) hide show
  1. package/dist/ReceiveComponent-Cyn4ECRG.js +1 -0
  2. package/dist/ReceiveComponent.module-BGpemTAX.js +1 -0
  3. package/dist/SwapComponent-BwfaI3D9.js +1 -0
  4. package/dist/active-bridge-V8lTJ2Js.js +1 -0
  5. package/dist/bridge-Bq0QUltI.js +1 -0
  6. package/dist/bridge.d.ts +613 -0
  7. package/dist/bridge.js +1 -0
  8. package/dist/custom-elements.d.ts +1 -27
  9. package/dist/defaults-loader-DfcaO9j5.js +1 -0
  10. package/dist/en-US-CU2aSy93.js +1 -0
  11. package/dist/errors-Nd9setTj.js +3 -0
  12. package/dist/iframe-entry.d.ts +21 -0
  13. package/dist/iframe-entry.js +29 -0
  14. package/dist/iframe-receiver-PfhKUIZW.js +1 -0
  15. package/dist/iframe.d.ts +422 -0
  16. package/dist/iframe.js +45 -0
  17. package/dist/ja-JP-BoipV6-j.js +1 -0
  18. package/dist/ko-KR-DyFXZJsF.js +1 -0
  19. package/dist/protocol-CDxgudrl.js +1 -0
  20. package/dist/rank-offers-CR-1NeiW.js +1 -0
  21. package/dist/register-defaults-C_q7CG7x.js +1 -0
  22. package/dist/register-widget-DOzDJD94.js +1 -0
  23. package/dist/shared.module-C-kWMzqW.js +1 -0
  24. package/dist/solid-iWr5Czxc.js +1 -0
  25. package/dist/swap.css +1 -1
  26. package/dist/theme-C9tsVWlo.js +2 -0
  27. package/dist/tokenflight-swap.d.ts +106 -308
  28. package/dist/tokenflight-swap.js +1 -2
  29. package/dist/tokenflight-swap.umd.cjs +5 -4
  30. package/dist/widget-BadYytj9.js +2 -0
  31. package/dist/widget.d.ts +267 -27
  32. package/dist/widget.js +1 -1
  33. package/dist/zh-CN-epCUm9Io.js +1 -0
  34. package/dist/zh-TW-DSEboEJV.js +1 -0
  35. package/package.json +14 -2
  36. package/dist/en-US-DJW-hZLc.js +0 -1
  37. package/dist/ja-JP-BU7auPz-.js +0 -1
  38. package/dist/ko-KR-BIXVqnQ_.js +0 -1
  39. package/dist/register-widget-CXGm8Ih3.js +0 -3
  40. package/dist/zh-CN-RuuHh9p5.js +0 -1
  41. package/dist/zh-TW-Ddf7Ck1N.js +0 -1
@@ -1,2 +1 @@
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 g,Q as ee,R as te,S as ne,T as _,U as v,V as y,W as b,X as re,Y as x,Z as ie,_ as S,_t as C,a as w,at as T,b as ae,bt as E,c as oe,ct as D,d as se,dt as O,et as ce,f as le,ft as k,g as ue,gt as de,h as fe,ht as pe,i as me,it as A,j as he,k as j,l as M,lt as N,m as P,mt as F,n as I,nt as L,o as R,ot as z,p as ge,pt as B,q as V,r as _e,rt as H,s as ve,st as U,t as W,tt as G,u as ye,ut as K,v as be,vt as q,w as xe,x as Se,y as Ce,yt as J,z as we}from"./register-widget-CXGm8Ih3.js";var Y=[xe,r,ne,Se,ae,Ce,be,S,ue,fe,P,ge,le,se,ye,M,oe,ve,R].join(`
2
- `),Te=n((e,t,n)=>C(_,{config:e,walletAdapter:t,callbacks:n}),()=>Y),Ee=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})}},X=x(`<style>`);function Z(e){e&&G(e),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-swap`)||I(`tokenflight-swap`,{"api-endpoint":``,"from-token":``,"to-token":``,recipient:``,"title-text":``,"title-image":``,theme:``,locale:``,"csp-nonce":``,"hide-title":!1,"hide-powered-by":!1,"hide-provider":!1,"no-background":!1,"no-border":!1},(e,{element:t})=>{let n={apiEndpoint:e[`api-endpoint`]||H()||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||k()||`light`,locale:e.locale||N()||`en-US`,hideTitle:L(t,e[`hide-title`],`hide-title`)?F(e[`hide-title`])??!1:D(),hidePoweredBy:L(t,e[`hide-powered-by`],`hide-powered-by`)?F(e[`hide-powered-by`])??!1:z(),hideProvider:L(t,e[`hide-provider`],`hide-provider`)?F(e[`hide-provider`])??!1:U(),noBackground:L(t,e[`no-background`],`no-background`)?F(e[`no-background`])??!1:K(),noBorder:L(t,e[`no-border`],`no-border`)?F(e[`no-border`])??!1:O()},r=e[`csp-nonce`]||void 0,[i,a]=J(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);E(s(e=>{a(e===v)}));let o=t.__customColors,l=q(()=>{let t=e.theme||k()||`light`,n=(t===`auto`?i():t===`dark`)?v:b,r=T();return`${Y}\n:host { ${c(r||o?{...n,...r,...o}:n)} }`}),f=t.__walletAdapter,p=t.__callbacks;return[(()=>{var e=X();return u(e,`nonce`,r),V(e,l),e})(),C(d,{client:y,get children(){return C(_,{config:n,get walletAdapter(){return f??B()},get callbacks(){return p?{...A(),...p}:A()}})}})]}))}var De=x(`<style>`);function Oe(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 ke(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function Ae(e){if(e)return e.map(e=>e===`wallet`?`crypto`:`card`)}function Q(e){e&&G(e),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-deposit`)||I(`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,"hide-provider":!1,"no-background":!1,"no-border":!1},(e,{element:t})=>{let n=ke(e.methods),r={apiEndpoint:e[`api-endpoint`]||H()||void 0,toToken:Oe(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:Ae(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||k()||`light`,locale:e.locale||N()||`en-US`,hideTitle:L(t,e[`hide-title`],`hide-title`)?F(e[`hide-title`])??!1:D(),hidePoweredBy:L(t,e[`hide-powered-by`],`hide-powered-by`)?F(e[`hide-powered-by`])??!1:z(),hideProvider:L(t,e[`hide-provider`],`hide-provider`)?F(e[`hide-provider`])??!1:U(),noBackground:L(t,e[`no-background`],`no-background`)?F(e[`no-background`])??!1:K(),noBorder:L(t,e[`no-border`],`no-border`)?F(e[`no-border`])??!1:O()},i=e[`csp-nonce`]||void 0,[a,o]=J(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);E(s(e=>{o(e===v)}));let l=t.__customColors,f=q(()=>{let t=e.theme||k()||`light`,n=(t===`auto`?a():t===`dark`)?v:b,r=T();return`${me}\n:host { ${c(r||l?{...n,...r,...l}:n)} }`}),p=t.__walletAdapter,m=t.__callbacks;return[(()=>{var e=De();return u(e,`nonce`,i),V(e,f),e})(),C(d,{client:y,get children(){return C(w,{config:r,get walletAdapter(){return p??B()},get callbacks(){return m?{...A(),...m}:A()}})}})]}))}function $(e={}){G(e),Z(),Q(),W()}typeof window<`u`&&$();export{ee as DEFAULT_API_ENDPOINT,ce as ErrorCode,Ee as MockWalletAdapter,t as SOLANA_CHAIN_ID,e as TERMINAL_FIAT_STATUSES,ie as TERMINAL_ORDER_STATUSES,re as TokenFlightError,Te as TokenFlightSwap,_e as TokenFlightWidget,o as addThousandsSeparator,a as buildOffersForRanking,j as clearTokenCache,l as computeExchangeRate,f as formatDisplayAmount,i as getBestOverallRouteId,he as getChainType,de as getDefaults,p as isCrossChainSwap,m as isEvmChain,g as isSolanaChain,h as rankOffers,Q as registerDepositElement,$ as registerElements,Z as registerSwapElement,W as registerWidgetElement,pe as setTextOverrides,te as toBaseUnits,we as toDisplayAmount};
1
+ import{t as e,x as t}from"./register-defaults-C_q7CG7x.js";import{a as n,c as r,l as i,r as a,t as o}from"./errors-Nd9setTj.js";import"./shared.module-C-kWMzqW.js";import{n as s,t as c}from"./register-widget-DOzDJD94.js";import"./widget-BadYytj9.js";import{_ as l,a as u,d,f,g as p,h as m,i as h,m as g,n as _,p as v,s as y,t as b,u as x,v as S}from"./rank-offers-CR-1NeiW.js";function C(){return typeof window>`u`?null:window.__tfMockWallet?.queuedActions?.shift()??null}var w=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){let t=C(),n=Number(t?.delayMs??1e3);return await new Promise(e=>setTimeout(e,Number.isFinite(n)&&n>0?n:0)),t?.success===!1?{success:!1,error:t.error??`User denied transaction signature.`}:{success:!0,txHash:t?.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})}};function T(t={}){e(t),c()}typeof window<`u`&&T();export{i as DEFAULT_API_ENDPOINT,o as ErrorCode,w as MockWalletAdapter,u as SOLANA_CHAIN_ID,a as TERMINAL_FIAT_STATUSES,n as TERMINAL_ORDER_STATUSES,r as TokenFlightError,s as TokenFlightWidget,v as addThousandsSeparator,b as buildOffersForRanking,S as clearTokenCache,g as computeExchangeRate,m as formatDisplayAmount,_ as getBestOverallRouteId,y as getChainType,x as isCrossChainSwap,d as isEvmChain,f as isSolanaChain,h as rankOffers,T as registerElements,c as registerWidgetElement,t as setTextOverrides,p as toBaseUnits,l as toDisplayAmount};