Skip to main content

MultichainRoutingService Actions

4 actions registered.

NameDeprecated
getSupportedAccounts
getSupportedMethods
handleRequest
isSupportedScope

MultichainRoutingService:getSupportedAccounts​

Package: @metamask/snaps-controllers

Get a list of supported accounts for a given scope.

Parameters:

NameDescription
scopeThe CAIP-2 scope.

Returns: A list of CAIP-10 addresses.

Handler signature:

(scope: CaipChainId) => string[]

MultichainRoutingService:getSupportedMethods​

Package: @metamask/snaps-controllers

Get a list of supported methods for a given scope. This combines both protocol and account Snaps supported methods.

Parameters:

NameDescription
scopeThe CAIP-2 scope.

Returns: A list of supported methods.

Handler signature:

(scope: CaipChainId) => string[]

MultichainRoutingService:handleRequest​

Package: @metamask/snaps-controllers

Handle an incoming JSON-RPC request tied to a specific scope by routing to either a protocol Snap or an account Snap.

Note: Addresses are considered case-sensitive by the MultichainRoutingService as not all non-EVM chains are case-insensitive.

Parameters:

NameDescription
optionsAn options bag.
options.connectedAddressesAddresses currently connected to the origin for the requested scope.
options.originThe origin of the RPC request.
options.originMetadataOptional additional origin metadata.
options.requestThe JSON-RPC request.
options.scopeThe CAIP-2 scope for the request.

Returns: The response from the chosen Snap.

Handler signature:

({ connectedAddresses, origin, originMetadata, scope, request: rawRequest, }: {
connectedAddresses: CaipAccountId[];
origin: string;
originMetadata?: OriginMetadata | null;
scope: CaipChainId;
request: JsonRpcRequest;
}) => Promise<Json>

MultichainRoutingService:isSupportedScope​

Package: @metamask/snaps-controllers

Determine whether a given CAIP-2 scope is supported by the router.

Parameters:

NameDescription
scopeThe CAIP-2 scope.

Returns: True if the router can service the scope, otherwise false.

Handler signature:

(scope: CaipChainId) => boolean