From 5bcf9a85f73ddb6d1f9709a983abbcc22ce66528 Mon Sep 17 00:00:00 2001 From: Fabian Vogelsteller Date: Thu, 2 Mar 2017 09:43:43 +0100 Subject: [PATCH] changed format of docs --- docs/web3-bzz.rst | 18 +-- docs/web3-eth-contract.rst | 137 ++++++++-------- docs/web3-eth-iban.rst | 4 +- docs/web3-eth-subscribe.rst | 42 ++--- docs/web3-eth.rst | 198 ++++++++++++------------ docs/web3-shh.rst | 44 +++--- packages/web3-eth-contract/src/index.js | 2 + 7 files changed, 227 insertions(+), 218 deletions(-) diff --git a/docs/web3-bzz.rst b/docs/web3-bzz.rst index e4b47a4..578516c 100644 --- a/docs/web3-bzz.rst +++ b/docs/web3-bzz.rst @@ -49,7 +49,7 @@ Parameters 1. ``String`` - ``localfspath``: The file or directory to upload. 2. ``String`` - ``defaultfile``: The default to use when no file on the manifest path could be mapped. For JavaScript Dapps that is normally an ``index.html``. -3. ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second. +3. ``callback`` - ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second. ------- Returns @@ -84,9 +84,9 @@ Downloads files and folders from swarm. Parameters ---------- -1. ``String`` - ``bzzHash``: The file or directory to download. -2. ``String`` - ``localdirpath``: The local folder to download the content into. -3. ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second. +1. ``bzzHash`` - ``String``: The file or directory to download. +2. ``localdirpath`` - ``String``: The local folder to download the content into. +3. ``callback`` - ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second. ------- Returns @@ -123,9 +123,9 @@ Creates a manifest with an entry. This entry has the empty path and specifies th Parameters ---------- -1. ``String`` - ``content``: The data blob to store. -2. ``String`` - ``contentType``: The MIME content type to assign for that data. -3. ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second. +1. ``content`` - ``String``: The data blob to store. +2. ``contentType`` - ``String``: The MIME content type to assign for that data. +3. ``callback`` - ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second. ------- Returns @@ -159,8 +159,8 @@ Description missing. Parameters ---------- -1. ``String`` - ``bzzHash``: The path to a file, it will then download its manifest JSON file. -2. ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second. +1. ``bzzHash`` - ``String``: The path to a file, it will then download its manifest JSON file. +2. ``callback`` - ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second. ------- Returns diff --git a/docs/web3-eth-contract.rst b/docs/web3-eth-contract.rst index 9912377..c4d8f19 100644 --- a/docs/web3-eth-contract.rst +++ b/docs/web3-eth-contract.rst @@ -29,13 +29,13 @@ Creates a new contract instance with all its methods and events defined in its : Parameters ---------- -1. ``Object`` - ``jsonInterface``: The json interface for the contract to instantiate -2. ``String`` - ``address`` (optional): The address of the smart contract to call, can be added later using ``myContract.options.address = '0x1234..'`` -3. ``Object`` - ``options`` (optional): The options of the contract. Some are used as fallbacks for calls and transactions: - * ``String`` - ``from``: The address transactions should be made from. - * ``String`` - ``gasPrice``: The gas price in wei to use for transactions. - * ``Number`` - ``gas``: The maximum gas provided for a transaction (gas limit). - * ``String`` - ``data``: The byte code of the contract. Used when the contract gets :ref:`deployed `. +1. ``jsonInterface`` - ``Object``: The json interface for the contract to instantiate +2. ``address`` - ``String`` (optional): The address of the smart contract to call, can be added later using ``myContract.options.address = '0x1234..'`` +3. ``options`` - ``Object`` (optional): The options of the contract. Some are used as fallbacks for calls and transactions: + * ``from`` - ``String``: The address transactions should be made from. + * ``gasPrice`` - ``String``: The gas price in wei to use for transactions. + * ``gas`` - ``Number``: The maximum gas provided for a transaction (gas limit). + * ``data`` - ``String``: The byte code of the contract. Used when the contract gets :ref:`deployed `. ------- Returns @@ -80,12 +80,12 @@ Properties ``Object`` - options: -- ``String`` - ``address``: The address where the contract is deployed. See :ref:`options.address `. -- ``Array`` - ``jsonInterface``: The json interface of the contract. See :ref:`options.jsonInterface `. -- ``String`` - ``data``: The byte code of the contract. Used when the contract gets :ref:`deployed `. -- ``String`` - ``from``: The address transactions should be made from. -- ``String`` - ``gasPrice``: The gas price in wei to use for transactions. -- ``Number`` - ``gas``: The maximum gas provided for a transaction (gas limit). +- ``address`` - ``String``: The address where the contract is deployed. See :ref:`options.address `. +- ``jsonInterface`` - ``Array``: The json interface of the contract. See :ref:`options.jsonInterface `. +- ``data`` - ``String``: The byte code of the contract. Used when the contract gets :ref:`deployed `. +- ``from`` - ``String``: The address transactions should be made from. +- ``gasPrice`` - ``String``: The gas price in wei to use for transactions. +- ``gas`` - ``Number``: The maximum gas provided for a transaction (gas limit). ------- @@ -129,7 +129,7 @@ The address will be stored in lowercase. Property ------- -``String|null`` - address: The address for this contract, or ``null`` if its not yet set. +``address`` - ``String|null``: The address for this contract, or ``null`` if its not yet set. ------- @@ -163,7 +163,7 @@ The :ref:`json interface ` object derived from the `ABI Property ------- -``Array`` - jsonInterface: The :ref:`json interface ` for this contract. Re-setting this will regenerate the methods and events of the contract instance. +``jsonInterface`` - ``Array``: The :ref:`json interface ` for this contract. Re-setting this will regenerate the methods and events of the contract instance. ------- @@ -254,9 +254,9 @@ After successfull deployment the promise will resolve with a new contract instan Parameters ---------- -1. ``Object`` - ``options``: The options used for deployemnt. - * ``String`` - ``data``: The byte code of the contract. - * ``Array``` - ``arguments`` (optional): The arguments which get passed to the constructor on deployment. +1. ``options`` - ``Object``: The options used for deployemnt. + * ``data`` - ``String``: The byte code of the contract. + * ``arguments`` - ``Array`` (optional): The arguments which get passed to the constructor on deployment. ------- Returns @@ -387,7 +387,7 @@ Example // or sending and using a promise myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'}) .then(function(receipt){ - ... + // receipt can also be a new contract instance, when coming from a "contract.deploy({...}).send()" }); // or sending and using the events @@ -399,7 +399,9 @@ Example .on('receipt', function(receipt){ ... }) - .on('confirmation', function(confirmationNumber, receipt){ ... }) + .on('confirmation', function(confirmationNumber, receipt){ + ... + }) .on('error', console.error); @@ -421,11 +423,11 @@ Will call a "constant" method and execute its smart contract method in the EVM w Parameters ---------- -1. ``Object`` - ``options`` (optional): The options used for calling. - * ``String`` - ``from`` (optional): The address the call "transaction" should be made from. - * ``String`` - ``gasPrice`` (optional): The gas price in wei to use for this call "transaction". - * ``Number`` - ``gas`` (optional): The maximum gas provided for this call "transaction" (gas limit). -2. ``Function`` - ``callback`` (optional): This callback will be fired with the result of the smart contract method execution as the second argument, or with an error object as the first argument. +1. ``options`` - ``Object`` (optional): The options used for calling. + * ``from`` - ``String`` (optional): The address the call "transaction" should be made from. + * ``gasPrice`` - ``String`` (optional): The gas price in wei to use for this call "transaction". + * ``gas`` - ``Number`` (optional): The maximum gas provided for this call "transaction" (gas limit). +2. ``callback`` - ``Function`` (optional): This callback will be fired with the result of the smart contract method execution as the second argument, or with an error object as the first argument. ------- Returns @@ -472,11 +474,11 @@ Will send a transaction to the smart contract and execute its method. Note this Parameters ---------- -1. ``Object`` - ``options``: The options used for sending. - * ``String`` - ``from``: The address the transaction should be send from. - * ``String`` - ``gasPrice`` (optional): The gas price in wei to use for this transaction. - * ``Number`` - ``gas`` (optional): The maximum gas provided for this transaction (gas limit). -2. ``Function`` - ``callback`` (optional): This callback will be fired first with the "transactionHash", or with an error object as the first argument. +1. ``options`` - ``Object``: The options used for sending. + * ``from`` - ``String``: The address the transaction should be send from. + * ``gasPrice`` - ``String`` (optional): The gas price in wei to use for this transaction. + * ``gas`` - ``Number`` (optional): The maximum gas provided for this transaction (gas limit). +2. ``callback`` - ``Function`` (optional): This callback will be fired first with the "transactionHash", or with an error object as the first argument. ------- Returns @@ -484,7 +486,7 @@ Returns The **callback** will return the 32 bytes transaction hash. -``PromiEvent``: A :ref:`promise combined event emitter `. Will be resolved when the transaction *receipt* is available. If this ``send()`` is is called from a ``someContract.deploy()`` then the promise will resolve with the *new contract instance*. Additionally the following events are available: +``PromiEvent``: A :ref:`promise combined event emitter `. Will be resolved when the transaction *receipt* is available, OR If this ``send()`` is is called from a ``someContract.deploy()`` then the promise will resolve with the *new contract instance*. Additionally the following events are available: - ``"transactionHash"`` returns ``String``: is fired right after the transaction is send and a transaction hash is available. - ``"receipt"`` returns ``Object``: is fired when the transaction receipt is available. @@ -499,14 +501,14 @@ Example .. code-block:: javascript // using the callback - myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'}, function(error, hash){ + myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'}, function(error, transactionHash){ ... }); // using the promise myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'}) .then(function(receipt){ - ... + // receipt can also be a new contract instance, when coming from a "contract.deploy({...}).send()" }); @@ -518,7 +520,9 @@ Example .on('receipt', function(receipt){ ... }) - .on('confirmation', function(confirmationNumber, receipt){ ... }) + .on('confirmation', function(confirmationNumber, receipt){ + ... + }) .on('error', console.error); // If a out of gas error, the second parameter is the receipt. @@ -541,10 +545,10 @@ The estimation can differ from the actual gas used when later sending a transact Parameters ---------- -1. ``Object`` - ``options`` (optional): The options used for calling. - * ``String`` - ``from`` (optional): The address the call "transaction" should be made from. - * ``Number`` - ``gas`` (optional): The maximum gas provided for this call "transaction" (gas limit). Setting a specific value helps to detect out of gas errors. If all gas is used it will return the same number. -2. ``Function`` - ``callback`` (optional): This callback will be fired with the result of the gas estimation as the second argument, or with an error object as the first argument. +1. ``options`` - ``Object`` (optional): The options used for calling. + * ``from`` - ``String`` (optional): The address the call "transaction" should be made from. + * ``gas`` - ``Number`` (optional): The maximum gas provided for this call "transaction" (gas limit). Setting a specific value helps to detect out of gas errors. If all gas is used it will return the same number. +2. ``callback`` - ``Function`` (optional): This callback will be fired with the result of the gas estimation as the second argument, or with an error object as the first argument. ------- Returns @@ -568,6 +572,9 @@ Example myContract.methods.myMethod(123).estimateGas({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'}) .then(function(gasAmount){ ... + }) + .catch(function(error){ + ... }); @@ -631,13 +638,13 @@ Gets past events for this contract. Parameters ---------- -1. ``String`` - ``event``: The name of the event in the contract, or ``"allEvents"`` to get all events. -2. ``Object`` - ``options`` (optional): The options used for deployment. - * ``Object`` - ``filter`` (optional): Let you filter events by indexed parameters, e.g. ``{filter: {myNumber: [12,13]}}`` means all events where "myNumber" is 12 or 13. - * ``Number`` - ``fromBlock`` (optional): The block number from which to get events on. - * ``Number`` - ``toBlock`` (optional): The block number until events to get (Defaults to ``"latest"``). - * ``Array`` - ``topics`` (optional): This allows to manually set the topics for the event filter. If given the filter property and event signature (topic[0]) will not be set automatically. -3. ``Function`` - ``callback`` (optional): This callback will be fired with an array of event logs as the second argument, or an error as the first argument. +1. ``event`` - ``String``: The name of the event in the contract, or ``"allEvents"`` to get all events. +2. ``options`` - ``Object`` (optional): The options used for deployment. + * ``filter`` - ``Object`` (optional): Let you filter events by indexed parameters, e.g. ``{filter: {myNumber: [12,13]}}`` means all events where "myNumber" is 12 or 13. + * ``fromBlock`` - ``Number`` (optional): The block number from which to get events on. + * ``toBlock`` - ``Number`` (optional): The block number until events to get (Defaults to ``"latest"``). + * ``topics`` - ``Array`` (optional): This allows to manually set the topics for the event filter. If given the filter property and event signature (topic[0]) will not be set automatically. +3. ``callback`` - ``Function`` (optional): This callback will be fired with an array of event logs as the second argument, or an error as the first argument. .. _contract-getPastEvents-return: @@ -650,16 +657,16 @@ Returns The structure of the returned event ``Object`` in the ``Array`` looks as follows: -- ``Object`` - ``returnValues``: The return values coming from the event, e.g. ``{myVar: 1, myVar2: '0x234...'}``. -- ``String`` - ``event``: The event name. -- ``String`` - ``address``: From which this event originated from. -- ``String`` - ``raw.data``: The data containing non-indexed log parameter. -- ``Array`` - ``raw.topics``: An array with max 4 32 Byte topics, topic 1-3 contains indexed parameters of the event. -- ``Number`` - ``logIndex``: Integer of the event index position in the block. -- ``Number`` - ``transactionIndex``: Integer of the transaction's index position, the event was created in. -- ``String`` 32 Bytes - ``transactionHash``: Hash of the transaction this event was created in. -- ``String`` 32 Bytes - ``blockHash``: Hash of the block where this event was created in. ``null`` when its still pending. -- ``Number`` - ``blockNumber``: The block number where this log was created in. ``null`` when still pending. +- ``event`` - ``String``: The event name. +- ``address`` - ``String``: From which this event originated from. +- ``returnValues`` - ``Object``: The return values coming from the event, e.g. ``{myVar: 1, myVar2: '0x234...'}``. +- ``logIndex`` - ``Number``: Integer of the event index position in the block. +- ``transactionIndex`` - ``Number``: Integer of the transaction's index position, the event was created in. +- ``transactionHash`` 32 Bytes - ``String``: Hash of the transaction this event was created in. +- ``blockHash`` 32 Bytes - ``String``: Hash of the block where this event was created in. ``null`` when its still pending. +- ``blockNumber`` - ``Number``: The block number where this log was created in. ``null`` when still pending. +- ``raw.data`` - ``String``: The data containing non-indexed log parameter. +- ``raw.topics`` - ``Array``: An array with max 4 32 Byte topics, topic 1-3 contains indexed parameters of the event. ------- Example @@ -714,11 +721,11 @@ Subscribes to an event, and unsubscribes immediately after the first event or er Parameters ---------- -1. ``String`` - ``event``: The name of the event in the contract, or ``"allEvents"`` to get all events. -2. ``Object`` - ``options`` (optional): The options used for deployment. - * ``Object`` - ``filter`` (optional): Let you filter events by indexed parameters, e.g. ``{filter: {myNumber: [12,13]}}`` means all events where "myNumber" is 12 or 13. - * ``Array`` - ``topics`` (optional): This allows to manually set the topics for the event filter. If given the filter property and event signature (topic[0]) will not be set automatically. -3. ``Function`` - ``callback``: This callback will be fired for the first event as the second argument, or an error as the first argument. +1. ``event`` - ``String``: The name of the event in the contract, or ``"allEvents"`` to get all events. +2. ``options`` - ``Object`` (optional): The options used for deployment. + * ``filter`` - ``Object`` (optional): Let you filter events by indexed parameters, e.g. ``{filter: {myNumber: [12,13]}}`` means all events where "myNumber" is 12 or 13. + * ``topics`` - ``Array`` (optional): This allows to manually set the topics for the event filter. If given the filter property and event signature (topic[0]) will not be set automatically. +3. ``callback`` - ``Function``: This callback will be fired for the first event as the second argument, or an error as the first argument. ------- Returns @@ -775,11 +782,11 @@ Subscribe to a event Parameters ---------- -1. ``Object`` - ``options`` (optional): The options used for deployment. - * ``Object`` - ``filter`` (optional): Let you filter events by indexed parameters, e.g. ``{filter: {myNumber: [12,13]}}`` means all events where "myNumber" is 12 or 13. - * ``Number`` - ``fromBlock`` (optional): The block number from which to get events on. - * ``Array`` - ``topics`` (optional): This allows to manually set the topics for the event filter. If given the filter property and event signature (topic[0]) will not be set automatically. -2. ``Function`` - ``callback`` (optional): This callback will be fired for each event as the second argument, or an error as the first argument. +1. ``options`` - ``Object`` (optional): The options used for deployment. + * ``filter`` - ``Object`` (optional): Let you filter events by indexed parameters, e.g. ``{filter: {myNumber: [12,13]}}`` means all events where "myNumber" is 12 or 13. + * ``fromBlock`` - ``Number`` (optional): The block number from which to get events on. + * ``topics`` - ``Array`` (optional): This allows to manually set the topics for the event filter. If given the filter property and event signature (topic[0]) will not be set automatically. +2. ``callback`` - ``Function`` (optional): This callback will be fired for each event as the second argument, or an error as the first argument. ------- Returns diff --git a/docs/web3-eth-iban.rst b/docs/web3-eth-iban.rst index c49a64c..b6e9f02 100644 --- a/docs/web3-eth-iban.rst +++ b/docs/web3-eth-iban.rst @@ -205,8 +205,8 @@ Parameters ---------- 1. ``Object``: the options object as follows: - - ``String`` - ``institution``: the institution to be assigned - - ``String`` - ``identifier``: the identifier to be assigned + - ``institution`` - ``String``: the institution to be assigned + - ``identifier`` - ``String``: the identifier to be assigned ------- Returns diff --git a/docs/web3-eth-subscribe.rst b/docs/web3-eth-subscribe.rst index a03b70d..7065f93 100644 --- a/docs/web3-eth-subscribe.rst +++ b/docs/web3-eth-subscribe.rst @@ -192,20 +192,20 @@ Returns The structure of a returned block header is as follows: - - ``Number`` - ``number``: The block number. ``null`` when its pending block. - - ``String`` 32 Bytes - ``hash``: Hash of the block. ``null`` when its pending block. - - ``String`` 32 Bytes - ``parentHash``: Hash of the parent block. - - ``String`` 8 Bytes - ``nonce``: Hash of the generated proof-of-work. ``null`` when its pending block. - - ``String`` 32 Bytes - ``sha3Uncles``: SHA3 of the uncles data in the block. - - ``String`` 256 Bytes - ``logsBloom``: The bloom filter for the logs of the block. ``null`` when its pending block. - - ``String`` 32 Bytes - ``transactionsRoot``: The root of the transaction trie of the block - - ``String`` 32 Bytes - ``stateRoot``: The root of the final state trie of the block. - - ``String`` 32 Bytes - ``receiptRoot``: The root of the receipts. - - ``String`` - ``miner``: The address of the beneficiary to whom the mining rewards were given. - - ``String`` - ``extraData``: The "extra data" field of this block. - - ``Number`` - ``gasLimit``: The maximum gas allowed in this block. - - ``Number`` - ``gasUsed``: The total used gas by all transactions in this block. - - ``Number`` - ``timestamp``: The unix timestamp for when the block was collated. + - ``number`` - ``Number``: The block number. ``null`` when its pending block. + - ``hash`` 32 Bytes - ``String``: Hash of the block. ``null`` when its pending block. + - ``parentHash`` 32 Bytes - ``String``: Hash of the parent block. + - ``nonce`` 8 Bytes - ``String``: Hash of the generated proof-of-work. ``null`` when its pending block. + - ``sha3Uncles`` 32 Bytes - ``String``: SHA3 of the uncles data in the block. + - ``logsBloom`` 256 Bytes - ``String``: The bloom filter for the logs of the block. ``null`` when its pending block. + - ``transactionsRoot`` 32 Bytes - ``String``: The root of the transaction trie of the block + - ``stateRoot`` 32 Bytes - ``String``: The root of the final state trie of the block. + - ``receiptRoot`` 32 Bytes - ``String``: The root of the receipts. + - ``miner`` - ``String``: The address of the beneficiary to whom the mining rewards were given. + - ``extraData`` - ``String``: The "extra data" field of this block. + - ``gasLimit`` - ``Number``: The maximum gas allowed in this block. + - ``gasUsed`` - ``Number``: The total used gas by all transactions in this block. + - ``timestamp`` - ``Number``: The unix timestamp for when the block was collated. ---------------- Callback returns @@ -260,7 +260,7 @@ Returns ``EventEmitter``: An :ref:`subscription instance ` as an event emitter with the following events: - ``"data"`` returns ``Object``: Fires on each incoming sync object as argument. -- ``"changed"`` returns ``Object``: Fires when the synchronisation is started with ``TRUE`` and when finsihed with ``FALSE``. +- ``"changed"`` returns ``Object``: Fires when the synchronisation is started with ``true`` and when finsihed with ``false``. - ``"error"`` returns ``Object``: Fires when an error in the subscription occours. For the structure of a returned event ``Object`` see :ref:`web3.eth.isSyncing return values `. @@ -270,7 +270,7 @@ Callback returns ---------------- 1. ``Object|Null`` - First parameter is an error object if the subscription failed. -2. ``Object|Boolean`` - The syncing object, when started it will return ``TRUE`` once or when finished it will return `FALSE` once. +2. ``Object|Boolean`` - The syncing object, when started it will return ``true`` once or when finished it will return `false` once. ------- Example @@ -316,12 +316,12 @@ Subscribes to incoming logs, filtered by the given options. Parameters ---------- -1. ``String`` - ``"logs"``, the type of the subscription. +1. ``"logs"`` - ``String``, the type of the subscription. 2. ``Object`` - The subscription options - - ``Number`` - ``fromBlock``: The number of the earliest block. By default ``null``. - - ``String`` - ``address``: An address or a list of addresses to only get logs from particular account(s). - - ``Array`` - ``topics``: An array of values which must each appear in the log entries. The order is important, if you want to leave topics out use ``null``, e.g. ``[null, '0x00...']``. You can also pass another array for each topic with options for that topic e.g. ``[null, ['option1', 'option2']]`` -3. ``Function`` - (optional) Optional callback, returns an error object as first parameter and the result as second. Will be called for each incoming subscription. + - ``fromBlock`` - ``Number``: The number of the earliest block. By default ``null``. + - ``address`` - ``String``: An address or a list of addresses to only get logs from particular account(s). + - ``topics`` - ``Array``: An array of values which must each appear in the log entries. The order is important, if you want to leave topics out use ``null``, e.g. ``[null, '0x00...']``. You can also pass another array for each topic with options for that topic e.g. ``[null, ['option1', 'option2']]`` +3. ``callback`` - ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second. Will be called for each incoming subscription. ------- Returns diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index 6e9ff72..8eb1203 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -151,11 +151,11 @@ Property Default block parameters can be one of the following: - ``Number``: A block number -- ``String`` - ``"genesis"``: The genesis block -- ``String`` - ``"latest"``: The latest block (current head of the blockchain) -- ``String`` - ``"pending"``: The currently mined block (including pending transactions) +- ``"genesis"`` - ``String``: The genesis block +- ``"latest"`` - ``String``: The latest block (current head of the blockchain) +- ``"pending"`` - ``String``: The currently mined block (including pending transactions) -Default is ``latest`` +Default is ``"latest"`` ------- @@ -220,11 +220,11 @@ Returns ``Promise`` returns ``Object|Boolean`` - A sync object when the node is currently syncing or ``false``: - - ``Number`` - ``startingBlock``: The block number where the sync started. - - ``Number`` - ``currentBlock``: The block number where at which block the node currently synced to already. - - ``Number`` - ``highestBlock``: The estimated block number to sync to. - - ``Number`` - ``knownStates``: The estimated states to download - - ``Number`` - ``pulledStates``: The already downloaded states + - ``startingBlock`` - ``Number``: The block number where the sync started. + - ``currentBlock`` - ``Number``: The block number where at which block the node currently synced to already. + - ``highestBlock`` - ``Number``: The estimated block number to sync to. + - ``knownStates`` - ``Number``: The estimated states to download + - ``pulledStates`` - ``Number``: The already downloaded states ------- @@ -575,24 +575,24 @@ Returns ``Promise`` returns ``Object`` - The block object: - - ``Number`` - ``number``: The block number. ``null`` when its pending block. - - ``String`` 32 Bytes - ``hash``: Hash of the block. ``null`` when its pending block. - - ``String`` 32 Bytes - ``parentHash``: Hash of the parent block. - - ``String`` 8 Bytes - ``nonce``: Hash of the generated proof-of-work. ``null`` when its pending block. - - ``String`` 32 Bytes - ``sha3Uncles``: SHA3 of the uncles data in the block. - - ``String`` 256 Bytes - ``logsBloom``: The bloom filter for the logs of the block. ``null`` when its pending block. - - ``String`` 32 Bytes - ``transactionsRoot``: The root of the transaction trie of the block - - ``String`` 32 Bytes - ``stateRoot``: The root of the final state trie of the block. - - ``String`` - ``miner``: The address of the beneficiary to whom the mining rewards were given. - - ``String`` - ``difficulty``: Integer of the difficulty for this block. - - ``String`` - ``totalDifficulty``: Integer of the total difficulty of the chain until this block. - - ``String`` - ``extraData``: The "extra data" field of this block. - - ``Number`` - ``size``: Integer the size of this block in bytes. - - ``Number`` - ``gasLimit``: The maximum gas allowed in this block. - - ``Number`` - ``gasUsed``: The total used gas by all transactions in this block. - - ``Number`` - ``timestamp``: The unix timestamp for when the block was collated. - - ``Array`` - ``transactions``: Array of transaction objects, or 32 Bytes transaction hashes depending on the ``returnTransactionObjects`` parameter. - - ``Array`` - ``uncles``: Array of uncle hashes. + - ``number`` - ``Number``: The block number. ``null`` when its pending block. + - ``hash`` 32 Bytes - ``String``: Hash of the block. ``null`` when its pending block. + - ``parentHash`` 32 Bytes - ``String``: Hash of the parent block. + - ``nonce`` 8 Bytes - ``String``: Hash of the generated proof-of-work. ``null`` when its pending block. + - ``sha3Uncles`` 32 Bytes - ``String``: SHA3 of the uncles data in the block. + - ``logsBloom`` 256 Bytes - ``String``: The bloom filter for the logs of the block. ``null`` when its pending block. + - ``transactionsRoot`` 32 Bytes - ``String``: The root of the transaction trie of the block + - ``stateRoot`` 32 Bytes - ``String``: The root of the final state trie of the block. + - ``miner`` - ``String``: The address of the beneficiary to whom the mining rewards were given. + - ``difficulty`` - ``String``: Integer of the difficulty for this block. + - ``totalDifficulty`` - ``String``: Integer of the total difficulty of the chain until this block. + - ``extraData`` - ``String``: The "extra data" field of this block. + - ``size`` - ``Number``: Integer the size of this block in bytes. + - ``gasLimit`` - ``Number``: The maximum gas allowed in this block. + - ``gasUsed`` - ``Number``: The total used gas by all transactions in this block. + - ``timestamp`` - ``Number``: The unix timestamp for when the block was collated. + - ``transactions`` - ``Array``: Array of transaction objects, or 32 Bytes transaction hashes depending on the ``returnTransactionObjects`` parameter. + - ``uncles`` - ``Array``: Array of uncle hashes. ------- Example @@ -605,26 +605,26 @@ Example .then(console.log); > { - "number": 3, - "hash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46", - "parentHash": "0x2302e1c0b972d00932deb5dab9eb2982f570597d9d42504c05d9c2147eaf9c88", - "nonce": "0xfb6e1a62d119228b", - "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "transactionsRoot": "0x3a1b03875115b79539e5bd33fb00d8f7b7cd61929d5a3c574f507b8acf415bee", - "stateRoot": "0xf1133199d44695dfa8fd1bcfe424d82854b5cebef75bddd7e40ea94cda515bcb", - "miner": "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty": '21345678965432', - "totalDifficulty": '324567845321', - "size": 616, - "extraData": "0x", - "gasLimit": 3141592, - "gasUsed": 21662, - "timestamp": 1429287689, - "transactions": [ - "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" - ], - "uncles": [] + "number": 3, + "hash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46", + "parentHash": "0x2302e1c0b972d00932deb5dab9eb2982f570597d9d42504c05d9c2147eaf9c88", + "nonce": "0xfb6e1a62d119228b", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "transactionsRoot": "0x3a1b03875115b79539e5bd33fb00d8f7b7cd61929d5a3c574f507b8acf415bee", + "stateRoot": "0xf1133199d44695dfa8fd1bcfe424d82854b5cebef75bddd7e40ea94cda515bcb", + "miner": "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty": '21345678965432', + "totalDifficulty": '324567845321', + "size": 616, + "extraData": "0x", + "gasLimit": 3141592, + "gasUsed": 21662, + "timestamp": 1429287689, + "transactions": [ + "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" + ], + "uncles": [] } @@ -739,17 +739,17 @@ Returns ``Promise`` returns ``Object`` - A transaction object its hash ``transactionHash``: - - ``String`` 32 Bytes - ``hash``: Hash of the transaction. - - ``Number`` - ``nonce``: The number of transactions made by the sender prior to this one. - - ``String`` 32 Bytes - ``blockHash``: Hash of the block where this transaction was in. ``null`` when its pending. - - ``Number`` - ``blockNumber``: Block number where this transaction was in. ``null`` when its pending. - - ``Number`` - ``transactionIndex``: Integer of the transactions index position in the block. ``null`` when its pending. - - ``String`` - ``from``: Address of the sender. - - ``String`` - ``to``: Address of the receiver. ``null`` when its a contract creation transaction. - - ``String`` - ``value``: Value transferred in :ref:`wei `. - - ``String`` - ``gasPrice``: Gas price provided by the sender in :ref:`wei `. - - ``Number`` - ``gas``: Gas provided by the sender. - - ``String`` - ``input``: The data sent along with the transaction. + - ``hash`` 32 Bytes - ``String``: Hash of the transaction. + - ``nonce`` - ``Number``: The number of transactions made by the sender prior to this one. + - ``blockHash`` 32 Bytes - ``String``: Hash of the block where this transaction was in. ``null`` when its pending. + - ``blockNumber`` - ``Number``: Block number where this transaction was in. ``null`` when its pending. + - ``transactionIndex`` - ``Number``: Integer of the transactions index position in the block. ``null`` when its pending. + - ``from`` - ``String``: Address of the sender. + - ``to`` - ``String``: Address of the receiver. ``null`` when its a contract creation transaction. + - ``value`` - ``String``: Value transferred in :ref:`wei `. + - ``gasPrice`` - ``String``: Gas price provided by the sender in :ref:`wei `. + - ``gas`` - ``Number``: Gas provided by the sender. + - ``input`` - ``String``: The data sent along with the transaction. ------- @@ -763,17 +763,17 @@ Example .then(console.log); > { - "hash": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b", - "nonce": 2, - "blockHash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46", - "blockNumber": 3, - "transactionIndex": 0, - "from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "to": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value": '123450000000000000', - "gas": 314159, - "gasPrice": '2000000000000', - "input": "0x57cb2fc4" + "hash": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b", + "nonce": 2, + "blockHash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46", + "blockNumber": 3, + "transactionIndex": 0, + "from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "to": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f", + "value": '123450000000000000', + "gas": 314159, + "gasPrice": '2000000000000', + "input": "0x57cb2fc4" } @@ -851,16 +851,16 @@ Returns ``Promise`` returns ``Object`` - A transaction receipt object, or ``null`` when no receipt was found: - - ``String`` 32 Bytes - ``blockHash``: Hash of the block where this transaction was in. - - ``Number`` - ``blockNumber``: Block number where this transaction was in. - - ``String`` 32 Bytes - ``transactionHash``: Hash of the transaction. - - ``Number``- ``transactionIndex``: Integer of the transactions index position in the block. - - ``String`` - ``from``: Address of the sender. - - ``String`` - ``to``: Address of the receiver. ``null`` when its a contract creation transaction. - - ``String`` - ``contractAddress``: The contract address created, if the transaction was a contract creation, otherwise ``null``. - - ``Number`` - ``cumulativeGasUsed``: The total amount of gas used when this transaction was executed in the block. - - ``Number``- ``gasUsed``: The amount of gas used by this specific transaction alone. - - ``Array`` - ``logs``: Array of log objects, which this transaction generated. + - ``blockHash`` 32 Bytes - ``String``: Hash of the block where this transaction was in. + - ``blockNumber`` - ``Number``: Block number where this transaction was in. + - ``transactionHash`` 32 Bytes - ``String``: Hash of the transaction. + - ``transactionIndex``- ``Number``: Integer of the transactions index position in the block. + - ``from`` - ``String``: Address of the sender. + - ``to`` - ``String``: Address of the receiver. ``null`` when its a contract creation transaction. + - ``contractAddress`` - ``String``: The contract address created, if the transaction was a contract creation, otherwise ``null``. + - ``cumulativeGasUsed`` - ``Number``: The total amount of gas used when this transaction was executed in the block. + - ``gasUsed``- ``Number``: The amount of gas used by this specific transaction alone. + - ``logs`` - ``Array``: Array of log objects, which this transaction generated. ------- Example @@ -942,14 +942,14 @@ Parameters 1. ``Object`` - The transaction object to send: - - ``String`` - ``from``: The address for the sending account. Uses the :ref:`web3.eth.defaultAccount ` property, if not specified. - - ``String`` - ``to``: (optional) The destination address of the message, left undefined for a contract-creation transaction. - - ``Number|String`` - ``value``: (optional) The value transferred for the transaction in :ref:`wei `, also the endowment if it's a contract-creation transaction. - - ``Number`` - ``gas``: (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). - - ``Number|String`` - ``gasPrice``: (optional, default: To-Be-Determined) The price of gas for this transaction in :ref:`wei `, defaults to the mean network gas price. - - ``String`` - ``data``: (optional) Either a `ABI byte string ` property, if not specified. + - ``to`` - ``String``: (optional) The destination address of the message, left undefined for a contract-creation transaction. + - ``value`` - ``Number|String|BN|BigNumber``: (optional) The value transferred for the transaction in :ref:`wei `, also the endowment if it's a contract-creation transaction. + - ``gas`` - ``Number``: (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). + - ``gasPrice`` - ``Number|String|BN|BigNumber``: (optional, default: To-Be-Determined) The price of gas for this transaction in :ref:`wei `, defaults to the mean network gas price. + - ``data`` - ``String``: (optional) Either a `ABI byte string ``null`` works as a wildcard - - ``String`` - ``to``: Filter by identity of the message receiver. If provided and the node has this identity, it will decrypt the incoming encrypted messages. -2. ``Function`` - (optional) Optional callback, returns an error object as first parameter and the result as second. +1. ``"messages"`` - ``String``: Type of the subscription. +2. ``Object`` - The filter options: + - ``topics``- ``Array``: Filters messages by this topic(s). You can use the following combinations: + - ``['topic1', 'topic2'] == 'topic1' && 'topic2'`` + - ``['topic1', ['topic2', 'topic3']] == 'topic1' && ('topic2' || 'topic3')`` + - ``[null, 'topic1', 'topic2'] == ANYTHING && 'topic1' && 'topic2'`` -> ``null`` works as a wildcard + - ``to`` - ``String``: Filter by identity of the message receiver. If provided and the node has this identity, it will decrypt the incoming encrypted messages. +3. ``callback`` - ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second. ---------- @@ -191,14 +191,14 @@ Callback Return ``Object`` - The incoming message: - - ``String`` 60 Bytes - ``from``: The sender of the message, if a sender was specified. - - ``String`` 60 Bytes - ``to``: The receiver of the message, if a receiver was specified. - - ``Number`` - ``expiry``: Integer of the time in seconds when this message should expire (?). - - ``Number`` - ``ttl``: Integer of the time the message should float in the system in seconds (?). - - ``Number`` - ``sent``: Integer of the unix timestamp when the message was sent. - - ``Array`` - ``topics``: topic ``Strings`` for the message. - - ``String`` - ``payload``: The payload of the message. - - ``Number`` - ``workProved``: Integer of the work this message required before it was send (?). + - ``from`` - 60 Bytes ``String``: The sender of the message, if a sender was specified. + - ``to`` - 60 Bytes ``String``: The receiver of the message, if a receiver was specified. + - ``expiry`` - ``Number``: Integer of the time in seconds when this message should expire (?). + - ``ttl`` - ``Number``: Integer of the time the message should float in the system in seconds (?). + - ``sent`` - ``Number``: Integer of the unix timestamp when the message was sent. + - ``topics`` - ``Array``: topic ``Strings`` for the message. + - ``payload`` - ``String``: The payload of the message. + - ``workProved`` - ``Number``: Integer of the work this message required before it was send (?). ---------- diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index 8b9c54b..0334b16 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -548,6 +548,8 @@ Contract.prototype.once = function(event, options, callback) { callback(err, res, sub); } }); + + return undefined; }; /**