From 1d5b71755155d9d94855ee10d7a3b27b17b608cd Mon Sep 17 00:00:00 2001 From: kujtimprenkuSQA Date: Fri, 20 Oct 2023 09:56:12 +0200 Subject: [PATCH] Disable signMessage for near-wallet, avoid redirecting to a 404 page. --- packages/my-near-wallet/src/lib/my-near-wallet.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/my-near-wallet/src/lib/my-near-wallet.ts b/packages/my-near-wallet/src/lib/my-near-wallet.ts index 4095d4a1c..0d3b3beb8 100644 --- a/packages/my-near-wallet/src/lib/my-near-wallet.ts +++ b/packages/my-near-wallet/src/lib/my-near-wallet.ts @@ -67,7 +67,7 @@ const setupWalletState = async ( const MyNearWallet: WalletBehaviourFactory< BrowserWallet, { params: MyNearWalletExtraOptions } -> = async ({ metadata, options, store, params, logger }) => { +> = async ({ metadata, options, store, params, logger, id }) => { const _state = await setupWalletState(params, options.network); const getAccounts = async (): Promise> => { const accountId = _state.wallet.getAccountId(); @@ -163,6 +163,12 @@ const MyNearWallet: WalletBehaviourFactory< async signMessage({ message, nonce, recipient, callbackUrl, state }) { logger.log("sign message", { message }); + if (id !== "my-near-wallet") { + throw Error( + `The signMessage method is not supported by ${metadata.name}` + ); + } + const locationUrl = typeof window !== "undefined" ? window.location.href : "";