ANocturnalGuy / proxy-api

Initialization in variable declarations against recommended approach JS-0119
Anti-pattern
Minor
8 occurrences in this check
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 = {
Variable 'url' should be initialized on declaration
 1const Web3 = require('web3')
 2const { oracleRpcUrl, httpRpcUrl, wsRpcUrl } = require('./config')
 3const getWeb3 = (type = 'http') => {
 4  let url 5  switch (type) {
 6    case 'oracle':
 7      url = oracleRpcUrl
Variable 'interval' should be initialized on declaration
  9const BigNumber = require('bignumber.js')
 10const web3 = getWeb3()
 11
 12let interval; 13const max_attempts = 20;
 14let attempts = 0;
 15
Variable 'data' should be initialized on declaration
124
125async function withdraw(req, res) {
126
127    let data128
129    try {
130        data = await Model.find({