Skip to content

Commit 1e26144

Browse files
authored
Merge pull request #91 from 0xProject/david/subproviders-clean
chore: clean unused code from @0x/subproviders
2 parents 8c79268 + bf9aaea commit 1e26144

39 files changed

+3032
-8754
lines changed

abi-gen/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"@types/glob": "5.0.35",
9494
"@types/mkdirp": "^0.5.2",
9595
"@types/mocha": "^5.2.7",
96+
"@types/sinon": "^2.2.2",
9697
"@types/tmp": "^0.0.33",
9798
"@types/yargs": "^11.0.0",
9899
"chai": "^4.0.1",

abi-gen/test-cli/test_typescript/test/abi_gen_dummy_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ContractFunctionObj } from '@0x/base-contract';
22
import { BlockchainLifecycle, devConstants, web3Factory } from '@0x/dev-utils';
33
import { Web3ProviderEngine } from '@0x/subproviders';
4-
import { BigNumber, providerUtils, StringRevertError } from '@0x/utils';
4+
import { BigNumber, StringRevertError } from '@0x/utils';
55
import { BlockParamLiteral, Web3Wrapper } from '@0x/web3-wrapper';
66
import * as chai from 'chai';
77
import * as chaiAsPromised from 'chai-as-promised';

dev-utils/docs/reference.mdx

Lines changed: 654 additions & 460 deletions
Large diffs are not rendered by default.

