Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release - v1.0.0-beta.51 #2598

Merged
merged 10 commits into from
Mar 28, 2019
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-core-helpers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-core-helpers/src/Formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
}
8 changes: 0 additions & 8 deletions packages/web3-core-subscriptions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions packages/web3-eth-accounts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {Accounts} from 'web3-eth-accounts';

const accounts = new Accounts(
'http://127.0.0.1:4546',
null,
options
);
```
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-eth-accounts/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
18 changes: 11 additions & 7 deletions packages/web3-eth-contract/src/AbstractContract.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 11 additions & 1 deletion packages/web3-eth-contract/tests/src/AbstractContractTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
}
);
});

Expand Down
5 changes: 3 additions & 2 deletions packages/web3-eth-ens/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import {Ens} from 'web3-eth-ens';

new Ens(
'ws://localhost:8546',
accounts,
{}
null,
options,
accountsModule
);
```

Expand Down
2 changes: 1 addition & 1 deletion packages/web3-eth-personal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {Personal} from 'web3-eth-personal';

const personal = new Personal(
'http://127.0.0.1:4546',
accounts,
null,
options
);
```
Expand Down
3 changes: 1 addition & 2 deletions packages/web3-eth-personal/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions packages/web3-eth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
```
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-eth/src/methods/EthSignMethod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions packages/web3-net/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {Network} from 'web3-net';

const net = new Network(
'http://127.0.0.1:4546',
null,
options
);
```
Expand Down
18 changes: 6 additions & 12 deletions packages/web3-providers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -80,22 +77,19 @@ 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
The ProviderResolver resolves an url or an given provider object to the correct provider class.
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/web3-shh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {Shh} from 'web3-shh';

const shh = new Shh(
'http://127.0.0.1:4546',
null,
options
);
```
Expand Down
2 changes: 1 addition & 1 deletion packages/web3/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down