2.0.24 • Published 1 year ago

reserve-sdk v2.0.24

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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

2.0.24

1 year ago

2.0.23

2 years ago

2.0.19

2 years ago

2.0.22

2 years ago

2.0.20

2 years ago

2.0.21

2 years ago

2.0.18

2 years ago

2.0.16

2 years ago

2.0.15

2 years ago

2.0.14

2 years ago

2.0.13

2 years ago

2.0.12

2 years ago

2.0.11

2 years ago

2.0.10

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago