import CloseIcon from "../../asset/icon/Close--small.svg"; import animationData from "./lotties/Animation.json"; import lottie from "lottie-web"; import styles from "./_defly-wallet-sign-txn-toast.scss"; import { DEFLY_WALLET_SIGN_TXN_TOAST_ID, removeModalWrapperFromDOM } from "../deflyWalletConnectModalUtils"; const deflyWalletSignTxnToastTemplate = document.createElement("template"); deflyWalletSignTxnToastTemplate.innerHTML = `

Please launch Defly Wallet on your iOS or Android device to sign this transaction.

`; export class DeflyWalletSignTxnToast extends HTMLElement { constructor() { super(); this.attachShadow({mode: "open"}); if (this.shadowRoot) { const styleSheet = document.createElement("style"); styleSheet.textContent = styles; this.shadowRoot.append( deflyWalletSignTxnToastTemplate.content.cloneNode(true), styleSheet ); const closeButton = this.shadowRoot.getElementById( "defly-wallet-sign-txn-toast-close-button" ); closeButton?.addEventListener("click", () => { removeModalWrapperFromDOM(DEFLY_WALLET_SIGN_TXN_TOAST_ID); }); this.renderLottieAnimation(); } } renderLottieAnimation() { const lottieWrapper = this.shadowRoot?.getElementById( "defly-wallet-sign-txn-toast-lottie-animation" ); if (lottieWrapper) { lottie.loadAnimation({ container: lottieWrapper, renderer: "svg", loop: true, autoplay: true, animationData }); } } }