Skip to content

refactor: make authorizationCache, chainSelector and onWalletNotFound in registerMwa optional#1271

Open
beeman wants to merge 1 commit intosolana-mobile:mainfrom
beeman:beeman/register-mwa
Open

refactor: make authorizationCache, chainSelector and onWalletNotFound in registerMwa optional#1271
beeman wants to merge 1 commit intosolana-mobile:mainfrom
beeman:beeman/register-mwa

Conversation

@beeman
Copy link
Copy Markdown
Collaborator

@beeman beeman commented Sep 4, 2025

This commit makes the authorizationCache, chainSelector and onWalletNotFound properties of registerMwa optional.

It does so by extracting the LocalSolanaMobileWalletAdapterWalletOptions into an object, marking the properties as optional and have RemoteSolanaMobileWalletAdapterWalletOptions extend it.

After that, we provide a default value in the constructor so that this function remains working the same, it just needs a few less parameters to set up.

@Funkatronics Funkatronics self-requested a review September 12, 2025 15:50
get cachedAuthorizationResult(): Promise<Authorization | undefined>;
}

export interface LocalSolanaMobileWalletAdapterWalletOptions {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a base interface called SolanaMobileWalletAdapterWalletConfig and extend LocalSolanaMobileWalletAdapterWalletConfig and RemoteSolanaMobileWalletAdapterWalletConfig from there

@@ -10,14 +10,7 @@ import { AppIdentity } from "@solana-mobile/mobile-wallet-adapter-protocol";
import { IdentifierArray } from "@wallet-standard/base";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some of the imports here are not unused with this change?

this.#chains = config.chains;
this.#chainSelector = config.chainSelector;
this.#onWalletNotFound = config.onWalletNotFound;
this.#chainSelector = config.chainSelector ?? createDefaultChainSelector();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer for these to be default parameters rather than fallbacks on nullable parameters.

@Funkatronics
Copy link
Copy Markdown
Collaborator

CI build is failing on these changes @beeman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants