diff --git a/lib/wallet/MWalletConnect.ts b/lib/wallet/MWalletConnect.ts index fe56a1c..3ebb498 100644 --- a/lib/wallet/MWalletConnect.ts +++ b/lib/wallet/MWalletConnect.ts @@ -32,7 +32,7 @@ export class MWalletConnect extends BaseWallet { this.ethereumProvider = await EthereumProvider.init({ projectId, showQrModal: true, - qrModalOptions: { themeMode: "light" , explorerRecommendedWalletIds: "NONE", explorerExcludedWalletIds: "ALL" }, + qrModalOptions: { themeMode: "light", explorerRecommendedWalletIds: "NONE", explorerExcludedWalletIds: "ALL" }, optionalChains: [1], disableProviderPing: true, // methods: ["eth_sendTransaction", "personal_sign"], @@ -44,10 +44,14 @@ export class MWalletConnect extends BaseWallet { } async fetchAccounts(): Promise { - if (!this.ethereumProvider) return []; - const accounts = await this.ethereumProvider.request({ method: "eth_accounts", params: [] }); - // this.accounts = accounts; - return accounts; + try { + if (!this.ethereumProvider) return []; + const accounts = await this.ethereumProvider.request({ method: "eth_accounts", params: [] }); + // this.accounts = accounts; + return accounts; + } catch (error) { + return []; + } } public async connect(): Promise { @@ -75,7 +79,7 @@ export class MWalletConnect extends BaseWallet { ]); console.info("connectEnd:", this.ethereumProvider.accounts); // await this.ethereumProvider.connect() - if (_.isEmpty(this.ethereumProvider.accounts)) throw "You rejected"; + if (_.isEmpty(this.ethereumProvider.accounts)) throw ""; this.account = this.ethereumProvider.accounts[0]; this.accounts = this.ethereumProvider.accounts; this.isConnected = true; diff --git a/lib/wallet/SolanaM.ts b/lib/wallet/SolanaM.ts index a5fbbf4..7e6da57 100644 --- a/lib/wallet/SolanaM.ts +++ b/lib/wallet/SolanaM.ts @@ -28,10 +28,14 @@ export class SolanaM extends BaseWallet { } async fetchAccounts(): Promise { - if (this.solana?.publicKey) return [this.solana?.publicKey.toBase58()]; + try { + if (this.solana?.publicKey) return [this.solana?.publicKey.toBase58()]; + } catch (error) { + console.info(error) + } return []; } - + public async connect(): Promise { if (!this.isConnected) { if (!this.solana) throw "Solana (Phantom Wallet) not installed";