-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: solana support #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: solana support #123
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring alerts on:
|
|
@SocketSecurity ignore npm/@solana/[email protected]
|
packages/connect-solana/src/types.ts
Outdated
| }; | ||
| /** Optional API configuration */ | ||
| api?: { | ||
| /** A map of CAIP chain IDs to RPC URLs for supported networks */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be Solana Genesis Hash to RPC URLs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 also not following this one haha
| const connectSolana = useCallback(async () => { | ||
| // Find the MetaMask wallet in registered wallets | ||
| const metamaskWallet = wallets.find((w) => | ||
| w.adapter.name.toLowerCase().includes('metamask') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a chance this will perfer the extension announced event instead of the ConnectSolana one?
Adding Solana introduced Solution:Force all packages to use This is safe because the interface BS58 {
encode(source: Buffer | Uint8Array): string;
decode(string: string): Buffer; // v4 returns Buffer
decodeUnsafe(string: string): Buffer | undefined;
}The only difference is Since |
|
I'm not seeing the Each time I click it (even after repeated attempts) I get prompted to connect again (I think this has to do with devnet permissions not getting granted initially...? though I don't know why the connection request happens again and again then) but as you can see I don't ever get the subsequent signature request to show: Screen.Recording.2026-01-29.at.2.08.38.PM.mov |
Yes, I've confirmed its due to the connection request not including the Solana Devnet scope. If you manually include it, you should see the tx confirmation pop-up. Let's discuss some of this during our standup today. |
…let_createSession` call
f26522e to
9e944ae
Compare
adonesky1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
ea1a85e to
1e5a26b
Compare
| @@ -218,18 +227,12 @@ export class DefaultTransport implements ExtendedTransport { | |||
| walletSession, | |||
| proposedCaipAccountIds, | |||
| ); | |||
|
|
|||
| if (!hasSameScopesAndAccounts) { | |||
| await this.request( | |||
| { method: 'wallet_revokeSession', params: walletSession }, | |||
| this.#defaultRequestOptions, | |||
| ); | |||
| const optionalScopes = addValidAccounts( | |||
| getOptionalScopes(options?.scopes ?? []), | |||
| getValidAccounts(options?.caipAccountIds ?? []), | |||
| ); | |||
| const createSessionParams: CreateSessionParams<RPCAPI> = { | |||
| optionalScopes, | |||
| }; | |||
| const response = await this.request( | |||
| { method: 'wallet_createSession', params: createSessionParams }, | |||
| this.#defaultRequestOptions, | |||
| @@ -240,14 +243,6 @@ export class DefaultTransport implements ExtendedTransport { | |||
| walletSession = response.result as SessionData; | |||
| } | |||
| } else if (!walletSession || options?.forceRequest) { | |||
| const optionalScopes = addValidAccounts( | |||
| getOptionalScopes(options?.scopes ?? []), | |||
| getValidAccounts(options?.caipAccountIds ?? []), | |||
| ); | |||
| const createSessionParams: CreateSessionParams<RPCAPI> = { | |||
| optionalScopes, | |||
| sessionProperties: options?.sessionProperties, | |||
| }; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously we weren't passing along sessionProperties in certain cases -> theoretically this could be its own PR but was causing an issue where Solana connection wasn't leading to additional network permissions being added as is expected (and currently happens in the injected script version)


Explanation
Introduces
@metamask/connect-solana, a new package that wraps@metamask/solana-wallet-standardwith MetaMask Connect, enabling Solana dapps to use MetaMask via the wallet-standard protocol. It also adds playground support for solana-wallet-standard which enables testing this feature.Testing Steps
yarn install && yarn build)yarn workspace @metamask/browser-playground start)Connect (Solana)button (ensure no extension is installed if using desktop browser)Solana Devnetis permitted when acceptingReferences
Fixes WAPI-751
Checklist