Skip to content

Commit

Permalink
Merge branch 'main' into chore/revert-ts-codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani committed Oct 19, 2023
2 parents dc31f07 + 7436d93 commit 468695a
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 20 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [#3559](https://github.com/ignite/cli/pull/3559) Bump network plugin version to `v0.1.1`
- [#3581](https://github.com/ignite/cli/pull/3581) Bump cometbft and cometbft-db in the template
- [#3522](https://github.com/ignite/cli/pull/3522) Remove indentation from `chain serve` output
- [#3346](https://github.com/ignite/cli/issues/3346) Improve scaffold query --help
- [#3601](https://github.com/ignite/cli/pull/3601) Update ts-relayer version to `0.10.0`
- [#3658](https://github.com/ignite/cli/pull/3658) Rename Marshaler to Codec in EncodingConfig
- [#3653](https://github.com/ignite/cli/pull/3653) Add "app" extension to plugin binaries
Expand Down
22 changes: 22 additions & 0 deletions ignite/cmd/scaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,28 @@ const (
msgCommitPrompt = "Do you want to proceed without committing your saved changes"

statusScaffolding = "Scaffolding..."

supportFieldTypes = `
Currently supports:
| Type | Alias | Index | Code Type | Description |
|--------------|---------|-------|-----------|---------------------------------|
| string | - | yes | string | Text type |
| array.string | strings | no | []string | List of text type |
| bool | - | yes | bool | Boolean type |
| int | - | yes | int32 | Integer type |
| array.int | ints | no | []int32 | List of integers types |
| uint | - | yes | uint64 | Unsigned integer type |
| array.uint | uints | no | []uint64 | List of unsigned integers types |
| coin | - | no | sdk.Coin | Cosmos SDK coin type |
| array.coin | coins | no | sdk.Coins | List of Cosmos SDK coin types |
Field Usage:
- fieldName
- fieldName:fieldType
If no :fieldType, default (string) is used
`
)

// NewScaffold returns a command that groups scaffolding related sub commands.
Expand Down
14 changes: 1 addition & 13 deletions ignite/cmd/scaffold_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,7 @@ array.coin. An example of using field types:
ignite scaffold list pool amount:coin tags:array.string height:int
Supported types:
| Type | Alias | Index | Code Type | Description |
|--------------|---------|-------|-----------|---------------------------------|
| string | - | yes | string | Text type |
| array.string | strings | no | []string | List of text type |
| bool | - | yes | bool | Boolean type |
| int | - | yes | int32 | Integer type |
| array.int | ints | no | []int32 | List of integers types |
| uint | - | yes | uint64 | Unsigned integer type |
| array.uint | uints | no | []uint64 | List of unsigned integers types |
| coin | - | no | sdk.Coin | Cosmos SDK coin type |
| array.coin | coins | no | sdk.Coins | List of Cosmos SDK coin types |
For detailed type information use ignite scaffold type --help
"Index" indicates whether the type can be used as an index in
"ignite scaffold map".
Expand Down
4 changes: 3 additions & 1 deletion ignite/cmd/scaffold_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ incrementing integer, whereas "map" values are indexed by a user-provided value
Let's use the same blog post example:
ignite scaffold map post title body
ignite scaffold map post title body:string
This command scaffolds a "Post" type and CRUD functionality to create, read,
updated, and delete posts. However, when creating a new post with your chain's
Expand Down Expand Up @@ -54,6 +54,8 @@ product values that have the same category but are using different GUIDs.
Since the behavior of "list" and "map" scaffolding is very similar, you can use
the "--no-message", "--module", "--signer" flags as well as the colon syntax for
custom types.
For detailed type information use ignite scaffold type --help
`,
Args: cobra.MinimumNArgs(1),
PreRunE: migrationPreRunHandler,
Expand Down
4 changes: 3 additions & 1 deletion ignite/cmd/scaffold_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const flagSigner = "signer"
// NewScaffoldMessage returns the command to scaffold messages.
func NewScaffoldMessage() *cobra.Command {
c := &cobra.Command{
Use: "message [name] [field1] [field2] ...",
Use: "message [name] [field1:type1] [field2:type2] ...",
Short: "Message to perform state transition on the blockchain",
Long: `Message scaffolding is useful for quickly adding functionality to your
blockchain to handle specific Cosmos SDK messages.
Expand All @@ -38,6 +38,8 @@ The command above will create a new message MsgAddPool with three fields: amount
(in tokens), denom (a string), and active (a boolean). The message will be added
to the "dex" module.
For detailed type information use ignite scaffold type --help
By default, the message is defined as a proto message in the
"proto/{app}/{module}/tx.proto" and registered in the "Msg" service. A CLI command to
create and broadcast a transaction with MsgAddPool is created in the module's
Expand Down
7 changes: 5 additions & 2 deletions ignite/cmd/scaffold_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ const (
// NewScaffoldQuery command creates a new type command to scaffold queries.
func NewScaffoldQuery() *cobra.Command {
c := &cobra.Command{
Use: "query [name] [request_field1] [request_field2] ...",
Short: "Query for fetching data from a blockchain",
Use: "query [name] [field1:type1] [field2:type2] ...",
Short: "Query for fetching data from a blockchain",
Long: `Query for fetching data from a blockchain.
For detailed type information use ignite scaffold type --help.`,
Args: cobra.MinimumNArgs(1),
PreRunE: migrationPreRunHandler,
RunE: queryHandler,
Expand Down
8 changes: 6 additions & 2 deletions ignite/cmd/scaffold_single.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import (
// NewScaffoldSingle returns a new command to scaffold a singleton.
func NewScaffoldSingle() *cobra.Command {
c := &cobra.Command{
Use: "single NAME [field]...",
Short: "CRUD for data stored in a single location",
Use: "single NAME [field:type]...",
Short: "CRUD for data stored in a single location",
Long: `CRUD for data stored in a single location.
For detailed type information use ignite scaffold type --help.`,
Example: " ignite scaffold single todo-single title:string done:bool",
Args: cobra.MinimumNArgs(1),
PreRunE: migrationPreRunHandler,
RunE: scaffoldSingleHandler,
Expand Down
6 changes: 5 additions & 1 deletion ignite/cmd/scaffold_type.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package ignitecmd

import (
"fmt"

"github.com/spf13/cobra"

"github.com/ignite/cli/ignite/services/scaffolder"
Expand All @@ -9,8 +11,10 @@ import (
// NewScaffoldType returns a new command to scaffold a type.
func NewScaffoldType() *cobra.Command {
c := &cobra.Command{
Use: "type NAME [field]...",
Use: "type NAME [field:type] ...",
Short: "Type definition",
Long: fmt.Sprintf("Type information\n%s\n", supportFieldTypes),
Example: " ignite scaffold type todo-item priority:int desc:string tags:array.string done:bool",
Args: cobra.MinimumNArgs(1),
PreRunE: migrationPreRunHandler,
RunE: scaffoldTypeHandler,
Expand Down

0 comments on commit 468695a

Please sign in to comment.