Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ilija42 committed Dec 24, 2024
1 parent f2416c0 commit 7bcaf47
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions integration-tests/relayinterface/chain_components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
. "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" //nolint common practice to import test mods with .
"github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives"
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"

"github.com/smartcontractkit/chainlink-solana/pkg/solana/codec"

contract "github.com/smartcontractkit/chainlink-solana/contracts/generated/contract_reader_interface"
Expand Down
11 changes: 6 additions & 5 deletions pkg/solana/config/chain_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

commoncodec "github.com/smartcontractkit/chainlink-common/pkg/codec"
commontypes "github.com/smartcontractkit/chainlink-common/pkg/types"

"github.com/smartcontractkit/chainlink-solana/pkg/solana/codec"
)

Expand Down Expand Up @@ -56,12 +57,12 @@ type RPCOpts struct {
}

func (c *ChainContractReader) UnmarshalJSON(bytes []byte) error {
rawJson := make(map[string]json.RawMessage)
if err := json.Unmarshal(bytes, &rawJson); err != nil {
rawJSON := make(map[string]json.RawMessage)
if err := json.Unmarshal(bytes, &rawJSON); err != nil {
return err
}

idlBytes := rawJson["anchorIDL"]
idlBytes := rawJSON["anchorIDL"]
var rawString string
if err := json.Unmarshal(idlBytes, &rawString); err == nil {
if err = json.Unmarshal([]byte(rawString), &c.IDL); err != nil {
Expand All @@ -79,11 +80,11 @@ func (c *ChainContractReader) UnmarshalJSON(bytes []byte) error {
return fmt.Errorf("namespace idl must have at least one account or event: %w", commontypes.ErrInvalidConfig)
}

if err := json.Unmarshal(rawJson["reads"], &c.Reads); err != nil {
if err := json.Unmarshal(rawJSON["reads"], &c.Reads); err != nil {
return err
}

if c.Reads == nil || len(c.Reads) == 0 {
if len(c.Reads) == 0 {
return fmt.Errorf("namespace must have at least one read: %w", commontypes.ErrInvalidConfig)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/solana/config/chain_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

codeccommon "github.com/smartcontractkit/chainlink-common/pkg/codec"
"github.com/smartcontractkit/chainlink-common/pkg/types"

"github.com/smartcontractkit/chainlink-solana/pkg/solana/codec"

"github.com/smartcontractkit/chainlink-solana/pkg/solana/codec/testutils"
Expand All @@ -36,7 +37,6 @@ func TestChainReaderConfig(t *testing.T) {
var result config.ContractReader
require.NoError(t, json.Unmarshal([]byte(validJSON), &result))
assert.Equal(t, validChainReaderConfig, result)

})

t.Run("valid unmarshal with idl as string", func(t *testing.T) {
Expand Down

0 comments on commit 7bcaf47

Please sign in to comment.