From ebb2f21c68d4c4a5889c46937685984452ab19f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matev=C5=BE=20Jekovec?= Date: Fri, 6 Sep 2024 15:06:50 +0200 Subject: [PATCH] cmd: Add --scheme to rofl create --- cmd/rofl/mgmt.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/rofl/mgmt.go b/cmd/rofl/mgmt.go index 74fb1df4..cd66ecbb 100644 --- a/cmd/rofl/mgmt.go +++ b/cmd/rofl/mgmt.go @@ -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{ @@ -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) @@ -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)