@tokenflight/swap 0.2.0-rc.1 → 0.2.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/en-US-d5YmzdLN.js +1 -0
- package/dist/ja-JP-83cqVPy-.js +1 -0
- package/dist/ko-KR-CjqzLa9V.js +1 -0
- package/dist/register-widget-CaJUDuje.js +3 -0
- package/dist/tokenflight-swap.d.ts +16 -0
- package/dist/tokenflight-swap.js +2 -2
- package/dist/tokenflight-swap.umd.cjs +4 -4
- package/dist/widget.d.ts +5 -0
- package/dist/widget.js +1 -1
- package/dist/zh-CN-BaBVFzvs.js +1 -0
- package/dist/zh-TW-D6aZF7b5.js +1 -0
- package/package.json +2 -2
- package/dist/en-US-qDDiLksN.js +0 -1
- package/dist/ja-JP-C_ZBjfPb.js +0 -1
- package/dist/ko-KR-BHIB7ZQf.js +0 -1
- package/dist/register-widget-BBJXAjbv.js +0 -3
- package/dist/zh-CN-DpZbMBLR.js +0 -1
- package/dist/zh-TW-CtmyKF1W.js +0 -1
|
@@ -377,6 +377,8 @@ export declare interface RegisterElementsOptions {
|
|
|
377
377
|
hideTitle?: boolean;
|
|
378
378
|
/** Default hide-powered-by flag. */
|
|
379
379
|
hidePoweredBy?: boolean;
|
|
380
|
+
/** Default hide-provider flag (hides "via {provider}" badge on the tracking page). */
|
|
381
|
+
hideProvider?: boolean;
|
|
380
382
|
/** Default no-background flag. */
|
|
381
383
|
noBackground?: boolean;
|
|
382
384
|
/** Default no-border flag. */
|
|
@@ -519,6 +521,8 @@ export declare interface TokenFlightConfigBase {
|
|
|
519
521
|
hideTitle?: boolean;
|
|
520
522
|
/** Hide "Powered by TokenFlight" footer */
|
|
521
523
|
hidePoweredBy?: boolean;
|
|
524
|
+
/** Hide the "via {provider}" badge on the order tracking page */
|
|
525
|
+
hideProvider?: boolean;
|
|
522
526
|
/** Remove container background (transparent) */
|
|
523
527
|
noBackground?: boolean;
|
|
524
528
|
/** Remove container border and shadow */
|
|
@@ -548,6 +552,7 @@ export declare interface TokenFlightDepositAttributes {
|
|
|
548
552
|
"csp-nonce"?: string;
|
|
549
553
|
"hide-title"?: BooleanAttribute;
|
|
550
554
|
"hide-powered-by"?: BooleanAttribute;
|
|
555
|
+
"hide-provider"?: BooleanAttribute;
|
|
551
556
|
"no-background"?: BooleanAttribute;
|
|
552
557
|
"no-border"?: BooleanAttribute;
|
|
553
558
|
}
|
|
@@ -593,6 +598,7 @@ export declare interface TokenFlightFiatAttributes {
|
|
|
593
598
|
icon?: string;
|
|
594
599
|
"hide-title"?: BooleanAttribute;
|
|
595
600
|
"hide-powered-by"?: BooleanAttribute;
|
|
601
|
+
"hide-provider"?: BooleanAttribute;
|
|
596
602
|
"no-background"?: BooleanAttribute;
|
|
597
603
|
"no-border"?: BooleanAttribute;
|
|
598
604
|
}
|
|
@@ -635,6 +641,7 @@ export declare interface TokenFlightReceiveAttributes {
|
|
|
635
641
|
icon?: string;
|
|
636
642
|
"hide-title"?: BooleanAttribute;
|
|
637
643
|
"hide-powered-by"?: BooleanAttribute;
|
|
644
|
+
"hide-provider"?: BooleanAttribute;
|
|
638
645
|
"no-background"?: BooleanAttribute;
|
|
639
646
|
"no-border"?: BooleanAttribute;
|
|
640
647
|
}
|
|
@@ -708,6 +715,7 @@ export declare interface TokenFlightSwapAttributes {
|
|
|
708
715
|
"csp-nonce"?: string;
|
|
709
716
|
"hide-title"?: BooleanAttribute;
|
|
710
717
|
"hide-powered-by"?: BooleanAttribute;
|
|
718
|
+
"hide-provider"?: BooleanAttribute;
|
|
711
719
|
"no-background"?: BooleanAttribute;
|
|
712
720
|
"no-border"?: BooleanAttribute;
|
|
713
721
|
}
|
|
@@ -796,6 +804,7 @@ export declare interface TokenFlightWidgetAttributes {
|
|
|
796
804
|
"csp-nonce"?: string;
|
|
797
805
|
"hide-title"?: BooleanAttribute;
|
|
798
806
|
"hide-powered-by"?: BooleanAttribute;
|
|
807
|
+
"hide-provider"?: BooleanAttribute;
|
|
799
808
|
"no-background"?: BooleanAttribute;
|
|
800
809
|
"no-border"?: BooleanAttribute;
|
|
801
810
|
}
|
|
@@ -916,6 +925,7 @@ declare const WidgetDefaultsSchema: Omit<v.ObjectSchema<{
|
|
|
916
925
|
readonly customColors: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
917
926
|
readonly hideTitle: v.BooleanSchema<undefined>;
|
|
918
927
|
readonly hidePoweredBy: v.BooleanSchema<undefined>;
|
|
928
|
+
readonly hideProvider: v.BooleanSchema<undefined>;
|
|
919
929
|
readonly noBackground: v.BooleanSchema<undefined>;
|
|
920
930
|
readonly noBorder: v.BooleanSchema<undefined>;
|
|
921
931
|
readonly methods: v.ArraySchema<v.PicklistSchema<["crypto", "card"], undefined>, undefined>;
|
|
@@ -931,6 +941,7 @@ declare const WidgetDefaultsSchema: Omit<v.ObjectSchema<{
|
|
|
931
941
|
readonly customColors: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
|
|
932
942
|
readonly hideTitle: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
933
943
|
readonly hidePoweredBy: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
944
|
+
readonly hideProvider: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
934
945
|
readonly noBackground: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
935
946
|
readonly noBorder: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
936
947
|
readonly methods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<["crypto", "card"], undefined>, undefined>, undefined>;
|
|
@@ -948,6 +959,7 @@ declare const WidgetDefaultsSchema: Omit<v.ObjectSchema<{
|
|
|
948
959
|
} | undefined;
|
|
949
960
|
hideTitle?: boolean | undefined;
|
|
950
961
|
hidePoweredBy?: boolean | undefined;
|
|
962
|
+
hideProvider?: boolean | undefined;
|
|
951
963
|
noBackground?: boolean | undefined;
|
|
952
964
|
noBorder?: boolean | undefined;
|
|
953
965
|
methods?: ("card" | "crypto")[] | undefined;
|
|
@@ -966,6 +978,7 @@ declare const WidgetDefaultsSchema: Omit<v.ObjectSchema<{
|
|
|
966
978
|
} | undefined;
|
|
967
979
|
hideTitle?: boolean | undefined;
|
|
968
980
|
hidePoweredBy?: boolean | undefined;
|
|
981
|
+
hideProvider?: boolean | undefined;
|
|
969
982
|
noBackground?: boolean | undefined;
|
|
970
983
|
noBorder?: boolean | undefined;
|
|
971
984
|
methods?: ("card" | "crypto")[] | undefined;
|
|
@@ -985,6 +998,7 @@ declare const WidgetDefaultsSchema: Omit<v.ObjectSchema<{
|
|
|
985
998
|
} | undefined;
|
|
986
999
|
hideTitle?: boolean | undefined;
|
|
987
1000
|
hidePoweredBy?: boolean | undefined;
|
|
1001
|
+
hideProvider?: boolean | undefined;
|
|
988
1002
|
noBackground?: boolean | undefined;
|
|
989
1003
|
noBorder?: boolean | undefined;
|
|
990
1004
|
methods?: ("card" | "crypto")[] | undefined;
|
|
@@ -1005,6 +1019,7 @@ declare const WidgetDefaultsSchema: Omit<v.ObjectSchema<{
|
|
|
1005
1019
|
} | undefined;
|
|
1006
1020
|
hideTitle?: boolean | undefined;
|
|
1007
1021
|
hidePoweredBy?: boolean | undefined;
|
|
1022
|
+
hideProvider?: boolean | undefined;
|
|
1008
1023
|
noBackground?: boolean | undefined;
|
|
1009
1024
|
noBorder?: boolean | undefined;
|
|
1010
1025
|
methods?: ("card" | "crypto")[] | undefined;
|
|
@@ -1024,6 +1039,7 @@ declare const WidgetDefaultsSchema: Omit<v.ObjectSchema<{
|
|
|
1024
1039
|
} | undefined;
|
|
1025
1040
|
hideTitle?: boolean | undefined;
|
|
1026
1041
|
hidePoweredBy?: boolean | undefined;
|
|
1042
|
+
hideProvider?: boolean | undefined;
|
|
1027
1043
|
noBackground?: boolean | undefined;
|
|
1028
1044
|
noBorder?: boolean | undefined;
|
|
1029
1045
|
methods?: ("card" | "crypto")[] | undefined;
|
package/dist/tokenflight-swap.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as
|
|
2
|
-
`),
|
|
1
|
+
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as ee,R as te,S as ne,T as _,U as v,V as y,W as b,X as re,Y as x,Z as ie,_ as S,_t as C,a as w,at as T,b as ae,bt as E,c as oe,ct as D,d as se,dt as O,et as ce,f as le,ft as k,g as ue,gt as de,h as fe,ht as pe,i as me,it as A,j as he,k as j,l as M,lt as N,m as P,mt as F,n as I,nt as L,o as R,ot as z,p as ge,pt as B,q as V,r as _e,rt as H,s as ve,st as U,t as W,tt as G,u as ye,ut as K,v as be,vt as q,w as xe,x as Se,y as Ce,yt as J,z as we}from"./register-widget-CaJUDuje.js";var Y=[xe,r,ne,Se,ae,Ce,be,S,ue,fe,P,ge,le,se,ye,M,oe,ve,R].join(`
|
|
2
|
+
`),Te=n((e,t,n)=>C(_,{config:e,walletAdapter:t,callbacks:n}),()=>Y),Ee=class{constructor(){this.name=`Mock Wallet`,this.icon=void 0,this.supportedActionTypes=[`eip1193_request`,`solana_signAndSendTransaction`],this.connected=!1,this.address=`0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045`,this.listeners=new Map}async connect(e){this.connected=!0,this.emit(`connect`,{address:this.address})}async disconnect(){this.connected=!1,this.emit(`disconnect`)}isConnected(e){return this.connected}async getAddress(e){return this.connected?this.address:null}async executeWalletAction(e){return await new Promise(e=>setTimeout(e,1e3)),{success:!0,txHash:`0x`+`a`.repeat(64)}}async signMessage(e){return`0x`+`b`.repeat(130)}async openAccountModal(){}on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e,t){let n=this.listeners.get(e);if(n)for(let r of n)r({type:e,data:t})}},X=x(`<style>`);function Z(e){e&&G(e),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-swap`)||I(`tokenflight-swap`,{"api-endpoint":``,"from-token":``,"to-token":``,recipient:``,"title-text":``,"title-image":``,theme:``,locale:``,"csp-nonce":``,"hide-title":!1,"hide-powered-by":!1,"hide-provider":!1,"no-background":!1,"no-border":!1},(e,{element:t})=>{let n={apiEndpoint:e[`api-endpoint`]||H()||void 0,fromToken:e[`from-token`]||void 0,toToken:e[`to-token`]||void 0,recipient:e.recipient||void 0,titleText:e[`title-text`]||void 0,titleImageUrl:e[`title-image`]||void 0,theme:e.theme||k()||`light`,locale:e.locale||N()||`en-US`,hideTitle:L(t,e[`hide-title`],`hide-title`)?F(e[`hide-title`])??!1:D(),hidePoweredBy:L(t,e[`hide-powered-by`],`hide-powered-by`)?F(e[`hide-powered-by`])??!1:z(),hideProvider:L(t,e[`hide-provider`],`hide-provider`)?F(e[`hide-provider`])??!1:U(),noBackground:L(t,e[`no-background`],`no-background`)?F(e[`no-background`])??!1:K(),noBorder:L(t,e[`no-border`],`no-border`)?F(e[`no-border`])??!1:O()},r=e[`csp-nonce`]||void 0,[i,a]=J(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);E(s(e=>{a(e===v)}));let o=t.__customColors,l=q(()=>{let t=e.theme||k()||`light`,n=(t===`auto`?i():t===`dark`)?v:b,r=T();return`${Y}\n:host { ${c(r||o?{...n,...r,...o}:n)} }`}),f=t.__walletAdapter,p=t.__callbacks;return[(()=>{var e=X();return u(e,`nonce`,r),V(e,l),e})(),C(d,{client:y,get children(){return C(_,{config:n,get walletAdapter(){return f??B()},get callbacks(){return p?{...A(),...p}:A()}})}})]}))}var De=x(`<style>`);function Oe(e){if(!e)return``;let t=e.trim();if(t.startsWith(`[`))try{let e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return t}function ke(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function Ae(e){if(e)return e.map(e=>e===`wallet`?`crypto`:`card`)}function Q(e){e&&G(e),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-deposit`)||I(`tokenflight-deposit`,{"api-endpoint":``,target:``,amount:``,"from-token":``,recipient:``,methods:``,"target-icon":``,"fiat-currency":``,"title-text":``,"title-image":``,theme:``,locale:``,"csp-nonce":``,"hide-title":!1,"hide-powered-by":!1,"hide-provider":!1,"no-background":!1,"no-border":!1},(e,{element:t})=>{let n=ke(e.methods),r={apiEndpoint:e[`api-endpoint`]||H()||void 0,toToken:Oe(e.target),fromToken:e[`from-token`]||void 0,tradeType:e.amount?`EXACT_OUTPUT`:`EXACT_INPUT`,amount:e.amount||void 0,recipient:e.recipient||void 0,methods:Ae(n),icon:e[`target-icon`]||void 0,fiatCurrency:e[`fiat-currency`]||void 0,titleText:e[`title-text`]||void 0,titleImageUrl:e[`title-image`]||void 0,theme:e.theme||k()||`light`,locale:e.locale||N()||`en-US`,hideTitle:L(t,e[`hide-title`],`hide-title`)?F(e[`hide-title`])??!1:D(),hidePoweredBy:L(t,e[`hide-powered-by`],`hide-powered-by`)?F(e[`hide-powered-by`])??!1:z(),hideProvider:L(t,e[`hide-provider`],`hide-provider`)?F(e[`hide-provider`])??!1:U(),noBackground:L(t,e[`no-background`],`no-background`)?F(e[`no-background`])??!1:K(),noBorder:L(t,e[`no-border`],`no-border`)?F(e[`no-border`])??!1:O()},i=e[`csp-nonce`]||void 0,[a,o]=J(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);E(s(e=>{o(e===v)}));let l=t.__customColors,f=q(()=>{let t=e.theme||k()||`light`,n=(t===`auto`?a():t===`dark`)?v:b,r=T();return`${me}\n:host { ${c(r||l?{...n,...r,...l}:n)} }`}),p=t.__walletAdapter,m=t.__callbacks;return[(()=>{var e=De();return u(e,`nonce`,i),V(e,f),e})(),C(d,{client:y,get children(){return C(w,{config:r,get walletAdapter(){return p??B()},get callbacks(){return m?{...A(),...m}:A()}})}})]}))}function $(e={}){G(e),Z(),Q(),W()}typeof window<`u`&&$();export{ee as DEFAULT_API_ENDPOINT,ce as ErrorCode,Ee as MockWalletAdapter,t as SOLANA_CHAIN_ID,e as TERMINAL_FIAT_STATUSES,ie as TERMINAL_ORDER_STATUSES,re as TokenFlightError,Te as TokenFlightSwap,_e as TokenFlightWidget,o as addThousandsSeparator,a as buildOffersForRanking,j as clearTokenCache,l as computeExchangeRate,f as formatDisplayAmount,i as getBestOverallRouteId,he as getChainType,de as getDefaults,p as isCrossChainSwap,m as isEvmChain,g as isSolanaChain,h as rankOffers,Q as registerDepositElement,$ as registerElements,Z as registerSwapElement,W as registerWidgetElement,pe as setTextOverrides,te as toBaseUnits,we as toDisplayAmount};
|