npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

redeemeum-api-service

v0.0.3

Published

Redeemeum API service to interact with the backend

Downloads

1

Readme

Redemeum Frontend API Service

Installation

npm install redeemeum-api-service --save

Description

In order to connect your frontend application to the API you would need to set API_URL in your .env file like this:

API_URL=http://localhost:3000

Response Codes

200: Success
400: Bad request
401: Unauthorized
403: Forbidden
404: Cannot be found
50X: Internal Server Error

Here are all the functions the Service currently provides and some useful information:

  • generateNonce(signerAddress) -> generate random nonce everytime prior user tries to log in and returns is to the FE
  • verifySignature(signerAddress, signature) -> returns JWT token for the logged user. The signature is create by signing message with the user's wallet and the nonce
  • createVoucher(formData, token) -> formData has the following properties
    • title - String, required
    • qty - Number, required
    • category - String, not required
    • startDate - Date, required
    • expiryDate - Date, required
    • offeredDate - Date, required
    • price - Schema.Types.Decimal128, required
    • buyerDeposit - Schema.Types.Decimal128, required
    • sellerDeposit - Schema.Types.Decimal128, required
    • description - String, not required
    • location - String, required
    • contact - String, required
    • conditions - String, required
    • voucherOwner - String, required
    • txHash - String, required
    • _tokenIdSupply - String, required
    • _promiseId - String, required
    • fileToUpload - File[], not required
  • getVoucher(id)
  • getSellerVouchers(userAddress)
  • getBuyerVouchers(userAddress)
  • getVouchersStatus(token) -> returns vouchers statuses (active / inactive) for the seller
  • getActiveVouchers(token) -> returns all active voucher for the seller
  • getInactiveVouchers(token) -> returns all inactive voucher for the seller
  • getMyVoucherDetails(voucherId, token) -> returns voucher details for the buyer
  • getAllUsersByVoucherID(voucherId, token) -> returns all the buyers committed a voucher from the specific VoucherBatch
  • getMyVouchers(token) -> returns all vouchers the buyer committed
  • commitToBuy(voucherID, data, token) -> store a committed voucher in the DB.
    • data is the parsed event from the blockchain. Example:
    const data =  {
        txHash: "0x00b8b2aed0ec1da983dd364e800210f9ff036a445b9bd27fa24d6291a248848b",
        _holder: "0x39650Cd0969B1FE9e25E468150EC35E4002Bfdb1",
        _issuer: "0x5aF2b312eC207D78C4de4E078270F0d8700C01e2",
        _promiseId: "0x93bb64c3c1130c2496d2d5bb8a74dad74014b65e7b414850f66329abd9b104b6",
        _tokenIdSupply: "57896044618658097711785492504343953927315557066662158946655541218820101242880",
        _tokenIdVoucher: "57896044618658097711785492504343953927315557066662158946655541218820101242881"
    }
  • updateUserVoucher(data, token) -> updates user voucher after interacting with the blockchain. Depending on the function you call as a buyer / seller you will need to provide the respective status. It will not come from the Smart Contracts
    • data example:
    const data = { 
        _id: 'userVoucherID',
       status:  "CANCELLED" || "REDEEMED" || "REFUNDED" || "COMPLAINED"}
    
  • getPaymentDetails(voucherID, token) -> returns an object identifying who received what after finalization of a voucher