Giter VIP home page Giter VIP logo

gnosis.js's Introduction

Gnosis.js Library

Logo

Build Status

Slack Status

Really quick start

  1. Get TestRPC
  2. Run this:
    testrpc -d -i 437894314312
    
  3. Clone Gnosis contracts, cd in there, and migrate the contracts onto the TestRPC instance with:
    cd path/to/gnosis-contracts
    npm install
    npm run migrate
    
  4. Download gnosis.js and put it in an HTML file:
    <script src=gnosis.js></script>
    
  5. Follow some tutorials:

Installation

Run npm install to install dependencies.

Needs a Web3 provider to work. For testing, try TestRPC.

Development

Before you begin, you will want to have the contracts deployed on the chain you plan to use. You can deploy contracts through the RPC interface on localhost:8545 with

npm run migrate

The build process using Truffle will insert the chain locations in a networks key on the contract build artifacts.

Building

You can run npm run nodebuild to build the library for Node.js use.

You can also run npm run webbuild to build the library targeting the web. Note that this will compile in all network information present in the build artifacts, including temporary network information generated by TestRPC during migrations. You may use npm run netreset beforehand to remove unofficial network info and reset to official deployed locations if desired.

Running the dev server

Run npm run dev to run the dev server and serve the examples. The library source will be continuously recompiled. Examples will be available on http://localhost:8080. Don't forget to refresh the page after you change the source.

Running the tests

Run npm test to run test suite. This should run without the need of an RPC provider running on localhost:8545. If you already have such a provider running and wish to run the test suite without automatically spinning up TestRPC and causing a chain migration, use npm run test-manual.

You may also provide mocha options through the MOCHA_OPTS environment variable, e.g. MOCHA_OPTS='-g estimate' npm test.

Documentation

API documentation and tutorials can be found hosted online at https://gnosis.github.io/gnosis.js/

Running the docs

Run npm run doc to build and open a local build of the documentation in your browser.

Web3 options

The methods on the API can be provided with from, to, value, gas, and gasPrice options which get passed down to the web3.js layer.

Gas estimations

Many of the methods on the gnosis API also have an asynchronous estimateGas property which you can use, while allowing you to specify the gas estimation source. For example:

// using the estimateGas RPC
await gnosis.createCentralizedOracle.estimateGas(ipfsHash, { using: 'rpc' }))

// using stats derived from gnosis-contracts
await gnosis.createCentralizedOracle.estimateGas({ using: 'stats' }))

gnosis.js's People

Contributors

cag avatar collinc97 avatar denisgranha avatar andre-meyer avatar georgi87 avatar

Watchers

James Cloos avatar David Van Isacker 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.