Giter VIP home page Giter VIP logo

origin-js's Introduction

origin_github_banner

origin_npm_version origin_license origin_travis_banner

Head to https://www.originprotocol.com/developers to learn more about what we're building and how to get involved.

origin-js

origin-js is a library of javascript code and Ethereum smart contracts which allow anyone to create decentralized marketplaces, including for fractional usage. It is an open source project created by Origin Protocol.

โš ๏ธ This is an alpha version which is not suitable for production environments.

Documentation

origin-js documentation

Demo

origin-js is showcased in our Demo DApp currently running on the Rinkeby testnet.

Using origin-js in your project

As a node package

npm install origin --save

or

yarn add origin

Plain javascript

A browser-compatible plain javascript file origin.js is available in the Releases section. A hosted version can be directly included in your html as:

<script src="https://code.originprotocol.com/origin-js/origin-v0.7.1.js"></script>

npm build will generate this file and save it to dist/origin.js.

Local development

Fully integrated with origin-dapp and origin-bridge

We recommend using Origin Box for development and testing on your local machine. This saves you the headache of spinning up several environments and running multiple, different processes.

  1. Clone this repo.
git clone https://github.com/OriginProtocol/origin-js.git && cd origin-js
  1. Install dependencies and link by running npm run install:dev. This script is a shortcut for npm install && npm link. Linking means that changes to origin-js code are immediately available to local DApps without an npm install.

  2. Start the local blockchain and build origin-js by running npm start. Code changes will trigger a live rebuild.

  3. To interact with your local origin-js and local blockahin, see the instructions in our Demo DApp.

Tests

Command Line (All Tests)

Our full test suite can be run with:

npm run test

Note: you should not have the server running at this time, as these tests start their own local blockchain instance.

Command Line (Non-Solidity Tests)

To run non-contract tests (test/**.js):

npm run test:js

To run non-contract tests and automatically re-run when files change:

npm run test:jsw

Command Line (Only Solidity Tests)

Our Solidity tests (which use Truffle) are located at contracts/test.

npm run test:contracts

Note: you should not have the server running at this time, as these tests start their own local blockchain instance.

To run contract tests and automatically re-run when files change:

npm run test:contractsw

To run contract tests and measure test coverage of Solidity code:

npm run test:contracts-coverage

Browser Tests

A subset of our tests can be run from the browser. These tests are automatically served at http://localhost:8081 when you run npm start. These tests are automatically rerun when source or test code is changed.

Run a subset of these tests using the grep query string parameter, for example: http://localhost:8081/?grep=IpfsService

Using the Ganache GUI

By default, starting origin-js locally starts ganache-cli automatically. However, for development you might want to connect to the GUI version of Ganache. This provides a nice interface for browsing your local blockchain activity and can be useful for debugging.

To use the Ganache GUI:

  1. Install Ganache
  2. Start Ganache
  3. Navigate to the settings in Ganache (click on the gear in the upper right-hand corner)
  4. Set Port Number to 8545
  5. Set Network ID to 999
  6. Under the Accounts & Keys tab, set the mnemonic to candy maple cake sugar pudding cream honey rich smooth crumble sweet treat
  7. When starting origin-js locally, run npm run start:no-ganache (instead of npm run start)

Troubleshooting

Python 3

If you have Python 3 installed, you may see this error when installing dependencies:

gyp ERR! stack Error: Python executable "/Users/aiham/.pyenv/shims/python" is v3.6.4, which is not supported by gyp.

Resolve this by configuring npm to use Python 2 (where python2.7 is a binary accessible from your $PATH):

npm config set python python2.7

Contributing

Origin is an 100% open-source and community-driven project and we welcome contributions of all sorts. There are many ways to help, from reporting issues, contributing code, and helping us improve our community.

To get involved, please join our Discord channel and review our guide to contributing.

origin-js's People

Contributors

tyleryasaka avatar wanderingstan avatar danielvf avatar joshfraser avatar micahalcorn avatar aiham avatar ambertch avatar franckc avatar cuongdo avatar nick avatar sparrowdom avatar jordajm avatar crazybuster avatar jsulinski avatar ryana avatar tomlinton avatar jessieay avatar conejoninja avatar mek32390 avatar

Watchers

James Cloos avatar  avatar

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.