Fund & Withdraw Front-end Ready
This commit is contained in:
parent
70a2714570
commit
a9311b04f6
@ -21,5 +21,8 @@ Test localhost hardhat node
|
||||
* RPC URL from VS code: http://127.0.0.1:8545/
|
||||
* Default Hardhat node Chain ID from VS code: 31337
|
||||
* Currency Symbol ETH (Or Any)
|
||||
* Metamark add account via private key
|
||||
* MetaMark add account via private key
|
||||
* Connect With the added account
|
||||
* MetaMask Prompt Error - Reset account
|
||||
* Due to localhost hardhat node restarted, nonce start from 0 again
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
<head>
|
||||
<title>Fund Me App</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<button id="connectButton">Connect</button>
|
||||
<button id="balanceButton">getBalance</button>
|
||||
|
6
index.js
6
index.js
@ -48,6 +48,12 @@ async function fund() {
|
||||
const ethAmount = document.getElementById("ethAmount").value;
|
||||
console.log(`Funding with ${ethAmount}...`);
|
||||
if (typeof window.ethereum !== "undefined") {
|
||||
/* Need:
|
||||
provider / connection to the blockchain
|
||||
signer / wallet / someone with gas
|
||||
contract that we are interacting with
|
||||
ABI & address
|
||||
*/
|
||||
const provider = new ethers.providers.Web3Provider(window.ethereum);
|
||||
const signer = provider.getSigner();
|
||||
const contract = new ethers.Contract(contractAddress, abi, signer);
|
||||
|
Loading…
Reference in New Issue
Block a user