Skip to content

Commit

Permalink
cmd: Add --scheme to rofl create
Browse files Browse the repository at this point in the history
  • Loading branch information
matevz committed Sep 6, 2024
1 parent eacb0ef commit 16e7a6a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/rofl/mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import (
)

var (
creatorSchemes = 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 +54,15 @@ var (
cobra.CheckErr(err)
}

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

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

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

createCmd.Flags().AddFlagSet(common.SelectorFlags)
createCmd.Flags().AddFlagSet(common.RuntimeTxFlags)
createCmd.Flags().StringVar(&scheme, "scheme", "cn", "app ID generator 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 16e7a6a

Please sign in to comment.