Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: new BigNumber() not a number: [object Object] #197

Open
DineshTechs opened this issue May 1, 2018 · 0 comments
Open

Error: new BigNumber() not a number: [object Object] #197

DineshTechs opened this issue May 1, 2018 · 0 comments

Comments

@DineshTechs
Copy link

DineshTechs commented May 1, 2018

i am trying to transfer token from one address to another
function functionCallWallet(){
var fromAddr = '0xe38265a9635f395d6a6ea1505f93fbfdb4b4175c';
var toAddr='0xe38265a9635f395d6a6ea1505f93fbfdb4b4175c';
var contractAddr = '0xbec5d11534d68a724640b8291310f56c92b31010';
var abi = JSON.parse('[ { "anonymous": false, "inputs": [ { "indexed": true, "name": "from", "type": "address" }, { "indexed": true, "name": "to", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" } ], "name": "Transfer", "type": "event" }, { "constant": false, "inputs": [ { "name": "token", "type": "address" }, { "name": "_addresses", "type": "address[]" }, { "name": "amount", "type": "uint256" } ], "name": "Airdrop", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_spender", "type": "address" }, { "name": "_value", "type": "uint256" } ], "name": "approve", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" } ], "name": "transfer", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_from", "type": "address" }, { "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "owner", "type": "address" }, { "indexed": true, "name": "spender", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" } ], "name": "Approval", "type": "event" }, { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "constant": true, "inputs": [ { "name": "_owner", "type": "address" }, { "name": "_spender", "type": "address" } ], "name": "allowance", "outputs": [ { "name": "remaining", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "_owner", "type": "address" } ], "name": "balanceOf", "outputs": [ { "name": "balance", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "decimals", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "INITIAL_SUPPLY", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "name", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "symbol", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "totalSupply", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" } ]');
var contract = web3.eth.contract(abi).at(contractAddr)
var functionName = 'transfer';
//var args = JSON.parse('[' + document.getElementById('functionArgs').value + ']')
//var srg = "from,value";
//var args = document.getElementById('functionArgs').value.split(",");
//alert(args[0]);
var valuetkn = '1';
var valuet = parseFloat(valuetkn)*1.0e6
var gasPrice = 50000000000
var gas = 3141592
txOptions = {
gasPrice: gasPrice,
gasLimit: gas,
value: 10000000,
nonce:2
}
txOptions.to = contractAddr;
//alert(txOptions.to);
//var args= { "to":"0xe38265a9635f395d6a6ea1505f93fbfdb4b4175c","value": valuet,"from":fromAddr};
var args= { toAddr,valuet};

    //var functionCallTx = lightwallet.txutils.functionTx(abi,functionName,[ {"from":fromAddr ,"to": toAddr ,  value: 1 } ],txOptions);
    var functionCallTx = lightwallet.txutils.functionTx(abi,functionName,[args],txOptions);
    
	var password = prompt('Enter password ', 'Password');
    lightwallet.keystore.deriveKeyFromPassword(password, function(err, pwDerivedKey) {
    var signedFunctionTx = signing.signTx(global_keystore,pwDerivedKey,functionCallTx,fromAddr);
    console.log("Signed function transaction:"+signedFunctionTx);
    console.log('');
    web3.eth.sendRawTransaction('0x'+signedFunctionTx, function(err, hash) {
        console.log(err);
        console.log(hash);
        });
    })
  }
@DineshTechs DineshTechs changed the title Error: new BigNumber() not a number: to Error: new BigNumber() not a number: [object Object] May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant