ubiquity-os-marketplace / command-wallet

Commands related to wallet update and query.
0 stars 7 forks source link

no docs for populating supabase #20

Open ishowvel opened 2 days ago

ishowvel commented 2 days ago

There is nothing in the readme as of right now which might give a hint on populating the tables in supabase, this might be a headache for first time contributors

ishowvel commented 2 days ago

@0x4007 can you give your views on this. there is nothing that clearly states how supabase should be set up. following the steps in the readme will result in a table not found error when a user tries to add their wallet using /wallet.

0x4007 commented 1 day ago

@gentlementlegen @Whilefoo might know more here

0x4007 commented 1 day ago

@UbiquityOS explain as clearly and concisely as possible on how to set up supabase for this plugin for a first time contributor.

ubiquity-os-beta[bot] commented 1 day ago

To set up Supabase for the command-wallet plugin as a first-time contributor, follow these steps:

  1. Create a Supabase Project

    • Sign Up/Login: Visit Supabase and sign up or log in to your account.
    • Create a New Project: Click on "New Project" and provide the necessary details such as project name, password, and the region closest to you.
  2. Obtain Supabase Credentials

    • API Settings: Once the project is created, navigate to Settings > API in the Supabase dashboard.
    • Retrieve Keys:
      • Supabase URL: You'll find your unique SUPABASE_URL here.
      • Supabase Key: Copy the SUPABASE_KEY (use the anon key for development).
  3. Configure Environment Variables

    • Copy Environment Variables File:
      cp .dev.vars.example .dev.vars
    • Populate .dev.vars: Open the .dev.vars file and fill in the Supabase credentials:
      SUPABASE_URL=your_supabase_url
      SUPABASE_KEY=your_supabase_key
    • Other Variables: Ensure all other required environment variables are properly set as per the .dev.vars.example file.
  4. Set Up Supabase Tables

    • Access Table Editor: In your Supabase project dashboard, go to Table Editor.
    • Create wallets Table:
      • Table Name: wallets
      • Columns:
      • id (UUID, Primary Key, Default: uuid_generate_v4())
      • user_id (UUID, Foreign Key referencing auth.users(id))
      • wallet_address (Text, Not Null)
      • created_at (Timestamp, Default: now())
    • SQL Script Example:
      CREATE TABLE wallets (
      id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
      user_id uuid REFERENCES auth.users(id),
      wallet_address text NOT NULL,
      created_at timestamp with time zone DEFAULT now()
      );
  5. Run Migrations (If Applicable)

    • Migration Scripts: If the project includes migration scripts, execute them to automatically create necessary tables.
      yarn migrate
    • Manual Setup: If no migration scripts are provided, ensure all required tables are manually created as outlined above.
  6. Generate Supabase Types

    • Run Prebuild Script:
      yarn prebuild
    • Purpose: This step generates TypeScript types based on your Supabase schema, ensuring type safety in your project.
  7. Start the Development Server

    • Run Wrangler:
      yarn wrangler
    • Verify Setup: Ensure the server starts without errors related to Supabase. Test the /wallet command to confirm that the tables are correctly integrated.
  8. Additional Configuration (Optional)

    • Supabase Auth: Depending on the plugin's requirements, configure authentication methods (e.g., email, OAuth) in Authentication > Settings.
    • Storage Buckets: If the plugin utilizes Supabase Storage, set up the necessary buckets under Storage.

Summary:

  1. Create Supabase Project
  2. Obtain and set environment variables (SUPABASE_URL, SUPABASE_KEY)
  3. Create necessary tables (wallets) in Supabase
  4. Run yarn prebuild to generate types
  5. Start the project with yarn wrangler

By following these steps, first-time contributors should be able to set up Supabase successfully for the command-wallet plugin. Make sure to update the project's README with these detailed instructions to assist future contributors.

0x4007 commented 1 day ago

Not sure how accurate this is but most of it seems to check out

gentlementlegen commented 1 day ago

@ishowvel You can refer to https://github.com/ubiquity-os/database to set up your own Supabase instance, should just be a matter of cloning and supabase start.

ishowvel commented 1 day ago

It would have been really helpful if it was linked 😭😭😭

gentlementlegen commented 1 day ago

We created this repository 2 days ago because we noticed the database was still located within the old bot. I'll add the link in the readme.