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

Accept a CSV with account definitions as input and fill in vesting and vault addresses #122

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

noamnelke
Copy link
Member

CSV columns should be:

name, amount, key1, key2, key3, key4, key5, required_signatures

Then running:

./smcli genesis csv --file address_definitions.csv

will output updated_address_definitions.csv with two additional columns:

vesting_address, vault_address

@noamnelke noamnelke requested a review from lrettig August 6, 2024 14:04
if err != nil {
log.Fatalf("Error: required signatures %s for %s on line %d is invalid", requiredSignaturesStr, name, i)
}
requiredSignatures := uint8(requiredSignatures64)
Copy link
Member

Choose a reason for hiding this comment

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

Can we combine this with the strconv and just read the number directly into u8?

var processCSVCmd = &cobra.Command{
Use: "csv",
Short: "Process a CSV file with account definitions " +
"(name, amount, key1, key2, key3, key4, key5, required_signatures)",
Copy link
Member

Choose a reason for hiding this comment

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

IIRC we actually support up to ten keys, although in practice I don't think anyone is using that many. Maybe worth adding to the description something like "(for an account with up to five pubkeys)"?

}

// Write updated records to a new CSV file
outputFile, err := os.Create("updated_" + csvFilePath)
Copy link
Member

Choose a reason for hiding this comment

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

This is a little counterintuitive, I'm not sure the user will know where to find this file. I think printing to STDOUT would make more sense, then they can use shell redirect if they want to save to a new file.

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

Successfully merging this pull request may close these issues.

2 participants