@@ -80,6 +80,11 @@ HookedWalletSubprovider.prototype.handleRequest = function(payload, next, end){
80
80
switch ( payload . method ) {
81
81
82
82
case 'eth_coinbase' :
83
+ // check for full method override
84
+ if ( opts . eth_coinbase ) {
85
+ return opts . eth_coinbase ( payload , next , end )
86
+ }
87
+ // process normally
83
88
self . getAccounts ( function ( err , accounts ) {
84
89
if ( err ) return end ( err )
85
90
var result = accounts [ 0 ] || null
@@ -88,13 +93,23 @@ HookedWalletSubprovider.prototype.handleRequest = function(payload, next, end){
88
93
return
89
94
90
95
case 'eth_accounts' :
96
+ // check for full method override
97
+ if ( opts . eth_accounts ) {
98
+ return opts . eth_accounts ( payload , next , end )
99
+ }
100
+ // process normally
91
101
self . getAccounts ( function ( err , accounts ) {
92
102
if ( err ) return end ( err )
93
103
end ( null , accounts )
94
104
} )
95
105
return
96
106
97
107
case 'eth_sendTransaction' :
108
+ // check for full method override
109
+ if ( opts . eth_sendTransaction ) {
110
+ return opts . eth_sendTransaction ( payload , next , end )
111
+ }
112
+ // process normally
98
113
var txParams = payload . params [ 0 ]
99
114
waterfall ( [
100
115
( cb ) => self . validateTransaction ( txParams , cb ) ,
@@ -103,6 +118,11 @@ HookedWalletSubprovider.prototype.handleRequest = function(payload, next, end){
103
118
return
104
119
105
120
case 'eth_signTransaction' :
121
+ // check for full method override
122
+ if ( opts . eth_signTransaction ) {
123
+ return opts . eth_signTransaction ( payload , next , end )
124
+ }
125
+ // process normally
106
126
var txParams = payload . params [ 0 ]
107
127
waterfall ( [
108
128
( cb ) => self . validateTransaction ( txParams , cb ) ,
@@ -111,6 +131,11 @@ HookedWalletSubprovider.prototype.handleRequest = function(payload, next, end){
111
131
return
112
132
113
133
case 'eth_sign' :
134
+ // check for full method override
135
+ if ( opts . eth_sign ) {
136
+ return opts . eth_sign ( payload , next , end )
137
+ }
138
+ // process normally
114
139
var address = payload . params [ 0 ]
115
140
var message = payload . params [ 1 ]
116
141
// non-standard "extraParams" to be appended to our "msgParams" obj
@@ -127,6 +152,11 @@ HookedWalletSubprovider.prototype.handleRequest = function(payload, next, end){
127
152
return
128
153
129
154
case 'personal_sign' :
155
+ // check for full method override
156
+ if ( opts . personal_sign ) {
157
+ return opts . personal_sign ( payload , next , end )
158
+ }
159
+ // process normally
130
160
const first = payload . params [ 0 ]
131
161
const second = payload . params [ 1 ]
132
162
@@ -167,6 +197,11 @@ HookedWalletSubprovider.prototype.handleRequest = function(payload, next, end){
167
197
return
168
198
169
199
case 'personal_ecRecover' :
200
+ // check for full method override
201
+ if ( opts . personal_ecRecover ) {
202
+ return opts . personal_ecRecover ( payload , next , end )
203
+ }
204
+ // process normally
170
205
var message = payload . params [ 0 ]
171
206
var signature = payload . params [ 1 ]
172
207
// non-standard "extraParams" to be appended to our "msgParams" obj
@@ -180,6 +215,11 @@ HookedWalletSubprovider.prototype.handleRequest = function(payload, next, end){
180
215
return
181
216
182
217
case 'eth_signTypedData' :
218
+ // check for full method override
219
+ if ( opts . eth_signTypedData ) {
220
+ return opts . eth_signTypedData ( payload , next , end )
221
+ }
222
+ // process normally
183
223
message = payload . params [ 0 ]
184
224
address = payload . params [ 1 ]
185
225
var extraParams = payload . params [ 2 ] || { }
0 commit comments