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

gari

v1.0.17

Published

This SDK is easy-to-use wallet service that a client can use to enable their users to have their wallet within there application and do on-chain transactions within their app

Downloads

43

Readme

gari-sdk

This SDK is easy-to-use wallet service that a client can use to enable their users to have their wallet within there application and do on-chain transactions within their app

💡 Features

  • Create a wallet for a user
  • fetch their wallet details and balance for a particular user
  • Send gari tokens from one wallet to another
  • fetch their transaction details by txn id
  • Client can Airdrop gari tokens to its users

⚡ Quick Start

Installation

npm install gari
import * as gari from 'gari'

Method List

  • sdkInitialize
  • createWalletOrGetWallet
  • transferGariToken
  • airdrop
  • initiateTransaction
  • getTransactions
  • getTransactionById

Frontend Methods

Initialize gari library

/**
 * @description 
 * @param {string} clientId 
 */
gari.sdkInitialize(clientId)

createWallet Or GetWallet

Get wallet or create wallet for user.

Token format supported: here

Note: web3 auth popup will occur initiale for user during wallet creation, next time this function will directly return data

/**
 * @param {string} token
 */
gari.createWalletOrGetWallet(token)
 
return {
publicKey:’sample publickey’,
balance:0
} 

transferGariToken

Send gari token to another user. This will return encoded transaction which client has to send to its backend for validation and its backend will forward it to chingari for processing.

/**
 * @param {string} token
 * @param {string} toPublicKey
 * @param {number} amount
 * @returns 
 */
gari.transferGariToken(token,toPublicKey, amount)

return
{
transaction:’base64 Encoded Tranaction’
}

Backend Methods

Initialize gari library

/**
 * @description if using in backend, need to pass gariSecretKey
 * @param {string} clientId 
 * @param {string?} secerateKey 
 */
gari.sdkInitialize(clientId,secerateKey)

airdrop

client will airdrop gari tokens to its users as a reward.

/**
 * @param {string} publicKey 
 * @param {number} amount 
 * @param {string} token 
 * @param {string} fromWalletPrivateKey 
 * @returns 
 */
gari.airdrop(publicKey,amount,token,fromWalletPrivateKey)

return
{
id:’’,
signature:'EJ3FktdZhsNbDMamvSygi2wLfjBgisWzF1iNecdckQVmsdgEJ3FktdZhsNbDMamvSygi2wLfjBgisWzF1iNecdckQVm',
status:’draft|pending|success|failed’,
message:’’
}

initiateTransaction

This method will validate transaction details and return signature.

/**
 * @param {string} encodedTransaction 
 * @param {string} token 
 */
gari.initiateTransaction(encodedTransaction,token)

return 
{
siganature:'EJ3FktdZhsNbDMamvSygi2wLfjBgisWzF1iNecdckQVmsdgEJ3FktdZhsNbDMamvSygi2wLfjBgisWzF1iNecdckQVm'
}

getTransactions

this will give all client related transactions to sdk Client.

/**
 * @param {object} filter 
 * @param {number} skip 
 * @param {number} limit 
 * @param {string} sorting 
 * @param {string} token 
 * @returns 
 */
gari.getTransactions(filter,skip,limit,sorting,token)

filter
{
fromPublicKey:’’,
toPublicKey:’’,
Status:’’,
case:’’
}

return
[{
id:’’,
signature:'EJ3FktdZhsNbDMamvSygi2wLfjBgisWzF1iNecdckQVmsdgEJ3FktdZhsNbDMamvSygi2wLfjBgisWzF1iNecdckQVm',
status:’draft|pending|success|failed’,
amount:number,
meta:string,
date:Date
}]

getTransactionById

this will return specific transaction by particular id.

/**
 * @param {string} transactionId 
 * @param {string} token
 * @returns 
 */
gari.getTransactionById(transactionId,token)

return
{
id:’’,
signature:'EJ3FktdZhsNbDMamvSygi2wLfjBgisWzF1iNecdckQVmsdgEJ3FktdZhsNbDMamvSygi2wLfjBgisWzF1iNecdckQVm',
status:’draft|pending|success|failed’,
amount:number,
meta:string,
date:Date
}

🌐 Demo

Checkout the gari Demo to see how gari can be used in your application. Demo Source code