0

I am trying to build a Dapp that relies on this functionality. A user will request another user for some eth, and the sender would then see a pop up notification on their wallet ex Metamask or some other and then confirm the transactionan after which the eth would be transferred?

1
  • this is what I have provider.getTransactionCount(walletA.address) .then((nonce) => { const txRequest = { to: walletB, value: 0, nonce: nonce, data: ethers.hexlify(ethers.toUtf8Bytes(send ${ethers.formatEther(amountToRequest)} ETH)), gasLimit: 50000, }; return walletA.sendTransaction(txRequest); }) .then(async (tx) => { const resolvedTx = await ethers.resolveProperties(tx); const receipt = await tx.wait(); }) .catch((error) => { console.error('Error sending request:', error); });
    – bot_one
    Commented Apr 11 at 3:03

1 Answer 1

0

Here is outline

  • Create the request data and store it in a database
  • Create a web page that displays this request
  • Send a link of this web page to the user
  • When the user arrives to the web page, they can connect their wallet (there are many wallets, and although MetaMask is oldest, you need to support all wallets)
  • The web page then opens MetaMask the Send transaction request and the user can confirm, this is done using a library like Viem and JSON-RPC request which web page and wallet use to communicate

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.