{"size": 816, "ext": "js", "max_stars_repo_path": "hdevframe/web3Lib/TxGenerator.js", "max_stars_repo_name": "haolifeng/compound-play", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "hdevframe/web3Lib/TxGenerator.js", "max_issues_repo_name": "haolifeng/compound-play", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "hdevframe/web3Lib/TxGenerator.js", "max_forks_repo_name": "haolifeng/compound-play", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.1379310345, "max_line_length": 77, "alphanum_fraction": 0.5796568627}
let Web3 = require('web3');
let web3 = new Web3();
class TxGenerator{
    constructor(){}

    getRawTx(chainId, nonce, from, to, value, data, gas, gasPrice, gasLimit){
        let gasHex = web3.utils.toHex(gas);
        let gasPriceHex = web3.utils.toHex(gasPrice);
        let gasLimitHex = web3.utils.toHex(gasLimit);
        let nonceHex = web3.utils.toHex(nonce);
        let valueHex = web3.utils.toHex(value);
        let chainIdHex = web3.utils.toHex(chainId);
        return {
            nonce:nonceHex,
            from:from,
            to:to,
            value:valueHex,
            data:data,
            gas:gasHex,
            gasPrice:gasPriceHex,
            gasLimit:gasLimitHex,
            chainId:chainIdHex

        }

    }
}
let txGenerator = new TxGenerator();
module.exports = txGenerator;