Skip to content

mry0tt4/suirwa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sui RWA Provenance Platform - Backend

This is the backend service for the Sui RWA Provenance Platform, responsible for indexing on-chain data, providing APIs for the frontend, and handling cross-chain communication via Wormhole.

Features

  • Indexing Service: Listens for events emitted by SRPP smart contracts and indexes them in a PostgreSQL database
  • RESTful API: Provides endpoints for querying item data, provenance history, and manufacturer information
  • Wormhole Integration: Processes cross-chain events via Wormhole VAAs
  • Swagger Documentation: Auto-generated API documentation

Prerequisites

  • Node.js (v16+)
  • PostgreSQL
  • Sui Full Node access

Installation

  1. Clone the repository
  2. Install dependencies:
    npm install
    
  3. Configure environment variables in .env file
  4. Start the application:
    npm run start:dev
    

Environment Variables

Variable Description Default
DB_TYPE Database type postgres
DB_HOST Database host localhost
DB_PORT Database port 5432
DB_USERNAME Database username postgres
DB_PASSWORD Database password postgres
DB_DATABASE Database name srpp
SUI_RPC_URL Sui RPC URL https://fullnode.testnet.sui.io:443
SUI_PACKAGE_ID SRPP package ID on Sui
PORT Server port 3000

API Endpoints

The API documentation is available at /api when the server is running.

Items

  • GET /items - Get all items with pagination and filtering
  • GET /items/types - Get all item types
  • GET /items/:id - Get item by ID
  • GET /items/by-item-id/:itemId - Get item by item ID (e.g., serial number)
  • GET /items/:id/history - Get item provenance history
  • GET /items/manufacturer/:address - Get items by manufacturer

Manufacturers

  • GET /manufacturers - Get all manufacturers with pagination
  • GET /manufacturers/search - Search manufacturers
  • GET /manufacturers/:address - Get manufacturer by address
  • PUT /manufacturers/:address - Update manufacturer information

Wormhole

  • POST /wormhole/process-vaa - Process a Wormhole VAA
  • GET /wormhole/unprocessed - Get all unprocessed cross-chain events
  • POST /wormhole/:id/mark-processed - Mark a cross-chain event as processed

Development

Running Tests

npm run test

Building for Production

npm run build

License

This project is licensed under the MIT License.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors