Skip to content

Commit

Permalink
cmd/tapcli: add universe multiverse subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
guggero committed Oct 27, 2023
1 parent 54715fd commit 0983095
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions cmd/tapcli/universe.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var universeCommands = []cli.Command{
Usage: "Interact with a local or remote tap universe",
Category: "Universe",
Subcommands: []cli.Command{
multiverseRootCommand,
universeRootsCommand,
universeDeleteRootCommand,
universeLeavesCommand,
Expand All @@ -51,6 +52,48 @@ var universeCommands = []cli.Command{
},
}

var multiverseRootCommand = cli.Command{
Name: "multiverse",
ShortName: "m",
Description: "Show the multiverse root",
Usage: `
Calculate the multiverse root from the current known asset universes of
the given proof type.
`,
Flags: []cli.Flag{
cli.StringFlag{
Name: proofTypeName,
Usage: "the type of proof to show the root for, " +
"either 'issuance' or 'transfer'",
Value: universe.ProofTypeIssuance.String(),
},
},
Action: multiverseRoot,
}

func multiverseRoot(ctx *cli.Context) error {
ctxc := getContext()
client, cleanUp := getUniverseClient(ctx)
defer cleanUp()

rpcProofType, err := parseProofType(ctx)
if err != nil {
return err
}

multiverseRoot, err := client.MultiverseRoot(
ctxc, &unirpc.MultiverseRootRequest{
ProofType: *rpcProofType,
},
)
if err != nil {
return err
}

printRespJSON(multiverseRoot)
return nil
}

var universeRootsCommand = cli.Command{
Name: "roots",
ShortName: "r",
Expand Down

0 comments on commit 0983095

Please sign in to comment.