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

reserve-sdk

v2.0.24

Published

Simple sdk for reserve

Downloads

29

Readme

Reserve SDK


Installation

npm i reserve-sdk

Usage

Custom headers

// auth headers
Sdk_Instance.setAuthToken('auth_token')

Sdk_Instance.setXReserveAuth('x_reserve_auth_value');

console.log(Sdk_Instance.getHeaders());

// custom headers
Sdk_Instance.setCustomHeader('x-reserve-auth', 'value');

Sdk_Instance.setCustomHeader('custom_header', 'custom_value');

console.log(Sdk_Instance.getHeaders());

Methods

Health check

Allows to perform a healthcheck request
import {Reserve_SDK} from 'reserve-sdk';
     
const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
const res = await Sdk_Instance.healthcheck();

Check-in

Allows AUTHENTICATED users to perform check-in request
import {Reserve_SDK} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("admin_or_trader_token");
const res = await Sdk_Instance.checkin();

Trader demo signin

Allows to obtain demo TRADER authentication token for specified username
import {Reserve_SDK} from 'reserve-sdk';
     
const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
const res = await Sdk_Instance.trader_demo_signin({username:"example_1_2_3"});

Admin demo signin

Allows to obtain demo ADMIN authentication token for specified username
import {Reserve_SDK} from 'reserve-sdk';
     
const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
const res = await Sdk_Instance.admin_demo_signin({username:"example_1_2_3"});

Service demo signin

Allows to obtain demo SERVICE authentication token for specified username
import {Reserve_SDK} from 'reserve-sdk';
     
const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
const res = await Sdk_Instance.service_signin({service_api_key:"example_1_2_3",service_api_secret:"example_4_5_6"});

Get users

Allows ADMINS to get users that can be filtered by multiple parameters
import {Reserve_SDK} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("admin_token");
const users = await Sdk_Instance.get_users({username: 'y', pager: {limit: 3}});

Get user info

Update user

Get account balances

Allows AUTHENTICATED users to get account balance

Trader - no args are required

import {Reserve_SDK} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("trader_token");
const accounts_balances_trader = await Sdk_Instance.get_account_balances();

Admin - user_id arg is required

import {Reserve_SDK} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("admin_token")
const accounts_balances_admin = await Sdk_Instance.get_account_balances({user_id: '3e8a836f-9bf5-4915-8c0b-e628396740bf'});

Create conversion quote

Allows AUTHENTICATED users to get estimated conversion quote
import {Reserve_SDK} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("admin_or_trader_token");
const conversion_quote = await Sdk_Instance.create_conversion_quote({source_currency_id: 'BTC', target_currency_id: 'USDT', source_currency_amount: 30});

Create conversion order

Allows AUTHENTICATED to execute estimated conversion_quote
import {Reserve_SDK} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("admin_or_trader_token");
const res = await Sdk_Instance.create_conversion_order({conversion_quote_id: 'your_conversion_quote_id'});

Create account transaction

Allows ADMINS to create new transactions
import {Reserve_SDK} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken('your_admin_token');
const res = await Sdk_Instance.create_account_transaction({
    items: [
        {
            user_id: '3e8a836f-9bf5-4915-8c0b-e628396740bf',
            currency_id: 'USDT',
            amount: 150,
            transaction_class: 'payment',
            comment: 'Example 1 2 3',
            type: 'credit',
        },
        {
            user_id: '3e8a836f-9bf5-4915-8c0b-e628396740bf',
            currency_id: 'USDT',
            amount: 100,
            transaction_class: 'reward',
            comment: 'Example 1 2 3',
            type: 'debit',
         },
    ],
});

Get instruments

Allows to get detailed data about instruments
import {Reserve_SDK, InstrumentHistoryPeriodicity} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
const res = await Sdk_Instance.get_instruments({
   periodicity: InstrumentHistoryPeriodicity['day'],
   limit: 3,
});

Get instruments price bars

