checkpoint: into main from release/1.8.2 @ 0e569c2610 (#15545)

Source hash: 0e569c2610
Remaining commits: 8
This commit is contained in:
William Allen 2023-06-16 16:04:32 -05:00 committed by GitHub
commit bb430d060b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 3 deletions

View File

@ -1527,7 +1527,20 @@ def _get_proofs_for_root(
default=None,
)
@click.option("-f", "--fingerprint", help="Set the fingerprint to specify which key to use", type=int)
@click.option("-p", "--parent-coin-id", help="The ID of the parent coin of the VC", type=str, required=True)
@click.option(
"-p",
"--parent-coin-id",
help="The ID of the parent coin of the VC (optional if VC ID is used)",
type=str,
required=False,
)
@click.option(
"-l",
"--vc-id",
help="The launcher ID of the VC to revoke (must be tracked by wallet) (optional if Parent ID is used)",
type=str,
required=False,
)
@click.option("-m", "--fee", help="Blockchain fee for revocation transaction, in XCH", type=str, required=False)
@click.option(
"--reuse-puzhash/--generate-new-puzhash",
@ -1538,7 +1551,8 @@ def _get_proofs_for_root(
def _revoke_vc(
wallet_rpc_port: Optional[int],
fingerprint: int,
parent_coin_id: str,
parent_coin_id: Optional[str],
vc_id: Optional[str],
fee: str,
reuse_puzhash: bool,
) -> None: # pragma: no cover
@ -1550,6 +1564,7 @@ def _revoke_vc(
extra_params = {
"parent_coin_id": parent_coin_id,
"vc_id": vc_id,
"fee": fee,
"reuse_puzhash": reuse_puzhash,
}

View File

@ -1319,8 +1319,19 @@ async def get_proofs_for_root(args: Dict, wallet_client: WalletRpcClient, finger
async def revoke_vc(args: Dict, wallet_client: WalletRpcClient, fingerprint: int) -> None: # pragma: no cover
config = load_config(DEFAULT_ROOT_PATH, "config.yaml", SERVICE_NAME)
if args["parent_coin_id"] is None:
if args["vc_id"] is None:
print("Must specify either --parent-coin-id or --vc-id")
return
record = await wallet_client.vc_get(bytes32.from_hexstr(args["vc_id"]))
if record is None:
print(f"Cannot find a VC with ID {args['vc_id']}")
return
parent_id: bytes32 = record.vc.coin.parent_coin_info
else:
parent_id = bytes32.from_hexstr(args["parent_coin_id"])
txs = await wallet_client.vc_revoke(
bytes32.from_hexstr(args["parent_coin_id"]),
parent_id,
fee=uint64(0) if args["fee"] is None else uint64(int(Decimal(args["fee"]) * units["chia"])),
reuse_puzhash=args["reuse_puzhash"],
)