-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CORE-827] Scaffolding code for x/ibcratelimit
#870
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { LCDClient } from "@osmonauts/lcd"; | ||
import { ListLimitParamsRequest, ListLimitParamsResponseSDKType, QueryCapacityByDenomRequest, QueryCapacityByDenomResponseSDKType } from "./query"; | ||
export class LCDQueryClient { | ||
req: LCDClient; | ||
|
||
constructor({ | ||
requestClient | ||
}: { | ||
requestClient: LCDClient; | ||
}) { | ||
this.req = requestClient; | ||
this.listLimitParams = this.listLimitParams.bind(this); | ||
this.capacityByDenom = this.capacityByDenom.bind(this); | ||
} | ||
/* List all limit params. */ | ||
|
||
|
||
async listLimitParams(_params: ListLimitParamsRequest = {}): Promise<ListLimitParamsResponseSDKType> { | ||
const endpoint = `dydxprotocol/v4/ibcratelimit/list_limit_params`; | ||
return await this.req.get<ListLimitParamsResponseSDKType>(endpoint); | ||
} | ||
/* Query capacity by denom. */ | ||
|
||
|
||
async capacityByDenom(params: QueryCapacityByDenomRequest): Promise<QueryCapacityByDenomResponseSDKType> { | ||
const options: any = { | ||
params: {} | ||
}; | ||
|
||
if (typeof params?.denom !== "undefined") { | ||
options.params.denom = params.denom; | ||
} | ||
|
||
const endpoint = `dydxprotocol/v4/ibcratelimit/capacity_by_denom`; | ||
return await this.req.get<QueryCapacityByDenomResponseSDKType>(endpoint, options); | ||
} | ||
Comment on lines
+25
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding error handling within the |
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/dydxprotocol/v4-chain/protocol/x/ibcratelimit/types" | ||
) | ||
|
||
// GetQueryCmd returns the cli query commands for this module | ||
func GetQueryCmd(queryRoute string) *cobra.Command { | ||
// Group ibcratelimit queries under a subcommand | ||
cmd := &cobra.Command{ | ||
Use: types.ModuleName, | ||
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), | ||
DisableFlagParsing: true, | ||
SuggestionsMinimumDistance: 2, | ||
RunE: client.ValidateCmd, | ||
} | ||
|
||
// TODO(CORE-823): implement query for `x/ibcratelimit` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
return cmd | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package cli | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func CmdQueryParams() *cobra.Command { | ||
// TODO(CORE-823): implement query for `x/ibcratelimit` | ||
return nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//go:build all || integration_test | ||
|
||
package cli_test | ||
|
||
import ( | ||
"strconv" | ||
"testing" | ||
) | ||
|
||
// Prevent strconv unused error | ||
var _ = strconv.IntSize | ||
|
||
func TestQueryParams(t *testing.T) { | ||
// TODO(CORE-823): implement query for `x/ibcratelimit` | ||
} | ||
Comment on lines
+13
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
options
object incapacityByDenom
is typed asany
. To take advantage of TypeScript's type safety, define a specific type for theoptions
object.Committable suggestion