mirror of
https://github.com/tornadocash/tornado-core.git
synced 2024-12-27 15:19:22 -05:00
fix cli
This commit is contained in:
parent
f04ff2b6fd
commit
2d9677831a
14
cli.js
14
cli.js
@ -388,10 +388,6 @@ async function init({ rpc, noteNetId, currency = 'dai', amount = '100' }) {
|
|||||||
PRIVATE_KEY = process.env.PRIVATE_KEY
|
PRIVATE_KEY = process.env.PRIVATE_KEY
|
||||||
erc20ContractJson = require('./build/contracts/ERC20Mock.json')
|
erc20ContractJson = require('./build/contracts/ERC20Mock.json')
|
||||||
erc20tornadoJson = require('./build/contracts/ERC20Tornado.json')
|
erc20tornadoJson = require('./build/contracts/ERC20Tornado.json')
|
||||||
const account = web3.eth.accounts.privateKeyToAccount('0x' + PRIVATE_KEY)
|
|
||||||
web3.eth.accounts.wallet.add('0x' + PRIVATE_KEY)
|
|
||||||
web3.eth.defaultAccount = account.address
|
|
||||||
senderAccount = account.address
|
|
||||||
}
|
}
|
||||||
// groth16 initialises a lot of Promises that will never be resolved, that's why we need to use process.exit to terminate the CLI
|
// groth16 initialises a lot of Promises that will never be resolved, that's why we need to use process.exit to terminate the CLI
|
||||||
groth16 = await buildGroth16()
|
groth16 = await buildGroth16()
|
||||||
@ -406,6 +402,16 @@ async function init({ rpc, noteNetId, currency = 'dai', amount = '100' }) {
|
|||||||
tokenAddress = currency !== 'eth' ? erc20ContractJson.networks[netId].address : null
|
tokenAddress = currency !== 'eth' ? erc20ContractJson.networks[netId].address : null
|
||||||
senderAccount = (await web3.eth.getAccounts())[0]
|
senderAccount = (await web3.eth.getAccounts())[0]
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
|
const account = web3.eth.accounts.privateKeyToAccount('0x' + PRIVATE_KEY)
|
||||||
|
web3.eth.accounts.wallet.add('0x' + PRIVATE_KEY)
|
||||||
|
// eslint-disable-next-line require-atomic-updates
|
||||||
|
web3.eth.defaultAccount = account.address
|
||||||
|
senderAccount = account.address
|
||||||
|
} catch(e) {
|
||||||
|
console.error('Please provide PRIVATE_KEY in .env file')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
tornadoAddress = config.deployments[`netId${netId}`][currency].instanceAddress[amount]
|
tornadoAddress = config.deployments[`netId${netId}`][currency].instanceAddress[amount]
|
||||||
if (!tornadoAddress) {
|
if (!tornadoAddress) {
|
||||||
|
Loading…
Reference in New Issue
Block a user