[Ethereum] Prompting a transaction to metamask

metamaskweb3js

How do I prompt a transaction to MetaMask using web3/truffle? Like if I want a charge a user x amount of ether, and have them confirm the transaction via MetaMask.

Best Answer

Be sure you've set the right provider (i.e. web3 = new Web3(web3.currentProvider) to use MetaMask's injected provider), and then just make the transaction: web3.eth.sendTransaction(...).

Related Topic