@tokenflight/swap 0.1.3 → 0.2.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/widget.d.ts CHANGED
@@ -66,9 +66,6 @@ declare interface EvmWalletAction {
66
66
  params: unknown[];
67
67
  }
68
68
 
69
- /** How the fiat payment provider UI is opened. */
70
- export declare type FiatPaymentMode = "overlay" | "popup";
71
-
72
69
  declare interface ImperativeWidgetOptions<TConfig> {
73
70
  container: string | HTMLElement;
74
71
  config: TConfig;
@@ -116,10 +113,28 @@ export declare interface RegisterElementsOptions {
116
113
  customColors?: CustomColors;
117
114
  /** Default API endpoint for all widget instances. */
118
115
  apiEndpoint?: string;
116
+ /** Default fiat on-ramp API endpoint. */
117
+ fiatApiEndpoint?: string;
119
118
  /** Default theme for all widget instances. */
120
119
  theme?: Theme;
121
120
  /** Default locale for all widget instances. */
122
121
  locale?: SupportedLocale;
122
+ /** Default UI label overrides applied to all widget instances. */
123
+ textOverrides?: TextOverrides;
124
+ /** Default hide-title flag. */
125
+ hideTitle?: boolean;
126
+ /** Default hide-powered-by flag. */
127
+ hidePoweredBy?: boolean;
128
+ /** Default no-background flag. */
129
+ noBackground?: boolean;
130
+ /** Default no-border flag. */
131
+ noBorder?: boolean;
132
+ /** Default payment methods (for Swap / Widget). */
133
+ methods?: SwapPayMethod[];
134
+ /** Per-chain RPC URL override map (decimal chainId → URL). */
135
+ rpcOverrides?: Record<string, string>;
136
+ /** Default supported chain id allowlist. */
137
+ supportedChainIds?: number[];
123
138
  }
124
139
 
125
140
  export declare function registerWidgetElement(options?: RegisterElementsOptions): void;
@@ -162,6 +177,23 @@ declare interface SwapSuccessData {
162
177
  /** @deprecated Use `SwapPayMethod` instead. */
163
178
  declare type SwapV2PayMethod = SwapPayMethod;
164
179
 
180
+ /**
181
+ * Override specific UI labels without switching locale. Use for white-label
182
+ * deployments that need to rename a few strings but keep the bundled language.
183
+ *
184
+ * Applied globally via `registerWidgetElement({ textOverrides })` or
185
+ * `setTextOverrides()`. Unset keys fall back to the active locale's default.
186
+ *
187
+ * Keys are semantic (not i18n message IDs) so they remain stable across widget
188
+ * versions and don't leak internal implementation details.
189
+ */
190
+ declare interface TextOverrides {
191
+ /** Label above the source/from token panel. Default: "You pay" */
192
+ youPay?: string;
193
+ /** Label above the destination/to token panel. Default: "You receive" */
194
+ youReceive?: string;
195
+ }
196
+
165
197
  /** All first-party CSS custom properties exposed for theming. */
166
198
  declare type TfCssVar = "--tf-bg" | "--tf-bg-secondary" | "--tf-bg-elevated" | "--tf-surface" | "--tf-surface-hover" | "--tf-input-bg" | "--tf-glass" | "--tf-text" | "--tf-text-secondary" | "--tf-text-tertiary" | "--tf-text-on-primary" | "--tf-border" | "--tf-border-light" | "--tf-primary" | "--tf-primary-alpha" | "--tf-primary-light" | "--tf-primary-glow" | "--tf-success" | "--tf-success-bg" | "--tf-error" | "--tf-error-bg" | "--tf-error-alpha" | "--tf-warning" | "--tf-warning-bg" | "--tf-shadow" | "--tf-shadow-lg" | "--tf-skeleton" | "--tf-radius-xs" | "--tf-radius-sm" | "--tf-radius" | "--tf-radius-lg" | "--tf-radius-xl" | "--tf-button-radius" | "--tf-widget-max-width" | "--tf-font-family" | "--tf-font-family-mono" | "--tf-font-size" | "--tf-line-height";
167
199
 
@@ -192,6 +224,12 @@ declare interface TokenFlightConfigBase {
192
224
  noBackground?: boolean;
193
225
  /** Remove container border and shadow */
194
226
  noBorder?: boolean;
227
+ /**
228
+ * Per-chain RPC URL overrides. Host apps consume these when constructing
229
+ * wallet adapters via `createAppKitAdapter` / `createWagmiAdapter`. Keys
230
+ * are decimal chain IDs as strings.
231
+ */
232
+ rpcOverrides?: Record<string, string>;
195
233
  }
196
234
 
197
235
  export declare const TokenFlightWidget: {
@@ -225,7 +263,6 @@ export declare interface TokenFlightWidgetAttributes {
225
263
  "lock-from-token"?: BooleanAttribute;
226
264
  "lock-to-token"?: BooleanAttribute;
227
265
  "fiat-currency"?: string;
228
- "fiat-payment-mode"?: string;
229
266
  methods?: string;
230
267
  "default-pay-method"?: "crypto" | "card";
231
268
  "from-tokens"?: string;
@@ -253,14 +290,19 @@ export declare interface TokenFlightWidgetConfig extends TokenFlightConfigBase {
253
290
  amount?: string;
254
291
  /** Optional recipient address */
255
292
  recipient?: string;
293
+ /**
294
+ * When true, the recipient badge stays editable even if `recipient` is preset.
295
+ * Default: false — presetting `recipient` locks the badge.
296
+ */
297
+ recipientEditable?: boolean;
298
+ /** Address the filler should refund to if the fill fails (sent as `refundTo` on quote requests). */
299
+ refundTo?: string;
256
300
  /** Payment methods to offer (default: ["crypto"]) */
257
301
  methods?: SwapV2PayMethod[];
258
302
  /** Default active pay method tab (default: "crypto") */
259
303
  defaultPayMethod?: SwapV2PayMethod;
260
304
  /** Fiat currency code for card payments (default: "USD") */
261
305
  fiatCurrency?: string;
262
- /** How to open the fiat payment provider (default: "overlay") */
263
- fiatPaymentMode?: FiatPaymentMode;
264
306
  /** Whitelist of allowed source tokens (CAIP-10) */
265
307
  fromTokens?: TokenIdentifier[];
266
308
  /** Whitelist of allowed destination tokens (CAIP-10) */
package/dist/widget.js CHANGED
@@ -1 +1 @@
1
- import"./dist-AEh2EHtG.js";import"./widget-FccUKqSD.js";import{n as e,t}from"./register-widget-BsjeFIPX.js";export{e as TokenFlightWidget,t as registerWidgetElement};
1
+ import{r as e,t}from"./register-widget-BOOjjgip.js";export{e as TokenFlightWidget,t as registerWidgetElement};
@@ -0,0 +1 @@
1
+ var e=`等待确认中...`,ee=`在浏览器中查看`,te=`交付未成功`,t=`选择法币支付通道`,n=`输入金额`,r=`正在寻找最优价格...`,i=`订单已过期`,a=e=>`通过 ${e.provider} 支付 ${e.amount}`,o=`我们将为您找到最优汇率`,s=e=>`通过 ${e.provider} 继续`,c=`尝试选择其他链或搜索特定代币`,ne=void 0,l=e=>`通过 ${e.provider}`,u=`确认充值`,d=`充值`,f=`代币已送达您的钱包`,p=`支付`,m=`您的代币已送达`,h=e=>`≈ $${e.formatUsd}`,g=`收款地址`,_=`确认`,v=`连接钱包以查看支付选项`,y=`未找到代币`,b=`连接钱包或输入地址以获取报价`,x=`请在钱包中确认...`,S=`退款交易`,C=e=>`购买 ${e.amt} ${e.sym}`,re=void 0,w=`通过 DEX 兑换中...`,T=`选择货币`,E=`交易失败 — 重试`,D=`无做市商接受此订单`,O=`返回`,k=`支付`,A=`执行中...`,j=`选择目标代币`,M=e=>`已在 ${e.chain} 上完成`,N=`支付已确认`,P=`购买`,F=`关闭`,I=`或使用银行卡支付`,L=e=>`对比其他 ${e.count} 家`,R=`暂无可用报价`,z=`退款进行中`,B=e=>`在 ${e.chain} 上存入`,V=`加密货币`,H=`已签名`,U=`订单失败`,W=`输入金额以开始`,G=`接收地址`,K=e=>`≈ $${e.addThousandsSeparator}`,q=`存款目标`,J=`使用信用卡或借记卡购买`,Y=`查看所有链`,X=`兑换`,Z=`发送方`,Q=`选择支付代币`,ie=e=>`通过 ${e.provider}`,ae=`总费用`,oe=`已支付`,se=`重试`,ce=`查看兑换`,le=`提供商正在执行订单`,ue=`代币兑换中`,de=e=>`正在 ${e.chain} 上退还代币`,fe=`银行卡`,pe=`交换代币`,me=`法币支付`,he=`处理中...`,ge=`购买失败`,_e=`新购买`,ve=`使用信用卡或借记卡支付`,$=`已上链确认`,ye=`钱包签名`,be=`发送`,xe=`接收代币所必需`,Se=`最大`,Ce=`费用`,we=`无法完成`,Te=`选择代币`,Ee=`完成交易`,De=e=>`${e.seconds}秒内送达`,Oe=`使用支付`,ke=e=>`直接购买 ${e.store_targetToken}`,Ae=`兑换成功`,je=`代币已送达`,Me=`收取`,Ne=`最低`,Pe=`按名称或地址搜索`,Fe=e=>`~${e.value}秒`,Ie=`0`,Le=`提供商`,Re=`预计时间`,ze=`余额不足`,Be=`此链地址格式无效`,Ve=`输入目标地址`,He=`没有可用的代币`,Ue=`最高`,We=`转账交易`,Ge=`确认兑换`,Ke=`该代币不支持直接刷卡购买,我们会先购买 USDC,再自动兑换为您需要的代币。`,qe=`报价失败`,Je=e=>`直接购买 ${e.arg0}`,Ye=e=>`在 ${e.chain} 上`,Xe=e=>`~${e.value}分钟`,Ze=`无可用路径`,Qe=`代币已到账!`,$e=`等待付款`,et=e=>`通过 ${e.token} 路由以获取最优价格`,tt=`新交易`,nt=`输入收款地址`,rt=`钱包与源链不匹配`,it=`查看`,at=`最优价格`,ot=`您的订单无法完成。`,st=e=>`正在将 ${e.symbol} 发送到您的钱包...`,ct=`您的资金已退回钱包。`,lt=`签名已提交`,ut=`存入交易`,dt=`连接钱包`,ft=`使用钱包中的代币支付`,pt=`收到`,mt=`购买完成`,ht=`所选代币当前无法用于此次购买`,gt=`输入收款地址`,_t=`推荐`,vt=`钱包账户`,yt=e=>`余额: ${e.fromBalance}`,bt=`购买完成`,xt=`重试`,St=`选择代币`,Ct={"10ioi7e":e,"10v0i5g":ee,"115lknq":te,"118a77s":t,"119fv83":n,"12rnjtt":r,"12rrl0i":i,"132vna6":a,"13i9oqu":o,"13l4n4r":s,"13x5i2v":c,"14ho4vt":void 0,"14j1lze":l,"15lxzx":u,"15lz1at":d,"1685rko":f,"17kq51m":p,"17wtaao":m,"188897k":h,"18cmny0":g,"18tbqwf":_,"18y1lrp":v,"19is1h8":y,"19ne1ha":b,"1bze7sg":x,"1c5n7ll":S,"1cei180":C,"1dyojgg":void 0,"1g8tdk7":w,"1gx00do":T,"1hb73om":E,"1hdpo6q":D,"1hzmxtu":O,"1i7coq1":k,"1ih47b3":A,"1ix1b7w":j,"1ixbbo7":M,"1jhuo24":N,"1ka8utn":P,"1l0xxoj":F,"1l41ftg":I,"1m2n0pw":L,"1ne9nkz":R,"1nhkl7x":z,"1nn0owb":B,"1o1b4a8":V,"1o4ofyx":H,"1ok4m5g":U,"1olegnl":W,"1oncz6g":G,"1ovj1tk":K,"1py89j9":q,"1q45kup":J,"1qbiehv":Y,"1rkfalq":X,"1rnxx1g":Z,"1t0r88u":Q,"1t86tnu":ie,"1viukn9":ae,"1w0n607":oe,"1w68n16":se,"1x5xdes":ce,"1y28pgi":le,"1y6hn5o":ue,"27fhcv":de,"2b8ghr":fe,"2eikro":pe,"2zh3gr":me,"344av8":he,"3pklqf":ge,"3u5vqs":_e,"6c0jc7":ve,"6c5l2f":$,"6gkge0":ye,"6s9hn9":be,"7m2ht3":xe,"7v6g6x":Se,"9l4mg3":Ce,"9p7amh":we,axj370:Te,bdo3n8:Ee,biwlqk:De,cgzgvn:Oe,chajkh:ke,cjn1xs:Ae,cnwfg3:je,cwk7r6:Me,cx9lh3:Ne,dizog6:Pe,ek03j3:Fe,epw9f3:`0`,evz7q4:Le,f45rwo:Re,fcy4ey:ze,fo0vw0:Be,fpand1:Ve,g7pjpv:He,gtvgs9:Ue,hzq69q:We,ibrnk6:Ge,ifug2i:Ke,jf8ts4:qe,jnzipx:Je,k47stp:Ye,knrcsh:Xe,ln9xiv:Ze,mnlddk:Qe,n9zkql:$e,ofi1rq:et,pmqvh0:tt,pom1h2:nt,q4mqcd:rt,q5w460:it,r7v9s7:at,rvctng:ot,sykid7:st,t1rvqg:ct,tgp8yw:lt,tjg3i3:ut,u61kge:dt,udneg1:ft,va18uh:pt,vum0cd:mt,wuxjl9:ht,wx5bee:gt,xel5qk:_t,xphk5n:vt,y6jqu9:yt,yhtv6l:bt,zkouah:xt,zz4mrw:St};export{Ge as _100907z,pt as _108j3sk,oe as _10lgc56,Z as _10n9ta8,p as _113vzpe,nt as _11ncipg,V as _11p3b1r,Ze as _12qyh2x,z as _13ym6k2,fe as _14oyo32,b as _15vbpgm,Ke as _16ln1wz,Ae as _16pzx0g,we as _16rump9,j as _17g2rjk,h as _18346vt,P as _1982g2x,vt as _1biskvr,w as _1bjtgx1,je as _1cmz8k7,ft as _1cpadi9,K as _1d7sodl,rt as _1e023il,c as _1e5aqjt,B as _1ea99j0,ee as _1f4czmp,$ as _1f8nqa3,ce as _1f8umlr,G as _1fe46d3,xe as _1fikhaa,tt as _1fu9qvd,re as _1g7ofg0,Oe as _1gfjrn0,De as _1gma9hv,de as _1hs819x,lt as _1ht75o0,te as _1i8i0au,F as _1ib6ekl,J as _1ievltk,at as _1in1gel,W as _1in9ocp,Ve as _1ju6xlj,C as _1jvje3y,Ce as _1kd3yrp,O as _1kez60s,ue as _1krtsvx,et as _1kvlpuf,ve as _1l1rqi2,X as _1l2nmmx,k as _1lra4kg,ht as _1n1igys,E as _1na1vy4,a as _1nwhws6,Fe as _1o0vi1j,We as _1o2h7a2,s as _1o8feo7,He as _1om32zr,S as _1oqs23j,xt as _1popw3r,e as _1qamgmj,I as _1s3hwm,Xe as _1s54fdc,o as _1s9ryeq,ye as _1t3gki9,T as _1uje2mm,f as _1urf8wf,t as _1w2bswr,M as _1wwy4yj,st as _1y7hba4,y as _1yv1ajq,gt as _3mtvnb,Le as _3w8t28,Q as _41y3qp,Y as _454sub,it as _49235i,U as _4itr6p,H as _4opuqb,me as _5af8qp,_ as _5r87wo,v as _78b61s,d as _89hoyp,be as _8edkty,Ee as _a5vz6z,Pe as _al7a0k,Se as _bii6w9,Ie as _cnghfj,A as _czpegb,ut as _d7bf51,qe as _doc1yy,u as _fdcaz1,R as _g3pfjv,ke as _g88yty,$e as _gkmqsa,l as _hyiyqa,ne as _i9ury1,g as _ide9vv,dt as _ig1w2,yt as _jpt8np,ae as _kmeu9o,le as _kqdlbv,_t as _l5s0fl,Je as _l78r94,m as _ly147p,Te as _m8t1qc,Me as _mdvri5,i as _nrzzox,Ye as _o3um2w,N as _oj2fr8,mt as _p5ybee,L as _peuj54,q as _pkny2p,D as _pqml54,ge as _pr6lte,he as _q0rsrj,ct as _qm85b2,x as _sf0mgy,St as _si8n6l,Ue as _swoaip,bt as _t0vnn4,ie as _t91lwj,Be as _ty2nen,ot as _u7tj7p,Re as _uc0jju,n as _uu4paz,Qe as _vogk37,se as _xavgbs,pe as _xkdtbf,r as _xpl7mo,_e as _ystooe,Ne as _z6jr7i,ze as _zzusn5,Ct as default};
@@ -0,0 +1 @@
1
+ var e=`等待確認中...`,ee=`在瀏覽器中查看`,te=`交付未成功`,t=`選擇法幣支付通道`,n=`輸入金額`,r=`正在尋找最優價格...`,i=`訂單已過期`,a=e=>`透過 ${e.provider} 支付 ${e.amount}`,o=`我們將為您找到最優匯率`,s=e=>`透過 ${e.provider} 繼續`,c=`嘗試選擇其他鏈或搜索特定代幣`,ne=void 0,l=e=>`透過 ${e.provider}`,u=`確認充值`,d=`充值`,f=`代幣已送達您的錢包`,p=`支付`,m=`您的代幣已送達`,h=e=>`≈ $${e.formatUsd}`,g=`收款地址`,_=`確認`,v=`連接錢包以查看支付選項`,y=`未找到代幣`,b=`連接錢包或輸入地址以獲取報價`,x=`請在錢包中確認...`,S=`退款交易`,C=e=>`購買 ${e.amt} ${e.sym}`,re=void 0,w=`透過 DEX 兌換中...`,T=`選擇貨幣`,E=`交易失敗 — 重試`,D=`無做市商接受此訂單`,O=`返回`,k=`支付`,A=`執行中...`,j=`選擇目標代幣`,M=e=>`已在 ${e.chain} 上完成`,N=`支付已確認`,P=`購買`,F=`關閉`,I=`或使用銀行卡支付`,L=e=>`比較其他 ${e.count} 家`,R=`暫無可用報價`,z=`退款進行中`,B=e=>`在 ${e.chain} 上存入`,V=`加密貨幣`,H=`已簽名`,U=`訂單失敗`,W=`輸入金額以開始`,G=`接收地址`,K=e=>`≈ $${e.addThousandsSeparator}`,q=`存款目標`,J=`使用信用卡或簽帳卡購買`,Y=`查看所有鏈`,X=`兌換`,Z=`發送方`,Q=`選擇支付代幣`,ie=e=>`透過 ${e.provider}`,ae=`總費用`,oe=`已支付`,se=`重試`,ce=`查看兌換`,le=`提供商正在執行訂單`,ue=`代幣兌換中`,de=e=>`正在 ${e.chain} 上退還代幣`,fe=`銀行卡`,pe=`交換代幣`,me=`法幣支付`,he=`處理中...`,ge=`購買失敗`,_e=`新購買`,ve=`使用信用卡或簽帳卡付款`,$=`已上鏈確認`,ye=`錢包簽名`,be=`發送`,xe=`接收代幣所必需`,Se=`最大`,Ce=`費用`,we=`無法完成`,Te=`選擇代幣`,Ee=`完成交易`,De=e=>`${e.seconds}秒內送達`,Oe=`使用支付`,ke=e=>`直接購買 ${e.store_targetToken}`,Ae=`兌換成功`,je=`代幣已送達`,Me=`收取`,Ne=`最低`,Pe=`按名稱或地址搜索`,Fe=e=>`~${e.value}秒`,Ie=`0`,Le=`提供商`,Re=`預計時間`,ze=`餘額不足`,Be=`此鏈地址格式無效`,Ve=`輸入目標地址`,He=`沒有可用的代幣`,Ue=`最高`,We=`轉帳交易`,Ge=`確認兌換`,Ke=`該代幣不支援直接刷卡購買,我們會先購買 USDC,再自動兌換為您需要的代幣。`,qe=`報價失敗`,Je=e=>`直接購買 ${e.arg0}`,Ye=e=>`在 ${e.chain} 上`,Xe=e=>`~${e.value}分鐘`,Ze=`無可用路徑`,Qe=`代幣已到帳!`,$e=`等待付款`,et=e=>`透過 ${e.token} 路由以獲取最優價格`,tt=`新交易`,nt=`輸入收款地址`,rt=`錢包與來源鏈不匹配`,it=`查看`,at=`最優價格`,ot=`您的訂單無法完成。`,st=e=>`正在將 ${e.symbol} 發送到您的錢包...`,ct=`您的資金已退回錢包。`,lt=`簽名已提交`,ut=`存入交易`,dt=`連接錢包`,ft=`使用錢包中的代幣支付`,pt=`收到`,mt=`購買完成`,ht=`所選代幣目前無法用於此次購買`,gt=`輸入收款地址`,_t=`推薦`,vt=`錢包帳戶`,yt=e=>`餘額: ${e.fromBalance}`,bt=`購買完成`,xt=`重試`,St=`選擇代幣`,Ct={"10ioi7e":e,"10v0i5g":ee,"115lknq":te,"118a77s":t,"119fv83":n,"12rnjtt":r,"12rrl0i":i,"132vna6":a,"13i9oqu":o,"13l4n4r":s,"13x5i2v":c,"14ho4vt":void 0,"14j1lze":l,"15lxzx":u,"15lz1at":d,"1685rko":f,"17kq51m":p,"17wtaao":m,"188897k":h,"18cmny0":g,"18tbqwf":_,"18y1lrp":v,"19is1h8":y,"19ne1ha":b,"1bze7sg":x,"1c5n7ll":S,"1cei180":C,"1dyojgg":void 0,"1g8tdk7":w,"1gx00do":T,"1hb73om":E,"1hdpo6q":D,"1hzmxtu":O,"1i7coq1":k,"1ih47b3":A,"1ix1b7w":j,"1ixbbo7":M,"1jhuo24":N,"1ka8utn":P,"1l0xxoj":F,"1l41ftg":I,"1m2n0pw":L,"1ne9nkz":R,"1nhkl7x":z,"1nn0owb":B,"1o1b4a8":V,"1o4ofyx":H,"1ok4m5g":U,"1olegnl":W,"1oncz6g":G,"1ovj1tk":K,"1py89j9":q,"1q45kup":J,"1qbiehv":Y,"1rkfalq":X,"1rnxx1g":Z,"1t0r88u":Q,"1t86tnu":ie,"1viukn9":ae,"1w0n607":oe,"1w68n16":se,"1x5xdes":ce,"1y28pgi":le,"1y6hn5o":ue,"27fhcv":de,"2b8ghr":fe,"2eikro":pe,"2zh3gr":me,"344av8":he,"3pklqf":ge,"3u5vqs":_e,"6c0jc7":ve,"6c5l2f":$,"6gkge0":ye,"6s9hn9":be,"7m2ht3":xe,"7v6g6x":Se,"9l4mg3":Ce,"9p7amh":we,axj370:Te,bdo3n8:Ee,biwlqk:De,cgzgvn:Oe,chajkh:ke,cjn1xs:Ae,cnwfg3:je,cwk7r6:Me,cx9lh3:Ne,dizog6:Pe,ek03j3:Fe,epw9f3:`0`,evz7q4:Le,f45rwo:Re,fcy4ey:ze,fo0vw0:Be,fpand1:Ve,g7pjpv:He,gtvgs9:Ue,hzq69q:We,ibrnk6:Ge,ifug2i:Ke,jf8ts4:qe,jnzipx:Je,k47stp:Ye,knrcsh:Xe,ln9xiv:Ze,mnlddk:Qe,n9zkql:$e,ofi1rq:et,pmqvh0:tt,pom1h2:nt,q4mqcd:rt,q5w460:it,r7v9s7:at,rvctng:ot,sykid7:st,t1rvqg:ct,tgp8yw:lt,tjg3i3:ut,u61kge:dt,udneg1:ft,va18uh:pt,vum0cd:mt,wuxjl9:ht,wx5bee:gt,xel5qk:_t,xphk5n:vt,y6jqu9:yt,yhtv6l:bt,zkouah:xt,zz4mrw:St};export{Ge as _100907z,pt as _108j3sk,oe as _10lgc56,Z as _10n9ta8,p as _113vzpe,nt as _11ncipg,V as _11p3b1r,Ze as _12qyh2x,z as _13ym6k2,fe as _14oyo32,b as _15vbpgm,Ke as _16ln1wz,Ae as _16pzx0g,we as _16rump9,j as _17g2rjk,h as _18346vt,P as _1982g2x,vt as _1biskvr,w as _1bjtgx1,je as _1cmz8k7,ft as _1cpadi9,K as _1d7sodl,rt as _1e023il,c as _1e5aqjt,B as _1ea99j0,ee as _1f4czmp,$ as _1f8nqa3,ce as _1f8umlr,G as _1fe46d3,xe as _1fikhaa,tt as _1fu9qvd,re as _1g7ofg0,Oe as _1gfjrn0,De as _1gma9hv,de as _1hs819x,lt as _1ht75o0,te as _1i8i0au,F as _1ib6ekl,J as _1ievltk,at as _1in1gel,W as _1in9ocp,Ve as _1ju6xlj,C as _1jvje3y,Ce as _1kd3yrp,O as _1kez60s,ue as _1krtsvx,et as _1kvlpuf,ve as _1l1rqi2,X as _1l2nmmx,k as _1lra4kg,ht as _1n1igys,E as _1na1vy4,a as _1nwhws6,Fe as _1o0vi1j,We as _1o2h7a2,s as _1o8feo7,He as _1om32zr,S as _1oqs23j,xt as _1popw3r,e as _1qamgmj,I as _1s3hwm,Xe as _1s54fdc,o as _1s9ryeq,ye as _1t3gki9,T as _1uje2mm,f as _1urf8wf,t as _1w2bswr,M as _1wwy4yj,st as _1y7hba4,y as _1yv1ajq,gt as _3mtvnb,Le as _3w8t28,Q as _41y3qp,Y as _454sub,it as _49235i,U as _4itr6p,H as _4opuqb,me as _5af8qp,_ as _5r87wo,v as _78b61s,d as _89hoyp,be as _8edkty,Ee as _a5vz6z,Pe as _al7a0k,Se as _bii6w9,Ie as _cnghfj,A as _czpegb,ut as _d7bf51,qe as _doc1yy,u as _fdcaz1,R as _g3pfjv,ke as _g88yty,$e as _gkmqsa,l as _hyiyqa,ne as _i9ury1,g as _ide9vv,dt as _ig1w2,yt as _jpt8np,ae as _kmeu9o,le as _kqdlbv,_t as _l5s0fl,Je as _l78r94,m as _ly147p,Te as _m8t1qc,Me as _mdvri5,i as _nrzzox,Ye as _o3um2w,N as _oj2fr8,mt as _p5ybee,L as _peuj54,q as _pkny2p,D as _pqml54,ge as _pr6lte,he as _q0rsrj,ct as _qm85b2,x as _sf0mgy,St as _si8n6l,Ue as _swoaip,bt as _t0vnn4,ie as _t91lwj,Be as _ty2nen,ot as _u7tj7p,Re as _uc0jju,n as _uu4paz,Qe as _vogk37,se as _xavgbs,pe as _xkdtbf,r as _xpl7mo,_e as _ystooe,Ne as _z6jr7i,ze as _zzusn5,Ct as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenflight/swap",
3
- "version": "0.1.3",
3
+ "version": "0.2.0-rc.0",
4
4
  "description": "Embeddable Web Components for cross-chain token swaps",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Khalani",
@@ -22,22 +22,6 @@
22
22
  "import": "./dist/tokenflight-swap.js",
23
23
  "require": "./dist/tokenflight-swap.umd.cjs"
24
24
  },
25
- "./swap": {
26
- "types": "./dist/swap.d.ts",
27
- "import": "./dist/swap.js"
28
- },
29
- "./receive": {
30
- "types": "./dist/receive.d.ts",
31
- "import": "./dist/receive.js"
32
- },
33
- "./fiat": {
34
- "types": "./dist/fiat.d.ts",
35
- "import": "./dist/fiat.js"
36
- },
37
- "./deposit": {
38
- "types": "./dist/deposit.d.ts",
39
- "import": "./dist/deposit.js"
40
- },
41
25
  "./widget": {
42
26
  "types": "./dist/widget.d.ts",
43
27
  "import": "./dist/widget.js"
@@ -58,13 +42,12 @@
58
42
  "access": "public"
59
43
  },
60
44
  "dependencies": {
61
- "@tokenflight/api": "0.1.3"
45
+ "@tokenflight/api": "0.2.0-rc.0"
62
46
  },
63
47
  "devDependencies": {
64
48
  "@fluenti/cli": "^0.6.2",
65
49
  "@fluenti/core": "^0.6.2",
66
50
  "@fluenti/solid": "^0.6.2",
67
- "@fluenti/vite-plugin": "0.6.2",
68
51
  "@tanstack/solid-query": "^5.75.7",
69
52
  "fast-glob": "^3.3.3",
70
53
  "jsdom": "^28.1.0",
package/dist/deposit.d.ts DELETED
@@ -1,304 +0,0 @@
1
- import { QuoteResponse } from '@tokenflight/api';
2
-
3
- /** Amount change data */
4
- declare interface AmountChangedData {
5
- amount: string;
6
- direction: "from" | "to";
7
- }
8
-
9
- /**
10
- * Boolean HTML attribute — accepts both native booleans and the
11
- * string equivalents that `parseBooleanProp()` understands.
12
- */
13
- declare type BooleanAttribute = boolean | "true" | "false" | "1" | "0" | "yes" | "no" | "";
14
-
15
- /** Callback interfaces for widget events */
16
- export declare interface Callbacks {
17
- onSwapSuccess?(data: SwapSuccessData): void;
18
- onSwapError?(data: SwapErrorData): void;
19
- onWalletConnected?(data: WalletConnectedData): void;
20
- onQuoteReceived?(data: QuoteResponse): void;
21
- onAmountChanged?(data: AmountChangedData): void;
22
- /** Called when user clicks Connect Wallet and no walletAdapter is provided */
23
- onConnectWallet?(): void;
24
- /** Called when user clicks the connected wallet address (for custom account modal handling) */
25
- onAccountModal?(): void;
26
- /** Called when a fiat order is created and the payment widget URL is available */
27
- onFiatOrderCreated?(data: {
28
- orderId: string;
29
- widgetUrl: string;
30
- }): void;
31
- /** Called when a fiat order reaches a terminal status */
32
- onFiatOrderCompleted?(data: {
33
- orderId: string;
34
- status: string;
35
- txHash?: string;
36
- }): void;
37
- /** Called when a deposit completes successfully */
38
- onDepositSuccess?(data: SwapSuccessData): void;
39
- /** Called when a deposit fails */
40
- onDepositError?(data: SwapErrorData): void;
41
- }
42
-
43
- /** Chain type for multi-chain support */
44
- declare type ChainType = "evm" | "solana";
45
-
46
- /**
47
- * Custom color overrides — keys are CSS variable names.
48
- * Typed keys provide autocomplete; arbitrary `--tf-*` strings are also accepted.
49
- *
50
- * ```ts
51
- * customColors: {
52
- * "--tf-primary": "#FF6B00",
53
- * "--tf-bg": "#1A1A2E",
54
- * "--tf-button-radius": "4px",
55
- * "--tf-widget-max-width": "480px",
56
- * }
57
- * ```
58
- */
59
- export declare type CustomColors = Partial<Record<TfCssVar, string>> & Record<string, string>;
60
-
61
- /** Payment methods available in `<tokenflight-deposit>` */
62
- export declare type DepositMethod = "wallet" | "card";
63
-
64
- /** EVM wallet action via EIP-1193 */
65
- declare interface EvmWalletAction {
66
- type: "eip1193_request";
67
- chainId: number;
68
- method: string;
69
- params: unknown[];
70
- }
71
-
72
- /** How the fiat payment provider UI is opened. */
73
- export declare type FiatPaymentMode = "overlay" | "popup";
74
-
75
- declare interface ImperativeWidgetOptions<TConfig> {
76
- container: string | HTMLElement;
77
- config: TConfig;
78
- walletAdapter?: IWalletAdapter;
79
- callbacks?: Callbacks;
80
- }
81
-
82
- /** Wallet adapter interface that all adapters must implement */
83
- export declare interface IWalletAdapter {
84
- /** Human-readable name */
85
- readonly name: string;
86
- /** Icon URL */
87
- readonly icon?: string;
88
- /** Supported action types */
89
- readonly supportedActionTypes: WalletActionType[];
90
- /** Optional: supported chain IDs — when set, the widget only shows tokens on these chains */
91
- readonly supportedChainIds?: number[];
92
- /** Connect the wallet */
93
- connect(chainType?: ChainType): Promise<void>;
94
- /** Disconnect the wallet */
95
- disconnect(): Promise<void>;
96
- /** Check if connected */
97
- isConnected(chainType?: ChainType): boolean;
98
- /** Get the current address */
99
- getAddress(chainType?: ChainType): Promise<string | null>;
100
- /** Execute a wallet action */
101
- executeWalletAction(action: WalletAction): Promise<WalletActionResult>;
102
- /** Optional: sign a message */
103
- signMessage?(message: string, chainType?: ChainType): Promise<string>;
104
- /** Optional: open the wallet's native account/connected modal */
105
- openAccountModal?(): Promise<void>;
106
- /** Optional: clean up internal subscriptions and watchers */
107
- destroy?(): void;
108
- /** Subscribe to wallet events */
109
- on(event: WalletEventType, handler: (event: WalletEvent) => void): void;
110
- /** Unsubscribe from wallet events */
111
- off(event: WalletEventType, handler: (event: WalletEvent) => void): void;
112
- }
113
-
114
- export declare function registerDepositElement(options?: RegisterElementsOptions): void;
115
-
116
- export declare interface RegisterElementsOptions {
117
- walletAdapter?: IWalletAdapter;
118
- callbacks?: Callbacks;
119
- /** Custom CSS variable overrides merged on top of the active theme.
120
- * Keys are CSS variable names, e.g. `"--tf-primary"`, `"--tf-font-family"`. */
121
- customColors?: CustomColors;
122
- /** Default API endpoint for all widget instances. */
123
- apiEndpoint?: string;
124
- /** Default theme for all widget instances. */
125
- theme?: Theme;
126
- /** Default locale for all widget instances. */
127
- locale?: SupportedLocale;
128
- }
129
-
130
- /** Solana sign and send transaction action */
131
- declare interface SolanaSignAndSendAction {
132
- type: "solana_signAndSendTransaction";
133
- transaction: string;
134
- }
135
-
136
- /** Solana sign transaction action */
137
- declare interface SolanaSignTransactionAction {
138
- type: "solana_signTransaction";
139
- transaction: string;
140
- }
141
-
142
- /** Supported locale identifiers. Accepts any string for forward-compat; known values get bundled translations. */
143
- export declare type SupportedLocale = "en-US" | "zh-CN" | "zh-TW" | "ja-JP" | "ko-KR" | (string & {});
144
-
145
- /** Data emitted on swap error */
146
- declare interface SwapErrorData {
147
- code: string;
148
- message: string;
149
- details?: unknown;
150
- }
151
-
152
- /** Data emitted on swap success */
153
- declare interface SwapSuccessData {
154
- orderId: string;
155
- fromToken: string;
156
- toToken: string;
157
- fromAmount: string;
158
- toAmount: string;
159
- txHash: string;
160
- }
161
-
162
- /** All first-party CSS custom properties exposed for theming. */
163
- declare type TfCssVar = "--tf-bg" | "--tf-bg-secondary" | "--tf-bg-elevated" | "--tf-surface" | "--tf-surface-hover" | "--tf-input-bg" | "--tf-glass" | "--tf-text" | "--tf-text-secondary" | "--tf-text-tertiary" | "--tf-text-on-primary" | "--tf-border" | "--tf-border-light" | "--tf-primary" | "--tf-primary-alpha" | "--tf-primary-light" | "--tf-primary-glow" | "--tf-success" | "--tf-success-bg" | "--tf-error" | "--tf-error-bg" | "--tf-error-alpha" | "--tf-warning" | "--tf-warning-bg" | "--tf-shadow" | "--tf-shadow-lg" | "--tf-skeleton" | "--tf-radius-xs" | "--tf-radius-sm" | "--tf-radius" | "--tf-radius-lg" | "--tf-radius-xl" | "--tf-button-radius" | "--tf-widget-max-width" | "--tf-font-family" | "--tf-font-family-mono" | "--tf-font-size" | "--tf-line-height";
164
-
165
- /** Visual theme mode. */
166
- export declare type Theme = "light" | "dark" | "auto";
167
-
168
- /** Shared configuration fields for both widgets */
169
- declare interface TokenFlightConfigBase {
170
- /** HyperStream API endpoint */
171
- apiEndpoint?: string;
172
- /** Fiat on-ramp API endpoint (default: https://fiat-preview.hyperstream.dev) */
173
- fiatApiEndpoint?: string;
174
- /** Visual theme */
175
- theme?: Theme;
176
- /** Locale for i18n */
177
- locale?: SupportedLocale;
178
- /** Custom CSS color overrides */
179
- customColors?: CustomColors;
180
- /** Optional custom widget title text */
181
- titleText?: string;
182
- /** Optional custom widget title image URL */
183
- titleImageUrl?: string;
184
- /** Hide top title/header area */
185
- hideTitle?: boolean;
186
- /** Hide "Powered by TokenFlight" footer */
187
- hidePoweredBy?: boolean;
188
- /** Remove container background (transparent) */
189
- noBackground?: boolean;
190
- /** Remove container border and shadow */
191
- noBorder?: boolean;
192
- }
193
-
194
- export declare const TokenFlightDeposit: {
195
- new (options: ImperativeWidgetOptions<TokenFlightDepositConfig>): {
196
- #dispose: (() => void) | null;
197
- #unwatchTheme: (() => void) | null;
198
- #container: HTMLElement;
199
- #shadowRoot: ShadowRoot | null;
200
- #config: TokenFlightDepositConfig;
201
- #walletAdapter?: IWalletAdapter;
202
- #callbacks?: Callbacks;
203
- initialize(): void;
204
- destroy(): void;
205
- setTheme(theme: Theme): void;
206
- setCustomColors(colors: CustomColors): void;
207
- #applyThemeStyles(style: HTMLStyleElement, theme: string): void;
208
- #setupAutoThemeWatch(style: HTMLStyleElement): void;
209
- };
210
- };
211
-
212
- /** Attributes accepted by `<tokenflight-deposit>`. */
213
- export declare interface TokenFlightDepositAttributes {
214
- "api-endpoint"?: string;
215
- target?: string;
216
- amount?: string;
217
- "from-token"?: string;
218
- recipient?: string;
219
- methods?: string;
220
- "target-icon"?: string;
221
- "fiat-currency"?: string;
222
- "fiat-payment-mode"?: string;
223
- "title-text"?: string;
224
- "title-image"?: string;
225
- theme?: Theme;
226
- locale?: SupportedLocale;
227
- "csp-nonce"?: string;
228
- "hide-title"?: BooleanAttribute;
229
- "hide-powered-by"?: BooleanAttribute;
230
- "no-background"?: BooleanAttribute;
231
- "no-border"?: BooleanAttribute;
232
- }
233
-
234
- /** Configuration for `<tokenflight-deposit>` */
235
- export declare interface TokenFlightDepositConfig extends TokenFlightConfigBase {
236
- /** Target token(s) to deposit into. When omitted, user selects via TokenSelector. */
237
- target?: TokenIdentifier | TokenIdentifier[];
238
- /** Optional: fixed amount for the target token */
239
- amount?: string;
240
- /** Optional: recipient address */
241
- recipient?: string;
242
- /** Payment methods to offer (default: ["wallet"]) */
243
- methods?: DepositMethod[];
244
- /** Optional source token to pay with */
245
- fromToken?: TokenIdentifier;
246
- /** Optional icon URL for the target token */
247
- targetIcon?: string;
248
- /** Fiat currency code for card payments (default: "USD") */
249
- fiatCurrency?: string;
250
- /** How to open the fiat payment provider (default: "overlay") */
251
- fiatPaymentMode?: FiatPaymentMode;
252
- }
253
-
254
- export declare interface TokenFlightDepositOptions {
255
- container: string | HTMLElement;
256
- config: TokenFlightDepositConfig;
257
- walletAdapter?: IWalletAdapter;
258
- callbacks?: Callbacks;
259
- }
260
-
261
- /**
262
- * Flexible token identifier supporting:
263
- * - Direct object: { chainId: 1, address: "0x..." }
264
- * - CAIP-10 string: "eip155:1:0x..."
265
- * - JSON string: '{"chainId":1,"address":"0x..."}'
266
- */
267
- declare type TokenIdentifier = string | TokenTarget;
268
-
269
- /** Token target as chain + address pair */
270
- declare interface TokenTarget {
271
- chainId: number;
272
- address: string;
273
- }
274
-
275
- /** Union of all wallet action types */
276
- declare type WalletAction = EvmWalletAction | SolanaSignTransactionAction | SolanaSignAndSendAction;
277
-
278
- /** Result of executing a wallet action */
279
- declare interface WalletActionResult {
280
- success: boolean;
281
- data?: unknown;
282
- error?: string;
283
- txHash?: string;
284
- }
285
-
286
- /** Wallet action types */
287
- declare type WalletActionType = "eip1193_request" | "solana_signTransaction" | "solana_signAndSendTransaction";
288
-
289
- /** Data emitted when wallet is connected */
290
- declare interface WalletConnectedData {
291
- address: string;
292
- chainType: string;
293
- }
294
-
295
- /** Wallet event payload */
296
- declare interface WalletEvent {
297
- type: WalletEventType;
298
- data?: unknown;
299
- }
300
-
301
- /** Wallet event types */
302
- declare type WalletEventType = "connect" | "disconnect" | "chainChanged" | "accountsChanged";
303
-
304
- export { }
package/dist/deposit.js DELETED
@@ -1 +0,0 @@
1
- import"./dist-AEh2EHtG.js";import"./widget-FccUKqSD.js";import{n as e,t}from"./register-deposit-B6K7wRIc.js";export{e as TokenFlightDeposit,t as registerDepositElement};