From acbd971fec4cfd382026acf8b89a93d353691239 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Thu, 29 Aug 2024 14:53:54 +0200 Subject: [PATCH] add registry and check if sdk is greater o equal than v0.51 --- _registry/ignite.apps.fee-abstraction.json | 32 +++++++++++++++++++ .../services/scaffolder/scaffolder.go | 13 ++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 _registry/ignite.apps.fee-abstraction.json diff --git a/_registry/ignite.apps.fee-abstraction.json b/_registry/ignite.apps.fee-abstraction.json new file mode 100644 index 00000000..bee0c391 --- /dev/null +++ b/_registry/ignite.apps.fee-abstraction.json @@ -0,0 +1,32 @@ +{ + "appName": "fee-abstraction", + "appDescription": "Integrate the fee abstraction module from osmosis-labs to make it easy for new chains to accept the currencies of existing chains", + "ignite": ">28.5.2", + "dependencies": {}, + "cosmosSDK": ">0.50.8", + "authors": [ + { + "name": "Danilo Pantani", + "github": "Pantani" + } + ], + "repositoryUrl": "https://github.com/ignite/apps", + "documentationUrl": "https://github.com/ignite/apps/blob/main/fee-abstraction/README.md", + "license": { + "name": "MIT", + "url": "https://github.com/ignite/apps/blob/main/LICENSE" + }, + "keywords": [ + "scaffolder", + "fee-abstraction", + "osmosis", + "osmosis-labs", + "cli", + "cosmos-sdk", + "ignite app" + ], + "supportedPlatforms": [ + "mac", + "linux" + ] +} \ No newline at end of file diff --git a/fee-abstraction/services/scaffolder/scaffolder.go b/fee-abstraction/services/scaffolder/scaffolder.go index b0c4bbc0..47722917 100644 --- a/fee-abstraction/services/scaffolder/scaffolder.go +++ b/fee-abstraction/services/scaffolder/scaffolder.go @@ -17,6 +17,7 @@ const ( errOldCosmosSDKVersionStr = `Your chain has been scaffolded with an older version of Cosmos SDK: %s Please, follow the migration guide to upgrade your chain to the latest version at https://docs.ignite.com/migration` + errNewCosmosSDKVersionStr = "Your chain has been scaffolded with the new version (%s) of Cosmos SDK greater than %s" ) // Scaffolder is fee abstraction app scaffolder. @@ -38,8 +39,16 @@ func New(c *chain.Chain, session *cliui.Session) (Scaffolder, error) { // assertSupportedCosmosSDKVersion asserts that a Cosmos SDK version is supported by Ignite CLI. func assertSupportedCosmosSDKVersion(v cosmosver.Version) error { - if v.LT(cosmosver.StargateFiftyVersion) { - return errors.Errorf(errOldCosmosSDKVersionStr, v) + v0501 := cosmosver.StargateFiftyVersion + v0510, err := cosmosver.Parse("0.51.0") + if err != nil { + return err + } + switch { + case v.LT(v0501): + return errors.Errorf(errOldCosmosSDKVersionStr, v.String()) + case v.GTE(v0510): + return errors.Errorf(errNewCosmosSDKVersionStr, v.String(), v0510.String()) } return nil }