Skip to main content
edited tags
Link
BokkyPooBah
  • 40.4k
  • 14
  • 123
  • 193

BigNumber issue:error while trying to call structs

Consider the following contract:

contract Test{  
    uint public id;  
    address public addr;  
    bytes32 public name;  

    struct t {
     bytes32 name;
     uint id;
    address addr;  
   }  
   mapping (address => t) addr_map;
    function f1 (uint param_1, bytes32 param_2) returns (bool) {  
       id = param_1;  
       name = param_2;  
    }
  
   function f2 (uint param_1, bytes32 param_2) returns (bool) {  
      addr_map[msg.sender].name = param_2;  
      addr_map[msg.sender].id = param_1;  
   }  
}  

I am using solc 0.4.4 and web3 calls to interact with the contract. Calling f1 no matter how much I try gives me an error (below the web3 snippet); however calling f1 doesnt have this issue - able to get the tx_hash.

testContractInstance.f2(1,"random",{from:accounts[0],gas:1000000}function(err,tx) {
    if (err) {console.log(err);} 
    console.log(tx)});  
    ```   Any suggestions would be greatly helpful. Error below:
    ```
    BigNumber Error: new BigNumber() not a number: new  
    ```

Any suggestions would be greatly helpful. Error below:

BigNumber Error: new BigNumber() not a number: new

BigNumber issue: while trying to call structs

Consider the following contract:

contract Test{  
    uint public id;  
    address public addr;  
    bytes32 public name;  

    struct t {
     bytes32 name;
     uint id;
    address addr;  
   }  
   mapping (address => t) addr_map;
    function f1 (uint param_1, bytes32 param_2) returns (bool) {  
       id = param_1;  
       name = param_2;  
    }
  
   function f2 (uint param_1, bytes32 param_2) returns (bool) {  
      addr_map[msg.sender].name = param_2;  
      addr_map[msg.sender].id = param_1;  
   }  
}  

I am using solc 0.4.4 and web3 calls to interact with the contract. Calling f1 no matter how much I try gives me an error (below the web3 snippet); however calling f1 doesnt have this issue - able to get the tx_hash.

testContractInstance.f2(1,"random",{from:accounts[0],gas:1000000}function(err,tx) {
    if (err) {console.log(err);} 
    console.log(tx)});  
    ```   Any suggestions would be greatly helpful. Error below:
    ```
    BigNumber Error: new BigNumber() not a number: new  
    ```

BigNumber error while trying to call structs

Consider the following contract:

contract Test{  
    uint public id;  
    address public addr;  
    bytes32 public name;  

    struct t {
     bytes32 name;
     uint id;
    address addr;  
   }  
   mapping (address => t) addr_map;
    function f1 (uint param_1, bytes32 param_2) returns (bool) {  
       id = param_1;  
       name = param_2;  
    }
  
   function f2 (uint param_1, bytes32 param_2) returns (bool) {  
      addr_map[msg.sender].name = param_2;  
      addr_map[msg.sender].id = param_1;  
   }  
}

I am using solc 0.4.4 and web3 calls to interact with the contract. Calling f1 no matter how much I try gives me an error (below the web3 snippet); however calling f1 doesnt have this issue - able to get the tx_hash.

testContractInstance.f2(1,"random",{from:accounts[0],gas:1000000}function(err,tx) {
    if (err) {console.log(err);} 
    console.log(tx)});  

Any suggestions would be greatly helpful. Error below:

BigNumber Error: new BigNumber() not a number: new

Source Link
skarred14
  • 945
  • 1
  • 9
  • 18

BigNumber issue: while trying to call structs

Consider the following contract:

contract Test{  
    uint public id;  
    address public addr;  
    bytes32 public name;  

    struct t {
     bytes32 name;
     uint id;
    address addr;  
   }  
   mapping (address => t) addr_map;
    function f1 (uint param_1, bytes32 param_2) returns (bool) {  
       id = param_1;  
       name = param_2;  
    }
  
   function f2 (uint param_1, bytes32 param_2) returns (bool) {  
      addr_map[msg.sender].name = param_2;  
      addr_map[msg.sender].id = param_1;  
   }  
}  

I am using solc 0.4.4 and web3 calls to interact with the contract. Calling f1 no matter how much I try gives me an error (below the web3 snippet); however calling f1 doesnt have this issue - able to get the tx_hash.

testContractInstance.f2(1,"random",{from:accounts[0],gas:1000000}function(err,tx) {
    if (err) {console.log(err);} 
    console.log(tx)});  
    ```   Any suggestions would be greatly helpful. Error below:
    ```
    BigNumber Error: new BigNumber() not a number: new  
    ```