Giter VIP home page Giter VIP logo

stellar-lib's Introduction

#The Stellar JavaScript Library

stellar-lib connects to the Stellar network via the WebSocket protocol. It runs in Node.js or in the browser.

###Use stellar-lib for:

  • Connecting to a local or remote stellard in JavaScript (Node.js or browser)
  • Issuing stellard API requests
  • Listening to events on the stellar network (transaction, ledger, etc.)
  • Signing and submitting transactions to the stellar network

###In this file:

  1. Overview
  2. Getting stellar-lib
  3. Quickstart
  4. Running tests

###For additional documentation see:

  1. The stellar-lib Guides (docs/GUIDES.md)
  2. The stellar-lib API Reference (docs/REFERENCE.md)

###Also see:

##Getting stellar-lib

Via npm for Node.js

  $ npm install stellar-lib

Build from the source using gulp

  $ git clone https://github.com/stellar/stellar-lib
  $ npm install
  $ gulp

Then use the minified build/stellar-*-min.js in your webpage

##Quickstart

Remote (remote.js) is the module responsible for managing connections to stellard servers:

/* Loading stellar-lib with Node.js */
var Remote = require('stellar-lib').Remote;

/* Loading stellar-lib in a webpage */
// var Remote = stellar.Remote;

var remote = new Remote({
  // see the API Reference for available options
  trusted:        true,
  local_signing:  true,
  local_fee:      true,
  fee_cushion:     1.5,
  servers: [
    {
        host:    's1.stellar.com'
      , port:    443
      , secure:  true
    }
  ]
});

remote.connect(function() {
  /* remote connected */

  // see the API Reference for available functions
});

See The stellar-lib Guides and The stellar-lib API Reference for walkthroughs and details about all of the available functions and options.

##Running tests

  1. Clone the repository

  2. cd into the repository and install dependencies with npm install

  3. npm test or make test or node_modules\.bin\mocha test\*-test.js

Generating code coverage

stellar-lib uses istanbul to generate code coverage. To create a code coverage report, run npm test --coverage. The report will be created in coverage/lcov-report/.

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.