Skip to content

clover-network/clover-rosetta-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rosetta

Rosetta SDK

NodeJS Rosetta SDK to create and interact with Rosetta API Implementations

RosettaSDK (JS) [experimental]

Supported Rosetta Protocol Version: 1.4.1

This project is a port of the official Go reference implementation. All features, except a few exceptions, have been ported to JS.

Motivation

Coinbase's Official Go Reference Implementation is a thouroughly tested and wonderful SDK Implementation. However, as many developers are better suited to use NodeJS/Javascript, DigiByte decided to port the reference implementation to NodeJS while maintaining support for all it's core components.

Documentation

Prerequisites

  • NodeJS >= 10.6
  • NPM >= 6.10.0

The code was written on a Mac, so assuming all should work smoothly on Linux-based computers. However, there is no reason not to run this library on Windows-based machines. If you find an OS-related problem, please open an issue and it will be resolved.

Installation

npm install --save rosetta-node-sdk

Tests

This project is thoroughly tested using > 300 automated tests. Run npm run test to see how they all work out.

Usage

All Core components are accessible as follows:

const RosettaSDK = require('rosetta-node-sdk');
const {
  Asserter,
  Server,
  Reconciler,
  Client,
  Fetcher,
  Syncer,
  Parser,
  SyncerEvents,
  Errors,

  Utils,
  InternalModels,

  logger,

  version, // '1.4.1'
} = RosettaSDK;

Components

  • Asserter - Syntactical and semantical type validator. This Asserter can be used to validate Requests/Responses. Constructors exist that ease the creation of an asserter. For example, NewClientWithResponses can be used in order to create a server validator by only passing the network responses.
  • Server - The Server Component eases the development of a custom server implementation. Examples on how to build such a server are located in examples.
  • Reconciler - Use the Reconciler in order to validate that the balances computed by parsing the blocks are the equal to the balances computed by a node.
  • Client - Client request library rosetta-node-sdk-client
  • Fetcher - Convenience Wrapper Class for Client
  • Syncer - Makes use of Fetcher class in order to download blocks in logical order.
  • Parser - Parses and groups BalanceOperations of a block.
  • SyncerEvents - Syncer Events. Mainly BLOCK_ADDED, BLOCK_REMOVED, SYNC_CANCELLED
  • Errors - Error Classes for the different components: AsserterError, FetcherError, InputError, ParserError, InternalError, ReconcilerError, SyncerError.
  • Utils - Utility functions, commonly used internally by the core components.
  • InternalModels - Models, that are commonly used internally.
  • logger - Default Logger Singleton Class.
  • version - Specifies the version of this SDK. This semver is equal to the Rosetta API SDK for convencience.

ToDos

  • Setup CI (npm run test will execute 313 tests)
  • Support keys (cryptographic API)
  • Documentation
  • Test Reconciler in live environment

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published