From bab99b155480dd49eed6872e52a7c9b5ab16beb4 Mon Sep 17 00:00:00 2001 From: William Hua Date: Wed, 2 Aug 2023 15:27:19 -0400 Subject: [PATCH] send funds back to self --- src/App.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 94fabc4..3f1272e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -524,7 +524,11 @@ And that has made all the difference. signer = signer || wallet.getSigner() // select DefaultChain signer by default - const toAddress = ethers.Wallet.createRandom().address + // Sending the funds to the wallet itself + // so we don't lose any funds ;-) + // (of course, you can send anywhere) + const toAddress = await signer.getAddress() + const amount = ethers.utils.parseUnits('1', 1) // (USDC address on Goerli) @@ -557,7 +561,11 @@ And that has made all the difference. signer = signer || wallet.getSigner() // select DefaultChain signer by default - const toAddress = ethers.Wallet.createRandom().address + // Sending the funds to the wallet itself + // so we don't lose any funds ;-) + // (of course, you can send anywhere) + const toAddress = await signer.getAddress() + const amount = ethers.utils.parseUnits('0.05', 18) const daiContractAddress = '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063' // (DAI address on Polygon)