Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(x/accounts): lockup account document, Tx and InitGenesis #23397

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion simapp/v2/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ var (
// NOTE: The genutils module must also occur after auth so that it can access the params from auth.
InitGenesis: []string{
consensustypes.ModuleName,
accounts.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
distrtypes.ModuleName,
stakingtypes.ModuleName,
accounts.ModuleName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this moved?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When creating a lockup account in genesis, the accounts must be placed below the bank and staking because parameters above this are referenced.

slashingtypes.ModuleName,
govtypes.ModuleName,
minttypes.ModuleName,
Expand Down
8 changes: 4 additions & 4 deletions x/accounts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,12 +545,12 @@ For example, given the following `genesis.json` file:
"init_account_msgs": [
{
"sender": "account_creator_address",
"account_type": "lockup",
"account_type": "lockup_account_type",
"message": {
"@type": "cosmos.accounts.defaults.lockup.MsgInitLockupAccount",
"@type": "/cosmos.accounts.defaults.lockup.v1.MsgInitLockupAccount",
"owner": "some_owner",
"end_time": "..",
"start_time": ".."
"end_time": "2026-01-01T00:00:00Z",
"start_time": "2025-01-01T00:00:00Z"
},
"funds": [
{
Expand Down
10 changes: 8 additions & 2 deletions x/accounts/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)

func TxCmd(name string) *cobra.Command {
Expand All @@ -41,9 +42,9 @@ func QueryCmd(name string) *cobra.Command {

func GetTxInitCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "init <account-type> <json-message>",
Use: "init <account-type> <json-message> <fund>[,<fund>...]",
Short: "Initialize a new account",
Args: cobra.ExactArgs(2),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand All @@ -69,10 +70,15 @@ func GetTxInitCmd() *cobra.Command {
if err != nil {
return err
}
funds, err := sdk.ParseCoinsNormalized(args[2])
if err != nil {
return err
}
msg := v1.MsgInit{
Sender: sender,
AccountType: args[0],
Message: msgBytes,
Funds: funds,
}

isGenesis, err := cmd.Flags().GetBool("genesis")
Expand Down
14 changes: 7 additions & 7 deletions x/accounts/defaults/lockup/TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Whereas `execute-msg-type-url` and `msgcontents` corresponds to lockup account

### Delegate

The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgDelegate`.
The execute message type url for this execution is `cosmos.accounts.defaults.lockup.v1.MsgDelegate`.

Example of json file:

Expand All @@ -125,7 +125,7 @@ The `sender` field are the address of the owner of the lockup account. If the se

### Undelegate

The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgUndelegate`.
The execute message type url for this execution is `cosmos.accounts.defaults.lockup.v1.MsgUndelegate`.

Example of json file:

Expand All @@ -146,7 +146,7 @@ The `sender` field are the address of the owner of the lockup account. If the se

### Withdraw reward

The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgWithdrawReward`.
The execute message type url for this execution is `cosmos.accounts.defaults.lockup.v1.MsgWithdrawReward`.

Example of json file:

Expand All @@ -163,7 +163,7 @@ The `sender` field are the address of the owner of the lockup account. If the se

### Withdraw unlocked token

The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgWithdraw`.
The execute message type url for this execution is `cosmos.accounts.defaults.lockup.v1.MsgWithdraw`.

Example of json file:

Expand All @@ -183,7 +183,7 @@ The `withdrawer` field are the address of the owner of the lockup account. If th

### Send coins

The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgSend`.
The execute message type url for this execution is `cosmos.accounts.defaults.lockup.v1.MsgSend`.

Example of json file:

Expand Down Expand Up @@ -213,7 +213,7 @@ simd tx accounts query <account_address> <query-request-type-url> $querycontents

### Query account info

The query request type url for this query is `cosmos.accounts.defaults.lockup.QueryLockupAccountInfoRequest`. And query json file can be an empty object since `QueryLockupAccountInfoRequest` does not required an input.
The query request type url for this query is `cosmos.accounts.defaults.lockup.v1.QueryLockupAccountInfoRequest`. And query json file can be an empty object since `QueryLockupAccountInfoRequest` does not required an input.

Account information including:

Expand All @@ -235,7 +235,7 @@ Account information including:
Note, can only be queried from a periodic lockup account
:::

The query request type url for this query is `cosmos.accounts.defaults.lockup.QueryLockingPeriodsRequest`. And query json file can be an empty object since `QueryLockingPeriodsRequest` does not required an input.
The query request type url for this query is `cosmos.accounts.defaults.lockup.v1.QueryLockingPeriodsRequest`. And query json file can be an empty object since `QueryLockingPeriodsRequest` does not required an input.

Locking periods including:

Expand Down
Loading