cbs-proxy-client
Client that creates functions for the cbs-proxy.
Last updated a year ago by rynobey .
MIT · Original npm · Tarball · package.json
$ cnpm install cbs-proxy-client 
SYNC missed versions from official npm registry.

cbs-proxy-client

Tests: CircleCI

Introduction

A simple javascript library to interact with the cbs-proxy.

Getting started

Testing

  1. Run Cyclos.
  2. Run the cbs-proxy
  3. npm test

Usage

npm install cbs-proxy-client

const { createCbsProxyObject } = require('cbs-proxy-client')

// this object handles authentication and manages session tokens for you.
const proxyClient = await createCbsProxyObject('admin', 'abcd', 'http://localhost:4000')

// get all transfers after a certain timestamp
const primaryAccountToTransfersSinceTimestamp = await proxyClient.getTransfersToPrimaryAccount(1533077567.294)
const primaryAccountFromTransfersSinceTimestamp = await proxyClient.getTransfersFromPrimaryAccount(1533077567.294)

Pure versions of all the functions can also be used.

Pure functions are useful since you can use them anywhere in your code without needing to pass around a stateful object.

The below code effectively does the same thing as the previous example:

const { getSessionToken, getPrimaryAccountId, getTransfersToPrimaryAccountPure, getTransfersFromPrimaryAccountPure } = require('cbs-proxy-client')

// get authentication token, and your primaryAccountId
const sessionToken = await getSessionToken('admin', 'abcd', 'http://localhost:4000')
const primaryAccountId = await getPrimaryAccountId(sessionToken, 'http://localhost:4000')

// get all transfers after a certain timestamp
const primaryAccountToTransfersSinceTimestamp = await getTransfersToPrimaryAccountPure(sessionToken, primaryAccountId, 'http://localhost:4000', 1533077567.294)
const primaryAccountFromTransfersSinceTimestamp = await getTransfersFromPrimaryAccountPure(sessionToken, primaryAccountId, 'http://localhost:4000', 1533077567.294)

Current Tags

  • 0.1.0                                ...           latest (a year ago)

13 Versions

  • 0.1.0                                ...           a year ago
  • 0.1.0-testing                                ...           2 years ago
  • 0.1.0-experimental                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5-transition-2                                ...           2 years ago
  • 0.0.5-transition                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.4-test1                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
  • 0.0.0                                ...           2 years ago
Downloads
Today 0
This Week 1
This Month 9
Last Day 0
Last Week 1
Last Month 3
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |