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

@hinkal/api

v0.1.5

Published

The `@hinkal/api` package provides a comprehensive set of functions to interact with the Hinkal Protocol backend services. It is designed to handle various operations such as user KYC verification, password management, transaction processing, price retrie

Downloads

452

Readme

Overview

The @hinkal/api package provides a comprehensive set of functions to interact with the Hinkal Protocol backend services. It is designed to handle various operations such as user KYC verification, password management, transaction processing, price retrieval, and more. This documentation provides a brief overview of the available API methods, their purposes, and usage examples.

Installation

To install the @hinkal/api package, use npm or yarn:

npm install @hinkal/api

yarn add @hinkal/api

Usage

Import the API into your project:

import { API } from '@hinkal/api';

API Methods

KYC (Know Your Customer)

Handles user verification processes.

getUserKycStatus(chainId, ethereumAddress)

Retrieves the KYC status of a user based on their Ethereum address and the specified blockchain network.

  • Parameters:
    • chainId (Chain): The identifier of the blockchain network.
    • ethereumAddress (string): The user's Ethereum address.
  • Returns: Promise<IGetKycStatus>

setAiPriseVerificationUrl(chainId, ethereumAddress, verificationSessionId, verificationType)

Initiates the KYC verification process by setting the verification URL.

  • Parameters:
    • chainId (Chain)
    • ethereumAddress (string)
    • verificationSessionId (string)
    • verificationType (VERIFICATION_TYPE)
  • Returns: Promise<any>

getAccessTokenSignature(chainId, ethereumAddress, accessKey)

Obtains a signature for an access token.

  • Parameters:
    • chainId (Chain)
    • ethereumAddress (string)
    • accessKey (string)
  • Returns: Promise<AccessTokenSignatureResponse>

getZkMeAccessToken(chainId)

Fetches the ZkMe access token for the specified blockchain network.

  • Parameters:
    • chainId (Chain)
  • Returns: Promise<string>

userHasAccessToken(chainId, accessKey)

Checks if a user possesses a valid access token.

  • Parameters:
    • chainId (Chain)
    • accessKey (string)
  • Returns: Promise<{ hasAccessToken: boolean }>

afterKycCall(chainId, ethereumAddress, hasAccessTokenOnAnyChain)

Performs post-KYC operations after verification.

  • Parameters:
    • chainId (Chain)
    • ethereumAddress (string)
    • hasAccessTokenOnAnyChain (boolean)
  • Returns: Promise<{ updated: boolean }>

Password Management

Handles user password operations.

userHasPassword(chainId, ethereumAddress)

Checks if a user has a password set.

  • Parameters:
    • chainId (Chain)
    • ethereumAddress (string)
  • Returns: Promise<OptionalUserPassword>

userRegisterPassword(chainId, ethereumAddress, passwordHash)

Registers a password for a user.

  • Parameters:
    • chainId (Chain)
    • ethereumAddress (string)
    • passwordHash (string)
  • Returns: Promise<UserPassword>

Relay Operations

Manages transaction relaying.

getIdleRelay(chainId)

Retrieves an idle relay server for transaction processing.

  • Parameters:
    • chainId (Chain)
  • Returns: Promise<IGetIdleRelay>

callRelayerTransactAPI(chain, requestBody)

Sends a transaction request to the relay server.

  • Parameters:
    • chain (Chain)
    • requestBody (HinkalTransactionRequestBody)
  • Returns: Promise<any>

Price Retrieval

Fetches token prices from various sources.

getTokenPrice(chainId, erc20Address?, id?)

Retrieves the price of a specific ERC20 token.

  • Parameters:
    • chainId (Chain)
    • erc20Address (string, optional)
    • id (string, optional)
  • Returns: Promise<GetTokenPriceInterface>

getTokenPriceEth(chainId, id)

Gets the price of a token in ETH.

  • Parameters:
    • chainId (Chain)
    • id (string)
  • Returns: Promise<GetTokenPriceEthInterface>

getTokenPrices(chainId, erc20Addresses)

