Skip to content

Commit

Permalink
Disable signMessage for near-wallet, avoid redirecting to a 404 page.
Browse files Browse the repository at this point in the history
  • Loading branch information
kujtimprenkuSQA committed Oct 20, 2023
1 parent 6824621 commit 1d5b717
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/my-near-wallet/src/lib/my-near-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Array<Account>> => {
const accountId = _state.wallet.getAccountId();
Expand Down Expand Up @@ -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 : "";

Expand Down

0 comments on commit 1d5b717

Please sign in to comment.