Some checks failed
CodeQL / Analyze (push) Waiting to run
golangci-lint / lint (push) Waiting to run
Tests / Code Coverage / build (amd64) (push) Waiting to run
Tests / Code Coverage / build (arm64) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[additional-args:-tags="test_e2e" name:e2e path:./e2e]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:08-wasm path:./modules/light-clients/08-wasm]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:ibc-go path:.]) (push) Waiting to run
Docker Build & Push Simapp (main) / docker-build (push) Has been cancelled
48 lines
1.5 KiB
Go
48 lines
1.5 KiB
Go
package keeper
|
|
|
|
import (
|
|
"context"
|
|
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
|
|
sdk "git.cw.tr/mukan-network/mukan-sdk/types"
|
|
|
|
"git.cw.tr/mukan-network/mukan-ibc/modules/apps/27-interchain-accounts/controller/types"
|
|
icatypes "git.cw.tr/mukan-network/mukan-ibc/modules/apps/27-interchain-accounts/types"
|
|
)
|
|
|
|
var _ types.QueryServer = (*Keeper)(nil)
|
|
|
|
// InterchainAccount implements the Query/InterchainAccount gRPC method
|
|
func (k Keeper) InterchainAccount(goCtx context.Context, req *types.QueryInterchainAccountRequest) (*types.QueryInterchainAccountResponse, error) {
|
|
if req == nil {
|
|
return nil, status.Error(codes.InvalidArgument, "empty request")
|
|
}
|
|
|
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
|
|
|
portID, err := icatypes.NewControllerPortID(req.Owner)
|
|
if err != nil {
|
|
return nil, status.Errorf(codes.InvalidArgument, "failed to generate portID from owner address: %s", err)
|
|
}
|
|
|
|
addr, found := k.GetInterchainAccountAddress(ctx, req.ConnectionId, portID)
|
|
if !found {
|
|
return nil, status.Errorf(codes.NotFound, "failed to retrieve account address for %s on connection %s", portID, req.ConnectionId)
|
|
}
|
|
|
|
return &types.QueryInterchainAccountResponse{
|
|
Address: addr,
|
|
}, nil
|
|
}
|
|
|
|
// Params implements the Query/Params gRPC method
|
|
func (k Keeper) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
|
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
|
params := k.GetParams(ctx)
|
|
|
|
return &types.QueryParamsResponse{
|
|
Params: ¶ms,
|
|
}, nil
|
|
}
|