@tokenflight/swap 0.1.2 → 0.1.4

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
@@ -146,6 +146,9 @@ declare interface SwapErrorData {
146
146
  details?: unknown;
147
147
  }
148
148
 
149
+ /** Payment methods available in swap widget */
150
+ export declare type SwapPayMethod = "crypto" | "card";
151
+
149
152
  /** Data emitted on swap success */
150
153
  declare interface SwapSuccessData {
151
154
  orderId: string;
@@ -156,11 +159,11 @@ declare interface SwapSuccessData {
156
159
  txHash: string;
157
160
  }
158
161
 
159
- /** Payment methods available in SwapV2 */
160
- export declare type SwapV2PayMethod = "crypto" | "card";
162
+ /** @deprecated Use `SwapPayMethod` instead. */
163
+ declare type SwapV2PayMethod = SwapPayMethod;
161
164
 
162
165
  /** 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";
166
+ 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
167
 
165
168
  /** Visual theme mode. */
166
169
  export declare type Theme = "light" | "dark" | "auto";
@@ -238,7 +241,7 @@ export declare interface TokenFlightWidgetAttributes {
238
241
  "no-border"?: BooleanAttribute;
239
242
  }
240
243
 
241
- /** Configuration for Widget component (auto-selects SwapV2 or Deposit UX based on config) */
244
+ /** Configuration for Widget component (auto-selects Swap or Deposit UX based on config) */
242
245
  export declare interface TokenFlightWidgetConfig extends TokenFlightConfigBase {
243
246
  /** Optional source token (crypto tab) */
244
247
  fromToken?: TokenIdentifier;
@@ -250,6 +253,10 @@ export declare interface TokenFlightWidgetConfig extends TokenFlightConfigBase {
250
253
  amount?: string;
251
254
  /** Optional recipient address */
252
255
  recipient?: string;
256
+ /** Payment methods to offer (default: ["crypto"]) */
257
+ methods?: SwapV2PayMethod[];
258
+ /** Default active pay method tab (default: "crypto") */
259
+ defaultPayMethod?: SwapV2PayMethod;
253
260
  /** Fiat currency code for card payments (default: "USD") */
254
261
  fiatCurrency?: string;
255
262
  /** How to open the fiat payment provider (default: "overlay") */
package/dist/widget.js CHANGED
@@ -1 +1 @@
1
- import"./dist-D4PEwqKq.js";import"./widget-9I201q7O.js";import{n as e,t}from"./register-widget-CTcQPmpL.js";export{e as TokenFlightWidget,t as registerWidgetElement};
1
+ import{d as e,t}from"./register-widget-vJhNZS3M.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=`尝试选择其他链或搜索特定代币`,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}`,w=`通过 DEX 兑换中...`,T=`重新打开支付窗口`,E=`选择货币`,D=`交易失败 — 重试`,O=`无做市商接受此订单`,k=`返回`,A=`支付`,j=`执行中...`,M=`选择目标代币`,N=e=>`已在 ${e.chain} 上完成`,P=`支付已确认`,F=`购买`,I=`关闭`,L=`或使用银行卡支付`,R=e=>`对比其他 ${e.count} 家`,z=`暂无可用报价`,B=`退款进行中`,V=e=>`在 ${e.chain} 上存入`,H=`加密货币`,U=`已签名`,W=`订单失败`,G=`输入金额以开始`,K=`接收地址`,q=e=>`≈ $${e.addThousandsSeparator}`,J=`存款目标`,Y=`使用信用卡或借记卡购买`,X=`查看所有链`,Z=`这可能是由于浏览器隐私设置阻止了第三方内容。请尝试在新窗口中打开支付页面。`,Q=`兑换`,ne=`发送方`,re=`选择支付代币`,ie=e=>`通过 ${e.provider}`,ae=`总费用`,oe=`已支付`,se=`重试`,ce=`查看兑换`,le=`提供商正在执行订单`,ue=`代币兑换中`,de=e=>`正在 ${e.chain} 上退还代币`,fe=`银行卡`,pe=`交换代币`,me=`法币支付`,he=`处理中...`,ge=`购买失败`,_e=`新购买`,ve=e=>`购买 ${e.store_targetToken}`,ye=`使用信用卡或借记卡支付`,be=`已上链确认`,xe=`钱包签名`,Se=`发送`,$=`支付窗口无法加载`,Ce=`正在加载支付...`,we=`接收代币所必需`,Te=`最大`,Ee=`支付`,De=`重试`,Oe=`费用`,ke=`无法完成`,Ae=`选择代币`,je=`完成交易`,Me=e=>`${e.seconds}秒内送达`,Ne=`使用支付`,Pe=e=>`直接购买 ${e.store_targetToken}`,Fe=`兑换成功`,Ie=`代币已送达`,Le=`收取`,Re=`最低`,ze=`按名称或地址搜索`,Be=e=>`~${e.value}秒`,Ve=`0`,He=`提供商`,Ue=`预计时间`,We=`余额不足`,Ge=`此链地址格式无效`,Ke=`输入目标地址`,qe=`没有可用的代币`,Je=`最高`,Ye=`转账交易`,Xe=`确认兑换`,Ze=`该代币不支持直接刷卡购买,我们会先购买 USDC,再自动兑换为您需要的代币。`,Qe=`报价失败`,$e=e=>`直接购买 ${e.arg0}`,et=e=>`在 ${e.chain} 上`,tt=e=>`~${e.value}分钟`,nt=`无可用路径`,rt=`代币已到账!`,it=`等待付款`,at=e=>`通过 ${e.token} 路由以获取最优价格`,ot=`用户已取消`,st=`新交易`,ct=`输入收款地址`,lt=`钱包与源链不匹配`,ut=`查看`,dt=`最优价格`,ft=`您的订单无法完成。`,pt=e=>`正在将 ${e.symbol} 发送到您的钱包...`,mt=`您的资金已退回钱包。`,ht=`已在新窗口中打开支付`,gt=`签名已提交`,_t=`存入交易`,vt=`连接钱包`,yt=`使用钱包中的代币支付`,bt=`完成支付`,xt=`收到`,St=`购买完成`,Ct=`在新窗口中打开`,wt=`所选代币当前无法用于此次购买`,Tt=`输入收款地址`,Et=`推荐`,Dt=`钱包账户`,Ot=e=>`余额: ${e.fromBalance}`,kt=`购买完成`,At=`重试`,jt=e=>`购买 ${e.store_toToken}`,Mt=`选择代币`,Nt={"10ioi7e":e,"10v0i5g":ee,"115lknq":te,"118a77s":t,"119fv83":n,"12rnjtt":r,"12rrl0i":i,"132vna6":a,"13i9oqu":o,"13l4n4r":s,"13x5i2v":c,"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,"1g8tdk7":w,"1gi9nny":T,"1gx00do":E,"1hb73om":D,"1hdpo6q":O,"1hzmxtu":k,"1i7coq1":A,"1ih47b3":j,"1ix1b7w":M,"1ixbbo7":N,"1jhuo24":P,"1ka8utn":F,"1l0xxoj":I,"1l41ftg":L,"1m2n0pw":R,"1ne9nkz":z,"1nhkl7x":B,"1nn0owb":V,"1o1b4a8":H,"1o4ofyx":U,"1ok4m5g":W,"1olegnl":G,"1oncz6g":K,"1ovj1tk":q,"1py89j9":J,"1q45kup":Y,"1qbiehv":X,"1qisb2z":Z,"1rkfalq":Q,"1rnxx1g":ne,"1t0r88u":re,"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,"515x49":ve,"6c0jc7":ye,"6c5l2f":be,"6gkge0":xe,"6s9hn9":Se,"75id35":$,"7iskw5":Ce,"7m2ht3":we,"7v6g6x":Te,"958wsx":Ee,"982hh6":De,"9l4mg3":Oe,"9p7amh":ke,axj370:Ae,bdo3n8:je,biwlqk:Me,cgzgvn:Ne,chajkh:Pe,cjn1xs:Fe,cnwfg3:Ie,cwk7r6:Le,cx9lh3:Re,dizog6:ze,ek03j3:Be,epw9f3:`0`,evz7q4:He,f45rwo:Ue,fcy4ey:We,fo0vw0:Ge,fpand1:Ke,g7pjpv:qe,gtvgs9:Je,hzq69q:Ye,ibrnk6:Xe,ifug2i:Ze,jf8ts4:Qe,jnzipx:$e,k47stp:et,knrcsh:tt,ln9xiv:nt,mnlddk:rt,n9zkql:it,ofi1rq:at,otqba5:ot,pmqvh0:st,pom1h2:ct,q4mqcd:lt,q5w460:ut,r7v9s7:dt,rvctng:ft,sykid7:pt,t1rvqg:mt,t40bok:ht,tgp8yw:gt,tjg3i3:_t,u61kge:vt,udneg1:yt,ulp7ys:bt,va18uh:xt,vum0cd:St,w6pv1a:Ct,wuxjl9:wt,wx5bee:Tt,xel5qk:Et,xphk5n:Dt,y6jqu9:Ot,yhtv6l:kt,zkouah:At,zsopm1:jt,zz4mrw:Mt};export{Xe as _100907z,xt as _108j3sk,oe as _10lgc56,ne as _10n9ta8,p as _113vzpe,ct as _11ncipg,H as _11p3b1r,nt as _12qyh2x,B as _13ym6k2,fe as _14oyo32,b as _15vbpgm,Ce as _1640n3f,ht as _165eyp5,Ze as _16ln1wz,Fe as _16pzx0g,ke as _16rump9,M as _17g2rjk,T as _181ewwm,h as _18346vt,Ct as _18ogtk,F as _1982g2x,Dt as _1biskvr,w as _1bjtgx1,Ie as _1cmz8k7,yt as _1cpadi9,q as _1d7sodl,lt as _1e023il,c as _1e5aqjt,V as _1ea99j0,ee as _1f4czmp,be as _1f8nqa3,ce as _1f8umlr,K as _1fe46d3,we as _1fikhaa,st as _1fu9qvd,Ne as _1gfjrn0,Me as _1gma9hv,de as _1hs819x,gt as _1ht75o0,te as _1i8i0au,I as _1ib6ekl,Y as _1ievltk,dt as _1in1gel,G as _1in9ocp,Ke as _1ju6xlj,C as _1jvje3y,Oe as _1kd3yrp,k as _1kez60s,ue as _1krtsvx,at as _1kvlpuf,ye as _1l1rqi2,Q as _1l2nmmx,A as _1lra4kg,wt as _1n1igys,D as _1na1vy4,a as _1nwhws6,Be as _1o0vi1j,Ye as _1o2h7a2,s as _1o8feo7,qe as _1om32zr,S as _1oqs23j,At as _1popw3r,e as _1qamgmj,L as _1s3hwm,tt as _1s54fdc,o as _1s9ryeq,xe as _1t3gki9,E as _1uje2mm,f as _1urf8wf,t as _1w2bswr,N as _1wwy4yj,pt as _1y7hba4,ve as _1yh8ttx,y as _1yv1ajq,Tt as _3mtvnb,He as _3w8t28,re as _41y3qp,X as _454sub,ut as _49235i,W as _4itr6p,U as _4opuqb,me as _5af8qp,_ as _5r87wo,v as _78b61s,$ as _78ts6w,d as _89hoyp,Se as _8edkty,jt as _8wjab,je as _a5vz6z,ze as _al7a0k,Te as _bii6w9,De as _cakypo,Ve as _cnghfj,j as _czpegb,_t as _d7bf51,Qe as _doc1yy,u as _fdcaz1,z as _g3pfjv,Pe as _g88yty,it as _gkmqsa,l as _hyiyqa,Z as _i1jamr,g as _ide9vv,vt as _ig1w2,bt as _jj7boh,Ot as _jpt8np,ae as _kmeu9o,le as _kqdlbv,Et as _l5s0fl,$e as _l78r94,m as _ly147p,Ae as _m8t1qc,Le as _mdvri5,ot as _mq62g3,i as _nrzzox,et as _o3um2w,P as _oj2fr8,St as _p5ybee,R as _peuj54,J as _pkny2p,O as _pqml54,ge as _pr6lte,he as _q0rsrj,mt as _qm85b2,Ee as _r56hbl,x as _sf0mgy,Mt as _si8n6l,Je as _swoaip,kt as _t0vnn4,ie as _t91lwj,Ge as _ty2nen,ft as _u7tj7p,Ue as _uc0jju,n as _uu4paz,rt as _vogk37,se as _xavgbs,pe as _xkdtbf,r as _xpl7mo,_e as _ystooe,Re as _z6jr7i,We as _zzusn5,Nt 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=`嘗試選擇其他鏈或搜索特定代幣`,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}`,w=`透過 DEX 兌換中...`,T=`重新開啟支付視窗`,E=`選擇貨幣`,D=`交易失敗 — 重試`,O=`無做市商接受此訂單`,k=`返回`,A=`支付`,j=`執行中...`,M=`選擇目標代幣`,N=e=>`已在 ${e.chain} 上完成`,P=`支付已確認`,F=`購買`,I=`關閉`,L=`或使用銀行卡支付`,R=e=>`比較其他 ${e.count} 家`,z=`暫無可用報價`,B=`退款進行中`,V=e=>`在 ${e.chain} 上存入`,H=`加密貨幣`,U=`已簽名`,W=`訂單失敗`,G=`輸入金額以開始`,K=`接收地址`,q=e=>`≈ $${e.addThousandsSeparator}`,J=`存款目標`,Y=`使用信用卡或簽帳卡購買`,X=`查看所有鏈`,Z=`這可能是由於瀏覽器隱私設定阻止了第三方內容。請嘗試在新視窗中開啟支付頁面。`,Q=`兌換`,ne=`發送方`,re=`選擇支付代幣`,ie=e=>`透過 ${e.provider}`,ae=`總費用`,oe=`已支付`,se=`重試`,ce=`查看兌換`,le=`提供商正在執行訂單`,ue=`代幣兌換中`,de=e=>`正在 ${e.chain} 上退還代幣`,fe=`銀行卡`,pe=`交換代幣`,me=`法幣支付`,he=`處理中...`,ge=`購買失敗`,_e=`新購買`,ve=e=>`購買 ${e.store_targetToken}`,ye=`使用信用卡或簽帳卡付款`,be=`已上鏈確認`,xe=`錢包簽名`,Se=`發送`,$=`支付視窗無法載入`,Ce=`正在載入支付...`,we=`接收代幣所必需`,Te=`最大`,Ee=`支付`,De=`重試`,Oe=`費用`,ke=`無法完成`,Ae=`選擇代幣`,je=`完成交易`,Me=e=>`${e.seconds}秒內送達`,Ne=`使用支付`,Pe=e=>`直接購買 ${e.store_targetToken}`,Fe=`兌換成功`,Ie=`代幣已送達`,Le=`收取`,Re=`最低`,ze=`按名稱或地址搜索`,Be=e=>`~${e.value}秒`,Ve=`0`,He=`提供商`,Ue=`預計時間`,We=`餘額不足`,Ge=`此鏈地址格式無效`,Ke=`輸入目標地址`,qe=`沒有可用的代幣`,Je=`最高`,Ye=`轉帳交易`,Xe=`確認兌換`,Ze=`該代幣不支援直接刷卡購買,我們會先購買 USDC,再自動兌換為您需要的代幣。`,Qe=`報價失敗`,$e=e=>`直接購買 ${e.arg0}`,et=e=>`在 ${e.chain} 上`,tt=e=>`~${e.value}分鐘`,nt=`無可用路徑`,rt=`代幣已到帳!`,it=`等待付款`,at=e=>`透過 ${e.token} 路由以獲取最優價格`,ot=`用戶已取消`,st=`新交易`,ct=`輸入收款地址`,lt=`錢包與來源鏈不匹配`,ut=`查看`,dt=`最優價格`,ft=`您的訂單無法完成。`,pt=e=>`正在將 ${e.symbol} 發送到您的錢包...`,mt=`您的資金已退回錢包。`,ht=`已在新視窗中開啟支付`,gt=`簽名已提交`,_t=`存入交易`,vt=`連接錢包`,yt=`使用錢包中的代幣支付`,bt=`完成支付`,xt=`收到`,St=`購買完成`,Ct=`在新視窗中開啟`,wt=`所選代幣目前無法用於此次購買`,Tt=`輸入收款地址`,Et=`推薦`,Dt=`錢包帳戶`,Ot=e=>`餘額: ${e.fromBalance}`,kt=`購買完成`,At=`重試`,jt=e=>`購買 ${e.store_toToken}`,Mt=`選擇代幣`,Nt={"10ioi7e":e,"10v0i5g":ee,"115lknq":te,"118a77s":t,"119fv83":n,"12rnjtt":r,"12rrl0i":i,"132vna6":a,"13i9oqu":o,"13l4n4r":s,"13x5i2v":c,"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,"1g8tdk7":w,"1gi9nny":T,"1gx00do":E,"1hb73om":D,"1hdpo6q":O,"1hzmxtu":k,"1i7coq1":A,"1ih47b3":j,"1ix1b7w":M,"1ixbbo7":N,"1jhuo24":P,"1ka8utn":F,"1l0xxoj":I,"1l41ftg":L,"1m2n0pw":R,"1ne9nkz":z,"1nhkl7x":B,"1nn0owb":V,"1o1b4a8":H,"1o4ofyx":U,"1ok4m5g":W,"1olegnl":G,"1oncz6g":K,"1ovj1tk":q,"1py89j9":J,"1q45kup":Y,"1qbiehv":X,"1qisb2z":Z,"1rkfalq":Q,"1rnxx1g":ne,"1t0r88u":re,"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,"515x49":ve,"6c0jc7":ye,"6c5l2f":be,"6gkge0":xe,"6s9hn9":Se,"75id35":$,"7iskw5":Ce,"7m2ht3":we,"7v6g6x":Te,"958wsx":Ee,"982hh6":De,"9l4mg3":Oe,"9p7amh":ke,axj370:Ae,bdo3n8:je,biwlqk:Me,cgzgvn:Ne,chajkh:Pe,cjn1xs:Fe,cnwfg3:Ie,cwk7r6:Le,cx9lh3:Re,dizog6:ze,ek03j3:Be,epw9f3:`0`,evz7q4:He,f45rwo:Ue,fcy4ey:We,fo0vw0:Ge,fpand1:Ke,g7pjpv:qe,gtvgs9:Je,hzq69q:Ye,ibrnk6:Xe,ifug2i:Ze,jf8ts4:Qe,jnzipx:$e,k47stp:et,knrcsh:tt,ln9xiv:nt,mnlddk:rt,n9zkql:it,ofi1rq:at,otqba5:ot,pmqvh0:st,pom1h2:ct,q4mqcd:lt,q5w460:ut,r7v9s7:dt,rvctng:ft,sykid7:pt,t1rvqg:mt,t40bok:ht,tgp8yw:gt,tjg3i3:_t,u61kge:vt,udneg1:yt,ulp7ys:bt,va18uh:xt,vum0cd:St,w6pv1a:Ct,wuxjl9:wt,wx5bee:Tt,xel5qk:Et,xphk5n:Dt,y6jqu9:Ot,yhtv6l:kt,zkouah:At,zsopm1:jt,zz4mrw:Mt};export{Xe as _100907z,xt as _108j3sk,oe as _10lgc56,ne as _10n9ta8,p as _113vzpe,ct as _11ncipg,H as _11p3b1r,nt as _12qyh2x,B as _13ym6k2,fe as _14oyo32,b as _15vbpgm,Ce as _1640n3f,ht as _165eyp5,Ze as _16ln1wz,Fe as _16pzx0g,ke as _16rump9,M as _17g2rjk,T as _181ewwm,h as _18346vt,Ct as _18ogtk,F as _1982g2x,Dt as _1biskvr,w as _1bjtgx1,Ie as _1cmz8k7,yt as _1cpadi9,q as _1d7sodl,lt as _1e023il,c as _1e5aqjt,V as _1ea99j0,ee as _1f4czmp,be as _1f8nqa3,ce as _1f8umlr,K as _1fe46d3,we as _1fikhaa,st as _1fu9qvd,Ne as _1gfjrn0,Me as _1gma9hv,de as _1hs819x,gt as _1ht75o0,te as _1i8i0au,I as _1ib6ekl,Y as _1ievltk,dt as _1in1gel,G as _1in9ocp,Ke as _1ju6xlj,C as _1jvje3y,Oe as _1kd3yrp,k as _1kez60s,ue as _1krtsvx,at as _1kvlpuf,ye as _1l1rqi2,Q as _1l2nmmx,A as _1lra4kg,wt as _1n1igys,D as _1na1vy4,a as _1nwhws6,Be as _1o0vi1j,Ye as _1o2h7a2,s as _1o8feo7,qe as _1om32zr,S as _1oqs23j,At as _1popw3r,e as _1qamgmj,L as _1s3hwm,tt as _1s54fdc,o as _1s9ryeq,xe as _1t3gki9,E as _1uje2mm,f as _1urf8wf,t as _1w2bswr,N as _1wwy4yj,pt as _1y7hba4,ve as _1yh8ttx,y as _1yv1ajq,Tt as _3mtvnb,He as _3w8t28,re as _41y3qp,X as _454sub,ut as _49235i,W as _4itr6p,U as _4opuqb,me as _5af8qp,_ as _5r87wo,v as _78b61s,$ as _78ts6w,d as _89hoyp,Se as _8edkty,jt as _8wjab,je as _a5vz6z,ze as _al7a0k,Te as _bii6w9,De as _cakypo,Ve as _cnghfj,j as _czpegb,_t as _d7bf51,Qe as _doc1yy,u as _fdcaz1,z as _g3pfjv,Pe as _g88yty,it as _gkmqsa,l as _hyiyqa,Z as _i1jamr,g as _ide9vv,vt as _ig1w2,bt as _jj7boh,Ot as _jpt8np,ae as _kmeu9o,le as _kqdlbv,Et as _l5s0fl,$e as _l78r94,m as _ly147p,Ae as _m8t1qc,Le as _mdvri5,ot as _mq62g3,i as _nrzzox,et as _o3um2w,P as _oj2fr8,St as _p5ybee,R as _peuj54,J as _pkny2p,O as _pqml54,ge as _pr6lte,he as _q0rsrj,mt as _qm85b2,Ee as _r56hbl,x as _sf0mgy,Mt as _si8n6l,Je as _swoaip,kt as _t0vnn4,ie as _t91lwj,Ge as _ty2nen,ft as _u7tj7p,Ue as _uc0jju,n as _uu4paz,rt as _vogk37,se as _xavgbs,pe as _xkdtbf,r as _xpl7mo,_e as _ystooe,Re as _z6jr7i,We as _zzusn5,Nt as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenflight/swap",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
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,12 +42,12 @@
58
42
  "access": "public"
59
43
  },
60
44
  "dependencies": {
61
- "@tokenflight/api": "0.1.2"
45
+ "@tokenflight/api": "0.1.4"
62
46
  },
63
47
  "devDependencies": {
64
- "@fluenti/cli": "^0.6.1",
65
- "@fluenti/core": "^0.6.1",
66
- "@fluenti/solid": "^0.6.1",
48
+ "@fluenti/cli": "^0.6.2",
49
+ "@fluenti/core": "^0.6.2",
50
+ "@fluenti/solid": "^0.6.2",
67
51
  "@tanstack/solid-query": "^5.75.7",
68
52
  "fast-glob": "^3.3.3",
69
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";
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-D4PEwqKq.js";import"./widget-9I201q7O.js";import{n as e,t}from"./register-deposit-COFuKwk-.js";export{e as TokenFlightDeposit,t as registerDepositElement};