Skip to content

Commit 7b2c426

Browse files
committed
refactor(go): use chainbridge command constants
1 parent 6de47ad commit 7b2c426

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

clients/go/cmd/client/main.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func nodeRegistration() {
7171

7272
// register the node
7373
command := fmt.Sprintf(
74-
"nodes register %s %d %d",
74+
chainbridge.Cmd_nodes_register,
7575
node1.Identifier,
7676
chainbridge.Bool2int(node1.IsGatewayNode),
7777
chainbridge.Bool2int(node1.IsServiceNode))
@@ -85,7 +85,7 @@ func nodeRegistration() {
8585
}
8686

8787
// retrieve the node
88-
command = fmt.Sprintf("nodes getNode %s", node1.Identifier)
88+
command = fmt.Sprintf(chainbridge.Cmd_nodes_getNode, node1.Identifier)
8989
response, err = chBridge.Command(command, nil)
9090
if err != nil {
9191
log.Printf("ChainBridge command error: %v", err)
@@ -125,7 +125,7 @@ func pkiMixDescriptor() {
125125
id := "node-5000"
126126

127127
// send encoded data as payload to IPFS and the appchain
128-
command := fmt.Sprintf("pki setMixDescriptor %d %s", epoch, id)
128+
command := fmt.Sprintf(chainbridge.Cmd_pki_setMixDescriptor, epoch, id)
129129
response, err := chBridge.Command(command, enc)
130130
log.Printf("Response (%s): %+v\n", command, response)
131131
if err != nil {
@@ -136,7 +136,7 @@ func pkiMixDescriptor() {
136136
}
137137

138138
// retrieve the stored data
139-
command = fmt.Sprintf("pki getMixDescriptor %d %s", epoch, id)
139+
command = fmt.Sprintf(chainbridge.Cmd_pki_getMixDescriptor, epoch, id)
140140
response, err = chBridge.Command(command, nil)
141141
if err != nil {
142142
log.Printf("ChainBridge command error: %v", err)
@@ -158,8 +158,7 @@ func pkiMixDescriptor() {
158158
}
159159

160160
func getGenesisEpoch() uint64 {
161-
command := "pki getGenesisEpoch"
162-
response, err := chBridge.Command(command, nil)
161+
response, err := chBridge.Command(chainbridge.Cmd_pki_getGenesisEpoch, nil)
163162
if err != nil {
164163
log.Printf("ChainBridge command error: %v", err)
165164
}

0 commit comments

Comments
 (0)