leonprou
  • Member for 3 years, 11 months
  • Last seen more than a month ago
How to detect if on mainnet or testnet?
8 votes

For web3 1.0.0 you should do: web3.eth.net.getId().then(netId => { switch (netId) { case 1: console.log('This is mainnet') break case 2: console.log('This is the ...

View answer
WEB3 accessing multiple return values
7 votes

With new Destructuring assignment syntax you can do this in one line: let [a, b] = myContractInstance.getAandB.call(2); console.log("a=", a); console.log("b=", b); Output is as expected: a=2 b=4

View answer
Reading events of the inner Solidity contract with Web3
Accepted answer
2 votes

I've found a straight forward way to solve it by extending the contract B ABI with the events of contract A. A is inside of B, so B can call to A methods and trigger A events. While A's methods are ...

View answer
Returns (bool) check in function
2 votes

Not sure that I have the same angle for that question. I asked myself if it's a good practice to return a true value on a function success. Many see that pattern first in the ERC20 standard, the ...

View answer
Setting the address for a contract - within another contract
1 votes

From solidity documentation: contract OwnedToken { // TokenCreator is a contract type that is defined below. // It is fine to reference it as long as it is not used // to create a new ...

View answer
Stop listening to / watching a contract (Web3)
Accepted answer
0 votes

You should receive up to 12 confirmations, from the web3 docs: "confirmation" returns Number, Object: Is fired for every confirmation up to the 12th confirmation. Receives the confirmation number ...

View answer