Skip to content

Commit

Permalink
Update App.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
aglawson committed Sep 20, 2023
1 parent 4ec7127 commit be2cd7f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frontend/client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function App() {
} catch (switchError) {
console.log({ switchError })
if (switchError.code === 4902) {
toast.warn('Adding Scroll Sepolia to your MetaMask');
try {
await window.ethereum.request({
method: 'wallet_addEthereumChain',
Expand All @@ -61,6 +62,7 @@ function App() {

provider = new ethers.BrowserProvider(window.ethereum);
} catch (addError) {
toast.error('There was an error adding the network, please refresh and try again.');
console.error(addError);
}
}
Expand All @@ -70,13 +72,14 @@ function App() {
signer = await provider.getSigner();
setUserAddress(await signer.getAddress());
const user = await GetUser(await signer.getAddress());
console.log(user)
if(user !== null) {
setTwitter(user.handle)
toast.success(`Welcome Back ${user.handle}!`);
setCopy(`Good to see ya again, ${user.handle}. Click the Drip button and you'll have your test ETH in no time.`);
setMessage(user.handle);
return;
}

setMessage('Connect X');
toast.success("Wallet Connected!");
setCopy('Great! Now just connect your X account. This is to prevent thievery. We gotta be careful out here nowadays.');
Expand All @@ -91,7 +94,6 @@ function App() {
return
}
const data = await getAuthUrl()
console.log(data)
let token = data.requestToken.oauth_token
let token_secret = data.requestToken.oauth_token_secret
setAuthUrl(data.authUrl)
Expand Down Expand Up @@ -120,8 +122,9 @@ function App() {
setTwitter(result.data.username)
setAuthUrl(null)
const addUser = await AddFaucetUser(userAddress, result.data.username)
console.log(addUser)
toast.success('X Connected!')

setMessage(result.data.username);
setCopy(`Pleasure to meet you, ${user.handle}. Click the Drip button and you'll have your test ETH in no time.`);
return result
} catch (error) {
Expand All @@ -132,7 +135,6 @@ function App() {

async function drip() {
const tx = await Drip(twitter, userAddress);
console.log(tx)

if(tx.error) {
if(tx.error.error) {
Expand Down

0 comments on commit be2cd7f

Please sign in to comment.