# @hancock/sdk-client-nodejs

> Client sdk for integration with hancock components

Latest version **1.0.0-alpha.44** (published 2019-04-04) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @hancock/sdk-client-nodejs
pnpm add @hancock/sdk-client-nodejs
yarn add @hancock/sdk-client-nodejs
bun add @hancock/sdk-client-nodejs
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-alpha.44 |
| Published | 2019-04-04 |
| First published | 2019-04-04 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=7.8.0 |
| Dependencies | 12 |
| Unpacked size | 15.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | bbva-ndb-hancock.group@bbva.com |
| Maintainers | bbva-ndb-rd, juansferrer |
| Keywords | hancock, sdk, client, nodejs |

## Links

- npm: https://www.npmjs.com/package/@hancock/sdk-client-nodejs
- Repository: https://github.com/BBVA/hancock-sdk-nodejs
- Homepage: https://github.com/BBVA/hancock-sdk-nodejs#readme
- Issues: https://github.com/BBVA/hancock-sdk-nodejs/issues
- npm.io page: https://npm.io/package/@hancock/sdk-client-nodejs

## Dependencies (12)

- [ws](https://npm.io/package/ws.md) ^5.0.0
- [web3](https://npm.io/package/web3.md) ^0.19.1
- [tslib](https://npm.io/package/tslib.md) ^1.9.3
- [deepmerge](https://npm.io/package/deepmerge.md) ^2.1.0
- [safe-buffer](https://npm.io/package/safe-buffer.md) ^5.1.2
- [bignumber.js](https://npm.io/package/bignumber.js.md) ^7.0.1
- [ethereumjs-tx](https://npm.io/package/ethereumjs-tx.md) ^1.3.4
- [eventemitter3](https://npm.io/package/eventemitter3.md) ^3.0.1
- [isomorphic-ws](https://npm.io/package/isomorphic-ws.md) ^4.0.0
- [isomorphic-fetch](https://npm.io/package/isomorphic-fetch.md) ^2.2.1
- [ethereumjs-wallet](https://npm.io/package/ethereumjs-wallet.md) ^0.6.0
- [web3-provider-engine](https://npm.io/package/web3-provider-engine.md) ^14.1.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.0-alpha.44 (latest) — 2019-04-04
- 1.0.0-alpha.43 — 2019-04-04
- 1.0.0-alpha.38 — 2019-04-04

## README

# Hancock SDK client

## Using this package

### Dependencies

This lib depends on ES6 Promises that are native in node. But you have to polyfill it in some browsers using `es6-promise` package.

### Installation

Once you have access to the kst registry:

```bash
  # with npm
  npm install --save es6-promise @hancock/sdk-client-nodejs

  # or using yarn
  yarn add es6-promise @hancock/sdk-client-nodejs
```

### Using all together

The main client is the [[HancockEthereumClient]] class. You have to instantiate it passing an [[HancockConfig]] configuration object
to indicate the client which hancock service it has to use.

Configuration object example:

```javascript
const config = {
  adapter: {
    host: 'http://localhost',
    port: '3000',
    base: '/'
  },
  wallet: {
    host: 'http://localhost',
    port: '3000',
    base: '/'
  },
  broker: {
    host: 'ws://localhost',
    port: '3000',
    base: '/'
  }
}
```

- In node:

```javascript
require('es6-promise').polyfill();
const HancockEthereumClient = require('@hancock/sdk-client').HancockEthereumClient

new HancockEthereumClient(config);
```

- In browser:

We need to include the ethereumjs-tx module as an external deependency before the sdk:

```html
<script src="https://raw.githubusercontent.com/ethereumjs/browser-builds/master/dist/ethereumjs-tx/ethereumjs-tx-1.3.3.min.js"></script>
```

And then use the sdk as an ES6 module (or in module bundlers like webpack)

```javascript
import * as es6Promise from 'es6-promise';
es6Promise.polyfill();

import { HancockEthereumClient } from '@hancock/sdk-client';
new HancockEthereumClient(config);
```

### Introduction and examples

[[HancockEthereumClient]] provides interfaces to interact with the blockchain 
allowing common operation like transfers, balance consulting or smart contract interactions. Take a look at the diferent sections of the [docs](https://BBVA.github.io/hancock-sdk-node/docs/index.html) to see examples of use:

- [[HancockEthereumWalletService]]
- [[HancockEthereumTransferService]]
- [[HancockEthereumTransactionService]]
- [[HancockEthereumSmartContractService]]
- [[HancockEthereumTokenService]]
- [[HancockProtocolService]]

---
_Source: https://npm.io/package/@hancock/sdk-client-nodejs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
