fix splitting note in cli

This commit is contained in:
noiach 2019-08-06 15:20:45 +10:00
parent 7997fe2582
commit 11b3c98ea2
No known key found for this signature in database
GPG Key ID: 74E77D7E2221E976
1 changed files with 2 additions and 2 deletions

4
cli.js
View File

@ -44,7 +44,7 @@ async function getBalance(receiver) {
async function withdraw(note, receiver) {
let buf = Buffer.from(note.slice(2), 'hex')
let deposit = createDeposit(bigInt.leBuff2int(buf.slice(0, 32)), bigInt.leBuff2int(buf.slice(32, 64)))
let deposit = createDeposit(bigInt.leBuff2int(buf.slice(0, 31)), bigInt.leBuff2int(buf.slice(31, 62)))
console.log('Getting current state from mixer contract')
const events = await mixer.getPastEvents('Deposit', { fromBlock: mixer.deployedBlock, toBlock: 'latest' })
@ -174,7 +174,7 @@ if (inBrowser) {
printHelp(1)
break
case 'withdraw':
if (args.length === 3 && /^0x[0-9a-fA-F]{128}$/.test(args[1]) && /^0x[0-9a-fA-F]{40}$/.test(args[2])) {
if (args.length === 3 && /^0x[0-9a-fA-F]{124}$/.test(args[1]) && /^0x[0-9a-fA-F]{40}$/.test(args[2])) {
init().then(() => withdraw(args[1], args[2])).then(() => process.exit(0)).catch(err => {console.log(err); process.exit(1)})
}
else