From 836e041657e04ccc470c18b0f75681de29298965 Mon Sep 17 00:00:00 2001 From: Jonathan Harvey-Buschel Date: Wed, 31 May 2023 18:51:48 -0400 Subject: [PATCH] tapcli: add universe deletion support --- cmd/tapcli/universe.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/cmd/tapcli/universe.go b/cmd/tapcli/universe.go index 3a5349b94..184d69835 100644 --- a/cmd/tapcli/universe.go +++ b/cmd/tapcli/universe.go @@ -36,6 +36,7 @@ var universeCommands = []cli.Command{ Category: "Universe", Subcommands: []cli.Command{ universeRootsCommand, + universeDeleteRootCommand, universeLeavesCommand, universeKeysCommand, universeProofCommand, @@ -143,6 +144,46 @@ func universeRoots(ctx *cli.Context) error { return nil } +var universeDeleteRootCommand = cli.Command{ + Name: "delete", + ShortName: "d", + Description: "Delete a known asset universe root", + Usage: "list the known asset universe root", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: assetIDName, + Usage: "the asset ID of the universe to delete", + }, + cli.StringFlag{ + Name: groupKeyName, + Usage: "the group key of the universe to delete", + }, + }, + Action: deleteUniverseRoot, +} + +func deleteUniverseRoot(ctx *cli.Context) error { + ctxc := getContext() + client, cleanUp := getUniverseClient(ctx) + defer cleanUp() + + universeID, err := parseUniverseID(ctx, true) + if err != nil { + return err + } + + rootReq := &universerpc.AssetRootQuery{ + Id: universeID, + } + + _, err = client.DeleteAssetRoot(ctxc, rootReq) + if err != nil { + return err + } + + return nil +} + var universeKeysCommand = cli.Command{ Name: "keys", ShortName: "k",