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

gemini-cryptoexchange-api

v0.4.0

Published

Simple typescript interface to the Gemini cryptoexchange.

Downloads

26

Readme

About

This package provides a modern javascript solution for interfacing with the Gemini cryptoexchange API. Currently, only the REST API has been implemented. Support for for the Push API is in the works.

This library is intended to be used with ES6, TypeScript, etc. In the interest of moving towards the more-readable async/await pattern, callbacks are not supported. Only native Promise-based interaction is supported.

This library does not track your request rate. Gemini throttles/disables api access if the request rate exceeds certain limits. It is the responsibility of the user to track rate limits.

Getting Started

Install

npm
npm i gemini-cryptoexchange-api
yarn
yarn add gemini-cryptoexchange-api

Quick Start

TypeScript
import { getClient, IGeminiClient } from 'gemini-cryptoexchange-api';

const main = async (): Promise<{}> => {
    try {
        const client: IGeminiClient = getClient({
            publicKey : '', // Your public key
            privateKey: '', // Your private key
        });

        const { status, data } = await client.getAvailableBalances();
        return Promise.resolve(data);
    } catch (err) {
        return Promise.reject(err);
    }
};

main().then(data => console.log(data))
      .catch(err => console.error(err));
JavaScript

This example shows usage without async/await.

const gemini = require('gemini-cryptoexchange-api');

const client = gemini.getClient({
    publicKey : '', // Your public key
    privateKey: '', // Your private key
});

client.getAvailableBalances()
      .then(response => {
          const { status, data } = response;
          console.log(data);
      })
      .catch(err => console.error(err));

Note: the remainder of this README.md will use TypeScript examples.

API Detail

All endpoints are available via the client. If authentication keys are provided during client construction, public and private endpoints will succeed. If no keys are given, only public endpoints will succeed. Private endpoints will return a promise rejection when not authenticated, so be sure to properly trap your errors.

No attempt is made to mitigate private calls when not authenticated. It is the responsibility of the user to trap any errors resulting from incorrect/invalid authentication.

A few convenience properties and methods are provided:

rawAgent

This gives the user access to the underlying request forwarder. While not very useful to a user, it does expose the request signing algorithm via rawAgent#signMessage.

isUpgraded()

This method returns a boolean corresponding to whether or not the user has provided API keys to the client.

upgrade()

This method allows a user to upgrade a public client with credentials. If the client already has credentials, this method will replace the existing keys.

Public Requests

In order to place requests with public endpoints, simply instantiate the client with no parameters:

const client: IGeminiClient = getClient(); 

Private Requests

Authentication

In order to authenticate a client with the Gemini API, a private request must provide a public key and a correctly signed request. This library handles request signatures - the user simply provides a public/private key pair. You can generate your own API keys through the Gemini interface.