Documentation ¶
Overview ¶
Package genaccounts contains specialized functionality for initializing accounts from genesis including:
- genesis account validation,
- initchain processing of genesis accounts,
- export processing (to genesis) of accounts,
- server command for adding accounts to the genesis file.
Index ¶
- Constants
- func InitGenesis(ctx sdk.Context, _ *codec.Codec, accountKeeper AccountKeeper, ...)
- func NewAppModule(accountKeeper AccountKeeper) module.AppModule
- func SetGenesisStateInAppState(cdc *codec.Codec, appState map[string]json.RawMessage, ...) map[string]json.RawMessage
- func ValidateGenesis(genesisState GenesisState) error
- type AccountKeeper
- type AppModule
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis() json.RawMessage
- func (AppModuleBasic) GetQueryCmd(_ *codec.Codec) *cobra.Command
- func (AppModuleBasic) GetTxCmd(_ *codec.Codec) *cobra.Command
- func (AppModuleBasic) IterateGenesisAccounts(cdc *codec.Codec, appGenesis map[string]json.RawMessage, ...)
- func (AppModuleBasic) Name() string
- func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
- func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router, kafkaBool bool, ...)
- func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
- type GenesisAccount
- type GenesisAccounts
- type GenesisState
Constants ¶
const ModuleName = "accounts"
module name
Variables ¶
This section is empty.
Functions ¶
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, _ *codec.Codec, accountKeeper AccountKeeper, genesisState GenesisState)
initialize accounts and deliver genesis transactions
func NewAppModule ¶
func NewAppModule(accountKeeper AccountKeeper) module.AppModule
NewAppModule creates a new AppModule object
func SetGenesisStateInAppState ¶
func SetGenesisStateInAppState(cdc *codec.Codec, appState map[string]json.RawMessage, genesisState GenesisState) map[string]json.RawMessage
set the genesis state within the expected app state
func ValidateGenesis ¶
func ValidateGenesis(genesisState GenesisState) error
ValidateGenesis performs validation of genesis accounts. It ensures that there are no duplicate accounts in the genesis state and any provided vesting accounts are valid.
Types ¶
type AccountKeeper ¶
type AccountKeeper interface { NewAccount(sdk.Context, auth.Account) auth.Account SetAccount(sdk.Context, auth.Account) IterateAccounts(ctx sdk.Context, process func(auth.Account) (stop bool)) }
expected account keeper
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
___________________________ app module
func (AppModule) ExportGenesis ¶
func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
module export genesis
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
module init-genesis
type AppModuleBasic ¶
type AppModuleBasic struct{}
app module basics object
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
default genesis state
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd(_ *codec.Codec) *cobra.Command
get the root query command of this module
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd(_ *codec.Codec) *cobra.Command
get the root tx command of this module
func (AppModuleBasic) IterateGenesisAccounts ¶
func (AppModuleBasic) IterateGenesisAccounts(cdc *codec.Codec, appGenesis map[string]json.RawMessage, iterateFn func(auth.Account) (stop bool))
extra function from sdk.AppModuleBasic iterate the genesis accounts and perform an operation at each of them - to used by other modules
func (AppModuleBasic) RegisterCodec ¶
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
register module codec
func (AppModuleBasic) RegisterRESTRoutes ¶
func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router, kafkaBool bool, kafkaState kafka.KafkaState)
register rest routes
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
module validate genesis
type GenesisAccount ¶
type GenesisAccount struct { Address sdk.AccAddress `json:"address" yaml:"address"` Coins sdk.Coins `json:"coins" yaml:"coins"` Sequence uint64 `json:"sequence_number" yaml:"sequence_number"` AccountNumber uint64 `json:"account_number" yaml:"account_number"` // vesting account fields OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"` // total vesting coins upon initialization DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"` // delegated vested coins at time of delegation DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"` // delegated vesting coins at time of delegation StartTime int64 `json:"start_time" yaml:"start_time"` // vesting start time (UNIX Epoch time) EndTime int64 `json:"end_time" yaml:"end_time"` // vesting end time (UNIX Epoch time) // module account fields ModuleName string `json:"module_name" yaml:"module_name"` // name of the module account ModulePermissions []string `json:"module_permissions" yaml:"module_permissions"` // permissions of module account }
GenesisAccount is a struct for account initialization used exclusively during genesis
func NewGenesisAccount ¶
func NewGenesisAccount(acc *auth.BaseAccount) GenesisAccount
NewGenesisAccount creates a GenesisAccount instance from a BaseAccount.
func NewGenesisAccountI ¶
func NewGenesisAccountI(acc authexported.Account) (GenesisAccount, error)
NewGenesisAccountI creates a GenesisAccount instance from an Account interface.
func NewGenesisAccountRaw ¶
func NewGenesisAccountRaw(address sdk.AccAddress, coins, vestingAmount sdk.Coins, vestingStartTime, vestingEndTime int64, module string, permissions ...string) GenesisAccount
NewGenesisAccountRaw creates a new GenesisAccount object
func (*GenesisAccount) ToAccount ¶
func (ga *GenesisAccount) ToAccount() auth.Account
ToAccount converts a GenesisAccount to an Account interface
func (GenesisAccount) Validate ¶
func (ga GenesisAccount) Validate() error
Validate checks for errors on the vesting and module account parameters
type GenesisAccounts ¶
type GenesisAccounts []GenesisAccount
___________________________________
func (GenesisAccounts) Contains ¶
func (gaccs GenesisAccounts) Contains(acc sdk.AccAddress) bool
genesis accounts contain an address
type GenesisState ¶
type GenesisState GenesisAccounts
State to Unmarshal
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, accountKeeper AccountKeeper) GenesisState
export genesis for all accounts
func GetGenesisStateFromAppState ¶
func GetGenesisStateFromAppState(cdc *codec.Codec, appState map[string]json.RawMessage) GenesisState
get the genesis state from the expected app state
func (GenesisState) Sanitize ¶
func (gs GenesisState) Sanitize()
Sanitize sorts accounts and coin sets.