web3.js/docs/web3.rst
2017-03-10 11:44:00 +01:00

95 lines
2.1 KiB
ReStructuredText

====
web3
====
The web3.js object is a umbrella package to house all ethereum related modules.
.. code-block:: javascript
var Web3 = require('web3');
// "Web3.providers.givenProvider" will be set if in an Ethereum supported browser.
var web3 = new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider('ws://some.local-or-remote.node:8546'));
> web3.eth
> web3.shh
> web3.bzz
> web3.utils
------------------------------------------------------------------------------
version
============
.. code-block:: javascript
web3.version
Contains the version of the ``web3`` container object.
-------
Returns
-------
``String``: The current version.
-------
Example
-------
.. code-block:: javascript
web3.version;
> "1.0.0"
------------------------------------------------------------------------------
.. include:: package-core.rst
------------------------------------------------------------------------------
modules
=====================
.. code-block:: javascript
web3.modules
Will return an object with the classes of all major sub modules, to be able to instantiate them manually.
-------
Returns
-------
``Object``: A list of modules:
- ``Eth`` - ``Function``: the Eth module for interacting with the ethereum network see :ref:`web3.eth <eth>` for more.
- ``Net`` - ``Function``: the Net module for interacting with network properties see :ref:`web3.eth.net <eth-net>` for more.
- ``Personal`` - ``Function``: the Personal module for interacting with the ethereum accounts see :ref:`web3.personal <personal>` for more.
- ``Shh`` - ``Function``: the Shh module for interacting with the whisper protocol see :ref:`web3.shh <shh>` for more.
- ``Bzz`` - ``Function``: the Bzz module for interacting with the swarm network see :ref:`web3.bzz <bzz>` for more.
-------
Example
-------
.. code-block:: javascript
web3.modules
> {
Eth: Eth function(provider),
Net: Net function(provider),
Personal: Personal function(provider),
Shh: Shh function(provider),
Bzz: Bzz function(provider),
}