Skip to content

CasperApi Constructor

Vsevolod Trofimov edited this page Jul 3, 2018 · 3 revisions

Let's assume you have imported casperapi like

const CasperApi = require('casperapi')

Now you can do

const casper = new CasperApi(web3)

Let's see what more can be done here

CasperApi(blockchainProvider [, options])

Parameters

  1. Object — Blockchain provider, for ethereum this would be web3 or web3-eth (:hammer: neo coming soon).
  2. Object — Options object.
Options
blockchain

Which blockchain to use, currently only eth is supported.

type: String
default: 'eth'

mode

'development'mode runs on the test nodes in casper test network. This works a bit faster and we could pull up some logs if you'll need it.
'production' mode will make request to production smart contract and store data on real provider nodes. (this will be happen on testnet before alpha version is launched)

type: String
default: 'development'

Returns

Casper instance. You can call .save, .getFile, .getLink, .delete

Example

const casper = new CasperApi(web3, { mode: 'production' })

Clone this wiki locally