0g-chain/tests/e2e/e2e_grpc_client_query_test.go

41 lines
1.1 KiB
Go
Raw Permalink Normal View History

package e2e_test
import (
"context"
2024-04-24 11:41:25 +00:00
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
2024-04-24 07:10:22 +00:00
evmutiltypes "github.com/0glabs/0g-chain/x/evmutil/types"
)
func (suite *IntegrationTestSuite) TestGrpcClientQueryCosmosModule_Balance() {
// ARRANGE
2024-04-24 11:41:25 +00:00
// setup 0g account
funds := a0gi(big.NewInt(1e5)) // .1 A0GI
zgChainAcc := suite.ZgChain.NewFundedAccount("balance-test", sdk.NewCoins(funds))
// ACT
2024-04-24 11:41:25 +00:00
rsp, err := suite.ZgChain.Grpc.Query.Bank.Balance(context.Background(), &banktypes.QueryBalanceRequest{
Address: zgChainAcc.SdkAddress.String(),
Denom: funds.Denom,
})
// ASSERT
suite.Require().NoError(err)
suite.Require().Equal(funds.Amount, rsp.Balance.Amount)
}
2024-04-24 11:41:25 +00:00
func (suite *IntegrationTestSuite) TestGrpcClientQueryZgChainModule_EvmParams() {
// ACT
2024-04-24 11:41:25 +00:00
rsp, err := suite.ZgChain.Grpc.Query.Evmutil.Params(
context.Background(), &evmutiltypes.QueryParamsRequest{},
)
// ASSERT
suite.Require().NoError(err)
suite.Require().GreaterOrEqual(len(rsp.Params.AllowedCosmosDenoms), 1)
suite.Require().GreaterOrEqual(len(rsp.Params.EnabledConversionPairs), 1)
}