ANocturnalGuy / proxy-api

Initialization in variable declarations against recommended approach JS-0119
Anti-pattern
Minor
a year agoa year old
Variable 'rawTx' should be initialized on declaration
 61            console.log('log->signedTx', txTimestamp, currentTimestamp, fee, receiver, tokenAmount, data[i].tokenAd)
 62
 63            if(txTimestamp <= currentTimestamp) {
 64                let contract, calldata, ethBal, rawTx 65                const nonce = await web3.eth.getTransactionCount(account.address)                
 66                if(data[i].tokenAd === '0x0000000000000000000000000000000000000000'){
 67                    rawTx = {
Variable 'calldata' should be initialized on declaration
 61            console.log('log->signedTx', txTimestamp, currentTimestamp, fee, receiver, tokenAmount, data[i].tokenAd)
 62
 63            if(txTimestamp <= currentTimestamp) {
 64                let contract, calldata, ethBal, rawTx 65                const nonce = await web3.eth.getTransactionCount(account.address)                
 66                if(data[i].tokenAd === '0x0000000000000000000000000000000000000000'){
 67                    rawTx = {
Variable 'data' should be initialized on declaration
 28
 29async function withdraw() {
 30
 31    let data 32
 33    try {
 34        data = await Model.find({
Variable 'contract' should be initialized on declaration
 61            console.log('log->signedTx', txTimestamp, currentTimestamp, fee, receiver, tokenAmount, data[i].tokenAd)
 62
 63            if(txTimestamp <= currentTimestamp) {
 64                let contract, calldata, ethBal, rawTx 65                const nonce = await web3.eth.getTransactionCount(account.address)                
 66                if(data[i].tokenAd === '0x0000000000000000000000000000000000000000'){
 67                    rawTx = {
Variable 'ethBal' should be initialized on declaration
 61            console.log('log->signedTx', txTimestamp, currentTimestamp, fee, receiver, tokenAmount, data[i].tokenAd)
 62
 63            if(txTimestamp <= currentTimestamp) {
 64                let contract, calldata, ethBal, rawTx 65                const nonce = await web3.eth.getTransactionCount(account.address)                
 66                if(data[i].tokenAd === '0x0000000000000000000000000000000000000000'){
 67                    rawTx = {