DIRT Protocol

DIRT Protocol

  • Docs
  • Help
  • Github

›DIRT Lib

Overview

  • About DIRT

Getting Started

  • Local Setup with Docker
  • Create Your First Project

Protocol

  • Overview
  • Sample Scenarios

Smart Contracts

  • DIRT Contract Architecture
  • DIRT Contract Classes
  • Ropsten Setup
  • Ropsten Deployment

DIRT Lib

  • DIRT Lib - Typescript Library
  • DIRT Lib Reference

Sample Projects

  • Sample Projects

DIRT Lib - Typescript Library

DIRTlib is a Typescript client library that makes it simple and easy to interact with the DIRT smart contracts.

Installing the library

@dirt/lib

npm install --save '@dirt/lib'

Getting a Web3 instance

You will need a Web3 instance to use DIRT lib.

For offline transactions (without MetaMask):

let provider = new HDWalletProvider('PRIVATE_KEY_HERE', 'ETHEREUM_NODE_URL')
let web3 = new Web3(provider)
web3.eth.defaultAccount = 'ACCOUNT_OF_PRIVATE_KEY_HERE'

When MetaMask is installed, Web3 will be automatically injected and available at window.web3.

To use MetaMask, see the sample web app or check out MetaMask's developer guide.

Instantiating DIRT

import { Dirt } from "@dirt/lib";

let dirt = await Dirt.create({
    rootAddress: DIRT_ROOT_CONTRACT_ADDRESS,
    web3: web3
})

For the root contract address, a deployed RootRegistry contract or use the your own deployed contract's address.

← Ropsten DeploymentDIRT Lib Reference →
  • Installing the library
  • Getting a Web3 instance
  • Instantiating DIRT
Docs
Get StartedDocs
Community
TwitterGitHubStar
Copyright © 2019 DIRT Protocol