How to use the ethereumjs-wallet/provider-engine function in ethereumjs-wallet

To help you get started, we’ve selected a few ethereumjs-wallet 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 KeySplit / dapp / back / dist / index.es.js View on Github external
this.engine = new ProviderEngine();
      this.web3 = new Web3(this.engine);
      // static results
      this.engine.addProvider(new FixtureSubprovider({
        web3_clientVersion: 'ProviderEngine/v0.0.0/javascript',
        net_listening: true,
        eth_hashrate: '0x00',
        eth_mining: false,
        eth_syncing: true
      }));

      // filters
      this.engine.addProvider(new FilterSubprovider());

      // id mgmt
      this.engine.addProvider(new WalletSubprovider(wallet, {}));

      this.engine.addProvider(new Web3Subprovider(new Web3.providers.HttpProvider(rpcURL)));

      this.engine.on('block', function (block) {
        console.log('BLOCK CHANGED:', '#' + block.number.toString('hex'), '0x' + block.hash.toString('hex'));
      });

      // network connectivity error
      this.engine.on('error', function (err) {
        // report connectivity errors
        console.error(err.stack);
      });

      // start polling for blocks
      this.engine.start();
    }
github KeySplit / dapp / src / Keysplit / app.js View on Github external
this.web3 = new Web3(this.engine);
      console.log(this.web3)
      // static results
      this.engine.addProvider(new FixtureSubprovider({
        web3_clientVersion: 'ProviderEngine/v0.0.0/javascript',
        net_listening: true,
        eth_hashrate: '0x00',
        eth_mining: false,
        eth_syncing: true,
      }))

      // filters
      this.engine.addProvider(new FilterSubprovider())

      // id mgmt
      this.engine.addProvider(new WalletSubprovider(wallet, {}))

      this.engine.addProvider(new Web3Subprovider(new Web3.providers.HttpProvider(rpcURL)));

      this.engine.on('block', function(block) {
        // We probably don't need to be spamming this to the console, but it's useful for debugging.
        console.log('BLOCK CHANGED:', '#'+block.number.toString('hex'), '0x'+block.hash.toString('hex'))
      })

      // network connectivity error
      this.engine.on('error', function(err){
        // report connectivity errors
        console.error(err.stack)
      });

      // start polling for blocks
      this.engine.start()