diff --git a/integration-tests/relayinterface/chain_components_test.go b/integration-tests/relayinterface/chain_components_test.go index c725ae755..8089b34ca 100644 --- a/integration-tests/relayinterface/chain_components_test.go +++ b/integration-tests/relayinterface/chain_components_test.go @@ -17,10 +17,8 @@ import ( "github.com/gagliardetto/solana-go" "github.com/gagliardetto/solana-go/rpc" "github.com/gagliardetto/solana-go/rpc/ws" - "github.com/gagliardetto/solana-go/text" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" commoncodec "github.com/smartcontractkit/chainlink-common/pkg/codec" @@ -112,7 +110,7 @@ func RunChainComponentsSolanaTests[T WrappedTestingT[T]](t T, it *SolanaChainCom Name: "Test address groups where first namespace shares address with second namespace", Test: func(t T) { ctx := tests.Context(t) - cfg := it.contractReaderConfig + cfg := it.buildContractReaderConfig(t) cfg.AddressShareGroups = [][]string{{AnyContractNameWithSharedAddress1, AnyContractNameWithSharedAddress2, AnyContractNameWithSharedAddress3}} cr := it.GetContractReaderWithCustomCfg(t, cfg) @@ -123,7 +121,7 @@ func RunChainComponentsSolanaTests[T WrappedTestingT[T]](t T, it *SolanaChainCom require.Error(t, cr.Bind(ctx, bound1)) }) - addressToBeShared := it.Helper.CreateAccount(t, AnyValueToReadWithoutAnArgument).String() + addressToBeShared := it.Helper.CreateAccount(t, *it, AnyContractName, AnyValueToReadWithoutAnArgument, TestStruct{}).String() t.Run("Namespace is part of an address share group that doesn't have a registered address and provides an address during Bind", func(t T) { bound1 := []types.BoundContract{{Name: AnyContractNameWithSharedAddress1, Address: addressToBeShared}} @@ -227,46 +225,6 @@ type SolanaChainComponentsInterfaceTester[T WrappedTestingT[T]] struct { // so that a test index can be injected as a PDA seed for each test func (it *SolanaChainComponentsInterfaceTester[T]) Setup(t T) { t.Cleanup(func() {}) - - anyContractReadDef := config.ChainContractReader{ - IDL: mustUnmarshalIDL(t, string(it.Helper.GetJSONEncodedIDL(t))), - Reads: map[string]config.ReadDefinition{ - MethodReturningUint64: { - ChainSpecificName: "DataAccount", - ReadType: config.Account, - OutputModifications: commoncodec.ModifiersConfig{ - &commoncodec.PropertyExtractorConfig{FieldName: "U64Value"}, - }, - }, - MethodReturningUint64Slice: { - ChainSpecificName: "DataAccount", - OutputModifications: commoncodec.ModifiersConfig{ - &commoncodec.PropertyExtractorConfig{FieldName: "U64Slice"}, - }, - }, - }, - } - - it.contractReaderConfig = config.ContractReader{ - Namespaces: map[string]config.ChainContractReader{ - AnyContractName: anyContractReadDef, - AnySecondContractName: { - IDL: mustUnmarshalIDL(t, string(it.Helper.GetJSONEncodedIDL(t))), - Reads: map[string]config.ReadDefinition{ - MethodReturningUint64: { - ChainSpecificName: "DataAccount", - OutputModifications: commoncodec.ModifiersConfig{ - &commoncodec.PropertyExtractorConfig{FieldName: "U64Value"}, - }, - }, - }, - }, - // these are for testing shared address groups - AnyContractNameWithSharedAddress1: anyContractReadDef, - AnyContractNameWithSharedAddress2: anyContractReadDef, - AnyContractNameWithSharedAddress3: anyContractReadDef, - }, - } } func (it *SolanaChainComponentsInterfaceTester[T]) Name() string { @@ -301,23 +259,22 @@ func (it *SolanaChainComponentsInterfaceTester[T]) GetContractReader(t T) types. return svc } -func (it *SolanaChainComponentsInterfaceTester[T]) GetContractReaderWithCustomCfg(t T, cfg config.ContractReader) types.ContractReader { +func (it *SolanaChainComponentsInterfaceTester[T]) GetContractReaderWithCustomCfg(t T, contractReaderConfig config.ContractReader) types.ContractReader { ctx := it.Helper.Context(t) - if it.cr != nil { - return it.cr - } + var events chainreader.EventsReader - svc, err := chainreader.NewContractReaderService(it.Helper.Logger(t), it.Helper.RPCClient(), cfg, nil) + svc, err := chainreader.NewContractReaderService( + it.Helper.Logger(t), + it.Helper.RPCClient(), + contractReaderConfig, + events) require.NoError(t, err) require.NoError(t, svc.Start(ctx)) - it.cr = svc - return svc } - func (it *SolanaChainComponentsInterfaceTester[T]) GetContractWriter(t T) types.ContractWriter { chainWriterConfig := it.buildContractWriterConfig(t) cw, err := chainwriter.NewSolanaChainWriterService(it.Helper.Logger(t), it.Helper.SolanaClient(), *it.Helper.TXM(), nil, chainWriterConfig)