@@ -16,6 +16,7 @@ import (
16
16
"github.com/cosmos/cosmos-sdk/server"
17
17
sdk "github.com/cosmos/cosmos-sdk/types"
18
18
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
19
+ "github.com/spf13/cast"
19
20
"github.com/spf13/cobra"
20
21
"github.com/spf13/viper"
21
22
dclauthtypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/dclauth/types"
@@ -27,6 +28,7 @@ const (
27
28
FlagAddress = "address"
28
29
FlagPubKey = "pubkey"
29
30
FlagRoles = "roles"
31
+ FlagVID = "vid"
30
32
)
31
33
32
34
// AddGenesisAccountCmd returns add-genesis-account cobra Command.
@@ -95,8 +97,17 @@ the address will be looked up in the local Keybase.
95
97
// and uses pack/unpack API to extract accounts from genesis state
96
98
97
99
ba := authtypes .NewBaseAccount (addr , pk , 0 , 0 )
100
+
101
+ var vendorID uint64 = 0
102
+ if viper .GetString (FlagVID ) != "" {
103
+ vendorID , err = cast .ToUint64E (viper .GetString (FlagVID ))
104
+ if err != nil {
105
+ return err
106
+ }
107
+ }
108
+
98
109
// FIXME issue 99 VendorID
99
- genAccount = dclauthtypes .NewAccount (ba , roles , 0 )
110
+ genAccount = dclauthtypes .NewAccount (ba , roles , vendorID )
100
111
101
112
if err := genAccount .Validate (); err != nil {
102
113
return fmt .Errorf ("failed to validate new genesis account: %w" , err )
@@ -138,6 +149,7 @@ the address will be looked up in the local Keybase.
138
149
cmd .Flags ().String (FlagPubKey , "" , "The validator's Protobuf JSON encoded public key" )
139
150
cmd .Flags ().String (FlagRoles , "" ,
140
151
fmt .Sprintf ("The list of roles (split by comma) to assign to account (supported roles: %v)" , dclauthtypes .Roles ))
152
+ cmd .Flags ().String (FlagVID , "" , "Vendor ID associated with this account. Required only for Vendor Roles" )
141
153
142
154
cmd .Flags ().String (flags .FlagHome , defaultNodeHome , "The application home directory" )
143
155
cmd .Flags ().String (flags .FlagKeyringBackend , flags .DefaultKeyringBackend , "Select keyring's backend (os|file|kwallet|pass|test)" )
0 commit comments