Retrieves prices for multiple ERC20 tokens.

  • Parameters:
    • chainId (Chain)
    • erc20Addresses (string[])
  • Returns: Promise<IGetPrices>

getOdosPriceForToken(chainId, tokenAddress)

Fetches the Odos price for a specific token.

  • Parameters:
    • chainId (Chain)
    • tokenAddress (string)
  • Returns: Promise<number | undefined>

callOdosAPI(chainId, requestBody)

Calls the Odos API for token swaps.

  • Parameters:
    • chainId (Chain)
    • requestBody (OdosSwapRequest)
  • Returns: Promise<any>

Coingecko Sub-Methods

getCoingeckoPrice(tokenId)

Retrieves the price of a token from Coingecko.

  • Parameters:
    • tokenId (string)
  • Returns: Promise<CoingeckoPriceResponse>

getCoingeckoPrice2(tokenAddress, platform)

Fetches the price based on token address and platform.

  • Parameters:
    • tokenAddress (string)
    • platform (string)
  • Returns: Promise<CoingeckoPriceResponse>

getCoingeckoPrices(tokenIds)

Retrieves prices for multiple tokens from Coingecko.

  • Parameters:
    • tokenIds (string)
  • Returns: Promise<CoingeckoPricesResponse>

getCoingeckoTokenList()

Gets the list of tokens available on Coingecko.

  • Returns: Promise<CoingeckoToken[]>

Transaction Management

Handles user transactions and their verification.

verificationStartDate(chainId, ethereumAddress)

Retrieves the start date for transaction verification.

  • Parameters:
    • chainId (Chain)
    • ethereumAddress (string)
  • Returns: Promise<IVerificationStartDate>

userGetTransactions(chainId, week?, lastHash?)

Fetches user transactions.

  • Parameters:
    • chainId (Chain)
    • week (number, optional)
    • lastHash (string, optional)
  • Returns: Promise<IUserGetTransactions>

userVerifyTransactions(chainId, transactionHashes, zkCallDataArray, backendToken, ethereumAddress, week)

Verifies user transactions.

  • Parameters:
    • chainId (Chain)
    • transactionHashes (string[])
    • zkCallDataArray (NewZkCallDataType[])
    • backendToken (string)
    • ethereumAddress (string)
    • week (number)
  • Returns: Promise<IUserVerifyTransactions>

Snapshots

Manages snapshots of commitments and access tokens.

fetchCommitmentsSnapshot(chainId)

Retrieves a snapshot of commitments.

  • Parameters:
    • chainId (Chain)
  • Returns: Promise<ICommitmentsTreeSnapshot>

fetchAccessTokenSnapshot(chainId)

Fetches a snapshot of access tokens.

  • Parameters:
    • chainId (Chain)
  • Returns: Promise<IAccessTokenTreeSnapshot>

restoreSnapshots(chainId)

Restores snapshots to the backend.

  • Parameters:
    • chainId (Chain)
  • Returns: Promise<any>

Nullifiers

Handles nullifier data for privacy operations.

fetchNullifiers(chainId)

Retrieves nullifiers from the backend.

  • Parameters:
    • chainId (Chain)
  • Returns: Promise<GetNullifiersResponse>

Risk Management

Evaluates the risk associated with user actions.

checkRisk(chain, address)

Checks the risk level for a specific address on a given chain.

  • Parameters:
    • chain (Chain)
    • address (string)
  • Returns: Promise<any>

Monitoring

Monitors user addresses for specific events or transactions.

monitor(address, chain)

Initiates monitoring for a user address.

  • Parameters:
    • address (string)
    • chain (Chain)
  • Returns: Promise<void>

Gas Estimates

Provides gas estimates for transactions.

getGasEstimates(chainId, tokenAddress, externalActionId, erc20TokenAddressLength, gasAmount?)

Retrieves gas estimates for a transaction.

  • Parameters:
    • chainId (Chain)
    • tokenAddress (string)
    • externalActionId (ExternalActionId)
    • erc20TokenAddressLength (number)
    • gasAmount (number, optional)
  • Returns: Promise<GetGasEstimateResponse> / End of Selection