Skip to content

Commit

Permalink
Merge pull request #207 from terra-money/fix/v2.7/tokenfactory
Browse files Browse the repository at this point in the history
fix: querying token factory from LCD
  • Loading branch information
emidev98 authored Nov 10, 2023
2 parents 02da49a + 1497f75 commit 23a8809
Show file tree
Hide file tree
Showing 4 changed files with 341 additions and 6 deletions.
6 changes: 4 additions & 2 deletions proto/osmosis/tokenfactory/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ service Query {
option (google.api.http).get = "/osmosis/tokenfactory/v1beta1/params";
}

// DenomAuthorityMetadata defines a gRPC query method for fetching
// DenomAuthorityMetadata for a particular denom.
// Given the denom, returns the authority metadata for the denom.
// This method can receive both the denom encoded to URL (for the LCD requests)
// and the denom not encoded:
// e.g. factory%2Fterra1v0eee20gjl68fuk0chyrkch2z7suw2mhg3wkxf%2Futoken931
rpc DenomAuthorityMetadata(QueryDenomAuthorityMetadataRequest)
returns (QueryDenomAuthorityMetadataResponse) {
option (google.api.http).get =
Expand Down
5 changes: 5 additions & 0 deletions x/tokenfactory/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package keeper

import (
"context"
"net/url"

sdk "github.com/cosmos/cosmos-sdk/types"

Expand All @@ -19,6 +20,10 @@ func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*typ

func (k Keeper) DenomAuthorityMetadata(ctx context.Context, req *types.QueryDenomAuthorityMetadataRequest) (*types.QueryDenomAuthorityMetadataResponse, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)
decodedDenom, err := url.QueryUnescape(req.Denom)
if err == nil {
req.Denom = decodedDenom
}

authorityMetadata, err := k.GetAuthorityMetadata(sdkCtx, req.GetDenom())
if err != nil {
Expand Down
12 changes: 8 additions & 4 deletions x/tokenfactory/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

324 changes: 324 additions & 0 deletions x/wasmd/types/executed_contracts.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 23a8809

Please sign in to comment.