Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rooot-browser-lib

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rooot-browser-lib

Browser library for the rooot project

  • 0.20.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

rooot-browser-lib

GitHub tag (latest by date) npm GitHub last commit GitHub issues NPM

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

Usage

npm i rooot-browser-lib

NB: The library is still under development, so ask us for installation guidelines.

Examples
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:

npm i -g live-server

License

The use of the Rooot™ libraries and executables are subject to fees for commercial purpose and to the respect of the BSD-2-Clause-Patent license. Please contact us to get further information.


© 2019-2022 Edgewhere SAS. All rights reserved.

FAQs

Package last updated on 22 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc