Giter Club home page Giter Club logo

contracts-js's Introduction

Orbs contracts js

npm version

Orbs contracts js is a library that provides easy to use interfaces to communicate with the Orbs contracts that are deployed on the Ethereum blockchain.

Installation

npm install @orbs-network/contracts-js

Usage

1.Initialize a web3 object (in this specific example we will use the 'ethereum provider' injected by MetaMask)

// MetaMask injects an ethereum provider straight to the window
import Web3 from "web3";

const ethereumProvider = (window as any).ethereum;
const web3 = new Web3(ethereumProvider as any);

2.Initialize an instance of a service (They all have the same constructor parameters)

import { IOrbsTokenService, OrbsTokenService } from '@orbs-network/contracts-js';

const orbsTokenService: IOrbsTokenService = new OrbsTokenService(web3);

3.Use the service to interact with the ethereum contracts in a js native way -- easy and convenient way to interact with the contracts that are deployed on Ethereum.

// Lets say this address holds 5,000 orbs
const myOrbsAccountAddress = '0x12BF4263560Ce9a3cADD20B0b36208d131b64f87';
const balance = await orbsTokenService.readBalance(myOrbsAccountAddress);

// will print "5000"
console.log(balance)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

ISC

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.