Add --override flage to make_offer (#17220)

This commit is contained in:
Matt Hauff 2024-01-05 12:22:06 -08:00 committed by GitHub
parent 92499b64a2
commit 1a33cfdecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -441,7 +441,6 @@ def add_token_cmd(wallet_rpc_port: Optional[int], asset_id: str, token_name: str
"-r",
"--request",
help="A wallet id of an asset to receive and the amount you wish to receive (formatted like wallet_id:amount)",
required=True,
multiple=True,
)
@click.option("-p", "--filepath", help="The path to write the generated offer file to", required=True)
@ -454,6 +453,7 @@ def add_token_cmd(wallet_rpc_port: Optional[int], asset_id: str, token_name: str
is_flag=True,
default=False,
)
@click.option("-o", "--override", help="Creates offer without checking for unusual values", is_flag=True, default=False)
def make_offer_cmd(
wallet_rpc_port: Optional[int],
fingerprint: int,
@ -462,9 +462,14 @@ def make_offer_cmd(
filepath: str,
fee: str,
reuse: bool,
override: bool,
) -> None:
from .wallet_funcs import make_offer
if len(request) == 0 and not override:
print("Cannot make an offer without requesting something without --override")
return
asyncio.run(
make_offer(
wallet_rpc_port=wallet_rpc_port,

View File

@ -696,6 +696,7 @@ def test_make_offer(capsys: object, get_test_cli_clients: Tuple[TestRpcClients,
"Including Fees: 1 XCH, 1000000000000 mojos",
"Created offer with ID 0202020202020202020202020202020202020202020202020202020202020202",
]
run_cli_command_and_assert(capsys, root_dir, command_args[:-4], ["without --override"])
run_cli_command_and_assert(capsys, root_dir, command_args, assert_list)
expected_calls: logType = {
"cat_asset_id_to_name": [(request_cat_id,)],