-
Notifications
You must be signed in to change notification settings - Fork 26
/
EthereumClient.go
332 lines (274 loc) · 8.58 KB
/
EthereumClient.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
// Code generated by mockery v2.28.1. DO NOT EDIT.
package mocks
import (
context "context"
big "math/big"
common "github.com/ethereum/go-ethereum/common"
ethereum "github.com/ethereum/go-ethereum"
mock "github.com/stretchr/testify/mock"
types "github.com/ethereum/go-ethereum/core/types"
)
// EthereumClient is an autogenerated mock type for the EthereumClient type
type EthereumClient struct {
mock.Mock
}
// CallContract provides a mock function with given fields: ctx, call, blockNumber
func (_m *EthereumClient) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) {
ret := _m.Called(ctx, call, blockNumber)
var r0 []byte
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, ethereum.CallMsg, *big.Int) ([]byte, error)); ok {
return rf(ctx, call, blockNumber)
}
if rf, ok := ret.Get(0).(func(context.Context, ethereum.CallMsg, *big.Int) []byte); ok {
r0 = rf(ctx, call, blockNumber)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
if rf, ok := ret.Get(1).(func(context.Context, ethereum.CallMsg, *big.Int) error); ok {
r1 = rf(ctx, call, blockNumber)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ChainID provides a mock function with given fields: ctx
func (_m *EthereumClient) ChainID(ctx context.Context) (*big.Int, error) {
ret := _m.Called(ctx)
var r0 *big.Int
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*big.Int, error)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) *big.Int); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*big.Int)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CodeAt provides a mock function with given fields: ctx, contract, blockNumber
func (_m *EthereumClient) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) {
ret := _m.Called(ctx, contract, blockNumber)
var r0 []byte
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, common.Address, *big.Int) ([]byte, error)); ok {
return rf(ctx, contract, blockNumber)
}
if rf, ok := ret.Get(0).(func(context.Context, common.Address, *big.Int) []byte); ok {
r0 = rf(ctx, contract, blockNumber)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
if rf, ok := ret.Get(1).(func(context.Context, common.Address, *big.Int) error); ok {
r1 = rf(ctx, contract, blockNumber)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// EstimateGas provides a mock function with given fields: ctx, call
func (_m *EthereumClient) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error) {
ret := _m.Called(ctx, call)
var r0 uint64
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, ethereum.CallMsg) (uint64, error)); ok {
return rf(ctx, call)
}
if rf, ok := ret.Get(0).(func(context.Context, ethereum.CallMsg) uint64); ok {
r0 = rf(ctx, call)
} else {
r0 = ret.Get(0).(uint64)
}
if rf, ok := ret.Get(1).(func(context.Context, ethereum.CallMsg) error); ok {
r1 = rf(ctx, call)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// FilterLogs provides a mock function with given fields: ctx, query
func (_m *EthereumClient) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error) {
ret := _m.Called(ctx, query)
var r0 []types.Log
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, ethereum.FilterQuery) ([]types.Log, error)); ok {
return rf(ctx, query)
}
if rf, ok := ret.Get(0).(func(context.Context, ethereum.FilterQuery) []types.Log); ok {
r0 = rf(ctx, query)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]types.Log)
}
}
if rf, ok := ret.Get(1).(func(context.Context, ethereum.FilterQuery) error); ok {
r1 = rf(ctx, query)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// HeaderByNumber provides a mock function with given fields: ctx, number
func (_m *EthereumClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) {
ret := _m.Called(ctx, number)
var r0 *types.Header
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *big.Int) (*types.Header, error)); ok {
return rf(ctx, number)
}
if rf, ok := ret.Get(0).(func(context.Context, *big.Int) *types.Header); ok {
r0 = rf(ctx, number)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*types.Header)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *big.Int) error); ok {
r1 = rf(ctx, number)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PendingCodeAt provides a mock function with given fields: ctx, account
func (_m *EthereumClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error) {
ret := _m.Called(ctx, account)
var r0 []byte
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, common.Address) ([]byte, error)); ok {
return rf(ctx, account)
}
if rf, ok := ret.Get(0).(func(context.Context, common.Address) []byte); ok {
r0 = rf(ctx, account)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
if rf, ok := ret.Get(1).(func(context.Context, common.Address) error); ok {
r1 = rf(ctx, account)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PendingNonceAt provides a mock function with given fields: ctx, account
func (_m *EthereumClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error) {
ret := _m.Called(ctx, account)
var r0 uint64
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, common.Address) (uint64, error)); ok {
return rf(ctx, account)
}
if rf, ok := ret.Get(0).(func(context.Context, common.Address) uint64); ok {
r0 = rf(ctx, account)
} else {
r0 = ret.Get(0).(uint64)
}
if rf, ok := ret.Get(1).(func(context.Context, common.Address) error); ok {
r1 = rf(ctx, account)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SendTransaction provides a mock function with given fields: ctx, tx
func (_m *EthereumClient) SendTransaction(ctx context.Context, tx *types.Transaction) error {
ret := _m.Called(ctx, tx)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Transaction) error); ok {
r0 = rf(ctx, tx)
} else {
r0 = ret.Error(0)
}
return r0
}
// SubscribeFilterLogs provides a mock function with given fields: ctx, query, ch
func (_m *EthereumClient) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) {
ret := _m.Called(ctx, query, ch)
var r0 ethereum.Subscription
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, ethereum.FilterQuery, chan<- types.Log) (ethereum.Subscription, error)); ok {
return rf(ctx, query, ch)
}
if rf, ok := ret.Get(0).(func(context.Context, ethereum.FilterQuery, chan<- types.Log) ethereum.Subscription); ok {
r0 = rf(ctx, query, ch)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(ethereum.Subscription)
}
}
if rf, ok := ret.Get(1).(func(context.Context, ethereum.FilterQuery, chan<- types.Log) error); ok {
r1 = rf(ctx, query, ch)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SuggestGasPrice provides a mock function with given fields: ctx
func (_m *EthereumClient) SuggestGasPrice(ctx context.Context) (*big.Int, error) {
ret := _m.Called(ctx)
var r0 *big.Int
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*big.Int, error)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) *big.Int); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*big.Int)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SuggestGasTipCap provides a mock function with given fields: ctx
func (_m *EthereumClient) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
ret := _m.Called(ctx)
var r0 *big.Int
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*big.Int, error)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) *big.Int); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*big.Int)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
type mockConstructorTestingTNewEthereumClient interface {
mock.TestingT
Cleanup(func())
}
// NewEthereumClient creates a new instance of EthereumClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewEthereumClient(t mockConstructorTestingTNewEthereumClient) *EthereumClient {
mock := &EthereumClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}