Skip to content

Commit

Permalink
Merge pull request #479 from icon-project/fix/remove-grpc-cosmos
Browse files Browse the repository at this point in the history
fix: remove grpc url
  • Loading branch information
sherpalden authored Feb 4, 2025
2 parents 45cb699 + 1f55582 commit 8939bd2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
15 changes: 10 additions & 5 deletions relayer/chains/wasm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,19 @@ func (c *Client) GetBalance(ctx context.Context, addr string, denomination strin
}

func (c *Client) GetAccountInfo(ctx context.Context, addr string) (sdkTypes.AccountI, error) {
res, err := c.aq.Account(ctx, &authTypes.QueryAccountRequest{Address: addr})
accAddr, err := sdkTypes.AccAddressFromBech32(addr)
if err != nil {
return nil, err
}

var account sdkTypes.AccountI

return account, c.ctx.InterfaceRegistry.UnpackAny(res.Account, &account)
acc, err := c.ctx.AccountRetriever.GetAccount(c.ctx, accAddr)
if err != nil {
return nil, err
}
return &authTypes.BaseAccount{
Address: addr,
AccountNumber: acc.GetAccountNumber(),
Sequence: acc.GetSequence(),
}, nil
}

// Create new AccountI
Expand Down
11 changes: 2 additions & 9 deletions relayer/chains/wasm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package wasm

import (
"context"
"crypto/tls"
"fmt"
"os"
"path/filepath"
Expand All @@ -13,18 +12,16 @@ import (
"github.com/cometbft/cometbft/rpc/client/http"
sdkClient "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/icon-project/centralized-relay/relayer/chains/wasm/types"
"github.com/icon-project/centralized-relay/relayer/provider"
relayTypes "github.com/icon-project/centralized-relay/relayer/types"

"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
)

type Config struct {
provider.CommonConfig `json:",inline" yaml:",inline"`
GrpcUrl string `json:"grpc-url" yaml:"grpc-url"`
KeyringBackend string `json:"keyring-backend" yaml:"keyring-backend"`
KeyringDir string `json:"keyring-dir" yaml:"keyring-dir"`
AccountPrefix string `json:"account-prefix" yaml:"account-prefix"`
Expand Down Expand Up @@ -129,10 +126,6 @@ func (c *Config) newClientContext(ctx context.Context) (sdkClient.Context, error
return sdkClient.Context{}, err
}

grpcClient, err := grpc.NewClient(c.GrpcUrl, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
if err != nil {
return sdkClient.Context{}, err
}
networkInfo, err := cometRPCClient.Status(ctx)
if err != nil {
return sdkClient.Context{}, err
Expand All @@ -151,8 +144,8 @@ func (c *Config) newClientContext(ctx context.Context) (sdkClient.Context, error
BroadcastMode: c.BroadcastMode,
SignModeStr: c.SignModeStr,
Simulate: c.Simulate,
GRPCClient: grpcClient,
InterfaceRegistry: codec.InterfaceRegistry,
AccountRetriever: authtypes.AccountRetriever{},
}, cometRPCClient.Start()
}

Expand Down

0 comments on commit 8939bd2

Please sign in to comment.