Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • ci-impr
  • improve-subscriptions
  • fix-config-being-mutated-error
  • add-support-for-additiona-http-headers
  • full-type-generation
  • ts/auto-sign-state
  • better-deposit-withdrawal-handling
  • 5.0.5
  • docs2
  • mpc-support
  • docs
  • ch/env2
  • ch/docs-fix
  • ts/prepare_movement
  • unionType
  • fix_2fa_not_being_mutation
  • updateObjectParams
  • v5.0.27
  • v5.0.25
  • v5.0.23
  • v5.0.21
  • v5.0.19
  • v5.0.17
  • v5.0.15
  • v5.0.11
  • v5.0.9
  • v5.0.7
  • v5.0.5
  • v5.0.3
  • v5.0.1
  • v0.4.6
  • v0.4.4
  • v0.4.2
  • v0.3.3
  • v4.0.6
  • v0.2.1
  • v4.0.4
38 results

api-client-typescript

  • Clone with SSH
  • Clone with HTTPS
  • tom's avatar
    localhuman authored
    442fc05c
    History

    api-client-typescript

    Official TypeScript client for interacting with the Nash Exchange.

    To test your integrations, Nash provides a public sandbox environment at https://app.sandbox.nash.io. When creating an account on the sandbox, use the referral code DEMORC.

    NOTE: In the sandbox, testnet funds are sent to new accounts automatically. The environment is automatically reset every four days.

      apiURI: 'https://app.sandbox.nash.io/api',
      casURI: 'https://app.sandbox.nash.io/api/graphql'

    Getting started

    To install, download a release bundle or install it from NPM:

    yarn add @neon-exchange/api-client-typescript

    If you install it from a release bundle (or Git), install the dependencies and run yarn link in order to use it just like the module from NPM:

    unzip api-client-ts-task-bundle.zip cd api-client-ts-task-bundle yarn install yarn link cd ..

    Usage

    import { Client } from '@neon-exchange/api-client-typescript';
    
    const nash = new Client({
      apiURI: 'path_to_nash_api',
      casURI: 'path_to_nash_cas',
      debug: false
    });
    
    const markets = nash.listMarkets();
    console.log(markets);

    Authentication

    Most Nash API requests require the client to be authenticated. This is needed to sign the payloads being sent over the wire.

    import { Client, CryptoCurrency } from '@neon-exchange/api-client-typescript';
    
    const nash = new Client({
      apiURI: 'path_to_nash_api',
      casURI: 'path_to_nash_cas',
      debug: false
    });
    
    const email = 'user@email.com';
    const password = 'userpassword';
    
    const run = async () => {
      try {
        await nash.login(email, password);
    
        const balance = await nash.getAccountBalance(CryptoCurrency.NEO);
        console.log(balance);
      } catch (e) {
        console.error(e);
      }
    };
    
    run();

    For more function documentation, see docs/classes/_client_client_.client.html