From ddd4e8e520ae4c1140efadea5fa60288b1d4f65d Mon Sep 17 00:00:00 2001 From: TaiNguyen Date: Tue, 9 Jul 2024 17:11:21 +0700 Subject: [PATCH 1/8] add mipd --- package-lock.json | 37 +++-- .../adapters/default-evm-adapter/package.json | 5 +- .../adapters/default-evm-adapter/src/index.ts | 31 +++- .../src/injectedEvmAdapter.ts | 154 ++++++++++++++++++ packages/modal/src/modalManager.ts | 12 +- packages/ui/css/web3auth.css | 2 +- .../ui/src/components/ExternalWallets.tsx | 2 +- 7 files changed, 220 insertions(+), 23 deletions(-) create mode 100644 packages/adapters/default-evm-adapter/src/injectedEvmAdapter.ts diff --git a/package-lock.json b/package-lock.json index 69c8e8f1e..47d1dd12b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11474,7 +11474,6 @@ "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", - "dev": true, "optional": true, "dependencies": { "iconv-lite": "^0.6.2" @@ -11484,7 +11483,6 @@ "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, "optional": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" @@ -16586,8 +16584,7 @@ "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "node_modules/js-yaml": { "version": "4.1.0", @@ -18322,7 +18319,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, @@ -19062,6 +19058,25 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, + "node_modules/mipd": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mipd/-/mipd-0.0.7.tgz", + "integrity": "sha512-aAPZPNDQ3uMTdKbuO2YmAw2TxLHO0moa4YKAyETM/DTj5FloZo+a+8tU+iv4GmW+sOxKLSRwcSFuczk+Cpt6fg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wagmi-dev" + } + ], + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/mixin-deep": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", @@ -22673,7 +22688,6 @@ "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", - "dev": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -22685,7 +22699,6 @@ "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", - "dev": true, "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" @@ -24752,13 +24765,12 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "devOptional": true }, "node_modules/scheduler": { "version": "0.23.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", - "dev": true, "dependencies": { "loose-envify": "^1.1.0" } @@ -27109,7 +27121,7 @@ "version": "5.5.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", - "dev": true, + "devOptional": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -28859,9 +28871,10 @@ "license": "ISC", "dependencies": { "@web3auth/base": "^8.8.0", - "@web3auth/metamask-adapter": "^8.8.0", + "@web3auth/base-evm-adapter": "^8.8.0", "@web3auth/torus-evm-adapter": "^8.8.0", - "@web3auth/wallet-connect-v2-adapter": "^8.8.0" + "@web3auth/wallet-connect-v2-adapter": "^8.8.0", + "mipd": "^0.0.7" }, "engines": { "node": ">=18.x", diff --git a/packages/adapters/default-evm-adapter/package.json b/packages/adapters/default-evm-adapter/package.json index df98aff32..59b3ed925 100644 --- a/packages/adapters/default-evm-adapter/package.json +++ b/packages/adapters/default-evm-adapter/package.json @@ -20,9 +20,10 @@ }, "dependencies": { "@web3auth/base": "^8.8.0", - "@web3auth/metamask-adapter": "^8.8.0", "@web3auth/torus-evm-adapter": "^8.8.0", - "@web3auth/wallet-connect-v2-adapter": "^8.8.0" + "@web3auth/base-evm-adapter": "^8.8.0", + "@web3auth/wallet-connect-v2-adapter": "^8.8.0", + "mipd": "^0.0.7" }, "files": [ "dist" diff --git a/packages/adapters/default-evm-adapter/src/index.ts b/packages/adapters/default-evm-adapter/src/index.ts index 7128f0e1b..1df86fa5a 100644 --- a/packages/adapters/default-evm-adapter/src/index.ts +++ b/packages/adapters/default-evm-adapter/src/index.ts @@ -1,4 +1,7 @@ import { CHAIN_NAMESPACES, CustomChainConfig, getChainConfig, IAdapter, IWeb3AuthCoreOptions, WalletInitializationError } from "@web3auth/base"; +import { createStore as createMipd } from "mipd"; + +import { InjectedEvmAdapter } from "./injectedEvmAdapter"; export const getDefaultExternalAdapters = async (params: { options: IWeb3AuthCoreOptions }): Promise[]> => { const { options } = params; @@ -10,15 +13,12 @@ export const getDefaultExternalAdapters = async (params: { options: IWeb3AuthCor ...(chainConfig || {}), }; - const [{ TorusWalletAdapter }, { MetamaskAdapter }, { WalletConnectV2Adapter }] = await Promise.all([ + const [{ TorusWalletAdapter }, { WalletConnectV2Adapter }] = await Promise.all([ import("@web3auth/torus-evm-adapter"), - import("@web3auth/metamask-adapter"), import("@web3auth/wallet-connect-v2-adapter"), ]); const torusWalletAdapter = new TorusWalletAdapter({ chainConfig: finalChainConfig, clientId, sessionTime, web3AuthNetwork, useCoreKitKey }); - const metamaskAdapter = new MetamaskAdapter({ chainConfig: finalChainConfig, clientId, sessionTime, web3AuthNetwork, useCoreKitKey }); - const wcv2Adapter = new WalletConnectV2Adapter({ chainConfig: finalChainConfig, clientId, @@ -30,5 +30,26 @@ export const getDefaultExternalAdapters = async (params: { options: IWeb3AuthCor }, }); - return [torusWalletAdapter, metamaskAdapter, wcv2Adapter]; + // EIP-6963: multiple injected provider discovery + const mipd = createMipd(); + const injectedProviders = mipd.getProviders().map((providerDetail) => { + // remove "wallet" from the wallet name e.g. Coinbase Wallet => coinbase + let walletName = providerDetail.info.name.toLowerCase(); + if (walletName.toLowerCase().endsWith("wallet")) { + walletName = walletName.slice(0, -6).trim(); + } + walletName = walletName.replace(/\s/g, "-"); + + return new InjectedEvmAdapter({ + name: walletName, + provider: providerDetail.provider, + chainConfig: finalChainConfig, + clientId, + sessionTime, + web3AuthNetwork, + useCoreKitKey, + }); + }); + + return [...injectedProviders, torusWalletAdapter, wcv2Adapter]; }; diff --git a/packages/adapters/default-evm-adapter/src/injectedEvmAdapter.ts b/packages/adapters/default-evm-adapter/src/injectedEvmAdapter.ts new file mode 100644 index 000000000..ab1d33763 --- /dev/null +++ b/packages/adapters/default-evm-adapter/src/injectedEvmAdapter.ts @@ -0,0 +1,154 @@ +import { + ADAPTER_CATEGORY, + ADAPTER_CATEGORY_TYPE, + ADAPTER_EVENTS, + ADAPTER_NAMESPACES, + ADAPTER_STATUS, + ADAPTER_STATUS_TYPE, + AdapterInitOptions, + AdapterNamespaceType, + BaseAdapterSettings, + CHAIN_NAMESPACES, + ChainNamespaceType, + CONNECTED_EVENT_DATA, + CustomChainConfig, + IProvider, + log, + UserInfo, + WalletLoginError, + Web3AuthError, +} from "@web3auth/base"; +import { BaseEvmAdapter } from "@web3auth/base-evm-adapter"; + +class InjectedEvmAdapter extends BaseEvmAdapter { + readonly adapterNamespace: AdapterNamespaceType = ADAPTER_NAMESPACES.EIP155; + + readonly currentChainNamespace: ChainNamespaceType = CHAIN_NAMESPACES.EIP155; + + readonly type: ADAPTER_CATEGORY_TYPE = ADAPTER_CATEGORY.EXTERNAL; + + name: string; + + public status: ADAPTER_STATUS_TYPE = ADAPTER_STATUS.NOT_READY; + + private injectedProvider: IProvider | null = null; + + constructor(options: BaseAdapterSettings & { name: string; provider: IProvider }) { + super(options); + this.name = options.name; + this.injectedProvider = options.provider; + } + + get provider(): IProvider | null { + if (this.status !== ADAPTER_STATUS.NOT_READY) { + return this.injectedProvider; + } + return null; + } + + async init(options: AdapterInitOptions = {}): Promise { + await super.init(options); + super.checkInitializationRequirements(); + this.status = ADAPTER_STATUS.READY; + this.emit(ADAPTER_EVENTS.READY, this.name); + try { + log.debug("initializing metamask adapter"); + if (options.autoConnect) { + this.rehydrated = true; + await this.connect(); + } + } catch (error) { + this.emit(ADAPTER_EVENTS.ERRORED, error); + } + } + + async connect(): Promise { + super.checkConnectionRequirements(); + this.status = ADAPTER_STATUS.CONNECTING; + this.emit(ADAPTER_EVENTS.CONNECTING, { adapter: this.name }); + try { + await this.injectedProvider?.request({ method: "eth_requestAccounts" }); + this.status = ADAPTER_STATUS.CONNECTED; + const disconnectHandler = () => { + // ready to be connected again + this.disconnect(); + this.injectedProvider?.removeListener("disconnect", disconnectHandler); + }; + this.injectedProvider.on("disconnect", disconnectHandler); + this.emit(ADAPTER_EVENTS.CONNECTED, { + adapter: this.name, + reconnected: this.rehydrated, + provider: this.injectedProvider, + } as CONNECTED_EVENT_DATA); + return this.injectedProvider; + } catch (error) { + // ready again to be connected + this.status = ADAPTER_STATUS.READY; + this.rehydrated = false; + this.emit(ADAPTER_EVENTS.ERRORED, error); + if (error instanceof Web3AuthError) throw error; + throw WalletLoginError.connectionError("Failed to login with metamask wallet"); + } + } + + async disconnect(options: { cleanup: boolean } = { cleanup: false }): Promise { + await super.disconnectSession(); + if (typeof this.injectedProvider?.removeAllListeners !== "undefined") this.injectedProvider?.removeAllListeners(); + try { + await this.injectedProvider.request({ + method: "wallet_revokePermissions", + params: [{ eth_accounts: {} }], + }); + } catch (error) {} + if (options.cleanup) { + this.status = ADAPTER_STATUS.NOT_READY; + this.injectedProvider = null; + } else { + // ready to be connected again + this.status = ADAPTER_STATUS.READY; + } + await super.disconnect(); + } + + async getUserInfo(): Promise> { + if (this.status !== ADAPTER_STATUS.CONNECTED) throw WalletLoginError.notConnectedError("Not connected with wallet, Please login/connect first"); + return {}; + } + + public async addChain(chainConfig: CustomChainConfig, init = false): Promise { + super.checkAddChainRequirements(chainConfig, init); + await this.injectedProvider?.request({ + method: "wallet_addEthereumChain", + params: [ + { + chainId: chainConfig.chainId, + chainName: chainConfig.displayName, + rpcUrls: [chainConfig.rpcTarget], + blockExplorerUrls: [chainConfig.blockExplorerUrl], + nativeCurrency: { + name: chainConfig.tickerName, + symbol: chainConfig.ticker, + decimals: chainConfig.decimals || 18, + }, + iconUrls: [chainConfig.logo], + }, + ], + }); + this.addChainConfig(chainConfig); + } + + public async switchChain(params: { chainId: string }, init = false): Promise { + super.checkSwitchChainRequirements(params, init); + await this.injectedProvider?.request({ + method: "wallet_switchEthereumChain", + params: [{ chainId: params.chainId }], + }); + this.setAdapterSettings({ chainConfig: this.getChainConfig(params.chainId) as CustomChainConfig }); + } + + public async enableMFA(): Promise { + throw new Error("Method Not implemented"); + } +} + +export { InjectedEvmAdapter }; diff --git a/packages/modal/src/modalManager.ts b/packages/modal/src/modalManager.ts index 5863f7354..76c5c1dea 100644 --- a/packages/modal/src/modalManager.ts +++ b/packages/modal/src/modalManager.ts @@ -19,7 +19,15 @@ import { import { CommonJRPCProvider } from "@web3auth/base-provider"; import { Web3AuthNoModal } from "@web3auth/no-modal"; import { getOpenloginDefaultOptions, LOGIN_PROVIDER, LoginConfig, OpenloginAdapter, OpenLoginOptions } from "@web3auth/openlogin-adapter"; -import { getAdapterSocialLogins, getUserLanguage, LOGIN_MODAL_EVENTS, LoginModal, OPENLOGIN_PROVIDERS, UIConfig } from "@web3auth/ui"; +import { + capitalizeFirstLetter, + getAdapterSocialLogins, + getUserLanguage, + LOGIN_MODAL_EVENTS, + LoginModal, + OPENLOGIN_PROVIDERS, + UIConfig, +} from "@web3auth/ui"; import { WalletConnectV2Adapter } from "@web3auth/wallet-connect-v2-adapter"; import clonedeep from "lodash.clonedeep"; import merge from "lodash.merge"; @@ -108,7 +116,7 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal { const adapterConfigurationPromises = allAdapters.map(async (adapterName) => { // start with the default config of adapter. let adapterConfig = this.modalConfig.adapters?.[adapterName] || { - label: adapterName, + label: adapterName.split("-").map(capitalizeFirstLetter).join(" "), showOnModal: true, showOnMobile: true, showOnDesktop: true, diff --git a/packages/ui/css/web3auth.css b/packages/ui/css/web3auth.css index 196045c68..7eda1bf30 100644 --- a/packages/ui/css/web3auth.css +++ b/packages/ui/css/web3auth.css @@ -617,4 +617,4 @@ 100% { transform: scale(1); } -} \ No newline at end of file +} diff --git a/packages/ui/src/components/ExternalWallets.tsx b/packages/ui/src/components/ExternalWallets.tsx index 11b416d46..ded6e3e30 100644 --- a/packages/ui/src/components/ExternalWallets.tsx +++ b/packages/ui/src/components/ExternalWallets.tsx @@ -204,7 +204,7 @@ export default function ExternalWallet(props: ExternalWalletsProps) { const providerIcon = button.isLink ? ( {`login-${button.name}`} ) : ( - + ); const isBlock = externalButtons.length === 1 || button.block; From 9b30ad6fe88105da1d8c3bf830def1fea34cdb3d Mon Sep 17 00:00:00 2001 From: TaiNguyen Date: Tue, 9 Jul 2024 17:50:40 +0700 Subject: [PATCH 2/8] fix issue with authenticate user --- packages/adapters/base-evm-adapter/src/baseEvmAdapter.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/adapters/base-evm-adapter/src/baseEvmAdapter.ts b/packages/adapters/base-evm-adapter/src/baseEvmAdapter.ts index 22ea38a3c..b0ca56c33 100644 --- a/packages/adapters/base-evm-adapter/src/baseEvmAdapter.ts +++ b/packages/adapters/base-evm-adapter/src/baseEvmAdapter.ts @@ -45,10 +45,11 @@ export abstract class BaseEvmAdapter extends BaseAdapter { }; const challenge = await signChallenge(payload, chainNamespace); + const hexChallenge = `0x${Buffer.from(challenge, "utf8").toString("hex")}`; const signedMessage = await this.provider.request<[string, string], string>({ method: "personal_sign", - params: [challenge, accounts[0]], + params: [hexChallenge, accounts[0]], }); const idToken = await verifySignedChallenge( From fffb39b47d8036dd49db0fe61fdaaac034f8a0b0 Mon Sep 17 00:00:00 2001 From: TaiNguyen Date: Tue, 9 Jul 2024 17:51:04 +0700 Subject: [PATCH 3/8] update demo app --- demo/vue-app/package-lock.json | 164 +++++++++++++-------------- demo/vue-app/src/chains/ethereum.vue | 6 +- demo/vue-app/src/config.ts | 1 + demo/vue-app/src/home.vue | 10 +- 4 files changed, 95 insertions(+), 86 deletions(-) diff --git a/demo/vue-app/package-lock.json b/demo/vue-app/package-lock.json index 731fa4682..72277ccbc 100644 --- a/demo/vue-app/package-lock.json +++ b/demo/vue-app/package-lock.json @@ -62,11 +62,11 @@ }, "../../packages/adapters/base-evm-adapter": { "name": "@web3auth/base-evm-adapter", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { - "@toruslabs/base-controllers": "^5.6.0", - "@web3auth/base": "^8.5.0" + "@toruslabs/base-controllers": "^5.9.2", + "@web3auth/base": "^8.8.0" }, "engines": { "node": ">=18.x", @@ -78,11 +78,11 @@ }, "../../packages/adapters/base-solana-adapter": { "name": "@web3auth/base-solana-adapter", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { - "@toruslabs/base-controllers": "^5.6.0", - "@web3auth/base": "^8.5.0", + "@toruslabs/base-controllers": "^5.9.2", + "@web3auth/base": "^8.8.0", "bs58": "^5.0.0" }, "devDependencies": { @@ -98,12 +98,12 @@ }, "../../packages/adapters/metamask-adapter": { "name": "@web3auth/metamask-adapter", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { "@metamask/detect-provider": "^2.0.0", - "@web3auth/base": "^8.5.0", - "@web3auth/base-evm-adapter": "^8.5.0" + "@web3auth/base": "^8.8.0", + "@web3auth/base-evm-adapter": "^8.8.0" }, "engines": { "node": ">=18.x", @@ -115,13 +115,13 @@ }, "../../packages/adapters/openlogin-adapter": { "name": "@web3auth/openlogin-adapter", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { - "@toruslabs/openlogin": "^8.1.0", - "@toruslabs/openlogin-utils": "^8.1.0", - "@web3auth/base": "^8.5.0", - "@web3auth/base-provider": "^8.5.0", + "@toruslabs/openlogin": "^8.2.1", + "@toruslabs/openlogin-utils": "^8.2.1", + "@web3auth/base": "^8.8.0", + "@web3auth/base-provider": "^8.8.0", "lodash.merge": "^4.6.2" }, "devDependencies": { @@ -153,13 +153,13 @@ }, "../../packages/adapters/phantom-adapter": { "name": "@web3auth/phantom-adapter", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { - "@web3auth/base": "^8.5.0", - "@web3auth/base-provider": "^8.5.0", - "@web3auth/base-solana-adapter": "^8.5.0", - "@web3auth/solana-provider": "^8.5.0", + "@web3auth/base": "^8.8.0", + "@web3auth/base-provider": "^8.8.0", + "@web3auth/base-solana-adapter": "^8.8.0", + "@web3auth/solana-provider": "^8.8.0", "bn.js": "^5.2.1" }, "engines": { @@ -173,13 +173,13 @@ }, "../../packages/adapters/slope-adapter": { "name": "@web3auth/slope-adapter", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { - "@web3auth/base": "^8.5.0", - "@web3auth/base-provider": "^8.5.0", - "@web3auth/base-solana-adapter": "^8.5.0", - "@web3auth/solana-provider": "^8.5.0", + "@web3auth/base": "^8.8.0", + "@web3auth/base-provider": "^8.8.0", + "@web3auth/base-solana-adapter": "^8.8.0", + "@web3auth/solana-provider": "^8.8.0", "bn.js": "^5.2.1" }, "engines": { @@ -193,17 +193,17 @@ }, "../../packages/adapters/solflare-adapter": { "name": "@web3auth/solflare-adapter", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { - "@web3auth/base": "^8.5.0", - "@web3auth/base-provider": "^8.5.0", - "@web3auth/base-solana-adapter": "^8.5.0", - "@web3auth/solana-provider": "^8.5.0", + "@web3auth/base": "^8.8.0", + "@web3auth/base-provider": "^8.8.0", + "@web3auth/base-solana-adapter": "^8.8.0", + "@web3auth/solana-provider": "^8.8.0", "bn.js": "^5.2.1" }, "devDependencies": { - "@solana/web3.js": "^1.91.8", + "@solana/web3.js": "^1.94.0", "@solflare-wallet/sdk": "^1.4.2" }, "engines": { @@ -218,12 +218,12 @@ }, "../../packages/adapters/torus-evm-adapter": { "name": "@web3auth/torus-evm-adapter", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { "@toruslabs/torus-embed": "^5.0.0", - "@web3auth/base": "^8.5.0", - "@web3auth/base-evm-adapter": "^8.5.0" + "@web3auth/base": "^8.8.0", + "@web3auth/base-evm-adapter": "^8.8.0" }, "engines": { "node": ">=18.x", @@ -235,14 +235,14 @@ }, "../../packages/adapters/torus-solana-adapter": { "name": "@web3auth/torus-solana-adapter", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { "@toruslabs/solana-embed": "^2.1.0", - "@web3auth/base": "^8.5.0", - "@web3auth/base-provider": "^8.5.0", - "@web3auth/base-solana-adapter": "^8.5.0", - "@web3auth/solana-provider": "^8.5.0" + "@web3auth/base": "^8.8.0", + "@web3auth/base-provider": "^8.8.0", + "@web3auth/base-solana-adapter": "^8.8.0", + "@web3auth/solana-provider": "^8.8.0" }, "engines": { "node": ">=18.x", @@ -256,22 +256,22 @@ "../../packages/adapters/wallet-connect-v1-adapter": {}, "../../packages/adapters/wallet-connect-v2-adapter": { "name": "@web3auth/wallet-connect-v2-adapter", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.0", "@toruslabs/openlogin-jrpc": "^8.1.1", - "@web3auth/base": "^8.5.0", - "@web3auth/base-evm-adapter": "^8.5.0", - "@web3auth/base-provider": "^8.5.0", - "@web3auth/ethereum-provider": "^8.5.0", + "@web3auth/base": "^8.8.0", + "@web3auth/base-evm-adapter": "^8.8.0", + "@web3auth/base-provider": "^8.8.0", + "@web3auth/ethereum-provider": "^8.8.0", "lodash.merge": "^4.6.2" }, "devDependencies": { "@types/lodash.merge": "^4.6.9", - "@walletconnect/sign-client": "^2.12.2", - "@walletconnect/types": "^2.12.2", - "@walletconnect/utils": "^2.12.2" + "@walletconnect/sign-client": "^2.13.3", + "@walletconnect/types": "^2.13.3", + "@walletconnect/utils": "^2.13.3" }, "engines": { "node": ">=18.x", @@ -286,14 +286,14 @@ }, "../../packages/base": { "name": "@web3auth/base", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { "@toruslabs/constants": "^13.4.0", "@toruslabs/http-helpers": "^6.1.1", - "@toruslabs/openlogin": "^8.1.0", + "@toruslabs/openlogin": "^8.2.1", "@toruslabs/openlogin-jrpc": "^8.1.1", - "@toruslabs/openlogin-utils": "^8.1.0", + "@toruslabs/openlogin-utils": "^8.2.1", "jwt-decode": "^4.0.0", "loglevel": "^1.9.1", "ts-custom-error": "^3.3.1" @@ -358,23 +358,23 @@ }, "../../packages/modal": { "name": "@web3auth/modal", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { - "@web3auth/base": "^8.5.0", - "@web3auth/base-provider": "^8.5.0", - "@web3auth/no-modal": "^8.5.0", - "@web3auth/openlogin-adapter": "^8.5.0", - "@web3auth/ui": "^8.5.0", + "@web3auth/base": "^8.8.0", + "@web3auth/base-provider": "^8.8.0", + "@web3auth/no-modal": "^8.8.0", + "@web3auth/openlogin-adapter": "^8.8.0", + "@web3auth/ui": "^8.8.0", "lodash.clonedeep": "^4.5.0", "lodash.merge": "^4.6.2" }, "devDependencies": { "@svgr/webpack": "^8.1.0", "@toruslabs/isomorphic-style-loader": "^5.3.3", - "@toruslabs/openlogin-utils": "^8.1.0", - "@web3auth/wallet-connect-v2-adapter": "^8.5.0", - "css-loader": "^7.1.1", + "@toruslabs/openlogin-utils": "^8.2.1", + "@web3auth/wallet-connect-v2-adapter": "^8.8.0", + "css-loader": "^7.1.2", "postcss-prefix-selector": "^1.16.1", "style-loader": "^4.0.0", "url-loader": "^4.1.1" @@ -412,20 +412,20 @@ }, "../../packages/no-modal": { "name": "@web3auth/no-modal", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { - "@toruslabs/openlogin": "^8.1.0", + "@toruslabs/openlogin": "^8.2.1", "@toruslabs/openlogin-jrpc": "^8.1.1", - "@toruslabs/openlogin-utils": "^8.1.0", - "@web3auth/base": "^8.5.0", - "@web3auth/base-provider": "^8.5.0", + "@toruslabs/openlogin-utils": "^8.2.1", + "@web3auth/base": "^8.8.0", + "@web3auth/base-provider": "^8.8.0", "lodash.clonedeep": "^4.5.0", "lodash.merge": "^4.6.2" }, "devDependencies": { - "@web3auth/openlogin-adapter": "^8.5.0", - "@web3auth/wallet-connect-v2-adapter": "^8.5.0" + "@web3auth/openlogin-adapter": "^8.8.0", + "@web3auth/wallet-connect-v2-adapter": "^8.8.0" }, "engines": { "node": ">=18.x", @@ -497,17 +497,17 @@ }, "../../packages/plugins/solana-wallet-connector-plugin": { "name": "@web3auth/solana-wallet-connector-plugin", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { "@toruslabs/openlogin-jrpc": "^8.1.1", "@toruslabs/solana-embed": "^2.1.0", - "@web3auth/base": "^8.5.0", - "@web3auth/no-modal": "^8.5.0", + "@web3auth/base": "^8.8.0", + "@web3auth/no-modal": "^8.8.0", "loglevel": "^1.9.1" }, "devDependencies": { - "@metamask/rpc-errors": "^6.2.1" + "@metamask/rpc-errors": "^6.3.0" }, "engines": { "node": ">=18.x", @@ -521,19 +521,19 @@ "../../packages/plugins/wallet-services-connector-plugin": {}, "../../packages/providers/ethereum-provider": { "name": "@web3auth/ethereum-provider", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { "@ethereumjs/common": "^4.3.0", "@ethereumjs/tx": "^5.3.0", "@ethereumjs/util": "^9.0.3", "@metamask/eth-sig-util": "^7.0.2", - "@metamask/rpc-errors": "^6.2.1", - "@toruslabs/base-controllers": "^5.6.0", + "@metamask/rpc-errors": "^6.3.0", + "@toruslabs/base-controllers": "^5.9.2", "@toruslabs/http-helpers": "^6.1.1", "@toruslabs/openlogin-jrpc": "^8.1.1", - "@web3auth/base": "^8.5.0", - "@web3auth/base-provider": "^8.5.0", + "@web3auth/base": "^8.8.0", + "@web3auth/base-provider": "^8.8.0", "assert": "^2.1.0", "bignumber.js": "^9.1.2", "bn.js": "^5.2.1", @@ -542,7 +542,7 @@ "devDependencies": { "@types/bn.js": "^5.1.5", "@types/json-rpc-random-id": "^1.0.3", - "@walletconnect/types": "^2.12.2" + "@walletconnect/types": "^2.13.3" }, "engines": { "node": ">=18.x", @@ -588,22 +588,22 @@ }, "../../packages/providers/solana-provider": { "name": "@web3auth/solana-provider", - "version": "8.5.0", + "version": "8.8.0", "license": "ISC", "dependencies": { - "@metamask/rpc-errors": "^6.2.1", - "@toruslabs/base-controllers": "^5.6.0", + "@metamask/rpc-errors": "^6.3.0", + "@toruslabs/base-controllers": "^5.9.2", "@toruslabs/openlogin-ed25519": "^8.1.0", "@toruslabs/openlogin-jrpc": "^8.1.1", "@toruslabs/tweetnacl-js": "^1.0.4", - "@web3auth/base": "^8.5.0", - "@web3auth/base-provider": "^8.5.0", + "@web3auth/base": "^8.8.0", + "@web3auth/base-provider": "^8.8.0", "bn.js": "^5.2.1", "bs58": "^5.0.0", "json-rpc-random-id": "^1.0.1" }, "devDependencies": { - "@solana/web3.js": "^1.91.8", + "@solana/web3.js": "^1.94.0", "@solflare-wallet/sdk": "^1.4.2", "@types/bn.js": "^5.1.5", "@types/bs58": "^4.0.4", diff --git a/demo/vue-app/src/chains/ethereum.vue b/demo/vue-app/src/chains/ethereum.vue index 76f59a7b6..8b1b7ac8d 100644 --- a/demo/vue-app/src/chains/ethereum.vue +++ b/demo/vue-app/src/chains/ethereum.vue @@ -58,7 +58,7 @@ const ethereumChainConfig: any = { const ethWeb3AuthOptions: Web3AuthOptions = { chainConfig: ethereumChainConfig, enableLogging: true, - clientId: config.clientId["mainnet"], + clientId: config.clientId["sapphire_mainnet"], privateKeyProvider: new EthereumPrivateKeyProvider({ config: { chainConfig: ethereumChainConfig } }), }; @@ -74,7 +74,7 @@ export default defineComponent({ }, openloginNetwork: { type: String, - default: "testnet", + default: "sapphire_mainnet", }, }, watch: { @@ -197,7 +197,7 @@ export default defineComponent({ }, subscribeAuthEvents(web3auth: Web3Auth) { web3auth.on(ADAPTER_STATUS.CONNECTED, async (data: CONNECTED_EVENT_DATA) => { - this.uiConsole("connected to wallet", data); + this.uiConsole("connected to wallet", data.adapter); this.provider = web3auth.provider; this.loginButtonStatus = "Logged in"; }); diff --git a/demo/vue-app/src/config.ts b/demo/vue-app/src/config.ts index ed1627328..d00d1a13b 100644 --- a/demo/vue-app/src/config.ts +++ b/demo/vue-app/src/config.ts @@ -1,5 +1,6 @@ export default { clientId: { + sapphire_mainnet: "BNI_pZZpoH4tqzbDDMKwfLOWujTif_kek4h9QEN271Gu0JheYDPEUHNKMl5Nnw5PGOjK-SOxp1RpUdG9TJufMZk", mainnet: "BCtbnOamqh0cJFEUYA0NB5YkvBECZ3HLZsKfvSRBvew2EiiKW3UxpyQASSR0artjQkiUOCHeZ_ZeygXpYpxZjOs", testnet: "BJ6l3_kIQiy6YVL7zDlCcEAvGpGukwFgp-C_0WvNI_fAEeIaoVRLDrV5OjtbZr_zJxbyXFsXMT-yhQiUNYvZWpo", cyan: "BJ6l3_kIQiy6YVL7zDlCcEAvGpGukwFgp-C_0WvNI_fAEeIaoVRLDrV5OjtbZr_zJxbyXFsXMT-yhQiUNYvZWpo", diff --git a/demo/vue-app/src/home.vue b/demo/vue-app/src/home.vue index 78f8a50e4..125880c6c 100644 --- a/demo/vue-app/src/home.vue +++ b/demo/vue-app/src/home.vue @@ -46,6 +46,14 @@
Openlogin Network + +