Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/snaps-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `SnapTerminated` is now `SnapControllerSnapTerminatedEvent`.
- `SnapEnabled` is now `SnapControllerSnapEnabledEvent`.
- `SnapDisabled` is now `SnapControllerSnapDisabledEvent`.
- **BREAKING:**: Rename `MultichainRouter` to `MultichainRoutingService` and update action types accordingly ([#3913](https://github.com/MetaMask/snaps/pull/3913))
- This is consistent with the naming of other services.
- **BREAKING:** `MultichainRoutingService` now requires `SnapController:getRunnableSnaps` instead of `SnapController:getAllSnaps` ([#3913](https://github.com/MetaMask/snaps/pull/3913))

### Removed

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* This file is auto generated by `scripts/generate-method-action-types.ts`.
* Do not edit manually.
*/

import type { MultichainRoutingService } from './MultichainRoutingService';

/**
* 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.
*
* @param options - An options bag.
* @param options.connectedAddresses - Addresses currently connected to the
* origin for the requested scope.
* @param options.origin - The origin of the RPC request.
* @param options.request - The JSON-RPC request.
* @param options.scope - The CAIP-2 scope for the request.
* @returns The response from the chosen Snap.
* @throws If no handler was found.
*/
export type MultichainRoutingServiceHandleRequestAction = {
type: `MultichainRoutingService:handleRequest`;
handler: MultichainRoutingService['handleRequest'];
};

/**
* Get a list of supported methods for a given scope.
* This combines both protocol and account Snaps supported methods.
*
* @param scope - The CAIP-2 scope.
* @returns A list of supported methods.
*/
export type MultichainRoutingServiceGetSupportedMethodsAction = {
type: `MultichainRoutingService:getSupportedMethods`;
handler: MultichainRoutingService['getSupportedMethods'];
};

/**
* Get a list of supported accounts for a given scope.
*
* @param scope - The CAIP-2 scope.
* @returns A list of CAIP-10 addresses.
*/
export type MultichainRoutingServiceGetSupportedAccountsAction = {
type: `MultichainRoutingService:getSupportedAccounts`;
handler: MultichainRoutingService['getSupportedAccounts'];
};

/**
* Determine whether a given CAIP-2 scope is supported by the router.
*
* @param scope - The CAIP-2 scope.
* @returns True if the router can service the scope, otherwise false.
*/
export type MultichainRoutingServiceIsSupportedScopeAction = {
type: `MultichainRoutingService:isSupportedScope`;
handler: MultichainRoutingService['isSupportedScope'];
};

/**
* Union of all MultichainRoutingService action types.
*/
export type MultichainRoutingServiceMethodActions =
| MultichainRoutingServiceHandleRequestAction
| MultichainRoutingServiceGetSupportedMethodsAction
| MultichainRoutingServiceGetSupportedAccountsAction
| MultichainRoutingServiceIsSupportedScopeAction;
Loading
Loading