Class
This is the main class of Archon.
var Archon = require('@kleros/archon');
> Archon.modules
> Archon.utils
> Archon.version
Property of Archon class
Archon.modules
Will return an object with the classes of all major sub modules, to be able to instantiate them manually.
Object
: A list of modules:Arbitrator
-Function
: The module for interacting with Arbitrator contracts. See :ref:`archon.arbitrator <arbitrator>` for more.Arbitrable
-Function
: The module for interacting with Arbitrable contracts. See :ref:`archon.arbitrable <arbitrable>` for more.
Archon.modules
> {
Arbitrator: Arbitrator function(provider),
Arbitrable: Arbitrable function(provider)
}
Property of Archon class and instance of archon
Archon.version
archon.version
Contains the version of the archon
container object.
String
: The current version.
archon.version;
> "0.1.0"
Property of Archon class and instance of archon
Archon.utils
archon.utils
Utility functions are also exposes on the Archon
class object directly.
See :ref:`archon.utils <utils>` for more.
new Archon(ethereumProvider, ipfsGatewayURI='https://gateway.ipfs.io')
ethereumProvider
-String|Object
: The provider object or URI of the Ethereum provider.ipfsGatewayURI
-String
: The URI of a trustedIPFS
gateway for fetching files from the IPFS network.
Instantiate Archon as an object to have access to all initialized modules.
var Archon = require('@kleros/archon');
// "Web3.providers.givenProvider" will be set if in an Ethereum supported browser.
var archon = new Archon('ws://some.local-or-remote.node:8546');
> archon.arbitrator
> archon.arbitrable
> archon.utils
> archon.version
archon.setProvider(myProvider)
archon.arbitrable.setProvider(myProvider)
archon.arbitrator.setProvider(myProvider)
...
Will change the ethereum provider.
Note
If called on the archon
class it will update the provider for all submodules. archon.arbitrable
, archon.arbitrator
, etc.
myProvider
-Object|String
: A provider object or URI.
var Archon = require('archon');
var archon = new Archon('http://localhost:8545');
// change provider for all submodules
archon.setProvider('ws://localhost:8546');
// or
archon.setProvider(new Web3.providers.WebsocketProvider('ws://localhost:8546'));
// change provider for arbitrator
archon.arbitrator.setProvider('https://mainnet.infura.io/')
archon.setIpfsGateway(ipfsGatewayURI)
Will change the IPFS
gateway used to fetch and validate data.
ipfsGatewayURI
-Object
: A URI to a trusted IPFS gateway .
var Archon = require('archon');
var archon = new Archon('http://localhost:8545');
// change IPFS gateway
archon.setIpfsGateway('https://cloudflare-ipfs.com/');