Skip to content

Commit aab22c2

Browse files
committed
cmd/tapcli: add universe multiverse subcommand
1 parent 7da2bf5 commit aab22c2

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

cmd/tapcli/universe.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ var universeCommands = []cli.Command{
3838
Usage: "Interact with a local or remote tap universe",
3939
Category: "Universe",
4040
Subcommands: []cli.Command{
41+
multiverseRootCommand,
4142
universeRootsCommand,
4243
universeDeleteRootCommand,
4344
universeLeavesCommand,
@@ -51,6 +52,48 @@ var universeCommands = []cli.Command{
5152
},
5253
}
5354

55+
var multiverseRootCommand = cli.Command{
56+
Name: "multiverse",
57+
ShortName: "m",
58+
Description: "Show the multiverse root",
59+
Usage: `
60+
Calculate the multiverse root from the current known asset universes of
61+
the given proof type.
62+
`,
63+
Flags: []cli.Flag{
64+
cli.StringFlag{
65+
Name: proofTypeName,
66+
Usage: "the type of proof to show the root for, " +
67+
"either 'issuance' or 'transfer'",
68+
Value: universe.ProofTypeIssuance.String(),
69+
},
70+
},
71+
Action: multiverseRoot,
72+
}
73+
74+
func multiverseRoot(ctx *cli.Context) error {
75+
ctxc := getContext()
76+
client, cleanUp := getUniverseClient(ctx)
77+
defer cleanUp()
78+
79+
rpcProofType, err := parseProofType(ctx)
80+
if err != nil {
81+
return err
82+
}
83+
84+
multiverseRoot, err := client.MultiverseRoot(
85+
ctxc, &unirpc.MultiverseRootRequest{
86+
ProofType: *rpcProofType,
87+
},
88+
)
89+
if err != nil {
90+
return err
91+
}
92+
93+
printRespJSON(multiverseRoot)
94+
return nil
95+
}
96+
5497
var universeRootsCommand = cli.Command{
5598
Name: "roots",
5699
ShortName: "r",

0 commit comments

Comments
 (0)