I am trying to deploy smart contract using ledger wallet. But i keep getting the error cant subscribe to new header. However i get the transaction hash but cant receive the contract instance and receipt.
var myContract = new my_web3.eth.Contract(this.state.abi);
myContract.deploy({
from: this.state.defaultAddr,
data:this.state.byteCode
})
.send({
from: this.state.defaultAddr,
gas: 1500000,
gasPrice: '30000000'
})
.on('error',error=>{
console.log(error)
this.setState({
errors:error
,infoHidden:true
,errorHidden:false
})
})
.on('transactionHash', transactionHash=>{
console.log(transactionHash) })
.on('receipt',receipt=>{
console.log(receipt) // contains the new contract address
})
.on('confirmation', function(confirmationNumber, receipt){
console.log(confirmationNumber) })
.then(newContractInstance=>{
console.log(newContractInstance) // instance with the new
contract address
this.setState({
Contract:newContractInstance,
infoHidden:false,
errorHidden:true})
console.log("Contract
Address"+newContractInstance.options.address);
this.props.history.push({
pathname:'/save',
state:{
// ABI:response.data.data.abi,
// byteCode:response.data.data.byteCode,
ContractAddress:newContractInstance.options.address,
ABI:this.state.abi,
}
})
})
Connection Snippet
var my_web3
let account;
const rpcUrl = "https://rinkeby.infura.io/";
const use_ledger =localStorage.walletAccessMechanismType;
console.log(use_ledger)
if(use_ledger =="ledger")
{
const engine = new ProviderEngine();
const getTransport = () => TransportU2F.create();
const ledger = createLedgerSubprovider(getTransport, {
networkId: 4, // 3 == Ropsten testnet
});
engine.addProvider(ledger);
engine.addProvider(new RpcSubprovider({ rpcUrl }));
engine.start();
my_web3 = new Web3(engine);
} else if(typeof(web3) === 'undefined') {
my_web3 = new Web3(new Web3.providers.HttpProvider(rpcUrl));
} else {
my_web3 = new Web3(window.web3.currentProvider);
}