@@ -4,12 +4,6 @@ import type {
4
4
ControllerStateChangeEvent ,
5
5
} from '@metamask/base-controller' ;
6
6
import { BaseController } from '@metamask/base-controller' ;
7
-
8
- import type {
9
- TransactionControllerUnapprovedTransactionAddedEvent ,
10
- SignatureStateChange ,
11
- TransactionControllerTransactionStatusUpdatedEvent ,
12
- } from '../types' ;
13
7
import { createDeferredPromise } from '@metamask/utils' ;
14
8
15
9
const controllerName = 'DeviceController' ;
@@ -21,7 +15,20 @@ export type DeviceControllerGetStateAction = ControllerGetStateAction<
21
15
DeviceControllerState
22
16
> ;
23
17
24
- export type DeviceControllerActions = DeviceControllerGetStateAction ;
18
+ export type DeviceControllerResolvePairingAction = {
19
+ type : `${typeof controllerName } :resolvePairing`;
20
+ handler : DeviceController [ 'resolvePairing' ] ;
21
+ } ;
22
+
23
+ export type DeviceControllerRejectPairingAction = {
24
+ type : `${typeof controllerName } :rejectPairing`;
25
+ handler : DeviceController [ 'rejectPairing' ] ;
26
+ } ;
27
+
28
+ export type DeviceControllerActions =
29
+ | DeviceControllerGetStateAction
30
+ | DeviceControllerResolvePairingAction
31
+ | DeviceControllerRejectPairingAction ;
25
32
26
33
export type DeviceControllerStateChangeEvent = ControllerStateChangeEvent <
27
34
typeof controllerName ,
@@ -30,10 +37,7 @@ export type DeviceControllerStateChangeEvent = ControllerStateChangeEvent<
30
37
31
38
export type DeviceControllerEvents = DeviceControllerStateChangeEvent ;
32
39
33
- export type DeviceControllerAllowedEvents =
34
- | TransactionControllerUnapprovedTransactionAddedEvent
35
- | TransactionControllerTransactionStatusUpdatedEvent
36
- | SignatureStateChange ;
40
+ export type DeviceControllerAllowedEvents = never ;
37
41
38
42
export type DeviceControllerMessenger = RestrictedControllerMessenger <
39
43
typeof controllerName ,
@@ -85,6 +89,16 @@ export class DeviceController extends BaseController<
85
89
name : controllerName ,
86
90
state : { ...state , devices : { } } ,
87
91
} ) ;
92
+
93
+ this . messagingSystem . registerActionHandler (
94
+ `${ controllerName } :resolvePairing` ,
95
+ async ( ...args ) => this . resolvePairing ( ...args ) ,
96
+ ) ;
97
+
98
+ this . messagingSystem . registerActionHandler (
99
+ `${ controllerName } :rejectPairing` ,
100
+ async ( ...args ) => this . rejectPairing ( ...args ) ,
101
+ ) ;
88
102
}
89
103
90
104
async requestDevices ( snapId : string ) {
0 commit comments