trufflesuite / truffle-hdwallet-provider

HD Wallet-enabled Web3 provider
MIT License
399 stars 167 forks source link

UnhandledPromiseRejectionWarning: Error: Subscriptions are not supported with the CustomProvider. #96

Open npvns opened 5 years ago

npvns commented 5 years ago

UnhandledPromiseRejectionWarning: Error: Subscriptions are not supported with the CustomProvider.

const HDWalletProvider = require('truffle-hdwallet-provider'); const Web3 = require('web3'); const { interface, bytecode } = require('./compile'); const wallet_mnemonic = 'a b c e f g h i j k l m'; const wallet_uri = 'https://rinkeby.infura.io/v3/8cacd06f607a4bf3b9ee83cbd7ad7dea'; const provider = new HDWalletProvider(wallet_mnemonic, wallet_uri ); const web3 = new Web3(provider);

const deploy = async () => { const accounts = await web3.eth.getAccounts(); console.log('Account used', accounts[0]); const result = await new web3.eth.Contract(JSON.parse(interface)) .deploy({data: '0x' + bytecode, arguments:['Initial message']}) .send({ gas: '1000000', from: accounts[0]}); console.log('Contract deployed to', result.options.address); }; deploy();