diff --git a/docs/web3-eth-contract.rst b/docs/web3-eth-contract.rst index 5e22ce4aa8e..6335702085f 100644 --- a/docs/web3-eth-contract.rst +++ b/docs/web3-eth-contract.rst @@ -48,8 +48,8 @@ Parameters 2. ``address`` - ``String`` (optional): The address of the smart contract to call. 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). + * ``gasPrice`` - ``Number|String|BN|BigNumber``: The gas price in wei to use for transactions. + * ``gas`` - ``Number|String|BN|BigNumber``: The maximum gas provided for a transaction (gas limit). * ``data`` - ``String``: The byte code of the contract. Used when the contract gets :ref:`deployed `. ------- @@ -140,7 +140,7 @@ Property The default block parameters can be one of the following: -- ``Number``: A block number +- ``Number|String|BN|BigNumber``: A block number - ``"genesis"`` - ``String``: The genesis block - ``"latest"`` - ``String``: The latest block (current head of the blockchain) - ``"pending"`` - ``String``: The currently mined block (including pending transactions) @@ -380,8 +380,8 @@ Properties - ``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). +- ``gasPrice`` - ``Number|String|BN|BigNumber``: The gas price in wei to use for transactions. +- ``gas`` - ``Number|String|BN|BigNumber``: The maximum gas provided for a transaction (gas limit). ------- @@ -723,8 +723,8 @@ Parameters 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). + * ``gasPrice`` - ``Number|String|BN|BigNumber`` (optional): The gas price in wei to use for this call "transaction". + * ``gas`` - ``Number|String|BN|BigNumber`` (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. ------- @@ -810,8 +810,8 @@ Parameters 1. ``options`` - ``Object``: The options used for sending. * ``from`` - ``String``: The address the transaction should be sent 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). + * ``gasPrice`` - ``Number|String|BN|BigNumber`` (optional): The gas price in wei to use for this transaction. + * ``gas`` - ``Number|String|BN|BigNumber`` (optional): The maximum gas provided for this transaction (gas limit). * ``value`` - ``Number|String|BN|BigNumber``(optional): The value transferred for the transaction in wei. 2. ``callback`` - ``Function`` (optional): This callback will be fired first with the "transactionHash", or with an error object as the first argument. @@ -862,10 +862,10 @@ Example "transactionHash": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b", "transactionIndex": 0, "blockHash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46", - "blockNumber": 3, + "blockNumber": '3', "contractAddress": "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", - "cumulativeGasUsed": 314159, - "gasUsed": 30234, + "cumulativeGasUsed": '314159', + "gasUsed": '30234', "events": { "MyEvent": { returnValues: { @@ -883,7 +883,7 @@ Example transactionIndex: 0, transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385', blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', - blockNumber: 1234, + blockNumber: '1234', address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe' }, "MyOtherEvent": { @@ -918,7 +918,7 @@ Parameters 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. + * ``gas`` - ``Number|String|BN|BigNumber`` (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. * ``value`` - ``Number|String|BN|BigNumber``(optional): The value transferred for the call "transaction" in wei. 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. @@ -926,7 +926,7 @@ Parameters Returns ------- -``Promise`` returns ``Number``: The gas amount estimated. +``Promise`` returns ``String``: The gas amount estimated. ------- Example @@ -1050,7 +1050,7 @@ Example transactionIndex: 0, transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385', blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', - blockNumber: 1234, + blockNumber: '1234', address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe' } @@ -1074,7 +1074,7 @@ Parameters 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|String|BN|BigNumber`` (optional): The block number (greater than or equal to) from which to get events on. Pre-defined block numbers as ``"latest"``, ``"earlist"``, ``"pending"``, and ``"genesis"`` can also be used. + * ``fromBlock`` - ``Number|String|BN|BigNumber`` (optional): The block number (greater than or equal to) from which to get events on. Pre-defined block numbers as ``"latest"``, ``"earliest"``, ``"pending"``, and ``"genesis"`` can also be used. * ``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. @@ -1102,7 +1102,7 @@ The structure of the returned event ``Object`` looks as follows: - ``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 this event was created in. ``null`` when it's still pending. -- ``blockNumber`` - ``Number``: The block number this log was created in. ``null`` when still pending. +- ``blockNumber`` - ``String``: The block number 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. @@ -1146,7 +1146,7 @@ Example transactionIndex: 0, transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385', blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', - blockNumber: 1234, + blockNumber: '1234', address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe' } @@ -1183,7 +1183,7 @@ Parameters 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): Lets you filter events by indexed parameters, e.g. ``{filter: {myNumber: [12,13]}}`` means all events where "myNumber" is 12 or 13. - * ``fromBlock`` - ``Number|String|BN|BigNumber`` (optional): The block number (greater than or equal to) from which to get events on. Pre-defined block numbers as ``"latest"``, ``"earlist"``, ``"pending"``, and ``"genesis"`` can also be used. + * ``fromBlock`` - ``Number|String|BN|BigNumber`` (optional): The block number (greater than or equal to) from which to get events on. Pre-defined block numbers as ``"latest"``, ``"earliest"``, ``"pending"``, and ``"genesis"`` can also be used. * ``toBlock`` - ``Number|String|BN|BigNumber`` (optional): The block number (less than or equal to) to get events up to (Defaults to ``"latest"``). Pre-defined block numbers as ``"latest"``, ``"earlist"``, ``"pending"``, and ``"genesis"`` can also be used. * ``topics`` - ``Array`` (optional): This allows manually setting 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. @@ -1228,7 +1228,7 @@ Example transactionIndex: 0, transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385', blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', - blockNumber: 1234, + blockNumber: '1234', address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe' },{ ... diff --git a/docs/web3-eth-ens.rst b/docs/web3-eth-ens.rst index cb1f5565703..4aacdc764aa 100644 --- a/docs/web3-eth-ens.rst +++ b/docs/web3-eth-ens.rst @@ -118,8 +118,8 @@ Parameters 2. ``address`` - ``String``: The address to set. 3. ``options`` - ``Object``: The options used for sending. * ``from`` - ``String``: The address the transaction should be sent 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). + * ``gasPrice`` - ``Number|String|BN|BigNumber`` (optional): The gas price in wei to use for this transaction. + * ``gas`` - ``Number|String|BN|BigNumber`` (optional): The maximum gas provided for this transaction (gas limit). Emits an ``AddrChanged`` event. @@ -237,8 +237,8 @@ Parameters 3. ``y`` - ``String``: The Y coordinate of the public key. 4. ``options`` - ``Object``: The options used for sending. * ``from`` - ``String``: The address the transaction should be sent 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). + * ``gasPrice`` - ``Number|String|BN|BigNumber`` (optional): The gas price in wei to use for this transaction. + * ``gas`` - ``Number|String|BN|BigNumber`` (optional): The maximum gas provided for this transaction (gas limit). Emits an ``PubkeyChanged`` event. @@ -353,8 +353,8 @@ Parameters 2. ``hash`` - ``String``: The content hash to set. 3. ``options`` - ``Object``: The options used for sending. * ``from`` - ``String``: The address the transaction should be sent 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). + * ``gasPrice`` - ``Number|String|BN|BigNumber`` (optional): The gas price in wei to use for this transaction. + * ``gas`` - ``Number|String|BN|BigNumber`` (optional): The maximum gas provided for this transaction (gas limit). Emits an ``ContentChanged`` event. @@ -467,8 +467,8 @@ Parameters 2. ``hash`` - ``String``: The multihash to set. 3. ``options`` - ``Object``: The options used for sending. * ``from`` - ``String``: The address the transaction should be sent 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). + * ``gasPrice`` - ``Number|String|BN|BigNumber`` (optional): The gas price in wei to use for this transaction. + * ``gas`` - ``Number|String|BN|BigNumber`` (optional): The maximum gas provided for this transaction (gas limit). Emits an ``MultihashChanged``event. @@ -566,7 +566,7 @@ Example transactionIndex: 0, transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385', blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', - blockNumber: 1234, + blockNumber: '1234', address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe' } @@ -615,7 +615,7 @@ Example transactionIndex: 0, transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385', blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', - blockNumber: 1234, + blockNumber: '1234', address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe' } diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index eeff7f48585..32acf65b6f7 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -187,7 +187,7 @@ Property Default block parameters can be one of the following: -- ``Number``: A block number +- ``Number|String|BN|BigNumber``: A block number - ``"genesis"`` - ``String``: The genesis block - ``"latest"`` - ``String``: The latest block (current head of the blockchain) - ``"pending"`` - ``String``: The currently mined block (including pending transactions) @@ -448,11 +448,11 @@ Returns ``Promise`` returns ``Object|Boolean`` - A sync object when the node is currently syncing or ``false``: - - ``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 + - ``startingBlock`` - ``String``: The block number where the sync started. + - ``currentBlock`` - ``String``: The block number where at which block the node currently synced to already. + - ``highestBlock`` - ``String``: The estimated block number to sync to. + - ``knownStates`` - ``String``: The estimated states to download + - ``pulledStates`` - ``String``: The already downloaded states ------- @@ -806,7 +806,7 @@ Returns ``Promise`` returns ``Object`` - The block object: - - ``number`` - ``Number``: The block number. ``null`` when its pending block. + - ``number`` - ``String``: 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. @@ -818,10 +818,10 @@ Returns - ``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. + - ``size`` - ``String``: Integer the size of this block in bytes. + - ``gasLimit`` - ``String``: The maximum gas allowed in this block. + - ``gasUsed`` - ``String``: The total used gas by all transactions in this block. + - ``timestamp`` - ``String``: 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. @@ -836,7 +836,7 @@ Example .then(console.log); > { - "number": 3, + "number": "3", "hash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46", "parentHash": "0x2302e1c0b972d00932deb5dab9eb2982f570597d9d42504c05d9c2147eaf9c88", "nonce": "0xfb6e1a62d119228b", @@ -845,13 +845,13 @@ Example "transactionsRoot": "0x3a1b03875115b79539e5bd33fb00d8f7b7cd61929d5a3c574f507b8acf415bee", "stateRoot": "0xf1133199d44695dfa8fd1bcfe424d82854b5cebef75bddd7e40ea94cda515bcb", "miner": "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty": '21345678965432', - "totalDifficulty": '324567845321', - "size": 616, + "difficulty": "21345678965432", + "totalDifficulty": "324567845321", + "size": "616", "extraData": "0x", - "gasLimit": 3141592, - "gasUsed": 21662, - "timestamp": 1429287689, + "gasLimit": "3141592", + "gasUsed": "21662", + "timestamp": "1429287689", "transactions": [ "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b" ], @@ -1011,15 +1011,15 @@ Returns ``Promise`` returns ``Object`` - A transaction object its hash ``transactionHash``: - ``hash`` 32 Bytes - ``String``: Hash of the transaction. - - ``nonce`` - ``Number``: The number of transactions made by the sender prior to this one. + - ``nonce`` - ``String``: 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. + - ``blockNumber`` - ``String``: 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. + - ``gas`` - ``String``: Gas provided by the sender. - ``input`` - ``String``: The data sent along with the transaction. @@ -1035,15 +1035,15 @@ Example > { "hash": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b", - "nonce": 2, + "nonce": "2", "blockHash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46", - "blockNumber": 3, + "blockNumber": "3", "transactionIndex": 0, "from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "to": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value": '123450000000000000', - "gas": 314159, - "gasPrice": '2000000000000', + "value": "123450000000000000", + "gas": "314159", + "gasPrice": "2000000000000", "input": "0x57cb2fc4" } @@ -1124,14 +1124,14 @@ Returns - ``status`` - ``Boolean``: ``TRUE`` if the transaction was successful, ``FALSE``, if the EVM reverted the transaction. - ``blockHash`` 32 Bytes - ``String``: Hash of the block where this transaction was in. - - ``blockNumber`` - ``Number``: Block number where this transaction was in. + - ``blockNumber`` - ``String``: 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. + - ``cumulativeGasUsed`` - ``String``: The total amount of gas used when this transaction was executed in the block. + - ``gasUsed``- ``String``: The amount of gas used by this specific transaction alone. - ``logs`` - ``Array``: Array of log objects, which this transaction generated. ------- @@ -1148,10 +1148,10 @@ Example "transactionHash": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b", "transactionIndex": 0, "blockHash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46", - "blockNumber": 3, + "blockNumber": "3", "contractAddress": "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", - "cumulativeGasUsed": 314159, - "gasUsed": 30234, + "cumulativeGasUsed": "314159", + "gasUsed": "30234", "logs": [{ // logs as returned by getPastLogs, etc. }, ...] @@ -1185,7 +1185,7 @@ Returns ------- -``Promise`` returns ``Number`` - The number of transactions sent from the given address. +``Promise`` returns ``String`` - The number of transactions sent from the given address. ------- Example @@ -1196,7 +1196,7 @@ Example web3.eth.getTransactionCount("0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe") .then(console.log); - > 1 + > "1" ------------------------------------------------------------------------------ @@ -1221,10 +1221,10 @@ Parameters - ``from`` - ``String|Number``: The address for the sending account. Uses the :ref:`web3.eth.defaultAccount ` property, if not specified. Or an address or index of a local wallet in :ref:`web3.eth.accounts.wallet `. - ``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). + - ``gas`` - ``Number|String|BN|BigNumber``: (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). - ``gasPrice`` - ``Number|String|BN|BigNumber``: (optional) The price of gas for this transaction in :ref:`wei `, defaults to :ref:`web3.eth.gasPrice `. - ``data`` - ``String``: (optional) Either a `ABI byte string `_ containing the data of the function call on a contract, or in the case of a contract-creation transaction the initialisation code. - - ``nonce`` - ``Number``: (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. + - ``nonce`` - ``Number|String|BN|BigNumber``: (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. - ``chain`` - ``String``: (optional) Defaults to ``mainnet``. - ``hardfork`` - ``String``: (optional) Defaults to ``petersburg``. - ``common`` - ``Object``: (optional) The common object @@ -1541,7 +1541,7 @@ Parameters Returns ------- -``Promise`` returns ``Number`` - the used gas for the simulated call/transaction. +``Promise`` returns ``String`` - the used gas for the simulated call/transaction. ------- Example @@ -1598,7 +1598,7 @@ The structure of the returned event ``Object`` in the ``Array`` looks as follows - ``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. +- ``blockNumber`` - ``String``: The block number where this log was created in. ``null`` when still pending. ------- Example diff --git a/packages/web3-core-helpers/src/formatters.js b/packages/web3-core-helpers/src/formatters.js index d96a17330fb..bc53b00334e 100644 --- a/packages/web3-core-helpers/src/formatters.js +++ b/packages/web3-core-helpers/src/formatters.js @@ -52,8 +52,8 @@ var inputStorageKeysFormatter = function (keys) { */ var outputProofFormatter = function (proof) { proof.address = utils.toChecksumAddress(proof.address); - proof.nonce = utils.hexToNumberString(proof.nonce); - proof.balance = utils.hexToNumberString(proof.balance); + proof.nonce = outputBigNumberFormatter(proof.nonce); + proof.balance = outputBigNumberFormatter(proof.balance); return proof; }; @@ -68,6 +68,10 @@ var outputProofFormatter = function (proof) { * @returns {BN} object */ var outputBigNumberFormatter = function (number) { + if (!number) { + return number; + } + return utils.toBN(number).toString(10); }; @@ -95,11 +99,21 @@ var isPredefinedBlockNumber = function (blockNumber) { */ var inputDefaultBlockNumberFormatter = function (blockNumber) { if (this && (blockNumber === undefined || blockNumber === null)) { - return this.defaultBlock; + if (isPredefinedBlockNumber(this.defaultBlock)) { + return this.defaultBlock; + } + + if (this.defaultBlock === 'genesis') { + return '0x0'; + } + + return utils.numberToHex(this.defaultBlock); } + if (blockNumber === 'genesis' || blockNumber === 'earliest') { return '0x0'; } + return inputBlockNumberFormatter(blockNumber); }; @@ -115,6 +129,8 @@ var inputBlockNumberFormatter = function (blockNumber) { return undefined; } else if (isPredefinedBlockNumber(blockNumber)) { return blockNumber; + } else if (blockNumber === 'genesis') { + return '0x0'; } return (utils.isHexStrict(blockNumber)) ? ((_.isString(blockNumber)) ? blockNumber.toLowerCase() : blockNumber) : utils.numberToHex(blockNumber); }; @@ -224,14 +240,12 @@ var inputSignFormatter = function (data) { * @returns {Object} */ var outputTransactionFormatter = function (tx) { - if (tx.blockNumber !== null) - tx.blockNumber = utils.hexToNumber(tx.blockNumber); - if (tx.transactionIndex !== null) - tx.transactionIndex = utils.hexToNumber(tx.transactionIndex); - tx.nonce = utils.hexToNumber(tx.nonce); - tx.gas = utils.hexToNumber(tx.gas); - tx.gasPrice = outputBigNumberFormatter(tx.gasPrice); + tx.transactionIndex = utils.hexToNumber(tx.transactionIndex); + tx.blockNumber = outputBigNumberFormatter(tx.blockNumber); + tx.nonce = outputBigNumberFormatter(tx.nonce); tx.value = outputBigNumberFormatter(tx.value); + tx.gasPrice = outputBigNumberFormatter(tx.gasPrice); + tx.gas = outputBigNumberFormatter(tx.gas); if (tx.to && utils.isAddress(tx.to)) { // tx.to could be `0x0` or `null` while contract creation tx.to = utils.toChecksumAddress(tx.to); @@ -258,12 +272,10 @@ var outputTransactionReceiptFormatter = function (receipt) { throw new Error('Received receipt is invalid: ' + receipt); } - if (receipt.blockNumber !== null) - receipt.blockNumber = utils.hexToNumber(receipt.blockNumber); - if (receipt.transactionIndex !== null) - receipt.transactionIndex = utils.hexToNumber(receipt.transactionIndex); - receipt.cumulativeGasUsed = utils.hexToNumber(receipt.cumulativeGasUsed); - receipt.gasUsed = utils.hexToNumber(receipt.gasUsed); + receipt.blockNumber = outputBigNumberFormatter(receipt.blockNumber); + receipt.cumulativeGasUsed = outputBigNumberFormatter(receipt.cumulativeGasUsed); + receipt.gasUsed = outputBigNumberFormatter(receipt.gasUsed); + receipt.transactionIndex = utils.hexToNumber(receipt.transactionIndex); if (_.isArray(receipt.logs)) { receipt.logs = receipt.logs.map(outputLogFormatter); @@ -288,19 +300,20 @@ var outputTransactionReceiptFormatter = function (receipt) { * @returns {Object} */ var outputBlockFormatter = function (block) { - // transform to number - block.gasLimit = utils.hexToNumber(block.gasLimit); - block.gasUsed = utils.hexToNumber(block.gasUsed); - block.size = utils.hexToNumber(block.size); - block.timestamp = utils.hexToNumber(block.timestamp); - if (block.number !== null) - block.number = utils.hexToNumber(block.number); - - if (block.difficulty) + block.gasLimit = outputBigNumberFormatter(block.gasLimit); + block.gasUsed = outputBigNumberFormatter(block.gasUsed); + block.size = outputBigNumberFormatter(block.size); + block.timestamp = outputBigNumberFormatter(block.timestamp); + block.number = outputBigNumberFormatter(block.number); + + if (block.difficulty) { block.difficulty = outputBigNumberFormatter(block.difficulty); - if (block.totalDifficulty) + } + + if (block.totalDifficulty) { block.totalDifficulty = outputBigNumberFormatter(block.totalDifficulty); + } if (_.isArray(block.transactions)) { block.transactions.forEach(function (item) { @@ -368,7 +381,6 @@ var inputLogFormatter = function (options) { * @returns {Object} log */ var outputLogFormatter = function (log) { - // generate a custom log id if (typeof log.blockHash === 'string' && typeof log.transactionHash === 'string' && @@ -379,12 +391,9 @@ var outputLogFormatter = function (log) { log.id = null; } - if (log.blockNumber !== null) - log.blockNumber = utils.hexToNumber(log.blockNumber); - if (log.transactionIndex !== null) - log.transactionIndex = utils.hexToNumber(log.transactionIndex); - if (log.logIndex !== null) - log.logIndex = utils.hexToNumber(log.logIndex); + log.blockNumber = outputBigNumberFormatter(log.blockNumber); + log.transactionIndex = utils.hexToNumber(log.transactionIndex); + log.logIndex = utils.hexToNumber(log.logIndex); if (log.address) { log.address = utils.toChecksumAddress(log.address); @@ -469,12 +478,12 @@ var inputAddressFormatter = function (address) { var outputSyncingFormatter = function (result) { - result.startingBlock = utils.hexToNumber(result.startingBlock); - result.currentBlock = utils.hexToNumber(result.currentBlock); - result.highestBlock = utils.hexToNumber(result.highestBlock); + result.startingBlock = outputBigNumberFormatter(result.startingBlock); + result.currentBlock = outputBigNumberFormatter(result.currentBlock); + result.highestBlock = outputBigNumberFormatter(result.highestBlock); if (result.knownStates) { - result.knownStates = utils.hexToNumber(result.knownStates); - result.pulledStates = utils.hexToNumber(result.pulledStates); + result.knownStates = outputBigNumberFormatter(result.knownStates); + result.pulledStates = outputBigNumberFormatter(result.pulledStates); } return result; diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index 98cea3d63c5..e5fa5443292 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -299,7 +299,7 @@ Method.prototype._confirmTransaction = function(defer, result, payload) { if (existingReceipt === undefined || confirmationCount !== 0) { if (isPolling) { // Check if actually a new block is existing on polling if (lastBlock) { - block = await _ethereumCall.getBlockByNumber(lastBlock.number + 1); + block = await _ethereumCall.getBlockByNumber(utils.toBN(lastBlock.number).add(1)); if (block) { lastBlock = block; defer.eventEmitter.emit('confirmation', confirmationCount, receipt); diff --git a/packages/web3-core/types/index.d.ts b/packages/web3-core/types/index.d.ts index e4c561b19c0..a6d2d3fc830 100644 --- a/packages/web3-core/types/index.d.ts +++ b/packages/web3-core/types/index.d.ts @@ -104,15 +104,15 @@ export interface PromiEvent extends Promise { export interface Transaction { hash: string; - nonce: number; + nonce: string; blockHash: string | null; - blockNumber: number | null; + blockNumber: string | null; transactionIndex: number | null; from: string; to: string | null; value: string; gasPrice: string; - gas: number; + gas: string; input: string; } @@ -181,12 +181,12 @@ export interface TransactionReceipt { transactionHash: string; transactionIndex: number; blockHash: string; - blockNumber: number; + blockNumber: string; from: string; to: string; contractAddress?: string; - cumulativeGasUsed: number; - gasUsed: number; + cumulativeGasUsed: string; + gasUsed: string; logs: Log[]; logsBloom: string; events?: { @@ -202,7 +202,7 @@ export interface EventLog { transactionIndex: number; transactionHash: string; blockHash: string; - blockNumber: number; + blockNumber: string; raw?: {data: string; topics: any[]}; } @@ -214,7 +214,7 @@ export interface Log { transactionIndex: number; transactionHash: string; blockHash: string; - blockNumber: number; + blockNumber: string; } // had to move `web3-net` due to other modules in `1.x` not referencing @@ -408,7 +408,7 @@ export interface LogsOptions { topics?: Array; } -export type BlockNumber = string | number | BN | BigNumber | 'latest' | 'pending' | 'earliest'; +export type BlockNumber = string | number | BN | BigNumber | 'latest' | 'pending' | 'earliest' | 'genesis'; export type provider = | HttpProvider diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index ca73e7bffab..2ad6ca62f36 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -159,7 +159,7 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca error = new Error('"gas" is missing'); } - if (tx.nonce < 0 || + if (utils.toBN(tx.nonce).ltn(0) || tx.gas < 0 || tx.gasPrice < 0 || tx.chainId < 0) { diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index 0920b10b8b6..23ac40aaf9a 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -801,7 +801,7 @@ Contract.prototype._executeMethod = function _executeMethod(){ call: 'eth_estimateGas', params: 1, inputFormatter: [formatters.inputCallFormatter], - outputFormatter: utils.hexToNumber, + outputFormatter: formatters.outputBigNumberFormatter, requestManager: _this._parent._requestManager, accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) defaultAccount: _this._parent.defaultAccount, diff --git a/packages/web3-eth-contract/types/index.d.ts b/packages/web3-eth-contract/types/index.d.ts index a9e2dabf478..c1a1031d45b 100644 --- a/packages/web3-eth-contract/types/index.d.ts +++ b/packages/web3-eth-contract/types/index.d.ts @@ -31,7 +31,7 @@ export class Contract { private _address: string; private _jsonInterface: AbiItem[]; defaultAccount: string | null; - defaultBlock: string | number; + defaultBlock: BlockNumber; defaultCommon: Common; defaultHardfork: hardfork; defaultChain: chain; @@ -91,18 +91,18 @@ export interface ContractSendMethod { estimateGas( options: EstimateGasOptions, callback?: (err: Error, gas: number) => void - ): Promise; + ): Promise; - estimateGas(callback: (err: Error, gas: number) => void): Promise; + estimateGas(callback: (err: Error, gas: number) => void): Promise; estimateGas( options: EstimateGasOptions, callback: (err: Error, gas: number) => void - ): Promise; + ): Promise; - estimateGas(options: EstimateGasOptions): Promise; + estimateGas(options: EstimateGasOptions): Promise; - estimateGas(): Promise; + estimateGas(): Promise; encodeABI(): string; } @@ -157,6 +157,6 @@ export interface EventData { transactionIndex: number; transactionHash: string; blockHash: string; - blockNumber: number; + blockNumber: string; address: string; } diff --git a/packages/web3-eth-contract/types/tests/contract-test.ts b/packages/web3-eth-contract/types/tests/contract-test.ts index 631e08e88ad..8dce8d5a16c 100644 --- a/packages/web3-eth-contract/types/tests/contract-test.ts +++ b/packages/web3-eth-contract/types/tests/contract-test.ts @@ -25,7 +25,7 @@ const contract = new Contract([]); // $ExpectType string | null contract.defaultAccount; -// $ExpectType string | number +// $ExpectType BlockNumber contract.defaultBlock; // $ExpectType Common @@ -119,7 +119,7 @@ contract.getPastEvents( // $ExpectType Promise contract.getPastEvents('MyEvent', (error, events) => {}); -// $ExpectType Promise +// $ExpectType Promise contract .deploy({ data: '0x12345...', @@ -127,7 +127,7 @@ contract }) .estimateGas(); -// $ExpectType Promise +// $ExpectType Promise contract .deploy({ data: '0x12345...', @@ -135,7 +135,7 @@ contract }) .estimateGas({ from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe' }); -// $ExpectType Promise +// $ExpectType Promise contract .deploy({ data: '0x12345...', diff --git a/packages/web3-eth-ens/src/ENS.js b/packages/web3-eth-ens/src/ENS.js index 741eb5b2b4e..c92c952f961 100644 --- a/packages/web3-eth-ens/src/ENS.js +++ b/packages/web3-eth-ens/src/ENS.js @@ -23,6 +23,7 @@ var config = require('./config'); var Registry = require('./contracts/Registry'); var ResolverMethodHandler = require('./lib/ResolverMethodHandler'); +var utils = require('web3-utils'); /** * Constructs a new instance of ENS @@ -171,10 +172,20 @@ ENS.prototype.setMultihash = function (name, hash, sendOptions, callback) { ENS.prototype.checkNetwork = function () { var self = this; return self.eth.getBlock('latest').then(function (block) { - var headAge = new Date() / 1000 - block.timestamp; - if (headAge > 3600) { + var headAge; + var now = utils.toBN((Math.floor(new Date().getTime() / 1000))); + var timestamp = utils.toBN(block.timestamp); + + if (timestamp.bitLength() <= 53) { + headAge = now.sub(timestamp); + } else { + headAge = now.sub(timestamp.divn(1000000000)); + } + + if (headAge.gtn(3600)) { throw new Error("Network not synced; last block was " + headAge + " seconds ago"); } + return self.eth.net.getNetworkType(); }).then(function (networkType) { var addr = config.addresses[networkType]; diff --git a/packages/web3-eth/src/index.js b/packages/web3-eth/src/index.js index ced9b9e7d15..563f818a66c 100644 --- a/packages/web3-eth/src/index.js +++ b/packages/web3-eth/src/index.js @@ -341,7 +341,7 @@ var Eth = function Eth() { name: 'getBlockNumber', call: 'eth_blockNumber', params: 0, - outputFormatter: utils.hexToNumber + outputFormatter: formatter.outputBigNumberFormatter }), new Method({ name: 'getBalance', @@ -417,7 +417,7 @@ var Eth = function Eth() { call: 'eth_getTransactionCount', params: 2, inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter], - outputFormatter: utils.hexToNumber + outputFormatter: formatter.outputBigNumberFormatter }), new Method({ name: 'sendSignedTransaction', @@ -458,7 +458,7 @@ var Eth = function Eth() { call: 'eth_estimateGas', params: 1, inputFormatter: [formatter.inputCallFormatter], - outputFormatter: utils.hexToNumber + outputFormatter: formatter.outputBigNumberFormatter }), new Method({ name: 'submitWork', diff --git a/packages/web3-eth/types/index.d.ts b/packages/web3-eth/types/index.d.ts index 83d67ffd0ce..f475312e046 100644 --- a/packages/web3-eth/types/index.d.ts +++ b/packages/web3-eth/types/index.d.ts @@ -80,7 +80,7 @@ export class Eth { readonly givenProvider: any; static readonly givenProvider: any; defaultAccount: string | null; - defaultBlock: string | number; + defaultBlock: BlockNumber; defaultCommon: Common; defaultHardfork: hardfork; defaultChain: chain; @@ -122,7 +122,7 @@ export class Eth { isSyncing( callback?: (error: Error, syncing: Syncing) => void - ): Promise; + ): Promise; getCoinbase( callback?: (error: Error, coinbaseAddress: string) => void @@ -154,7 +154,7 @@ export class Eth { getBlockNumber( callback?: (error: Error, blockNumber: number) => void - ): Promise; + ): Promise; getBalance( address: string @@ -258,10 +258,6 @@ export class Eth { callback?: (error: Error, transaction: Transaction) => void ): Promise; - getPendingTransactions( - callback?: (error: Error, result: Transaction[]) => void - ): Promise; - getTransactionFromBlock( blockHashOrBlockNumber: BlockNumber | string, indexNumber: number | string | BN, @@ -276,20 +272,20 @@ export class Eth { ) => void ): Promise; - getTransactionCount(address: string): Promise; + getTransactionCount(address: string): Promise; getTransactionCount( address: string, defaultBlock: BlockNumber - ): Promise; + ): Promise; getTransactionCount( address: string, callback?: (error: Error, count: number) => void - ): Promise; + ): Promise; getTransactionCount( address: string, defaultBlock: BlockNumber, callback?: (error: Error, count: number) => void - ): Promise; + ): Promise; sendTransaction( transactionConfig: TransactionConfig, @@ -345,7 +341,7 @@ export class Eth { estimateGas( transactionConfig: TransactionConfig, callback?: (error: Error, gas: number) => void - ): Promise; + ): Promise; getPastLogs( options: PastLogsOptions, @@ -379,15 +375,15 @@ export class Eth { } export interface Syncing { - StartingBlock: number; - CurrentBlock: number; - HighestBlock: number; - KnownStates: number; - PulledStates: number; + startingBlock: string; + currentBlock: string; + highestBlock: string; + knownStates: string; + pulledStates: string; } export interface BlockHeader { - number: number; + number: string; hash: string; parentHash: string; nonce: string; @@ -398,9 +394,9 @@ export interface BlockHeader { receiptRoot: string; miner: string; extraData: string; - gasLimit: number; - gasUsed: number; - timestamp: number | string; + gasLimit: string; + gasUsed: string; + timestamp: string; } // TODO: This interface does exist to provide backwards-compatibility and can get removed on a minor release @@ -409,9 +405,9 @@ export interface Block extends BlockTransactionBase { } export interface BlockTransactionBase extends BlockHeader { - size: number; - difficulty: number; - totalDifficulty: number; + size: string; + difficulty: string; + totalDifficulty: string; uncles: string[]; } diff --git a/packages/web3-eth/types/tests/eth.tests.ts b/packages/web3-eth/types/tests/eth.tests.ts index c62a89c8365..0aadb7fc5ba 100644 --- a/packages/web3-eth/types/tests/eth.tests.ts +++ b/packages/web3-eth/types/tests/eth.tests.ts @@ -46,7 +46,7 @@ const eth = new Eth('http://localhost:8545'); // $ExpectType string | null eth.defaultAccount; -// $ExpectType string | number +// $ExpectType BlockNumber eth.defaultBlock; // $ExpectType Common @@ -132,7 +132,7 @@ eth.givenProvider; // $ExpectType string | null eth.defaultAccount; -// $ExpectType string | number +// $ExpectType BlockNumber eth.defaultBlock; // $ExpectType boolean @@ -146,9 +146,9 @@ eth.getProtocolVersion(); // $ExpectType Promise eth.getProtocolVersion((error: Error, protocolVersion: string) => {}); -// $ExpectType Promise +// $ExpectType Promise eth.isSyncing(); -// $ExpectType Promise +// $ExpectType Promise eth.isSyncing((error: Error, syncing: Syncing) => {}); // $ExpectType Promise @@ -186,9 +186,9 @@ eth.getAccounts(); // $ExpectType Promise eth.getAccounts((error: Error, accounts: string[]) => {}); -// $ExpectType Promise +// $ExpectType Promise eth.getBlockNumber(); -// $ExpectType Promise +// $ExpectType Promise eth.getBlockNumber((error: Error, blockNumber: number) => {}); // $ExpectType Promise @@ -354,29 +354,29 @@ eth.getTransactionReceipt( (error: Error, transactionReceipt: TransactionReceipt) => {} ); -// $ExpectType Promise +// $ExpectType Promise eth.getTransactionCount('0x407d73d8a49eeb85d32cf465507dd71d507100c1'); -// $ExpectType Promise +// $ExpectType Promise eth.getTransactionCount('0x407d73d8a49eeb85d32cf465507dd71d507100c1', 1000); -// $ExpectType Promise +// $ExpectType Promise eth.getTransactionCount('0x407d73d8a49eeb85d32cf465507dd71d507100c1', '1000'); -// $ExpectType Promise +// $ExpectType Promise eth.getTransactionCount( '0x407d73d8a49eeb85d32cf465507dd71d507100c1', (error: Error, count: number) => {} ); -// $ExpectType Promise +// $ExpectType Promise eth.getTransactionCount( '0x407d73d8a49eeb85d32cf465507dd71d507100c1', (error: Error, count: number) => {} ); -// $ExpectType Promise +// $ExpectType Promise eth.getTransactionCount( '0x407d73d8a49eeb85d32cf465507dd71d507100c1', 1000, (error: Error, count: number) => {} ); -// $ExpectType Promise +// $ExpectType Promise eth.getTransactionCount( '0x407d73d8a49eeb85d32cf465507dd71d507100c1', '1000', @@ -532,13 +532,13 @@ eth.call( (error: Error, data: string) => {} ); -// $ExpectType Promise +// $ExpectType Promise eth.estimateGas({ to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', data: '0xc6888fa10000000000000000000000000000000000000000000000000000000000000003' }); -// $ExpectType Promise +// $ExpectType Promise eth.estimateGas( { to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', @@ -586,12 +586,6 @@ eth.submitWork( (error: Error, result: boolean) => {} ); -// $ExpectType Promise -eth.getPendingTransactions(); - -// $ExpectType Promise -eth.getPendingTransactions((error: Error, result: Transaction[]) => {}); - // $ExpectType Promise eth.getProof( '0x1234567890123456789012345678901234567890', diff --git a/test/contract.js b/test/contract.js index 18d0a9c6c77..4173ccf7d2d 100644 --- a/test/contract.js +++ b/test/contract.js @@ -461,7 +461,7 @@ var runTests = function(contractFactory) { '0000000000000000000000000000000000000000000000000000000000000008' }); - assert.equal(result.blockNumber, 3); + assert.equal(result.blockNumber, '3'); assert.equal(result.blockHash, '0x1345'); assert.equal(result.logIndex, 4); assert.equal(result.id, 'log_9ff24cb4'); @@ -565,11 +565,11 @@ var runTests = function(contractFactory) { assert.deepEqual(result, { contractAddress: address, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, - blockNumber: 10, + blockNumber: '10', blockHash: '0xbf1234', - gasUsed: 0 + gasUsed: '0' }); done(); }); @@ -659,11 +659,11 @@ var runTests = function(contractFactory) { .on('receipt', function(result){ assert.deepEqual(result, { contractAddress: address, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, - blockNumber: 10, + blockNumber: '10', blockHash: '0xbf1234', - gasUsed: 0 + gasUsed: '0' }); done(); }).catch(console.log); @@ -1477,7 +1477,7 @@ var runTests = function(contractFactory) { var contract = contractFactory(abi, address, provider); contract.methods.balance(address).estimateGas(function (err, res) { - assert.deepEqual(res, 50); + assert.deepEqual(res, '50'); done(); }); }); @@ -1499,7 +1499,7 @@ var runTests = function(contractFactory) { contract.deploy({ arguments: [address, 50] }).estimateGas(function (err, res) { - assert.deepEqual(res, 10); + assert.deepEqual(res, '10'); done(); }); }); @@ -1796,16 +1796,16 @@ var runTests = function(contractFactory) { // wont throw if it errors ?! assert.deepEqual(receipt, { contractAddress: null, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, transactionHash: '0x1234', - blockNumber: 10, + blockNumber: '10', blockHash: '0x1234', - gasUsed: 0, + gasUsed: '0', events: { Unchanged: { address: address, - blockNumber: 10, + blockNumber: '10', transactionHash: '0x1234', blockHash: '0x1345', logIndex: 4, @@ -1830,7 +1830,7 @@ var runTests = function(contractFactory) { }, Changed: { address: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', - blockNumber: 10, + blockNumber: '10', transactionHash: '0x1234', blockHash: '0x1345', logIndex: 4, @@ -1959,17 +1959,17 @@ var runTests = function(contractFactory) { // wont throw if it errors ?! nope: causes a timeout assert.deepEqual(receipt, { contractAddress: null, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, transactionHash: '0x1234', - blockNumber: 10, + blockNumber: '10', blockHash: '0x1234', - gasUsed: 0, + gasUsed: '0', events: { Changed: [ { address: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', - blockNumber: 10, + blockNumber: '10', transactionHash: '0x1234', blockHash: '0x1345', logIndex: 4, @@ -1995,7 +1995,7 @@ var runTests = function(contractFactory) { } }, { address: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', - blockNumber: 10, + blockNumber: '10', transactionHash: '0x1234', blockHash: '0x1345', logIndex: 5, @@ -2111,16 +2111,16 @@ var runTests = function(contractFactory) { // wont throw if it errors ?! assert.deepEqual(receipt, { contractAddress: null, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, transactionHash: '0x1234', - blockNumber: 10, + blockNumber: '10', blockHash: '0x43ffdd', - gasUsed: 0, + gasUsed: '0', events: { Unchanged: { address: address, - blockNumber: 10, + blockNumber: '10', transactionHash: '0x1234', blockHash: '0x1345', logIndex: 4, @@ -2145,7 +2145,7 @@ var runTests = function(contractFactory) { }, Changed: { address: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', - blockNumber: 10, + blockNumber: '10', transactionHash: '0x1234', blockHash: '0x1345', logIndex: 4, @@ -2226,12 +2226,12 @@ var runTests = function(contractFactory) { if(count === 1) { assert.deepEqual(receipt, { contractAddress: null, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, transactionHash: '0x1234', - blockNumber: 10, + blockNumber: '10', blockHash: '0x1234', - gasUsed: 0, + gasUsed: '0', events: {} }); @@ -2240,12 +2240,12 @@ var runTests = function(contractFactory) { if(count === 2) { assert.deepEqual(receipt, { contractAddress: null, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, transactionHash: '0x1234', - blockNumber: 10, + blockNumber: '10', blockHash: '0x1234', - gasUsed: 0, + gasUsed: '0', events: {} }); @@ -2693,7 +2693,7 @@ var runTests = function(contractFactory) { signature: "0xc00c1c37cc8b83163fb4fddc06c74d1d5c00d74648e7cb28c0ebada3e32fd62c", id: "log_9ff24cb4", address: address, - blockNumber: 3, + blockNumber: '3', transactionHash: '0x1234', blockHash: '0x1345', logIndex: 4, @@ -2719,7 +2719,7 @@ var runTests = function(contractFactory) { signature: "0xc00c1c37cc8b83163fb4fddc06c74d1d5c00d74648e7cb28c0ebada3e32fd62c", id: "log_29c93e15", address: address, - blockNumber: 4, + blockNumber: '4', transactionHash: '0x1235', blockHash: '0x1346', logIndex: 1, @@ -3088,10 +3088,10 @@ describe('typical usage', function() { arguments: [account.address, 200] }).send({ from: account.address, - gas: 54872, - gasPrice: 3000, + gas: '54872', + gasPrice: '3000', chainId: 1, - nonce: 1, + nonce: '1', chain: 'mainnet', hardfork: 'petersburg' }) diff --git a/test/e2e.contract.deploy.js b/test/e2e.contract.deploy.js index 380881c9bc0..92df70d7d92 100644 --- a/test/e2e.contract.deploy.js +++ b/test/e2e.contract.deploy.js @@ -151,7 +151,7 @@ describe('contract.deploy [ @E2E ]', function() { .on('confirmation', async (number, receipt) => { if (number === 1) { // Confirmation numbers are zero indexed var endBlock = await web3.eth.getBlockNumber(); - assert(endBlock >= (startBlock + 2)); + assert(parseInt(endBlock) >= (parseInt(startBlock) + 2)); resolve(); } }) diff --git a/test/e2e.method.send.js b/test/e2e.method.send.js index d9bfa9f1713..f100f66a09c 100644 --- a/test/e2e.method.send.js +++ b/test/e2e.method.send.js @@ -156,7 +156,7 @@ describe('method.send [ @E2E ]', function() { .on('confirmation', async (number, receipt) => { if (number === 1) { // Confirmation numbers are zero indexed var endBlock = await web3.eth.getBlockNumber(); - assert(endBlock >= (startBlock + 2)); + assert(parseInt(endBlock) >= (parseInt(startBlock) + 2)); resolve(); } }) diff --git a/test/eth.estimateGas.js b/test/eth.estimateGas.js index 808f6828456..45ea0d839c9 100644 --- a/test/eth.estimateGas.js +++ b/test/eth.estimateGas.js @@ -16,7 +16,7 @@ var tests = [{ gasPrice: '0xb' }], result: '0x31981', - formattedResult: 203137, + formattedResult: '203137', call: 'eth_'+ method }]; diff --git a/test/eth.getBlock.js b/test/eth.getBlock.js index 1fe66a346da..13fc9fb3243 100644 --- a/test/eth.getBlock.js +++ b/test/eth.getBlock.js @@ -23,7 +23,7 @@ var blockResult = { "uncles": ["0x460cfb8472af2c5fd05b5a2", "0xd5460cfb8472af2c5fd05b5a2"] }; var formattedBlockResult = { - "number": 436, + "number": '436', "hash": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", "parentHash": "0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5", "nonce": "0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2", @@ -34,11 +34,11 @@ var formattedBlockResult = { "miner": "0x4E65FDa2159562a496F9f3522f89122A3088497a", "difficulty": '163591', "totalDifficulty": '163591', - "size": 163591, + "size": '163591', "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000", - "gasLimit": 653145, - "gasUsed": 653145, - "timestamp": 1424182926, + "gasLimit": '653145', + "gasUsed": '653145', + "timestamp": '1424182926', "transactions": ['0x460cfb8472af2c5fd05b5a2','0x460cfb8472af2c5fd05b5a2'], "uncles": ["0x460cfb8472af2c5fd05b5a2", "0xd5460cfb8472af2c5fd05b5a2"] }; @@ -76,7 +76,7 @@ var blockResultWithTx = { "uncles": ["0x460cfb8472af2c5fd05b5a2", "0xd5460cfb8472af2c5fd05b5a2"] }; var formattedBlockResultWithTx = { - "number": 436, + "number": '436', "hash": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", "parentHash": "0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5", "nonce": "0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2", @@ -87,22 +87,22 @@ var formattedBlockResultWithTx = { "miner": "0x4E65FDa2159562a496F9f3522f89122A3088497a", "difficulty": '163591', "totalDifficulty": '163591', - "size": 163591, + "size": '163591', "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000", - "gasLimit": 653145, - "gasUsed": 653145, - "timestamp": 1424182926, + "gasLimit": '653145', + "gasUsed": '653145', + "timestamp": '1424182926', "transactions": [{ "status": "mined", "hash":"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", - "nonce": 2, + "nonce": '2', "blockHash": "0x6fd9e2a26ab", - "blockNumber": 5599, + "blockNumber": '5599', "transactionIndex": 1, "from":"0x407D73d8a49eeb85D32Cf465507dd71d507100c1", "to":"0x85F43D8a49eeB85d32Cf465507DD71d507100C1d", "value": '520464', - "gas": 520464, + "gas": '520464', "gasPrice": '10000000000000', "input":"0x603880600c6000396000f30060", }], diff --git a/test/eth.getBlockNumber.js b/test/eth.getBlockNumber.js index d5357dd09bd..30aa62ab1fe 100644 --- a/test/eth.getBlockNumber.js +++ b/test/eth.getBlockNumber.js @@ -4,7 +4,7 @@ var method = 'getBlockNumber'; var tests = [{ result: '0xb', - formattedResult: 11, + formattedResult: '11', call: 'eth_blockNumber' }]; diff --git a/test/eth.getTransaction.js b/test/eth.getTransaction.js index d0fae0de54f..7bcb45ff2cb 100644 --- a/test/eth.getTransaction.js +++ b/test/eth.getTransaction.js @@ -16,15 +16,15 @@ var txResult = { "input":"0x603880600c6000396000f30060" }; var formattedTxResult = { - "hash":"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", - "nonce":5, + "hash": "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", + "nonce": '5', "blockHash": "0x6fd9e2a26ab", - "blockNumber": 5599, + "blockNumber": '5599', "transactionIndex": 1, "from":"0x407D73d8a49eeb85D32Cf465507dd71d507100c1", // checksum address "to":"0x85F43D8a49eeB85d32Cf465507DD71d507100C1d", // checksum address "value": '520464', - "gas": 520464, + "gas": '520464', "gasPrice": '10000000000000', "input":"0x603880600c6000396000f30060" }; diff --git a/test/eth.getTransactionFromBlock.js b/test/eth.getTransactionFromBlock.js index 32260659ac2..a892b167283 100644 --- a/test/eth.getTransactionFromBlock.js +++ b/test/eth.getTransactionFromBlock.js @@ -18,15 +18,15 @@ var txResult = { }; var formattedTxResult = { "status": "mined", - "hash":"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", - "nonce":11, + "hash": "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", + "nonce": '11', "blockHash": "0x6fd9e2a26ab", - "blockNumber": 5599, + "blockNumber": '5599', "transactionIndex": 1, "from":"0x407D73d8a49eeb85D32Cf465507dd71d507100c1", // checksum address "to":"0x85F43D8a49eeB85d32Cf465507DD71d507100C1d", // checksum address "value": '520464', - "gas": 520464, + "gas": '520464', "gasPrice": '10000000000000', "input":"0x603880600c6000396000f30060" }; diff --git a/test/eth.getTransactionReceipt.js b/test/eth.getTransactionReceipt.js index dabb7f6bb64..d5206ba28ec 100644 --- a/test/eth.getTransactionReceipt.js +++ b/test/eth.getTransactionReceipt.js @@ -30,17 +30,17 @@ var txResult = { }; var formattedTxResult = { "blockHash": "0x6fd9e2a26ab", - "blockNumber": 5599, + "blockNumber": '5599', "transactionHash":"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "transactionIndex": 1, "contractAddress":"0x407D73d8a49eeb85D32Cf465507dd71d507100c1", // checksum address - "cumulativeGasUsed": 520464, - "gasUsed": 520464, + "cumulativeGasUsed": '520464', + "gasUsed": '520464', "logs": [{ id: "log_2b801386", transactionIndex: 1000, logIndex: 1000, - blockNumber: 1000, + blockNumber: '1000', transactionHash: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', blockHash: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', data: '0x7b2274657374223a2274657374227', @@ -79,12 +79,12 @@ var tests = [{ formattedResult: { "status": true, "blockHash": "0x6fd9e2a26ab", - "blockNumber": 5599, + "blockNumber": '5599', "transactionHash":"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "transactionIndex": 1, "contractAddress":"0x407D73d8a49eeb85D32Cf465507dd71d507100c1", // checksum address - "cumulativeGasUsed": 520464, - "gasUsed": 520464, + "cumulativeGasUsed": '520464', + "gasUsed": '520464', }, call: 'eth_'+ method },{ @@ -103,12 +103,12 @@ var tests = [{ formattedResult: { "status": false, "blockHash": "0x6fd9e2a26ab", - "blockNumber": 5599, + "blockNumber": '5599', "transactionHash":"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "transactionIndex": 16, "contractAddress":"0x407D73d8a49eeb85D32Cf465507dd71d507100c1", // checksum address - "cumulativeGasUsed": 520464, - "gasUsed": 520464, + "cumulativeGasUsed": '520464', + "gasUsed": '520464', }, call: 'eth_'+ method }]; diff --git a/test/eth.getUncle.js b/test/eth.getUncle.js index 31c3a91a948..079c1500554 100644 --- a/test/eth.getUncle.js +++ b/test/eth.getUncle.js @@ -23,7 +23,7 @@ var blockResult = { "uncles": ["0x460cfb8472af2c5fd05b5a2", "0xd5460cfb8472af2c5fd05b5a2"] }; var formattedBlockResult = { - "number": 436, + "number": '436', "hash": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", "parentHash": "0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5", "nonce": "0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2", @@ -34,11 +34,11 @@ var formattedBlockResult = { "miner": "0x4E65FDa2159562a496F9f3522f89122A3088497a", // checksum address "difficulty": '163591', "totalDifficulty": '163591', - "size": 163591, + "size": '163591', "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000", - "gasLimit": 653145, - "gasUsed": 653145, - "timestamp": 1424182926, + "gasLimit": '653145', + "gasUsed": '653145', + "timestamp": '1424182926', "transactions": ['0x460cfb8472af2c5fd05b5a2','0x460cfb8472af2c5fd05b5a2'], "uncles": ["0x460cfb8472af2c5fd05b5a2", "0xd5460cfb8472af2c5fd05b5a2"] }; @@ -76,7 +76,7 @@ var blockResultWithTx = { "uncles": ["0x460cfb8472af2c5fd05b5a2", "0xd5460cfb8472af2c5fd05b5a2"] }; var formattedBlockResultWithTx = { - "number": 436, + "number": '436', "hash": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", "parentHash": "0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5", "nonce": "0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2", @@ -87,22 +87,22 @@ var formattedBlockResultWithTx = { "miner": "0x4E65FDa2159562a496F9f3522f89122A3088497a", // checksum address "difficulty": '163591', "totalDifficulty": '163591', - "size": 163591, + "size": '163591', "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000", - "gasLimit": 653145, - "gasUsed": 653145, - "timestamp": 1424182926, + "gasLimit": '653145', + "gasUsed": '653145', + "timestamp": '1424182926', "transactions": [{ // "status": "mined", "hash":"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", - "nonce": 2, + "nonce": '2', "blockHash": "0x6fd9e2a26ab", - "blockNumber": 5599, + "blockNumber": '5599', "transactionIndex": 1, "from":"0x407D73d8a49eeb85D32Cf465507dd71d507100c1", // checksum address "to":"0x85F43D8a49eeB85d32Cf465507DD71d507100C1d", // checksum address "value": '520464', - "gas": 520464, + "gas": '520464', "gasPrice": '10000000000000', "input":"0x603880600c6000396000f30060", }], diff --git a/test/eth.sendTransaction.js b/test/eth.sendTransaction.js index 4a77bd8e791..dcd6269f041 100644 --- a/test/eth.sendTransaction.js +++ b/test/eth.sendTransaction.js @@ -287,12 +287,12 @@ describe(method, function () { // test receipt assert.deepEqual(result, { "blockHash": "0x6fd9e2a26ab", - "blockNumber": 5599, + "blockNumber": "5599", "transactionHash":"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "transactionIndex": 1, "contractAddress":"0x407D73d8a49eeb85D32Cf465507dd71d507100c1", // checksum address - "cumulativeGasUsed": 520464, - "gasUsed": 520464 + "cumulativeGasUsed": '520464', + "gasUsed": '520464' }); } else { assert.deepEqual(result, test.formattedResult); diff --git a/test/eth.subscribe.js b/test/eth.subscribe.js index 4f2db3b1308..2c0452667a5 100644 --- a/test/eth.subscribe.js +++ b/test/eth.subscribe.js @@ -40,20 +40,20 @@ var tests = [{ difficulty: "24022326322090", totalDifficulty: "24022326322090", extraData: "0xd983010305844765746887676f312e342e328777696e646f7773", - gasLimit: 4712388, - gasUsed: 231000, + gasLimit: '4712388', + gasUsed: '231000', hash: "0x950427f707bf395fda0092d4f5dcbcf32d632106fb08e397124d0726082693e6", logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", miner: "0xf8b483DbA2c3B7176a3Da549ad41A48BB3121069", // checksum address nonce: "0x084149998194cc5f", - number: 1263817, + number: '1263817', parentHash: "0x7736fab79e05dc611604d22470dadad26f56fe494421b5b333de816ce1f25701", receiptRoot: "0x2fab35823ad00c7bb388595cb46652fe7886e00660a01e867824d3dceb1c8d36", sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", stateRoot: "0xb3346685172db67de536d8765c43c31009d0eb3bd9c501c9be3229203f15f378", - timestamp: 1459613688, + timestamp: '1459613688', transactionsRoot: "0x0167ffa60e3ebc0b080cdb95f7c0087dd6c0e61413140e39d94d3468d7c9689f", - size: 0 + size: '0' }] }, // PENDING TRANSACTIONS @@ -108,7 +108,7 @@ var tests = [{ subscriptionResults: [{ id: "log_d43624aa", blockHash: "0x43534ffddd", - blockNumber: 12834, + blockNumber: '12834', logIndex: 35, transactionHash: '0x2345fdfdf', transactionIndex: 1, @@ -151,7 +151,7 @@ var tests = [{ subscriptionResults: [{ id: "log_d43624aa", blockHash: "0x43534ffddd", - blockNumber: 12834, + blockNumber: '12834', logIndex: 35, transactionHash: '0x2345fdfdf', transactionIndex: 1, @@ -206,7 +206,7 @@ var tests = [{ subscriptionResults: [{ id: "log_d43624aa", blockHash: "0x43534ffddd", - blockNumber: 12834, + blockNumber: '12834', logIndex: 35, transactionHash: '0x2345fdfdf', transactionIndex: 1, @@ -219,7 +219,7 @@ var tests = [{ },{ id: "log_b20551f9", blockHash: "0x43534ffddd", - blockNumber: 12834, + blockNumber: '12834', logIndex: 35, transactionHash: '0x2345fdfdd', transactionIndex: 1, @@ -274,7 +274,7 @@ var tests = [{ subscriptionResults: [{ id: "log_d43624aa", blockHash: "0x43534ffddd", - blockNumber: 12834, + blockNumber: '12834', logIndex: 35, transactionHash: '0x2345fdfdf', transactionIndex: 1, @@ -287,7 +287,7 @@ var tests = [{ },{ id: "log_b20551f9", blockHash: "0x43534ffddd", - blockNumber: 12834, + blockNumber: '12834', logIndex: 35, transactionHash: '0x2345fdfdd', transactionIndex: 1, @@ -331,7 +331,7 @@ var tests = [{ subscriptionResults: [{ id: "log_d43624aa", blockHash: "0x43534ffddd", - blockNumber: 12834, + blockNumber: '12834', logIndex: 35, transactionHash: '0x2345fdfdf', transactionIndex: 1, @@ -392,7 +392,7 @@ var tests = [{ subscriptionResults: [{ id: "log_d43624aa", blockHash: "0x43534ffddd", - blockNumber: 12834, + blockNumber: '12834', logIndex: 35, transactionHash: '0x2345fdfdf', transactionIndex: 1, @@ -405,7 +405,7 @@ var tests = [{ },{ id: "log_d43624aa", blockHash: "0x43534ffddd", - blockNumber: 12834, + blockNumber: '12834', removed: true, logIndex: 35, transactionHash: '0x2345fdfdf', @@ -456,18 +456,18 @@ var tests = [{ subscriptionResults: [ true, { - startingBlock: 786211, - currentBlock: 786193, - highestBlock: 712483, - knownStates: 698915, - pulledStates: 35 + startingBlock: '786211', + currentBlock: '786193', + highestBlock: '712483', + knownStates: '698915', + pulledStates: '35' }, { - startingBlock: 786211, - currentBlock: 786193, - highestBlock: 786193, - knownStates: 698915, - pulledStates: 35 + startingBlock: '786211', + currentBlock: '786193', + highestBlock: '786193', + knownStates: '698915', + pulledStates: '35' }, false ] diff --git a/test/event.decode.js b/test/event.decode.js index 619b4ed6d64..09e33f3149c 100644 --- a/test/event.decode.js +++ b/test/event.decode.js @@ -30,7 +30,7 @@ var tests = [{ transactionHash: '0x1234567890', address: resultAddress, blockHash: '0x1234567890', - blockNumber: 1, + blockNumber: '1', id: "log_c71f2e84", raw: { topics: [], @@ -67,7 +67,7 @@ var tests = [{ transactionHash: '0x1234567890', address: resultAddress, blockHash: '0x1234567890', - blockNumber: 1, + blockNumber: '1', id: "log_c71f2e84", raw: { data: "0x0000000000000000000000000000000000000000000000000000000000000001", @@ -129,7 +129,7 @@ var tests = [{ transactionHash: '0x1234567890', address: resultAddress, blockHash: '0x1234567890', - blockNumber: 1, + blockNumber: '1', id: "log_c71f2e84", raw: { data: '0x' + @@ -197,7 +197,7 @@ var tests = [{ transactionHash: '0x1234567890', address: resultAddress, blockHash: '0x1234567890', - blockNumber: 1, + blockNumber: '1', id: "log_c71f2e84", raw: { data: '0x' + diff --git a/test/formatters.outputBlockFormatter.js b/test/formatters.outputBlockFormatter.js index d6bf27563de..bec780c01b5 100644 --- a/test/formatters.outputBlockFormatter.js +++ b/test/formatters.outputBlockFormatter.js @@ -32,13 +32,13 @@ describe('formatters', function () { bloom: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', difficulty: '1000', totalDifficulty: '1000', - number: 1000, - gasLimit: 1000, - gasUsed: 1000, - timestamp: 1000, + number: '1000', + gasLimit: '1000', + gasUsed: '1000', + timestamp: '1000', extraData: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', nonce: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', - size: 1000 + size: '1000' }); }); it('should return the correct value, when null values are present', function () { @@ -69,12 +69,12 @@ describe('formatters', function () { difficulty: '1000', totalDifficulty: '1000', number: null, - gasLimit: 1000, - gasUsed: 1000, - timestamp: 1000, + gasLimit: '1000', + gasUsed: '1000', + timestamp: '1000', extraData: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', nonce: null, - size: 1000 + size: '1000' }); }); }); diff --git a/test/formatters.outputLogFormatter.js b/test/formatters.outputLogFormatter.js index da692001512..41303bf9e23 100644 --- a/test/formatters.outputLogFormatter.js +++ b/test/formatters.outputLogFormatter.js @@ -17,7 +17,7 @@ describe('formatters', function () { }), { transactionIndex: 1000, logIndex: 1000, - blockNumber: 1000, + blockNumber: '1000', transactionHash: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', blockHash: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', data: '0x7b2274657374223a2274657374227', diff --git a/test/formatters.outputTransactionFormatter.js b/test/formatters.outputTransactionFormatter.js index 38dede445de..b4d17af8843 100644 --- a/test/formatters.outputTransactionFormatter.js +++ b/test/formatters.outputTransactionFormatter.js @@ -21,10 +21,10 @@ describe('formatters', function () { from: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', value: '1000', - gas: 1000, + gas: '1000', gasPrice: '1000', - nonce: 11, - blockNumber: 1000, + nonce: '11', + blockNumber: '1000', blockHash: '0xc9b9cdc2092a9d6589d96662b1fd6949611163fb3910cf8a173cd060f17702f9', transactionIndex: 1 }); @@ -47,10 +47,10 @@ describe('formatters', function () { input: '0x3454645634534', from: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', to: null, - value: 1000, - gas: 1000, + value: '1000', + gas: '1000', gasPrice: '1000', - nonce: 11, + nonce: '11', blockNumber: null, blockHash: null, transactionIndex: null diff --git a/test/formatters.outputTransactionReceiptFormatter.js b/test/formatters.outputTransactionReceiptFormatter.js index 7647d725d36..eb4991f05af 100644 --- a/test/formatters.outputTransactionReceiptFormatter.js +++ b/test/formatters.outputTransactionReceiptFormatter.js @@ -17,9 +17,9 @@ describe('outputTransactionReceiptFormatter', function() { assert.deepEqual(formatters.outputTransactionReceiptFormatter(receipt), { status: false, - cumulativeGasUsed: 256, - gasUsed: 256, - blockNumber: 256, + cumulativeGasUsed: '256', + gasUsed: '256', + blockNumber: '256', transactionIndex: 10, to: '0x03c9a938ff7f54090d0d99e2c6f80380510ea078', from: '0x03c9a938ff7f54090d0d99e2c6f80380510ea078', @@ -42,9 +42,9 @@ describe('outputTransactionReceiptFormatter', function() { assert.deepEqual(formatters.outputTransactionReceiptFormatter(receipt), { status: false, - cumulativeGasUsed: 256, - gasUsed: 256, - blockNumber: 256, + cumulativeGasUsed: '256', + gasUsed: '256', + blockNumber: '256', transactionIndex: 10, to: '0x03c9a938ff7f54090d0d99e2c6f80380510ea078', from: '0x03c9a938ff7f54090d0d99e2c6f80380510ea078', diff --git a/test/helpers/test.method.js b/test/helpers/test.method.js index 0d0e4300c49..49c1337bfa5 100644 --- a/test/helpers/test.method.js +++ b/test/helpers/test.method.js @@ -130,12 +130,12 @@ var runTests = function (obj, method, tests) { // test receipt assert.deepEqual(result, { "blockHash": "0x6fd9e2a26ab", - "blockNumber": 5599, + "blockNumber": '5599', "transactionHash":"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "transactionIndex": 1, "contractAddress":"0x407D73d8a49eeb85D32Cf465507dd71d507100c1", // checksum address - "cumulativeGasUsed": 520464, - "gasUsed": 520464 + "cumulativeGasUsed": '520464', + "gasUsed": '520464' }); } else { assert.deepEqual(result, test.formattedResult); diff --git a/test/helpers/test.subscription.js b/test/helpers/test.subscription.js index 651a92586dc..d70fad6b8e9 100644 --- a/test/helpers/test.subscription.js +++ b/test/helpers/test.subscription.js @@ -6,7 +6,7 @@ var Web3 = require('../../packages/web3'); var runTests = function (protocol, tests) { - describe('web3.shh.subscribe', function () { + describe('web3.' + protocol + '.subscribe', function () { tests.forEach(function (test, index) { it('should create a subscription for "'+ test.args[0] +'"', function (done) { diff --git a/test/method.buildCall.js b/test/method.buildCall.js index 49f4e1f0b49..5cdb2d6a120 100644 --- a/test/method.buildCall.js +++ b/test/method.buildCall.js @@ -304,11 +304,11 @@ describe('lib/web3/method', function () { assert.deepEqual(result, { contractAddress: address, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, - blockNumber: 10, + blockNumber: '10', blockHash: '0xafff', - gasUsed: 0 + gasUsed: '0' }); done(); @@ -329,11 +329,11 @@ describe('lib/web3/method', function () { assert.deepEqual(result, { contractAddress: address, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, - blockNumber: 10, + blockNumber: '10', blockHash: '0xafff', - gasUsed: 0 + gasUsed: '0' }); done(); @@ -424,11 +424,11 @@ describe('lib/web3/method', function () { assert.deepEqual(result, { contractAddress: address, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, - blockNumber: 10, + blockNumber: '10', blockHash: '0xafff', - gasUsed: 0 + gasUsed: '0' }); done(); @@ -448,11 +448,11 @@ describe('lib/web3/method', function () { assert.deepEqual(result, { contractAddress: address, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, - blockNumber: 10, + blockNumber: '10', blockHash: '0xafff', - gasUsed: 0 + gasUsed: '0' }); done(); @@ -831,11 +831,11 @@ describe('lib/web3/method', function () { assert.deepEqual(result, { contractAddress: null, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, - blockNumber: 10, + blockNumber: '10', blockHash: '0xafff', - gasUsed: 0 + gasUsed: '0' }); }) @@ -843,11 +843,11 @@ describe('lib/web3/method', function () { assert.deepEqual(receipt, { contractAddress: null, - cumulativeGasUsed: 10, + cumulativeGasUsed: '10', transactionIndex: 3, - blockNumber: 10, + blockNumber: '10', blockHash: '0xafff', - gasUsed: 0 + gasUsed: '0' }); assert.deepEqual(conf, countConf);