cmd

package
v0.1.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

Package cmd holds CLI flag variables for the migration module.

- Used by subcommands to configure runtime behavior - Values are set via CLI flags

Index

Constants

View Source
const (
	FlagUnarmoredJSON     = "unarmored-json"
	FlagUnarmoredJSONDesc = "Export unarmored hex privkey. Requires --unsafe."

	FlagUnsafe     = "unsafe"
	FlagUnsafeDesc = "Enable unsafe operations. This flag must be switched on along with all unsafe operation-specific options."

	FlagOutputFile     = "output-file"
	FlagOutputFileDesc = "Path to a file where the migration result will be written."

	FlagDryRunClaim     = "dry-run-claim"
	FlagDryRunClaimDesc = "If true, the claim transaction will be simulated (i.e. a dry run) but not broadcasted onchain."
)

Variables

View Source
var (
	// ErrInvalidUsage usage is returned when the CLI arguments are invalid.
	ErrInvalidUsage = sdkerrors.Register(codespace, 1100, "invalid CLI usage")

	// ErrMorseExportState is returned with the JSON generated from `pocket util export-genesis-for-reset` is invalid.
	ErrMorseExportState = sdkerrors.Register(codespace, 1101, "morse export state failed")

	// ErrMorseStateTransform is returned upon general failure when transforming the MorseExportState into the MorseAccountState.
	ErrMorseStateTransform = sdkerrors.Register(codespace, 1102, "morse export to state transformation invalid")

	// ErrInvalidMorseAccountState is used when the morse account state hash doesn't match the expected hash.
	ErrInvalidMorseAccountState = sdkerrors.Register(codespace, 1103, "morse account state is invalid")
)

Functions

func AdminRecoverMorseAccountCmd added in v0.1.31

func AdminRecoverMorseAccountCmd() *cobra.Command

func ClaimAccountCmd

func ClaimAccountCmd() *cobra.Command

TODO_MAINNET_MIGRATION: Add a few examples in the CLI.

func ClaimApplicationCmd

func ClaimApplicationCmd() *cobra.Command

func ClaimMorseAccountBulkCmd added in v0.1.13

func ClaimMorseAccountBulkCmd() *cobra.Command

TODO_MAINNET_MIGRATION: Update the docs in https://dev.poktroll.com/operate/morse_migration/claiming ClaimMorseAccountBulkCmd returns the cobra command for bulk claiming Morse accounts and mapping them to new Shannon accounts.

func ClaimSupplierBulkCmd added in v0.1.14

func ClaimSupplierBulkCmd() *cobra.Command

ClaimSupplierBulkCmd returns the cobra command for bulk-claiming Morse nodes as Shannon Suppliers.

func ClaimSupplierCmd

func ClaimSupplierCmd() *cobra.Command

TODO_MAINNET_MIGRATION: Add a few examples,

func CollectMorseAccountsCmd

func CollectMorseAccountsCmd() *cobra.Command

DEV_NOTE: AutoCLI does not apply here because there is no gRPC service, message, or query.

Purpose:

  • Facilitate deterministic (reproducible) transformation from Morse's export data structure (MorseStateExport) into Shannon's import data structure (MorseAccountState)
  • Prepare data for use in the MsgImportMorseAccountState message

Note: - Does not interact with the network directly

func ImportMorseAccountsCmd

func ImportMorseAccountsCmd() *cobra.Command

func LoadMorsePrivateKey

func LoadMorsePrivateKey(morseKeyExportPath, passphrase string, noPrompt bool) (ed25519.PrivKey, error)

LoadMorsePrivateKey reads, deserializes, decrypts and returns an exported Morse private key from morseKeyExportPath.

func RecoverMorseAccountCmd added in v0.1.16

func RecoverMorseAccountCmd() *cobra.Command

func UnarmorDecryptPrivKey

func UnarmorDecryptPrivKey(armorStr []byte, passphrase string) (ed25519.PrivKey, error)

UnarmorDecryptPrivKey deserializes and decrypts the exported Morse private key file in armorStr using the passphrase.

func ValidateMorseAccountsCmd

func ValidateMorseAccountsCmd() *cobra.Command

Types

type MigrationBatchResult added in v0.1.13

type MigrationBatchResult struct {
	// Mappings is a list of Morse to Shannon account mappings.
	Mappings []*MorseShannonMapping `json:"mappings"`

	// Error contains an error message for the batch, if any.
	Error string `json:"error"`

	// TxHash is the transaction hash for the migration batch.
	// Single tx with multiple messages for simplified migration.
	// See: https://github.com/pokt-network/poktroll/issues/1267
	TxHash string `json:"tx_hash"`

	// TxCode is the transaction code for the migration batch.
	TxCode uint32 `json:"tx_code"`
}

MigrationBatchResult holds the results of a migration batch, including all mappings and transaction info.

type MorseAccountInfo added in v0.1.13

type MorseAccountInfo struct {
	// Address is the Morse account address in hex format.
	Address cometcrypto.Address `json:"address"`

	// PrivateKey is the Morse account private key in ed25519 format.
	PrivateKey ed25519.PrivKey `json:"private_key"`
}

MorseAccountInfo holds Morse account data. - Address and private key are in hex format.

func (MorseAccountInfo) MarshalJSON added in v0.1.13

func (m MorseAccountInfo) MarshalJSON() ([]byte, error)

MarshalJSON customizes MorseAccountInfo JSON output. - Includes private key if unsafe/unarmored flags are set.

type MorseShannonMapping added in v0.1.13

type MorseShannonMapping struct {
	// MorseAccount contains Morse account info.
	MorseAccount MorseAccountInfo `json:"morse"`

	// ShannonAccount contains Shannon account info. Could be nil if Morse validation fails.
	ShannonAccount *ShannonAccountInfo `json:"shannon"`

	// MigrationMsg is the migration message for debugging purposes.
	MigrationMsg sdk.Msg `json:"migration_msg"`

	// Error contains an error message if something goes wrong. Always set for result clarity.
	Error string `json:"error"`
}

MorseShannonMapping maps a Morse account to its corresponding Shannon account and migration message.

type ShannonAccountInfo added in v0.1.13

type ShannonAccountInfo struct {
	// Address is the Shannon account address in bech32 format.
	Address cosmostypes.AccAddress `json:"address"`

	// PrivateKey is the Shannon account private key in secp256k1 format.
	PrivateKey secp256k1.PrivKey `json:"private_key"`

	// KeyringName is the name of the key in the keyring.
	KeyringName string `json:"keyring_name"`
}

ShannonAccountInfo holds Shannon account data. - Address and private key are in bech32 format.

func (ShannonAccountInfo) MarshalJSON added in v0.1.13

func (s ShannonAccountInfo) MarshalJSON() ([]byte, error)

MarshalJSON customizes ShannonAccountInfo JSON output. - Includes private key if unsafe/unarmored flags are set.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL