-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add rollkit app * updates * fixes * remove replace * add integration tests * use tagged version
- Loading branch information
1 parent
3ee8005
commit c83ca93
Showing
16 changed files
with
1,815 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ use ( | |
./explorer | ||
./hermes | ||
./marketplace | ||
./rollkit | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Rollkit App Changelog | ||
|
||
## [`v0.1.0`](https://github.com/ignite/apps/releases/tag/rollkit/v0.1.0) | ||
|
||
* First release of the Rollkit app compatible with Ignite >= v28.x.y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# RollKit | ||
|
||
This Ignite App is aimed to extend [Ignite CLI](https://github.com/ignite/cli) and bootstrap the development of a [RollKit](https://rollkit.dev) rollup. | ||
|
||
## Prerequisites | ||
|
||
* Ignite CLI version v28.4.0 or greater. | ||
* Knowledge of blockchain development (Cosmos SDK). | ||
|
||
## Usage | ||
|
||
```sh | ||
ignite s chain gm --address-prefix gm | ||
ignite app install -g github.com/ignite/apps/rollkit | ||
ignite rollkit add | ||
ignite chain build | ||
``` | ||
|
||
Learn more about Rollkit and Ignite in their respective documentation: | ||
|
||
* <https://docs.ignite.com> | ||
* <https://rollkit.dev/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package cmd | ||
|
||
import ( | ||
"context" | ||
"path/filepath" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/ignite/cli/v28/ignite/pkg/cliui" | ||
"github.com/ignite/cli/v28/ignite/pkg/gocmd" | ||
"github.com/ignite/cli/v28/ignite/pkg/placeholder" | ||
"github.com/ignite/cli/v28/ignite/pkg/xgenny" | ||
"github.com/ignite/cli/v28/ignite/services/chain" | ||
|
||
"github.com/ignite/apps/rollkit/template" | ||
) | ||
|
||
const ( | ||
statusScaffolding = "Scaffolding..." | ||
|
||
flagPath = "path" | ||
) | ||
|
||
func NewRollkitAdd() *cobra.Command { | ||
c := &cobra.Command{ | ||
Use: "add", | ||
Short: "Add rollkit support", | ||
Long: "Add rollkit support to your Cosmos SDK chain", | ||
Args: cobra.NoArgs, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
session := cliui.New(cliui.StartSpinnerWithText(statusScaffolding)) | ||
defer session.End() | ||
|
||
appPath, err := cmd.Flags().GetString(flagPath) | ||
if err != nil { | ||
return err | ||
} | ||
absPath, err := filepath.Abs(appPath) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
chain, err := chain.New(absPath) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
g, err := template.NewRollKitGenerator(chain) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
_, err = xgenny.RunWithValidation(placeholder.New(), g) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if finish(cmd.Context(), session, chain.AppPath()) != nil { | ||
return err | ||
} | ||
|
||
session.Printf("\n🎉 RollKit added (`%[1]v`).\n\n", chain.AppPath()) | ||
return nil | ||
}, | ||
} | ||
|
||
c.Flags().StringP(flagPath, "p", ".", "path of the app") | ||
|
||
return c | ||
} | ||
|
||
// finish finalize the scaffolded code (formating, dependencies) | ||
func finish(ctx context.Context, session *cliui.Session, path string) error { | ||
session.StartSpinner("go mod tidy...") | ||
if err := gocmd.ModTidy(ctx, path); err != nil { | ||
return err | ||
} | ||
|
||
session.StartSpinner("Formatting code...") | ||
if err := gocmd.Fmt(ctx, path); err != nil { | ||
return err | ||
} | ||
|
||
_ = gocmd.GoImports(ctx, path) // goimports installation could fail, so ignore the error | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package cmd | ||
|
||
import "github.com/spf13/cobra" | ||
|
||
// NewRollkit creates a new rollkit command that holds | ||
// some other sub commands related to Rollkit. | ||
func NewRollkit() *cobra.Command { | ||
c := &cobra.Command{ | ||
Use: "rollkit [command]", | ||
Aliases: []string{"r"}, | ||
Short: "Ignite rollkit integration", | ||
SilenceUsage: true, | ||
SilenceErrors: true, | ||
} | ||
|
||
// add sub commands. | ||
c.AddCommand( | ||
NewRollkitAdd(), | ||
) | ||
return c | ||
} |
Oops, something went wrong.