dev-utils/src/web3_factory.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
EmptyWalletSubprovider,
3-
FakeGasEstimateSubprovider,
4-
GanacheSubprovider,
5-
RPCSubprovider,
6-
Web3ProviderEngine,
7-
} from '@0x/subproviders';
1+
import { GanacheSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
82
import { providerUtils } from '@0x/utils';
93
import * as fs from 'fs';
104

@@ -15,11 +9,9 @@ import { env, EnvVars } from './env';
159

1610
export interface Web3Config {
1711
total_accounts?: number; // default: 10
18-
hasAddresses?: boolean; // default: true
1912
shouldUseInProcessGanache?: boolean; // default: false
2013
shouldThrowErrorsOnGanacheRPCResponse?: boolean; // default: true
2114
rpcUrl?: string; // default: localhost:8545
22-
shouldUseFakeGasEstimate?: boolean; // default: true
2315
ganacheDatabasePath?: string; // default: undefined, creates a tmp dir
2416
shouldAllowUnlimitedContractSize?: boolean;
2517
fork?: string;
@@ -35,17 +27,6 @@ export const web3Factory = {
3527
getRpcProvider(config: Web3Config = {}): Web3ProviderEngine {
3628
const provider = new Web3ProviderEngine();
3729

38-
const hasAddresses = config.hasAddresses === undefined || config.hasAddresses;
39-
const shouldUseFakeGasEstimate =
40-
config.shouldUseFakeGasEstimate === undefined || config.shouldUseFakeGasEstimate;
41-
42-
if (!hasAddresses) {
43-
provider.addProvider(new EmptyWalletSubprovider());
44-
}
45-
if (shouldUseFakeGasEstimate) {
46-
provider.addProvider(new FakeGasEstimateSubprovider(constants.GAS_LIMIT));
47-
}
48-
4930
const logger = {
5031
log: (arg: any) => {
5132
fs.appendFileSync('ganache.log', `${arg}\n`);

doc-gen-config.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,17 @@
2020
"IterableIterator": true,
2121
"Set": true,
2222
"Exclude": true,
23-
"Ajv": true
23+
"Ajv": true,
24+
"#": "private types below",
25+
"EIP712TypedData": true,
26+
"ErrorCallback": true,
27+
"JSONRPCErrorCallback": true,
28+
"JSONRPCRequestPayload": true,
29+
"JSONRPCRequestPayloadWithMethod": true,
30+
"JSONRPCResponsePayload": true,
31+
"MnemonicWalletSubproviderConfigs": true,
32+
"NextCallback": true,
33+
"PartialTxParams": true
2434
},
2535
"ignoredExcessiveTypes": [
2636
"NonceSubproviderErrors",

json-schemas/docs/reference.mdx

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,53 @@
11
# Class: SchemaValidator
22

3-
A validator for [JSON-schemas](http://json-schema.org/)
3+
A validator wrapping (AJV) [https://github.com/ajv-validator/ajv]
44

55

66
## Constructors
77

88

99

10-
\+ **new SchemaValidator**(): *[SchemaValidator](#class-schemavalidator)*
10+
\+ **new SchemaValidator**(`newSchemas`: object[]): *[SchemaValidator](#class-schemavalidator)*
1111

12-
*Defined in [schema_validator.ts:15](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/json-schemas/src/schema_validator.ts#L15)*
12+
*Defined in [schema_validator.ts:11](https://github.com/0xProject/tools/blob/c64730cff/json-schemas/src/schema_validator.ts#L11)*
1313

1414
Instantiates a SchemaValidator instance
1515

16+
**Parameters:**
17+
18+
Name | Type | Default |
19+
------ | ------ | ------ |
20+
`newSchemas` | object[] | [] |
21+
1622
**Returns:** *[SchemaValidator](#class-schemavalidator)*
1723

1824
## Methods
1925

2026
### addSchema
2127

22-
**addSchema**(`schema`: `Schema`): *void*
28+
**addSchema**(`schemaObjectOrArray`: object | object[]): *void*
2329

24-
*Defined in [schema_validator.ts:32](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/json-schemas/src/schema_validator.ts#L32)*
30+
*Defined in [schema_validator.ts:26](https://github.com/0xProject/tools/blob/c64730cff/json-schemas/src/schema_validator.ts#L26)*
2531

2632
Add a schema to the validator. All schemas and sub-schemas must be added to
2733
the validator before the `validate` and `isValid` methods can be called with
2834
instances of that schema.
2935

3036
**Parameters:**
3137

32-
Name | Type | Description |
33-
------ | ------ | ------ |
34-
`schema` | `Schema` | The schema to add |
38+
Name | Type |
39+
------ | ------ |
40+
`schemaObjectOrArray` | object | object[] |
3541

3642
**Returns:** *void*
3743

3844
___
3945

4046
### isValid
4147

42-
**isValid**(`instance`: any, `schema`: `Schema`): *boolean*
48+
**isValid**(`instance`: any, `schema`: object): *boolean*
4349

44-
*Defined in [schema_validator.ts:57](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/json-schemas/src/schema_validator.ts#L57)*
50+
*Defined in [schema_validator.ts:59](https://github.com/0xProject/tools/blob/c64730cff/json-schemas/src/schema_validator.ts#L59)*
4551

4652
Check whether an instance properly adheres to a JSON schema
4753

@@ -50,7 +56,7 @@ Check whether an instance properly adheres to a JSON schema
5056
Name | Type | Description |
5157
------ | ------ | ------ |
5258
`instance` | any | JS object in question |
53-
`schema` | `Schema` | Schema to check against |
59+
`schema` | object | Schema to check against |
5460

5561
**Returns:** *boolean*
5662

@@ -60,9 +66,9 @@ ___
6066

6167
### validate
6268

63-
**validate**(`instance`: any, `schema`: `Schema`): *`ValidatorResult`*
69+
**validate**(`instance`: any, `schema`: object): *Ajv*
6470

65-
*Defined in [schema_validator.ts:46](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/json-schemas/src/schema_validator.ts#L46)*
71+
*Defined in [schema_validator.ts:49](https://github.com/0xProject/tools/blob/c64730cff/json-schemas/src/schema_validator.ts#L49)*
6672

6773
Validate the JS object conforms to a specific JSON schema
6874

@@ -71,12 +77,13 @@ Validate the JS object conforms to a specific JSON schema
7177
Name | Type | Description |
7278
------ | ------ | ------ |
7379
`instance` | any | JS object in question |
74-
`schema` | `Schema` | Schema to check against |
80+
`schema` | object | Schema to check against |
7581

76-
**Returns:** *`ValidatorResult`*
82+
**Returns:** *Ajv*
7783

7884
The results of the validation
7985

86+
8087
<hr />
8188

8289

0 commit comments

Comments
 (0)