How to use the tronweb.toDecimal function in tronweb

To help you get started, we’ve selected a few tronweb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tronscan / tronscan-frontend / src / utils / contractUtils.js View on Github external
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 {
github TronLink / tronlink-extension / packages / lib / utils.js View on Github external
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{

tronweb

JavaScript SDK that encapsulates the TRON HTTP API

MIT
Latest version published 3 months ago

Package Health Score

80 / 100
Full package analysis