Coder Social home page Coder Social logo

hackathon's Introduction

Setup and run Express project

npm install
node index.js

0G project

https://github.com/0glabs/0g-ts-sdk

API Endpoints

POST /events

Description:

Creates a new event in the blockchain.

Example:

curl -H "Content-Type: application/json" \
     -d '{"eventName": "hackathon 2024", "ticketPrice": 1}' \
     -X POST \
     localhost:6969/events

Parameters:

{
    "eventName": "hackathon 2024",
    "ticketPrice": 1 // in A0GI
}

Returns:

{
    "eventName": "hackathon",
    "ticketPrice": 69, // in A0GI
    "ticketsSold": 1,
    "maxTickets": 100,
    "date": "2024-06-16",
    "time": "13:00 PDT",
    "location": "JJ Lakes Business Center",
    "description": "A great learning experience!"
}

GET /events/:id

Description:

Fetches a single event's details.

Example:

curl -X GET localhost:6969/events/1

Returns:

{
    "eventName": "hackathon",
    "ticketPrice": 69, // in A0GI
    "ticketsSold": 1,
    "maxTickets": 100,
    "date": "2024-06-16",
    "time": "13:00 PDT",
    "location": "JJ Lakes Business Center",
    "description": "A great learning experience!"
}

If the id does not exist, a HTTP 404 status code is returned.

GET /events

Description:

Fetches details of all events.

Example:

curl -X GET localhost:6969/events

Returns:

[
    {
        "eventName": "hackathon",
        "ticketPrice": 69, // in A0GI
        "ticketsSold": 1,
        "maxTickets": 100,
        "date": "2024-06-16",
        "time": "13:00 PDT",
        "location": "JJ Lakes Business Center",
        "description": "A great learning experience!"
    },
    {
        "eventName": "party",
        "ticketPrice": 0, // in A0GI
        "ticketsSold": 50,
        "maxTickets": 100,
        "date": "2024-06-17",
        "time": "10:30 PST",
        "location": "JJ Lakes Business Center",
        "description": "A great partying experience!"
    },
]

If there are no events, an empty list is returned.

GET /events/:id/attendees

Description:

Fetches the list of attendees (wallet addresses) for a given event.

Example:

curl -X GET localhost:6969/events/1/attendees

Returns:

[
    "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
]

POST /tickets

Description:

Purchases a ticket to an event.

Parameters:

{
    "eventID": 1,
    "amount": 2,
    "buyer": "0xcE2754e204b5c78D2dc34bA93A57c22B60A8F5CC"
}

Example:

curl -H "Content-Type: application/json" \
     -d '{"eventID": 1, "amount": 2, "buyer": "0xcE2754e204b5c78D2dc34bA93A57c22B60A8F5CC"}' \
     -X POST \
     localhost:6969/events

Returns:

None if successful. HTTP 400/404 otherwise (if invalid request body or invalid eventID does not exist).

POST /users

Description:

Creates a new user with the specified wallet address.

Example:

curl -H "Content-Type: application/json" \
     -d '{"address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "name": "Susan", "bio":  "sunshine and rainbows :)", "imageURL": "https://example.com"}' \
     -X POST \
     localhost:6969/events

Returns:

None

GET /users/:address

Example:

curl -X GET localhost:6969/users/0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266

Returns:

[
    "Susan",
    "sunshine and rainbows :)",
    "https://example.com"
]

TODO

  • [/] add try-catch blocks with meaningful errors
  • get list of attendees given eventID
  • be able to show proof of ticket purchase (how?)
  • prevent dupes from showing up in list of attendees
  • POST /users
  • GET /users/:id
  • POST /messages
  • GET /messages/:userID

Deployed Site:

https://tick3ts-pearl.vercel.app/

Frontend:

https://github.com/NyiHtett/tick3ts

Backend:

https://github.com/sk4rm/hackathon/blob/smart-contracts/contracts/tick3t.sol \

hackathon's People

Contributors

sk4rm avatar nueverest avatar k-shirule avatar

Watchers

 avatar  avatar

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.