diff --git a/package.json b/package.json index c0591931bf0..1dfb6506267 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "web3", "namespace": "ethereum", - "version": "1.0.0-beta.49", + "version": "1.0.0-beta.51", "description": "Ethereum JavaScript API wrapper repository", "license": "LGPL-3.0", "main": "./packages/web3/src/index.js", diff --git a/packages/web3-core-helpers/README.md b/packages/web3-core-helpers/README.md index bb89582a2cf..017a0354051 100644 --- a/packages/web3-core-helpers/README.md +++ b/packages/web3-core-helpers/README.md @@ -16,7 +16,7 @@ npm install web3-core-helpers ## Usage ```js -import {errors, formatters} from 'web3-core-helpers'; +import {formatters} from 'web3-core-helpers'; ``` ## Types diff --git a/packages/web3-core-helpers/src/Formatters.js b/packages/web3-core-helpers/src/Formatters.js index e6df7c358e0..a2f5754bbbe 100644 --- a/packages/web3-core-helpers/src/Formatters.js +++ b/packages/web3-core-helpers/src/Formatters.js @@ -280,6 +280,8 @@ export const outputTransactionReceiptFormatter = (receipt) => { if (typeof receipt.status !== 'undefined' && receipt.status !== null) { receipt.status = Boolean(parseInt(receipt.status)); + } else { + receipt.status = true; } return receipt; diff --git a/packages/web3-core-method/lib/factories/AbstractMethodFactory.js b/packages/web3-core-method/lib/factories/AbstractMethodFactory.js index 58197289024..fb912d32b3c 100644 --- a/packages/web3-core-method/lib/factories/AbstractMethodFactory.js +++ b/packages/web3-core-method/lib/factories/AbstractMethodFactory.js @@ -132,9 +132,8 @@ export default class AbstractMethodFactory { */ getTimeout(moduleInstance) { let timeout = moduleInstance.transactionBlockTimeout; - const providerName = moduleInstance.currentProvider.constructor.name; - if (providerName === 'HttpProvider' || providerName === 'CustomProvider') { + if (!moduleInstance.currentProvider.SOCKET_MESSAGE) { timeout = moduleInstance.transactionPollingTimeout; } diff --git a/packages/web3-core-method/lib/methods/transaction/AbstractObservedTransactionMethod.js b/packages/web3-core-method/lib/methods/transaction/AbstractObservedTransactionMethod.js index 90d51a8e152..04bb368bb86 100644 --- a/packages/web3-core-method/lib/methods/transaction/AbstractObservedTransactionMethod.js +++ b/packages/web3-core-method/lib/methods/transaction/AbstractObservedTransactionMethod.js @@ -80,7 +80,7 @@ export default class AbstractObservedTransactionMethod extends AbstractMethod { confirmations = transactionConfirmation.confirmations; receipt = transactionConfirmation.receipt; - if (this.hasRevertReceiptStatus(receipt)) { + if (!receipt.status) { if (this.parameters[0].gas === receipt.gasUsed) { this.handleError( new Error( @@ -161,17 +161,4 @@ export default class AbstractObservedTransactionMethod extends AbstractMethod { this.promiEvent.reject(error); } - - /** - * Checks if the status property has a revert state - * - * @method hasRevertReceiptStatus - * - * @param {Object} receipt - * - * @returns {Boolean} - */ - hasRevertReceiptStatus(receipt) { - return receipt.status === false && receipt.status !== undefined && receipt.status !== null; - } } diff --git a/packages/web3-core-subscriptions/README.md b/packages/web3-core-subscriptions/README.md index 0e8d7f300a5..91e9f956ab1 100644 --- a/packages/web3-core-subscriptions/README.md +++ b/packages/web3-core-subscriptions/README.md @@ -13,14 +13,6 @@ If you would like to know all supported subscriptions please have a look in the npm install web3-core-subscriptions ``` -## Exported classes - -```js -SubscriptionsFactory -LogSubscription -AbstractSubscription -``` - ## Types All the typescript typings are placed in the types folder. diff --git a/packages/web3-eth-accounts/README.md b/packages/web3-eth-accounts/README.md index 8a8ef93033c..2bec1ee73e0 100644 --- a/packages/web3-eth-accounts/README.md +++ b/packages/web3-eth-accounts/README.md @@ -20,6 +20,7 @@ import {Accounts} from 'web3-eth-accounts'; const accounts = new Accounts( 'http://127.0.0.1:4546', + null, options ); ``` diff --git a/packages/web3-eth-accounts/src/index.js b/packages/web3-eth-accounts/src/index.js index d6f0f00e5b0..e10c257d865 100644 --- a/packages/web3-eth-accounts/src/index.js +++ b/packages/web3-eth-accounts/src/index.js @@ -36,5 +36,5 @@ import AccountsModule from './Accounts'; * @constructor */ export function Accounts(provider, net = null, options = {}) { - return new AccountsModule(provider, Utils, new MethodFactory(Utils, formatters), options, net); + return new AccountsModule(provider, Utils, formatters, new MethodFactory(Utils, formatters), options, net); } diff --git a/packages/web3-eth-contract/src/AbstractContract.js b/packages/web3-eth-contract/src/AbstractContract.js index d31bc56a5c6..5543bfbd4f4 100644 --- a/packages/web3-eth-contract/src/AbstractContract.js +++ b/packages/web3-eth-contract/src/AbstractContract.js @@ -213,13 +213,17 @@ export default class AbstractContract extends AbstractWeb3Module { * @returns {AbstractContract} */ clone() { - const clone = this.contractModuleFactory.createContract( - this.currentProvider, - this.accounts, - [], - '', - this.options - ); + const clone = this.contractModuleFactory.createContract(this.currentProvider, this.accounts, [], '', { + defaultAccount: this.defaultAccount, + defaultBlock: this.defaultBlock, + defaultGas: this.defaultGas, + defaultGasPrice: this.defaultGasPrice, + transactionBlockTimeout: this.transactionBlockTimeout, + transactionConfirmationBlocks: this.transactionConfirmationBlocks, + transactionPollingTimeout: this.transactionPollingTimeout, + transactionSigner: this.transactionSigner, + data: this.options.data + }); clone.abiModel = this.abiModel; diff --git a/packages/web3-eth-contract/tests/src/AbstractContractTest.js b/packages/web3-eth-contract/tests/src/AbstractContractTest.js index 1e9861473d6..e6aa83e2113 100644 --- a/packages/web3-eth-contract/tests/src/AbstractContractTest.js +++ b/packages/web3-eth-contract/tests/src/AbstractContractTest.js @@ -236,7 +236,17 @@ describe('AbstractContractTest', () => { abstractContract.accounts, [], '', - abstractContract.options + { + data: '', + defaultAccount: undefined, + defaultBlock: 'latest', + defaultGas: undefined, + defaultGasPrice: undefined, + transactionBlockTimeout: 50, + transactionConfirmationBlocks: 24, + transactionPollingTimeout: 750, + transactionSigner: {} + } ); }); diff --git a/packages/web3-eth-ens/README.md b/packages/web3-eth-ens/README.md index 602e5be889c..d0212b9ddc1 100644 --- a/packages/web3-eth-ens/README.md +++ b/packages/web3-eth-ens/README.md @@ -18,8 +18,9 @@ import {Ens} from 'web3-eth-ens'; new Ens( 'ws://localhost:8546', - accounts, - {} + null, + options, + accountsModule ); ``` diff --git a/packages/web3-eth-personal/README.md b/packages/web3-eth-personal/README.md index fa62f685360..d0d44925fd4 100644 --- a/packages/web3-eth-personal/README.md +++ b/packages/web3-eth-personal/README.md @@ -18,7 +18,7 @@ import {Personal} from 'web3-eth-personal'; const personal = new Personal( 'http://127.0.0.1:4546', - accounts, + null, options ); ``` diff --git a/packages/web3-eth-personal/src/index.js b/packages/web3-eth-personal/src/index.js index 83a2498f4eb..e151192d386 100644 --- a/packages/web3-eth-personal/src/index.js +++ b/packages/web3-eth-personal/src/index.js @@ -35,11 +35,10 @@ import PersonalModule from './Personal.js'; * @param {Web3EthereumProvider|HttpProvider|WebsocketProvider|IpcProvider|String} provider * @param {Net.Socket} net * @param {Object} options - * @param {Accounts} accounts * * @returns {Personal} */ -export function Personal(provider, net = null, options = {}, accounts = {}) { +export function Personal(provider, net = null, options = {}) { const resolvedProvider = new ProviderResolver().resolve(provider, net); return new PersonalModule( diff --git a/packages/web3-eth/README.md b/packages/web3-eth/README.md index 47e7d819169..c8590de8ade 100644 --- a/packages/web3-eth/README.md +++ b/packages/web3-eth/README.md @@ -14,8 +14,11 @@ npm install web3-eth ## Usage ```js +import {Eth} from 'web3-eth'; + const eth = new Eth( 'http://127.0.0.1:4546', + null, options ); ``` diff --git a/packages/web3-eth/src/methods/EthSignMethod.js b/packages/web3-eth/src/methods/EthSignMethod.js index d579e089639..3628d7b83fc 100644 --- a/packages/web3-eth/src/methods/EthSignMethod.js +++ b/packages/web3-eth/src/methods/EthSignMethod.js @@ -63,7 +63,7 @@ export default class EthSignMethod extends SignMethod { let signedMessage = this.moduleInstance.accounts.sign( this.parameters[1], - this.moduleInstance.accounts.wallet[this.parameters[0]].address + this.moduleInstance.accounts.wallet[this.parameters[0]].privateKey ); if (this.callback) { diff --git a/packages/web3-net/README.md b/packages/web3-net/README.md index 692f8838f04..362f7e701cb 100644 --- a/packages/web3-net/README.md +++ b/packages/web3-net/README.md @@ -18,6 +18,7 @@ import {Network} from 'web3-net'; const net = new Network( 'http://127.0.0.1:4546', + null, options ); ``` diff --git a/packages/web3-providers/README.md b/packages/web3-providers/README.md index b87bd3e1f61..d8770dd9a7f 100644 --- a/packages/web3-providers/README.md +++ b/packages/web3-providers/README.md @@ -59,12 +59,9 @@ The BatchRequest provides the possibility to send JSON-RPC requests as batch. Please read the [documentation][docs] for more. ```js -import {ProvidersModuleFactory, BatchRequest} 'web3-providers'; - -const provider = new ProvidersModuleFactory() - .createProviderResolver - .resolve('ws://localhost:8546'); +import {ProviderResolver, BatchRequest} 'web3-providers'; +const provider = new ProviderResolver().resolve('ws://localhost:8546'); const batchRequest = new BatchRequest(provider); batchRequest.add(web3.eth.getBalance.request( @@ -80,10 +77,9 @@ await batchRequest.execute(); Checks if an provider is given from the environment (Mist, MetaMask) and returns the provider. ```js -import {ProvidersModuleFactory} from 'web3-providers'; +import {ProviderDetector} from 'web3-providers'; -const providerDetector = new ProvidersModuleFactory.createProviderDetector(); -const givenProvider = providerDetector.detect(); +const givenProvider = ProviderDetector.detect(); ``` #### ProviderResolver @@ -91,11 +87,9 @@ The ProviderResolver resolves an url or an given provider object to the correct Because of the resolves does web3 has internally just one provider interface and we have no direct dependency to third party providers. ```js -import {ProvidersModuleFactory} 'web3-providers'; +import {ProviderResolver} 'web3-providers'; -const socketProviderAdapter = new ProvidersModuleFactory() - .createProviderResolver - .resolve('ws://localhost:8546'); +const socketProviderAdapter = new ProviderResolver().resolve('ws://localhost:8546'); ``` ## Types diff --git a/packages/web3-providers/src/factories/ProvidersModuleFactory.js b/packages/web3-providers/src/factories/ProvidersModuleFactory.js index d669a970804..ab0ab5375ad 100644 --- a/packages/web3-providers/src/factories/ProvidersModuleFactory.js +++ b/packages/web3-providers/src/factories/ProvidersModuleFactory.js @@ -85,7 +85,7 @@ export default class ProvidersModuleFactory { * * @returns {XMLHttpRequest} */ - createXMLHttpRequest(host, timeout = 0, headers, agent, withCredentials) { + createXMLHttpRequest(host, timeout, headers, agent, withCredentials) { let request; // runtime is of type node diff --git a/packages/web3-shh/README.md b/packages/web3-shh/README.md index 9f3fb6a05ba..6c5a1a6dfa5 100644 --- a/packages/web3-shh/README.md +++ b/packages/web3-shh/README.md @@ -18,6 +18,7 @@ import {Shh} from 'web3-shh'; const shh = new Shh( 'http://127.0.0.1:4546', + null, options ); ``` diff --git a/packages/web3/package.json b/packages/web3/package.json index b6557f06748..d40518d93d1 100644 --- a/packages/web3/package.json +++ b/packages/web3/package.json @@ -1,7 +1,7 @@ { "name": "web3", "namespace": "ethereum", - "version": "1.0.0-beta.50", + "version": "1.0.0-beta.51", "description": "Ethereum JavaScript API", "repository": "https://github.com/ethereum/web3.js/tree/1.0/packages/web3", "license": "LGPL-3.0",