Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/tapcli: add universe multiverse subcommand
Browse files Browse the repository at this point in the history
guggero authored and Roasbeef committed Nov 13, 2023
1 parent c4ddb95 commit ec46e11
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
@@ -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,
@@ -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",

0 comments on commit ec46e11

Please sign in to comment.