@@ -60,4 +60,108 @@ export class NetworkRpc {
6060 [ address , port ]
6161 ) ;
6262 }
63+
64+ /**
65+ * Add the IP to whitelist
66+ * @param ip Node IP
67+ */
68+ addToWhiteList ( ip : string ) : Promise < null > {
69+ return this . rpc . sendRpcRequest (
70+ "net_addToWhitelist" ,
71+ [ ip ]
72+ ) ;
73+ }
74+
75+ /**
76+ * Remove the IP from whitelist
77+ * @param ip Node IP
78+ */
79+ removeFromWhiteList ( ip : string ) : Promise < null > {
80+ return this . rpc . sendRpcRequest (
81+ "net_removeFromWhitelist" ,
82+ [ ip ]
83+ ) ;
84+ }
85+
86+ /**
87+ * Add the IP to blacklist
88+ * @param ip Node IP
89+ */
90+ addToBlacklist ( ip : string ) : Promise < null > {
91+ return this . rpc . sendRpcRequest (
92+ "net_addToBlacklist" ,
93+ [ ip ]
94+ ) ;
95+ }
96+
97+ /**
98+ * Remove the IP from blacklist
99+ * @param ip Node IP
100+ */
101+ removeFromBlackList ( ip : string ) : Promise < null > {
102+ return this . rpc . sendRpcRequest (
103+ "net_removeFromBlacklist" ,
104+ [ ip ]
105+ ) ;
106+ }
107+
108+ /**
109+ * Enable whitelist
110+ */
111+ enableWhiteList ( ) : Promise < null > {
112+ return this . rpc . sendRpcRequest (
113+ "net_enableWhitelist" ,
114+ [ ]
115+ ) ;
116+ }
117+
118+ /**
119+ * Disable whitelist
120+ */
121+ disableWhiteList ( ) : Promise < null > {
122+ return this . rpc . sendRpcRequest (
123+ "net_disableWhitelist" ,
124+ [ ]
125+ ) ;
126+ }
127+
128+ /**
129+ * Enable blacklist
130+ */
131+ enableBlackList ( ) : Promise < null > {
132+ return this . rpc . sendRpcRequest (
133+ "net_enableBlacklist" ,
134+ [ ]
135+ ) ;
136+ }
137+
138+ /**
139+ * Disable blacklist
140+ */
141+ disableBlackList ( ) : Promise < null > {
142+ return this . rpc . sendRpcRequest (
143+ "net_disableBlacklist" ,
144+ [ ]
145+ ) ;
146+ }
147+
148+ /**
149+ * Get the status of whitelist
150+ */
151+ getWhitelist ( ) : Promise < { list : string [ ] , enabled : boolean } > {
152+ return this . rpc . sendRpcRequest (
153+ "net_getWhitelist" ,
154+ [ ]
155+ ) ;
156+ }
157+
158+ /**
159+ * Get the status of blacklist
160+ */
161+ getBlacklist ( ) : Promise < { list : string [ ] , enabled : boolean } > {
162+ return this . rpc . sendRpcRequest (
163+ "net_getBlacklist" ,
164+ [ ]
165+ ) ;
166+ }
63167}
0 commit comments