SuperblocksHQ / superblocks-lab

Superblocks Lab for DApp development
https://superblocks.com/lab/
GNU General Public License v3.0
100 stars 37 forks source link

Consider adding network id to auto-generated Contracts object #336

Open filippsen opened 5 years ago

filippsen commented 5 years ago

Summary

Add networkId string field (as number) to auto-generated Contracts data object (usually accessed via this.Contract). In src/deployer.js:

(function(module, Contracts) {
var data={
...
address: "0x0...",
transactionHash: "0x0...",
network: "rinkeby",
networkId: "4"
...

Motivation

Use network id as returned by RPC {network : 4} for Rinkeby.

I prefer exporting ABI, contract address and transaction hash to a new JSON, skipping dependencies on built-in dapp and fallback to web3 contracts using ABI and contract address. The transaction hash is used to verify chain/network id, together with contract address.

Further information

Network id is also refered to as chain id (chainId).

Further reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#net_version

filippsen commented 5 years ago

Related: #335