Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return abi[0].inputs.map(({
name,
type
}, i) => {
let value;
const array = byteArray.filter((v, index) => index >= 32 * i && index < 32 * (i + 1));
if (type === 'address') {
value = TronWeb.address.fromHex('41' + TronWeb.utils.code.byteArray2hexStr(array.filter((v, i) => i > 11)));
} else if (type === 'trcToken') {
value = TronWeb.toDecimal('0x' + TronWeb.utils.code.byteArray2hexStr(array));
} else {
value = TronWeb.toDecimal('0x' + TronWeb.utils.code.byteArray2hexStr(array));
}
return {
name,
type,
value
};
});
} else {
return abi[0].inputs.map(({name,type},i)=>{
let value;
const array = byteArray.filter((v,index)=>index >=32 * i && index< 32 * (i + 1));
if(type === 'address') {
value = TronWeb.address.fromHex('41'+TronWeb.utils.code.byteArray2hexStr(array.filter((v,i) => i>11)));
} else if(type === 'trcToken') {
value = TronWeb.toDecimal('0x'+TronWeb.utils.code.byteArray2hexStr(array));
} else {
value = TronWeb.toDecimal('0x'+TronWeb.utils.code.byteArray2hexStr(array));
}
return {name,type,value};
});
}else{