I am trying to interact with a contract without a provider as Metamask/Mist. I know that web3 has an option to create a new Wallet and I have been seeing code examples about that but all of them sending a normal transaction of ethers and I am a bit confused how to use it when I want to interact with a function in the contract.
One example is in pet-shop-tutorial. When you want to adopt a pet, you send a transaction from the .js file calling the adopt
function with the account:
App.contracts.Adoption.deployed().then(function(instance) {
adoptionInstance = instance;
// Execute adopt as a transaction by sending account
return adoptionInstance.adopt(petId, {from: account});
})
I am trying to do that using a web3 provider with the private key because I dont want to confirm the tx through Metamask. How could I do it? is there any example of that? It will be very helpful if someone could apply it in this example.