From 43eb1243b3660d1bcfa6e0186cb4f001c9ded12d Mon Sep 17 00:00:00 2001 From: Awbrey Hughlett Date: Tue, 19 Nov 2024 20:02:48 -0500 Subject: [PATCH] Move mockery configs to single config file (#932) * move mockery to config file and update go version in build script * add mockery to makefile --- .mockery.yaml | 39 + Makefile | 1 + pkg/monitoring/chain_reader.go | 1 - pkg/monitoring/metrics/feedbalances.go | 2 - pkg/monitoring/metrics/fees.go | 2 - pkg/monitoring/metrics/mocks/FeedBalances.go | 69 -- pkg/monitoring/metrics/mocks/Fees.go | 66 ++ pkg/monitoring/metrics/mocks/NetworkFees.go | 37 - pkg/monitoring/metrics/mocks/NodeBalances.go | 34 - pkg/monitoring/metrics/mocks/NodeSuccess.go | 37 - .../metrics/mocks/ReportObservations.go | 37 - pkg/monitoring/metrics/mocks/SlotHeight.go | 37 - pkg/monitoring/metrics/mocks/feed_balances.go | 164 ++++ pkg/monitoring/metrics/mocks/network_fees.go | 101 +++ pkg/monitoring/metrics/mocks/node_balances.go | 101 +++ pkg/monitoring/metrics/mocks/node_success.go | 102 +++ .../metrics/mocks/report_observations.go | 102 +++ pkg/monitoring/metrics/mocks/slot_height.go | 102 +++ pkg/monitoring/metrics/networkfees.go | 2 - pkg/monitoring/metrics/nodebalances.go | 2 - pkg/monitoring/metrics/nodesuccess.go | 2 - pkg/monitoring/metrics/reportobservations.go | 2 - pkg/monitoring/metrics/slotheight.go | 2 - pkg/monitoring/mocks/ChainReader.go | 282 ------- pkg/monitoring/mocks/chain_reader.go | 527 +++++++++++++ pkg/solana/client/client.go | 1 - pkg/solana/client/mocks/ReaderWriter.go | 384 --------- pkg/solana/client/mocks/reader_writer.go | 739 ++++++++++++++++++ pkg/solana/config/config.go | 1 - pkg/solana/config/mocks/config.go | 548 +++++++++++++ pkg/solana/fees/estimator.go | 1 - pkg/solana/fees/mocks/Estimator.go | 90 +++ pkg/solana/txm/mocks/simple_keystore.go | 66 ++ pkg/solana/txm/txm.go | 1 - scripts/build-contract-artifacts-action.sh | 4 +- 35 files changed, 2750 insertions(+), 938 deletions(-) create mode 100644 .mockery.yaml delete mode 100644 pkg/monitoring/metrics/mocks/FeedBalances.go delete mode 100644 pkg/monitoring/metrics/mocks/NetworkFees.go delete mode 100644 pkg/monitoring/metrics/mocks/NodeBalances.go delete mode 100644 pkg/monitoring/metrics/mocks/NodeSuccess.go delete mode 100644 pkg/monitoring/metrics/mocks/ReportObservations.go delete mode 100644 pkg/monitoring/metrics/mocks/SlotHeight.go create mode 100644 pkg/monitoring/metrics/mocks/feed_balances.go create mode 100644 pkg/monitoring/metrics/mocks/network_fees.go create mode 100644 pkg/monitoring/metrics/mocks/node_balances.go create mode 100644 pkg/monitoring/metrics/mocks/node_success.go create mode 100644 pkg/monitoring/metrics/mocks/report_observations.go create mode 100644 pkg/monitoring/metrics/mocks/slot_height.go delete mode 100644 pkg/monitoring/mocks/ChainReader.go create mode 100644 pkg/monitoring/mocks/chain_reader.go delete mode 100644 pkg/solana/client/mocks/ReaderWriter.go create mode 100644 pkg/solana/client/mocks/reader_writer.go diff --git a/.mockery.yaml b/.mockery.yaml new file mode 100644 index 000000000..1ef8d4a73 --- /dev/null +++ b/.mockery.yaml @@ -0,0 +1,39 @@ +dir: "{{ .InterfaceDir }}/mocks" +mockname: "{{ .InterfaceName }}" +outpkg: mocks +filename: "{{ .InterfaceName | snakecase }}.go" +packages: + github.com/smartcontractkit/chainlink-solana/pkg/monitoring: + interfaces: + ChainReader: + github.com/smartcontractkit/chainlink-solana/pkg/monitoring/metrics: + interfaces: + FeedBalances: + Fees: + config: + filename: "Fees.go" + NetworkFees: + NodeBalances: + NodeSuccess: + ReportObservations: + SlotHeight: + github.com/smartcontractkit/chainlink-solana/pkg/solana/client: + interfaces: + ReaderWriter: + github.com/smartcontractkit/chainlink-solana/pkg/solana/config: + interfaces: + Config: + config: + filename: config.go + case: underscore + github.com/smartcontractkit/chainlink-solana/pkg/solana/fees: + interfaces: + Estimator: + config: + filename: "Estimator.go" + github.com/smartcontractkit/chainlink-solana/pkg/solana/txm: + interfaces: + SimpleKeystore: + config: + filename: simple_keystore.go + case: underscore \ No newline at end of file diff --git a/Makefile b/Makefile index 27f3f7d31..0f3fd8843 100644 --- a/Makefile +++ b/Makefile @@ -111,6 +111,7 @@ rm-mocked: .PHONY: generate generate: mockery gomods gomods -w go generate -x ./... + mockery .PHONY: lint-go-integration-tests lint-go-integration-tests: diff --git a/pkg/monitoring/chain_reader.go b/pkg/monitoring/chain_reader.go index 9b8c8ebff..8aef3f5b1 100644 --- a/pkg/monitoring/chain_reader.go +++ b/pkg/monitoring/chain_reader.go @@ -10,7 +10,6 @@ import ( "github.com/smartcontractkit/chainlink-solana/pkg/solana/client" ) -//go:generate mockery --name ChainReader --output ./mocks/ type ChainReader interface { GetState(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (state pkgSolana.State, blockHeight uint64, err error) GetLatestTransmission(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (answer pkgSolana.Answer, blockHeight uint64, err error) diff --git a/pkg/monitoring/metrics/feedbalances.go b/pkg/monitoring/metrics/feedbalances.go index c56c86a75..54e856ad4 100644 --- a/pkg/monitoring/metrics/feedbalances.go +++ b/pkg/monitoring/metrics/feedbalances.go @@ -8,8 +8,6 @@ import ( commonMonitoring "github.com/smartcontractkit/chainlink-common/pkg/monitoring" ) -//go:generate mockery --name FeedBalances --output ./mocks/ - type FeedBalances interface { Exists(balanceAccountName string) (*prometheus.GaugeVec, bool) SetBalance(balance uint64, balanceAccountName string, feedInput FeedInput) diff --git a/pkg/monitoring/metrics/fees.go b/pkg/monitoring/metrics/fees.go index 883b69485..05aed3fc9 100644 --- a/pkg/monitoring/metrics/fees.go +++ b/pkg/monitoring/metrics/fees.go @@ -7,8 +7,6 @@ import ( "github.com/smartcontractkit/chainlink-solana/pkg/solana/fees" ) -//go:generate mockery --name Fees --output ./mocks/ - type Fees interface { Set(txFee uint64, computeUnitPrice fees.ComputeUnitPrice, feedInput FeedInput) Cleanup(feedInput FeedInput) diff --git a/pkg/monitoring/metrics/mocks/FeedBalances.go b/pkg/monitoring/metrics/mocks/FeedBalances.go deleted file mode 100644 index ded286e81..000000000 --- a/pkg/monitoring/metrics/mocks/FeedBalances.go +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - metrics "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/metrics" - mock "github.com/stretchr/testify/mock" - - prometheus "github.com/prometheus/client_golang/prometheus" -) - -// FeedBalances is an autogenerated mock type for the FeedBalances type -type FeedBalances struct { - mock.Mock -} - -// Cleanup provides a mock function with given fields: balanceAccountName, feedInput -func (_m *FeedBalances) Cleanup(balanceAccountName string, feedInput metrics.FeedInput) { - _m.Called(balanceAccountName, feedInput) -} - -// Exists provides a mock function with given fields: balanceAccountName -func (_m *FeedBalances) Exists(balanceAccountName string) (*prometheus.GaugeVec, bool) { - ret := _m.Called(balanceAccountName) - - if len(ret) == 0 { - panic("no return value specified for Exists") - } - - var r0 *prometheus.GaugeVec - var r1 bool - if rf, ok := ret.Get(0).(func(string) (*prometheus.GaugeVec, bool)); ok { - return rf(balanceAccountName) - } - if rf, ok := ret.Get(0).(func(string) *prometheus.GaugeVec); ok { - r0 = rf(balanceAccountName) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*prometheus.GaugeVec) - } - } - - if rf, ok := ret.Get(1).(func(string) bool); ok { - r1 = rf(balanceAccountName) - } else { - r1 = ret.Get(1).(bool) - } - - return r0, r1 -} - -// SetBalance provides a mock function with given fields: balance, balanceAccountName, feedInput -func (_m *FeedBalances) SetBalance(balance uint64, balanceAccountName string, feedInput metrics.FeedInput) { - _m.Called(balance, balanceAccountName, feedInput) -} - -// NewFeedBalances creates a new instance of FeedBalances. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewFeedBalances(t interface { - mock.TestingT - Cleanup(func()) -}) *FeedBalances { - mock := &FeedBalances{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/monitoring/metrics/mocks/Fees.go b/pkg/monitoring/metrics/mocks/Fees.go index e435cfabd..3bb621ec5 100644 --- a/pkg/monitoring/metrics/mocks/Fees.go +++ b/pkg/monitoring/metrics/mocks/Fees.go @@ -14,16 +14,82 @@ type Fees struct { mock.Mock } +type Fees_Expecter struct { + mock *mock.Mock +} + +func (_m *Fees) EXPECT() *Fees_Expecter { + return &Fees_Expecter{mock: &_m.Mock} +} + // Cleanup provides a mock function with given fields: feedInput func (_m *Fees) Cleanup(feedInput metrics.FeedInput) { _m.Called(feedInput) } +// Fees_Cleanup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Cleanup' +type Fees_Cleanup_Call struct { + *mock.Call +} + +// Cleanup is a helper method to define mock.On call +// - feedInput metrics.FeedInput +func (_e *Fees_Expecter) Cleanup(feedInput interface{}) *Fees_Cleanup_Call { + return &Fees_Cleanup_Call{Call: _e.mock.On("Cleanup", feedInput)} +} + +func (_c *Fees_Cleanup_Call) Run(run func(feedInput metrics.FeedInput)) *Fees_Cleanup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(metrics.FeedInput)) + }) + return _c +} + +func (_c *Fees_Cleanup_Call) Return() *Fees_Cleanup_Call { + _c.Call.Return() + return _c +} + +func (_c *Fees_Cleanup_Call) RunAndReturn(run func(metrics.FeedInput)) *Fees_Cleanup_Call { + _c.Call.Return(run) + return _c +} + // Set provides a mock function with given fields: txFee, computeUnitPrice, feedInput func (_m *Fees) Set(txFee uint64, computeUnitPrice fees.ComputeUnitPrice, feedInput metrics.FeedInput) { _m.Called(txFee, computeUnitPrice, feedInput) } +// Fees_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set' +type Fees_Set_Call struct { + *mock.Call +} + +// Set is a helper method to define mock.On call +// - txFee uint64 +// - computeUnitPrice fees.ComputeUnitPrice +// - feedInput metrics.FeedInput +func (_e *Fees_Expecter) Set(txFee interface{}, computeUnitPrice interface{}, feedInput interface{}) *Fees_Set_Call { + return &Fees_Set_Call{Call: _e.mock.On("Set", txFee, computeUnitPrice, feedInput)} +} + +func (_c *Fees_Set_Call) Run(run func(txFee uint64, computeUnitPrice fees.ComputeUnitPrice, feedInput metrics.FeedInput)) *Fees_Set_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint64), args[1].(fees.ComputeUnitPrice), args[2].(metrics.FeedInput)) + }) + return _c +} + +func (_c *Fees_Set_Call) Return() *Fees_Set_Call { + _c.Call.Return() + return _c +} + +func (_c *Fees_Set_Call) RunAndReturn(run func(uint64, fees.ComputeUnitPrice, metrics.FeedInput)) *Fees_Set_Call { + _c.Call.Return(run) + return _c +} + // NewFees creates a new instance of Fees. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewFees(t interface { diff --git a/pkg/monitoring/metrics/mocks/NetworkFees.go b/pkg/monitoring/metrics/mocks/NetworkFees.go deleted file mode 100644 index 3b27dbd93..000000000 --- a/pkg/monitoring/metrics/mocks/NetworkFees.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - metrics "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/metrics" - mock "github.com/stretchr/testify/mock" -) - -// NetworkFees is an autogenerated mock type for the NetworkFees type -type NetworkFees struct { - mock.Mock -} - -// Cleanup provides a mock function with given fields: -func (_m *NetworkFees) Cleanup() { - _m.Called() -} - -// Set provides a mock function with given fields: slot, chain -func (_m *NetworkFees) Set(slot metrics.NetworkFeesInput, chain string) { - _m.Called(slot, chain) -} - -// NewNetworkFees creates a new instance of NetworkFees. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewNetworkFees(t interface { - mock.TestingT - Cleanup(func()) -}) *NetworkFees { - mock := &NetworkFees{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/monitoring/metrics/mocks/NodeBalances.go b/pkg/monitoring/metrics/mocks/NodeBalances.go deleted file mode 100644 index bbf9aa4b8..000000000 --- a/pkg/monitoring/metrics/mocks/NodeBalances.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// NodeBalances is an autogenerated mock type for the NodeBalances type -type NodeBalances struct { - mock.Mock -} - -// Cleanup provides a mock function with given fields: address, operator -func (_m *NodeBalances) Cleanup(address string, operator string) { - _m.Called(address, operator) -} - -// SetBalance provides a mock function with given fields: balance, address, operator -func (_m *NodeBalances) SetBalance(balance uint64, address string, operator string) { - _m.Called(balance, address, operator) -} - -// NewNodeBalances creates a new instance of NodeBalances. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewNodeBalances(t interface { - mock.TestingT - Cleanup(func()) -}) *NodeBalances { - mock := &NodeBalances{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/monitoring/metrics/mocks/NodeSuccess.go b/pkg/monitoring/metrics/mocks/NodeSuccess.go deleted file mode 100644 index b80b46f59..000000000 --- a/pkg/monitoring/metrics/mocks/NodeSuccess.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - metrics "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/metrics" - mock "github.com/stretchr/testify/mock" -) - -// NodeSuccess is an autogenerated mock type for the NodeSuccess type -type NodeSuccess struct { - mock.Mock -} - -// Add provides a mock function with given fields: count, i -func (_m *NodeSuccess) Add(count int, i metrics.NodeFeedInput) { - _m.Called(count, i) -} - -// Cleanup provides a mock function with given fields: i -func (_m *NodeSuccess) Cleanup(i metrics.NodeFeedInput) { - _m.Called(i) -} - -// NewNodeSuccess creates a new instance of NodeSuccess. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewNodeSuccess(t interface { - mock.TestingT - Cleanup(func()) -}) *NodeSuccess { - mock := &NodeSuccess{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/monitoring/metrics/mocks/ReportObservations.go b/pkg/monitoring/metrics/mocks/ReportObservations.go deleted file mode 100644 index 814d997eb..000000000 --- a/pkg/monitoring/metrics/mocks/ReportObservations.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - metrics "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/metrics" - mock "github.com/stretchr/testify/mock" -) - -// ReportObservations is an autogenerated mock type for the ReportObservations type -type ReportObservations struct { - mock.Mock -} - -// Cleanup provides a mock function with given fields: feedInput -func (_m *ReportObservations) Cleanup(feedInput metrics.FeedInput) { - _m.Called(feedInput) -} - -// SetCount provides a mock function with given fields: count, feedInput -func (_m *ReportObservations) SetCount(count uint8, feedInput metrics.FeedInput) { - _m.Called(count, feedInput) -} - -// NewReportObservations creates a new instance of ReportObservations. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewReportObservations(t interface { - mock.TestingT - Cleanup(func()) -}) *ReportObservations { - mock := &ReportObservations{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/monitoring/metrics/mocks/SlotHeight.go b/pkg/monitoring/metrics/mocks/SlotHeight.go deleted file mode 100644 index 22de7542b..000000000 --- a/pkg/monitoring/metrics/mocks/SlotHeight.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - types "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/types" - mock "github.com/stretchr/testify/mock" -) - -// SlotHeight is an autogenerated mock type for the SlotHeight type -type SlotHeight struct { - mock.Mock -} - -// Cleanup provides a mock function with given fields: -func (_m *SlotHeight) Cleanup() { - _m.Called() -} - -// Set provides a mock function with given fields: slot, chain, url -func (_m *SlotHeight) Set(slot types.SlotHeight, chain string, url string) { - _m.Called(slot, chain, url) -} - -// NewSlotHeight creates a new instance of SlotHeight. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewSlotHeight(t interface { - mock.TestingT - Cleanup(func()) -}) *SlotHeight { - mock := &SlotHeight{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/monitoring/metrics/mocks/feed_balances.go b/pkg/monitoring/metrics/mocks/feed_balances.go new file mode 100644 index 000000000..4cbbcc858 --- /dev/null +++ b/pkg/monitoring/metrics/mocks/feed_balances.go @@ -0,0 +1,164 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import ( + metrics "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/metrics" + mock "github.com/stretchr/testify/mock" + + prometheus "github.com/prometheus/client_golang/prometheus" +) + +// FeedBalances is an autogenerated mock type for the FeedBalances type +type FeedBalances struct { + mock.Mock +} + +type FeedBalances_Expecter struct { + mock *mock.Mock +} + +func (_m *FeedBalances) EXPECT() *FeedBalances_Expecter { + return &FeedBalances_Expecter{mock: &_m.Mock} +} + +// Cleanup provides a mock function with given fields: balanceAccountName, feedInput +func (_m *FeedBalances) Cleanup(balanceAccountName string, feedInput metrics.FeedInput) { + _m.Called(balanceAccountName, feedInput) +} + +// FeedBalances_Cleanup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Cleanup' +type FeedBalances_Cleanup_Call struct { + *mock.Call +} + +// Cleanup is a helper method to define mock.On call +// - balanceAccountName string +// - feedInput metrics.FeedInput +func (_e *FeedBalances_Expecter) Cleanup(balanceAccountName interface{}, feedInput interface{}) *FeedBalances_Cleanup_Call { + return &FeedBalances_Cleanup_Call{Call: _e.mock.On("Cleanup", balanceAccountName, feedInput)} +} + +func (_c *FeedBalances_Cleanup_Call) Run(run func(balanceAccountName string, feedInput metrics.FeedInput)) *FeedBalances_Cleanup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(metrics.FeedInput)) + }) + return _c +} + +func (_c *FeedBalances_Cleanup_Call) Return() *FeedBalances_Cleanup_Call { + _c.Call.Return() + return _c +} + +func (_c *FeedBalances_Cleanup_Call) RunAndReturn(run func(string, metrics.FeedInput)) *FeedBalances_Cleanup_Call { + _c.Call.Return(run) + return _c +} + +// Exists provides a mock function with given fields: balanceAccountName +func (_m *FeedBalances) Exists(balanceAccountName string) (*prometheus.GaugeVec, bool) { + ret := _m.Called(balanceAccountName) + + if len(ret) == 0 { + panic("no return value specified for Exists") + } + + var r0 *prometheus.GaugeVec + var r1 bool + if rf, ok := ret.Get(0).(func(string) (*prometheus.GaugeVec, bool)); ok { + return rf(balanceAccountName) + } + if rf, ok := ret.Get(0).(func(string) *prometheus.GaugeVec); ok { + r0 = rf(balanceAccountName) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*prometheus.GaugeVec) + } + } + + if rf, ok := ret.Get(1).(func(string) bool); ok { + r1 = rf(balanceAccountName) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + +// FeedBalances_Exists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Exists' +type FeedBalances_Exists_Call struct { + *mock.Call +} + +// Exists is a helper method to define mock.On call +// - balanceAccountName string +func (_e *FeedBalances_Expecter) Exists(balanceAccountName interface{}) *FeedBalances_Exists_Call { + return &FeedBalances_Exists_Call{Call: _e.mock.On("Exists", balanceAccountName)} +} + +func (_c *FeedBalances_Exists_Call) Run(run func(balanceAccountName string)) *FeedBalances_Exists_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *FeedBalances_Exists_Call) Return(_a0 *prometheus.GaugeVec, _a1 bool) *FeedBalances_Exists_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *FeedBalances_Exists_Call) RunAndReturn(run func(string) (*prometheus.GaugeVec, bool)) *FeedBalances_Exists_Call { + _c.Call.Return(run) + return _c +} + +// SetBalance provides a mock function with given fields: balance, balanceAccountName, feedInput +func (_m *FeedBalances) SetBalance(balance uint64, balanceAccountName string, feedInput metrics.FeedInput) { + _m.Called(balance, balanceAccountName, feedInput) +} + +// FeedBalances_SetBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetBalance' +type FeedBalances_SetBalance_Call struct { + *mock.Call +} + +// SetBalance is a helper method to define mock.On call +// - balance uint64 +// - balanceAccountName string +// - feedInput metrics.FeedInput +func (_e *FeedBalances_Expecter) SetBalance(balance interface{}, balanceAccountName interface{}, feedInput interface{}) *FeedBalances_SetBalance_Call { + return &FeedBalances_SetBalance_Call{Call: _e.mock.On("SetBalance", balance, balanceAccountName, feedInput)} +} + +func (_c *FeedBalances_SetBalance_Call) Run(run func(balance uint64, balanceAccountName string, feedInput metrics.FeedInput)) *FeedBalances_SetBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint64), args[1].(string), args[2].(metrics.FeedInput)) + }) + return _c +} + +func (_c *FeedBalances_SetBalance_Call) Return() *FeedBalances_SetBalance_Call { + _c.Call.Return() + return _c +} + +func (_c *FeedBalances_SetBalance_Call) RunAndReturn(run func(uint64, string, metrics.FeedInput)) *FeedBalances_SetBalance_Call { + _c.Call.Return(run) + return _c +} + +// NewFeedBalances creates a new instance of FeedBalances. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewFeedBalances(t interface { + mock.TestingT + Cleanup(func()) +}) *FeedBalances { + mock := &FeedBalances{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/monitoring/metrics/mocks/network_fees.go b/pkg/monitoring/metrics/mocks/network_fees.go new file mode 100644 index 000000000..1257f3603 --- /dev/null +++ b/pkg/monitoring/metrics/mocks/network_fees.go @@ -0,0 +1,101 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import ( + metrics "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/metrics" + mock "github.com/stretchr/testify/mock" +) + +// NetworkFees is an autogenerated mock type for the NetworkFees type +type NetworkFees struct { + mock.Mock +} + +type NetworkFees_Expecter struct { + mock *mock.Mock +} + +func (_m *NetworkFees) EXPECT() *NetworkFees_Expecter { + return &NetworkFees_Expecter{mock: &_m.Mock} +} + +// Cleanup provides a mock function with given fields: +func (_m *NetworkFees) Cleanup() { + _m.Called() +} + +// NetworkFees_Cleanup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Cleanup' +type NetworkFees_Cleanup_Call struct { + *mock.Call +} + +// Cleanup is a helper method to define mock.On call +func (_e *NetworkFees_Expecter) Cleanup() *NetworkFees_Cleanup_Call { + return &NetworkFees_Cleanup_Call{Call: _e.mock.On("Cleanup")} +} + +func (_c *NetworkFees_Cleanup_Call) Run(run func()) *NetworkFees_Cleanup_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *NetworkFees_Cleanup_Call) Return() *NetworkFees_Cleanup_Call { + _c.Call.Return() + return _c +} + +func (_c *NetworkFees_Cleanup_Call) RunAndReturn(run func()) *NetworkFees_Cleanup_Call { + _c.Call.Return(run) + return _c +} + +// Set provides a mock function with given fields: slot, chain +func (_m *NetworkFees) Set(slot metrics.NetworkFeesInput, chain string) { + _m.Called(slot, chain) +} + +// NetworkFees_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set' +type NetworkFees_Set_Call struct { + *mock.Call +} + +// Set is a helper method to define mock.On call +// - slot metrics.NetworkFeesInput +// - chain string +func (_e *NetworkFees_Expecter) Set(slot interface{}, chain interface{}) *NetworkFees_Set_Call { + return &NetworkFees_Set_Call{Call: _e.mock.On("Set", slot, chain)} +} + +func (_c *NetworkFees_Set_Call) Run(run func(slot metrics.NetworkFeesInput, chain string)) *NetworkFees_Set_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(metrics.NetworkFeesInput), args[1].(string)) + }) + return _c +} + +func (_c *NetworkFees_Set_Call) Return() *NetworkFees_Set_Call { + _c.Call.Return() + return _c +} + +func (_c *NetworkFees_Set_Call) RunAndReturn(run func(metrics.NetworkFeesInput, string)) *NetworkFees_Set_Call { + _c.Call.Return(run) + return _c +} + +// NewNetworkFees creates a new instance of NetworkFees. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewNetworkFees(t interface { + mock.TestingT + Cleanup(func()) +}) *NetworkFees { + mock := &NetworkFees{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/monitoring/metrics/mocks/node_balances.go b/pkg/monitoring/metrics/mocks/node_balances.go new file mode 100644 index 000000000..643a6ca48 --- /dev/null +++ b/pkg/monitoring/metrics/mocks/node_balances.go @@ -0,0 +1,101 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" + +// NodeBalances is an autogenerated mock type for the NodeBalances type +type NodeBalances struct { + mock.Mock +} + +type NodeBalances_Expecter struct { + mock *mock.Mock +} + +func (_m *NodeBalances) EXPECT() *NodeBalances_Expecter { + return &NodeBalances_Expecter{mock: &_m.Mock} +} + +// Cleanup provides a mock function with given fields: address, operator +func (_m *NodeBalances) Cleanup(address string, operator string) { + _m.Called(address, operator) +} + +// NodeBalances_Cleanup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Cleanup' +type NodeBalances_Cleanup_Call struct { + *mock.Call +} + +// Cleanup is a helper method to define mock.On call +// - address string +// - operator string +func (_e *NodeBalances_Expecter) Cleanup(address interface{}, operator interface{}) *NodeBalances_Cleanup_Call { + return &NodeBalances_Cleanup_Call{Call: _e.mock.On("Cleanup", address, operator)} +} + +func (_c *NodeBalances_Cleanup_Call) Run(run func(address string, operator string)) *NodeBalances_Cleanup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *NodeBalances_Cleanup_Call) Return() *NodeBalances_Cleanup_Call { + _c.Call.Return() + return _c +} + +func (_c *NodeBalances_Cleanup_Call) RunAndReturn(run func(string, string)) *NodeBalances_Cleanup_Call { + _c.Call.Return(run) + return _c +} + +// SetBalance provides a mock function with given fields: balance, address, operator +func (_m *NodeBalances) SetBalance(balance uint64, address string, operator string) { + _m.Called(balance, address, operator) +} + +// NodeBalances_SetBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetBalance' +type NodeBalances_SetBalance_Call struct { + *mock.Call +} + +// SetBalance is a helper method to define mock.On call +// - balance uint64 +// - address string +// - operator string +func (_e *NodeBalances_Expecter) SetBalance(balance interface{}, address interface{}, operator interface{}) *NodeBalances_SetBalance_Call { + return &NodeBalances_SetBalance_Call{Call: _e.mock.On("SetBalance", balance, address, operator)} +} + +func (_c *NodeBalances_SetBalance_Call) Run(run func(balance uint64, address string, operator string)) *NodeBalances_SetBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint64), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *NodeBalances_SetBalance_Call) Return() *NodeBalances_SetBalance_Call { + _c.Call.Return() + return _c +} + +func (_c *NodeBalances_SetBalance_Call) RunAndReturn(run func(uint64, string, string)) *NodeBalances_SetBalance_Call { + _c.Call.Return(run) + return _c +} + +// NewNodeBalances creates a new instance of NodeBalances. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewNodeBalances(t interface { + mock.TestingT + Cleanup(func()) +}) *NodeBalances { + mock := &NodeBalances{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/monitoring/metrics/mocks/node_success.go b/pkg/monitoring/metrics/mocks/node_success.go new file mode 100644 index 000000000..e36aeb501 --- /dev/null +++ b/pkg/monitoring/metrics/mocks/node_success.go @@ -0,0 +1,102 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import ( + metrics "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/metrics" + mock "github.com/stretchr/testify/mock" +) + +// NodeSuccess is an autogenerated mock type for the NodeSuccess type +type NodeSuccess struct { + mock.Mock +} + +type NodeSuccess_Expecter struct { + mock *mock.Mock +} + +func (_m *NodeSuccess) EXPECT() *NodeSuccess_Expecter { + return &NodeSuccess_Expecter{mock: &_m.Mock} +} + +// Add provides a mock function with given fields: count, i +func (_m *NodeSuccess) Add(count int, i metrics.NodeFeedInput) { + _m.Called(count, i) +} + +// NodeSuccess_Add_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Add' +type NodeSuccess_Add_Call struct { + *mock.Call +} + +// Add is a helper method to define mock.On call +// - count int +// - i metrics.NodeFeedInput +func (_e *NodeSuccess_Expecter) Add(count interface{}, i interface{}) *NodeSuccess_Add_Call { + return &NodeSuccess_Add_Call{Call: _e.mock.On("Add", count, i)} +} + +func (_c *NodeSuccess_Add_Call) Run(run func(count int, i metrics.NodeFeedInput)) *NodeSuccess_Add_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(int), args[1].(metrics.NodeFeedInput)) + }) + return _c +} + +func (_c *NodeSuccess_Add_Call) Return() *NodeSuccess_Add_Call { + _c.Call.Return() + return _c +} + +func (_c *NodeSuccess_Add_Call) RunAndReturn(run func(int, metrics.NodeFeedInput)) *NodeSuccess_Add_Call { + _c.Call.Return(run) + return _c +} + +// Cleanup provides a mock function with given fields: i +func (_m *NodeSuccess) Cleanup(i metrics.NodeFeedInput) { + _m.Called(i) +} + +// NodeSuccess_Cleanup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Cleanup' +type NodeSuccess_Cleanup_Call struct { + *mock.Call +} + +// Cleanup is a helper method to define mock.On call +// - i metrics.NodeFeedInput +func (_e *NodeSuccess_Expecter) Cleanup(i interface{}) *NodeSuccess_Cleanup_Call { + return &NodeSuccess_Cleanup_Call{Call: _e.mock.On("Cleanup", i)} +} + +func (_c *NodeSuccess_Cleanup_Call) Run(run func(i metrics.NodeFeedInput)) *NodeSuccess_Cleanup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(metrics.NodeFeedInput)) + }) + return _c +} + +func (_c *NodeSuccess_Cleanup_Call) Return() *NodeSuccess_Cleanup_Call { + _c.Call.Return() + return _c +} + +func (_c *NodeSuccess_Cleanup_Call) RunAndReturn(run func(metrics.NodeFeedInput)) *NodeSuccess_Cleanup_Call { + _c.Call.Return(run) + return _c +} + +// NewNodeSuccess creates a new instance of NodeSuccess. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewNodeSuccess(t interface { + mock.TestingT + Cleanup(func()) +}) *NodeSuccess { + mock := &NodeSuccess{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/monitoring/metrics/mocks/report_observations.go b/pkg/monitoring/metrics/mocks/report_observations.go new file mode 100644 index 000000000..78136a27a --- /dev/null +++ b/pkg/monitoring/metrics/mocks/report_observations.go @@ -0,0 +1,102 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import ( + metrics "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/metrics" + mock "github.com/stretchr/testify/mock" +) + +// ReportObservations is an autogenerated mock type for the ReportObservations type +type ReportObservations struct { + mock.Mock +} + +type ReportObservations_Expecter struct { + mock *mock.Mock +} + +func (_m *ReportObservations) EXPECT() *ReportObservations_Expecter { + return &ReportObservations_Expecter{mock: &_m.Mock} +} + +// Cleanup provides a mock function with given fields: feedInput +func (_m *ReportObservations) Cleanup(feedInput metrics.FeedInput) { + _m.Called(feedInput) +} + +// ReportObservations_Cleanup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Cleanup' +type ReportObservations_Cleanup_Call struct { + *mock.Call +} + +// Cleanup is a helper method to define mock.On call +// - feedInput metrics.FeedInput +func (_e *ReportObservations_Expecter) Cleanup(feedInput interface{}) *ReportObservations_Cleanup_Call { + return &ReportObservations_Cleanup_Call{Call: _e.mock.On("Cleanup", feedInput)} +} + +func (_c *ReportObservations_Cleanup_Call) Run(run func(feedInput metrics.FeedInput)) *ReportObservations_Cleanup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(metrics.FeedInput)) + }) + return _c +} + +func (_c *ReportObservations_Cleanup_Call) Return() *ReportObservations_Cleanup_Call { + _c.Call.Return() + return _c +} + +func (_c *ReportObservations_Cleanup_Call) RunAndReturn(run func(metrics.FeedInput)) *ReportObservations_Cleanup_Call { + _c.Call.Return(run) + return _c +} + +// SetCount provides a mock function with given fields: count, feedInput +func (_m *ReportObservations) SetCount(count uint8, feedInput metrics.FeedInput) { + _m.Called(count, feedInput) +} + +// ReportObservations_SetCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetCount' +type ReportObservations_SetCount_Call struct { + *mock.Call +} + +// SetCount is a helper method to define mock.On call +// - count uint8 +// - feedInput metrics.FeedInput +func (_e *ReportObservations_Expecter) SetCount(count interface{}, feedInput interface{}) *ReportObservations_SetCount_Call { + return &ReportObservations_SetCount_Call{Call: _e.mock.On("SetCount", count, feedInput)} +} + +func (_c *ReportObservations_SetCount_Call) Run(run func(count uint8, feedInput metrics.FeedInput)) *ReportObservations_SetCount_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint8), args[1].(metrics.FeedInput)) + }) + return _c +} + +func (_c *ReportObservations_SetCount_Call) Return() *ReportObservations_SetCount_Call { + _c.Call.Return() + return _c +} + +func (_c *ReportObservations_SetCount_Call) RunAndReturn(run func(uint8, metrics.FeedInput)) *ReportObservations_SetCount_Call { + _c.Call.Return(run) + return _c +} + +// NewReportObservations creates a new instance of ReportObservations. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewReportObservations(t interface { + mock.TestingT + Cleanup(func()) +}) *ReportObservations { + mock := &ReportObservations{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/monitoring/metrics/mocks/slot_height.go b/pkg/monitoring/metrics/mocks/slot_height.go new file mode 100644 index 000000000..990caea39 --- /dev/null +++ b/pkg/monitoring/metrics/mocks/slot_height.go @@ -0,0 +1,102 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import ( + types "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/types" + mock "github.com/stretchr/testify/mock" +) + +// SlotHeight is an autogenerated mock type for the SlotHeight type +type SlotHeight struct { + mock.Mock +} + +type SlotHeight_Expecter struct { + mock *mock.Mock +} + +func (_m *SlotHeight) EXPECT() *SlotHeight_Expecter { + return &SlotHeight_Expecter{mock: &_m.Mock} +} + +// Cleanup provides a mock function with given fields: +func (_m *SlotHeight) Cleanup() { + _m.Called() +} + +// SlotHeight_Cleanup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Cleanup' +type SlotHeight_Cleanup_Call struct { + *mock.Call +} + +// Cleanup is a helper method to define mock.On call +func (_e *SlotHeight_Expecter) Cleanup() *SlotHeight_Cleanup_Call { + return &SlotHeight_Cleanup_Call{Call: _e.mock.On("Cleanup")} +} + +func (_c *SlotHeight_Cleanup_Call) Run(run func()) *SlotHeight_Cleanup_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SlotHeight_Cleanup_Call) Return() *SlotHeight_Cleanup_Call { + _c.Call.Return() + return _c +} + +func (_c *SlotHeight_Cleanup_Call) RunAndReturn(run func()) *SlotHeight_Cleanup_Call { + _c.Call.Return(run) + return _c +} + +// Set provides a mock function with given fields: slot, chain, url +func (_m *SlotHeight) Set(slot types.SlotHeight, chain string, url string) { + _m.Called(slot, chain, url) +} + +// SlotHeight_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set' +type SlotHeight_Set_Call struct { + *mock.Call +} + +// Set is a helper method to define mock.On call +// - slot types.SlotHeight +// - chain string +// - url string +func (_e *SlotHeight_Expecter) Set(slot interface{}, chain interface{}, url interface{}) *SlotHeight_Set_Call { + return &SlotHeight_Set_Call{Call: _e.mock.On("Set", slot, chain, url)} +} + +func (_c *SlotHeight_Set_Call) Run(run func(slot types.SlotHeight, chain string, url string)) *SlotHeight_Set_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.SlotHeight), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *SlotHeight_Set_Call) Return() *SlotHeight_Set_Call { + _c.Call.Return() + return _c +} + +func (_c *SlotHeight_Set_Call) RunAndReturn(run func(types.SlotHeight, string, string)) *SlotHeight_Set_Call { + _c.Call.Return(run) + return _c +} + +// NewSlotHeight creates a new instance of SlotHeight. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewSlotHeight(t interface { + mock.TestingT + Cleanup(func()) +}) *SlotHeight { + mock := &SlotHeight{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/monitoring/metrics/networkfees.go b/pkg/monitoring/metrics/networkfees.go index 9700529e3..be5f93b19 100644 --- a/pkg/monitoring/metrics/networkfees.go +++ b/pkg/monitoring/metrics/networkfees.go @@ -7,8 +7,6 @@ import ( "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/types" ) -//go:generate mockery --name NetworkFees --output ./mocks/ - type NetworkFees interface { Set(slot NetworkFeesInput, chain string) Cleanup() diff --git a/pkg/monitoring/metrics/nodebalances.go b/pkg/monitoring/metrics/nodebalances.go index 9e14fa19d..109c8decd 100644 --- a/pkg/monitoring/metrics/nodebalances.go +++ b/pkg/monitoring/metrics/nodebalances.go @@ -8,8 +8,6 @@ import ( "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/types" ) -//go:generate mockery --name NodeBalances --output ./mocks/ - type NodeBalances interface { SetBalance(balance uint64, address, operator string) Cleanup(address, operator string) diff --git a/pkg/monitoring/metrics/nodesuccess.go b/pkg/monitoring/metrics/nodesuccess.go index 73cc00d94..87511284b 100644 --- a/pkg/monitoring/metrics/nodesuccess.go +++ b/pkg/monitoring/metrics/nodesuccess.go @@ -6,8 +6,6 @@ import ( "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/types" ) -//go:generate mockery --name NodeSuccess --output ./mocks/ - type NodeSuccess interface { Add(count int, i NodeFeedInput) Cleanup(i NodeFeedInput) diff --git a/pkg/monitoring/metrics/reportobservations.go b/pkg/monitoring/metrics/reportobservations.go index f790a4319..7fe037d03 100644 --- a/pkg/monitoring/metrics/reportobservations.go +++ b/pkg/monitoring/metrics/reportobservations.go @@ -6,8 +6,6 @@ import ( "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/types" ) -//go:generate mockery --name ReportObservations --output ./mocks/ - type ReportObservations interface { SetCount(count uint8, feedInput FeedInput) Cleanup(feedInput FeedInput) diff --git a/pkg/monitoring/metrics/slotheight.go b/pkg/monitoring/metrics/slotheight.go index 2c4c5caf5..3ccfa2111 100644 --- a/pkg/monitoring/metrics/slotheight.go +++ b/pkg/monitoring/metrics/slotheight.go @@ -7,8 +7,6 @@ import ( "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/types" ) -//go:generate mockery --name SlotHeight --output ./mocks/ - type SlotHeight interface { Set(slot types.SlotHeight, chain, url string) Cleanup() diff --git a/pkg/monitoring/mocks/ChainReader.go b/pkg/monitoring/mocks/ChainReader.go deleted file mode 100644 index 30b714305..000000000 --- a/pkg/monitoring/mocks/ChainReader.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - - pkgsolana "github.com/smartcontractkit/chainlink-solana/pkg/solana" - - rpc "github.com/gagliardetto/solana-go/rpc" - - solana "github.com/gagliardetto/solana-go" -) - -// ChainReader is an autogenerated mock type for the ChainReader type -type ChainReader struct { - mock.Mock -} - -// GetBalance provides a mock function with given fields: ctx, account, commitment -func (_m *ChainReader) GetBalance(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (*rpc.GetBalanceResult, error) { - ret := _m.Called(ctx, account, commitment) - - if len(ret) == 0 { - panic("no return value specified for GetBalance") - } - - var r0 *rpc.GetBalanceResult - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) (*rpc.GetBalanceResult, error)); ok { - return rf(ctx, account, commitment) - } - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) *rpc.GetBalanceResult); ok { - r0 = rf(ctx, account, commitment) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*rpc.GetBalanceResult) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey, rpc.CommitmentType) error); ok { - r1 = rf(ctx, account, commitment) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetLatestBlock provides a mock function with given fields: ctx, commitment -func (_m *ChainReader) GetLatestBlock(ctx context.Context, commitment rpc.CommitmentType) (*rpc.GetBlockResult, error) { - ret := _m.Called(ctx, commitment) - - if len(ret) == 0 { - panic("no return value specified for GetLatestBlock") - } - - var r0 *rpc.GetBlockResult - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, rpc.CommitmentType) (*rpc.GetBlockResult, error)); ok { - return rf(ctx, commitment) - } - if rf, ok := ret.Get(0).(func(context.Context, rpc.CommitmentType) *rpc.GetBlockResult); ok { - r0 = rf(ctx, commitment) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*rpc.GetBlockResult) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, rpc.CommitmentType) error); ok { - r1 = rf(ctx, commitment) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetLatestTransmission provides a mock function with given fields: ctx, account, commitment -func (_m *ChainReader) GetLatestTransmission(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (pkgsolana.Answer, uint64, error) { - ret := _m.Called(ctx, account, commitment) - - if len(ret) == 0 { - panic("no return value specified for GetLatestTransmission") - } - - var r0 pkgsolana.Answer - var r1 uint64 - var r2 error - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) (pkgsolana.Answer, uint64, error)); ok { - return rf(ctx, account, commitment) - } - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) pkgsolana.Answer); ok { - r0 = rf(ctx, account, commitment) - } else { - r0 = ret.Get(0).(pkgsolana.Answer) - } - - if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey, rpc.CommitmentType) uint64); ok { - r1 = rf(ctx, account, commitment) - } else { - r1 = ret.Get(1).(uint64) - } - - if rf, ok := ret.Get(2).(func(context.Context, solana.PublicKey, rpc.CommitmentType) error); ok { - r2 = rf(ctx, account, commitment) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetSignaturesForAddressWithOpts provides a mock function with given fields: ctx, account, opts -func (_m *ChainReader) GetSignaturesForAddressWithOpts(ctx context.Context, account solana.PublicKey, opts *rpc.GetSignaturesForAddressOpts) ([]*rpc.TransactionSignature, error) { - ret := _m.Called(ctx, account, opts) - - if len(ret) == 0 { - panic("no return value specified for GetSignaturesForAddressWithOpts") - } - - var r0 []*rpc.TransactionSignature - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, *rpc.GetSignaturesForAddressOpts) ([]*rpc.TransactionSignature, error)); ok { - return rf(ctx, account, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, *rpc.GetSignaturesForAddressOpts) []*rpc.TransactionSignature); ok { - r0 = rf(ctx, account, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*rpc.TransactionSignature) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey, *rpc.GetSignaturesForAddressOpts) error); ok { - r1 = rf(ctx, account, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetSlot provides a mock function with given fields: ctx -func (_m *ChainReader) GetSlot(ctx context.Context) (uint64, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetSlot") - } - - var r0 uint64 - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (uint64, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) uint64); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(uint64) - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetState provides a mock function with given fields: ctx, account, commitment -func (_m *ChainReader) GetState(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (pkgsolana.State, uint64, error) { - ret := _m.Called(ctx, account, commitment) - - if len(ret) == 0 { - panic("no return value specified for GetState") - } - - var r0 pkgsolana.State - var r1 uint64 - var r2 error - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) (pkgsolana.State, uint64, error)); ok { - return rf(ctx, account, commitment) - } - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) pkgsolana.State); ok { - r0 = rf(ctx, account, commitment) - } else { - r0 = ret.Get(0).(pkgsolana.State) - } - - if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey, rpc.CommitmentType) uint64); ok { - r1 = rf(ctx, account, commitment) - } else { - r1 = ret.Get(1).(uint64) - } - - if rf, ok := ret.Get(2).(func(context.Context, solana.PublicKey, rpc.CommitmentType) error); ok { - r2 = rf(ctx, account, commitment) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetTokenAccountBalance provides a mock function with given fields: ctx, account, commitment -func (_m *ChainReader) GetTokenAccountBalance(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (*rpc.GetTokenAccountBalanceResult, error) { - ret := _m.Called(ctx, account, commitment) - - if len(ret) == 0 { - panic("no return value specified for GetTokenAccountBalance") - } - - var r0 *rpc.GetTokenAccountBalanceResult - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) (*rpc.GetTokenAccountBalanceResult, error)); ok { - return rf(ctx, account, commitment) - } - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) *rpc.GetTokenAccountBalanceResult); ok { - r0 = rf(ctx, account, commitment) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*rpc.GetTokenAccountBalanceResult) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey, rpc.CommitmentType) error); ok { - r1 = rf(ctx, account, commitment) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetTransaction provides a mock function with given fields: ctx, txSig, opts -func (_m *ChainReader) GetTransaction(ctx context.Context, txSig solana.Signature, opts *rpc.GetTransactionOpts) (*rpc.GetTransactionResult, error) { - ret := _m.Called(ctx, txSig, opts) - - if len(ret) == 0 { - panic("no return value specified for GetTransaction") - } - - var r0 *rpc.GetTransactionResult - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, solana.Signature, *rpc.GetTransactionOpts) (*rpc.GetTransactionResult, error)); ok { - return rf(ctx, txSig, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, solana.Signature, *rpc.GetTransactionOpts) *rpc.GetTransactionResult); ok { - r0 = rf(ctx, txSig, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*rpc.GetTransactionResult) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, solana.Signature, *rpc.GetTransactionOpts) error); ok { - r1 = rf(ctx, txSig, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewChainReader creates a new instance of ChainReader. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewChainReader(t interface { - mock.TestingT - Cleanup(func()) -}) *ChainReader { - mock := &ChainReader{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/monitoring/mocks/chain_reader.go b/pkg/monitoring/mocks/chain_reader.go new file mode 100644 index 000000000..e6a1e655a --- /dev/null +++ b/pkg/monitoring/mocks/chain_reader.go @@ -0,0 +1,527 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + + pkgsolana "github.com/smartcontractkit/chainlink-solana/pkg/solana" + + rpc "github.com/gagliardetto/solana-go/rpc" + + solana "github.com/gagliardetto/solana-go" +) + +// ChainReader is an autogenerated mock type for the ChainReader type +type ChainReader struct { + mock.Mock +} + +type ChainReader_Expecter struct { + mock *mock.Mock +} + +func (_m *ChainReader) EXPECT() *ChainReader_Expecter { + return &ChainReader_Expecter{mock: &_m.Mock} +} + +// GetBalance provides a mock function with given fields: ctx, account, commitment +func (_m *ChainReader) GetBalance(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (*rpc.GetBalanceResult, error) { + ret := _m.Called(ctx, account, commitment) + + if len(ret) == 0 { + panic("no return value specified for GetBalance") + } + + var r0 *rpc.GetBalanceResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) (*rpc.GetBalanceResult, error)); ok { + return rf(ctx, account, commitment) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) *rpc.GetBalanceResult); ok { + r0 = rf(ctx, account, commitment) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*rpc.GetBalanceResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey, rpc.CommitmentType) error); ok { + r1 = rf(ctx, account, commitment) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ChainReader_GetBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBalance' +type ChainReader_GetBalance_Call struct { + *mock.Call +} + +// GetBalance is a helper method to define mock.On call +// - ctx context.Context +// - account solana.PublicKey +// - commitment rpc.CommitmentType +func (_e *ChainReader_Expecter) GetBalance(ctx interface{}, account interface{}, commitment interface{}) *ChainReader_GetBalance_Call { + return &ChainReader_GetBalance_Call{Call: _e.mock.On("GetBalance", ctx, account, commitment)} +} + +func (_c *ChainReader_GetBalance_Call) Run(run func(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType)) *ChainReader_GetBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.PublicKey), args[2].(rpc.CommitmentType)) + }) + return _c +} + +func (_c *ChainReader_GetBalance_Call) Return(out *rpc.GetBalanceResult, err error) *ChainReader_GetBalance_Call { + _c.Call.Return(out, err) + return _c +} + +func (_c *ChainReader_GetBalance_Call) RunAndReturn(run func(context.Context, solana.PublicKey, rpc.CommitmentType) (*rpc.GetBalanceResult, error)) *ChainReader_GetBalance_Call { + _c.Call.Return(run) + return _c +} + +// GetLatestBlock provides a mock function with given fields: ctx, commitment +func (_m *ChainReader) GetLatestBlock(ctx context.Context, commitment rpc.CommitmentType) (*rpc.GetBlockResult, error) { + ret := _m.Called(ctx, commitment) + + if len(ret) == 0 { + panic("no return value specified for GetLatestBlock") + } + + var r0 *rpc.GetBlockResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, rpc.CommitmentType) (*rpc.GetBlockResult, error)); ok { + return rf(ctx, commitment) + } + if rf, ok := ret.Get(0).(func(context.Context, rpc.CommitmentType) *rpc.GetBlockResult); ok { + r0 = rf(ctx, commitment) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*rpc.GetBlockResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, rpc.CommitmentType) error); ok { + r1 = rf(ctx, commitment) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ChainReader_GetLatestBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestBlock' +type ChainReader_GetLatestBlock_Call struct { + *mock.Call +} + +// GetLatestBlock is a helper method to define mock.On call +// - ctx context.Context +// - commitment rpc.CommitmentType +func (_e *ChainReader_Expecter) GetLatestBlock(ctx interface{}, commitment interface{}) *ChainReader_GetLatestBlock_Call { + return &ChainReader_GetLatestBlock_Call{Call: _e.mock.On("GetLatestBlock", ctx, commitment)} +} + +func (_c *ChainReader_GetLatestBlock_Call) Run(run func(ctx context.Context, commitment rpc.CommitmentType)) *ChainReader_GetLatestBlock_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(rpc.CommitmentType)) + }) + return _c +} + +func (_c *ChainReader_GetLatestBlock_Call) Return(_a0 *rpc.GetBlockResult, _a1 error) *ChainReader_GetLatestBlock_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ChainReader_GetLatestBlock_Call) RunAndReturn(run func(context.Context, rpc.CommitmentType) (*rpc.GetBlockResult, error)) *ChainReader_GetLatestBlock_Call { + _c.Call.Return(run) + return _c +} + +// GetLatestTransmission provides a mock function with given fields: ctx, account, commitment +func (_m *ChainReader) GetLatestTransmission(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (pkgsolana.Answer, uint64, error) { + ret := _m.Called(ctx, account, commitment) + + if len(ret) == 0 { + panic("no return value specified for GetLatestTransmission") + } + + var r0 pkgsolana.Answer + var r1 uint64 + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) (pkgsolana.Answer, uint64, error)); ok { + return rf(ctx, account, commitment) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) pkgsolana.Answer); ok { + r0 = rf(ctx, account, commitment) + } else { + r0 = ret.Get(0).(pkgsolana.Answer) + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey, rpc.CommitmentType) uint64); ok { + r1 = rf(ctx, account, commitment) + } else { + r1 = ret.Get(1).(uint64) + } + + if rf, ok := ret.Get(2).(func(context.Context, solana.PublicKey, rpc.CommitmentType) error); ok { + r2 = rf(ctx, account, commitment) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// ChainReader_GetLatestTransmission_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestTransmission' +type ChainReader_GetLatestTransmission_Call struct { + *mock.Call +} + +// GetLatestTransmission is a helper method to define mock.On call +// - ctx context.Context +// - account solana.PublicKey +// - commitment rpc.CommitmentType +func (_e *ChainReader_Expecter) GetLatestTransmission(ctx interface{}, account interface{}, commitment interface{}) *ChainReader_GetLatestTransmission_Call { + return &ChainReader_GetLatestTransmission_Call{Call: _e.mock.On("GetLatestTransmission", ctx, account, commitment)} +} + +func (_c *ChainReader_GetLatestTransmission_Call) Run(run func(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType)) *ChainReader_GetLatestTransmission_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.PublicKey), args[2].(rpc.CommitmentType)) + }) + return _c +} + +func (_c *ChainReader_GetLatestTransmission_Call) Return(answer pkgsolana.Answer, blockHeight uint64, err error) *ChainReader_GetLatestTransmission_Call { + _c.Call.Return(answer, blockHeight, err) + return _c +} + +func (_c *ChainReader_GetLatestTransmission_Call) RunAndReturn(run func(context.Context, solana.PublicKey, rpc.CommitmentType) (pkgsolana.Answer, uint64, error)) *ChainReader_GetLatestTransmission_Call { + _c.Call.Return(run) + return _c +} + +// GetSignaturesForAddressWithOpts provides a mock function with given fields: ctx, account, opts +func (_m *ChainReader) GetSignaturesForAddressWithOpts(ctx context.Context, account solana.PublicKey, opts *rpc.GetSignaturesForAddressOpts) ([]*rpc.TransactionSignature, error) { + ret := _m.Called(ctx, account, opts) + + if len(ret) == 0 { + panic("no return value specified for GetSignaturesForAddressWithOpts") + } + + var r0 []*rpc.TransactionSignature + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, *rpc.GetSignaturesForAddressOpts) ([]*rpc.TransactionSignature, error)); ok { + return rf(ctx, account, opts) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, *rpc.GetSignaturesForAddressOpts) []*rpc.TransactionSignature); ok { + r0 = rf(ctx, account, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*rpc.TransactionSignature) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey, *rpc.GetSignaturesForAddressOpts) error); ok { + r1 = rf(ctx, account, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ChainReader_GetSignaturesForAddressWithOpts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSignaturesForAddressWithOpts' +type ChainReader_GetSignaturesForAddressWithOpts_Call struct { + *mock.Call +} + +// GetSignaturesForAddressWithOpts is a helper method to define mock.On call +// - ctx context.Context +// - account solana.PublicKey +// - opts *rpc.GetSignaturesForAddressOpts +func (_e *ChainReader_Expecter) GetSignaturesForAddressWithOpts(ctx interface{}, account interface{}, opts interface{}) *ChainReader_GetSignaturesForAddressWithOpts_Call { + return &ChainReader_GetSignaturesForAddressWithOpts_Call{Call: _e.mock.On("GetSignaturesForAddressWithOpts", ctx, account, opts)} +} + +func (_c *ChainReader_GetSignaturesForAddressWithOpts_Call) Run(run func(ctx context.Context, account solana.PublicKey, opts *rpc.GetSignaturesForAddressOpts)) *ChainReader_GetSignaturesForAddressWithOpts_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.PublicKey), args[2].(*rpc.GetSignaturesForAddressOpts)) + }) + return _c +} + +func (_c *ChainReader_GetSignaturesForAddressWithOpts_Call) Return(out []*rpc.TransactionSignature, err error) *ChainReader_GetSignaturesForAddressWithOpts_Call { + _c.Call.Return(out, err) + return _c +} + +func (_c *ChainReader_GetSignaturesForAddressWithOpts_Call) RunAndReturn(run func(context.Context, solana.PublicKey, *rpc.GetSignaturesForAddressOpts) ([]*rpc.TransactionSignature, error)) *ChainReader_GetSignaturesForAddressWithOpts_Call { + _c.Call.Return(run) + return _c +} + +// GetSlot provides a mock function with given fields: ctx +func (_m *ChainReader) GetSlot(ctx context.Context) (uint64, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetSlot") + } + + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (uint64, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) uint64); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ChainReader_GetSlot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlot' +type ChainReader_GetSlot_Call struct { + *mock.Call +} + +// GetSlot is a helper method to define mock.On call +// - ctx context.Context +func (_e *ChainReader_Expecter) GetSlot(ctx interface{}) *ChainReader_GetSlot_Call { + return &ChainReader_GetSlot_Call{Call: _e.mock.On("GetSlot", ctx)} +} + +func (_c *ChainReader_GetSlot_Call) Run(run func(ctx context.Context)) *ChainReader_GetSlot_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *ChainReader_GetSlot_Call) Return(slot uint64, err error) *ChainReader_GetSlot_Call { + _c.Call.Return(slot, err) + return _c +} + +func (_c *ChainReader_GetSlot_Call) RunAndReturn(run func(context.Context) (uint64, error)) *ChainReader_GetSlot_Call { + _c.Call.Return(run) + return _c +} + +// GetState provides a mock function with given fields: ctx, account, commitment +func (_m *ChainReader) GetState(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (pkgsolana.State, uint64, error) { + ret := _m.Called(ctx, account, commitment) + + if len(ret) == 0 { + panic("no return value specified for GetState") + } + + var r0 pkgsolana.State + var r1 uint64 + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) (pkgsolana.State, uint64, error)); ok { + return rf(ctx, account, commitment) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) pkgsolana.State); ok { + r0 = rf(ctx, account, commitment) + } else { + r0 = ret.Get(0).(pkgsolana.State) + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey, rpc.CommitmentType) uint64); ok { + r1 = rf(ctx, account, commitment) + } else { + r1 = ret.Get(1).(uint64) + } + + if rf, ok := ret.Get(2).(func(context.Context, solana.PublicKey, rpc.CommitmentType) error); ok { + r2 = rf(ctx, account, commitment) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// ChainReader_GetState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetState' +type ChainReader_GetState_Call struct { + *mock.Call +} + +// GetState is a helper method to define mock.On call +// - ctx context.Context +// - account solana.PublicKey +// - commitment rpc.CommitmentType +func (_e *ChainReader_Expecter) GetState(ctx interface{}, account interface{}, commitment interface{}) *ChainReader_GetState_Call { + return &ChainReader_GetState_Call{Call: _e.mock.On("GetState", ctx, account, commitment)} +} + +func (_c *ChainReader_GetState_Call) Run(run func(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType)) *ChainReader_GetState_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.PublicKey), args[2].(rpc.CommitmentType)) + }) + return _c +} + +func (_c *ChainReader_GetState_Call) Return(state pkgsolana.State, blockHeight uint64, err error) *ChainReader_GetState_Call { + _c.Call.Return(state, blockHeight, err) + return _c +} + +func (_c *ChainReader_GetState_Call) RunAndReturn(run func(context.Context, solana.PublicKey, rpc.CommitmentType) (pkgsolana.State, uint64, error)) *ChainReader_GetState_Call { + _c.Call.Return(run) + return _c +} + +// GetTokenAccountBalance provides a mock function with given fields: ctx, account, commitment +func (_m *ChainReader) GetTokenAccountBalance(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (*rpc.GetTokenAccountBalanceResult, error) { + ret := _m.Called(ctx, account, commitment) + + if len(ret) == 0 { + panic("no return value specified for GetTokenAccountBalance") + } + + var r0 *rpc.GetTokenAccountBalanceResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) (*rpc.GetTokenAccountBalanceResult, error)); ok { + return rf(ctx, account, commitment) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) *rpc.GetTokenAccountBalanceResult); ok { + r0 = rf(ctx, account, commitment) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*rpc.GetTokenAccountBalanceResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey, rpc.CommitmentType) error); ok { + r1 = rf(ctx, account, commitment) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ChainReader_GetTokenAccountBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTokenAccountBalance' +type ChainReader_GetTokenAccountBalance_Call struct { + *mock.Call +} + +// GetTokenAccountBalance is a helper method to define mock.On call +// - ctx context.Context +// - account solana.PublicKey +// - commitment rpc.CommitmentType +func (_e *ChainReader_Expecter) GetTokenAccountBalance(ctx interface{}, account interface{}, commitment interface{}) *ChainReader_GetTokenAccountBalance_Call { + return &ChainReader_GetTokenAccountBalance_Call{Call: _e.mock.On("GetTokenAccountBalance", ctx, account, commitment)} +} + +func (_c *ChainReader_GetTokenAccountBalance_Call) Run(run func(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType)) *ChainReader_GetTokenAccountBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.PublicKey), args[2].(rpc.CommitmentType)) + }) + return _c +} + +func (_c *ChainReader_GetTokenAccountBalance_Call) Return(out *rpc.GetTokenAccountBalanceResult, err error) *ChainReader_GetTokenAccountBalance_Call { + _c.Call.Return(out, err) + return _c +} + +func (_c *ChainReader_GetTokenAccountBalance_Call) RunAndReturn(run func(context.Context, solana.PublicKey, rpc.CommitmentType) (*rpc.GetTokenAccountBalanceResult, error)) *ChainReader_GetTokenAccountBalance_Call { + _c.Call.Return(run) + return _c +} + +// GetTransaction provides a mock function with given fields: ctx, txSig, opts +func (_m *ChainReader) GetTransaction(ctx context.Context, txSig solana.Signature, opts *rpc.GetTransactionOpts) (*rpc.GetTransactionResult, error) { + ret := _m.Called(ctx, txSig, opts) + + if len(ret) == 0 { + panic("no return value specified for GetTransaction") + } + + var r0 *rpc.GetTransactionResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.Signature, *rpc.GetTransactionOpts) (*rpc.GetTransactionResult, error)); ok { + return rf(ctx, txSig, opts) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.Signature, *rpc.GetTransactionOpts) *rpc.GetTransactionResult); ok { + r0 = rf(ctx, txSig, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*rpc.GetTransactionResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.Signature, *rpc.GetTransactionOpts) error); ok { + r1 = rf(ctx, txSig, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ChainReader_GetTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTransaction' +type ChainReader_GetTransaction_Call struct { + *mock.Call +} + +// GetTransaction is a helper method to define mock.On call +// - ctx context.Context +// - txSig solana.Signature +// - opts *rpc.GetTransactionOpts +func (_e *ChainReader_Expecter) GetTransaction(ctx interface{}, txSig interface{}, opts interface{}) *ChainReader_GetTransaction_Call { + return &ChainReader_GetTransaction_Call{Call: _e.mock.On("GetTransaction", ctx, txSig, opts)} +} + +func (_c *ChainReader_GetTransaction_Call) Run(run func(ctx context.Context, txSig solana.Signature, opts *rpc.GetTransactionOpts)) *ChainReader_GetTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.Signature), args[2].(*rpc.GetTransactionOpts)) + }) + return _c +} + +func (_c *ChainReader_GetTransaction_Call) Return(out *rpc.GetTransactionResult, err error) *ChainReader_GetTransaction_Call { + _c.Call.Return(out, err) + return _c +} + +func (_c *ChainReader_GetTransaction_Call) RunAndReturn(run func(context.Context, solana.Signature, *rpc.GetTransactionOpts) (*rpc.GetTransactionResult, error)) *ChainReader_GetTransaction_Call { + _c.Call.Return(run) + return _c +} + +// NewChainReader creates a new instance of ChainReader. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewChainReader(t interface { + mock.TestingT + Cleanup(func()) +}) *ChainReader { + mock := &ChainReader{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/solana/client/client.go b/pkg/solana/client/client.go index 18c0e4bfe..f9f6715b0 100644 --- a/pkg/solana/client/client.go +++ b/pkg/solana/client/client.go @@ -23,7 +23,6 @@ const ( MainnetGenesisHash = "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d" ) -//go:generate mockery --name ReaderWriter --output ./mocks/ type ReaderWriter interface { Writer Reader diff --git a/pkg/solana/client/mocks/ReaderWriter.go b/pkg/solana/client/mocks/ReaderWriter.go deleted file mode 100644 index f4d514459..000000000 --- a/pkg/solana/client/mocks/ReaderWriter.go +++ /dev/null @@ -1,384 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - context "context" - - rpc "github.com/gagliardetto/solana-go/rpc" - multinode "github.com/smartcontractkit/chainlink-solana/pkg/solana/client/multinode" - mock "github.com/stretchr/testify/mock" - - solana "github.com/gagliardetto/solana-go" -) - -// ReaderWriter is an autogenerated mock type for the ReaderWriter type -type ReaderWriter struct { - mock.Mock -} - -// Balance provides a mock function with given fields: ctx, addr -func (_m *ReaderWriter) Balance(ctx context.Context, addr solana.PublicKey) (uint64, error) { - ret := _m.Called(ctx, addr) - - if len(ret) == 0 { - panic("no return value specified for Balance") - } - - var r0 uint64 - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey) (uint64, error)); ok { - return rf(ctx, addr) - } - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey) uint64); ok { - r0 = rf(ctx, addr) - } else { - r0 = ret.Get(0).(uint64) - } - - if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey) error); ok { - r1 = rf(ctx, addr) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ChainID provides a mock function with given fields: ctx -func (_m *ReaderWriter) ChainID(ctx context.Context) (multinode.StringID, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for ChainID") - } - - var r0 multinode.StringID - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (multinode.StringID, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) multinode.StringID); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(multinode.StringID) - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetAccountInfoWithOpts provides a mock function with given fields: ctx, addr, opts -func (_m *ReaderWriter) GetAccountInfoWithOpts(ctx context.Context, addr solana.PublicKey, opts *rpc.GetAccountInfoOpts) (*rpc.GetAccountInfoResult, error) { - ret := _m.Called(ctx, addr, opts) - - if len(ret) == 0 { - panic("no return value specified for GetAccountInfoWithOpts") - } - - var r0 *rpc.GetAccountInfoResult - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, *rpc.GetAccountInfoOpts) (*rpc.GetAccountInfoResult, error)); ok { - return rf(ctx, addr, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, *rpc.GetAccountInfoOpts) *rpc.GetAccountInfoResult); ok { - r0 = rf(ctx, addr, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*rpc.GetAccountInfoResult) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey, *rpc.GetAccountInfoOpts) error); ok { - r1 = rf(ctx, addr, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetBlock provides a mock function with given fields: ctx, slot -func (_m *ReaderWriter) GetBlock(ctx context.Context, slot uint64) (*rpc.GetBlockResult, error) { - ret := _m.Called(ctx, slot) - - if len(ret) == 0 { - panic("no return value specified for GetBlock") - } - - var r0 *rpc.GetBlockResult - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, uint64) (*rpc.GetBlockResult, error)); ok { - return rf(ctx, slot) - } - if rf, ok := ret.Get(0).(func(context.Context, uint64) *rpc.GetBlockResult); ok { - r0 = rf(ctx, slot) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*rpc.GetBlockResult) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, uint64) error); ok { - r1 = rf(ctx, slot) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetBlocksWithLimit provides a mock function with given fields: ctx, startSlot, limit -func (_m *ReaderWriter) GetBlocksWithLimit(ctx context.Context, startSlot uint64, limit uint64) (*rpc.BlocksResult, error) { - ret := _m.Called(ctx, startSlot, limit) - - if len(ret) == 0 { - panic("no return value specified for GetBlocksWithLimit") - } - - var r0 *rpc.BlocksResult - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, uint64, uint64) (*rpc.BlocksResult, error)); ok { - return rf(ctx, startSlot, limit) - } - if rf, ok := ret.Get(0).(func(context.Context, uint64, uint64) *rpc.BlocksResult); ok { - r0 = rf(ctx, startSlot, limit) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*rpc.BlocksResult) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, uint64, uint64) error); ok { - r1 = rf(ctx, startSlot, limit) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetFeeForMessage provides a mock function with given fields: ctx, msg -func (_m *ReaderWriter) GetFeeForMessage(ctx context.Context, msg string) (uint64, error) { - ret := _m.Called(ctx, msg) - - if len(ret) == 0 { - panic("no return value specified for GetFeeForMessage") - } - - var r0 uint64 - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (uint64, error)); ok { - return rf(ctx, msg) - } - if rf, ok := ret.Get(0).(func(context.Context, string) uint64); ok { - r0 = rf(ctx, msg) - } else { - r0 = ret.Get(0).(uint64) - } - - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, msg) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetLatestBlock provides a mock function with given fields: ctx -func (_m *ReaderWriter) GetLatestBlock(ctx context.Context) (*rpc.GetBlockResult, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetLatestBlock") - } - - var r0 *rpc.GetBlockResult - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (*rpc.GetBlockResult, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) *rpc.GetBlockResult); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*rpc.GetBlockResult) - } - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// LatestBlockhash provides a mock function with given fields: ctx -func (_m *ReaderWriter) LatestBlockhash(ctx context.Context) (*rpc.GetLatestBlockhashResult, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for LatestBlockhash") - } - - var r0 *rpc.GetLatestBlockhashResult - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (*rpc.GetLatestBlockhashResult, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) *rpc.GetLatestBlockhashResult); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*rpc.GetLatestBlockhashResult) - } - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SendTx provides a mock function with given fields: ctx, tx -func (_m *ReaderWriter) SendTx(ctx context.Context, tx *solana.Transaction) (solana.Signature, error) { - ret := _m.Called(ctx, tx) - - if len(ret) == 0 { - panic("no return value specified for SendTx") - } - - var r0 solana.Signature - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *solana.Transaction) (solana.Signature, error)); ok { - return rf(ctx, tx) - } - if rf, ok := ret.Get(0).(func(context.Context, *solana.Transaction) solana.Signature); ok { - r0 = rf(ctx, tx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(solana.Signature) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *solana.Transaction) error); ok { - r1 = rf(ctx, tx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SignatureStatuses provides a mock function with given fields: ctx, sigs -func (_m *ReaderWriter) SignatureStatuses(ctx context.Context, sigs []solana.Signature) ([]*rpc.SignatureStatusesResult, error) { - ret := _m.Called(ctx, sigs) - - if len(ret) == 0 { - panic("no return value specified for SignatureStatuses") - } - - var r0 []*rpc.SignatureStatusesResult - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, []solana.Signature) ([]*rpc.SignatureStatusesResult, error)); ok { - return rf(ctx, sigs) - } - if rf, ok := ret.Get(0).(func(context.Context, []solana.Signature) []*rpc.SignatureStatusesResult); ok { - r0 = rf(ctx, sigs) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*rpc.SignatureStatusesResult) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, []solana.Signature) error); ok { - r1 = rf(ctx, sigs) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SimulateTx provides a mock function with given fields: ctx, tx, opts -func (_m *ReaderWriter) SimulateTx(ctx context.Context, tx *solana.Transaction, opts *rpc.SimulateTransactionOpts) (*rpc.SimulateTransactionResult, error) { - ret := _m.Called(ctx, tx, opts) - - if len(ret) == 0 { - panic("no return value specified for SimulateTx") - } - - var r0 *rpc.SimulateTransactionResult - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *solana.Transaction, *rpc.SimulateTransactionOpts) (*rpc.SimulateTransactionResult, error)); ok { - return rf(ctx, tx, opts) - } - if rf, ok := ret.Get(0).(func(context.Context, *solana.Transaction, *rpc.SimulateTransactionOpts) *rpc.SimulateTransactionResult); ok { - r0 = rf(ctx, tx, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*rpc.SimulateTransactionResult) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *solana.Transaction, *rpc.SimulateTransactionOpts) error); ok { - r1 = rf(ctx, tx, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SlotHeight provides a mock function with given fields: ctx -func (_m *ReaderWriter) SlotHeight(ctx context.Context) (uint64, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for SlotHeight") - } - - var r0 uint64 - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (uint64, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) uint64); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(uint64) - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewReaderWriter creates a new instance of ReaderWriter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewReaderWriter(t interface { - mock.TestingT - Cleanup(func()) -}) *ReaderWriter { - mock := &ReaderWriter{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/solana/client/mocks/reader_writer.go b/pkg/solana/client/mocks/reader_writer.go new file mode 100644 index 000000000..86285fdf5 --- /dev/null +++ b/pkg/solana/client/mocks/reader_writer.go @@ -0,0 +1,739 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import ( + context "context" + + rpc "github.com/gagliardetto/solana-go/rpc" + multinode "github.com/smartcontractkit/chainlink-solana/pkg/solana/client/multinode" + mock "github.com/stretchr/testify/mock" + + solana "github.com/gagliardetto/solana-go" +) + +// ReaderWriter is an autogenerated mock type for the ReaderWriter type +type ReaderWriter struct { + mock.Mock +} + +type ReaderWriter_Expecter struct { + mock *mock.Mock +} + +func (_m *ReaderWriter) EXPECT() *ReaderWriter_Expecter { + return &ReaderWriter_Expecter{mock: &_m.Mock} +} + +// Balance provides a mock function with given fields: ctx, addr +func (_m *ReaderWriter) Balance(ctx context.Context, addr solana.PublicKey) (uint64, error) { + ret := _m.Called(ctx, addr) + + if len(ret) == 0 { + panic("no return value specified for Balance") + } + + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey) (uint64, error)); ok { + return rf(ctx, addr) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey) uint64); ok { + r0 = rf(ctx, addr) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey) error); ok { + r1 = rf(ctx, addr) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ReaderWriter_Balance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Balance' +type ReaderWriter_Balance_Call struct { + *mock.Call +} + +// Balance is a helper method to define mock.On call +// - ctx context.Context +// - addr solana.PublicKey +func (_e *ReaderWriter_Expecter) Balance(ctx interface{}, addr interface{}) *ReaderWriter_Balance_Call { + return &ReaderWriter_Balance_Call{Call: _e.mock.On("Balance", ctx, addr)} +} + +func (_c *ReaderWriter_Balance_Call) Run(run func(ctx context.Context, addr solana.PublicKey)) *ReaderWriter_Balance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.PublicKey)) + }) + return _c +} + +func (_c *ReaderWriter_Balance_Call) Return(_a0 uint64, _a1 error) *ReaderWriter_Balance_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ReaderWriter_Balance_Call) RunAndReturn(run func(context.Context, solana.PublicKey) (uint64, error)) *ReaderWriter_Balance_Call { + _c.Call.Return(run) + return _c +} + +// ChainID provides a mock function with given fields: ctx +func (_m *ReaderWriter) ChainID(ctx context.Context) (multinode.StringID, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for ChainID") + } + + var r0 multinode.StringID + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (multinode.StringID, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) multinode.StringID); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(multinode.StringID) + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ReaderWriter_ChainID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ChainID' +type ReaderWriter_ChainID_Call struct { + *mock.Call +} + +// ChainID is a helper method to define mock.On call +// - ctx context.Context +func (_e *ReaderWriter_Expecter) ChainID(ctx interface{}) *ReaderWriter_ChainID_Call { + return &ReaderWriter_ChainID_Call{Call: _e.mock.On("ChainID", ctx)} +} + +func (_c *ReaderWriter_ChainID_Call) Run(run func(ctx context.Context)) *ReaderWriter_ChainID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *ReaderWriter_ChainID_Call) Return(_a0 multinode.StringID, _a1 error) *ReaderWriter_ChainID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ReaderWriter_ChainID_Call) RunAndReturn(run func(context.Context) (multinode.StringID, error)) *ReaderWriter_ChainID_Call { + _c.Call.Return(run) + return _c +} + +// GetAccountInfoWithOpts provides a mock function with given fields: ctx, addr, opts +func (_m *ReaderWriter) GetAccountInfoWithOpts(ctx context.Context, addr solana.PublicKey, opts *rpc.GetAccountInfoOpts) (*rpc.GetAccountInfoResult, error) { + ret := _m.Called(ctx, addr, opts) + + if len(ret) == 0 { + panic("no return value specified for GetAccountInfoWithOpts") + } + + var r0 *rpc.GetAccountInfoResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, *rpc.GetAccountInfoOpts) (*rpc.GetAccountInfoResult, error)); ok { + return rf(ctx, addr, opts) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, *rpc.GetAccountInfoOpts) *rpc.GetAccountInfoResult); ok { + r0 = rf(ctx, addr, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*rpc.GetAccountInfoResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.PublicKey, *rpc.GetAccountInfoOpts) error); ok { + r1 = rf(ctx, addr, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ReaderWriter_GetAccountInfoWithOpts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAccountInfoWithOpts' +type ReaderWriter_GetAccountInfoWithOpts_Call struct { + *mock.Call +} + +// GetAccountInfoWithOpts is a helper method to define mock.On call +// - ctx context.Context +// - addr solana.PublicKey +// - opts *rpc.GetAccountInfoOpts +func (_e *ReaderWriter_Expecter) GetAccountInfoWithOpts(ctx interface{}, addr interface{}, opts interface{}) *ReaderWriter_GetAccountInfoWithOpts_Call { + return &ReaderWriter_GetAccountInfoWithOpts_Call{Call: _e.mock.On("GetAccountInfoWithOpts", ctx, addr, opts)} +} + +func (_c *ReaderWriter_GetAccountInfoWithOpts_Call) Run(run func(ctx context.Context, addr solana.PublicKey, opts *rpc.GetAccountInfoOpts)) *ReaderWriter_GetAccountInfoWithOpts_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.PublicKey), args[2].(*rpc.GetAccountInfoOpts)) + }) + return _c +} + +func (_c *ReaderWriter_GetAccountInfoWithOpts_Call) Return(_a0 *rpc.GetAccountInfoResult, _a1 error) *ReaderWriter_GetAccountInfoWithOpts_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ReaderWriter_GetAccountInfoWithOpts_Call) RunAndReturn(run func(context.Context, solana.PublicKey, *rpc.GetAccountInfoOpts) (*rpc.GetAccountInfoResult, error)) *ReaderWriter_GetAccountInfoWithOpts_Call { + _c.Call.Return(run) + return _c +} + +// GetBlock provides a mock function with given fields: ctx, slot +func (_m *ReaderWriter) GetBlock(ctx context.Context, slot uint64) (*rpc.GetBlockResult, error) { + ret := _m.Called(ctx, slot) + + if len(ret) == 0 { + panic("no return value specified for GetBlock") + } + + var r0 *rpc.GetBlockResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64) (*rpc.GetBlockResult, error)); ok { + return rf(ctx, slot) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64) *rpc.GetBlockResult); ok { + r0 = rf(ctx, slot) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*rpc.GetBlockResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64) error); ok { + r1 = rf(ctx, slot) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ReaderWriter_GetBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBlock' +type ReaderWriter_GetBlock_Call struct { + *mock.Call +} + +// GetBlock is a helper method to define mock.On call +// - ctx context.Context +// - slot uint64 +func (_e *ReaderWriter_Expecter) GetBlock(ctx interface{}, slot interface{}) *ReaderWriter_GetBlock_Call { + return &ReaderWriter_GetBlock_Call{Call: _e.mock.On("GetBlock", ctx, slot)} +} + +func (_c *ReaderWriter_GetBlock_Call) Run(run func(ctx context.Context, slot uint64)) *ReaderWriter_GetBlock_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64)) + }) + return _c +} + +func (_c *ReaderWriter_GetBlock_Call) Return(_a0 *rpc.GetBlockResult, _a1 error) *ReaderWriter_GetBlock_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ReaderWriter_GetBlock_Call) RunAndReturn(run func(context.Context, uint64) (*rpc.GetBlockResult, error)) *ReaderWriter_GetBlock_Call { + _c.Call.Return(run) + return _c +} + +// GetBlocksWithLimit provides a mock function with given fields: ctx, startSlot, limit +func (_m *ReaderWriter) GetBlocksWithLimit(ctx context.Context, startSlot uint64, limit uint64) (*rpc.BlocksResult, error) { + ret := _m.Called(ctx, startSlot, limit) + + if len(ret) == 0 { + panic("no return value specified for GetBlocksWithLimit") + } + + var r0 *rpc.BlocksResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, uint64) (*rpc.BlocksResult, error)); ok { + return rf(ctx, startSlot, limit) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, uint64) *rpc.BlocksResult); ok { + r0 = rf(ctx, startSlot, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*rpc.BlocksResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64, uint64) error); ok { + r1 = rf(ctx, startSlot, limit) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ReaderWriter_GetBlocksWithLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBlocksWithLimit' +type ReaderWriter_GetBlocksWithLimit_Call struct { + *mock.Call +} + +// GetBlocksWithLimit is a helper method to define mock.On call +// - ctx context.Context +// - startSlot uint64 +// - limit uint64 +func (_e *ReaderWriter_Expecter) GetBlocksWithLimit(ctx interface{}, startSlot interface{}, limit interface{}) *ReaderWriter_GetBlocksWithLimit_Call { + return &ReaderWriter_GetBlocksWithLimit_Call{Call: _e.mock.On("GetBlocksWithLimit", ctx, startSlot, limit)} +} + +func (_c *ReaderWriter_GetBlocksWithLimit_Call) Run(run func(ctx context.Context, startSlot uint64, limit uint64)) *ReaderWriter_GetBlocksWithLimit_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64), args[2].(uint64)) + }) + return _c +} + +func (_c *ReaderWriter_GetBlocksWithLimit_Call) Return(_a0 *rpc.BlocksResult, _a1 error) *ReaderWriter_GetBlocksWithLimit_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ReaderWriter_GetBlocksWithLimit_Call) RunAndReturn(run func(context.Context, uint64, uint64) (*rpc.BlocksResult, error)) *ReaderWriter_GetBlocksWithLimit_Call { + _c.Call.Return(run) + return _c +} + +// GetFeeForMessage provides a mock function with given fields: ctx, msg +func (_m *ReaderWriter) GetFeeForMessage(ctx context.Context, msg string) (uint64, error) { + ret := _m.Called(ctx, msg) + + if len(ret) == 0 { + panic("no return value specified for GetFeeForMessage") + } + + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (uint64, error)); ok { + return rf(ctx, msg) + } + if rf, ok := ret.Get(0).(func(context.Context, string) uint64); ok { + r0 = rf(ctx, msg) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, msg) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ReaderWriter_GetFeeForMessage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFeeForMessage' +type ReaderWriter_GetFeeForMessage_Call struct { + *mock.Call +} + +// GetFeeForMessage is a helper method to define mock.On call +// - ctx context.Context +// - msg string +func (_e *ReaderWriter_Expecter) GetFeeForMessage(ctx interface{}, msg interface{}) *ReaderWriter_GetFeeForMessage_Call { + return &ReaderWriter_GetFeeForMessage_Call{Call: _e.mock.On("GetFeeForMessage", ctx, msg)} +} + +func (_c *ReaderWriter_GetFeeForMessage_Call) Run(run func(ctx context.Context, msg string)) *ReaderWriter_GetFeeForMessage_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *ReaderWriter_GetFeeForMessage_Call) Return(_a0 uint64, _a1 error) *ReaderWriter_GetFeeForMessage_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ReaderWriter_GetFeeForMessage_Call) RunAndReturn(run func(context.Context, string) (uint64, error)) *ReaderWriter_GetFeeForMessage_Call { + _c.Call.Return(run) + return _c +} + +// GetLatestBlock provides a mock function with given fields: ctx +func (_m *ReaderWriter) GetLatestBlock(ctx context.Context) (*rpc.GetBlockResult, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetLatestBlock") + } + + var r0 *rpc.GetBlockResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*rpc.GetBlockResult, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) *rpc.GetBlockResult); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*rpc.GetBlockResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ReaderWriter_GetLatestBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestBlock' +type ReaderWriter_GetLatestBlock_Call struct { + *mock.Call +} + +// GetLatestBlock is a helper method to define mock.On call +// - ctx context.Context +func (_e *ReaderWriter_Expecter) GetLatestBlock(ctx interface{}) *ReaderWriter_GetLatestBlock_Call { + return &ReaderWriter_GetLatestBlock_Call{Call: _e.mock.On("GetLatestBlock", ctx)} +} + +func (_c *ReaderWriter_GetLatestBlock_Call) Run(run func(ctx context.Context)) *ReaderWriter_GetLatestBlock_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *ReaderWriter_GetLatestBlock_Call) Return(_a0 *rpc.GetBlockResult, _a1 error) *ReaderWriter_GetLatestBlock_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ReaderWriter_GetLatestBlock_Call) RunAndReturn(run func(context.Context) (*rpc.GetBlockResult, error)) *ReaderWriter_GetLatestBlock_Call { + _c.Call.Return(run) + return _c +} + +// LatestBlockhash provides a mock function with given fields: ctx +func (_m *ReaderWriter) LatestBlockhash(ctx context.Context) (*rpc.GetLatestBlockhashResult, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for LatestBlockhash") + } + + var r0 *rpc.GetLatestBlockhashResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*rpc.GetLatestBlockhashResult, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) *rpc.GetLatestBlockhashResult); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*rpc.GetLatestBlockhashResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ReaderWriter_LatestBlockhash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LatestBlockhash' +type ReaderWriter_LatestBlockhash_Call struct { + *mock.Call +} + +// LatestBlockhash is a helper method to define mock.On call +// - ctx context.Context +func (_e *ReaderWriter_Expecter) LatestBlockhash(ctx interface{}) *ReaderWriter_LatestBlockhash_Call { + return &ReaderWriter_LatestBlockhash_Call{Call: _e.mock.On("LatestBlockhash", ctx)} +} + +func (_c *ReaderWriter_LatestBlockhash_Call) Run(run func(ctx context.Context)) *ReaderWriter_LatestBlockhash_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *ReaderWriter_LatestBlockhash_Call) Return(_a0 *rpc.GetLatestBlockhashResult, _a1 error) *ReaderWriter_LatestBlockhash_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ReaderWriter_LatestBlockhash_Call) RunAndReturn(run func(context.Context) (*rpc.GetLatestBlockhashResult, error)) *ReaderWriter_LatestBlockhash_Call { + _c.Call.Return(run) + return _c +} + +// SendTx provides a mock function with given fields: ctx, tx +func (_m *ReaderWriter) SendTx(ctx context.Context, tx *solana.Transaction) (solana.Signature, error) { + ret := _m.Called(ctx, tx) + + if len(ret) == 0 { + panic("no return value specified for SendTx") + } + + var r0 solana.Signature + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *solana.Transaction) (solana.Signature, error)); ok { + return rf(ctx, tx) + } + if rf, ok := ret.Get(0).(func(context.Context, *solana.Transaction) solana.Signature); ok { + r0 = rf(ctx, tx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(solana.Signature) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *solana.Transaction) error); ok { + r1 = rf(ctx, tx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ReaderWriter_SendTx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendTx' +type ReaderWriter_SendTx_Call struct { + *mock.Call +} + +// SendTx is a helper method to define mock.On call +// - ctx context.Context +// - tx *solana.Transaction +func (_e *ReaderWriter_Expecter) SendTx(ctx interface{}, tx interface{}) *ReaderWriter_SendTx_Call { + return &ReaderWriter_SendTx_Call{Call: _e.mock.On("SendTx", ctx, tx)} +} + +func (_c *ReaderWriter_SendTx_Call) Run(run func(ctx context.Context, tx *solana.Transaction)) *ReaderWriter_SendTx_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*solana.Transaction)) + }) + return _c +} + +func (_c *ReaderWriter_SendTx_Call) Return(_a0 solana.Signature, _a1 error) *ReaderWriter_SendTx_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ReaderWriter_SendTx_Call) RunAndReturn(run func(context.Context, *solana.Transaction) (solana.Signature, error)) *ReaderWriter_SendTx_Call { + _c.Call.Return(run) + return _c +} + +// SignatureStatuses provides a mock function with given fields: ctx, sigs +func (_m *ReaderWriter) SignatureStatuses(ctx context.Context, sigs []solana.Signature) ([]*rpc.SignatureStatusesResult, error) { + ret := _m.Called(ctx, sigs) + + if len(ret) == 0 { + panic("no return value specified for SignatureStatuses") + } + + var r0 []*rpc.SignatureStatusesResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, []solana.Signature) ([]*rpc.SignatureStatusesResult, error)); ok { + return rf(ctx, sigs) + } + if rf, ok := ret.Get(0).(func(context.Context, []solana.Signature) []*rpc.SignatureStatusesResult); ok { + r0 = rf(ctx, sigs) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*rpc.SignatureStatusesResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, []solana.Signature) error); ok { + r1 = rf(ctx, sigs) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ReaderWriter_SignatureStatuses_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SignatureStatuses' +type ReaderWriter_SignatureStatuses_Call struct { + *mock.Call +} + +// SignatureStatuses is a helper method to define mock.On call +// - ctx context.Context +// - sigs []solana.Signature +func (_e *ReaderWriter_Expecter) SignatureStatuses(ctx interface{}, sigs interface{}) *ReaderWriter_SignatureStatuses_Call { + return &ReaderWriter_SignatureStatuses_Call{Call: _e.mock.On("SignatureStatuses", ctx, sigs)} +} + +func (_c *ReaderWriter_SignatureStatuses_Call) Run(run func(ctx context.Context, sigs []solana.Signature)) *ReaderWriter_SignatureStatuses_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].([]solana.Signature)) + }) + return _c +} + +func (_c *ReaderWriter_SignatureStatuses_Call) Return(_a0 []*rpc.SignatureStatusesResult, _a1 error) *ReaderWriter_SignatureStatuses_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ReaderWriter_SignatureStatuses_Call) RunAndReturn(run func(context.Context, []solana.Signature) ([]*rpc.SignatureStatusesResult, error)) *ReaderWriter_SignatureStatuses_Call { + _c.Call.Return(run) + return _c +} + +// SimulateTx provides a mock function with given fields: ctx, tx, opts +func (_m *ReaderWriter) SimulateTx(ctx context.Context, tx *solana.Transaction, opts *rpc.SimulateTransactionOpts) (*rpc.SimulateTransactionResult, error) { + ret := _m.Called(ctx, tx, opts) + + if len(ret) == 0 { + panic("no return value specified for SimulateTx") + } + + var r0 *rpc.SimulateTransactionResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *solana.Transaction, *rpc.SimulateTransactionOpts) (*rpc.SimulateTransactionResult, error)); ok { + return rf(ctx, tx, opts) + } + if rf, ok := ret.Get(0).(func(context.Context, *solana.Transaction, *rpc.SimulateTransactionOpts) *rpc.SimulateTransactionResult); ok { + r0 = rf(ctx, tx, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*rpc.SimulateTransactionResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *solana.Transaction, *rpc.SimulateTransactionOpts) error); ok { + r1 = rf(ctx, tx, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ReaderWriter_SimulateTx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SimulateTx' +type ReaderWriter_SimulateTx_Call struct { + *mock.Call +} + +// SimulateTx is a helper method to define mock.On call +// - ctx context.Context +// - tx *solana.Transaction +// - opts *rpc.SimulateTransactionOpts +func (_e *ReaderWriter_Expecter) SimulateTx(ctx interface{}, tx interface{}, opts interface{}) *ReaderWriter_SimulateTx_Call { + return &ReaderWriter_SimulateTx_Call{Call: _e.mock.On("SimulateTx", ctx, tx, opts)} +} + +func (_c *ReaderWriter_SimulateTx_Call) Run(run func(ctx context.Context, tx *solana.Transaction, opts *rpc.SimulateTransactionOpts)) *ReaderWriter_SimulateTx_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*solana.Transaction), args[2].(*rpc.SimulateTransactionOpts)) + }) + return _c +} + +func (_c *ReaderWriter_SimulateTx_Call) Return(_a0 *rpc.SimulateTransactionResult, _a1 error) *ReaderWriter_SimulateTx_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ReaderWriter_SimulateTx_Call) RunAndReturn(run func(context.Context, *solana.Transaction, *rpc.SimulateTransactionOpts) (*rpc.SimulateTransactionResult, error)) *ReaderWriter_SimulateTx_Call { + _c.Call.Return(run) + return _c +} + +// SlotHeight provides a mock function with given fields: ctx +func (_m *ReaderWriter) SlotHeight(ctx context.Context) (uint64, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for SlotHeight") + } + + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (uint64, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) uint64); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ReaderWriter_SlotHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SlotHeight' +type ReaderWriter_SlotHeight_Call struct { + *mock.Call +} + +// SlotHeight is a helper method to define mock.On call +// - ctx context.Context +func (_e *ReaderWriter_Expecter) SlotHeight(ctx interface{}) *ReaderWriter_SlotHeight_Call { + return &ReaderWriter_SlotHeight_Call{Call: _e.mock.On("SlotHeight", ctx)} +} + +func (_c *ReaderWriter_SlotHeight_Call) Run(run func(ctx context.Context)) *ReaderWriter_SlotHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *ReaderWriter_SlotHeight_Call) Return(_a0 uint64, _a1 error) *ReaderWriter_SlotHeight_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ReaderWriter_SlotHeight_Call) RunAndReturn(run func(context.Context) (uint64, error)) *ReaderWriter_SlotHeight_Call { + _c.Call.Return(run) + return _c +} + +// NewReaderWriter creates a new instance of ReaderWriter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewReaderWriter(t interface { + mock.TestingT + Cleanup(func()) +}) *ReaderWriter { + mock := &ReaderWriter{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/solana/config/config.go b/pkg/solana/config/config.go index 28d7ac5fb..7700b7a64 100644 --- a/pkg/solana/config/config.go +++ b/pkg/solana/config/config.go @@ -35,7 +35,6 @@ var defaultConfigSet = Chain{ EstimateComputeUnitLimit: ptr(false), // set to false to disable compute unit limit estimation } -//go:generate mockery --name Config --output ./mocks/ --case=underscore --filename config.go type Config interface { BalancePollPeriod() time.Duration ConfirmPollPeriod() time.Duration diff --git a/pkg/solana/config/mocks/config.go b/pkg/solana/config/mocks/config.go index feef5c3c6..6f9ab913d 100644 --- a/pkg/solana/config/mocks/config.go +++ b/pkg/solana/config/mocks/config.go @@ -14,6 +14,14 @@ type Config struct { mock.Mock } +type Config_Expecter struct { + mock *mock.Mock +} + +func (_m *Config) EXPECT() *Config_Expecter { + return &Config_Expecter{mock: &_m.Mock} +} + // BalancePollPeriod provides a mock function with given fields: func (_m *Config) BalancePollPeriod() time.Duration { ret := _m.Called() @@ -32,6 +40,33 @@ func (_m *Config) BalancePollPeriod() time.Duration { return r0 } +// Config_BalancePollPeriod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BalancePollPeriod' +type Config_BalancePollPeriod_Call struct { + *mock.Call +} + +// BalancePollPeriod is a helper method to define mock.On call +func (_e *Config_Expecter) BalancePollPeriod() *Config_BalancePollPeriod_Call { + return &Config_BalancePollPeriod_Call{Call: _e.mock.On("BalancePollPeriod")} +} + +func (_c *Config_BalancePollPeriod_Call) Run(run func()) *Config_BalancePollPeriod_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_BalancePollPeriod_Call) Return(_a0 time.Duration) *Config_BalancePollPeriod_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_BalancePollPeriod_Call) RunAndReturn(run func() time.Duration) *Config_BalancePollPeriod_Call { + _c.Call.Return(run) + return _c +} + // BlockHistoryPollPeriod provides a mock function with given fields: func (_m *Config) BlockHistoryPollPeriod() time.Duration { ret := _m.Called() @@ -50,6 +85,33 @@ func (_m *Config) BlockHistoryPollPeriod() time.Duration { return r0 } +// Config_BlockHistoryPollPeriod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockHistoryPollPeriod' +type Config_BlockHistoryPollPeriod_Call struct { + *mock.Call +} + +// BlockHistoryPollPeriod is a helper method to define mock.On call +func (_e *Config_Expecter) BlockHistoryPollPeriod() *Config_BlockHistoryPollPeriod_Call { + return &Config_BlockHistoryPollPeriod_Call{Call: _e.mock.On("BlockHistoryPollPeriod")} +} + +func (_c *Config_BlockHistoryPollPeriod_Call) Run(run func()) *Config_BlockHistoryPollPeriod_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_BlockHistoryPollPeriod_Call) Return(_a0 time.Duration) *Config_BlockHistoryPollPeriod_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_BlockHistoryPollPeriod_Call) RunAndReturn(run func() time.Duration) *Config_BlockHistoryPollPeriod_Call { + _c.Call.Return(run) + return _c +} + // BlockHistorySize provides a mock function with given fields: func (_m *Config) BlockHistorySize() uint64 { ret := _m.Called() @@ -68,6 +130,33 @@ func (_m *Config) BlockHistorySize() uint64 { return r0 } +// Config_BlockHistorySize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockHistorySize' +type Config_BlockHistorySize_Call struct { + *mock.Call +} + +// BlockHistorySize is a helper method to define mock.On call +func (_e *Config_Expecter) BlockHistorySize() *Config_BlockHistorySize_Call { + return &Config_BlockHistorySize_Call{Call: _e.mock.On("BlockHistorySize")} +} + +func (_c *Config_BlockHistorySize_Call) Run(run func()) *Config_BlockHistorySize_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_BlockHistorySize_Call) Return(_a0 uint64) *Config_BlockHistorySize_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_BlockHistorySize_Call) RunAndReturn(run func() uint64) *Config_BlockHistorySize_Call { + _c.Call.Return(run) + return _c +} + // Commitment provides a mock function with given fields: func (_m *Config) Commitment() rpc.CommitmentType { ret := _m.Called() @@ -86,6 +175,33 @@ func (_m *Config) Commitment() rpc.CommitmentType { return r0 } +// Config_Commitment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Commitment' +type Config_Commitment_Call struct { + *mock.Call +} + +// Commitment is a helper method to define mock.On call +func (_e *Config_Expecter) Commitment() *Config_Commitment_Call { + return &Config_Commitment_Call{Call: _e.mock.On("Commitment")} +} + +func (_c *Config_Commitment_Call) Run(run func()) *Config_Commitment_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_Commitment_Call) Return(_a0 rpc.CommitmentType) *Config_Commitment_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_Commitment_Call) RunAndReturn(run func() rpc.CommitmentType) *Config_Commitment_Call { + _c.Call.Return(run) + return _c +} + // ComputeUnitLimitDefault provides a mock function with given fields: func (_m *Config) ComputeUnitLimitDefault() uint32 { ret := _m.Called() @@ -104,6 +220,33 @@ func (_m *Config) ComputeUnitLimitDefault() uint32 { return r0 } +// Config_ComputeUnitLimitDefault_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputeUnitLimitDefault' +type Config_ComputeUnitLimitDefault_Call struct { + *mock.Call +} + +// ComputeUnitLimitDefault is a helper method to define mock.On call +func (_e *Config_Expecter) ComputeUnitLimitDefault() *Config_ComputeUnitLimitDefault_Call { + return &Config_ComputeUnitLimitDefault_Call{Call: _e.mock.On("ComputeUnitLimitDefault")} +} + +func (_c *Config_ComputeUnitLimitDefault_Call) Run(run func()) *Config_ComputeUnitLimitDefault_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_ComputeUnitLimitDefault_Call) Return(_a0 uint32) *Config_ComputeUnitLimitDefault_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_ComputeUnitLimitDefault_Call) RunAndReturn(run func() uint32) *Config_ComputeUnitLimitDefault_Call { + _c.Call.Return(run) + return _c +} + // ComputeUnitPriceDefault provides a mock function with given fields: func (_m *Config) ComputeUnitPriceDefault() uint64 { ret := _m.Called() @@ -122,6 +265,33 @@ func (_m *Config) ComputeUnitPriceDefault() uint64 { return r0 } +// Config_ComputeUnitPriceDefault_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputeUnitPriceDefault' +type Config_ComputeUnitPriceDefault_Call struct { + *mock.Call +} + +// ComputeUnitPriceDefault is a helper method to define mock.On call +func (_e *Config_Expecter) ComputeUnitPriceDefault() *Config_ComputeUnitPriceDefault_Call { + return &Config_ComputeUnitPriceDefault_Call{Call: _e.mock.On("ComputeUnitPriceDefault")} +} + +func (_c *Config_ComputeUnitPriceDefault_Call) Run(run func()) *Config_ComputeUnitPriceDefault_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_ComputeUnitPriceDefault_Call) Return(_a0 uint64) *Config_ComputeUnitPriceDefault_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_ComputeUnitPriceDefault_Call) RunAndReturn(run func() uint64) *Config_ComputeUnitPriceDefault_Call { + _c.Call.Return(run) + return _c +} + // ComputeUnitPriceMax provides a mock function with given fields: func (_m *Config) ComputeUnitPriceMax() uint64 { ret := _m.Called() @@ -140,6 +310,33 @@ func (_m *Config) ComputeUnitPriceMax() uint64 { return r0 } +// Config_ComputeUnitPriceMax_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputeUnitPriceMax' +type Config_ComputeUnitPriceMax_Call struct { + *mock.Call +} + +// ComputeUnitPriceMax is a helper method to define mock.On call +func (_e *Config_Expecter) ComputeUnitPriceMax() *Config_ComputeUnitPriceMax_Call { + return &Config_ComputeUnitPriceMax_Call{Call: _e.mock.On("ComputeUnitPriceMax")} +} + +func (_c *Config_ComputeUnitPriceMax_Call) Run(run func()) *Config_ComputeUnitPriceMax_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_ComputeUnitPriceMax_Call) Return(_a0 uint64) *Config_ComputeUnitPriceMax_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_ComputeUnitPriceMax_Call) RunAndReturn(run func() uint64) *Config_ComputeUnitPriceMax_Call { + _c.Call.Return(run) + return _c +} + // ComputeUnitPriceMin provides a mock function with given fields: func (_m *Config) ComputeUnitPriceMin() uint64 { ret := _m.Called() @@ -158,6 +355,33 @@ func (_m *Config) ComputeUnitPriceMin() uint64 { return r0 } +// Config_ComputeUnitPriceMin_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputeUnitPriceMin' +type Config_ComputeUnitPriceMin_Call struct { + *mock.Call +} + +// ComputeUnitPriceMin is a helper method to define mock.On call +func (_e *Config_Expecter) ComputeUnitPriceMin() *Config_ComputeUnitPriceMin_Call { + return &Config_ComputeUnitPriceMin_Call{Call: _e.mock.On("ComputeUnitPriceMin")} +} + +func (_c *Config_ComputeUnitPriceMin_Call) Run(run func()) *Config_ComputeUnitPriceMin_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_ComputeUnitPriceMin_Call) Return(_a0 uint64) *Config_ComputeUnitPriceMin_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_ComputeUnitPriceMin_Call) RunAndReturn(run func() uint64) *Config_ComputeUnitPriceMin_Call { + _c.Call.Return(run) + return _c +} + // ConfirmPollPeriod provides a mock function with given fields: func (_m *Config) ConfirmPollPeriod() time.Duration { ret := _m.Called() @@ -176,6 +400,33 @@ func (_m *Config) ConfirmPollPeriod() time.Duration { return r0 } +// Config_ConfirmPollPeriod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConfirmPollPeriod' +type Config_ConfirmPollPeriod_Call struct { + *mock.Call +} + +// ConfirmPollPeriod is a helper method to define mock.On call +func (_e *Config_Expecter) ConfirmPollPeriod() *Config_ConfirmPollPeriod_Call { + return &Config_ConfirmPollPeriod_Call{Call: _e.mock.On("ConfirmPollPeriod")} +} + +func (_c *Config_ConfirmPollPeriod_Call) Run(run func()) *Config_ConfirmPollPeriod_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_ConfirmPollPeriod_Call) Return(_a0 time.Duration) *Config_ConfirmPollPeriod_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_ConfirmPollPeriod_Call) RunAndReturn(run func() time.Duration) *Config_ConfirmPollPeriod_Call { + _c.Call.Return(run) + return _c +} + // EstimateComputeUnitLimit provides a mock function with given fields: func (_m *Config) EstimateComputeUnitLimit() bool { ret := _m.Called() @@ -194,6 +445,33 @@ func (_m *Config) EstimateComputeUnitLimit() bool { return r0 } +// Config_EstimateComputeUnitLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EstimateComputeUnitLimit' +type Config_EstimateComputeUnitLimit_Call struct { + *mock.Call +} + +// EstimateComputeUnitLimit is a helper method to define mock.On call +func (_e *Config_Expecter) EstimateComputeUnitLimit() *Config_EstimateComputeUnitLimit_Call { + return &Config_EstimateComputeUnitLimit_Call{Call: _e.mock.On("EstimateComputeUnitLimit")} +} + +func (_c *Config_EstimateComputeUnitLimit_Call) Run(run func()) *Config_EstimateComputeUnitLimit_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_EstimateComputeUnitLimit_Call) Return(_a0 bool) *Config_EstimateComputeUnitLimit_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_EstimateComputeUnitLimit_Call) RunAndReturn(run func() bool) *Config_EstimateComputeUnitLimit_Call { + _c.Call.Return(run) + return _c +} + // FeeBumpPeriod provides a mock function with given fields: func (_m *Config) FeeBumpPeriod() time.Duration { ret := _m.Called() @@ -212,6 +490,33 @@ func (_m *Config) FeeBumpPeriod() time.Duration { return r0 } +// Config_FeeBumpPeriod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FeeBumpPeriod' +type Config_FeeBumpPeriod_Call struct { + *mock.Call +} + +// FeeBumpPeriod is a helper method to define mock.On call +func (_e *Config_Expecter) FeeBumpPeriod() *Config_FeeBumpPeriod_Call { + return &Config_FeeBumpPeriod_Call{Call: _e.mock.On("FeeBumpPeriod")} +} + +func (_c *Config_FeeBumpPeriod_Call) Run(run func()) *Config_FeeBumpPeriod_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_FeeBumpPeriod_Call) Return(_a0 time.Duration) *Config_FeeBumpPeriod_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_FeeBumpPeriod_Call) RunAndReturn(run func() time.Duration) *Config_FeeBumpPeriod_Call { + _c.Call.Return(run) + return _c +} + // FeeEstimatorMode provides a mock function with given fields: func (_m *Config) FeeEstimatorMode() string { ret := _m.Called() @@ -230,6 +535,33 @@ func (_m *Config) FeeEstimatorMode() string { return r0 } +// Config_FeeEstimatorMode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FeeEstimatorMode' +type Config_FeeEstimatorMode_Call struct { + *mock.Call +} + +// FeeEstimatorMode is a helper method to define mock.On call +func (_e *Config_Expecter) FeeEstimatorMode() *Config_FeeEstimatorMode_Call { + return &Config_FeeEstimatorMode_Call{Call: _e.mock.On("FeeEstimatorMode")} +} + +func (_c *Config_FeeEstimatorMode_Call) Run(run func()) *Config_FeeEstimatorMode_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_FeeEstimatorMode_Call) Return(_a0 string) *Config_FeeEstimatorMode_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_FeeEstimatorMode_Call) RunAndReturn(run func() string) *Config_FeeEstimatorMode_Call { + _c.Call.Return(run) + return _c +} + // MaxRetries provides a mock function with given fields: func (_m *Config) MaxRetries() *uint { ret := _m.Called() @@ -250,6 +582,33 @@ func (_m *Config) MaxRetries() *uint { return r0 } +// Config_MaxRetries_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MaxRetries' +type Config_MaxRetries_Call struct { + *mock.Call +} + +// MaxRetries is a helper method to define mock.On call +func (_e *Config_Expecter) MaxRetries() *Config_MaxRetries_Call { + return &Config_MaxRetries_Call{Call: _e.mock.On("MaxRetries")} +} + +func (_c *Config_MaxRetries_Call) Run(run func()) *Config_MaxRetries_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_MaxRetries_Call) Return(_a0 *uint) *Config_MaxRetries_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_MaxRetries_Call) RunAndReturn(run func() *uint) *Config_MaxRetries_Call { + _c.Call.Return(run) + return _c +} + // OCR2CachePollPeriod provides a mock function with given fields: func (_m *Config) OCR2CachePollPeriod() time.Duration { ret := _m.Called() @@ -268,6 +627,33 @@ func (_m *Config) OCR2CachePollPeriod() time.Duration { return r0 } +// Config_OCR2CachePollPeriod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OCR2CachePollPeriod' +type Config_OCR2CachePollPeriod_Call struct { + *mock.Call +} + +// OCR2CachePollPeriod is a helper method to define mock.On call +func (_e *Config_Expecter) OCR2CachePollPeriod() *Config_OCR2CachePollPeriod_Call { + return &Config_OCR2CachePollPeriod_Call{Call: _e.mock.On("OCR2CachePollPeriod")} +} + +func (_c *Config_OCR2CachePollPeriod_Call) Run(run func()) *Config_OCR2CachePollPeriod_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_OCR2CachePollPeriod_Call) Return(_a0 time.Duration) *Config_OCR2CachePollPeriod_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_OCR2CachePollPeriod_Call) RunAndReturn(run func() time.Duration) *Config_OCR2CachePollPeriod_Call { + _c.Call.Return(run) + return _c +} + // OCR2CacheTTL provides a mock function with given fields: func (_m *Config) OCR2CacheTTL() time.Duration { ret := _m.Called() @@ -286,6 +672,33 @@ func (_m *Config) OCR2CacheTTL() time.Duration { return r0 } +// Config_OCR2CacheTTL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OCR2CacheTTL' +type Config_OCR2CacheTTL_Call struct { + *mock.Call +} + +// OCR2CacheTTL is a helper method to define mock.On call +func (_e *Config_Expecter) OCR2CacheTTL() *Config_OCR2CacheTTL_Call { + return &Config_OCR2CacheTTL_Call{Call: _e.mock.On("OCR2CacheTTL")} +} + +func (_c *Config_OCR2CacheTTL_Call) Run(run func()) *Config_OCR2CacheTTL_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_OCR2CacheTTL_Call) Return(_a0 time.Duration) *Config_OCR2CacheTTL_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_OCR2CacheTTL_Call) RunAndReturn(run func() time.Duration) *Config_OCR2CacheTTL_Call { + _c.Call.Return(run) + return _c +} + // SkipPreflight provides a mock function with given fields: func (_m *Config) SkipPreflight() bool { ret := _m.Called() @@ -304,6 +717,33 @@ func (_m *Config) SkipPreflight() bool { return r0 } +// Config_SkipPreflight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SkipPreflight' +type Config_SkipPreflight_Call struct { + *mock.Call +} + +// SkipPreflight is a helper method to define mock.On call +func (_e *Config_Expecter) SkipPreflight() *Config_SkipPreflight_Call { + return &Config_SkipPreflight_Call{Call: _e.mock.On("SkipPreflight")} +} + +func (_c *Config_SkipPreflight_Call) Run(run func()) *Config_SkipPreflight_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_SkipPreflight_Call) Return(_a0 bool) *Config_SkipPreflight_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_SkipPreflight_Call) RunAndReturn(run func() bool) *Config_SkipPreflight_Call { + _c.Call.Return(run) + return _c +} + // TxConfirmTimeout provides a mock function with given fields: func (_m *Config) TxConfirmTimeout() time.Duration { ret := _m.Called() @@ -322,6 +762,33 @@ func (_m *Config) TxConfirmTimeout() time.Duration { return r0 } +// Config_TxConfirmTimeout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TxConfirmTimeout' +type Config_TxConfirmTimeout_Call struct { + *mock.Call +} + +// TxConfirmTimeout is a helper method to define mock.On call +func (_e *Config_Expecter) TxConfirmTimeout() *Config_TxConfirmTimeout_Call { + return &Config_TxConfirmTimeout_Call{Call: _e.mock.On("TxConfirmTimeout")} +} + +func (_c *Config_TxConfirmTimeout_Call) Run(run func()) *Config_TxConfirmTimeout_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_TxConfirmTimeout_Call) Return(_a0 time.Duration) *Config_TxConfirmTimeout_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_TxConfirmTimeout_Call) RunAndReturn(run func() time.Duration) *Config_TxConfirmTimeout_Call { + _c.Call.Return(run) + return _c +} + // TxRetentionTimeout provides a mock function with given fields: func (_m *Config) TxRetentionTimeout() time.Duration { ret := _m.Called() @@ -340,6 +807,33 @@ func (_m *Config) TxRetentionTimeout() time.Duration { return r0 } +// Config_TxRetentionTimeout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TxRetentionTimeout' +type Config_TxRetentionTimeout_Call struct { + *mock.Call +} + +// TxRetentionTimeout is a helper method to define mock.On call +func (_e *Config_Expecter) TxRetentionTimeout() *Config_TxRetentionTimeout_Call { + return &Config_TxRetentionTimeout_Call{Call: _e.mock.On("TxRetentionTimeout")} +} + +func (_c *Config_TxRetentionTimeout_Call) Run(run func()) *Config_TxRetentionTimeout_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_TxRetentionTimeout_Call) Return(_a0 time.Duration) *Config_TxRetentionTimeout_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_TxRetentionTimeout_Call) RunAndReturn(run func() time.Duration) *Config_TxRetentionTimeout_Call { + _c.Call.Return(run) + return _c +} + // TxRetryTimeout provides a mock function with given fields: func (_m *Config) TxRetryTimeout() time.Duration { ret := _m.Called() @@ -358,6 +852,33 @@ func (_m *Config) TxRetryTimeout() time.Duration { return r0 } +// Config_TxRetryTimeout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TxRetryTimeout' +type Config_TxRetryTimeout_Call struct { + *mock.Call +} + +// TxRetryTimeout is a helper method to define mock.On call +func (_e *Config_Expecter) TxRetryTimeout() *Config_TxRetryTimeout_Call { + return &Config_TxRetryTimeout_Call{Call: _e.mock.On("TxRetryTimeout")} +} + +func (_c *Config_TxRetryTimeout_Call) Run(run func()) *Config_TxRetryTimeout_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_TxRetryTimeout_Call) Return(_a0 time.Duration) *Config_TxRetryTimeout_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_TxRetryTimeout_Call) RunAndReturn(run func() time.Duration) *Config_TxRetryTimeout_Call { + _c.Call.Return(run) + return _c +} + // TxTimeout provides a mock function with given fields: func (_m *Config) TxTimeout() time.Duration { ret := _m.Called() @@ -376,6 +897,33 @@ func (_m *Config) TxTimeout() time.Duration { return r0 } +// Config_TxTimeout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TxTimeout' +type Config_TxTimeout_Call struct { + *mock.Call +} + +// TxTimeout is a helper method to define mock.On call +func (_e *Config_Expecter) TxTimeout() *Config_TxTimeout_Call { + return &Config_TxTimeout_Call{Call: _e.mock.On("TxTimeout")} +} + +func (_c *Config_TxTimeout_Call) Run(run func()) *Config_TxTimeout_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Config_TxTimeout_Call) Return(_a0 time.Duration) *Config_TxTimeout_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Config_TxTimeout_Call) RunAndReturn(run func() time.Duration) *Config_TxTimeout_Call { + _c.Call.Return(run) + return _c +} + // NewConfig creates a new instance of Config. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewConfig(t interface { diff --git a/pkg/solana/fees/estimator.go b/pkg/solana/fees/estimator.go index aded6f4a6..f09fec95b 100644 --- a/pkg/solana/fees/estimator.go +++ b/pkg/solana/fees/estimator.go @@ -2,7 +2,6 @@ package fees import "context" -//go:generate mockery --name Estimator --output ./mocks/ type Estimator interface { Start(context.Context) error Close() error diff --git a/pkg/solana/fees/mocks/Estimator.go b/pkg/solana/fees/mocks/Estimator.go index a61b811a7..06d6a53ae 100644 --- a/pkg/solana/fees/mocks/Estimator.go +++ b/pkg/solana/fees/mocks/Estimator.go @@ -13,6 +13,14 @@ type Estimator struct { mock.Mock } +type Estimator_Expecter struct { + mock *mock.Mock +} + +func (_m *Estimator) EXPECT() *Estimator_Expecter { + return &Estimator_Expecter{mock: &_m.Mock} +} + // BaseComputeUnitPrice provides a mock function with given fields: func (_m *Estimator) BaseComputeUnitPrice() uint64 { ret := _m.Called() @@ -31,6 +39,33 @@ func (_m *Estimator) BaseComputeUnitPrice() uint64 { return r0 } +// Estimator_BaseComputeUnitPrice_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BaseComputeUnitPrice' +type Estimator_BaseComputeUnitPrice_Call struct { + *mock.Call +} + +// BaseComputeUnitPrice is a helper method to define mock.On call +func (_e *Estimator_Expecter) BaseComputeUnitPrice() *Estimator_BaseComputeUnitPrice_Call { + return &Estimator_BaseComputeUnitPrice_Call{Call: _e.mock.On("BaseComputeUnitPrice")} +} + +func (_c *Estimator_BaseComputeUnitPrice_Call) Run(run func()) *Estimator_BaseComputeUnitPrice_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Estimator_BaseComputeUnitPrice_Call) Return(_a0 uint64) *Estimator_BaseComputeUnitPrice_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Estimator_BaseComputeUnitPrice_Call) RunAndReturn(run func() uint64) *Estimator_BaseComputeUnitPrice_Call { + _c.Call.Return(run) + return _c +} + // Close provides a mock function with given fields: func (_m *Estimator) Close() error { ret := _m.Called() @@ -49,6 +84,33 @@ func (_m *Estimator) Close() error { return r0 } +// Estimator_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type Estimator_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +func (_e *Estimator_Expecter) Close() *Estimator_Close_Call { + return &Estimator_Close_Call{Call: _e.mock.On("Close")} +} + +func (_c *Estimator_Close_Call) Run(run func()) *Estimator_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Estimator_Close_Call) Return(_a0 error) *Estimator_Close_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Estimator_Close_Call) RunAndReturn(run func() error) *Estimator_Close_Call { + _c.Call.Return(run) + return _c +} + // Start provides a mock function with given fields: _a0 func (_m *Estimator) Start(_a0 context.Context) error { ret := _m.Called(_a0) @@ -67,6 +129,34 @@ func (_m *Estimator) Start(_a0 context.Context) error { return r0 } +// Estimator_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type Estimator_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +// - _a0 context.Context +func (_e *Estimator_Expecter) Start(_a0 interface{}) *Estimator_Start_Call { + return &Estimator_Start_Call{Call: _e.mock.On("Start", _a0)} +} + +func (_c *Estimator_Start_Call) Run(run func(_a0 context.Context)) *Estimator_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Estimator_Start_Call) Return(_a0 error) *Estimator_Start_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Estimator_Start_Call) RunAndReturn(run func(context.Context) error) *Estimator_Start_Call { + _c.Call.Return(run) + return _c +} + // NewEstimator creates a new instance of Estimator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewEstimator(t interface { diff --git a/pkg/solana/txm/mocks/simple_keystore.go b/pkg/solana/txm/mocks/simple_keystore.go index 1c0bd6562..655869cd7 100644 --- a/pkg/solana/txm/mocks/simple_keystore.go +++ b/pkg/solana/txm/mocks/simple_keystore.go @@ -13,6 +13,14 @@ type SimpleKeystore struct { mock.Mock } +type SimpleKeystore_Expecter struct { + mock *mock.Mock +} + +func (_m *SimpleKeystore) EXPECT() *SimpleKeystore_Expecter { + return &SimpleKeystore_Expecter{mock: &_m.Mock} +} + // Accounts provides a mock function with given fields: ctx func (_m *SimpleKeystore) Accounts(ctx context.Context) ([]string, error) { ret := _m.Called(ctx) @@ -43,6 +51,34 @@ func (_m *SimpleKeystore) Accounts(ctx context.Context) ([]string, error) { return r0, r1 } +// SimpleKeystore_Accounts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Accounts' +type SimpleKeystore_Accounts_Call struct { + *mock.Call +} + +// Accounts is a helper method to define mock.On call +// - ctx context.Context +func (_e *SimpleKeystore_Expecter) Accounts(ctx interface{}) *SimpleKeystore_Accounts_Call { + return &SimpleKeystore_Accounts_Call{Call: _e.mock.On("Accounts", ctx)} +} + +func (_c *SimpleKeystore_Accounts_Call) Run(run func(ctx context.Context)) *SimpleKeystore_Accounts_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *SimpleKeystore_Accounts_Call) Return(accounts []string, err error) *SimpleKeystore_Accounts_Call { + _c.Call.Return(accounts, err) + return _c +} + +func (_c *SimpleKeystore_Accounts_Call) RunAndReturn(run func(context.Context) ([]string, error)) *SimpleKeystore_Accounts_Call { + _c.Call.Return(run) + return _c +} + // Sign provides a mock function with given fields: ctx, account, data func (_m *SimpleKeystore) Sign(ctx context.Context, account string, data []byte) ([]byte, error) { ret := _m.Called(ctx, account, data) @@ -73,6 +109,36 @@ func (_m *SimpleKeystore) Sign(ctx context.Context, account string, data []byte) return r0, r1 } +// SimpleKeystore_Sign_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Sign' +type SimpleKeystore_Sign_Call struct { + *mock.Call +} + +// Sign is a helper method to define mock.On call +// - ctx context.Context +// - account string +// - data []byte +func (_e *SimpleKeystore_Expecter) Sign(ctx interface{}, account interface{}, data interface{}) *SimpleKeystore_Sign_Call { + return &SimpleKeystore_Sign_Call{Call: _e.mock.On("Sign", ctx, account, data)} +} + +func (_c *SimpleKeystore_Sign_Call) Run(run func(ctx context.Context, account string, data []byte)) *SimpleKeystore_Sign_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].([]byte)) + }) + return _c +} + +func (_c *SimpleKeystore_Sign_Call) Return(signature []byte, err error) *SimpleKeystore_Sign_Call { + _c.Call.Return(signature, err) + return _c +} + +func (_c *SimpleKeystore_Sign_Call) RunAndReturn(run func(context.Context, string, []byte) ([]byte, error)) *SimpleKeystore_Sign_Call { + _c.Call.Return(run) + return _c +} + // NewSimpleKeystore creates a new instance of SimpleKeystore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewSimpleKeystore(t interface { diff --git a/pkg/solana/txm/txm.go b/pkg/solana/txm/txm.go index e34c99cef..13b7fcfdc 100644 --- a/pkg/solana/txm/txm.go +++ b/pkg/solana/txm/txm.go @@ -38,7 +38,6 @@ const ( var _ services.Service = (*Txm)(nil) -//go:generate mockery --name SimpleKeystore --output ./mocks/ --case=underscore --filename simple_keystore.go type SimpleKeystore interface { Sign(ctx context.Context, account string, data []byte) (signature []byte, err error) Accounts(ctx context.Context) (accounts []string, err error) diff --git a/scripts/build-contract-artifacts-action.sh b/scripts/build-contract-artifacts-action.sh index 4aa2781b3..379628b43 100755 --- a/scripts/build-contract-artifacts-action.sh +++ b/scripts/build-contract-artifacts-action.sh @@ -11,8 +11,8 @@ CONTRACTS=${REPO}/contracts # install go apt-get update apt-get install -y wget -wget https://golang.org/dl/go1.21.7.linux-amd64.tar.gz -tar -xvf go1.21.7.linux-amd64.tar.gz +wget https://golang.org/dl/go1.22.8.linux-amd64.tar.gz +tar -xvf go1.22.8.linux-amd64.tar.gz mv go /usr/local export PATH=/usr/local/go/bin:$PATH export GOPATH=$HOME/go