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

Implement a command for adding genesis accounts #2945

Closed
fadeev opened this issue Oct 19, 2022 · 3 comments · Fixed by #2955
Closed

Implement a command for adding genesis accounts #2945

fadeev opened this issue Oct 19, 2022 · 3 comments · Fixed by #2955
Assignees

Comments

@fadeev
Copy link
Contributor

fadeev commented Oct 19, 2022

ignite network chain account add [launch-id] [address] [coins]

Send a request to add an account with a token balance to the genesis file of the chain.

func (n Network) sendAccountRequest(
ctx context.Context,
launchID uint64,
address string,
amount sdk.Coins,
) error {
addr, err := n.account.Address(networktypes.SPN)
if err != nil {
return err
}
msg := launchtypes.NewMsgSendRequest(
addr,
launchID,
launchtypes.NewGenesisAccount(
launchID,
address,
amount,
),
)
n.ev.Send("Broadcasting account transactions", events.ProgressStarted())
res, err := n.cosmos.BroadcastTx(ctx, n.account, msg)
if err != nil {
return err
}
var requestRes launchtypes.MsgSendRequestResponse
if err := res.Decode(&requestRes); err != nil {
return err
}
if requestRes.AutoApproved {
n.ev.Send("Account added to the network by the coordinator!", events.ProgressFinished())
} else {
n.ev.Send(
fmt.Sprintf("Request %d to add account to the network has been submitted!", requestRes.RequestID),
events.ProgressFinished(),
)
}
return nil
}

@lumtis lumtis self-assigned this Oct 19, 2022
@lumtis
Copy link
Contributor

lumtis commented Oct 19, 2022

I would go with the command

ignite network request add-account

The name space ignite n chain contains commands that are more for a high-level workflow of the chain launch, the high level join that automatize requesting for a validator for example

While the namespace request is for actions specific to requests, approving, listing, etc...
So I think we should implement here, the lower level command to send a specific request as a unit

add-account
add-validator
remove-account
change-param

Also transform [coin] into a flow --balance as the chain could have the option of a fixed AccountBalance, therefore making the command fails if --balance is not provided and AccountBalance is not set

@fadeev
Copy link
Contributor Author

fadeev commented Oct 19, 2022

Agree with ignite network request add-account.

Not sure I understand --balance, though. What is a "fixed account balance"?

@lumtis
Copy link
Contributor

lumtis commented Oct 19, 2022

Not sure I understand --balance, though. What is a "fixed account balance"?

When the coordinator set the account balance for all account requesters. But instead of a flag we can actually just set that the coin argument is not expected if AccountBalance set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants