Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet auth #81

Open
wants to merge 7 commits into
base: member-list-ui
Choose a base branch
from
Open

Wallet auth #81

wants to merge 7 commits into from

Conversation

suleman-mahmood
Copy link

@suleman-mahmood suleman-mahmood commented Aug 25, 2021

Features added:

  • The user can head on to '/login' page to connect his wallet with our dapp.
  • After connecting the wallet, the app checks for the member status of the user by calling a read-only function from Miami Vice's smart contract. Note: The Miami vice's contract is not deployed yet so the read-only function cannot be tested.
  • The user is then redirected to the registration page or Miami vice's dashboard.
  • Added the '/logout' page which signs the user out from his wallet and then redirects to the login page (will need to be changed to landing page once we have one)

Minor Changes:

  • Added stacks connect package for authenticating the user through the wallet web extension
  • Added "DOM" in tsconfig to avoid errors related to dom functions such as fetch and window.

Changes left:

  • I haven't worked on the HTML/CSS side of things so the login page will appear very basic with just a text and a button. I hope someone more skilled in the design aspect of the frontend can code this :D

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 25, 2021

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: ade269a
Status:🚫  Build failed.

View logs

The app checks for miami coin balance and then gives user access if he has any coins present

Signed-off-by: Suleman Mahmood <[email protected]>
contact call to read only function added to verify whether the loggin in user is a registered member of the miami vice or not
This was linked to issues Aug 31, 2021
@Zk2u
Copy link

Zk2u commented Aug 31, 2021

Build is failing on CF for some reason. Check the logs.

Other than that, this is an AWESOME PR!! thank you! gonna test it out and give it an approval or not later. cc @314159265359879 for his review too. assigning reviews now...

@Zk2u Zk2u added ✨ Next.js Regards Next.js in some way 💡 Feature A new feature or request 🧠 Good 4 noobs Good for newcomers ⚠️ High Priority High priority issue labels Aug 31, 2021
@Zk2u Zk2u added this to the Mainnet proof-of-concept milestone Aug 31, 2021
Copy link
Contributor

@JMKJR JMKJR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the great work and initiative on this!

packages/ui/pages/logout.tsx Outdated Show resolved Hide resolved
// Set this to true if you want to use Mainnet
// Using a boolean helps to switch the entire application to mainnet
// or testnet with only changing a single value
const isNetworkMainnet = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an environment variable.

Copy link
Author

@suleman-mahmood suleman-mahmood Sep 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the docs here (https://nextjs.org/docs/basic-features/environment-variables).
Making .env.development or .env files isn't working and environment variables aren't loaded up.
Spent an hour trying to make them to work but no progress :(
Dunno, what am I doing wrong

I have added the environment variable files and their usage in the commit. So maybe you can look into what am I doing wrong :x

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you create .env.local in packages/ui?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have created all types of .env files in packages/ui and have logged the object process.env in the console and it appears to be empty. The environment variable doesn't seem to get loaded :/

packages/ui/components/auth.tsx Show resolved Hide resolved
packages/ui/components/auth.tsx Show resolved Hide resolved
packages/ui/components/auth.tsx Outdated Show resolved Hide resolved
@314159265359879
Copy link
Contributor

Excellent work, I am keeping an eye on this, will test when the page builds.

packages/ui/.env.development Outdated Show resolved Hide resolved
packages/ui/components/NavLink.tsx Outdated Show resolved Hide resolved
packages/ui/components/Drawer.tsx Outdated Show resolved Hide resolved
packages/ui/components/MainNavMobile.tsx Show resolved Hide resolved
Copy link
Contributor

@JMKJR JMKJR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put your .env.local file in the root directory of the project and it will work. I mistakenly suggested packages/ui.

@@ -27,8 +27,16 @@ function Drawer({
expanded,
handleCloseClick,
closeDrawer,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can set a default value here of closeDrawer=()=>{} so we don't need to pass in an empty function in our other components when we want to use Drawer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 Feature A new feature or request 🧠 Good 4 noobs Good for newcomers ⚠️ High Priority High priority issue ✨ Next.js Regards Next.js in some way
Projects
None yet
Development

Successfully merging this pull request may close these issues.

App logout Wallet Authentication
4 participants