mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-25 15:55:18 +00:00
ffd306ef52
* add grpc client * add e2e tests for grpc client * add grpc client readme * doc update * fix more doc issues * remove util namespace & move grpc client to chain * rename GrpcClient to Grpc * add 3rd party query clients * fix invalid url in readme * update e2e tests to use grpc client (#1787)
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package e2e_test
|
|
|
|
import (
|
|
"context"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
|
|
|
evmutiltypes "github.com/kava-labs/kava/x/evmutil/types"
|
|
)
|
|
|
|
func (suite *IntegrationTestSuite) TestGrpcClientQueryCosmosModule_Balance() {
|
|
// ARRANGE
|
|
// setup kava account
|
|
funds := ukava(1e5) // .1 KAVA
|
|
kavaAcc := suite.Kava.NewFundedAccount("balance-test", sdk.NewCoins(funds))
|
|
|
|
// ACT
|
|
rsp, err := suite.Kava.Grpc.Query.Bank.Balance(context.Background(), &banktypes.QueryBalanceRequest{
|
|
Address: kavaAcc.SdkAddress.String(),
|
|
Denom: funds.Denom,
|
|
})
|
|
|
|
// ASSERT
|
|
suite.Require().NoError(err)
|
|
suite.Require().Equal(funds.Amount, rsp.Balance.Amount)
|
|
}
|
|
|
|
func (suite *IntegrationTestSuite) TestGrpcClientQueryKavaModule_EvmParams() {
|
|
// ACT
|
|
rsp, err := suite.Kava.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)
|
|
}
|