GithubHelp home page GithubHelp logo

surgieboi / nextjs-wagmi-supabase Goto Github PK

View Code? Open in Web Editor NEW
11.0 5.0 2.0 731 KB

A starter kit for developing a dApp using Next.js, Supabase, and Wagmi.

Home Page: https://nextjs-wagmi-supabase.vercel.app/

License: MIT License

Shell 0.79% JavaScript 3.92% TypeScript 92.95% CSS 2.34%
ethereum nextjs supabase wagmi web3

nextjs-wagmi-supabase's Introduction

Wagmi dApp Starter Kit

This proof-of-concept uses Wagmi to connect and save Web3 wallet addresses and metadata to Supabase using a connected wallet's address within a Next.js application.

Deploy on Vercel

Before deploying, read Get Started and ensure that you have created the required environment variables.

Deploy with Vercel

Getting Started

  1. git clone https://github.com/surgieboi/nextjs-wagmi-supabase.git
  2. npm install
  3. Rename the .env.example file to .env
  4. Create an account on Alchemy; once logged-in, copy and paste your API Key within your .env file
  5. Create an account on Supabase; once logged-in, copy and paste your Anon Key and URL within your .env file
  6. npm run dev
  7. Visit http://localhost:3000

Additionally, read Connecting and Using Supabase, and ensure that you have properly setup your Supabase organization, project, and tables.

Remember, in order to connect a Web3 wallet you will need a wallet extension added to your browser. This proof-of-concept is pre-configured with the following:

Connecting and Using Supabase

Setting up Supabase

Before you can save data from your application, you will need to complete the following:

General

  1. Create an organization
  2. Create a project
  3. Proceed to Table Editor

Saving Wallet Adddresses

Create a table called, wallets and add the following columns:

Column Type Primary Is Nullable
wallet_address text true false

Delete the default id column and ensure that wallet_address is the only Primary value.

Note, you can update table names; however, remember to update their references found throughout /src/components/SupabaseActions.tsx.

Saving Signed Message Signatures

Create a table called, signings and add the following columns:

Column Type Primary Is Nullable
address text false false
signature text false false

Saving Transaction Metadata

Create a table called transactions and add the following columns:

Column Type Primary Is Nullable
tx_hash text true false
amount numeric false false
from text false false
to text false false

supabaseClient.js

Within /utils we connect our application to Supabase using supabaseClient.js, which then allows us to import supabase throughout our components and pages using the following import statement, import { supabase } from "../../utils/supabaseClient";.

Note, in order for your application to connect to Supabase, ensure that you've properly updated your .env file with your accounts Anon Key and API URL.

SupabaseActions Component

Within /components we use the SupabaseActions to enable connected wallets to:

  1. insert and select a connect wallet's address from Supabase
  2. insert a completed signing message's signature value using Wagmi's useSignMessage hook
  3. insert a completed send trasnaction's hash value using Wagmi's usePrepareSendTransaction, useSendTransaction and useWaitForTransaction hook

Dependencies

Addtional Support

Tailwind CSS

When using VS Code, Tailwind will initially create 3 warnings; specifically, from /src/styles/globals.css. To disable these warnings, visit the VC Code Marketplace and install PostCSS Language Support.

Contributing

This proof-of-concept uses as an MIT license and is free to use. Moreover, you can create issues and pull requests, as this repository will be maintained and updated as it supports various Web3 MVPs.

For additional information or if you have any questions, feel free to email me at [email protected] or connect with me on Twitter, @surgieboi.

nextjs-wagmi-supabase's People

Contributors

surgieboi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

bunsdev ngmisl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.