From 0c35e5e463dbaa87a8441e5b0644045bdfc4daa5 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 13 Mar 2024 23:37:45 -0600 Subject: [PATCH] ref+fix: simpler bool check, including 'undefined' --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index f94cf17..b364fee 100644 --- a/lib/index.js +++ b/lib/index.js @@ -235,7 +235,7 @@ RpcClient.callspec = { getPoolInfo: '', getRawMemPool: 'bool', getRawChangeAddress: '', - getRawTransaction: 'str int', + getRawTransaction: 'str bool', getReceivedByAccount: 'str int', getReceivedByAddress: 'str int', getSpentInfo: 'obj', @@ -377,7 +377,7 @@ function generateRPCMethods(constructor, apiCalls, rpc) { return parseFloat(arg); }, bool(arg) { - return (arg === true || arg == '1' || arg == 'true' || arg.toString().toLowerCase() == 'true'); + return (String(arg).toLowerCase() === 'true' || arg > 0); }, obj(arg) { if (typeof arg === 'string') {