# rooot-browser-lib

> Browser library for the rooot project

Latest version **0.20.0** (published 2022-11-22) · BSD-2-Clause-Patent license · 0 weekly downloads

## Install

```sh
npm install rooot-browser-lib
pnpm add rooot-browser-lib
yarn add rooot-browser-lib
bun add rooot-browser-lib
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.20.0 |
| Published | 2022-11-22 |
| First published | 2020-08-23 |
| Weekly downloads | 0 |
| License | BSD-2-Clause-Patent |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 287.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Cyril Dever |
| Maintainers | plerouxpro, cdever, edgewhere-admin |

## Links

- npm: https://www.npmjs.com/package/rooot-browser-lib
- Repository: https://github.com/edgewhere/rooot-browser-lib
- Homepage: https://github.com/edgewhere/rooot-browser-lib#readme
- Issues: https://github.com/edgewhere/rooot-browser-lib/issues
- npm.io page: https://npm.io/package/rooot-browser-lib

## Dependencies (11)

- [axios](https://npm.io/package/axios.md) ^1.1.3
- [bip32](https://npm.io/package/bip32.md) ^2.0.6
- [fp-ts](https://npm.io/package/fp-ts.md) ^2.13.1
- [io-ts](https://npm.io/package/io-ts.md) ^2.2.19
- [monet](https://npm.io/package/monet.md) ^0.9.3
- [peeel](https://npm.io/package/peeel.md) ^1.1.9
- [ts-utls](https://npm.io/package/ts-utls.md) ^1.4.7
- [ecies-geth](https://npm.io/package/ecies-geth.md) ^1.6.7
- [es-normalizer](https://npm.io/package/es-normalizer.md) ^2.1.6
- [feistel-cipher](https://npm.io/package/feistel-cipher.md) ^1.4.1
- [@auth0/auth0-spa-js](https://npm.io/package/@auth0/auth0-spa-js.md) ^1.22.5

## Recent versions

- 0.20.0 (latest) — 2022-11-22
- 0.19.1 — 2022-03-14
- 0.19.0 — 2022-01-07
- 0.18.0 — 2021-11-09
- 0.17.1 — 2021-08-23
- 0.17.0 — 2021-04-13
- 0.16.3 — 2021-04-13
- 0.16.2 — 2021-04-07
- 0.16.1 — 2021-03-01
- 0.16.0 — 2021-02-03
- 0.15.1 — 2021-01-01
- 0.15.0 — 2020-12-27
- 0.14.0 — 2020-12-04
- 0.13.12 — 2020-11-26
- 0.13.11 — 2020-11-24
- … 14 more at https://npm.io/package/rooot-browser-lib/versions

## README

# rooot-browser-lib

![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/edgewhere/rooot-browser-lib)
![npm](https://img.shields.io/npm/dw/rooot-browser-lib)
![GitHub last commit](https://img.shields.io/github/last-commit/edgewhere/rooot-browser-lib)
![GitHub issues](https://img.shields.io/github/issues/edgewhere/rooot-browser-lib)
![NPM](https://img.shields.io/npm/l/rooot-browser-lib)

This library holds the common modules used by the Rooot&trade; system in TypeScript. It's specially suited for websites interacting with the blockchain.

### Usage

```console
npm i rooot-browser-lib
```
_NB: The library is still under development, so [ask us](mailto:contact@edgewhere.fr) for installation guidelines._

##### Examples

```typescript
import {
  AccountsRestClient, GatewayRestClient, MetadataRestClient, TermsRestClient, TransactionRestClient,
  buildOblivionTransaction, createOblivionTransaction, Vectors
} from 'rooot-browser-lib'

// Get all account information
const accountsRestClient = AccountsRestClient('http://localhost:3014')
accountsRestClient.getAccount(yourCredentials).then(account => {
  // Use its info, eg. list its vectors
  console.log(Vectors(account.vectors).list())
})

// Ask for the metadata
const metadataRestClient = MetadataRestClient('http://localhost:3013')
metadataRestClient.getMetadata().then(metadata => {
  // Use them
  console.log(metadata.lastBlockId, metadata.timestamp)
})

// Get a transaction from a depositary's gateway
const gatewayRestClient = GatewayRestClient('http://localhost:3030')
gatewayRestClient.getTransaction('1234567890abcdef[...]')
  .then(transaction => {
    // Do sth with it
    console.log(transaction)
  })
  .catch(err => {
    // Handle it
    console.error(err)
  })

// Know the latest terms of a smart contract
const termsRestClient = TermsRestClient('http://localhost:3004')
termsRestClient.getTerms(publicKey)
  .then(terms => {
    // Read them
    console.log(terms.status, terms.channel, terms.end, terms.maxUse)
  })

// Post an oblivion transaction
const transactionRestClient = TransactionRestClient('http://localhost:3003')
const oblivionTx = await transactionRestClient.getMetadata()
  .then(([metadata, beneficiary]) => buildBaseOblivion(optinTx, optoutTx.transactionId, metadata, emitter, beneficiary)
    .then(createOblivionTransaction)
  )
transactionRestClient.sendOblivion(oblivionTx)

// Get the IDs of the 10 last blocks
const gatewayRestClient = GatewayRestClient('http://localhost:3030')
gatewayRestClient.last10Blocks()
  .then(blockIds => {
    // Do sth with them
    console.log(blockIds.includes(transaction.lastBlockId))
  })
```


### Dependencies

To run the tests, you would need to install [`live-server`](https://www.npmjs.com/package/live-server):
```console
npm i -g live-server
```


### License

The use of the Rooot&trade; libraries and executables are subject to fees for commercial purpose and to the respect of the [BSD-2-Clause-Patent license](LICENSE).
Please [contact us](mailto:contact@edgewhere.fr) to get further information.


<hr />
&copy; 2019-2022 Edgewhere SAS. All rights reserved.

---
_Source: https://npm.io/package/rooot-browser-lib · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
