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AS,cAG/C,oBAAXpR,QACPA,OAAO4J,SAASO,OAAOiH,SAAS,gBASDpR,OAAO4J,SAASO,OAExC,uBACT,C","sources":["../node_modules/@thirdweb-dev/react/node_modules/@thirdweb-dev/wallets/dist/embedded-wallet-410d94f4.browser.esm.js","../node_modules/@paperxyz/sdk-common-utilities/src/constants/blockchain.ts","../node_modules/@paperxyz/sdk-common-utilities/src/constants/settings.ts"],"sourcesContent":["import { _ as _defineProperty } from './defineProperty-350fc508.browser.esm.js';\nimport { ChainToPublicRpc } from '@paperxyz/sdk-common-utilities';\nimport { Signer, getDefaultProvider } from 'ethers';\nimport { defineReadOnly } from 'ethers/lib/utils';\nimport { getDefaultGasOverrides } from '@thirdweb-dev/sdk';\n\n/**\n * @internal\n */\nconst EMBEDDED_WALLET_PATH = \"/sdk/2022-08-12/embedded-wallet\";\n/**\n * @internal\n */\nconst GET_IFRAME_BASE_URL = () => {\n if (!!(localStorage.getItem(\"IS_THIRDWEB_DEV\") === \"true\")) {\n return window.localStorage.getItem(\"THIRDWEB_DEV_URL\") ?? \"http://localhost:3000\";\n }\n return `https://embedded-wallet.thirdweb.com`;\n};\n/**\n * @internal\n */\nconst WALLET_USER_DETAILS_LOCAL_STORAGE_NAME = clientId => `thirdwebEwsWalletUserDetails-${clientId}`;\n\n/**\n * @internal\n */\nconst WALLET_USER_ID_LOCAL_STORAGE_NAME = clientId => `thirdwebEwsWalletUserId-${clientId}`;\n\n/**\n * @internal\n */\nconst AUTH_TOKEN_LOCAL_STORAGE_PREFIX = \"walletToken\";\n\n/**\n * @internal\n */\nconst AUTH_TOKEN_LOCAL_STORAGE_NAME = clientId => {\n return `${AUTH_TOKEN_LOCAL_STORAGE_PREFIX}-${clientId}`;\n};\n\n/**\n * @internal\n */\nconst DEVICE_SHARE_LOCAL_STORAGE_PREFIX = \"a\";\n\n/**\n * @internal\n */\nconst DEVICE_SHARE_LOCAL_STORAGE_NAME = (clientId, userId) => `${DEVICE_SHARE_LOCAL_STORAGE_PREFIX}-${clientId}-${userId}`;\n\n/**\n * @internal\n */\nconst DEVICE_SHARE_LOCAL_STORAGE_NAME_DEPRECATED = clientId => `${DEVICE_SHARE_LOCAL_STORAGE_PREFIX}-${clientId}`;\n\nlet RecoveryShareManagement = /*#__PURE__*/function (RecoveryShareManagement) {\n RecoveryShareManagement[\"USER_MANAGED\"] = \"USER_MANAGED\";\n RecoveryShareManagement[\"CLOUD_MANAGED\"] = \"AWS_MANAGED\";\n return RecoveryShareManagement;\n}({});\nlet AuthProvider = /*#__PURE__*/function (AuthProvider) {\n AuthProvider[\"COGNITO\"] = \"Cognito\";\n AuthProvider[\"GOOGLE\"] = \"Google\";\n AuthProvider[\"EMAIL_OTP\"] = \"EmailOtp\";\n AuthProvider[\"CUSTOM_JWT\"] = \"CustomJWT\";\n AuthProvider[\"CUSTOM_AUTH_ENDPOINT\"] = \"CustomAuthEndpoint\";\n AuthProvider[\"FACEBOOK\"] = \"Facebook\";\n AuthProvider[\"APPLE\"] = \"Apple\";\n return AuthProvider;\n}({});\n\n/**\n * @internal\n */\n\n// TODO: Clean up tech debt of random type Objects\n// E.g. StoredTokenType is really not used anywhere but it exists as this object for legacy reason\n\n// Class constructor types\n// types for class constructors still a little messy right now.\n// Open to PRs from whoever sees this and knows of a cleaner way to handle things\n\n// Auth Types\n\n// Embedded Wallet Types\nlet UserWalletStatus = /*#__PURE__*/function (UserWalletStatus) {\n UserWalletStatus[\"LOGGED_OUT\"] = \"Logged Out\";\n UserWalletStatus[\"LOGGED_IN_WALLET_UNINITIALIZED\"] = \"Logged In, Wallet Uninitialized\";\n UserWalletStatus[\"LOGGED_IN_NEW_DEVICE\"] = \"Logged In, New Device\";\n UserWalletStatus[\"LOGGED_IN_WALLET_INITIALIZED\"] = \"Logged In, Wallet Initialized\";\n return UserWalletStatus;\n}({});\n\n/**\n * @internal\n */\n\n// ! Types seem repetitive, but the name should identify which goes where\n// this is the return type from the EmbeddedWallet Class getUserWalletStatus method iframe call\n\n// this is the return type from the EmbeddedWallet Class getUserWalletStatus method\n\nconst data = new Map();\nclass LocalStorage {\n constructor(_ref) {\n let {\n clientId\n } = _ref;\n this.isSupported = !!window.localStorage;\n this.clientId = clientId;\n }\n async getItem(key) {\n if (this.isSupported) {\n return window.localStorage.getItem(key);\n } else {\n return data.get(key) ?? null;\n }\n }\n async setItem(key, value) {\n if (this.isSupported) {\n return window.localStorage.setItem(key, value);\n } else {\n data.set(key, value);\n }\n }\n async removeItem(key) {\n const item = await this.getItem(key);\n if (this.isSupported && item) {\n window.localStorage.removeItem(key);\n return true;\n }\n return false;\n }\n async saveAuthCookie(cookie) {\n await this.setItem(AUTH_TOKEN_LOCAL_STORAGE_NAME(this.clientId), cookie);\n }\n async getAuthCookie() {\n return this.getItem(AUTH_TOKEN_LOCAL_STORAGE_NAME(this.clientId));\n }\n async removeAuthCookie() {\n return this.removeItem(AUTH_TOKEN_LOCAL_STORAGE_NAME(this.clientId));\n }\n async saveDeviceShare(share, userId) {\n await this.saveWalletUserId(userId);\n await this.setItem(DEVICE_SHARE_LOCAL_STORAGE_NAME(this.clientId, userId), share);\n }\n async getDeviceShare() {\n const userId = await this.getWalletUserId();\n if (userId) {\n return this.getItem(DEVICE_SHARE_LOCAL_STORAGE_NAME(this.clientId, userId));\n }\n return null;\n }\n async removeDeviceShare() {\n const userId = await this.getWalletUserId();\n if (userId) {\n return this.removeItem(DEVICE_SHARE_LOCAL_STORAGE_NAME(this.clientId, userId));\n }\n return false;\n }\n async getWalletUserId() {\n return this.getItem(WALLET_USER_ID_LOCAL_STORAGE_NAME(this.clientId));\n }\n async saveWalletUserId(userId) {\n await this.setItem(WALLET_USER_ID_LOCAL_STORAGE_NAME(this.clientId), userId);\n }\n async removeWalletUserId() {\n return this.removeItem(WALLET_USER_ID_LOCAL_STORAGE_NAME(this.clientId));\n }\n}\n\nfunction sleep(seconds) {\n return new Promise(resolve => {\n setTimeout(resolve, seconds * 1000);\n });\n}\nconst iframeBaseStyle = {\n height: \"100%\",\n width: \"100%\",\n border: \"none\",\n backgroundColor: \"transparent\",\n colorScheme: \"light\",\n position: \"fixed\",\n top: \"0px\",\n right: \"0px\",\n zIndex: \"2147483646\",\n display: \"none\"\n};\n\n// Global var to help track iframe state\nconst isIframeLoaded = new Map();\nclass IframeCommunicator {\n constructor(_ref) {\n let {\n link,\n iframeId,\n container = document.body,\n iframeStyles,\n onIframeInitialize\n } = _ref;\n _defineProperty(this, \"POLLING_INTERVAL_SECONDS\", 1.4);\n this.iframeBaseUrl = GET_IFRAME_BASE_URL();\n\n // Creating the IFrame element for communication\n let iframe = document.getElementById(iframeId);\n const hrefLink = new URL(link);\n const sdkVersion = \"2.5.16\";\n hrefLink.searchParams.set(\"sdkVersion\", sdkVersion);\n if (!iframe || iframe.src !== hrefLink.href) {\n // ! Do not update the hrefLink here or it'll cause multiple re-renders\n if (!iframe) {\n iframe = document.createElement(\"iframe\");\n const mergedIframeStyles = {\n ...iframeBaseStyle,\n ...iframeStyles\n };\n Object.assign(iframe.style, mergedIframeStyles);\n iframe.setAttribute(\"id\", iframeId);\n iframe.setAttribute(\"fetchpriority\", \"high\");\n container.appendChild(iframe);\n }\n iframe.src = hrefLink.href;\n iframe.setAttribute(\"data-version\", sdkVersion);\n const onIframeLoaded = event => {\n if (event.data.eventType === \"ewsIframeLoaded\") {\n window.removeEventListener(\"message\", onIframeLoaded);\n if (!iframe) {\n console.warn(\"thirdweb Iframe not found\");\n return;\n }\n this.onIframeLoadHandler(iframe, onIframeInitialize)();\n }\n };\n window.addEventListener(\"message\", onIframeLoaded);\n }\n this.iframe = iframe;\n }\n async onIframeLoadedInitVariables() {\n return {};\n }\n onIframeLoadHandler(iframe, onIframeInitialize) {\n return async () => {\n const promise = new Promise(async (res, rej) => {\n const channel = new MessageChannel();\n channel.port1.onmessage = event => {\n const {\n data\n } = event;\n channel.port1.close();\n if (!data.success) {\n return rej(new Error(data.error));\n }\n isIframeLoaded.set(iframe.src, true);\n if (onIframeInitialize) {\n onIframeInitialize();\n }\n return res(true);\n };\n const INIT_IFRAME_EVENT = \"initIframe\";\n iframe?.contentWindow?.postMessage(\n // ? We initialise the iframe with a bunch\n // of useful information so that we don't have to pass it\n // through in each of the future call. This would be where we do it.\n {\n eventType: INIT_IFRAME_EVENT,\n data: await this.onIframeLoadedInitVariables()\n }, this.iframeBaseUrl, [channel.port2]);\n });\n await promise;\n };\n }\n async call(_ref2) {\n let {\n procedureName,\n params,\n showIframe = false\n } = _ref2;\n while (!isIframeLoaded.get(this.iframe.src)) {\n await sleep(this.POLLING_INTERVAL_SECONDS);\n }\n if (showIframe) {\n this.iframe.style.display = \"block\";\n // magic number to let the display render before performing the animation of the modal in\n await sleep(0.005);\n }\n const promise = new Promise((res, rej) => {\n const channel = new MessageChannel();\n channel.port1.onmessage = async event => {\n const {\n data\n } = event;\n channel.port1.close();\n if (showIframe) {\n // magic number to let modal fade out before hiding it\n await sleep(0.1);\n this.iframe.style.display = \"none\";\n }\n if (!data.success) {\n rej(new Error(data.error));\n } else {\n res(data.data);\n }\n };\n this.iframe.contentWindow?.postMessage({\n eventType: procedureName,\n data: params\n }, this.iframeBaseUrl, [channel.port2]);\n });\n return promise;\n }\n\n /**\n * This has to be called by any iframe that will be removed from the DOM.\n * Use to make sure that we reset the global loaded state of the particular iframe.src\n */\n destroy() {\n isIframeLoaded.delete(this.iframe.src);\n }\n}\n\nclass EmbeddedWalletIframeCommunicator extends IframeCommunicator {\n constructor(_ref) {\n let {\n clientId,\n customizationOptions\n } = _ref;\n super({\n iframeId: EMBEDDED_WALLET_IFRAME_ID,\n link: createEmbeddedWalletIframeLink({\n clientId,\n path: EMBEDDED_WALLET_PATH,\n queryParams: customizationOptions\n }).href,\n container: document.body\n });\n this.clientId = clientId;\n }\n async onIframeLoadedInitVariables() {\n const localStorage = new LocalStorage({\n clientId: this.clientId\n });\n return {\n authCookie: await localStorage.getAuthCookie(),\n deviceShareStored: await localStorage.getDeviceShare(),\n walletUserId: await localStorage.getWalletUserId(),\n clientId: this.clientId\n };\n }\n}\n\n// This is the URL and ID tag of the iFrame that we communicate with\nfunction createEmbeddedWalletIframeLink(_ref2) {\n let {\n clientId,\n path,\n queryParams\n } = _ref2;\n const embeddedWalletUrl = new URL(`${path}`, GET_IFRAME_BASE_URL());\n if (queryParams) {\n for (const queryKey of Object.keys(queryParams)) {\n embeddedWalletUrl.searchParams.set(queryKey, queryParams[queryKey]?.toString() || \"\");\n }\n }\n embeddedWalletUrl.searchParams.set(\"clientId\", clientId);\n return embeddedWalletUrl;\n}\nconst EMBEDDED_WALLET_IFRAME_ID = \"thirdweb-embedded-wallet-iframe\";\n\nclass AbstractLogin {\n /**\n * Used to manage the user's auth states. This should not be instantiated directly.\n * Call {@link EmbeddedWalletSdk.auth} instead.\n *\n */\n constructor(_ref) {\n let {\n querier,\n preLogin,\n postLogin,\n clientId\n } = _ref;\n this.LoginQuerier = querier;\n this.preLogin = preLogin;\n this.postLogin = postLogin;\n this.clientId = clientId;\n }\n async sendEmailLoginOtp(_ref2) {\n let {\n email\n } = _ref2;\n await this.preLogin();\n const result = await this.LoginQuerier.call({\n procedureName: \"sendThirdwebEmailLoginOtp\",\n params: {\n email\n }\n });\n return result;\n }\n async sendSmsLoginOtp(_ref3) {\n let {\n phoneNumber\n } = _ref3;\n await this.preLogin();\n const result = await this.LoginQuerier.call({\n procedureName: \"sendThirdwebSmsLoginOtp\",\n params: {\n phoneNumber\n }\n });\n return result;\n }\n}\n\nclass BaseLogin extends AbstractLogin {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"closeWindow\", _ref => {\n let {\n isWindowOpenedByFn,\n win,\n closeOpenedWindow\n } = _ref;\n if (isWindowOpenedByFn) {\n win?.close();\n } else {\n if (win && closeOpenedWindow) {\n closeOpenedWindow(win);\n } else if (win) {\n win.close();\n }\n }\n });\n }\n async getOauthLoginUrl(authProvider) {\n const result = await this.LoginQuerier.call({\n procedureName: \"getHeadlessOauthLoginLink\",\n params: {\n authProvider\n }\n });\n return result;\n }\n async loginWithModal() {\n await this.preLogin();\n const result = await this.LoginQuerier.call({\n procedureName: \"loginWithThirdwebModal\",\n params: undefined,\n showIframe: true\n });\n return this.postLogin(result);\n }\n async loginWithEmailOtp(_ref2) {\n let {\n email\n } = _ref2;\n await this.preLogin();\n const result = await this.LoginQuerier.call({\n procedureName: \"loginWithThirdwebModal\",\n params: {\n email\n },\n showIframe: true\n });\n return this.postLogin(result);\n }\n getOauthPopUpSizing(authProvider) {\n switch (authProvider) {\n case AuthProvider.FACEBOOK:\n return \"width=715, height=555\";\n default:\n return \"width=350, height=500\";\n }\n }\n async loginWithOauth(args) {\n let win = args?.openedWindow;\n let isWindowOpenedByFn = false;\n if (!win) {\n win = window.open(\"\", \"Login\", this.getOauthPopUpSizing(args.oauthProvider));\n isWindowOpenedByFn = true;\n }\n if (!win) {\n throw new Error(\"Something went wrong opening pop-up\");\n }\n // logout the user\n // fetch the url to open the login window from iframe\n const [{\n loginLink\n }] = await Promise.all([this.getOauthLoginUrl(args.oauthProvider), this.preLogin()]);\n win.location.href = loginLink;\n // listen to result from the login window\n const result = await new Promise((resolve, reject) => {\n // detect when the user closes the login window\n const pollTimer = window.setInterval(async () => {\n if (!win) {\n return;\n }\n if (win.closed) {\n clearInterval(pollTimer);\n window.removeEventListener(\"message\", messageListener);\n reject(new Error(\"User closed login window\"));\n }\n }, 1000);\n const messageListener = async event => {\n if (event.origin !== GET_IFRAME_BASE_URL()) {\n return;\n }\n if (typeof event.data !== \"object\") {\n reject(new Error(\"Invalid event data\"));\n return;\n }\n switch (event.data.eventType) {\n case \"userLoginSuccess\":\n {\n window.removeEventListener(\"message\", messageListener);\n clearInterval(pollTimer);\n this.closeWindow({\n isWindowOpenedByFn,\n win,\n closeOpenedWindow: args?.closeOpenedWindow\n });\n if (event.data.authResult) {\n resolve(event.data.authResult);\n }\n break;\n }\n case \"userLoginFailed\":\n {\n window.removeEventListener(\"message\", messageListener);\n clearInterval(pollTimer);\n this.closeWindow({\n isWindowOpenedByFn,\n win,\n closeOpenedWindow: args?.closeOpenedWindow\n });\n reject(new Error(event.data.error));\n break;\n }\n case \"injectDeveloperClientId\":\n {\n win?.postMessage({\n eventType: \"injectDeveloperClientIdResult\",\n developerClientId: this.clientId,\n authOption: args.oauthProvider\n }, GET_IFRAME_BASE_URL());\n break;\n }\n }\n };\n window.addEventListener(\"message\", messageListener);\n });\n return this.postLogin({\n storedToken: {\n ...result.storedToken,\n shouldStoreCookieString: true\n },\n walletDetails: {\n ...result.walletDetails,\n isIframeStorageEnabled: false\n }\n });\n }\n async loginWithCustomJwt(_ref3) {\n let {\n encryptionKey,\n jwt\n } = _ref3;\n await this.preLogin();\n const result = await this.LoginQuerier.call({\n procedureName: \"loginWithCustomJwt\",\n params: {\n encryptionKey,\n jwt\n }\n });\n return this.postLogin(result);\n }\n async loginWithCustomAuthEndpoint(_ref4) {\n let {\n encryptionKey,\n payload\n } = _ref4;\n await this.preLogin();\n const result = await this.LoginQuerier.call({\n procedureName: \"loginWithCustomAuthEndpoint\",\n params: {\n encryptionKey,\n payload\n }\n });\n return this.postLogin(result);\n }\n async verifyEmailLoginOtp(_ref5) {\n let {\n email,\n otp,\n recoveryCode\n } = _ref5;\n const result = await this.LoginQuerier.call({\n procedureName: \"verifyThirdwebEmailLoginOtp\",\n params: {\n email,\n otp,\n recoveryCode\n }\n });\n return this.postLogin(result);\n }\n async verifySmsLoginOtp(_ref6) {\n let {\n phoneNumber,\n otp,\n recoveryCode\n } = _ref6;\n const result = await this.LoginQuerier.call({\n procedureName: \"verifyThirdwebSmsLoginOtp\",\n params: {\n phoneNumber,\n otp,\n recoveryCode\n }\n });\n return this.postLogin(result);\n }\n}\n\nclass Auth {\n /**\n * Used to manage the user's auth states. This should not be instantiated directly.\n * Call {@link EmbeddedWalletSdk.auth} instead.\n */\n constructor(_ref) {\n let {\n clientId,\n querier,\n onAuthSuccess\n } = _ref;\n this.clientId = clientId;\n this.AuthQuerier = querier;\n this.localStorage = new LocalStorage({\n clientId\n });\n this.onAuthSuccess = onAuthSuccess;\n this.BaseLogin = new BaseLogin({\n postLogin: async result => {\n return this.postLogin(result);\n },\n preLogin: async () => {\n await this.preLogin();\n },\n querier: querier,\n clientId\n });\n }\n async preLogin() {\n await this.logout();\n }\n async postLogin(_ref2) {\n let {\n storedToken,\n walletDetails\n } = _ref2;\n if (storedToken.shouldStoreCookieString) {\n await this.localStorage.saveAuthCookie(storedToken.cookieString);\n }\n const initializedUser = await this.onAuthSuccess({\n storedToken,\n walletDetails\n });\n return initializedUser;\n }\n\n /**\n * Used to log the user into their thirdweb wallet on your platform via a myriad of auth providers\n *\n * @example\n * ```typescript\n * const thirdwebEmbeddedWallet = new EmbeddedWalletSdk({clientId: \"YOUR_CLIENT_ID\", chain: \"Polygon\"})\n * try {\n * const user = await thirdwebEmbeddedWallet.auth.loginWithModal();\n * // user is now logged in\n * } catch (e) {\n * // User closed modal or something else went wrong during the authentication process\n * console.error(e)\n * }\n * ```\n *\n * @returns `{{user: InitializedUser}}` An InitializedUser object. See {@link EmbeddedWalletSdk.getUser} for more\n */\n async loginWithModal() {\n return this.BaseLogin.loginWithModal();\n }\n\n /**\n * Used to log the user into their thirdweb wallet using email OTP\n *\n * @example\n * ```typescript\n * // Basic Flow\n * const thirdwebEmbeddedWallet = new EmbeddedWalletSdk({clientId: \"\", chain: \"Polygon\"});\n * try {\n * // prompts user to enter the code they received\n * const user = await thirdwebEmbeddedWallet.auth.loginWithThirdwebEmailOtp({ email : \"you@example.com\" });\n * // user is now logged in\n * } catch (e) {\n * // User closed the OTP modal or something else went wrong during the authentication process\n * console.error(e)\n * }\n * ```\n *\n * @param args - args.email: We will send the email an OTP that needs to be entered in order for them to be logged in.\n * @returns `{{user: InitializedUser}}` An InitializedUser object. See {@link EmbeddedWalletSdk.getUser} for more\n */\n async loginWithEmailOtp(args) {\n return this.BaseLogin.loginWithEmailOtp(args);\n }\n async loginWithCustomJwt(args) {\n return this.BaseLogin.loginWithCustomJwt(args);\n }\n async loginWithCustomAuthEndpoint(args) {\n return this.BaseLogin.loginWithCustomAuthEndpoint(args);\n }\n async loginWithOauth(args) {\n return this.BaseLogin.loginWithOauth(args);\n }\n\n /**\n * A headless way to send the users at the passed email an OTP code.\n * You need to then call {@link Auth.verifyEmailLoginOtp} in order to complete the login process\n *\n * @example\n * ```typescript\n * const thirdwebEmbeddedWallet = new EmbeddedWalletSdk({clientId: \"\", chain: \"Polygon\"});\n * // sends user an OTP code\n * try {\n * await thirdwebEmbeddedWallet.auth.sendEmailLoginOtp({ email : \"you@example.com\" });\n * } catch(e) {\n * // Error Sending user's email an OTP code\n * console.error(e);\n * }\n *\n * // Then when your user is ready to verify their OTP\n * try {\n * const user = await thirdwebEmbeddedWallet.auth.verifyEmailLoginOtp({ email: \"you@example.com\", otp: \"6-DIGIT_CODE_HERE\" });\n * } catch(e) {\n * // Error verifying the OTP code\n * console.error(e)\n * }\n * ```\n *\n * @param param0 - param0.email We will send the email an OTP that needs to be entered in order for them to be logged in.\n * @returns `{{ isNewUser: boolean }}` IsNewUser indicates if the user is a new user to your platform\n */\n async sendEmailLoginOtp(_ref3) {\n let {\n email\n } = _ref3;\n return this.BaseLogin.sendEmailLoginOtp({\n email\n });\n }\n async sendSmsLoginOtp(_ref4) {\n let {\n phoneNumber\n } = _ref4;\n return this.BaseLogin.sendSmsLoginOtp({\n phoneNumber\n });\n }\n\n /**\n * Used to verify the otp that the user receives from thirdweb\n *\n * See {@link Auth.sendEmailLoginOtp} for how the headless call flow looks like. Simply swap out the calls to `loginWithThirdwebEmailOtp` with `verifyThirdwebEmailLoginOtp`\n *\n * @param args - props.email We will send the email an OTP that needs to be entered in order for them to be logged in.\n * props.otp The code that the user received in their email\n * @returns `{{user: InitializedUser}}` An InitializedUser object containing the user's status, wallet, authDetails, and more\n */\n async verifyEmailLoginOtp(args) {\n return this.BaseLogin.verifyEmailLoginOtp(args);\n }\n async verifySmsLoginOtp(args) {\n return this.BaseLogin.verifySmsLoginOtp(args);\n }\n\n /**\n * Logs any existing user out of their wallet.\n * @returns `{{success: boolean}}` true if a user is successfully logged out. false if there's no user currently logged in.\n */\n async logout() {\n const {\n success\n } = await this.AuthQuerier.call({\n procedureName: \"logout\",\n params: undefined\n });\n const isRemoveAuthCookie = await this.localStorage.removeAuthCookie();\n const isRemoveUserId = await this.localStorage.removeWalletUserId();\n return {\n success: success || isRemoveAuthCookie || isRemoveUserId\n };\n }\n}\n\nclass EthersSigner extends Signer {\n constructor(_ref) {\n let {\n provider,\n clientId,\n querier\n } = _ref;\n super();\n _defineProperty(this, \"DEFAULT_ETHEREUM_CHAIN_ID\", 5);\n this.clientId = clientId;\n this.querier = querier;\n // we try to extract a url if possible\n this.endpoint = provider.connection?.url;\n defineReadOnly(this, \"provider\", provider);\n }\n async getAddress() {\n const {\n address\n } = await this.querier.call({\n procedureName: \"getAddress\",\n params: undefined\n });\n return address;\n }\n async signMessage(message) {\n const {\n signedMessage\n } = await this.querier.call({\n procedureName: \"signMessage\",\n params: {\n message,\n chainId: (await this.provider?.getNetwork())?.chainId ?? this.DEFAULT_ETHEREUM_CHAIN_ID,\n rpcEndpoint: this.endpoint\n }\n });\n return signedMessage;\n }\n async signTransaction(transaction) {\n const {\n signedTransaction\n } = await this.querier.call({\n procedureName: \"signTransaction\",\n params: {\n transaction,\n chainId: (await this.provider?.getNetwork())?.chainId ?? this.DEFAULT_ETHEREUM_CHAIN_ID,\n rpcEndpoint: this.endpoint\n }\n });\n return signedTransaction;\n }\n async sendTransaction(transaction) {\n if (!this.provider) {\n throw new Error(\"Provider not found\");\n }\n const gas = await getDefaultGasOverrides(this.provider);\n const txWithGas = {\n ...gas,\n ...transaction\n };\n return super.sendTransaction(txWithGas);\n }\n async _signTypedData(domain, types, message) {\n const {\n signedTypedData\n } = await this.querier.call({\n procedureName: \"signTypedDataV4\",\n params: {\n domain,\n types,\n message,\n chainId: (await this.provider?.getNetwork())?.chainId ?? this.DEFAULT_ETHEREUM_CHAIN_ID,\n rpcEndpoint: this.endpoint\n }\n });\n return signedTypedData;\n }\n connect(provider) {\n return new EthersSigner({\n clientId: this.clientId,\n provider,\n querier: this.querier\n });\n }\n}\n\nclass EmbeddedWallet {\n /**\n * Not meant to be initialized directly. Call {@link initializeUser} to get an instance\n */\n constructor(_ref) {\n let {\n clientId,\n chain,\n querier\n } = _ref;\n this.clientId = clientId;\n this.chain = chain;\n this.walletManagerQuerier = querier;\n this.localStorage = new LocalStorage({\n clientId\n });\n }\n\n /**\n * @internal\n * Used to set-up the user device in the case that they are using incognito\n * @returns `{walletAddress : string }` The user's wallet details\n */\n async postWalletSetUp(_ref2) {\n let {\n deviceShareStored,\n walletAddress,\n isIframeStorageEnabled,\n walletUserId\n } = _ref2;\n if (!isIframeStorageEnabled) {\n await this.localStorage.saveDeviceShare(deviceShareStored, walletUserId);\n }\n return {\n walletAddress\n };\n }\n\n /**\n * @internal\n * Gets the various status states of the user\n * @example\n * ```typescript\n * const userStatus = await Paper.getUserWalletStatus();\n * switch (userStatus.status) {\n * case UserWalletStatus.LOGGED_OUT: {\n * // User is logged out, call one of the auth methods on Paper.auth to authenticate the user\n * break;\n * }\n * case UserWalletStatus.LOGGED_IN_WALLET_UNINITIALIZED: {\n * // User is logged in, but does not have a wallet associated with it\n * // you also have access to the user's details\n * userStatus.user.authDetails;\n * break;\n * }\n * case UserWalletStatus.LOGGED_IN_NEW_DEVICE: {\n * // User is logged in and created a wallet already, but is missing the device shard\n * // You have access to:\n * userStatus.user.authDetails;\n * userStatus.user.walletAddress;\n * break;\n * }\n * case UserWalletStatus.LOGGED_IN_WALLET_INITIALIZED: {\n * // user is logged in and wallet is all set up.\n * // You have access to:\n * userStatus.user.authDetails;\n * userStatus.user.walletAddress;\n * userStatus.user.wallet;\n * break;\n * }\n *}\n *```\n * @returns `{GetUserWalletStatusFnReturnType}` an object to containing various information on the user statuses\n */\n async getUserWalletStatus() {\n const userStatus = await this.walletManagerQuerier.call({\n procedureName: \"getUserStatus\",\n params: undefined\n });\n if (userStatus.status === UserWalletStatus.LOGGED_IN_WALLET_INITIALIZED) {\n return {\n status: UserWalletStatus.LOGGED_IN_WALLET_INITIALIZED,\n ...userStatus.user,\n wallet: this\n };\n } else if (userStatus.status === UserWalletStatus.LOGGED_IN_NEW_DEVICE) {\n return {\n status: UserWalletStatus.LOGGED_IN_WALLET_UNINITIALIZED,\n ...userStatus.user\n };\n } else if (userStatus.status === UserWalletStatus.LOGGED_IN_WALLET_UNINITIALIZED) {\n return {\n status: UserWalletStatus.LOGGED_IN_WALLET_UNINITIALIZED,\n ...userStatus.user\n };\n } else {\n // Logged out\n return {\n status: userStatus.status\n };\n }\n }\n\n /**\n * Switches the chain that the user wallet is currently on.\n *\n * @example\n * ```typescript\n * // user wallet will be set to Polygon\n * const Paper = new ThirdwebEmbeddedWalletSdk({clientId: \"\", chain: \"Polygon\"});\n * const user = await Paper.initializeUser();\n * // Switch the user wallet to Mumbai\n * await user.wallet.setChain({ chain: \"Mumbai\" });\n * ```\n * @param param0 - The chain that we are changing the user wallet too\n */\n async setChain(_ref3) {\n let {\n chain\n } = _ref3;\n this.chain = chain;\n }\n\n /**\n * Returns an Ethers.Js compatible signer that you can use in conjunction with the rest of dApp\n * @example\n * ```typescript\n * const Paper = new ThirdwebEmbeddedWalletSdk({clientId: \"\", chain: \"Polygon\"});\n * const user = await Paper.getUser();\n * if (user.status === UserStatus.LOGGED_IN_WALLET_INITIALIZED) {\n * // returns a signer on the Polygon mainnet\n * const signer = await user.getEthersJsSigner();\n * // returns a signer on the specified RPC endpoints\n * const signer = await user.getEthersJsSigner({rpcEndpoint: \"https://eth-rpc.gateway.pokt.network\"});\n * }\n * ```\n * @param network - object with the rpc url where calls will be routed through\n * @throws If attempting to call the function without the user wallet initialize on their current device. This should never happen if call {@link ThirdwebEmbeddedWalletSdk.initializeUser} before accessing this function\n * @returns A signer that is compatible with Ether.js. Defaults to the public rpc on the chain specified when initializing the {@link ThirdwebEmbeddedWalletSdk} instance\n */\n async getEthersJsSigner(network) {\n const signer = new EthersSigner({\n clientId: this.clientId,\n provider: getDefaultProvider(network?.rpcEndpoint ?? ChainToPublicRpc[this.chain]),\n querier: this.walletManagerQuerier\n });\n return signer;\n }\n}\n\nclass EmbeddedWalletSdk {\n /**\n * Used to manage the Auth state of the user.\n */\n\n isClientIdLegacyPaper(clientId) {\n if (clientId.indexOf(\"-\") > 0 && clientId.length === 36) {\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @example\n * `const thirdwebEmbeddedWallet = new EmbeddedWalletSdk({ clientId: \"\", chain: \"Goerli\" });`\n * @param param0 - EmbeddedWalletConstructorType\n */\n constructor(_ref) {\n let {\n clientId,\n chain,\n styles,\n onAuthSuccess\n } = _ref;\n if (this.isClientIdLegacyPaper(clientId)) {\n throw new Error(\"You are using a legacy clientId. Please use the clientId found on the thirdweb dashboard settings page\");\n }\n this.clientId = clientId;\n this.querier = new EmbeddedWalletIframeCommunicator({\n clientId,\n customizationOptions: styles\n });\n this.wallet = new EmbeddedWallet({\n clientId,\n chain,\n querier: this.querier\n });\n this.auth = new Auth({\n clientId,\n querier: this.querier,\n onAuthSuccess: async authResult => {\n onAuthSuccess?.(authResult);\n await this.wallet.postWalletSetUp({\n ...authResult.walletDetails,\n walletUserId: authResult.storedToken.authDetails.userWalletId\n });\n await this.querier.call({\n procedureName: \"initIframe\",\n params: {\n deviceShareStored: authResult.walletDetails.deviceShareStored,\n clientId: this.clientId,\n walletUserId: authResult.storedToken.authDetails.userWalletId,\n authCookie: authResult.storedToken.cookieString\n }\n });\n return {\n user: {\n status: UserWalletStatus.LOGGED_IN_WALLET_INITIALIZED,\n authDetails: authResult.storedToken.authDetails,\n wallet: this.wallet,\n walletAddress: authResult.walletDetails.walletAddress\n }\n };\n }\n });\n }\n\n /**\n * Gets the usr if they are logged in\n * @example\n * ```js\n * const user = await thirdwebEmbeddedWallet.getUser();\n * switch (user.status) {\n * case UserWalletStatus.LOGGED_OUT: {\n * // User is logged out, call one of the auth methods on thirdwebEmbeddedWallet.auth to authenticate the user\n * break;\n * }\n * case UserWalletStatus.LOGGED_IN_WALLET_INITIALIZED: {\n * // user is logged in and wallet is all set up.\n * // You have access to:\n * user.status;\n * user.authDetails;\n * user.walletAddress;\n * user.wallet;\n * break;\n * }\n * }\n * ```\n * @returns GetUser - an object to containing various information on the user statuses\n */\n async getUser() {\n return this.wallet.getUserWalletStatus();\n }\n}\n\nexport { AUTH_TOKEN_LOCAL_STORAGE_NAME as A, DEVICE_SHARE_LOCAL_STORAGE_NAME as D, EmbeddedWalletSdk as E, RecoveryShareManagement as R, UserWalletStatus as U, WALLET_USER_DETAILS_LOCAL_STORAGE_NAME as W, DEVICE_SHARE_LOCAL_STORAGE_NAME_DEPRECATED as a, WALLET_USER_ID_LOCAL_STORAGE_NAME as b, AuthProvider as c };\n","export const ChainToPublicRpc: Record = {\n Ethereum: \"https://ethereum.rpc.thirdweb.com\",\n Goerli: \"https://goerli.rpc.thirdweb.com\",\n Mumbai: \"https://mumbai.rpc.thirdweb.com\",\n Polygon: \"https://polygon.rpc.thirdweb.com\",\n Avalanche: \"https://avalanche.rpc.thirdweb.com\",\n Optimism: \"https://optimism.rpc.thirdweb.com\",\n OptimismGoerli: \"https://optimism-goerli.rpc.thirdweb.com\",\n BSC: \"https://binance.rpc.thirdweb.com\",\n BSCTestnet: \"https://binance-testnet.rpc.thirdweb.com\",\n ArbitrumOne: \"https://arbitrum.rpc.thirdweb.com\",\n ArbitrumGoerli: \"https://arbitrum-goerli.rpc.thirdweb.com\",\n Fantom: \"https://fantom.rpc.thirdweb.com\",\n FantomTestnet: \"https://fantom-testnet.rpc.thirdweb.com\",\n Sepolia: \"https://sepolia.rpc.thirdweb.com\",\n AvalancheFuji: \"https://avalanche-fuji.rpc.thirdweb.com\",\n};\n\nexport const ChainIdToChain: Record = {\n 1: \"Ethereum\",\n 5: \"Goerli\",\n 80001: \"Mumbai\",\n 137: \"Polygon\",\n 43114: \"Avalanche\",\n 10: \"Optimism\",\n 420: \"OptimismGoerli\",\n 56: \"BSC\",\n 97: \"BSCTestnet\",\n 42161: \"ArbitrumOne\",\n 421613: \"ArbitrumGoerli\",\n 250: \"Fantom\",\n 4002: \"FantomTestnet\",\n 11155111: \"Sepolia\",\n 43113: \"AvalancheFuji\",\n};\n\n// General Embedded wallet types\nexport type Chain =\n | \"Polygon\"\n | \"Mumbai\"\n | \"Goerli\"\n | \"Ethereum\"\n | \"Avalanche\"\n | \"Optimism\"\n | \"OptimismGoerli\"\n | \"BSC\"\n | \"BSCTestnet\"\n | \"ArbitrumOne\"\n | \"ArbitrumGoerli\"\n | \"Fantom\"\n | \"FantomTestnet\"\n | \"Sepolia\"\n | \"AvalancheFuji\";\n\nexport type SupportedChainName = Chain | \"Rinkeby\" | \"Solana\" | \"SolanaDevnet\";\n","const isDev = (): boolean => {\n return !!(\n typeof window !== \"undefined\" &&\n window.localStorage.getItem(\"IS_PAPER_DEV\") === \"true\"\n );\n};\n\nconst isOldPaperDomain = (): boolean =>\n typeof window !== \"undefined\" && window.location.origin.includes(\"paper.xyz\");\n\nconst isThirdwebDomain = (): boolean =>\n typeof window !== \"undefined\" &&\n window.location.origin.includes(\"thirdweb.com\");\n\nexport const getPaperOriginUrl = (): string => {\n if (isDev())\n return (\n window.localStorage.getItem(\"PAPER_DEV_URL\") ?? \"http://localhost:3000\"\n );\n\n if (isOldPaperDomain()) return window.location.origin;\n if (isThirdwebDomain()) return window.location.origin;\n\n return \"https://withpaper.com\";\n};\n"],"names":["GET_IFRAME_BASE_URL","_window$localStorage$","localStorage","getItem","window","WALLET_USER_ID_LOCAL_STORAGE_NAME","clientId","concat","AUTH_TOKEN_LOCAL_STORAGE_NAME","DEVICE_SHARE_LOCAL_STORAGE_NAME","userId","AuthProvider","UserWalletStatus","data","Map","LocalStorage","constructor","_ref","this","isSupported","key","_data$get","get","setItem","value","set","removeItem","item","saveAuthCookie","cookie","getAuthCookie","removeAuthCookie","saveDeviceShare","share","saveWalletUserId","getDeviceShare","getWalletUserId","removeDeviceShare","removeWalletUserId","sleep","seconds","Promise","resolve","setTimeout","iframeBaseStyle","height","width","border","backgroundColor","colorScheme","position","top","right","zIndex","display","isIframeLoaded","IframeCommunicator","link","iframeId","container","document","body","iframeStyles","onIframeInitialize","_defineProperty","iframeBaseUrl","iframe","getElementById","hrefLink","URL","sdkVersion","searchParams","src","href","createElement","mergedIframeStyles","Object","assign","style","setAttribute","appendChild","onIframeLoaded","event","eventType","removeEventListener","console","warn","onIframeLoadHandler","addEventListener","onIframeLoadedInitVariables","async","promise","res","rej","_iframe$contentWindow","channel","MessageChannel","port1","onmessage","close","success","Error","error","contentWindow","postMessage","port2","call","_ref2","procedureName","params","showIframe","POLLING_INTERVAL_SECONDS","_this$iframe$contentW","destroy","delete","EmbeddedWalletIframeCommunicator","customizationOptions","super","EMBEDDED_WALLET_IFRAME_ID","createEmbeddedWalletIframeLink","path","queryParams","authCookie","deviceShareStored","walletUserId","embeddedWalletUrl","queryKey","keys","_queryParams$queryKey","toString","AbstractLogin","querier","preLogin","postLogin","LoginQuerier","sendEmailLoginOtp","email","sendSmsLoginOtp","_ref3","phoneNumber","BaseLogin","arguments","isWindowOpenedByFn","win","closeOpenedWindow","getOauthLoginUrl","authProvider","loginWithModal","result","undefined","loginWithEmailOtp","getOauthPopUpSizing","FACEBOOK","loginWithOauth","args","openedWindow","open","oauthProvider","loginLink","all","location","reject","pollTimer","setInterval","closed","clearInterval","messageListener","origin","closeWindow","authResult","_win","developerClientId","authOption","storedToken","shouldStoreCookieString","walletDetails","isIframeStorageEnabled","loginWithCustomJwt","encryptionKey","jwt","loginWithCustomAuthEndpoint","_ref4","payload","verifyEmailLoginOtp","_ref5","otp","recoveryCode","verifySmsLoginOtp","_ref6","Auth","onAuthSuccess","AuthQuerier","logout","cookieString","isRemoveAuthCookie","isRemoveUserId","EthersSigner","Signer","_provider$connection","provider","endpoint","connection","url","defineReadOnly","getAddress","address","signMessage","message","_await$this$provider$","_await$this$provider$2","_this$provider","signedMessage","chainId","getNetwork","DEFAULT_ETHEREUM_CHAIN_ID","rpcEndpoint","signTransaction","transaction","_await$this$provider$3","_await$this$provider$4","_this$provider2","signedTransaction","sendTransaction","txWithGas","getDefaultGasOverrides","_signTypedData","domain","types","_await$this$provider$5","_await$this$provider$6","_this$provider3","signedTypedData","connect","EmbeddedWallet","chain","walletManagerQuerier","postWalletSetUp","walletAddress","getUserWalletStatus","userStatus","status","LOGGED_IN_WALLET_INITIALIZED","user","wallet","LOGGED_IN_NEW_DEVICE","LOGGED_IN_WALLET_UNINITIALIZED","setChain","getEthersJsSigner","network","_network$rpcEndpoint","getDefaultProvider","ChainToPublicRpc","EmbeddedWalletSdk","isClientIdLegacyPaper","indexOf","length","styles","auth","authDetails","userWalletId","getUser","o","Ethereum","Goerli","Mumbai","Polygon","Avalanche","Optimism","OptimismGoerli","BSC","BSCTestnet","ArbitrumOne","ArbitrumGoerli","Fantom","FantomTestnet","Sepolia","AvalancheFuji","n","getPaperOriginUrl","t","includes"],"sourceRoot":""}