@tokenflight/swap 0.3.0-rc.0 → 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.
- package/dist/ReceiveComponent-Cyn4ECRG.js +1 -0
- package/dist/ReceiveComponent.module-BGpemTAX.js +1 -0
- package/dist/SwapComponent-BwfaI3D9.js +1 -0
- package/dist/bridge-Bq0QUltI.js +1 -0
- package/dist/bridge.d.ts +17 -1
- package/dist/bridge.js +1 -1
- package/dist/custom-elements.d.ts +1 -27
- package/dist/defaults-loader-DfcaO9j5.js +1 -0
- package/dist/en-US-CU2aSy93.js +1 -0
- package/dist/errors-Nd9setTj.js +3 -0
- package/dist/iframe-entry.d.ts +21 -0
- package/dist/iframe-entry.js +29 -0
- package/dist/iframe-receiver-PfhKUIZW.js +1 -0
- package/dist/iframe.d.ts +78 -10
- package/dist/iframe.js +45 -1
- package/dist/ja-JP-BoipV6-j.js +1 -0
- package/dist/ko-KR-DyFXZJsF.js +1 -0
- package/dist/protocol-CDxgudrl.js +1 -0
- package/dist/rank-offers-CR-1NeiW.js +1 -0
- package/dist/register-defaults-C_q7CG7x.js +1 -0
- package/dist/register-widget-DOzDJD94.js +1 -0
- package/dist/shared.module-C-kWMzqW.js +1 -0
- package/dist/solid-iWr5Czxc.js +1 -0
- package/dist/swap.css +1 -1
- package/dist/theme-C9tsVWlo.js +2 -0
- package/dist/tokenflight-swap.d.ts +88 -250
- package/dist/tokenflight-swap.js +1 -2
- package/dist/tokenflight-swap.umd.cjs +5 -6
- package/dist/widget-BadYytj9.js +2 -0
- package/dist/widget.d.ts +307 -25
- package/dist/widget.js +1 -1
- package/dist/zh-CN-epCUm9Io.js +1 -0
- package/dist/zh-TW-DSEboEJV.js +1 -0
- package/package.json +6 -2
- package/dist/bridge-C9uFKAdS.js +0 -1
- package/dist/en-US-ChmhdVUe.js +0 -1
- package/dist/ja-JP-BAX9fLqV.js +0 -1
- package/dist/ko-KR-jwhmhUqJ.js +0 -1
- package/dist/register-defaults-lIJMUU-P.js +0 -1
- package/dist/register-widget-DQAzucnZ.js +0 -5
- package/dist/zh-CN-fKcRI4Y8.js +0 -1
- package/dist/zh-TW-gFEUAIR6.js +0 -1
- /package/dist/{active-bridge-DTyKObda.js → active-bridge-V8lTJ2Js.js} +0 -0
package/dist/bridge.d.ts
CHANGED
|
@@ -28,8 +28,13 @@ export declare interface BridgeEventMap {
|
|
|
28
28
|
export declare type BridgeEventName = keyof BridgeEventMap;
|
|
29
29
|
|
|
30
30
|
export declare interface BridgeOptions {
|
|
31
|
-
/** Mount point — CSS selector or HTMLElement.
|
|
31
|
+
/** Mount point — CSS selector or HTMLElement. Ignored when `iframe` is
|
|
32
|
+
* provided (the shell has already placed the iframe in its Shadow DOM). */
|
|
32
33
|
container: string | HTMLElement;
|
|
34
|
+
/** Existing iframe element to drive via postMessage. When provided, the
|
|
35
|
+
* bridge will not create its own iframe and will not touch the chrome —
|
|
36
|
+
* the host shell (`<tokenflight-iframe-widget>`) owns appearance. */
|
|
37
|
+
iframe?: HTMLIFrameElement;
|
|
33
38
|
/** Wallet adapter running on the host page. */
|
|
34
39
|
wallet?: IWalletAdapter;
|
|
35
40
|
/** Widget configuration. */
|
|
@@ -475,6 +480,9 @@ declare type Theme = "light" | "dark" | "auto";
|
|
|
475
480
|
*/
|
|
476
481
|
export declare class TokenFlightBridge {
|
|
477
482
|
readonly iframe: HTMLIFrameElement;
|
|
483
|
+
/** True when the iframe was handed in by the caller (shell) — bridge must
|
|
484
|
+
* not move or restyle it, and destroy() must not remove it. */
|
|
485
|
+
private readonly ownsIframe;
|
|
478
486
|
private readonly container;
|
|
479
487
|
private wallet;
|
|
480
488
|
private readonly options;
|
|
@@ -588,8 +596,16 @@ export declare interface WidgetConfig {
|
|
|
588
596
|
titleImageUrl?: string;
|
|
589
597
|
hideTitle?: boolean;
|
|
590
598
|
hidePoweredBy?: boolean;
|
|
599
|
+
hideProvider?: boolean;
|
|
600
|
+
quoteCard?: "hidden" | "visible";
|
|
591
601
|
noBackground?: boolean;
|
|
592
602
|
noBorder?: boolean;
|
|
603
|
+
recipientEditable?: boolean;
|
|
604
|
+
refundTo?: string;
|
|
605
|
+
icon?: string;
|
|
606
|
+
rpcOverrides?: Record<string, string>;
|
|
607
|
+
referrer?: string;
|
|
608
|
+
referrerFeeBps?: number;
|
|
593
609
|
lockFromToken?: boolean;
|
|
594
610
|
lockToToken?: boolean;
|
|
595
611
|
}
|
package/dist/bridge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./protocol-CDxgudrl.js";import{n as c,t as l}from"./bridge-Bq0QUltI.js";import{i as u,n as d,r as f,t as p}from"./iframe-receiver-PfhKUIZW.js";export{u as IframeBridgeWalletAdapter,p as IframeReceiver,t as TF_PROTOCOL_VERSION,l as TokenFlightBridge,s as consumeRequestId,r as createMessage,a as createRequestId,c as createTokenFlightBridge,n as deserializeError,d as getHostOrigin,f as isIframeMode,e as isMessageType,i as parseMessage,o as serializeError};
|
|
@@ -22,11 +22,7 @@
|
|
|
22
22
|
* to your component's `schemas` array. This import still registers the
|
|
23
23
|
* elements in `HTMLElementTagNameMap` for `document.querySelector()` etc.
|
|
24
24
|
*/
|
|
25
|
-
import type {
|
|
26
|
-
TokenFlightReceiveAttributes,
|
|
27
|
-
TokenFlightDepositAttributes,
|
|
28
|
-
TokenFlightWidgetAttributes,
|
|
29
|
-
} from "./index";
|
|
25
|
+
import type { TokenFlightWidgetAttributes } from "./index";
|
|
30
26
|
|
|
31
27
|
/**
|
|
32
28
|
* Standard HTML attributes common to all custom elements.
|
|
@@ -86,13 +82,9 @@ interface ReactHTMLAttributes {
|
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
/** Widget attributes + standard HTML attributes */
|
|
89
|
-
type ReceiveElementAttributes = TokenFlightReceiveAttributes & BaseHTMLAttributes;
|
|
90
|
-
type DepositElementAttributes = TokenFlightDepositAttributes & BaseHTMLAttributes;
|
|
91
85
|
type WidgetElementAttributes = TokenFlightWidgetAttributes & BaseHTMLAttributes;
|
|
92
86
|
|
|
93
87
|
/** With React/Preact camelCase aliases */
|
|
94
|
-
type ReceiveReactAttributes = ReceiveElementAttributes & ReactHTMLAttributes;
|
|
95
|
-
type DepositReactAttributes = DepositElementAttributes & ReactHTMLAttributes;
|
|
96
88
|
type WidgetReactAttributes = WidgetElementAttributes & ReactHTMLAttributes;
|
|
97
89
|
|
|
98
90
|
// ---------------------------------------------------------------------------
|
|
@@ -101,16 +93,12 @@ type WidgetReactAttributes = WidgetElementAttributes & ReactHTMLAttributes;
|
|
|
101
93
|
// ---------------------------------------------------------------------------
|
|
102
94
|
declare global {
|
|
103
95
|
interface HTMLElementTagNameMap {
|
|
104
|
-
"tokenflight-receive": HTMLElement;
|
|
105
|
-
"tokenflight-deposit": HTMLElement;
|
|
106
96
|
"tokenflight-widget": HTMLElement;
|
|
107
97
|
}
|
|
108
98
|
|
|
109
99
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
110
100
|
namespace svelteHTML {
|
|
111
101
|
interface IntrinsicElements {
|
|
112
|
-
"tokenflight-receive": ReceiveElementAttributes;
|
|
113
|
-
"tokenflight-deposit": DepositElementAttributes;
|
|
114
102
|
"tokenflight-widget": WidgetElementAttributes;
|
|
115
103
|
}
|
|
116
104
|
}
|
|
@@ -123,8 +111,6 @@ declare module "react/jsx-runtime" {
|
|
|
123
111
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
124
112
|
namespace JSX {
|
|
125
113
|
interface IntrinsicElements {
|
|
126
|
-
"tokenflight-receive": ReceiveReactAttributes;
|
|
127
|
-
"tokenflight-deposit": DepositReactAttributes;
|
|
128
114
|
"tokenflight-widget": WidgetReactAttributes;
|
|
129
115
|
}
|
|
130
116
|
}
|
|
@@ -137,8 +123,6 @@ declare module "react" {
|
|
|
137
123
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
138
124
|
namespace JSX {
|
|
139
125
|
interface IntrinsicElements {
|
|
140
|
-
"tokenflight-receive": ReceiveReactAttributes;
|
|
141
|
-
"tokenflight-deposit": DepositReactAttributes;
|
|
142
126
|
"tokenflight-widget": WidgetReactAttributes;
|
|
143
127
|
}
|
|
144
128
|
}
|
|
@@ -151,8 +135,6 @@ declare module "preact" {
|
|
|
151
135
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
152
136
|
namespace JSX {
|
|
153
137
|
interface IntrinsicElements {
|
|
154
|
-
"tokenflight-receive": ReceiveReactAttributes;
|
|
155
|
-
"tokenflight-deposit": DepositReactAttributes;
|
|
156
138
|
"tokenflight-widget": WidgetReactAttributes;
|
|
157
139
|
}
|
|
158
140
|
}
|
|
@@ -163,8 +145,6 @@ declare module "preact" {
|
|
|
163
145
|
// ---------------------------------------------------------------------------
|
|
164
146
|
declare module "vue" {
|
|
165
147
|
interface GlobalComponents {
|
|
166
|
-
"tokenflight-receive": ReceiveElementAttributes;
|
|
167
|
-
"tokenflight-deposit": DepositElementAttributes;
|
|
168
148
|
"tokenflight-widget": WidgetElementAttributes;
|
|
169
149
|
}
|
|
170
150
|
}
|
|
@@ -176,8 +156,6 @@ declare module "solid-js" {
|
|
|
176
156
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
177
157
|
namespace JSX {
|
|
178
158
|
interface IntrinsicElements {
|
|
179
|
-
"tokenflight-receive": ReceiveElementAttributes;
|
|
180
|
-
"tokenflight-deposit": DepositElementAttributes;
|
|
181
159
|
"tokenflight-widget": WidgetElementAttributes;
|
|
182
160
|
}
|
|
183
161
|
}
|
|
@@ -188,8 +166,6 @@ declare module "solid-js" {
|
|
|
188
166
|
// ---------------------------------------------------------------------------
|
|
189
167
|
declare module "svelte/elements" {
|
|
190
168
|
interface SvelteHTMLElements {
|
|
191
|
-
"tokenflight-receive": ReceiveElementAttributes;
|
|
192
|
-
"tokenflight-deposit": DepositElementAttributes;
|
|
193
169
|
"tokenflight-widget": WidgetElementAttributes;
|
|
194
170
|
}
|
|
195
171
|
}
|
|
@@ -199,8 +175,6 @@ declare module "svelte/elements" {
|
|
|
199
175
|
// ---------------------------------------------------------------------------
|
|
200
176
|
declare namespace astroHTML.JSX {
|
|
201
177
|
interface IntrinsicElements {
|
|
202
|
-
"tokenflight-receive": ReceiveElementAttributes;
|
|
203
|
-
"tokenflight-deposit": DepositElementAttributes;
|
|
204
178
|
"tokenflight-widget": WidgetElementAttributes;
|
|
205
179
|
}
|
|
206
180
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e;function t(t){return{lang:t?.lang??e?.lang,message:t?.message,abortEarly:t?.abortEarly??e?.abortEarly,abortPipeEarly:t?.abortPipeEarly??e?.abortPipeEarly}}var n;function r(e){return n?.get(e)}var i;function a(e){return i?.get(e)}var o;function s(e,t){return o?.get(e)?.get(t)}function c(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function l(e,t,n,i,o){let l=o&&`input`in o?o.input:n.value,u=o?.expected??e.expects??null,d=o?.received??c(l),f={kind:e.kind,type:e.type,input:l,expected:u,received:d,message:`Invalid ${t}: ${u?`Expected ${u} but r`:`R`}eceived ${d}`,requirement:e.requirement,path:o?.path,issues:o?.issues,lang:i.lang,abortEarly:i.abortEarly,abortPipeEarly:i.abortPipeEarly},p=e.kind===`schema`,m=o?.message??e.message??s(e.reference,f.lang)??(p?a(f.lang):null)??i.message??r(f.lang);m!==void 0&&(f.message=typeof m==`function`?m(f):m),p&&(n.typed=!1),n.issues?n.issues.push(f):n.issues=[f]}function u(e){return{version:1,vendor:`valibot`,validate(n){return e[`~run`]({value:n},t())}}}function d(e,t){return Object.hasOwn(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function f(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}function p(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function m(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function h(e,t){return{kind:`schema`,type:`array`,reference:h,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return u(this)},"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||(e.issues=a.issues),t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else l(this,`type`,e,t);return e}}}function g(e){return{kind:`schema`,type:`boolean`,reference:g,expects:`boolean`,async:!1,message:e,get"~standard"(){return u(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:l(this,`type`,e,t),e}}}function _(e){return{kind:`schema`,type:`number`,reference:_,expects:`number`,async:!1,message:e,get"~standard"(){return u(this)},"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:l(this,`type`,e,t),e}}}function v(e,t){return{kind:`schema`,type:`object`,reference:v,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return u(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:m(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=p(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(l(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}}else l(this,`type`,e,t);return e}}}function y(e,t){return{kind:`schema`,type:`optional`,reference:y,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return u(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=m(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function b(e,t){return{kind:`schema`,type:`picklist`,reference:b,expects:f(e.map(c),`|`),async:!1,options:e,message:t,get"~standard"(){return u(this)},"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:l(this,`type`,e,t),e}}}function x(e,t,n){return{kind:`schema`,type:`record`,reference:x,expects:`Object`,async:!1,key:e,value:t,message:n,get"~standard"(){return u(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in n)if(d(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||(e.issues=a.issues),t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}(!a.typed||!o.typed)&&(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else l(this,`type`,e,t);return e}}}function S(e){return{kind:`schema`,type:`string`,reference:S,expects:`string`,async:!1,message:e,get"~standard"(){return u(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:l(this,`type`,e,t),e}}}function C(e,t){let n={};for(let r in e.entries)n[r]=!t||t.includes(r)?y(e.entries[r]):e.entries[r];return{...e,entries:n,get"~standard"(){return u(this)}}}function w(e,n,r){let i=e[`~run`]({value:n},t(r));return{typed:i.typed,success:!i.issues,output:i.value,issues:i.issues}}var T=C(v({apiEndpoint:S(),fiatApiEndpoint:S(),theme:b([`light`,`dark`,`auto`]),locale:S(),customColors:x(S(),S()),hideTitle:g(),hidePoweredBy:g(),hideProvider:g(),noBackground:g(),noBorder:g(),methods:h(b([`crypto`,`card`])),supportedChainIds:h(_()),rpcOverrides:x(S(),S()),reownProjectId:S()})),E=`https://embed.tokenflight.ai/api/config/defaults.json`,D=5e3,O=null;function k(){return O||(typeof fetch==`function`?(O=(async()=>{let e=new AbortController,t=setTimeout(()=>e.abort(),D);try{let t=await fetch(E,{credentials:`omit`,signal:e.signal});if(!t.ok)return null;let n=w(T,await t.json());return n.success?n.output:null}catch{return null}finally{clearTimeout(t)}})(),O):(O=Promise.resolve(null),O))}export{k as loadDefaults};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=e=>`Pay ${e.amount}`,ee=`Waiting for confirmation...`,te=`View on Explorer`,t=`Delivery unsuccessful`,n=`Select Fiat Provider`,r=`Enter amount`,i=e=>`${e.count} more`,a=`Order expired`,o=e=>`Pay ${e.amount} via ${e.provider}`,s=`Copied`,c=`We'll find the best rate for you`,l=e=>`Continue via ${e.provider}`,u=`Try selecting a different chain or search for a specific token`,d=`Coming soon`,f=e=>`via ${e.provider}`,p=`Search results`,m=`Tokens delivered to your wallet`,h=`You pay`,g=`Your tokens have been delivered`,_=e=>`≈ $${e.formatUsd}`,v=`Recipient Address`,y=`Confirm`,b=`Connect your wallet to see payment options`,x=`No tokens found`,S=`Connect wallet or enter an address to get a quote`,C=`Confirm in your wallet...`,w=`Refund tx`,T=e=>`Buy ${e.amt} ${e.sym}`,E=`Exchange`,D=`Swapping via DEX...`,O=`Transaction failed — Retry`,k=`No filler accepted the order`,A=`Back`,ne=`Pay`,j=`Executing...`,M=`Select destination token`,N=e=>`Filled on ${e.chain}`,P=`Payment confirmed`,re=`Buy`,F=`Close`,I=`No offer available`,L=`Refund in progress`,R=e=>`Deposit on ${e.chain}`,z=`Route`,B=`Crypto`,V=`Signed in wallet`,H=`Order failed`,U=`Enter amount to get started`,W=`Recipient`,G=e=>`≈ $${e.addThousandsSeparator}`,K=`Buy with credit or debit card`,q=`View All Chains`,J=`Swap`,Y=`Sender`,X=`Processing your order...`,Z=`Select payment token`,Q=e=>`Via ${e.provider}`,ie=`Quote details`,ae=`Total fee`,oe=`Paid`,se=`Try Again`,ce=`Review Swap`,le=`Provider filling your order`,ue=`Swapping tokens`,$=`Your tokens`,de=e=>`Returning tokens on ${e.chain}`,fe=`Card`,pe=`Swap tokens`,me=`Copy error`,he=`Fiat payment`,ge=`Processing...`,_e=`Purchase failed`,ve=`New Purchase`,ye=`Pay with credit or debit card`,be=`Confirmed on-chain`,xe=`Sign in wallet`,Se=`From`,Ce=`Required to receive your tokens`,we=`MAX`,Te=`Fee`,Ee=`Could not be completed`,De=`Top tokens`,Oe=`Fill tx`,ke=e=>`Delivered in ${e.seconds}s`,Ae=`Pay with`,je=`Swap Successful`,Me=`Tokens delivered`,Ne=`Receive`,Pe=`Min`,Fe=`Search by name or address`,Ie=e=>`~${e.value}s`,Le=`0`,Re=`Provider`,ze=`Est. time`,Be=`Insufficient balance`,Ve=`Invalid address for this chain`,He=`Enter destination address`,Ue=`No tokens available`,We=`Max`,Ge=`Transfer tx`,Ke=`Confirm Swap`,qe=`This token is not directly available for card purchase. We buy USDC first, then swap it to your desired token automatically.`,Je=`Quote Failed`,Ye=e=>`Compare ${e.count} more providers`,Xe=e=>`Buy ${e.arg0} directly`,Ze=e=>`on ${e.chain}`,Qe=e=>`~${e.value}m`,$e=`No routes available`,et=`Tokens Landed!`,tt=`Awaiting payment`,nt=e=>`Routed through ${e.token} for the best rate`,rt=`New Swap`,it=`Enter recipient address`,at=`Wallet doesn't match source chain`,ot=`View`,st=`BEST RATE`,ct=`Your order could not be completed.`,lt=e=>`Delivering ${e.symbol} to your wallet...`,ut=`Your funds have been returned to your wallet.`,dt=`View quote details`,ft=`Signature submitted`,pt=`Deposit tx`,mt=`Connect Wallet`,ht=`Pay with tokens from your wallet`,gt=`You receive`,_t=`Purchase Complete`,vt=`Selected token is unavailable for this purchase`,yt=`Enter Recipient Address`,bt=`Recommended`,xt=`Wallet account`,St=e=>`Balance: ${e.fromBalance}`,Ct=`Purchase complete`,wt=`Retry`,Tt=`Select token`,Et={"10189s3":e,"10ioi7e":ee,"10v0i5g":te,"115lknq":t,"118a77s":n,"119fv83":r,"11k1vkl":i,"12rrl0i":a,"132vna6":o,"13bzcw5":s,"13i9oqu":c,"13l4n4r":l,"13x5i2v":u,"14ho4vt":d,"14j1lze":f,"15bw477":p,"1685rko":m,"17kq51m":h,"17wtaao":g,"188897k":_,"18cmny0":v,"18tbqwf":y,"18y1lrp":b,"19is1h8":x,"19ne1ha":S,"1bze7sg":C,"1c5n7ll":w,"1cei180":T,"1dyojgg":E,"1g8tdk7":D,"1hb73om":O,"1hdpo6q":k,"1hzmxtu":A,"1i7coq1":`Pay`,"1ih47b3":j,"1ix1b7w":M,"1ixbbo7":N,"1jhuo24":P,"1ka8utn":`Buy`,"1l0xxoj":F,"1ne9nkz":I,"1nhkl7x":L,"1nn0owb":R,"1nvxkfy":z,"1o1b4a8":B,"1o4ofyx":V,"1ok4m5g":H,"1olegnl":U,"1oncz6g":W,"1ovj1tk":G,"1q45kup":K,"1qbiehv":q,"1rkfalq":J,"1rnxx1g":Y,"1spu5st":X,"1t0r88u":Z,"1t86tnu":Q,"1tn6f91":ie,"1viukn9":ae,"1w0n607":oe,"1w68n16":se,"1x5xdes":ce,"1y28pgi":le,"1y6hn5o":ue,"1yijk6g":$,"27fhcv":de,"2b8ghr":fe,"2eikro":pe,"2mzna2":me,"2zh3gr":he,"344av8":ge,"3pklqf":_e,"3u5vqs":ve,"6c0jc7":ye,"6c5l2f":be,"6gkge0":xe,"6s9hn9":Se,"7m2ht3":Ce,"7v6g6x":`MAX`,"9l4mg3":`Fee`,"9p7amh":Ee,bdctly:De,bdo3n8:Oe,biwlqk:ke,cgzgvn:Ae,cjn1xs:je,cnwfg3:Me,cwk7r6:Ne,cx9lh3:`Min`,dizog6:Fe,ek03j3:Ie,epw9f3:`0`,evz7q4:Re,f45rwo:ze,fcy4ey:Be,fo0vw0:Ve,fpand1:He,g7pjpv:Ue,gtvgs9:`Max`,hzq69q:Ge,ibrnk6:Ke,ifug2i:qe,jf8ts4:Je,jmpbi6:Ye,jnzipx:Xe,k47stp:Ze,knrcsh:Qe,ln9xiv:$e,mnlddk:et,n9zkql:tt,ofi1rq:nt,pmqvh0:rt,pom1h2:it,q4mqcd:at,q5w460:ot,r7v9s7:st,rvctng:ct,sykid7:lt,t1rvqg:ut,tbygoy:dt,tgp8yw:ft,tjg3i3:pt,u61kge:mt,udneg1:ht,va18uh:gt,vum0cd:_t,wuxjl9:vt,wx5bee:yt,xel5qk:bt,xphk5n:xt,y6jqu9:St,yhtv6l:Ct,zkouah:wt,zz4mrw:Tt};export{Ke as _100907z,gt as _108j3sk,oe as _10lgc56,Y as _10n9ta8,h as _113vzpe,it as _11ncipg,B as _11p3b1r,$e as _12qyh2x,L as _13ym6k2,fe as _14oyo32,De as _15iyda3,S as _15vbpgm,s as _16j2pbi,qe as _16ln1wz,je as _16pzx0g,Ee as _16rump9,M as _17g2rjk,_ as _18346vt,re as _1982g2x,xt as _1biskvr,D as _1bjtgx1,Me as _1cmz8k7,ht as _1cpadi9,G as _1d7sodl,at as _1e023il,u as _1e5aqjt,R as _1ea99j0,te as _1f4czmp,be as _1f8nqa3,ce as _1f8umlr,W as _1fe46d3,Ce as _1fikhaa,rt as _1fu9qvd,E as _1g7ofg0,Ae as _1gfjrn0,ke as _1gma9hv,de as _1hs819x,ft as _1ht75o0,t as _1i8i0au,Ye as _1i9sfkh,F as _1ib6ekl,K as _1ievltk,st as _1in1gel,U as _1in9ocp,He as _1ju6xlj,T as _1jvje3y,Te as _1kd3yrp,A as _1kez60s,ue as _1krtsvx,nt as _1kvlpuf,ye as _1l1rqi2,J as _1l2nmmx,ne as _1lra4kg,dt as _1mmcyfz,vt as _1n1igys,O as _1na1vy4,me as _1nd7gbf,o as _1nwhws6,Ie as _1o0vi1j,Ge as _1o2h7a2,l as _1o8feo7,Ue as _1om32zr,w as _1oqs23j,wt as _1popw3r,ee as _1qamgmj,z as _1rggu8s,Qe as _1s54fdc,c as _1s9ryeq,xe as _1t3gki9,i as _1ulsa90,m as _1urf8wf,n as _1w2bswr,N as _1wwy4yj,e as _1wx2fw2,lt as _1y7hba4,x as _1yv1ajq,yt as _3mtvnb,Re as _3w8t28,Z as _41y3qp,q as _454sub,ot as _49235i,H as _4itr6p,V as _4opuqb,he as _5af8qp,y as _5r87wo,b as _78b61s,Se as _8edkty,Oe as _a5vz6z,Fe as _al7a0k,we as _bii6w9,Le as _cnghfj,j as _czpegb,pt as _d7bf51,Je as _doc1yy,I as _g3pfjv,tt as _gkmqsa,f as _hyiyqa,d as _i9ury1,v as _ide9vv,mt as _ig1w2,St as _jpt8np,ae as _kmeu9o,le as _kqdlbv,bt as _l5s0fl,Xe as _l78r94,$ as _l800fy,g as _ly147p,Ne as _mdvri5,X as _np8jou,a as _nrzzox,Ze as _o3um2w,P as _oj2fr8,_t as _p5ybee,k as _pqml54,_e as _pr6lte,ge as _q0rsrj,ut as _qm85b2,p as _r3yix2,C as _sf0mgy,Tt as _si8n6l,We as _swoaip,Ct as _t0vnn4,Q as _t91lwj,Ve as _ty2nen,ct as _u7tj7p,ze as _uc0jju,r as _uu4paz,et as _vogk37,ie as _wa8i8c,se as _xavgbs,pe as _xkdtbf,ve as _ystooe,Pe as _z6jr7i,Be as _zzusn5,Et as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{_ as e,b as t,v as n,x as r,y as i}from"./shared.module-C-kWMzqW.js";function a(e){"@babel/helpers - typeof";return a=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a(e)}function o(e,t){if(a(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(a(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function s(e){var t=o(e,`string`);return a(t)==`symbol`?t:t+``}function c(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=class extends Error{constructor(e,t,n){let r=`${e.status||e.status===0?e.status:``} ${e.statusText??``}`.trim(),i=r?`status code ${r}`:`an unknown error`;super(`Request failed with ${i}: ${t.method} ${t.url}`),c(this,`response`,void 0),c(this,`request`,void 0),c(this,`options`,void 0),this.name=`HTTPError`,this.response=e,this.request=t,this.options=n}},u=class extends Error{constructor(e){let t=`Non-error value was thrown`;try{typeof e==`string`?t=e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`&&(t=e.message)}catch{}super(t),c(this,`name`,`NonError`),c(this,`value`,void 0),this.value=e}},d=class extends Error{constructor(e){let t=e?.cause?e.cause instanceof Error?e.cause:new u(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:`Forced retry`,t?{cause:t}:void 0),c(this,`name`,`ForceRetryError`),c(this,`customDelay`,void 0),c(this,`code`,void 0),c(this,`customRequest`,void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}},f=(()=>{let e=!1,t=!1,n=typeof globalThis.ReadableStream==`function`,r=typeof globalThis.Request==`function`;if(n&&r)try{t=new globalThis.Request(`https://empty.invalid`,{body:new globalThis.ReadableStream,method:`POST`,get duplex(){return e=!0,`half`}}).headers.has(`Content-Type`)}catch(e){if(e instanceof Error&&e.message===`unsupported BodyInit type`)return!1;throw e}return e&&!t})(),p=typeof globalThis.AbortController==`function`,m=typeof globalThis.AbortSignal==`function`&&typeof globalThis.AbortSignal.any==`function`,h=typeof globalThis.ReadableStream==`function`,g=typeof globalThis.FormData==`function`,_=[`get`,`post`,`put`,`patch`,`head`,`delete`],ee={json:`application/json`,text:`text/*`,formData:`multipart/form-data`,arrayBuffer:`*/*`,blob:`*/*`,bytes:`*/*`},v=2147483647,te=new TextEncoder().encode(`------WebKitFormBoundaryaxpyiPgbbPti10Rw`).length,y=Symbol(`stop`),b=class{constructor(e){c(this,`options`,void 0),this.options=e}},ne=e=>new b(e),re={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},ie={next:!0},ae={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},oe=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[n,r]of e)t+=te,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${n}"`).length,t+=typeof r==`string`?new TextEncoder().encode(r).length:r.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e==`string`)return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if(`byteLength`in e)return e.byteLength;if(typeof e==`object`&&e)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},x=(e,t,n)=>{let r,i=0;return e.pipeThrough(new TransformStream({transform(e,a){if(a.enqueue(e),r){i+=r.byteLength;let e=t===0?0:i/t;e>=1&&(e=1-2**-52),n?.({percent:e,totalBytes:Math.max(t,i),transferredBytes:i},r)}r=e},flush(){r&&(i+=r.byteLength,n?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},r))}}))},se=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let n=Math.max(0,Number(e.headers.get(`content-length`))||0);return new Response(x(e.body,n,t),{status:e.status,statusText:e.statusText,headers:e.headers})},ce=(e,t,n)=>{if(!e.body)return e;let r=oe(n??e.body);return new Request(e,{duplex:`half`,body:x(e.body,r,t)})},S=e=>typeof e==`object`&&!!e,C=(...e)=>{for(let t of e)if((!S(t)||Array.isArray(t))&&t!==void 0)throw TypeError("The `options` argument must be an object");return D({},...e)},w=(e={},t={})=>{let n=new globalThis.Headers(e),r=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[e,t]of i.entries())r&&t===`undefined`||t===void 0?n.delete(e):n.set(e,t);return n};function T(e,t,n){return Object.hasOwn(t,n)&&t[n]===void 0?[]:D(e[n]??[],t[n]??[])}var E=(e={},t={})=>({beforeRequest:T(e,t,`beforeRequest`),beforeRetry:T(e,t,`beforeRetry`),afterResponse:T(e,t,`afterResponse`),beforeError:T(e,t,`beforeError`)}),le=(e,t)=>{let n=new URLSearchParams;for(let r of[e,t])if(r!==void 0)if(r instanceof URLSearchParams)for(let[e,t]of r.entries())n.append(e,t);else if(Array.isArray(r))for(let e of r){if(!Array.isArray(e)||e.length!==2)throw TypeError(`Array search parameters must be provided in [[key, value], ...] format`);n.append(String(e[0]),String(e[1]))}else if(S(r))for(let[e,t]of Object.entries(r))t!==void 0&&n.append(e,String(t));else{let e=new URLSearchParams(r);for(let[t,r]of e.entries())n.append(t,r)}return n},D=(...e)=>{let t={},n={},r={},i,a=[];for(let o of e)if(Array.isArray(o))Array.isArray(t)||(t=[]),t=[...t,...o];else if(S(o)){for(let[e,n]of Object.entries(o)){if(e===`signal`&&n instanceof globalThis.AbortSignal){a.push(n);continue}if(e===`context`){if(n!=null&&(!S(n)||Array.isArray(n)))throw TypeError("The `context` option must be an object");t={...t,context:n==null?{}:{...t.context,...n}};continue}if(e===`searchParams`){i=n==null?void 0:i===void 0?n:le(i,n);continue}S(n)&&e in t&&(n=D(t[e],n)),t={...t,[e]:n}}S(o.hooks)&&(r=E(r,o.hooks),t.hooks=r),S(o.headers)&&(n=w(n,o.headers),t.headers=n)}return i!==void 0&&(t.searchParams=i),a.length>0&&(a.length===1?t.signal=a[0]:m?t.signal=AbortSignal.any(a):t.signal=a.at(-1)),t},ue=e=>_.includes(e)?e.toUpperCase():e,O={limit:2,methods:[`get`,`put`,`head`,`delete`,`options`,`trace`],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:1/0,backoffLimit:1/0,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},de=(e={})=>{if(typeof e==`number`)return{...O,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error(`retry.methods must be an array`);if(e.methods&&(e.methods=e.methods.map(e=>e.toLowerCase())),e.statusCodes&&!Array.isArray(e.statusCodes))throw Error(`retry.statusCodes must be an array`);let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0));return{...O,...t}},k=class extends Error{constructor(e){super(`Request timed out: ${e.method} ${e.url}`),c(this,`request`,void 0),this.name=`TimeoutError`,this.request=e}};async function fe(e,t,n,r){return new Promise((i,a)=>{let o=setTimeout(()=>{n&&n.abort(),a(new k(e))},r.timeout);r.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function pe(e,{signal:t}){return new Promise((n,r)=>{t&&(t.throwIfAborted(),t.addEventListener(`abort`,i,{once:!0}));function i(){clearTimeout(a),r(t.reason)}let a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e)})}var me=(e,t)=>{let n={};for(let r in t)Object.hasOwn(t,r)&&!(r in ae)&&!(r in re)&&(!(r in e)||r in ie)&&(n[r]=t[r]);return n},he=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e==`object`?Object.keys(e).length>0:typeof e==`string`?e.trim().length>0:!!e;function ge(e){return e instanceof l||e?.name===l.name}function _e(e){return e instanceof k||e?.name===k.name}var A=new WeakMap,j=new WeakMap,M=new WeakMap,N=new WeakMap,P=new WeakMap,F=new WeakMap,I=new WeakMap,L=new WeakSet,R=class a{static create(e,t){let r=new a(e,t),o=i(L,r,U).call(r,async()=>{if(typeof n(N,r).timeout==`number`&&n(N,r).timeout>2147483647)throw RangeError(`The \`timeout\` option cannot be greater than ${v}`);await Promise.resolve();let e=await i(L,r,be).call(r);for(let t of n(N,r).hooks.afterResponse){let a=i(L,r,B).call(r,e.clone()),o;try{o=await t(r.request,i(L,r,W).call(r),a,{retryCount:n(j,r)})}catch(t){throw i(L,r,H).call(r,a),i(L,r,H).call(r,e),t}if(o instanceof b)throw i(L,r,H).call(r,a),i(L,r,H).call(r,e),new d(o.options);let s=o instanceof globalThis.Response?o:e;a!==s&&i(L,r,H).call(r,a),e!==s&&i(L,r,H).call(r,e),e=s}if(i(L,r,B).call(r,e),!e.ok&&(typeof n(N,r).throwHttpErrors==`function`?n(N,r).throwHttpErrors(e.status):n(N,r).throwHttpErrors)){let t=new l(e,r.request,i(L,r,W).call(r));for(let e of n(N,r).hooks.beforeError)t=await e(t,{retryCount:n(j,r)});throw t}if(n(N,r).onDownloadProgress){if(typeof n(N,r).onDownloadProgress!=`function`)throw TypeError("The `onDownloadProgress` option must be a function");if(!h)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let t=e.clone();return i(L,r,H).call(r,e),se(t,n(N,r).onDownloadProgress)}return e}).finally(()=>{let e=n(P,r);i(L,r,V).call(r,e?.body??void 0),i(L,r,V).call(r,r.request.body??void 0)});for(let[e,n]of Object.entries(ee))e===`bytes`&&typeof globalThis.Response?.prototype?.bytes!=`function`||(o[e]=async()=>{r.request.headers.set(`accept`,r.request.headers.get(`accept`)||n);let i=await o;if(e===`json`){if(i.status===204)return``;let e=await i.text();return e===``?``:t.parseJson?t.parseJson(e):JSON.parse(e)}return i[e]()});return o}constructor(o,s={}){if(r(this,L),c(this,`request`,void 0),t(this,A,void 0),t(this,j,0),t(this,M,void 0),t(this,N,void 0),t(this,P,void 0),t(this,F,void 0),t(this,I,void 0),e(M,this,o),e(N,this,{...s,headers:w(n(M,this).headers,s.headers),hooks:E({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},s.hooks),method:ue(s.method??n(M,this).method??`GET`),prefixUrl:String(s.prefixUrl||``),retry:de(s.retry),throwHttpErrors:s.throwHttpErrors??!0,timeout:s.timeout??1e4,fetch:s.fetch??globalThis.fetch.bind(globalThis),context:s.context??{}}),typeof n(M,this)!=`string`&&!(n(M,this)instanceof URL||n(M,this)instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(n(N,this).prefixUrl&&typeof n(M,this)==`string`){if(n(M,this).startsWith(`/`))throw Error("`input` must not begin with a slash when using `prefixUrl`");n(N,this).prefixUrl.endsWith(`/`)||(n(N,this).prefixUrl+=`/`),e(M,this,n(N,this).prefixUrl+n(M,this))}p&&m&&(e(F,this,n(N,this).signal??n(M,this).signal),e(A,this,new globalThis.AbortController),n(N,this).signal=n(F,this)?AbortSignal.any([n(F,this),n(A,this).signal]):n(A,this).signal),f&&(n(N,this).duplex=`half`),n(N,this).json!==void 0&&(n(N,this).body=n(N,this).stringifyJson?.(n(N,this).json)??JSON.stringify(n(N,this).json),n(N,this).headers.set(`content-type`,n(N,this).headers.get(`content-type`)??`application/json`));let l=s.headers&&new globalThis.Headers(s.headers).has(`content-type`);if(n(M,this)instanceof globalThis.Request&&(g&&n(N,this).body instanceof globalThis.FormData||n(N,this).body instanceof URLSearchParams)&&!l&&n(N,this).headers.delete(`content-type`),this.request=new globalThis.Request(n(M,this),n(N,this)),he(n(N,this).searchParams)){let e=`?`+(typeof n(N,this).searchParams==`string`?n(N,this).searchParams.replace(/^\?/,``):new URLSearchParams(ve.call(a,n(N,this).searchParams)).toString()),t=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,e);this.request=new globalThis.Request(t,n(N,this))}if(n(N,this).onUploadProgress){if(typeof n(N,this).onUploadProgress!=`function`)throw TypeError("The `onUploadProgress` option must be a function");if(!f)throw Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=i(L,this,K).call(this,this.request,n(N,this).body??void 0)}}};function ve(e){return e&&typeof e==`object`&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)):e}function z(){let e=n(N,this).retry.delay(n(j,this)),t=e;n(N,this).retry.jitter===!0?t=Math.random()*e:typeof n(N,this).retry.jitter==`function`&&(t=n(N,this).retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e));let r=n(N,this).retry.backoffLimit??1/0;return Math.min(r,t)}async function ye(t){var r;if(e(j,this,(r=n(j,this),r++,r)),n(j,this)>n(N,this).retry.limit)throw t;let a=t instanceof Error?t:new u(t);if(a instanceof d)return a.customDelay??i(L,this,z).call(this);if(!n(N,this).retry.methods.includes(this.request.method.toLowerCase()))throw t;if(n(N,this).retry.shouldRetry!==void 0){let e=await n(N,this).retry.shouldRetry({error:a,retryCount:n(j,this)});if(e===!1)throw t;if(e===!0)return i(L,this,z).call(this)}if(_e(t)&&!n(N,this).retry.retryOnTimeout)throw t;if(ge(t)){if(!n(N,this).retry.statusCodes.includes(t.response.status))throw t;let e=t.response.headers.get(`Retry-After`)??t.response.headers.get(`RateLimit-Reset`)??t.response.headers.get(`X-RateLimit-Retry-After`)??t.response.headers.get(`X-RateLimit-Reset`)??t.response.headers.get(`X-Rate-Limit-Reset`);if(e&&n(N,this).retry.afterStatusCodes.includes(t.response.status)){let t=Number(e)*1e3;Number.isNaN(t)?t=Date.parse(e)-Date.now():t>=Date.parse(`2024-01-01`)&&(t-=Date.now());let r=n(N,this).retry.maxRetryAfter??t;return t<r?t:r}if(t.response.status===413)throw t}return i(L,this,z).call(this)}function B(e){return n(N,this).parseJson&&(e.json=async()=>n(N,this).parseJson(await e.text())),e}function V(e){e&&e.cancel().catch(()=>void 0)}function H(e){i(L,this,V).call(this,e.body??void 0)}async function U(e){try{return await e()}catch(t){let r=Math.min(await i(L,this,ye).call(this,t),v);if(n(j,this)<1)throw t;if(await pe(r,n(F,this)?{signal:n(F,this)}:{}),t instanceof d&&t.customRequest){let e=n(N,this).signal?new globalThis.Request(t.customRequest,{signal:n(N,this).signal}):new globalThis.Request(t.customRequest);i(L,this,G).call(this,e)}for(let e of n(N,this).hooks.beforeRetry){let r=await e({request:this.request,options:i(L,this,W).call(this),error:t,retryCount:n(j,this)});if(r instanceof globalThis.Request){i(L,this,G).call(this,r);break}if(r instanceof globalThis.Response)return r;if(r===y)return}return i(L,this,U).call(this,e)}}async function be(){n(A,this)?.signal.aborted&&(e(A,this,new globalThis.AbortController),n(N,this).signal=n(F,this)?AbortSignal.any([n(F,this),n(A,this).signal]):n(A,this).signal,this.request=new globalThis.Request(this.request,{signal:n(N,this).signal}));for(let e of n(N,this).hooks.beforeRequest){let t=await e(this.request,i(L,this,W).call(this),{retryCount:n(j,this)});if(t instanceof Response)return t;if(t instanceof globalThis.Request){i(L,this,G).call(this,t);break}}let t=me(this.request,n(N,this));return e(P,this,this.request),this.request=n(P,this).clone(),n(N,this).timeout===!1?n(N,this).fetch(n(P,this),t):fe(n(P,this),t,n(A,this),n(N,this))}function W(){if(!n(I,this)){let{hooks:t,...r}=n(N,this);e(I,this,Object.freeze(r))}return n(I,this)}function G(t){e(I,this,void 0),this.request=i(L,this,K).call(this,t)}function K(e,t){return!n(N,this).onUploadProgress||!e.body?e:ce(e,n(N,this).onUploadProgress,t??n(N,this).body??void 0)}var q=e=>{let t=(t,n)=>R.create(t,C(e,n));for(let n of _)t[n]=(t,r)=>R.create(t,C(e,r,{method:n}));return t.create=e=>q(C(e)),t.extend=t=>(typeof t==`function`&&(t=t(e??{})),q(C(e,t))),t.stop=y,t.retry=ne,t},xe=q(),J={API_REQUEST_FAILED:`TF3001`,API_TIMEOUT:`TF3002`,API_INVALID_RESPONSE:`TF3003`,QUOTE_FAILED:`TF3004`,QUOTE_EXPIRED:`TF3005`,DEPOSIT_BUILD_FAILED:`TF3006`,DEPOSIT_SUBMIT_FAILED:`TF3007`,ORDER_FAILED:`TF3008`,API_ABORTED:`TF3009`,FIAT_QUOTE_FAILED:`TF6001`,FIAT_ORDER_FAILED:`TF6002`,FIAT_STATUS_FAILED:`TF6003`,FIAT_PROVIDER_ERROR:`TF6004`,FIAT_AMOUNT_OUT_OF_RANGE:`TF6005`,FIAT_POPUP_BLOCKED:`TF6006`,FIAT_CHECKOUT_UNAVAILABLE:`TF6007`},Y={[J.API_REQUEST_FAILED]:`API request failed`,[J.API_TIMEOUT]:`API request timed out`,[J.API_INVALID_RESPONSE]:`Invalid API response`,[J.QUOTE_FAILED]:`Failed to get quote`,[J.QUOTE_EXPIRED]:`Quote has expired`,[J.DEPOSIT_BUILD_FAILED]:`Failed to build deposit transaction`,[J.DEPOSIT_SUBMIT_FAILED]:`Failed to submit deposit`,[J.ORDER_FAILED]:`Order processing failed`,[J.API_ABORTED]:`Request was aborted`,[J.FIAT_QUOTE_FAILED]:`Failed to get fiat quote`,[J.FIAT_ORDER_FAILED]:`Failed to create fiat order`,[J.FIAT_STATUS_FAILED]:`Failed to get fiat order status`,[J.FIAT_PROVIDER_ERROR]:`Fiat provider error`,[J.FIAT_AMOUNT_OUT_OF_RANGE]:`Fiat amount is out of range`,[J.FIAT_POPUP_BLOCKED]:`Payment popup was blocked by the browser`,[J.FIAT_CHECKOUT_UNAVAILABLE]:`Fiat checkout requires a browser window`},X=class extends Error{constructor(e,t,n){let r=typeof t==`string`?t:t instanceof Error||typeof t==`object`&&t&&`message`in t&&typeof t.message==`string`?t.message:Y[e]??`Unknown error`;super(r),this.name=`TokenFlightError`,this.code=e,this.details=n}},Se=class extends X{constructor(e,t){super(J.API_TIMEOUT,e,t),this.name=`ApiTimeoutError`}},Z=class extends X{constructor(e,t){super(J.API_ABORTED,e,t),this.name=`ApiAbortedError`}},Q=class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`ApiValidationError`}},Ce={ValidationException:Q,ZodValidationException:Q,BadRequestException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`BadRequestError`}},QuoteNotFoundException:class extends X{constructor(e,t){super(J.QUOTE_FAILED,e,t),this.name=`QuoteNotFoundError`}},QuoteExpiredException:class extends X{constructor(e,t){super(J.QUOTE_EXPIRED,e,t),this.name=`QuoteExpiredError`}},CannotFillException:class extends X{constructor(e,t){super(J.QUOTE_FAILED,e,t),this.name=`CannotFillError`}},NotSupportedTokenException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`NotSupportedTokenError`}},NotSupportedChainException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`NotSupportedChainError`}},NotSupportedDepositMethodException:class extends X{constructor(e,t){super(J.DEPOSIT_BUILD_FAILED,e,t),this.name=`NotSupportedDepositMethodError`}},UnexpectedFromAddressException:class extends X{constructor(e,t){super(J.DEPOSIT_BUILD_FAILED,e,t),this.name=`UnexpectedFromAddressError`}},IntentNotFoundException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`IntentNotFoundError`}},DuplicateRecordException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`DuplicateRecordError`}},BroadcastException:class extends X{constructor(e,t){super(J.DEPOSIT_SUBMIT_FAILED,e,t),this.name=`BroadcastError`}},InternalErrorException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`InternalServerError`}}};function we(e,t,n){if(typeof e==`object`&&e){let r=e,i=typeof r.name==`string`?r.name:null,a=typeof r.message==`string`?r.message:t;if(i&&Ce[i]){let t=Ce[i];return new t(a,n??e)}return new X(J.API_REQUEST_FAILED,a,n??e)}return new X(J.API_REQUEST_FAILED,t,n)}function Te(e){return xe.create({prefixUrl:e.baseUrl,timeout:e.timeout??15e3,retry:0,...e.fetch?{fetch:e.fetch}:{},headers:{"X-TF-SDK-Version":De(),...e.headers}})}function Ee(e){return e.replace(/\/$/,``)}function De(){return`0.3.0-rc.1`}async function Oe(e,t){try{return await e}catch(e){if(e instanceof X)throw e;if(e instanceof k)throw new Se(t.timeoutMessage,e);if(e instanceof DOMException&&e.name===`AbortError`)throw new Z(`Request was aborted`,e);if(e instanceof l){let n=``;try{n=await e.response.json()}catch{n=await e.response.text().catch(()=>``)}let r=`${t.failureMessage}: ${e.response.status} ${e.response.statusText}`;throw we(n,r,{status:e.response.status,body:n})}throw new X(J.API_REQUEST_FAILED,`${t.failureMessage}: ${String(e)}`,e)}}async function*ke(e){if(!e.ok){let t=``;try{t=await e.json()}catch{t=await e.text().catch(()=>``)}throw we(t,`API request failed: ${e.status} ${e.statusText}`,{status:e.status,body:t})}if(!e.body)throw new X(J.API_INVALID_RESPONSE,`Streaming response has no body`);let t=e.body.getReader(),n=new TextDecoder(`utf-8`),r=``;try{for(;;){let{value:e,done:i}=await t.read();e&&(r+=n.decode(e,{stream:!0}));let a=r.indexOf(`
|
|
2
|
+
`);for(;a!==-1;){let e=r.slice(0,a).trim();r=r.slice(a+1),e&&(yield Ae(e)),a=r.indexOf(`
|
|
3
|
+
`)}if(i){let e=r.trim();e&&(yield Ae(e));return}}}finally{t.releaseLock()}}function Ae(e){try{return JSON.parse(e)}catch(t){throw new X(J.API_INVALID_RESPONSE,`Failed to parse NDJSON frame: ${String(t)}`,{line:e})}}var je=`https://api.hyperstream.dev`,Me=2e3,Ne=500,Pe=5e3,Fe=class{constructor(e){this.baseUrl=Ee(e.baseUrl),this.ky=Te({baseUrl:this.baseUrl,timeout:e.timeout,fetch:e.fetch,headers:e.headers}),this.fetchImpl=e.fetch??globalThis.fetch.bind(globalThis),this.extraHeaders=e.headers??{}}request(e){return Oe(e,{timeoutMessage:`API request timed out`,failureMessage:`API request failed`})}getQuotes(e,t){return this.request(this.ky.post(`v1/quotes`,{json:e,signal:t?.signal}).json())}async*streamQuotes(e,t){yield*ke(await this.fetchImpl(`${this.baseUrl}/v1/quotes?mode=stream`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-TF-SDK-Version":De(),...this.extraHeaders},body:JSON.stringify(e),signal:t?.signal}))}buildDeposit(e,t){return this.request(this.ky.post(`v1/deposit/build`,{json:e,signal:t?.signal}).json())}submitDeposit(e,t){return this.request(this.ky.put(`v1/deposit/submit`,{json:e,signal:t?.signal}).json())}getOrdersByAddress(e,t){let n={};return t?.orderIds?.length&&(n.orderIds=t.orderIds.join(`,`)),t?.limit&&(n.limit=t.limit.toString()),t?.cursor&&(n.cursor=t.cursor.toString()),this.request(this.ky.get(`v1/orders/${e}`,{searchParams:n,signal:t?.signal}).json())}async getOrderById(e,t,n){return(await this.getOrdersByAddress(e,{orderIds:[t],signal:n?.signal})).data[0]??null}getOrder(e,t){return this.request(this.ky.get(`v1/orders/by-id/${e}`,{signal:t?.signal}).json())}trackOrder(e,t={}){let n=Math.max(Ne,t.intervalMs??Me);return new Promise((r,i)=>{let a=!1,o=null,s=()=>{o&&(clearTimeout(o),o=null),t.signal&&t.signal.removeEventListener(`abort`,c)},c=()=>{a||(a=!0,s(),i(new Z(`Order tracking was aborted`)))};if(t.signal){if(t.signal.aborted){c();return}t.signal.addEventListener(`abort`,c)}let l=async()=>{if(!a)try{let i=await this.getOrder(e,{signal:t.signal});if(a)return;if(t.onStatus?.(i),Ie.includes(i.status)){a=!0,s(),r(i);return}o=setTimeout(l,n)}catch(e){if(a)return;if(e instanceof Z){a=!0,s(),i(e);return}o=setTimeout(l,Pe)}};l()})}getTokens(e){let t={};return e?.q&&(t.q=e.q),e?.chainIds?.length&&(t.chainIds=e.chainIds.join(`,`)),e?.limit&&(t.limit=e.limit.toString()),e?.cursor&&(t.cursor=e.cursor.toString()),this.request(this.ky.get(`v1/tokens`,{searchParams:t,signal:e?.signal}).json())}searchTokens(e,t){let n={q:e};return t?.chainIds?.length&&(n.chainIds=t.chainIds.join(`,`)),this.request(this.ky.get(`v1/tokens/search`,{searchParams:n,signal:t?.signal}).json())}getTopTokens(e){let t={};return e?.chainIds?.length&&(t.chainIds=e.chainIds.join(`,`)),this.request(this.ky.get(`v1/tokens/top`,{searchParams:t,signal:e?.signal}).json())}getTokenBalances(e,t){let n={};return t?.chainIds?.length&&(n.chainIds=t.chainIds.join(`,`)),this.request(this.ky.get(`v1/tokens/balances/${e}`,{searchParams:n,signal:t?.signal}).json())}getTokenAutocomplete(e,t){let n={};return t?.chainIds?.length&&(n.chainIds=t.chainIds.join(`,`)),t?.limit&&(n.limit=t.limit.toString()),this.request(this.ky.get(`v1/tokens/autocomplete/${encodeURIComponent(e)}`,{searchParams:n,signal:t?.signal}).json())}getTokenAutocompleteSuggestions(e){return this.request(this.ky.get(`v1/tokens/autocomplete/suggestions`,{signal:e?.signal}).json())}getChains(e){return this.request(this.ky.get(`v1/chains`,{signal:e?.signal}).json())}getArcadiaConfig(e){return this.request(this.ky.get(`v1/config/arcadia`,{signal:e?.signal}).json())}getVaults(e){return this.request(this.ky.get(`v1/vaults`,{signal:e?.signal}).json())}getMTokens(e){return this.request(this.ky.get(`v1/mtokens`,{signal:e?.signal}).json())}getIntent(e,t){return this.request(this.ky.get(`v1/intent/${e}`,{signal:t?.signal}).json())}getIntentByDeposit(e,t){return this.request(this.ky.get(`v1/intent/deposit`,{searchParams:{chainId:e.chainId.toString(),txHash:e.txHash},signal:t?.signal}).json())}getIntentsByAuthor(e,t){let n={};return t?.limit&&(n.limit=t.limit.toString()),t?.cursor&&(n.cursor=t.cursor.toString()),t?.fromChainId&&(n.fromChainId=t.fromChainId.toString()),t?.toChainId&&(n.toChainId=t.toChainId.toString()),this.request(this.ky.get(`v1/intents/${e}`,{searchParams:n,signal:t?.signal}).json())}},Ie=[`filled`,`refunded`,`failed`],Le=500,Re=700,ze=2e3,Be=500,Ve=5e3;function He(e,t){let n=typeof window.outerWidth==`number`?window.outerWidth:0,r=typeof window.outerHeight==`number`?window.outerHeight:0,i=typeof window.screenX==`number`?window.screenX:0,a=typeof window.screenY==`number`?window.screenY:0,o=n>0?n:screen.width,s=r>0?r:screen.height,c=n>0?i:0,l=r>0?a:0;return`width=${e},height=${t},left=${Math.max(0,Math.round(c+(o-e)/2))},top=${Math.max(0,Math.round(l+(s-t)/2))}`}function Ue(e){return e===`completed`?`completed`:e===`canceled`?`canceled`:`failed`}function We(e,t,n={}){if(typeof window>`u`)return Promise.reject(new X(J.FIAT_CHECKOUT_UNAVAILABLE,`Fiat checkout requires a browser window`));let r=n.popup?.width??Le,i=n.popup?.height??Re,a=n.minPollIntervalMs??ze,o=window.open(t.wrapperUrl,`tf-fiat-${t.orderId}`,He(r,i));if(!o||o.closed)return Promise.reject(new X(J.FIAT_POPUP_BLOCKED,`Payment popup was blocked by the browser`));let s;try{s=new URL(e.baseUrl).origin}catch{return o.close(),Promise.reject(new X(J.FIAT_CHECKOUT_UNAVAILABLE,`Fiat API base URL is malformed`))}return new Promise((r,i)=>{let c=!1,l=!1,u=null,d=null,f=()=>{window.removeEventListener(`message`,m),u&&(clearTimeout(u),u=null),d&&(clearInterval(d),d=null),n.signal&&n.signal.removeEventListener(`abort`,h)},p=async n=>{if(!c){c=!0,f();try{let i=await e.getStatus(t.orderId);o.closed||o.close(),r({orderId:t.orderId,finalStatus:i,outcome:n})}catch(e){o.closed||o.close(),i(e)}}},m=e=>{if(e.origin!==s)return;let r=e.data;if(!(!r||typeof r!=`object`||r.type!==`FIAT_WIDGET_EVENT`)&&!(r.orderId&&r.orderId!==t.orderId))switch(n.onEvent?.(r),r.event){case`widget_ready`:l=!0;break;case`order_completed`:p(`completed`);break;case`order_failed`:l&&p(`failed`);break;case`widget_close`:break}},h=()=>{o.closed||o.close(),p(`canceled`)};if(window.addEventListener(`message`,m),n.signal){if(n.signal.aborted){h();return}n.signal.addEventListener(`abort`,h)}d=setInterval(()=>{o.closed&&!c&&p(`canceled`)},Be);let g=async()=>{if(!c)try{let r=await e.getStatus(t.orderId);if(c)return;if(n.onStatus?.(r),r.polling.isTerminal){p(Ue(r.status));return}let i=Math.max(a,r.polling.suggestedIntervalMs);u=setTimeout(g,i)}catch{c||(u=setTimeout(g,Ve))}};g()})}var Ge=`https://fiat.hyperstream.dev`,Ke=class{constructor(e){this.baseUrl=Ee(e.baseUrl),this.ky=Te({baseUrl:this.baseUrl,timeout:e.timeout,fetch:e.fetch,headers:e.headers})}request(e){return Oe(e,{timeoutMessage:`Fiat API request timed out`,failureMessage:`Fiat API request failed`})}getProviders(e){return this.request(this.ky.get(`v1/fiat/providers`,{signal:e?.signal}).json())}getQuote(e,t){return this.request(this.ky.post(`v1/fiat/quote`,{json:e,signal:t?.signal}).json())}createOrder(e,t){return this.request(this.ky.post(`v1/fiat/order`,{json:e,signal:t?.signal}).json())}getStatus(e,t){let n=t?.force?{force:`1`}:void 0;return this.request(this.ky.get(`v1/fiat/status/${e}`,{signal:t?.signal,searchParams:n}).json())}startCheckout(e,t){return We(this,e,t)}getOrdersByAddress(e,t){let n={};return t?.status&&(n.status=t.status),t?.limit&&(n.limit=t.limit.toString()),t?.cursor&&(n.cursor=t.cursor.toString()),this.request(this.ky.get(`v1/fiat/orders/${e}`,{searchParams:n,signal:t?.signal}).json())}};function qe(e,t){if(e)return`${e.replace(/\/$/,``)}/v1/chain/${t}/icon`}var Je=new Set([`completed`,`failed`,`canceled`]),$={...J,INVALID_CONFIG:`TF1001`,INVALID_TOKEN_IDENTIFIER:`TF1002`,INVALID_AMOUNT:`TF1003`,WALLET_CONNECTION_FAILED:`TF2002`,WALLET_ACTION_FAILED:`TF2003`,TRANSACTION_FAILED:`TF4001`,ELEMENT_NOT_FOUND:`TF5001`},Ye={[$.INVALID_CONFIG]:`Invalid configuration provided`,[$.INVALID_TOKEN_IDENTIFIER]:`Invalid token identifier format`,[$.INVALID_AMOUNT]:`Invalid amount value`,[$.WALLET_CONNECTION_FAILED]:`Failed to connect wallet`,[$.WALLET_ACTION_FAILED]:`Wallet action failed`,[$.TRANSACTION_FAILED]:`Transaction failed`,[$.ELEMENT_NOT_FOUND]:`Target DOM element not found`};({...Y,...Ye});export{Ie as a,X as c,Fe as i,je as l,qe as n,Ge as o,Je as r,Ke as s,$ as t,c as u};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/solid-query';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Mount the iframe receiver app into a target element. Establishes a
|
|
5
|
+
* postMessage bridge with the host page, applies theme/customColors to
|
|
6
|
+
* `<html>`, and renders `<WidgetComponent>` bound to the bridge wallet
|
|
7
|
+
* adapter.
|
|
8
|
+
*
|
|
9
|
+
* Returns a cleanup function that disposes the Solid root and tears down
|
|
10
|
+
* the receiver.
|
|
11
|
+
*/
|
|
12
|
+
export declare function mountIframeReceiver(options?: MountIframeReceiverOptions): () => void;
|
|
13
|
+
|
|
14
|
+
export declare interface MountIframeReceiverOptions {
|
|
15
|
+
/** Mount target — CSS selector or HTMLElement. Default: `#root`. */
|
|
16
|
+
target?: HTMLElement | string;
|
|
17
|
+
/** Optional QueryClient override (uses the package singleton if omitted). */
|
|
18
|
+
queryClient?: QueryClient;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{S as e,m as t,o as n,p as r,u as i,v as a}from"./solid-iWr5Czxc.js";import{h as o,l as s,n as c,r as l,u}from"./shared.module-C-kWMzqW.js";import{i as d,o as f,r as p,t as m}from"./theme-C9tsVWlo.js";import{n as h,t as g}from"./widget-BadYytj9.js";import{n as _,r as v,t as y}from"./iframe-receiver-PfhKUIZW.js";function b(e=document){return e.querySelector(`[data-widget-root="stable"]`)??e.querySelector(`[part="container"]`)}function x(e,t=document){let n=()=>{let n=b(t);return n?(e.observeResize(n),!0):!1};if(n())return;let r=new MutationObserver(()=>{n()&&r.disconnect()});r.observe(document.body,{childList:!0,subtree:!0})}var S=o(`<div style="position:fixed;top:12px;left:50%;transform:translateX(-50%);z-index:9999;padding:6px 12px;border-radius:999px;background:color-mix(in srgb, var(--tf-primary) 15%, transparent);color:var(--tf-primary);border:1px solid color-mix(in srgb, var(--tf-primary) 35%, transparent);font-family:'DM Sans', sans-serif;font-size:11px;font-weight:600;letter-spacing:0.03em;user-select:none;pointer-events:none">Standalone preview · embed via <tokenflight-iframe-widget>`),C=o(`<div style="color:#95a8c4;font-family:'DM Sans', sans-serif;font-size:13px;text-align:center;padding-top:60px">Waiting for host bridge…`);function w(e={}){if(typeof window>`u`)return()=>{};E(),D();let t=T(e.target);if(!t)return()=>{};let n=e.queryClient??c,r=u(()=>i(P,{queryClient:n}),t);return()=>r()}function T(e){return typeof e==`string`?document.querySelector(e):e||document.getElementById(`root`)}function E(){if(!g||document.querySelector(`style[data-tokenflight-widget]`))return;let e=document.createElement(`style`);e.setAttribute(`data-tokenflight-widget`,``),e.textContent=g,document.head.appendChild(e)}function D(){if(document.querySelector(`style[data-tokenflight-flat]`))return;let e=document.createElement(`style`);e.setAttribute(`data-tokenflight-flat`,``),e.textContent=`
|
|
2
|
+
html, body {
|
|
3
|
+
margin: 0;
|
|
4
|
+
padding: 0;
|
|
5
|
+
background: transparent;
|
|
6
|
+
}
|
|
7
|
+
[part="container"] {
|
|
8
|
+
width: 100% !important;
|
|
9
|
+
max-width: none !important;
|
|
10
|
+
min-width: 0 !important;
|
|
11
|
+
border: none !important;
|
|
12
|
+
border-radius: 0 !important;
|
|
13
|
+
box-shadow: none !important;
|
|
14
|
+
background: transparent !important;
|
|
15
|
+
}
|
|
16
|
+
`,document.head.appendChild(e)}function O(){if(document.querySelector(`style[data-tokenflight-standalone-fill]`))return;let e=document.createElement(`style`);e.setAttribute(`data-tokenflight-standalone-fill`,``),e.textContent=`
|
|
17
|
+
html, body {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
}
|
|
22
|
+
#root {
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
}
|
|
26
|
+
[part="container"] {
|
|
27
|
+
height: 100dvh !important;
|
|
28
|
+
}
|
|
29
|
+
`,document.head.appendChild(e)}function k(e){x(e)}function A(){let e={};if(typeof location>`u`)return e;let t=new URLSearchParams(location.search),n=e=>t.get(e)??void 0;n(`api-endpoint`)&&(e.apiEndpoint=n(`api-endpoint`)),n(`fiat-api-endpoint`)&&(e.fiatApiEndpoint=n(`fiat-api-endpoint`));let r=n(`theme`);(r===`dark`||r===`light`||r===`auto`)&&(e.theme=r),n(`locale`)&&(e.locale=n(`locale`)),n(`from-token`)&&(e.fromToken=n(`from-token`)),n(`to-token`)&&(e.toToken=n(`to-token`));let i=n(`trade-type`);(i===`EXACT_INPUT`||i===`EXACT_OUTPUT`)&&(e.tradeType=i);let a=n(`quote-card`);(a===`hidden`||a===`visible`)&&(e.quoteCard=a),n(`amount`)&&(e.amount=n(`amount`)),n(`recipient`)&&(e.recipient=n(`recipient`));let o=n(`methods`);return o&&(e.methods=o.split(`,`).map(e=>e.trim())),n(`title-text`)&&(e.titleText=n(`title-text`)),t.has(`hide-title`)&&(e.hideTitle=!0),t.has(`hide-powered-by`)&&(e.hidePoweredBy=!0),e}function j(){return S()}function M(e){if(!e)return;let t=document.documentElement;for(let[n,r]of Object.entries(e))n.startsWith(`--`)&&t.style.setProperty(n,r)}function N(e){let t=document.documentElement;for(let[n,r]of Object.entries(e))t.style.setProperty(n,r)}function P(o){let[c,u]=a(null),[g,b]=a(null),[x,S]=a(!1),w=t(()=>{let e=g();if(e)return{onSwapSuccess:t=>e.emitEvent(`swapComplete`,t),onDepositSuccess:t=>e.emitEvent(`swapComplete`,t),onSwapError:t=>e.emitEvent(`error`,t),onDepositError:t=>e.emitEvent(`error`,t),onFiatOrderCreated:t=>e.emitEvent(`fiatOrderCreated`,t),onFiatOrderCompleted:t=>e.emitEvent(`fiatOrderCompleted`,t)}});queueMicrotask(()=>{if(!v()){O(),S(!0),u(A());return}let e=_();if(!e)return;let t=new y(e,{onInit:(e,t)=>{u(e),M(t?.vars)},onConfigUpdate:e=>{u({...c()??{},...e})},onStyleUpdate:e=>{M(e.vars)}});b(t),k(t)}),e(()=>g()?.destroy());let T=null;r(()=>{let e=c();if(!e)return;let t=e.theme??`light`;N(d(t)),e.customColors&&m(document.documentElement,e.customColors),document.body.className=t===`dark`?`dark`:`light`,T?.(),T=null,t===`auto`&&(T=f(t=>{N(t),e.customColors&&m(document.documentElement,e.customColors),document.body.className=t===p?`dark`:`light`}))}),e(()=>T?.());let E=t(()=>c()||null);return i(l,{get client(){return o.queryClient},get children(){return[s(()=>s(()=>!!x())()?i(j,{}):null),i(n,{get when(){return E()},get fallback(){return C()},children:e=>i(h,{get config(){return e()},get walletAdapter(){return g()?.walletAdapter},get callbacks(){return w()}})})]}})}export{w as mountIframeReceiver};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i}from"./protocol-CDxgudrl.js";import{n as a}from"./active-bridge-V8lTJ2Js.js";var o=12e4,s=6e4,c=class{constructor(t){this.name=`IframeBridge`,this.supportedActionTypes=[`eip1193_request`,`solana_signTransaction`,`solana_signAndSendTransaction`],this.connected=!1,this.address=null,this.lastWalletSeq=0,this.eventListeners=new Map,this.pendingRequests=new Map,this.pendingConnect=null,this.pendingDisconnect=null,this.destroyed=!1,this.handleMessage=t=>{if(this.destroyed||t.origin!==this.hostOrigin)return;let n=r(t.data);n&&(e(n,`tf:walletState`)?this.handleWalletState(n.payload,n.seq):e(n,`tf:signResult`)&&this.handleSignResult(n.payload.requestId,n.payload.result,n.payload.error))},this.hostOrigin=t,window.addEventListener(`message`,this.handleMessage)}async connect(e){return this.postToHost(n(`connectWallet`,{chainType:e})),new Promise((e,t)=>{this.pendingConnect={resolve:e,reject:t},setTimeout(()=>{this.pendingConnect&&(this.pendingConnect.reject(Error(`Wallet connection timed out`)),this.pendingConnect=null)},s)})}async disconnect(){return this.postToHost(n(`disconnectWallet`,{})),new Promise((e,t)=>{this.pendingDisconnect={resolve:e,reject:t},setTimeout(()=>{this.pendingDisconnect&&(this.pendingDisconnect.reject(Error(`Wallet disconnect timed out`)),this.pendingDisconnect=null)},s)})}isConnected(e){return this.connected}async getAddress(e){return this.address}async executeWalletAction(e){let t=i();return new Promise((r,i)=>{let a=setTimeout(()=>{this.pendingRequests.delete(t),i(Error(`Wallet action timed out`))},o);this.pendingRequests.set(t,{resolve:r,reject:i,timer:a}),this.postToHost(n(`signRequest`,{requestId:t,action:e}))})}on(e,t){let n=this.eventListeners.get(e);n||(n=new Set,this.eventListeners.set(e,n)),n.add(t)}off(e,t){this.eventListeners.get(e)?.delete(t)}destroy(){if(!this.destroyed){this.destroyed=!0,window.removeEventListener(`message`,this.handleMessage);for(let[,e]of this.pendingRequests)clearTimeout(e.timer),e.reject(Error(`Bridge destroyed`));this.pendingRequests.clear(),this.pendingConnect&&(this.pendingConnect.reject(Error(`Bridge destroyed`)),this.pendingConnect=null),this.pendingDisconnect&&(this.pendingDisconnect.reject(Error(`Bridge destroyed`)),this.pendingDisconnect=null),this.eventListeners.clear()}}setInitialState(e,t,n){this.connected=e,this.address=t,this.chainType=n}handleWalletState(e,t){if(t<=this.lastWalletSeq)return;this.lastWalletSeq=t;let n=this.connected;this.connected=e.connected,this.address=e.address,e.chainType&&(this.chainType=e.chainType),e.connected&&this.pendingConnect&&(this.pendingConnect.resolve(),this.pendingConnect=null),!e.connected&&this.pendingDisconnect&&(this.pendingDisconnect.resolve(),this.pendingDisconnect=null),e.event?this.emit(e.event,{type:e.event,data:e}):e.connected&&!n?this.emit(`connect`,{type:`connect`,data:e}):!e.connected&&n?this.emit(`disconnect`,{type:`disconnect`,data:e}):e.connected&&this.emit(`accountsChanged`,{type:`accountsChanged`,data:e})}handleSignResult(e,n,r){let i=this.pendingRequests.get(e);i&&(this.pendingRequests.delete(e),clearTimeout(i.timer),r?i.reject(t(r)):n?i.resolve(n):i.reject(Error(`Invalid sign result: missing both result and error`)))}postToHost(e){this.destroyed||typeof window>`u`||!window.parent||window.parent.postMessage(e,this.hostOrigin)}emit(e,t){let n=this.eventListeners.get(e);if(n)for(let e of n)try{e(t)}catch{}}},l=`__TF_VERSION__`,u=class{constructor(t,i){this.destroyed=!1,this.resizeObserver=null,this.lastReportedHeight=0,this.popupClosedHandlers=new Set,this.providerEventHandlers=new Set,this.handleMessage=t=>{if(this.destroyed||t.origin!==this.hostOrigin)return;let n=r(t.data);if(n){if(e(n,`tf:init`))this.handleInit(n.payload);else if(e(n,`tf:setConfig`))this.callbacks.onConfigUpdate(n.payload);else if(e(n,`tf:setStyle`))this.callbacks.onStyleUpdate(n.payload);else if(e(n,`tf:fiatPopupClosed`)){let e=n.payload.orderId;this.callbacks.onFiatPopupClosed?.(e);for(let t of this.popupClosedHandlers)t(e)}else if(e(n,`tf:fiatProviderEvent`)){let e=n.payload;this.callbacks.onFiatProviderEvent?.(e);for(let t of this.providerEventHandlers)t(e)}}},this.hostOrigin=t,this.callbacks=i,this.walletAdapter=new c(t),window.addEventListener(`message`,this.handleMessage),a(this.getFiatBridge()),this.postToHost(n(`ready`,{version:l,protocolVersion:1}))}getFiatBridge(){return{requestPreOpenPopup:()=>this.requestPreOpenPopup(),requestNavigatePopup:(e,t)=>this.requestNavigatePopup(e,t),onPopupClosed:e=>(this.popupClosedHandlers.add(e),()=>this.popupClosedHandlers.delete(e)),onProviderEvent:e=>(this.providerEventHandlers.add(e),()=>this.providerEventHandlers.delete(e))}}observeResize(e){this.resizeObserver=new ResizeObserver(e=>{let t=e[0];if(!t)return;let r=Math.ceil(t.borderBoxSize?.[0]?.blockSize??t.contentRect.height);Math.abs(r-this.lastReportedHeight)<2||(this.lastReportedHeight=r,this.postToHost(n(`resize`,{height:r})))}),this.resizeObserver.observe(e)}emitEvent(e,t){this.postToHost(n(`event`,{name:e,data:t}))}requestPreOpenPopup(){this.postToHost(n(`preOpenPopup`,{}))}requestNavigatePopup(e,t){this.postToHost(n(`navigatePopup`,{url:e,orderId:t}))}destroy(){this.destroyed||(this.destroyed=!0,window.removeEventListener(`message`,this.handleMessage),this.walletAdapter.destroy(),this.popupClosedHandlers.clear(),this.providerEventHandlers.clear(),a(null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null))}handleInit(e){this.walletAdapter.setInitialState(e.connected??!1,e.walletAddress??null,e.chainType),this.callbacks.onInit(e.config,e.style)}postToHost(e){this.destroyed||window.parent.postMessage(e,this.hostOrigin)}};function d(){try{return window!==window.top}catch{return!0}}function f(){if(!d())return null;try{if(document.referrer)return new URL(document.referrer).origin}catch{}return null}export{c as i,f as n,d as r,u as t};
|
package/dist/iframe.d.ts
CHANGED
|
@@ -12,9 +12,24 @@ declare interface AmountChangedData {
|
|
|
12
12
|
*/
|
|
13
13
|
declare type BooleanAttribute = boolean | "true" | "false" | "1" | "0" | "yes" | "no" | "";
|
|
14
14
|
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Callback interfaces for widget events.
|
|
17
|
+
*
|
|
18
|
+
* **Crypto outcome routing** (mutually exclusive — pick the channel that matches
|
|
19
|
+
* the active flow):
|
|
20
|
+
* - `EXACT_INPUT` (`<tokenflight-widget trade-type="EXACT_INPUT">` / default,
|
|
21
|
+
* "spend exactly N of X") → fires `onSwapSuccess` / `onSwapError`
|
|
22
|
+
* - `EXACT_OUTPUT` (`<tokenflight-widget trade-type="EXACT_OUTPUT">`,
|
|
23
|
+
* "receive exactly N of Y") → fires `onDepositSuccess` / `onDepositError`
|
|
24
|
+
*
|
|
25
|
+
* **Fiat (card) outcomes** route through the same `onSwap*` / `onDeposit*`
|
|
26
|
+
* channels for errors (matched to the host flow) and through
|
|
27
|
+
* `onFiatOrderCreated` / `onFiatOrderCompleted` for fiat-specific lifecycle.
|
|
28
|
+
*/
|
|
16
29
|
export declare interface Callbacks {
|
|
30
|
+
/** EXACT_INPUT crypto success. */
|
|
17
31
|
onSwapSuccess?(data: SwapSuccessData): void;
|
|
32
|
+
/** EXACT_INPUT errors (crypto execution + card flow when in EXACT_INPUT mode). */
|
|
18
33
|
onSwapError?(data: SwapErrorData): void;
|
|
19
34
|
onWalletConnected?(data: WalletConnectedData): void;
|
|
20
35
|
onQuoteReceived?(data: QuoteResponse): void;
|
|
@@ -34,9 +49,9 @@ export declare interface Callbacks {
|
|
|
34
49
|
status: string;
|
|
35
50
|
txHash?: string;
|
|
36
51
|
}): void;
|
|
37
|
-
/**
|
|
52
|
+
/** EXACT_OUTPUT crypto success. */
|
|
38
53
|
onDepositSuccess?(data: SwapSuccessData): void;
|
|
39
|
-
/**
|
|
54
|
+
/** EXACT_OUTPUT errors (crypto execution + card flow when in EXACT_OUTPUT mode). */
|
|
40
55
|
onDepositError?(data: SwapErrorData): void;
|
|
41
56
|
}
|
|
42
57
|
|
|
@@ -66,6 +81,9 @@ declare interface EvmWalletAction {
|
|
|
66
81
|
params: unknown[];
|
|
67
82
|
}
|
|
68
83
|
|
|
84
|
+
/** Tag name for the iframe-backed web component. */
|
|
85
|
+
export declare const IFRAME_WIDGET_TAG = "tokenflight-iframe-widget";
|
|
86
|
+
|
|
69
87
|
/** Wallet adapter interface that all adapters must implement */
|
|
70
88
|
export declare interface IWalletAdapter {
|
|
71
89
|
/** Human-readable name */
|
|
@@ -98,6 +116,9 @@ export declare interface IWalletAdapter {
|
|
|
98
116
|
off(event: WalletEventType, handler: (event: WalletEvent) => void): void;
|
|
99
117
|
}
|
|
100
118
|
|
|
119
|
+
/** Quote detail card display mode. */
|
|
120
|
+
declare type QuoteCardVisibility = "hidden" | "visible";
|
|
121
|
+
|
|
101
122
|
declare type QuoteResponse = HyperstreamApi.GetQuotesResponse;
|
|
102
123
|
|
|
103
124
|
export declare interface RegisterElementsOptions {
|
|
@@ -120,6 +141,8 @@ export declare interface RegisterElementsOptions {
|
|
|
120
141
|
hideTitle?: boolean;
|
|
121
142
|
/** Default hide-powered-by flag. */
|
|
122
143
|
hidePoweredBy?: boolean;
|
|
144
|
+
/** Default hide-provider flag (hides "via {provider}" badge on the tracking page). */
|
|
145
|
+
hideProvider?: boolean;
|
|
123
146
|
/** Default no-background flag. */
|
|
124
147
|
noBackground?: boolean;
|
|
125
148
|
/** Default no-border flag. */
|
|
@@ -130,16 +153,20 @@ export declare interface RegisterElementsOptions {
|
|
|
130
153
|
rpcOverrides?: Record<string, string>;
|
|
131
154
|
/** Default supported chain id allowlist. */
|
|
132
155
|
supportedChainIds?: number[];
|
|
156
|
+
/** Referrer address that receives the fee. Passed through to quote API. */
|
|
157
|
+
referrer?: string;
|
|
158
|
+
/** Referrer fee in basis points (e.g. 30 = 0.3%). Passed through to quote API. */
|
|
159
|
+
referrerFeeBps?: number;
|
|
133
160
|
}
|
|
134
161
|
|
|
162
|
+
export declare function registerIframeElement(options?: RegisterIframeOptions): void;
|
|
163
|
+
|
|
135
164
|
export declare interface RegisterIframeOptions extends RegisterElementsOptions {
|
|
136
165
|
/** URL of the hosted iframe receiver page.
|
|
137
166
|
* Defaults to `"https://embed.tokenflight.ai/widget"`. */
|
|
138
167
|
iframeSrc?: string;
|
|
139
168
|
}
|
|
140
169
|
|
|
141
|
-
export declare function registerWidgetElement(options?: RegisterIframeOptions): void;
|
|
142
|
-
|
|
143
170
|
/** Solana sign and send transaction action */
|
|
144
171
|
declare interface SolanaSignAndSendAction {
|
|
145
172
|
type: "solana_signAndSendTransaction";
|
|
@@ -175,9 +202,6 @@ declare interface SwapSuccessData {
|
|
|
175
202
|
txHash: string;
|
|
176
203
|
}
|
|
177
204
|
|
|
178
|
-
/** @deprecated Use `SwapPayMethod` instead. */
|
|
179
|
-
declare type SwapV2PayMethod = SwapPayMethod;
|
|
180
|
-
|
|
181
205
|
/**
|
|
182
206
|
* Override specific UI labels without switching locale. Use for white-label
|
|
183
207
|
* deployments that need to rename a few strings but keep the bundled language.
|
|
@@ -193,6 +217,38 @@ declare interface TextOverrides {
|
|
|
193
217
|
youPay?: string;
|
|
194
218
|
/** Label above the destination/to token panel. Default: "You receive" */
|
|
195
219
|
youReceive?: string;
|
|
220
|
+
/** Step 1 title (pending). Default: "Sign in wallet" */
|
|
221
|
+
trackingSignTitle?: string;
|
|
222
|
+
/** Step 1 title (done). Default: "Signed in wallet" */
|
|
223
|
+
trackingSignedTitle?: string;
|
|
224
|
+
/** Step 1 subtitle (pending). Default: "Confirm in your wallet..." */
|
|
225
|
+
trackingSignSubtitle?: string;
|
|
226
|
+
/** Step 1 subtitle (done). Default: "Signature submitted" */
|
|
227
|
+
trackingSignedSubtitle?: string;
|
|
228
|
+
/** Step 2 title. Default: "Deposit on {chain}" */
|
|
229
|
+
trackingDepositTitle?: string;
|
|
230
|
+
/** Step 2 subtitle (pending). Default: "Waiting for confirmation..." */
|
|
231
|
+
trackingDepositSubtitle?: string;
|
|
232
|
+
/** Step 2 subtitle (done). Default: "Confirmed on-chain" */
|
|
233
|
+
trackingDepositConfirmedSubtitle?: string;
|
|
234
|
+
/** Step 3 title. Default: "Provider filling your order" */
|
|
235
|
+
trackingFillTitle?: string;
|
|
236
|
+
/** Step 3 subtitle. Default: "Via {provider}" */
|
|
237
|
+
trackingFillSubtitle?: string;
|
|
238
|
+
/** Step 4 title. Default: "Filled on {chain}" */
|
|
239
|
+
trackingCompleteTitle?: string;
|
|
240
|
+
/** Step 4 subtitle. Default: "Tokens delivered" */
|
|
241
|
+
trackingCompleteSubtitle?: string;
|
|
242
|
+
/** Fiat step 1 title. Default: "Awaiting payment" */
|
|
243
|
+
trackingPaymentTitle?: string;
|
|
244
|
+
/** Fiat step 1 subtitle (done). Default: "Payment confirmed" */
|
|
245
|
+
trackingPaymentConfirmedSubtitle?: string;
|
|
246
|
+
/** Fiat swap step title (jump strategy). Default: "Swapping tokens" */
|
|
247
|
+
trackingSwapTitle?: string;
|
|
248
|
+
/** Fiat final step title. Default: "Purchase complete" */
|
|
249
|
+
trackingPurchaseTitle?: string;
|
|
250
|
+
/** Fiat final step subtitle (done). Default: "Tokens delivered to your wallet" */
|
|
251
|
+
trackingDeliverySubtitle?: string;
|
|
196
252
|
}
|
|
197
253
|
|
|
198
254
|
/** All first-party CSS custom properties exposed for theming. */
|
|
@@ -221,6 +277,10 @@ declare interface TokenFlightConfigBase {
|
|
|
221
277
|
hideTitle?: boolean;
|
|
222
278
|
/** Hide "Powered by TokenFlight" footer */
|
|
223
279
|
hidePoweredBy?: boolean;
|
|
280
|
+
/** Hide the "via {provider}" badge on the order tracking page */
|
|
281
|
+
hideProvider?: boolean;
|
|
282
|
+
/** Quote card display mode. EXACT_INPUT Swap defaults to "hidden". */
|
|
283
|
+
quoteCard?: QuoteCardVisibility;
|
|
224
284
|
/** Remove container background (transparent) */
|
|
225
285
|
noBackground?: boolean;
|
|
226
286
|
/** Remove container border and shadow */
|
|
@@ -231,6 +291,10 @@ declare interface TokenFlightConfigBase {
|
|
|
231
291
|
* are decimal chain IDs as strings.
|
|
232
292
|
*/
|
|
233
293
|
rpcOverrides?: Record<string, string>;
|
|
294
|
+
/** Referrer address that receives the fee. Passed through to the quote API. */
|
|
295
|
+
referrer?: string;
|
|
296
|
+
/** Referrer fee in basis points (e.g. 30 = 0.3%). Passed through to the quote API. */
|
|
297
|
+
referrerFeeBps?: number;
|
|
234
298
|
}
|
|
235
299
|
|
|
236
300
|
/** Attributes accepted by `<tokenflight-widget>`. */
|
|
@@ -260,8 +324,12 @@ export declare interface TokenFlightWidgetAttributes {
|
|
|
260
324
|
"csp-nonce"?: string;
|
|
261
325
|
"hide-title"?: BooleanAttribute;
|
|
262
326
|
"hide-powered-by"?: BooleanAttribute;
|
|
327
|
+
"hide-provider"?: BooleanAttribute;
|
|
328
|
+
"quote-card"?: "hidden" | "visible";
|
|
263
329
|
"no-background"?: BooleanAttribute;
|
|
264
330
|
"no-border"?: BooleanAttribute;
|
|
331
|
+
"referrer"?: string;
|
|
332
|
+
"referrer-fee-bps"?: string | number;
|
|
265
333
|
}
|
|
266
334
|
|
|
267
335
|
/** Configuration for Widget component (auto-selects Swap or Deposit UX based on config) */
|
|
@@ -284,9 +352,9 @@ export declare interface TokenFlightWidgetConfig extends TokenFlightConfigBase {
|
|
|
284
352
|
/** Address the filler should refund to if the fill fails (sent as `refundTo` on quote requests). */
|
|
285
353
|
refundTo?: string;
|
|
286
354
|
/** Payment methods to offer (default: ["crypto"]) */
|
|
287
|
-
methods?:
|
|
355
|
+
methods?: SwapPayMethod[];
|
|
288
356
|
/** Default active pay method tab (default: "crypto") */
|
|
289
|
-
defaultPayMethod?:
|
|
357
|
+
defaultPayMethod?: SwapPayMethod;
|
|
290
358
|
/** Fiat currency code for card payments (default: "USD") */
|
|
291
359
|
fiatCurrency?: string;
|
|
292
360
|
/** Whitelist of allowed source tokens (CAIP-10) */
|
package/dist/iframe.js
CHANGED
|
@@ -1 +1,45 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{S as e,b as t}from"./register-defaults-C_q7CG7x.js";import{a as n,n as r,o as i,r as a}from"./theme-C9tsVWlo.js";import{t as o}from"./bridge-Bq0QUltI.js";function s(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 c(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function l(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function u(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{}}var d=`tokenflight-iframe-widget`,f=`api-endpoint.fiat-api-endpoint.to-token.from-token.trade-type.amount.recipient.icon.lock-from-token.lock-to-token.fiat-currency.methods.default-pay-method.from-tokens.to-tokens.title-text.title-image.theme.locale.hide-title.hide-powered-by.hide-provider.quote-card.no-background.no-border.recipient-editable.refund-to.rpc-overrides.referrer.referrer-fee-bps`.split(`.`),p={"api-endpoint":`apiEndpoint`,"fiat-api-endpoint":`fiatApiEndpoint`,"to-token":`toToken`,"from-token":`fromToken`,"trade-type":`tradeType`,"lock-from-token":`lockFromToken`,"lock-to-token":`lockToToken`,"fiat-currency":`fiatCurrency`,"default-pay-method":`defaultPayMethod`,"from-tokens":`fromTokens`,"to-tokens":`toTokens`,"title-text":`titleText`,"title-image":`titleImageUrl`,"hide-title":`hideTitle`,"hide-powered-by":`hidePoweredBy`,"hide-provider":`hideProvider`,"quote-card":`quoteCard`,"no-background":`noBackground`,"no-border":`noBorder`,"recipient-editable":`recipientEditable`,"refund-to":`refundTo`,"rpc-overrides":`rpcOverrides`,"referrer-fee-bps":`referrerFeeBps`};function m(e,n){if(n!==null)switch(e){case`to-token`:return s(n);case`from-tokens`:case`to-tokens`:return c(n);case`methods`:return l(n);case`quote-card`:return n===`hidden`||n===`visible`?n:void 0;case`rpc-overrides`:return u(n);case`referrer-fee-bps`:{let e=Number(n);return Number.isNaN(e)?void 0:e}case`lock-from-token`:case`lock-to-token`:case`hide-title`:case`hide-powered-by`:case`hide-provider`:case`no-background`:case`no-border`:case`recipient-editable`:return t(n)??(n===``?!0:void 0);default:return n||void 0}}function h(t,n){let r=t.getAttribute(`referrer`)||n.referrer,i=t.getAttribute(`referrer-fee-bps`);return e(r,i!==null&&i!==``?Number(i):n.referrerFeeBps,t)}function g(e,n){let r=t=>e.getAttribute(t),i=h(e,n);return{apiEndpoint:r(`api-endpoint`)||n.apiEndpoint||void 0,fiatApiEndpoint:r(`fiat-api-endpoint`)||n.fiatApiEndpoint||void 0,toToken:s(r(`to-token`)??``)||void 0,fromToken:r(`from-token`)||void 0,tradeType:r(`trade-type`)||void 0,amount:r(`amount`)||void 0,recipient:r(`recipient`)||void 0,icon:r(`icon`)||void 0,recipientEditable:e.hasAttribute(`recipient-editable`)?t(r(`recipient-editable`))??!0:void 0,refundTo:r(`refund-to`)||void 0,lockFromToken:e.hasAttribute(`lock-from-token`)?t(r(`lock-from-token`))??!0:void 0,lockToToken:e.hasAttribute(`lock-to-token`)?t(r(`lock-to-token`))??!0:void 0,fiatCurrency:r(`fiat-currency`)||void 0,methods:l(r(`methods`)??``)??n.methods,defaultPayMethod:r(`default-pay-method`)||void 0,quoteCard:r(`quote-card`)===`hidden`||r(`quote-card`)===`visible`?r(`quote-card`):void 0,fromTokens:c(r(`from-tokens`)??``),toTokens:c(r(`to-tokens`)??``),titleText:r(`title-text`)||void 0,titleImageUrl:r(`title-image`)||void 0,theme:r(`theme`)||n.theme||`light`,locale:r(`locale`)||n.locale||`en-US`,hideTitle:e.hasAttribute(`hide-title`)?t(r(`hide-title`))??!0:n.hideTitle,hidePoweredBy:e.hasAttribute(`hide-powered-by`)?t(r(`hide-powered-by`))??!0:n.hidePoweredBy,hideProvider:e.hasAttribute(`hide-provider`)?t(r(`hide-provider`))??!0:n.hideProvider,noBackground:e.hasAttribute(`no-background`)?t(r(`no-background`))??!0:n.noBackground,noBorder:e.hasAttribute(`no-border`)?t(r(`no-border`))??!0:n.noBorder,rpcOverrides:u(r(`rpc-overrides`)??``)??n.rpcOverrides,referrer:i.referrer,referrerFeeBps:i.referrerFeeBps}}var _=`
|
|
2
|
+
:host { display: block; }
|
|
3
|
+
.container {
|
|
4
|
+
position: relative;
|
|
5
|
+
width: 100%;
|
|
6
|
+
max-width: var(--tf-widget-max-width, 400px);
|
|
7
|
+
min-width: min(var(--tf-widget-min-width, 300px), 100%);
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
background: var(--tf-bg);
|
|
10
|
+
border: 1px solid var(--tf-border);
|
|
11
|
+
border-radius: var(--tf-radius-xl);
|
|
12
|
+
box-shadow: var(--tf-shadow-lg);
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
color-scheme: normal;
|
|
15
|
+
}
|
|
16
|
+
:host([no-background]) .container { background: transparent; }
|
|
17
|
+
:host([no-border]) .container { border: none; box-shadow: none; }
|
|
18
|
+
.accent-line {
|
|
19
|
+
position: absolute;
|
|
20
|
+
inset-inline: 0;
|
|
21
|
+
top: 0;
|
|
22
|
+
z-index: 1;
|
|
23
|
+
height: 2px;
|
|
24
|
+
background: linear-gradient(90deg, transparent, var(--tf-primary), transparent);
|
|
25
|
+
opacity: 0.6;
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
}
|
|
28
|
+
:host([no-border]) .accent-line { display: none; }
|
|
29
|
+
iframe {
|
|
30
|
+
display: block;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 660px;
|
|
33
|
+
min-width: 0;
|
|
34
|
+
border: 0;
|
|
35
|
+
background: transparent;
|
|
36
|
+
color-scheme: normal;
|
|
37
|
+
}
|
|
38
|
+
`;function v(e){if(typeof customElements>`u`||customElements.get(`tokenflight-iframe-widget`))return;let t=e??{},s=t.iframeSrc;class c extends HTMLElement{static get observedAttributes(){return f}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});e.querySelector(`iframe`)||(e.innerHTML=`
|
|
39
|
+
<style data-tf-shell-base>${_}</style>
|
|
40
|
+
<style data-tf-shell-theme></style>
|
|
41
|
+
<div class="container" part="container">
|
|
42
|
+
<div class="accent-line" part="accent-line"></div>
|
|
43
|
+
<iframe part="frame" allow="camera;microphone;payment;clipboard-write" title="TokenFlight Widget"></iframe>
|
|
44
|
+
</div>
|
|
45
|
+
`),this.themeStyleEl=e.querySelector(`style[data-tf-shell-theme]`)??void 0;let n=e.querySelector(`iframe`);if(!n)return;let r=this.__walletAdapter??t.walletAdapter,i=this.__callbacks??t.callbacks,a=g(this,t);this.applyThemeStyles(a.theme??`light`),this.bridge=new o({container:this,iframe:n,wallet:r,config:a,...s?{iframeSrc:s}:{}}),(i?.onSwapSuccess||i?.onDepositSuccess)&&this.bridge.on(`swapComplete`,e=>{if(this.isExactOutput()){i.onDepositSuccess?.(e);return}i.onSwapSuccess?.(e)}),(i?.onSwapError||i?.onDepositError)&&this.bridge.on(`error`,e=>{if(this.isExactOutput()){i.onDepositError?.(e);return}i.onSwapError?.(e)}),i?.onFiatOrderCreated&&this.bridge.on(`fiatOrderCreated`,e=>i.onFiatOrderCreated(e)),i?.onFiatOrderCompleted&&this.bridge.on(`fiatOrderCompleted`,e=>i.onFiatOrderCompleted(e))}disconnectedCallback(){this.bridge?.destroy(),this.bridge=void 0,this.unwatchAuto?.(),this.unwatchAuto=void 0}attributeChangedCallback(e,n,r){if(!this.bridge||n===r)return;if(e===`theme`&&this.applyThemeStyles(r||`light`),e===`referrer`||e===`referrer-fee-bps`){this.bridge.setConfig(h(this,t));return}let i=p[e]??e,a=m(e,r);this.bridge.setConfig({[i]:a})}isExactOutput(){return this.getAttribute(`trade-type`)===`EXACT_OUTPUT`}applyThemeStyles(e){this.unwatchAuto?.(),this.unwatchAuto=void 0;let o=e=>{let n=this.__customColors,i=t.customColors||n?{...e,...t.customColors,...n}:e;this.themeStyleEl&&(this.themeStyleEl.textContent=`:host {\n ${r(i)}\n}`)};e===`auto`?(o(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0?a:n),this.unwatchAuto=i(o)):o(e===`dark`?a:n)}}customElements.define(d,c)}export{d as IFRAME_WIDGET_TAG,v as registerIframeElement};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=e=>`${e.amount} を支払う`,ee=`確認待ち...`,te=`エクスプローラーで表示`,t=`送達に失敗しました`,n=`法定通貨プロバイダーを選択`,r=`金額を入力`,i=e=>`他${e.count}件`,a=`注文が期限切れ`,o=e=>`${e.provider} で ${e.amount} を支払う`,s=`コピーしました`,c=`最適なレートをお探しします`,l=e=>`${e.provider}で続行`,u=`別のチェーンを選択するか、特定のトークンを検索してください`,d=`近日公開`,f=e=>`${e.provider}経由`,p=`検索結果`,m=`トークンがウォレットに送達されました`,h=`支払い`,g=`トークンが送達されました`,_=e=>`≈ $${e.formatUsd}`,v=`受取アドレス`,y=`確認`,b=`ウォレットを接続して支払いオプションを表示`,x=`トークンが見つかりません`,S=`ウォレットを接続するかアドレスを入力して見積もりを取得`,C=`ウォレットで確認してください...`,w=`返金トランザクション`,T=e=>`${e.amt} ${e.sym} を購入`,E=`交換`,D=`DEXでスワップ中...`,O=`取引失敗 — 再試行`,k=`フィラーが注文を受け付けませんでした`,A=`戻る`,j=`支払い`,M=`実行中...`,N=`受取りトークンを選択`,P=e=>`${e.chain}で完了`,F=`支払い確認済み`,I=`購入`,L=`閉じる`,R=`利用可能なオファーがありません`,z=`返金処理中`,B=e=>`${e.chain}への入金`,V=`ルート`,H=`暗号通貨`,U=`署名完了`,W=`注文が失敗`,G=`金額を入力して開始`,K=`受取アドレス`,q=e=>`≈ $${e.addThousandsSeparator}`,J=`クレジットカードまたはデビットカードで購入`,Y=`すべてのチェーンを表示`,X=`スワップ`,Z=`送信者`,Q=`注文を処理中...`,ne=`支払いトークンを選択`,re=e=>`${e.provider}経由`,ie=`見積もり詳細`,ae=`合計手数料`,oe=`支払い済み`,se=`再試行`,ce=`スワップを確認`,le=`プロバイダーが注文を処理中`,ue=`トークンをスワップ中`,de=`あなたのトークン`,fe=e=>`${e.chain}でトークンを返還中`,pe=`カード`,me=`トークンを交換`,he=`エラーをコピー`,ge=`法定通貨支払い`,_e=`処理中...`,ve=`購入失敗`,$=`新しい購入`,ye=`クレジットカードまたはデビットカードで支払う`,be=`オンチェーンで確認済み`,xe=`ウォレットで署名`,Se=`送金元`,Ce=`トークン受け取りに必要`,we=`最大`,Te=`手数料`,Ee=`完了できませんでした`,De=`人気トークン`,Oe=`完了取引`,ke=e=>`${e.seconds}秒で送達`,Ae=`支払い方法`,je=`スワップ成功`,Me=`トークンが送達されました`,Ne=`受取`,Pe=`最低`,Fe=`名前またはアドレスで検索`,Ie=e=>`~${e.value}秒`,Le=`0`,Re=`プロバイダー`,ze=`推定時間`,Be=`残高不足`,Ve=`このチェーンのアドレス形式が無効です`,He=`宛先アドレスを入力`,Ue=`利用可能なトークンがありません`,We=`最高`,Ge=`送金トランザクション`,Ke=`スワップを実行`,qe=`このトークンはカードで直接購入できません。まず USDC を購入し、自動的にご希望のトークンに交換します。`,Je=`見積もり失敗`,Ye=e=>`他${e.count}件のプロバイダーと比較`,Xe=e=>`${e.arg0} を直接購入`,Ze=e=>`${e.chain}上`,Qe=e=>`~${e.value}分`,$e=`利用可能なルートがありません`,et=`トークンが到着しました!`,tt=`支払い待ち`,nt=e=>`最良レートのため${e.token}経由でルーティング`,rt=`新しいスワップ`,it=`受取アドレスを入力`,at=`ウォレットがソースチェーンと一致しません`,ot=`表示`,st=`最良レート`,ct=`注文を完了できませんでした。`,lt=e=>`${e.symbol}をウォレットに送信中...`,ut=`資金がウォレットに返金されました。`,dt=`見積もり詳細を表示`,ft=`署名を提出しました`,pt=`入金取引`,mt=`ウォレットを接続`,ht=`ウォレットのトークンで支払う`,gt=`受取り`,_t=`購入完了`,vt=`選択したトークンは現在この購入には利用できません`,yt=`受取アドレスを入力`,bt=`おすすめ`,xt=`ウォレットアカウント`,St=e=>`残高: ${e.fromBalance}`,Ct=`購入完了`,wt=`リトライ`,Tt=`トークンを選択`,Et={"10189s3":e,"10ioi7e":ee,"10v0i5g":te,"115lknq":t,"118a77s":n,"119fv83":r,"11k1vkl":i,"12rrl0i":a,"132vna6":o,"13bzcw5":s,"13i9oqu":c,"13l4n4r":l,"13x5i2v":u,"14ho4vt":d,"14j1lze":f,"15bw477":p,"1685rko":m,"17kq51m":h,"17wtaao":g,"188897k":_,"18cmny0":v,"18tbqwf":y,"18y1lrp":b,"19is1h8":x,"19ne1ha":S,"1bze7sg":C,"1c5n7ll":w,"1cei180":T,"1dyojgg":E,"1g8tdk7":D,"1hb73om":O,"1hdpo6q":k,"1hzmxtu":A,"1i7coq1":j,"1ih47b3":M,"1ix1b7w":N,"1ixbbo7":P,"1jhuo24":F,"1ka8utn":I,"1l0xxoj":L,"1ne9nkz":R,"1nhkl7x":z,"1nn0owb":B,"1nvxkfy":V,"1o1b4a8":H,"1o4ofyx":U,"1ok4m5g":W,"1olegnl":G,"1oncz6g":K,"1ovj1tk":q,"1q45kup":J,"1qbiehv":Y,"1rkfalq":X,"1rnxx1g":Z,"1spu5st":Q,"1t0r88u":ne,"1t86tnu":re,"1tn6f91":ie,"1viukn9":ae,"1w0n607":oe,"1w68n16":se,"1x5xdes":ce,"1y28pgi":le,"1y6hn5o":ue,"1yijk6g":de,"27fhcv":fe,"2b8ghr":pe,"2eikro":me,"2mzna2":he,"2zh3gr":ge,"344av8":_e,"3pklqf":ve,"3u5vqs":$,"6c0jc7":ye,"6c5l2f":be,"6gkge0":xe,"6s9hn9":Se,"7m2ht3":Ce,"7v6g6x":we,"9l4mg3":Te,"9p7amh":Ee,bdctly:De,bdo3n8:Oe,biwlqk:ke,cgzgvn:Ae,cjn1xs:je,cnwfg3:Me,cwk7r6:Ne,cx9lh3:Pe,dizog6:Fe,ek03j3:Ie,epw9f3:`0`,evz7q4:Re,f45rwo:ze,fcy4ey:Be,fo0vw0:Ve,fpand1:He,g7pjpv:Ue,gtvgs9:We,hzq69q:Ge,ibrnk6:Ke,ifug2i:qe,jf8ts4:Je,jmpbi6:Ye,jnzipx:Xe,k47stp:Ze,knrcsh:Qe,ln9xiv:$e,mnlddk:et,n9zkql:tt,ofi1rq:nt,pmqvh0:rt,pom1h2:it,q4mqcd:at,q5w460:ot,r7v9s7:st,rvctng:ct,sykid7:lt,t1rvqg:ut,tbygoy:dt,tgp8yw:ft,tjg3i3:pt,u61kge:mt,udneg1:ht,va18uh:gt,vum0cd:_t,wuxjl9:vt,wx5bee:yt,xel5qk:bt,xphk5n:xt,y6jqu9:St,yhtv6l:Ct,zkouah:wt,zz4mrw:Tt};export{Ke as _100907z,gt as _108j3sk,oe as _10lgc56,Z as _10n9ta8,h as _113vzpe,it as _11ncipg,H as _11p3b1r,$e as _12qyh2x,z as _13ym6k2,pe as _14oyo32,De as _15iyda3,S as _15vbpgm,s as _16j2pbi,qe as _16ln1wz,je as _16pzx0g,Ee as _16rump9,N as _17g2rjk,_ as _18346vt,I as _1982g2x,xt as _1biskvr,D as _1bjtgx1,Me as _1cmz8k7,ht as _1cpadi9,q as _1d7sodl,at as _1e023il,u as _1e5aqjt,B as _1ea99j0,te as _1f4czmp,be as _1f8nqa3,ce as _1f8umlr,K as _1fe46d3,Ce as _1fikhaa,rt as _1fu9qvd,E as _1g7ofg0,Ae as _1gfjrn0,ke as _1gma9hv,fe as _1hs819x,ft as _1ht75o0,t as _1i8i0au,Ye as _1i9sfkh,L as _1ib6ekl,J as _1ievltk,st as _1in1gel,G as _1in9ocp,He as _1ju6xlj,T as _1jvje3y,Te as _1kd3yrp,A as _1kez60s,ue as _1krtsvx,nt as _1kvlpuf,ye as _1l1rqi2,X as _1l2nmmx,j as _1lra4kg,dt as _1mmcyfz,vt as _1n1igys,O as _1na1vy4,he as _1nd7gbf,o as _1nwhws6,Ie as _1o0vi1j,Ge as _1o2h7a2,l as _1o8feo7,Ue as _1om32zr,w as _1oqs23j,wt as _1popw3r,ee as _1qamgmj,V as _1rggu8s,Qe as _1s54fdc,c as _1s9ryeq,xe as _1t3gki9,i as _1ulsa90,m as _1urf8wf,n as _1w2bswr,P as _1wwy4yj,e as _1wx2fw2,lt as _1y7hba4,x as _1yv1ajq,yt as _3mtvnb,Re as _3w8t28,ne as _41y3qp,Y as _454sub,ot as _49235i,W as _4itr6p,U as _4opuqb,ge as _5af8qp,y as _5r87wo,b as _78b61s,Se as _8edkty,Oe as _a5vz6z,Fe as _al7a0k,we as _bii6w9,Le as _cnghfj,M as _czpegb,pt as _d7bf51,Je as _doc1yy,R as _g3pfjv,tt as _gkmqsa,f as _hyiyqa,d as _i9ury1,v as _ide9vv,mt as _ig1w2,St as _jpt8np,ae as _kmeu9o,le as _kqdlbv,bt as _l5s0fl,Xe as _l78r94,de as _l800fy,g as _ly147p,Ne as _mdvri5,Q as _np8jou,a as _nrzzox,Ze as _o3um2w,F as _oj2fr8,_t as _p5ybee,k as _pqml54,ve as _pr6lte,_e as _q0rsrj,ut as _qm85b2,p as _r3yix2,C as _sf0mgy,Tt as _si8n6l,We as _swoaip,Ct as _t0vnn4,re as _t91lwj,Ve as _ty2nen,ct as _u7tj7p,ze as _uc0jju,r as _uu4paz,et as _vogk37,ie as _wa8i8c,se as _xavgbs,me as _xkdtbf,$ as _ystooe,Pe as _z6jr7i,Be as _zzusn5,Et as default};
|