@swapper-finance/deposit-sdk 0.0.7 → 0.1.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/README.md +1 -1
- package/dist/SwapperModal.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +4 -24
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/SwapperModal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SwapperIframe}from"./SwapperIframe";export class SwapperModal{constructor(e){this.iframe=null,this.overlay=null,this.modalContainer=null,this.iframeContainer=null,this.isOpen=!1,this.options=e}open(){this.isOpen||(this.createModal(),this.isOpen=!0)}close(){this.isOpen&&(this.destroyModal(),this.isOpen=!1,this.options.onClose&&this.options.onClose())}isModalOpen(){return this.isOpen}getIframe(){return this.iframe}createModal(){const e=this.options.modalStyle||{};if(this.overlay=document.createElement("div"),this.overlay.style.cssText=`\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: ${e.overlayColor||"rgba(0, 0, 0, 0.7)"};\n z-index: ${e.zIndex||1e4};\n display: flex;\n align-items: center;\n justify-content: center;\n animation: swapper-fade-in 0.2s ease-out;\n `,!document.getElementById("swapper-modal-styles")){const e=document.createElement("style");e.id="swapper-modal-styles",e.textContent="\n @keyframes swapper-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes swapper-scale-in {\n from {\n transform: scale(0.95);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n }\n ",document.head.appendChild(e)}this.overlay.addEventListener("click",e=>{e.target===this.overlay&&this.close()});const t=e=>{"Escape"===e.key&&(this.close(),document.removeEventListener("keydown",t))};if(document.addEventListener("keydown",t),this.modalContainer=document.createElement("div"),this.modalContainer.style.cssText=`\n position: relative;\n width: ${e.width||"
|
|
1
|
+
import{SwapperIframe}from"./SwapperIframe";export class SwapperModal{constructor(e){this.iframe=null,this.overlay=null,this.modalContainer=null,this.iframeContainer=null,this.isOpen=!1,this.options=e}open(){this.isOpen||(this.createModal(),this.isOpen=!0)}close(){this.isOpen&&(this.destroyModal(),this.isOpen=!1,this.options.onClose&&this.options.onClose())}isModalOpen(){return this.isOpen}getIframe(){return this.iframe}createModal(){const e=this.options.modalStyle||{};if(this.overlay=document.createElement("div"),this.overlay.style.cssText=`\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: ${e.overlayColor||"rgba(0, 0, 0, 0.7)"};\n z-index: ${e.zIndex||1e4};\n display: flex;\n align-items: center;\n justify-content: center;\n animation: swapper-fade-in 0.2s ease-out;\n `,!document.getElementById("swapper-modal-styles")){const e=document.createElement("style");e.id="swapper-modal-styles",e.textContent="\n @keyframes swapper-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes swapper-scale-in {\n from {\n transform: scale(0.95);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n }\n ",document.head.appendChild(e)}this.overlay.addEventListener("click",e=>{e.target===this.overlay&&this.close()});const t=e=>{"Escape"===e.key&&(this.close(),document.removeEventListener("keydown",t))};if(document.addEventListener("keydown",t),this.modalContainer=document.createElement("div"),this.modalContainer.style.cssText=`\n position: relative;\n width: ${e.width||"450px"};\n height: ${e.height||"560px"};\n background: transparent;\n border-radius: ${e.borderRadius||"16px"};\n overflow: hidden;\n animation: swapper-scale-in 0.3s ease-out;\n `,!0===e.showCloseButton){const t=document.createElement("button");t.innerHTML="×",t.style.cssText=`\n position: absolute;\n top: 12px;\n right: 12px;\n width: 32px;\n height: 32px;\n border: none;\n background: rgba(0, 0, 0, 0.5);\n color: white;\n font-size: 24px;\n line-height: 1;\n border-radius: 50%;\n cursor: pointer;\n z-index: ${(e.zIndex||1e4)+1};\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background 0.2s ease;\n `,t.onmouseover=()=>{t.style.background="rgba(0, 0, 0, 0.7)"},t.onmouseout=()=>{t.style.background="rgba(0, 0, 0, 0.5)"},t.onclick=()=>this.close(),this.modalContainer.appendChild(t)}this.iframeContainer=document.createElement("div"),this.iframeContainer.style.cssText="\n width: 100%;\n height: 100%;\n ",this.modalContainer.appendChild(this.iframeContainer),this.overlay.appendChild(this.modalContainer),document.body.appendChild(this.overlay),document.body.style.overflow="hidden",this.iframe=new SwapperIframe({container:this.iframeContainer,integratorId:this.options.integratorId,dstChainId:this.options.dstChainId,dstTokenAddr:this.options.dstTokenAddr,depositWalletAddress:this.options.depositWalletAddress,styles:this.options.styles,customContractCalls:this.options.customContractCalls,supportedDepositOptions:this.options.supportedDepositOptions,webhookUrl:this.options.webhookUrl,iframeUrl:this.options.iframeUrl,iframeAttributes:{...this.options.iframeAttributes,width:"100%",height:"100%"}})}destroyModal(){this.iframe&&(this.iframe.destroy(),this.iframe=null),this.overlay&&this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay),document.body.style.overflow="",this.overlay=null,this.modalContainer=null,this.iframeContainer=null}destroy(){this.close()}}export function openSwapperModal(e){const t=new SwapperModal(e);return t.open(),t}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { SwapperIframe } from "./SwapperIframe";
|
|
2
2
|
export { SwapperModal, openSwapperModal } from "./SwapperModal";
|
|
3
3
|
export type { SwapperModalOptions } from "./SwapperModal";
|
|
4
|
-
export { ThemeMode,
|
|
4
|
+
export { ThemeMode, ComponentStyles, SwapperStyles, SupportedDepositOption, ContractCallType, ContractCall, SwapperConfig, SwapperIframeOptions, SwapperEvent, SwapperEventHandler, } from "./types";
|
|
5
5
|
export { approve, transfer, transferFrom, approveBalance, transferBalance, } from "./helpers";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAChE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACL,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAChE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACL,SAAS,EACT,eAAe,EACf,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,OAAO,EACP,QAAQ,EACR,YAAY,EAEZ,cAAc,EACd,eAAe,GAChB,MAAM,WAAW,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAKL,gBAAgB,GAMjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,OAAO,EACP,QAAQ,EACR,YAAY,EAEZ,cAAc,EACd,eAAe,GAChB,MAAM,WAAW,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,34 +1,14 @@
|
|
|
1
1
|
export type ThemeMode = "light" | "dark";
|
|
2
|
-
export interface BrandTheme {
|
|
3
|
-
primaryColor?: string;
|
|
4
|
-
secondaryColor?: string;
|
|
5
|
-
}
|
|
6
2
|
export interface ComponentStyles {
|
|
7
|
-
backgroundColor?: string;
|
|
8
|
-
borderRadius?: string;
|
|
9
|
-
width?: string;
|
|
10
|
-
textColor?: string;
|
|
11
|
-
primaryButtonBackground?: string;
|
|
12
|
-
primaryButtonText?: string;
|
|
13
|
-
secondaryButtonBackground?: string;
|
|
14
|
-
secondaryButtonText?: string;
|
|
15
|
-
disabledButtonBackground?: string;
|
|
16
|
-
disabledButtonText?: string;
|
|
17
|
-
successColor?: string;
|
|
18
|
-
warningColor?: string;
|
|
19
|
-
errorColor?: string;
|
|
20
3
|
primaryColor?: string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
inputBorder?: string;
|
|
24
|
-
cardBackground?: string;
|
|
25
|
-
borderColor?: string;
|
|
4
|
+
primaryBorderColor?: string;
|
|
5
|
+
accentColor?: string;
|
|
26
6
|
}
|
|
27
7
|
export interface SwapperStyles {
|
|
28
8
|
themeMode?: ThemeMode;
|
|
29
|
-
|
|
9
|
+
componentStyles?: ComponentStyles;
|
|
30
10
|
}
|
|
31
|
-
export type SupportedDepositOption = "transferCrypto" | "depositWithCash";
|
|
11
|
+
export type SupportedDepositOption = "transferCrypto" | "depositWithCash" | "walletDeposit";
|
|
32
12
|
export declare enum ContractCallType {
|
|
33
13
|
DEFAULT = 0,
|
|
34
14
|
FULL_TOKEN_BALANCE = 1,
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,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,CAAC,EAAE,MAAM,CAAC;IAKnB,gBAAgB,CAAC,EAAE;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;KACnC,CAAC;CACH;AAKD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAKD,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAwCA,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,6DAAW,CAAA;IACX,mFAAsB,CAAA;IACtB,qFAAuB,CAAA;IACvB,yFAAyB,CAAA;AAC3B,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B"}
|