Skip to content

cryptodev523/point-issuer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PointsIssuer

PointsIssuer is a TypeScript SDK and Next.js application that allows projects to issue points to their users for off-chain actions. The SDK provides setter and getter functions for points management and stores the data in a PostgreSQL database. The project includes an API endpoint for registering API keys and a simple frontend utility for manually distributing points.

About SDK

Check the sdk level README.

Getting Started

Prerequisites

  • Node.js (>=18.x)
  • Vercel account (for deployment & db)

Installation

  1. Clone the repository:
git clone [email protected]:cryptodev523/point-issuer.git
cd point-issuer
  1. Install dependencies:
cd utility
npm install
  1. Create a new PostgreSQL on Vercel and connect the project.
  2. Create a .env.local file in the utility folder with database connection details

Running the Application

  1. Start the utility:
npm run dev
  1. Open your browser and navigate to http://localhost:3000 to access the frontend utility.

Usage

1. Registering an API key

To register an API key for your project, send a POST request to /api/project with your project details:

curl -X POST http://localhost:3000/api/project -d '{"name": "Your Project Name"}'

Record the project id from the /project endpoint response.

Send a POST request to /api/credential with the projectId.

curl -X POST http://localhost:3000/api/credential -d '{"projectId": "Your Project Id"}'

2. Run the utility.

Run the utility Next.js project with the following command.

npm run dev

Go to 'http://localhost:3000' and input the api key, event name, number of points, address

image

Deployment

Deploy the application to Vercel:

  1. Connect your GitHub repository to Vercel.
  2. Set up environment variables in Vercel with your database connection details.
  3. Deploy the project.