Skip to content

Commit

Permalink
fix(eth): update ethKeys & ethTransaction query
Browse files Browse the repository at this point in the history
Update ethKeys & ethTransaction query to use the new dataloader `GetChainByRelayID` as the existing loader does not handle duplicate Id across different network.
  • Loading branch information
graham-chainlink committed Oct 22, 2024
1 parent b849b89 commit 8968048
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion core/web/resolver/eth_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/graph-gophers/graphql-go"
commonTypes "github.com/smartcontractkit/chainlink-common/pkg/types"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey"
"github.com/smartcontractkit/chainlink/v2/core/services/relay"
"github.com/smartcontractkit/chainlink/v2/core/web/loader"
)

Expand Down Expand Up @@ -37,7 +39,8 @@ func NewETHKeys(keys []ETHKey) []*ETHKeyResolver {
}

func (r *ETHKeyResolver) Chain(ctx context.Context) (*ChainResolver, error) {
chain, err := loader.GetChainByID(ctx, r.key.state.EVMChainID.String())
relayID := commonTypes.NewRelayID(relay.NetworkEVM, r.key.state.EVMChainID.String())
chain, err := loader.GetChainByRelayID(ctx, relayID.Name())
if err != nil {
return nil, err
}
Expand Down
5 changes: 4 additions & 1 deletion core/web/resolver/eth_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import (

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/graph-gophers/graphql-go"
commonTypes "github.com/smartcontractkit/chainlink-common/pkg/types"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr"
"github.com/smartcontractkit/chainlink/v2/core/services/relay"
"github.com/smartcontractkit/chainlink/v2/core/utils/stringutils"
"github.com/smartcontractkit/chainlink/v2/core/web/loader"
)
Expand Down Expand Up @@ -98,7 +100,8 @@ func (r *EthTransactionResolver) Hex(ctx context.Context) string {

// Chain resolves the node's chain object field.
func (r *EthTransactionResolver) Chain(ctx context.Context) (*ChainResolver, error) {
chain, err := loader.GetChainByID(ctx, string(r.EVMChainID()))
relayID := commonTypes.NewRelayID(relay.NetworkEVM, string(r.EVMChainID()))
chain, err := loader.GetChainByRelayID(ctx, relayID.Name())
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 8968048

Please sign in to comment.