diff --git a/demo/vue-app-new/src/MainView.vue b/demo/vue-app-new/src/MainView.vue index 8ad131a4f..ebef48b8f 100644 --- a/demo/vue-app-new/src/MainView.vue +++ b/demo/vue-app-new/src/MainView.vue @@ -28,7 +28,7 @@ import { computed, onBeforeMount, ref, watch } from "vue"; import AppDashboard from "./components/AppDashboard.vue"; import AppHeader from "./components/AppHeader.vue"; import AppSettings from "./components/AppSettings.vue"; -import { chainConfigs, clientIds, getDefaultBundlerUrl } from "./config"; +import { chainConfigs, clientIds, getDefaultBundlerUrl, NFT_CHECKOUT_CLIENT_ID } from "./config"; import { formDataStore } from "./store/form"; const formData = formDataStore; @@ -40,7 +40,7 @@ const walletPlugins = computed(() => { const plugins = []; if (formData.nftCheckoutPlugin.enable) { const nftCheckoutPlugin = new NFTCheckoutPlugin({ - apiKey: "pk_test_4ca499b1f017c2a96bac63493dca4ac2eb08d1e91de0a796d87137dc7278e0af", + web3AuthClientId: NFT_CHECKOUT_CLIENT_ID, }); plugins.push(nftCheckoutPlugin); } diff --git a/demo/vue-app-new/src/components/AppDashboard.vue b/demo/vue-app-new/src/components/AppDashboard.vue index b46020680..5fc5b3b1e 100644 --- a/demo/vue-app-new/src/components/AppDashboard.vue +++ b/demo/vue-app-new/src/components/AppDashboard.vue @@ -18,12 +18,7 @@ import { signTypedMessage, } from "../services/ethHandlers"; import { signAllTransactions, signAndSendTransaction, signMessage, signTransaction as signSolTransaction } from "../services/solHandlers"; -import { - walletSendEth, - walletSignPersonalMessage, - walletSignTransaction as walletSignEthTransaction, - walletSignTypedMessage, -} from "../services/walletServiceHandlers"; +import { walletSendEth, walletSignPersonalMessage, walletSignTypedMessage } from "../services/walletServiceHandlers"; import { formDataStore } from "../store/form"; const { t } = useI18n({ useScope: "global" }); diff --git a/demo/vue-app-new/src/config.ts b/demo/vue-app-new/src/config.ts index de91bce95..7fba43845 100644 --- a/demo/vue-app-new/src/config.ts +++ b/demo/vue-app-new/src/config.ts @@ -256,3 +256,5 @@ export const NFT_CHECKOUT_CONTRACT_ID = { FREE_MINT: "b5b4de3f-0212-11ef-a08f-0242ac190003", PAID_MINT: "d1145a8b-98ae-44e0-ab63-2c9c8371caff", }; + +export const NFT_CHECKOUT_CLIENT_ID = "BHgArYmWwSeq21czpcarYh0EVq2WWOzflX-NTK-tY1-1pauPzHKRRLgpABkmYiIV_og9jAvoIxQ8L3Smrwe04Lw"; diff --git a/packages/plugins/nft-checkout-plugin/src/embed.ts b/packages/plugins/nft-checkout-plugin/src/embed.ts index 66b0c559b..7c1ffd7c6 100644 --- a/packages/plugins/nft-checkout-plugin/src/embed.ts +++ b/packages/plugins/nft-checkout-plugin/src/embed.ts @@ -1,5 +1,5 @@ import { randomId } from "@toruslabs/base-controllers"; -import { THEME_MODES, WEB3AUTH_NETWORK_TYPE, WhiteLabelData } from "@web3auth/auth"; +import { THEME_MODES, WhiteLabelData } from "@web3auth/auth"; import log from "loglevel"; import { @@ -36,34 +36,18 @@ import { getTheme, htmlToElement } from "./utils"; export class NFTCheckoutEmbed { web3AuthClientId: string; - web3AuthNetwork: WEB3AUTH_NETWORK_TYPE; - isInitialized: boolean; private modalZIndex: number; - private apiKey: string; - private buildEnv: NFT_CHECKOUT_BUILD_ENV_TYPE; private readonly embedNonce = randomId(); - constructor({ - modalZIndex = 99999, - apiKey, - web3AuthClientId, - web3AuthNetwork, - }: { - modalZIndex?: number; - apiKey: string; - web3AuthClientId?: string; - web3AuthNetwork?: WEB3AUTH_NETWORK_TYPE; - }) { + constructor({ modalZIndex = 99999, web3AuthClientId }: { modalZIndex?: number; web3AuthClientId: string }) { this.isInitialized = false; this.modalZIndex = modalZIndex; - this.apiKey = apiKey; this.web3AuthClientId = web3AuthClientId; - this.web3AuthNetwork = web3AuthNetwork; } public async init(params: { buildEnv?: NFT_CHECKOUT_BUILD_ENV_TYPE; whiteLabel?: WhiteLabelData }): Promise { @@ -106,9 +90,7 @@ export class NFTCheckoutEmbed { nftCheckoutIframe.contentWindow.postMessage( { type: MESSAGE_INIT, - apiKey: this.apiKey, web3AuthClientId: this.web3AuthClientId, - web3AuthNetwork: this.web3AuthNetwork, whiteLabel, }, nftCheckoutIframeUrl.origin diff --git a/packages/plugins/nft-checkout-plugin/src/plugin.ts b/packages/plugins/nft-checkout-plugin/src/plugin.ts index 4315d98a1..c36fff2c8 100644 --- a/packages/plugins/nft-checkout-plugin/src/plugin.ts +++ b/packages/plugins/nft-checkout-plugin/src/plugin.ts @@ -1,4 +1,4 @@ -import { SafeEventEmitter, WEB3AUTH_NETWORK_TYPE, type WhiteLabelData } from "@web3auth/auth"; +import { SafeEventEmitter, type WhiteLabelData } from "@web3auth/auth"; import { ADAPTER_STATUS, EVM_PLUGINS, @@ -30,7 +30,7 @@ export class NFTCheckoutPlugin extends SafeEventEmitter implements IPlugin { private receiverAddress: string | null = null; - constructor(params: { modalZIndex?: number; apiKey: string; web3AuthClientId?: string; web3AuthNetwork?: WEB3AUTH_NETWORK_TYPE }) { + constructor(params: { modalZIndex?: number; web3AuthClientId: string }) { super(); this.nftCheckoutEmbedInstance = new NFTCheckoutEmbed(params); } @@ -40,9 +40,6 @@ export class NFTCheckoutPlugin extends SafeEventEmitter implements IPlugin { if (!web3auth) throw NFTCheckoutPluginError.web3authRequired(); this.web3auth = web3auth; - this.nftCheckoutEmbedInstance.web3AuthClientId = web3auth.coreOptions.clientId; - this.nftCheckoutEmbedInstance.web3AuthNetwork = web3auth.coreOptions.web3AuthNetwork; - await this.nftCheckoutEmbedInstance.init({ whiteLabel, });