From 2e20c1fbb65c11e5aded6310a61ed678c8d75d69 Mon Sep 17 00:00:00 2001 From: Theo Date: Mon, 15 May 2023 14:35:17 +0300 Subject: [PATCH] Use default RPC while withdraw, if no RPC is provided --- cli.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cli.js b/cli.js index 17005e1..abe6e27 100755 --- a/cli.js +++ b/cli.js @@ -1372,6 +1372,8 @@ async function init({ rpc, noteNetId, currency = 'dai', amount = '100', balanceC let contractJson, instanceJson, erc20ContractJson, erc20tornadoJson, tornadoAddress, tokenAddress; let ipOptions = {}; + if (noteNetId && !rpc) rpc = config.deployments[`netId${noteNetId}`].defaultRpc; + if (torPort && rpc.includes('https')) { console.log('Using tor network'); web3Options = { agent: { https: new SocksProxyAgent('socks5h://127.0.0.1:' + torPort) }, timeout: 60000 }; @@ -1500,7 +1502,7 @@ async function init({ rpc, noteNetId, currency = 'dai', amount = '100', balanceC async function main() { program - .option('-r, --rpc ', 'The RPC that CLI should interact with', 'http://localhost:8545') + .option('-r, --rpc ', 'The RPC that CLI should interact with') .option('-R, --relayer ', 'Withdraw via relayer') .option('-T, --tor ', 'Optional tor port') .option('-p, --private-key ', "Wallet private key - If you didn't add it to .env file and it is needed for operation")