How to use the web3.eth function in web3

To help you get started, we’ve selected a few web3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DurianStallSingapore / ZILMiner / example / contract_with_array.html View on Github external
function createExampleContract() {
        // hide create button
        document.getElementById('create').style.visibility = 'hidden'; 
        document.getElementById('source').innerText = source;

        // create contract
        var address = web3.eth.sendTransaction({data: web3.eth.compile.solidity(source)}),
            Contract = web3.eth.contract(desc);

        myContract = new Contract(address);
        document.getElementById('call').style.visibility = 'visible';
    }
github CortexFoundation / CortexTheseus / cmd / mist / assets / ext / ethereum.js / example / event.html View on Github external
function test8() {
            // "{"topic":["0x83c9849c","000000000000000000000000000000000000000000000000000000000000001e"],"max":100,"address":"0x01"}"
            web3.eth.watch(contract.Event, {a: 30}, {max: 100}).changed(function (res) {

            });
        };
github status-im / ens-usernames / app / components / testtoken.js View on Github external
mint(e) {
    const { addToBalance } = this.props;
    e.preventDefault();

    const value = parseInt(this.state.amountToMint, 10);

    if (EmbarkJS.isNewWeb3()) {
      TestToken.methods.mint(value).send({ from: web3.eth.defaultAccount })
        .then(() => { addToBalance(value); });
    } else {
      TestToken.mint(value).send({ from: web3.eth.defaultAccount })
        .then(() => { addToBalance(value); });
    }
    console.log(TestToken.options.address +".mint("+value+").send({from: " + web3.eth.defaultAccount + "})");
  }
github ConsenSys / reflux-tx / test / mocker.jsx View on Github external
it('getTransactionReceipt', function(done) {
            web3.eth.onBlock(8, function() {
                web3.eth.getTransactionReceipt(txHash, function(err, receipt) {
                    validateTxReceipt(err, receipt, tx);
                    done();
                });
            });
        });
github embark-framework / embark / old_lib / single_deploy.js View on Github external
SingleDeploy = function(compiledContracts, gasLimit, gasPrice, _web3) {
  if (_web3 !== undefined) {
    web3 = _web3;
  }
  this.compiledContracts = compiledContracts;
  this.gasLimit = gasLimit;
  this.gasPrice = gasPrice;
  this.deployedContracts = {};
  web3.eth.defaultAccount = web3.eth.coinbase;
};
github krakenfx / swoop / src / components / Application.jsx View on Github external
componentWillMount() {
    overrideSendTransaction(web3.eth, () => {
      return this.state.wallet.privKey;
    });
  }
github janx / ethpanel / app / js / utils / EthWebAPIUtils.js View on Github external
getLatestStates: function(url) {
    web3.setProvider(new web3.providers.HttpProvider(url));

    var last = web3.eth.blockNumber;
    var first = last - AppConstants.BlockFetchLimit + 1;

    return {
      defaultAccount: web3.eth.defaultAccount,
      accounts: this.getAccounts(),
      network: this.getNetwork(),
      mining: this.getMining(),
      blocks: this.getBlocks(first, last)
    };
  },