16
16
17
17
'use strict' ;
18
18
19
- import { Provider , JsonRpcProvider } from '@ethersproject/providers' ;
19
+ import { Provider } from '@ethersproject/providers' ;
20
20
import { Address } from '@setprotocol/set-protocol-v2/utils/types' ;
21
21
22
22
import ContractWrapper from './ContractWrapper' ;
@@ -36,7 +36,7 @@ export default class ControllerWrapper {
36
36
37
37
public constructor ( provider : Provider , controllerAddress : Address ) {
38
38
this . provider = provider ;
39
- this . contracts = new ContractWrapper ( provider ) ;
39
+ this . contracts = new ContractWrapper ( this . provider ) ;
40
40
this . controllerAddress = controllerAddress ;
41
41
}
42
42
@@ -51,7 +51,7 @@ export default class ControllerWrapper {
51
51
) : Promise < Address [ ] > {
52
52
const controller = await this . contracts . loadControllerContractAsync (
53
53
this . controllerAddress ,
54
- ( this . provider as JsonRpcProvider ) . getSigner ( callerAddress )
54
+ callerAddress ,
55
55
) ;
56
56
57
57
return controller . getFactories ( ) ;
@@ -68,7 +68,7 @@ export default class ControllerWrapper {
68
68
) : Promise < Address [ ] > {
69
69
const controller = await this . contracts . loadControllerContractAsync (
70
70
this . controllerAddress ,
71
- ( this . provider as JsonRpcProvider ) . getSigner ( callerAddress )
71
+ callerAddress ,
72
72
) ;
73
73
74
74
return controller . getModules ( ) ;
@@ -85,7 +85,7 @@ export default class ControllerWrapper {
85
85
) : Promise < Address [ ] > {
86
86
const controller = await this . contracts . loadControllerContractAsync (
87
87
this . controllerAddress ,
88
- ( this . provider as JsonRpcProvider ) . getSigner ( callerAddress )
88
+ callerAddress ,
89
89
) ;
90
90
91
91
return controller . getResources ( ) ;
@@ -102,9 +102,27 @@ export default class ControllerWrapper {
102
102
) : Promise < Address [ ] > {
103
103
const controller = await this . contracts . loadControllerContractAsync (
104
104
this . controllerAddress ,
105
- ( this . provider as JsonRpcProvider ) . getSigner ( callerAddress )
105
+ callerAddress ,
106
106
) ;
107
107
108
108
return controller . getSets ( ) ;
109
109
}
110
+
111
+ /**
112
+ * Returns whether or not an address is a SetToken
113
+ *
114
+ * @param address Address to check
115
+ * @return boolean
116
+ */
117
+ public async isSet (
118
+ address : Address ,
119
+ callerAddress ?: Address ,
120
+ ) : Promise < boolean > {
121
+ const controller = await this . contracts . loadControllerContractAsync (
122
+ this . controllerAddress ,
123
+ callerAddress ,
124
+ ) ;
125
+
126
+ return controller . isSet ( address ) ;
127
+ }
110
128
}
0 commit comments