-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
feat: Integrate non-evm SIP-26 support into @metamask/multichain
#5191
base: main
Are you sure you want to change the base?
Conversation
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamask/multichain
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
} else { | ||
methods = isCaipChainId(scopeString) | ||
? getNonEvmSupportedMethods(scopeString) | ||
: []; |
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.
@FrederikBolding just wondering if we've considered what wallet:<caip-2-reference>
(e.g. wallet:solana
) scoped snaps would mean/look like. Not saying this case won't exist, just curious if we've thought about it.
optionalScopes: { | ||
'foo:1': { | ||
accounts: ['foo:1:0xdeadbeef'], | ||
it('gets methods from getNonEvmSupportedMethods for scope non-evm namespace', () => { |
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.
it('gets methods from getNonEvmSupportedMethods for scope non-evm namespace', () => { | |
it('gets methods from getNonEvmSupportedMethods for non-evm (not `eip155`, `wallet` or `wallet:eip155`) scopes', () => { |
{ | ||
getEvmInternalAccounts: expect.any(Function), | ||
getNonEvmAccountAddresses: expect.any(Function), | ||
}, |
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.
Yeah this pattern is a bit funny, passing these hooks to the utility helpers.... ah well
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.
yeah... not my favorite
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
Explanation
Updates the
@metamask/multichain
package to use new hooks provided by the SnapsMultichainRouter
to enable non-evm support on the Multichain APIReferences
Ticket: https://github.com/orgs/MetaMask/projects/146/views/6?pane=issue&itemId=94617458&issue=MetaMask%7CMetaMask-planning%7C3989
Extension: MetaMask/metamask-extension#29887
Snaps: MetaMask/snaps#2875
Changelog
@metamask/multichain
getSessionScopes()
now expects an additional hooks object as its last param. The hooks object should have agetNonEvmSupportedMethods
property whose value should be a function that accepts aCaipChainId
and returns an array of supported methods.caip25CaveatBuilder()
now expects two additional properties it's singular param object. The param object should now also have aisNonEvmScopeSupported
property whose value should be a function that accepts aCaipChainId
and returns a boolean, and agetNonEvmAccountAddresses
property whose value should be a function that accepts aCaipChainId
and returns an array of CAIP-10 account addresses.wallet_getSession
handler now expectsgetNonEvmSupportedMethods
to be provided in it's hooks.sessionScopes
resultwallet_invokeMethod
handler now expectsgetNonEvmSupportedMethods
andhandleNonEvmRequestForOrigin
to be provided in it's hooks.handleNonEvmRequestForOrigin
should be a function with the following signature:assertScopeSupported()
now expects the following hooks params object as it's last param:assertScopesSupported()
now expects the following hooks params object as it's last param:bucketScopes()
now expects the following hooks params object as it's last param:bucketScopesBySupport()
now expects the following hooks params object as it's last param:getSessionScopes()
now expects a hooks object as its last param. The hooks object should have agetNonEvmSupportedMethods
property whose value should be a function that accepts aCaipChainId
and returns an array of supported methods.isSupportedScopeString()
now expects the a hooks params object as it's last param with the following properties:isSupportedAccount()
now expects the a hooks params object as it's last param with the following properties:isSupportedMethod()
now expects the a hooks params object as it's last param with the following properties:Checklist