Git Product home page Git Product logo

rosetta-sdk-typescript's Introduction

Rosetta

Rosetta SDK

Typescript SDK to create and interact with Rosetta API implementations (WORK IN PROGRESS!)

Version Downloads/week License Build Status Coverage Status Api Doc

Overview

The rosetta-sdk-typescript provides an easy to use and extend Express server ready to serve your Rosetta typescript implementation for your blockchain.

Much of the code in this repository is generated from the rosetta-specifications.

Documentation

Before diving into the SDK, we recommend taking a look at the Rosetta API Docs:

Packages

  • OpenApi: Auto-generated Rosetta types, including api clients and server service extension points. Don't modify this code!
  • Client: Low-level communication with any Rosetta server. Main class is RosettaRestClientFactory.
  • Server: Simplified Rosetta API server development. Main class is RosettaServer. This SDK uses and Express server integrated with express-openapi-validator.

This current SDK implementation is not complete, most GO's sdk packages should be implemented in typescript.

Usage

Install this package:

npm install rosetta-sdk-typescript@alpha

The following script shows how to create a Rosetta Express server:

import { RosettaServer } from './server';

// The factory you need to provide that creates the services connecting to your blockchain client/node
const apiServiceFactory = new MyBlockchainApiServiceFactory(); 

new RosettaServer({ apiServiceFactory }).start(8080).catch((e) => {
    console.error(e);
});

The following script shows how to create a Rosetta network client:

import { RosettaRestClientFactory } from 'rosetta-sdk-typescript';

const restClientFactory = new RosettaRestClientFactory({
    url: 'http://localhost:8080',
});

const networkClient = restClientFactory.network();
const networkList = await networkClient.networkList({
    metadataRequest: {},
});
console.log(JSON.stringify(networkList, null, 2));

Development

  • npm install to install dependencies
  • npm run gen to generate types and helpers
  • npm test to run tests
  • npm style:fix to pretty, index, and lint the source code (including generated code)

License

This project is available open source under the terms of the Apache 2.0 License.

© 2021 Fernando Boucquez

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.