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);
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();