Allows to get detailed price bars data about specified instrument
import {Reserve_SDK, InstrumentHistoryPeriodicity} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
const res = await Sdk_Instance.get_instrument_price_bars({
    instrument_id: 'BTCUSDT',
    periodicity: InstrumentHistoryPeriodicity.day,
    limit: 3,
});

Generate deposit address crypto

Allows AUTHENTICATED users to create generate new crypto deposit addresses

Trader

import {Reserve_SDK} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("trader_token");
const res = await Sdk_Instance.deposit_address_crypto({network: 'example_network', currency_id: 'BTC'});

Admin - user_id arg is required

import {Reserve_SDK} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("admin_token")
const res = await Sdk_Instance.deposit_address_crypto({
    currency_id: 'BTC',
    user_id: 'example_user_id',
    network: 'example_network',
});

Create fiat withdrawal

Allows AUTHENTICATED users to create fiat withdrawals

Trader

import {Reserve_SDK} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("trader_token");
const res = await Sdk_Instance.create_withdrawal_fiat({
     amount: 0.5,
     currency_id: 'USD',
     fiat_bank_bic: 'example_fiat_bank_bic',
     fiat_bank_name: 'example_fiat_bank_name',
     fiat_beneficiary_name: 'example_fiat_beneficiary_name',
     fiat_beneficiary_account_number: 'example_fiat_beneficiary_account_number',
});

Admin - user_id arg is required

import {Reserve_SDK} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("admin_token")
const res = await Sdk_Instance.create_withdrawal_fiat({
     user_id: 'example_user_id',
     amount: 0.5,
     currency_id: 'USD',
     fiat_bank_bic: 'example_fiat_bank_bic',
     fiat_bank_name: 'example_fiat_bank_name',
     fiat_beneficiary_name: 'example_fiat_beneficiary_name',
     fiat_beneficiary_account_number: 'example_fiat_beneficiary_account_number',
});

Get conversions

Allows AUTHENTICATED users to get conversions history

Trader

import {Reserve_SDK} from 'reserve-sdk';
     
const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("trader_token");
const res = await Sdk_Instance.get_conversions({
   source_currency_id: 'BTC',
   target_currency_id: 'ETH',
   pager: {limit:3,offset:1},
   dateRange: {
      time_from: '2022-07-28 16:20:01',
      time_to: '2022-08-02 18:40:05',
   }
});

Admin

import {Reserve_SDK} from 'reserve-sdk';
     
const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("admin_token")
const res = await Sdk_Instance.get_conversions({
   user_id:'example_user_id',
   source_currency_id: 'BTC',
   target_currency_id: 'ETH',
   pager: {limit:3,offset:1},
   dateRange: {
      time_from: '2022-07-28 16:20:01',
      time_to: '2022-08-02 18:40:05',
   }
});

Get payments

Allows AUTHENTICATED users to get payments history

Trader

import {Reserve_SDK,PaymentType,PaymentStatus} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("trader_token");
const res = await Sdk_Instance.get_payments({
        currency_id: 'ETH',
        type: PaymentType.deposit,
        status: [PaymentStatus.completed, PaymentStatus.rejected],
        pager: {limit:3,offset:1},
        dateRange: {
        time_from: '2022-07-28 16:20:01',
        time_to: '2022-08-02 18:40:05',
    }
});

Admin

import {Reserve_SDK,PaymentType,PaymentStatus} from 'reserve-sdk';

const Sdk_Instance = new Reserve_SDK("your_graphQL_endpoint");
Sdk_Instance.setAuthToken("admin_token");
const res = await Sdk_Instance.get_payments({
        user_id: 'example_user_id',
        currency_id: 'ETH',
        type: PaymentType.deposit,
        status: [PaymentStatus.completed, PaymentStatus.rejected],
        pager: {limit:3,offset:1},
        dateRange: {
        time_from: '2022-07-28 16:20:01',
        time_to: '2022-08-02 18:40:05',
    }
});

Get payments routes