Skip to content

Commit 8e61343

Browse files
committed
fix(cli): executeswap don't set undefined quantity
The `coinsToSats` method expects a number, but when a quantity is not defined as a command argument then it gets passed `undefined` and returns `NaN`. Instead, we should not call this method when `quantity` is not defined and leave it as its default value on the gRPC call. Fixes #1175.
1 parent 328d35f commit 8e61343

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/cli/commands/executeswap.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export const handler = (argv: Arguments) => {
3636
const request = new ExecuteSwapRequest();
3737
request.setOrderId(argv.order_id);
3838
request.setPairId(argv.pair_id);
39-
request.setQuantity(coinsToSats(argv.quantity));
39+
if (argv.quantity) {
40+
request.setQuantity(coinsToSats(argv.quantity));
41+
}
4042
loadXudClient(argv).executeSwap(request, callback(argv, displaySwapSuccess));
4143
};

0 commit comments

Comments
 (0)