-
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/withdrawal api by address (#41)
* save withdrawals by address * change query params * db iteration bug fix * fix db iteration bug * change cmd name * go mod tidy * cleanup go.mod * change offset to real index * add next --------- Co-authored-by: beer-1 <[email protected]>
- Loading branch information
Showing
19 changed files
with
366 additions
and
118 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
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,39 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/initia-labs/opinit-bots/bot" | ||
bottypes "github.com/initia-labs/opinit-bots/bot/types" | ||
"github.com/initia-labs/opinit-bots/db" | ||
"github.com/initia-labs/opinit-bots/executor" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// migration015Cmd handles the one-time migration of withdrawal data for v0.1.5 | ||
// TODO: Remove this command in the future | ||
func migration015Cmd(ctx *cmdContext) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "migrate", | ||
Args: cobra.ExactArgs(1), | ||
Short: "Run database migrations", | ||
Long: `Run database migrations | ||
v0.1.5: Store the sequence number so that it can be accessed by address | ||
`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
version := args[0] | ||
switch version { | ||
case "v0.1.5": | ||
// Run migration for v0.1.5 | ||
db, err := db.NewDB(bot.GetDBPath(ctx.homePath, bottypes.BotTypeExecutor)) | ||
if err != nil { | ||
return err | ||
} | ||
return executor.Migration015(db) | ||
default: | ||
return fmt.Errorf("unknown migration version: %s", version) | ||
} | ||
}, | ||
} | ||
return cmd | ||
} |
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
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
Oops, something went wrong.