Giter VIP home page Giter VIP logo

stellar-deprecated / stellar-lib Goto Github PK

View Code? Open in Web Editor NEW
56.0 23.0 20.0 11.18 MB

INACTIVE. JS library to facilitate talking to stellard. This repository is not in active development. It points to the stellard network, which is being replaced by stellar-core. Please refer to the replacement repository, js-stellar-lib, which points to the stellar-core network.

License: Other

JavaScript 99.15% C++ 0.85% Batchfile 0.01%

stellar-lib's Introduction

INACTIVE. This repository is not in active development. It points to the stellard network, which is being replaced by stellar-core. Please refer to the replacement repository, js-stellar-lib, which points to the stellar-core network.

#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
  $ cd 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:    'live.stellar.org'
      , port:    9001
      , 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/.

stellar-lib's People

Contributors

abrkn avatar ahbritto avatar anderssonfilip avatar anfedorov avatar bartekn avatar bekkibolthouse avatar emoitzi3 avatar emschwartz avatar geertweening avatar guillelopezgines avatar irisli avatar jatchili avatar joelkatz avatar justinlynn avatar justmoon avatar marco89nish avatar miracle2k avatar mjethani avatar moeadham avatar monsieurnicolas avatar nullstyle avatar sergey-pf avatar shekenahglory avatar sublimator avatar sunny-g avatar thejollyrogers avatar vhpoet avatar vincenttide avatar vinniefalco avatar wltsmrz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stellar-lib's Issues

transaction.submit() fails silently on 'account not found' error

I'm playing around with this lib and everything went fine until I went to take an action that required a key pair (account id and secret). It was failing silently with no stack trace or error output for the "submit transaction" example. I was at a loss until I set the trace option on the Remote object and saw that "account not found" errors were occurring, but not getting reported in my callback.

Apologies for that lack of detail on reproducing this, I have since moved past it and was only reminded a couple hours after to submit this. It should be reproducible by using an invalid key pair on the set_secret() method when making a transaction.

Sample for signing initiated in a browser?

According to the description and all the API notes, it should be trivial to use a web page to sign a transaction without sending ANYTHING to a server using stellar-lib.

However, it is made non trivial because we really don't have a clue where to start.

Is it possible to create a demonstration of this with notes as to how to use it, for example, in a mobile app?

Modify lib tests to work with stellar addresses

Lib tests have lots of hard-coded ripple addresses, we need to convert those to stellar addresses for tests to pass. Ripple address can be converted to corresponding stellar address by swapping all occurrences of 'g' and 'r'. String stellarAddr = rippleAddr.replaceAll('r', '0').replaceAll('g', 'r').replaceAll('0', 'g');

make local_signing the default

We should not default stellar-lib to a mode where the secret gets sent over the wire. This task is to confirm local_signing is the default, and if not, make it the default.

Stellar problems in the browser

Here are the details when the page loads:

Uncaught Error: Cannot find module "lru-cache" stellar-0.9.0.js:130
  webpackMissingModule stellar-0.9.0.js:130
  (anonymous function) stellar-0.9.0.js:130
  __webpack_require__ stellar-0.9.0.js:21
  (anonymous function) stellar-0.9.0.js:48
  __webpack_require__ stellar-0.9.0.js:21
  (anonymous function) stellar-0.9.0.js:41
  (anonymous function) stellar-0.9.0.js:44

and when you try to set up the remote properties:

TypeError: Cannot read property 'Remote' of undefined

Add travis (will reward 0.25 BTC)

This library is very broken. Tests are not even close to passing. I'll pay 0.25 BTC to whoever can get this on travis + all tests passing.

Implement exponential backoff when trying to connect to stellard

Currently, it appears that stellar-lib will try to connect every second if the server is down.

Instead, we should implement exponential backoff so that we don't overload a server as it is trying to come up from a failed state with a horde of connection attempts

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.