@tokenflight/swap 0.3.0-rc.4 → 0.3.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.
- package/dist/{ReceiveComponent-GQRMS7Qu.js → ReceiveComponent-CG4ZOm4X.js} +1 -1
- package/dist/SwapComponent-r6gFMQDK.js +1 -0
- package/dist/{bridge-YKE1uT8W.js → bridge-BaH05V0t.js} +1 -1
- package/dist/bridge.js +1 -1
- package/dist/{dist-D3Q09jyE.js → dist-7BXv_hiJ.js} +1 -1
- package/dist/{errors-wDO33e38.js → errors-BH9xS7WI.js} +1 -1
- package/dist/iframe-entry.js +1 -1
- package/dist/iframe.js +1 -1
- package/dist/{rank-offers-TMz0oVic.js → rank-offers-C1sqecwN.js} +1 -1
- package/dist/{register-widget-CzQlUUbW.js → register-widget-BNCrsb0V.js} +1 -1
- package/dist/tokenflight-swap.js +1 -1
- package/dist/tokenflight-swap.umd.cjs +3 -3
- package/dist/{usePageRouter-mTjOlNav.js → usePageRouter-C9px48pG.js} +1 -1
- package/dist/{widget-M3Wfb9U3.js → widget-DKrK3hCc.js} +1 -1
- package/dist/widget.js +1 -1
- package/package.json +2 -2
- package/dist/SwapComponent-B_mG9K4P.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,s as t}from"./dist-
|
|
1
|
+
import{r as e,s as t}from"./dist-7BXv_hiJ.js";import{t as n}from"./errors-BH9xS7WI.js";import{r}from"./shared.module-BORGC5lt.js";var i={ETH:[`ETH`,`WETH`],USDC:[`USDC`,`USDC.e`,`USDbC`],USDT:[`USDT`,`USDT.e`]},a={STABLES_MAJOR:[`USDT`,`USDC`,`USDE`,`DAI`,`USDS`,`USD1`,`BUIDL`,`USDF`,`USDTB`,`PYUSD`],STABLE_WRAPPED:[`USDE`,`SUSDE`,`USDS`,`SUSDS`,`DAI`,`SDAI`],BTC:[`BTC`,`WBTC`,`TBTC`,`CBBTC`,`BTC.B`,`CKBTC`],ETH_LST_LRT:[`ETH`,`WETH`,`STETH`,`WSTETH`,`RETH`,`CBETH`,`FRXETH`,`SFRXETH`,`OSETH`,`ETHX`,`METH`,`EETH`,`WEETH`,`EZETH`,`PUFETH`,`RSETH`,`WBETH`]},o=new Set([`BTC`,`ETH`,`WETH`,`WBTC`,`USDC`,`USDT`,`DAI`,`BNB`,`XRP`,`SOL`,`TRX`,`DOGE`,`ADA`,`BCH`,`HYPE`,`XMR`,`LEO`,`LINK`,`MATIC`,`AVAX`]),s=new Set([`USDC`,`USDT`,`DAI`,`USDE`,`USDS`,`USD1`,`USDF`,`USDG`,`RLUSD`,`USDD`,`BUSD`,`TUSD`,`USDP`,`FRAX`,`LUSD`,`GUSD`,`PYUSD`]),c=.1,l=new Set([1]),u=new Set([`0x0000000000000000000000000000000000000000`,`0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`,`11111111111111111111111111111111`]);function d(e){return e?u.has(e.toLowerCase()):!1}function f(e,t){let n=e.toUpperCase(),r=t.toUpperCase();if(n===r)return!0;for(let e of Object.values(i)){let t=e.some(e=>e.toUpperCase()===n),i=e.some(e=>e.toUpperCase()===r);if(t&&i)return!0}return!1}function p(e,t){let n=e.toUpperCase(),r=t.toUpperCase();for(let e of Object.values(a)){let t=e.some(e=>e.toUpperCase()===n),i=e.some(e=>e.toUpperCase()===r);if(t&&i)return!0}return!1}function m(e){return s.has(e.toUpperCase())}function h(e){return o.has(e.toUpperCase())}function g(e){return d(e)&&(e.startsWith(`0x`)||e.startsWith(`0X`))?`0x0000000000000000000000000000000000000000`:e.toLowerCase()}function _(e,t){return e.chainId===t.chainId&&g(e.address)===g(t.address)}function v(e){return`${e.chainId}:${g(e.address)}`}function y(e,t){return t?e.find(e=>_(e,t))??null:null}function b(e){let{defaultFromToken:t,balances:n,currentSelection:r,userPicked:i}=e;return!t||n.length===0||i||r&&_(r,t)?null:y(n,t)}var x=`tf:token:`,S=1440*60*1e3,C=200;function w(e,t,n){return[`tokenInfo`,n??`__default__`,e,t.toLowerCase()]}function T(e,t){return`${x}${e}:${t.toLowerCase()}`}function E(e,t,n){return r.getQueryData(w(e,t,n))??null}function D(e,t){r.setQueryData(w(e.chainId,e.address,t),e)}function O(e,t){try{let n=T(e,t),r=localStorage.getItem(n);if(!r)return null;let i=JSON.parse(r);return Date.now()-i.timestamp>S?(localStorage.removeItem(n),null):i.token}catch{return null}}function k(e){try{let t=T(e.chainId,e.address),n={token:e,timestamp:Date.now()};localStorage.setItem(t,JSON.stringify(n)),A()}catch{}}function A(){let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(x))try{let t=localStorage.getItem(n);if(t){let r=JSON.parse(t);e.push({key:n,timestamp:r.timestamp})}}catch{n&&localStorage.removeItem(n)}}if(e.length<=C)return;e.sort((e,t)=>e.timestamp-t.timestamp);let t=e.length-C;for(let n=0;n<t;n++)localStorage.removeItem(e[n].key)}function j(e,t){k(e),D(e,t)}function M(){try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(x)&&e.push(n)}for(let t of e)localStorage.removeItem(t)}catch{}}async function N(r,i,a,o){let s=(o?.baseUrl??a)?.replace(/\/$/,``),c=E(r,i,s);if(c)return c;let l=O(r,i);if(l)return D(l,s),l;let u=e=>({chainId:e.chainId??r,address:e.address??i,symbol:e.symbol,name:e.name,decimals:e.decimals,logoURI:e.logoURI,...Number.isFinite(Number(e.extensions?.price?.usd??``))?{priceUsd:Number(e.extensions?.price?.usd??``)}:{}}),d=e=>{let t=g(i);return e.find(e=>Number(e.chainId)===r&&g(e.address)===t)};if(o||a)try{let c=d((await(o??new e({baseUrl:a})).searchTokens(i,{chainIds:[r]})).data??[]);if(c){let e=u(c);return j(e,s),e}throw new t(n.INVALID_TOKEN_IDENTIFIER,`Token not found for chain ${r}: ${i}`)}catch(e){if(e instanceof t)throw e}return{chainId:r,address:i,decimals:void 0}}function P(e){let t=e.replace(/[^0-9.]/g,``),n=t.indexOf(`.`);return n===-1?t:t.slice(0,n+1)+t.slice(n+1).replace(/\./g,``)}function F(e,t){if(!e||t<0)return`0`;let n;try{n=(e.startsWith(`0x`),BigInt(e).toString())}catch{return`0`}let r=n.startsWith(`-`),i=r?n.slice(1):n;if(t===0)return r?`-${i}`:i;let a=i.padStart(t+1,`0`),o=a.slice(0,a.length-t),s=a.slice(a.length-t).replace(/0+$/,``),c=s?`${o}.${s}`:o;return r?`-${c}`:c}function I(e,t){if(!e||!/^-?(?:\d+(?:\.\d*)?|\.\d+)$/.test(e))return`0`;let n=e.startsWith(`-`),r=(n?e.slice(1):e).split(`.`),i=((r[0]??`0`)+(r[1]??``).slice(0,t).padEnd(t,`0`)).replace(/^0+/,``)||`0`;return n?`-${i}`:i}function L(e,t,n,r){if(!e||!n||e===`0`||t<0||r<0)return`0`;let i,a;try{i=BigInt(e),a=BigInt(n)}catch{return`0`}if(i===0n)return`0`;let o=10n**BigInt(8),s=(a*10n**BigInt(t)*o/(i*10n**BigInt(r))).toString().padStart(9,`0`),c=s.slice(0,s.length-8),l=s.slice(s.length-8).replace(/0+$/,``);return l?`${c}.${l}`:c}function R(e){let t=e.split(`.`),n=t[0]??`0`,r=n.startsWith(`-`),i=(r?n.slice(1):n).replace(/\B(?=(\d{3})+(?!\d))/g,`,`),a=r?`-${i}`:i;return t[1]===void 0?a:`${a}.${t[1]}`}function z(e,t=6){if(!e||e===`0`)return`0`;let n=e.split(`.`),r=n[0]??`0`;if(!n[1])return e;let i=n[1];if(r!==`0`&&r!==`-0`){let e=i.slice(0,t).replace(/0+$/,``);return e?`${r}.${e}`:r}let a=i.search(/[1-9]/);if(a===-1)return`0`;let o=a+t,s=i.slice(0,o).replace(/0+$/,``);return s?`${r}.${s}`:`0`}var B=20011e6;function V(e){return e===B}function H(e){return e!==B}function U(e){return V(e)?`solana`:`evm`}function W(e,t){return U(e)!==U(t)}function G(e){return V(e)?`11111111111111111111111111111111`:`0x0000000000000000000000000000000000000000`}function K(e,t){return t?.get(e)?.name??`Chain ${e}`}function q(e,t){return t===`evm`?/^0x[0-9a-fA-F]{40}$/.test(e):/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)}function J(e){return e?.includes(`1-click`)??!1}function Y(e){try{return e.startsWith(`0x`),BigInt(e)}catch{return null}}function X(e){let t=[];for(let n of e){let e=Y(n.quote.amountOut);e!==null&&t.push({routeId:n.routeId,amountOut:e,etaSeconds:Number.isFinite(n.quote.expectedDurationSeconds)?n.quote.expectedDurationSeconds:2**53-1,isGuaranteedOutput:!1,isOneClick:J(n.tags)})}return t}function Z(e,t){let n=[];for(let r of e){let e=Y(r.quote.amountIn);if(e===null)continue;let i=t===`EXACT_OUTPUT`&&r.exactOutMethod===`native`;n.push({routeId:r.routeId,amountIn:e,etaSeconds:Number.isFinite(r.quote.expectedDurationSeconds)?r.quote.expectedDurationSeconds:2**53-1,isGuaranteedOutput:i,isOneClick:J(r.tags)})}return n}function Q(e){if(e.length===0)return[];let t=e[0].amountOut;for(let n of e)n.amountOut>t&&(t=n.amountOut);let n=t*999n/1000n,r=[...e.filter(e=>e.amountOut>=n)].sort((e,t)=>{if(e.isGuaranteedOutput!==t.isGuaranteedOutput)return e.isGuaranteedOutput?-1:1;if(e.isOneClick!==t.isOneClick)return e.isOneClick?-1:1;let n=e.etaSeconds-t.etaSeconds;return n===0?t.amountOut>e.amountOut?1:t.amountOut<e.amountOut?-1:0:n}),i=new Set(r.map(e=>e.routeId)),a=e.filter(e=>!i.has(e.routeId)).sort((e,t)=>t.amountOut>e.amountOut?1:t.amountOut<e.amountOut?-1:0);return[...r.map(e=>e.routeId),...a.map(e=>e.routeId)]}function $(e){if(e.length===0)return[];let t=e[0].amountIn;for(let n of e)n.amountIn<t&&(t=n.amountIn);let n=t*1001n/1000n,r=[...e.filter(e=>e.amountIn<=n)].sort((e,t)=>{if(e.isGuaranteedOutput!==t.isGuaranteedOutput)return e.isGuaranteedOutput?-1:1;if(e.isOneClick!==t.isOneClick)return e.isOneClick?-1:1;let n=e.etaSeconds-t.etaSeconds;return n===0?e.amountIn>t.amountIn?1:e.amountIn<t.amountIn?-1:0:n}),i=new Set(r.map(e=>e.routeId)),a=e.filter(e=>!i.has(e.routeId)).sort((e,t)=>e.amountIn>t.amountIn?1:e.amountIn<t.amountIn?-1:0);return[...r.map(e=>e.routeId),...a.map(e=>e.routeId)]}function ee(e){return Q(X(e))[0]??null}function te(e,t){return $(Z(e,t))[0]??null}export{d as A,_ as C,c as D,l as E,m as M,f as O,y as S,v as T,I as _,B as a,j as b,G as c,H as d,V as f,P as g,z as h,$ as i,p as j,h as k,q as l,L as m,te as n,K as o,R as p,ee as r,U as s,Z as t,W as u,F as v,b as w,N as x,M as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,_ as t,m as n,u as r,v as i}from"./solid-DqvEpdeb.js";import{S as a,a as o,b as s,c,d as l,f as u,g as d,h as f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,s as b,t as x,u as S,v as C,y as ee}from"./register-defaults-BOb3wgfD.js";import{s as w}from"./dist-
|
|
1
|
+
import{S as e,_ as t,m as n,u as r,v as i}from"./solid-DqvEpdeb.js";import{S as a,a as o,b as s,c,d as l,f as u,g as d,h as f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,s as b,t as x,u as S,v as C,y as ee}from"./register-defaults-BOb3wgfD.js";import{s as w}from"./dist-7BXv_hiJ.js";import{a as T,i as E,n as D,r as O,t as k}from"./classPrivateFieldSet2-DmR3eaHe.js";import{t as A}from"./errors-BH9xS7WI.js";import{d as j,f as te,g as M,i as N,l as P,r as F}from"./shared.module-BORGC5lt.js";import{a as I,n as L,o as R,r as z,t as B}from"./theme-B6YtpkRW.js";import{n as V,t as H}from"./widget-DKrK3hCc.js";function ne(e){if(typeof e==`string`){let t=document.querySelector(e);if(!t)throw new w(A.ELEMENT_NOT_FOUND,`Element not found: ${e}`);return t}return e}function re(e,t){var n,i,a,o,s,c,l,u;return n=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakSet,class{constructor(e){T(this,u),E(this,n,null),E(this,i,null),E(this,a,void 0),E(this,o,null),E(this,s,void 0),E(this,c,void 0),E(this,l,void 0),k(a,this,ne(e.container)),k(s,this,e.config),k(c,this,e.walletAdapter),k(l,this,e.callbacks)}initialize(){D(n,this)&&this.destroy();let t=document.createElement(`div`);D(a,this).appendChild(t);let i=t.attachShadow({mode:`open`});k(o,this,i);let p=document.createElement(`style`),m=D(s,this).theme??`light`;O(u,this,d).call(this,p,m),i.appendChild(p),O(u,this,f).call(this,p);let h=document.createElement(`div`);i.appendChild(h),D(s,this).customColors&&B(t,D(s,this).customColors);let g=D(s,this),_=D(c,this),v=D(l,this);k(n,this,j(()=>r(N,{client:F,get children(){return e(g,_,v)}}),h))}destroy(){D(i,this)&&(D(i,this).call(this),k(i,this,null)),D(n,this)&&(D(n,this).call(this),k(n,this,null)),k(o,this,null),D(a,this).innerHTML=``}setTheme(e){k(s,this,{...D(s,this),theme:e});let t=D(o,this);if(t){let n=t.querySelector(`style`);n&&(O(u,this,d).call(this,n,e),O(u,this,f).call(this,n))}}setCustomColors(e){let t=D(o,this)?.host;t&&B(t,e)}};function d(e,n){let r=(n===`auto`?typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0:n===`dark`)?z:I;e.textContent=`${t()}\n:host { ${L(r)} }`}function f(e){D(i,this)&&(D(i,this).call(this),k(i,this,null)),D(s,this).theme===`auto`&&k(i,this,R(n=>{e.textContent=`${t()}\n:host { ${L(n)} }`}))}}var U=re((e,t,n)=>r(V,{config:e,walletAdapter:t,callbacks:n}),()=>H);function W(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return t[n]=Object.assign({},r),X(r.value)&&!ae(r.value)&&!Array.isArray(r.value)&&(t[n].value=Object.assign({},r.value)),Array.isArray(r.value)&&(t[n].value=r.value.slice(0)),t},{})}function G(e){return e?Object.keys(e).reduce((t,n)=>{let r=e[n];return t[n]=X(r)&&`value`in r?r:{value:r},t[n].attribute||(t[n].attribute=ie(n)),t[n].parse=`parse`in t[n]?t[n].parse:typeof t[n].value!=`string`,t},{}):{}}function K(e){return Object.keys(e).reduce((t,n)=>(t[n]=e[n].value,t),{})}function q(e,t){let n=W(t);return Object.keys(t).forEach(t=>{let r=n[t],i=e.getAttribute(r.attribute),a=e[t];i!=null&&(r.value=r.parse?J(i):i),a!=null&&(r.value=Array.isArray(a)?a.slice(0):a),r.reflect&&Y(e,r.attribute,r.value,!!r.parse),Object.defineProperty(e,t,{get(){return r.value},set(e){let n=r.value;r.value=e,r.reflect&&Y(this,r.attribute,r.value,!!r.parse);for(let r=0,i=this.__propertyChangedCallbacks.length;r<i;r++)this.__propertyChangedCallbacks[r](t,e,n)},enumerable:!0,configurable:!0})}),n}function J(e){if(e)try{return JSON.parse(e)}catch{return e}}function Y(e,t,n,r){if(n==null||n===!1)return e.removeAttribute(t);let i=r?JSON.stringify(n):n;e.__updating[t]=!0,i===`true`&&(i=``),e.setAttribute(t,i),Promise.resolve().then(()=>delete e.__updating[t])}function ie(e){return e.replace(/\.?([A-Z]+)/g,(e,t)=>`-`+t.toLowerCase()).replace(`_`,`-`).replace(/^-/,``)}function X(e){return e!=null&&(typeof e==`object`||typeof e==`function`)}function ae(e){return Object.prototype.toString.call(e)===`[object Function]`}function oe(e){return typeof e==`function`&&e.toString().indexOf(`class`)===0}var Z;function se(e,t){let n=Object.keys(t);return class extends e{static get observedAttributes(){return n.map(e=>t[e].attribute)}constructor(){super(),this.__initialized=!1,this.__released=!1,this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props={};for(let e of n)this[e]=void 0}connectedCallback(){if(this.__initialized)return;this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props=q(this,t);let e=K(this.props),n=this.Component,r=Z;try{Z=this,this.__initialized=!0,oe(n)?new n(e,{element:this}):n(e,{element:this})}finally{Z=r}}async disconnectedCallback(){if(await Promise.resolve(),this.isConnected)return;this.__propertyChangedCallbacks.length=0;let e=null;for(;e=this.__releaseCallbacks.pop();)e(this);delete this.__initialized,this.__released=!0}attributeChangedCallback(e,n,r){if(this.__initialized&&!this.__updating[e]&&(e=this.lookupProp(e),e in t)){if(r==null&&!this[e])return;this[e]=t[e].parse?J(r):r}}lookupProp(e){if(t)return n.find(n=>e===n||e===t[n].attribute)}get renderRoot(){return this.shadowRoot||this.attachShadow({mode:`open`})}addReleaseCallback(e){this.__releaseCallbacks.push(e)}addPropertyChangedCallback(e){this.__propertyChangedCallbacks.push(e)}}}function ce(e,t={},n={}){let{BaseElement:r=HTMLElement,extension:i,customElements:a=window.customElements}=n;return n=>{if(!e)throw Error(`tag is required to register a Component`);let o=a.get(e);return o?(o.prototype.Component=n,o):(o=se(r,G(t)),o.prototype.Component=n,o.prototype.registeredTag=e,a.define(e,o,i),o)}}function le(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let[a,o]=i(e[t[r]]);Object.defineProperty(n,t[r],{get:a,set(e){o(()=>e)}})}return n}function Q(e){if(e.assignedSlot&&e.assignedSlot._$owner)return e.assignedSlot._$owner;let t=e.parentNode;for(;t&&!t._$owner&&!(t.assignedSlot&&t.assignedSlot._$owner);)t=t.parentNode;return t&&t.assignedSlot?t.assignedSlot._$owner:e._$owner}function ue(e){return(n,r)=>{let{element:i}=r;return t(t=>{let a=le(n);i.addPropertyChangedCallback((e,t)=>a[e]=t),i.addReleaseCallback(()=>{i.renderRoot.textContent=``,t()});let o=e(a,r);return P(i.renderRoot,o)},Q(i))}}function de(e,t,n){return arguments.length===2&&(n=t,t={}),ce(e,t)(ue(n))}var fe=M(`<style>`);function pe(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 $(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function me(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function he(e){if(e)try{let t=JSON.parse(e.trim());if(typeof t==`object`&&t&&!Array.isArray(t)&&Object.values(t).every(e=>typeof e==`string`))return t}catch{}}function ge(e){return e===`hidden`||e===`visible`?e:void 0}function _e(t){t&&x(t),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-widget`)||de(`tokenflight-widget`,{"api-endpoint":``,"fiat-api-endpoint":``,"to-token":``,"from-token":``,"trade-type":``,amount:``,recipient:``,icon:``,"lock-from-token":!1,"lock-to-token":!1,"fiat-currency":``,methods:``,"default-pay-method":``,"from-tokens":``,"to-tokens":``,"title-text":``,"title-image":``,theme:``,locale:``,"csp-nonce":``,"hide-title":!1,"hide-powered-by":!1,"hide-provider":!1,"quote-card":``,"no-background":!1,"no-border":!1,"recipient-editable":!1,"refund-to":``,"rpc-overrides":``,referrer:``,"referrer-fee-bps":``},(t,{element:x})=>{let w={get apiEndpoint(){return t[`api-endpoint`]||y()||void 0},get fiatApiEndpoint(){return t[`fiat-api-endpoint`]||_()||void 0},get toToken(){return pe(t[`to-token`])},get fromToken(){return t[`from-token`]||void 0},get tradeType(){return t[`trade-type`]||void 0},get amount(){return t.amount||void 0},get recipient(){return t.recipient||void 0},get recipientEditable(){return s(t[`recipient-editable`])},get refundTo(){return t[`refund-to`]||void 0},get icon(){return t.icon||void 0},get lockFromToken(){return s(t[`lock-from-token`])},get lockToToken(){return s(t[`lock-to-token`])},get fiatCurrency(){return t[`fiat-currency`]||void 0},get methods(){return me(t.methods)??l()},get defaultPayMethod(){return t[`default-pay-method`]||void 0},get fromTokens(){return $(t[`from-tokens`])},get toTokens(){return $(t[`to-tokens`])},get titleText(){return t[`title-text`]||void 0},get titleImageUrl(){return t[`title-image`]||void 0},get theme(){return t.theme||C()||`light`},get locale(){return t.locale||S()||`en-US`},get hideTitle(){return g(x,t[`hide-title`],`hide-title`)?s(t[`hide-title`])??!1:m()},get hidePoweredBy(){return g(x,t[`hide-powered-by`],`hide-powered-by`)?s(t[`hide-powered-by`])??!1:b()},get hideProvider(){return g(x,t[`hide-provider`],`hide-provider`)?s(t[`hide-provider`])??!1:c()},get quoteCard(){return ge(t[`quote-card`])},get noBackground(){return g(x,t[`no-background`],`no-background`)?s(t[`no-background`])??!1:u()},get noBorder(){return g(x,t[`no-border`],`no-border`)?s(t[`no-border`])??!1:v()},get rpcOverrides(){return he(t[`rpc-overrides`])??d()},get referrer(){return T().referrer},get referrerFeeBps(){return T().referrerFeeBps}},T=()=>a(t.referrer||h(),t[`referrer-fee-bps`]===``?f():Number(t[`referrer-fee-bps`]),x),E=t[`csp-nonce`]||void 0,[D,O]=i(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);e(R(e=>{O(e===z)}));let k=x.__customColors,A=n(()=>{let e=t.theme||C()||`light`,n=(e===`auto`?D():e===`dark`)?z:I,r=o();return`${H}\n:host { ${L(r||k?{...n,...r,...k}:n)} }`}),j=x.__walletAdapter,M=x.__callbacks;return[(()=>{var e=fe();return te(e,`nonce`,E),P(e,A),e})(),r(N,{client:F,get children(){return r(V,{config:w,get walletAdapter(){return j??ee()},get callbacks(){return M?{...p(),...M}:p()}})}})]}))}export{U as n,_e as t};
|
package/dist/tokenflight-swap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e,x as t}from"./register-defaults-BOb3wgfD.js";import{i as n,l as r,n as i,s as a}from"./dist-
|
|
1
|
+
import{t as e,x as t}from"./register-defaults-BOb3wgfD.js";import{i as n,l as r,n as i,s as a}from"./dist-7BXv_hiJ.js";import{t as o}from"./errors-BH9xS7WI.js";import{n as s,t as c}from"./register-widget-BNCrsb0V.js";import{_ as l,a as u,d,f,h as p,i as m,m as h,n as g,p as _,s as v,t as y,u as b,v as x,y as S}from"./rank-offers-C1sqecwN.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{r as DEFAULT_API_ENDPOINT,o as ErrorCode,w as MockWalletAdapter,u as SOLANA_CHAIN_ID,i as TERMINAL_FIAT_STATUSES,n as TERMINAL_ORDER_STATUSES,a as TokenFlightError,s as TokenFlightWidget,_ as addThousandsSeparator,y as buildOffersForRanking,S as clearTokenCache,h as computeExchangeRate,p as formatDisplayAmount,g as getBestOverallRouteId,v as getChainType,b as isCrossChainSwap,d as isEvmChain,f as isSolanaChain,m as rankOffers,T as registerElements,c as registerWidgetElement,t as setTextOverrides,l as toBaseUnits,x as toDisplayAmount};
|