Skip to content

Commit

Permalink
Merge pull request #281 from oasisprotocol/matevz/feature/rofl-create…
Browse files Browse the repository at this point in the history
…-scheme

feat(rofl/create): Add --scheme
  • Loading branch information
matevz authored Sep 11, 2024
2 parents 246a950 + ebb2f21 commit 5fbe791
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/rofl/mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ import (
)

var (
identifierSchemes = map[string]rofl.IdentifierScheme{
"cri": rofl.CreatorRoundIndex,
"cn": rofl.CreatorNonce,
}

policyFn string
scheme string
adminAddress string

createCmd = &cobra.Command{
Expand Down Expand Up @@ -51,9 +57,15 @@ var (
cobra.CheckErr(err)
}

idScheme, ok := identifierSchemes[scheme]
if !ok {
cobra.CheckErr(fmt.Errorf("unknown scheme %s", scheme))
}

// Prepare transaction.
tx := rofl.NewCreateTx(nil, &rofl.Create{
Policy: *policy,
Scheme: idScheme,
})

acc := common.LoadAccount(cfg, npa.AccountName)
Expand Down Expand Up @@ -247,6 +259,7 @@ func init() {

createCmd.Flags().AddFlagSet(common.SelectorFlags)
createCmd.Flags().AddFlagSet(common.RuntimeTxFlags)
createCmd.Flags().StringVar(&scheme, "scheme", "cn", "app ID generation scheme: creator+round+index [cri] or creator+nonce [cn]")

updateCmd.Flags().AddFlagSet(common.SelectorFlags)
updateCmd.Flags().AddFlagSet(common.RuntimeTxFlags)
Expand Down

0 comments on commit 5fbe791

Please sign in to comment.