Apply various PR feedback
This commit is contained in:
parent
68f150eff2
commit
974ec23ecd
@ -4,7 +4,7 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
"description": "Smart contract components of 0x protocol",
|
"description": "Low-level 0x smart contract wrappers generated using @0xproject/abi-gen",
|
||||||
"main": "lib/src/index.js",
|
"main": "lib/src/index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/assert": "^1.0.13",
|
"@0xproject/assert": "^1.0.13",
|
||||||
"@0xproject/connect": "^3.0.1",
|
"@0xproject/connect": "^3.0.1",
|
||||||
"@0xproject/contract-addresses": "^1.0.0",
|
|
||||||
"@0xproject/contract-wrappers": "^2.0.2",
|
"@0xproject/contract-wrappers": "^2.0.2",
|
||||||
"@0xproject/json-schemas": "^1.0.7",
|
"@0xproject/json-schemas": "^1.0.7",
|
||||||
"@0xproject/order-utils": "^1.0.7",
|
"@0xproject/order-utils": "^1.0.7",
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { getContractAddressesForNetwork } from '@0xproject/contract-addresses';
|
|
||||||
import { ContractWrappers } from '@0xproject/contract-wrappers';
|
import { ContractWrappers } from '@0xproject/contract-wrappers';
|
||||||
import { schemas } from '@0xproject/json-schemas';
|
import { schemas } from '@0xproject/json-schemas';
|
||||||
import { SignedOrder } from '@0xproject/order-utils';
|
import { SignedOrder } from '@0xproject/order-utils';
|
||||||
@ -110,7 +109,6 @@ export class AssetBuyer {
|
|||||||
this.expiryBufferSeconds = expiryBufferSeconds;
|
this.expiryBufferSeconds = expiryBufferSeconds;
|
||||||
this._contractWrappers = new ContractWrappers(this.provider, {
|
this._contractWrappers = new ContractWrappers(this.provider, {
|
||||||
networkId,
|
networkId,
|
||||||
contractAddresses: getContractAddressesForNetwork(networkId),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -24,11 +24,11 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/contract-addresses/README.md",
|
"homepage": "https://github.com/0xProject/0x-monorepo/packages/contract-addresses/README.md",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/lodash": "4.14.104",
|
||||||
"typescript": "3.0.1",
|
"typescript": "3.0.1",
|
||||||
"shx": "^0.2.2"
|
"shx": "^0.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/types": "1.1.4",
|
|
||||||
"lodash": "^4.17.5"
|
"lodash": "^4.17.5"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@ -53,6 +53,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
|
|||||||
/**
|
/**
|
||||||
* Used to get addresses of contracts that have been deployed to either the
|
* Used to get addresses of contracts that have been deployed to either the
|
||||||
* Ethereum mainnet or a supported testnet.
|
* Ethereum mainnet or a supported testnet.
|
||||||
|
* @param networkId The desired networkId.
|
||||||
* @returns The set of addresses for contracts which have been deployed on the
|
* @returns The set of addresses for contracts which have been deployed on the
|
||||||
* given networkId.
|
* given networkId.
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
"description": "Smart contract components of 0x protocol",
|
"description": "0x smart contract compilation artifacts",
|
||||||
"main": "lib/src/index.js",
|
"main": "lib/src/index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
@ -27,8 +27,6 @@
|
|||||||
"typescript": "3.0.1",
|
"typescript": "3.0.1",
|
||||||
"shx": "^0.2.2"
|
"shx": "^0.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"resolveJsonModule": true
|
"resolveJsonModule": true
|
||||||
},
|
},
|
||||||
"include": ["./globals.d.ts", "./src/**/*"],
|
"include": ["./src/**/*"],
|
||||||
"files": [
|
"files": [
|
||||||
"./artifacts/AssetProxyOwner.json",
|
"./artifacts/AssetProxyOwner.json",
|
||||||
"./artifacts/DummyERC20Token.json",
|
"./artifacts/DummyERC20Token.json",
|
||||||
|
@ -67,7 +67,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/abi-gen-wrappers": "^1.0.0",
|
"@0xproject/abi-gen-wrappers": "^1.0.0",
|
||||||
"@0xproject/assert": "^1.0.13",
|
"@0xproject/assert": "^1.0.13",
|
||||||
"@0xproject/base-contract": "^3.0.1",
|
|
||||||
"@0xproject/contract-addresses": "^1.0.0",
|
"@0xproject/contract-addresses": "^1.0.0",
|
||||||
"@0xproject/contract-artifacts": "^1.0.0",
|
"@0xproject/contract-artifacts": "^1.0.0",
|
||||||
"@0xproject/fill-scenarios": "^1.0.7",
|
"@0xproject/fill-scenarios": "^1.0.7",
|
||||||
|
@ -70,7 +70,7 @@ export class ContractWrappers {
|
|||||||
private readonly _web3Wrapper: Web3Wrapper;
|
private readonly _web3Wrapper: Web3Wrapper;
|
||||||
/**
|
/**
|
||||||
* Instantiates a new ContractWrappers instance.
|
* Instantiates a new ContractWrappers instance.
|
||||||
* @param provider The Provider instance you would like the 0x.js library to use for interacting with
|
* @param provider The Provider instance you would like the contract-wrappers library to use for interacting with
|
||||||
* the Ethereum network.
|
* the Ethereum network.
|
||||||
* @param config The configuration object. Look up the type for the description.
|
* @param config The configuration object. Look up the type for the description.
|
||||||
* @return An instance of the ContractWrappers class.
|
* @return An instance of the ContractWrappers class.
|
||||||
@ -147,9 +147,9 @@ export class ContractWrappers {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Sets a new web3 provider for 0x.js. Updating the provider will stop all
|
* Sets a new web3 provider for contract-wrappers. Updating the provider will stop all
|
||||||
* subscriptions so you will need to re-subscribe to all events relevant to your app after this call.
|
* subscriptions so you will need to re-subscribe to all events relevant to your app after this call.
|
||||||
* @param provider The Web3Provider you would like the 0x.js library to use from now on.
|
* @param provider The Web3Provider you would like the contract-wrappers library to use from now on.
|
||||||
* @param networkId The id of the network your provider is connected to
|
* @param networkId The id of the network your provider is connected to
|
||||||
*/
|
*/
|
||||||
public setProvider(provider: Provider): void {
|
public setProvider(provider: Provider): void {
|
||||||
@ -164,7 +164,7 @@ export class ContractWrappers {
|
|||||||
(this.orderValidator as any)._invalidateContractInstance();
|
(this.orderValidator as any)._invalidateContractInstance();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the provider instance currently used by 0x.js
|
* Get the provider instance currently used by contract-wrappers
|
||||||
* @return Web3 provider instance
|
* @return Web3 provider instance
|
||||||
*/
|
*/
|
||||||
public getProvider(): Provider {
|
public getProvider(): Provider {
|
||||||
|
@ -113,6 +113,7 @@ export abstract class ContractWrapper {
|
|||||||
return logWithDecodedArgs;
|
return logWithDecodedArgs;
|
||||||
}
|
}
|
||||||
protected _getDefaultContractAddresses(): ContractAddresses {
|
protected _getDefaultContractAddresses(): ContractAddresses {
|
||||||
|
// TODO(albrow): Figure out better error handling here.
|
||||||
return getContractAddressesForNetwork(this._networkId);
|
return getContractAddressesForNetwork(this._networkId);
|
||||||
}
|
}
|
||||||
private _onLogStateChanged<ArgsType extends ContractEventArgs>(isRemoved: boolean, rawLog: RawLogEntry): void {
|
private _onLogStateChanged<ArgsType extends ContractEventArgs>(isRemoved: boolean, rawLog: RawLogEntry): void {
|
||||||
|
@ -20,9 +20,8 @@ export class ERC20ProxyWrapper extends ContractWrapper {
|
|||||||
* Instantiate ERC20ProxyWrapper
|
* Instantiate ERC20ProxyWrapper
|
||||||
* @param web3Wrapper Web3Wrapper instance to use
|
* @param web3Wrapper Web3Wrapper instance to use
|
||||||
* @param networkId Desired networkId
|
* @param networkId Desired networkId
|
||||||
* @param address (Optional) The address of the ERC20Proxy contract. If
|
* @param address The address of the ERC20Proxy contract. If undefined, will
|
||||||
* undefined, will default to the known address corresponding to the
|
* default to the known address corresponding to the networkId.
|
||||||
* networkId.
|
|
||||||
*/
|
*/
|
||||||
constructor(web3Wrapper: Web3Wrapper, networkId: number, address?: string) {
|
constructor(web3Wrapper: Web3Wrapper, networkId: number, address?: string) {
|
||||||
super(web3Wrapper, networkId);
|
super(web3Wrapper, networkId);
|
||||||
|
@ -20,9 +20,8 @@ export class ERC721ProxyWrapper extends ContractWrapper {
|
|||||||
* Instantiate ERC721ProxyWrapper
|
* Instantiate ERC721ProxyWrapper
|
||||||
* @param web3Wrapper Web3Wrapper instance to use
|
* @param web3Wrapper Web3Wrapper instance to use
|
||||||
* @param networkId Desired networkId
|
* @param networkId Desired networkId
|
||||||
* @param address (Optional) The address of the ERC721Proxy contract. If
|
* @param address The address of the ERC721Proxy contract. If undefined,
|
||||||
* undefined, will default to the known address corresponding to the
|
* will default to the known address corresponding to the networkId.
|
||||||
* networkId.
|
|
||||||
*/
|
*/
|
||||||
constructor(web3Wrapper: Web3Wrapper, networkId: number, address?: string) {
|
constructor(web3Wrapper: Web3Wrapper, networkId: number, address?: string) {
|
||||||
super(web3Wrapper, networkId);
|
super(web3Wrapper, networkId);
|
||||||
|
@ -53,12 +53,11 @@ export class ExchangeWrapper extends ContractWrapper {
|
|||||||
* @param networkId Desired networkId.
|
* @param networkId Desired networkId.
|
||||||
* @param erc20TokenWrapper ERC20TokenWrapper instance to use.
|
* @param erc20TokenWrapper ERC20TokenWrapper instance to use.
|
||||||
* @param erc721TokenWrapper ERC721TokenWrapper instance to use.
|
* @param erc721TokenWrapper ERC721TokenWrapper instance to use.
|
||||||
* @param address (Optional) The address of the Exchange contract. If
|
* @param address The address of the Exchange contract. If undefined, will
|
||||||
|
* default to the known address corresponding to the networkId.
|
||||||
|
* @param zrxTokenAddress The address of the ZRXToken contract. If
|
||||||
* undefined, will default to the known address corresponding to the
|
* undefined, will default to the known address corresponding to the
|
||||||
* networkId.
|
* networkId.
|
||||||
* @param zrxTokenAddress (Optional) The address of the ZRXToken contract.
|
|
||||||
* If undefined, will default to the known address corresponding to the
|
|
||||||
* networkId.
|
|
||||||
* @param blockPollingIntervalMs The block polling interval to use for active subscriptions.
|
* @param blockPollingIntervalMs The block polling interval to use for active subscriptions.
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -32,15 +32,14 @@ export class ForwarderWrapper extends ContractWrapper {
|
|||||||
* Instantiate ForwarderWrapper
|
* Instantiate ForwarderWrapper
|
||||||
* @param web3Wrapper Web3Wrapper instance to use.
|
* @param web3Wrapper Web3Wrapper instance to use.
|
||||||
* @param networkId Desired networkId.
|
* @param networkId Desired networkId.
|
||||||
* @param address (Optional) The address of the Exchange contract. If
|
* @param address The address of the Exchange contract. If undefined, will
|
||||||
|
* default to the known address corresponding to the networkId.
|
||||||
|
* @param zrxTokenAddress The address of the ZRXToken contract. If
|
||||||
* undefined, will default to the known address corresponding to the
|
* undefined, will default to the known address corresponding to the
|
||||||
* networkId.
|
* networkId.
|
||||||
* @param zrxTokenAddress (Optional) The address of the ZRXToken contract.
|
* @param etherTokenAddress The address of a WETH (Ether token) contract. If
|
||||||
* If undefined, will default to the known address corresponding to the
|
* undefined, will default to the known address corresponding to the
|
||||||
* networkId.
|
* networkId.
|
||||||
* @param etherTokenAddress (Optional) The address of a WETH (Ether token)
|
|
||||||
* contract. If undefined, will default to the known address corresponding
|
|
||||||
* to the networkId.
|
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
web3Wrapper: Web3Wrapper,
|
web3Wrapper: Web3Wrapper,
|
||||||
|
@ -23,9 +23,8 @@ export class OrderValidatorWrapper extends ContractWrapper {
|
|||||||
* Instantiate OrderValidatorWrapper
|
* Instantiate OrderValidatorWrapper
|
||||||
* @param web3Wrapper Web3Wrapper instance to use.
|
* @param web3Wrapper Web3Wrapper instance to use.
|
||||||
* @param networkId Desired networkId.
|
* @param networkId Desired networkId.
|
||||||
* @param address (Optional) The address of the OrderValidator contract. If
|
* @param address The address of the OrderValidator contract. If undefined,
|
||||||
* undefined, will default to the known address corresponding to the
|
* will default to the known address corresponding to the networkId.
|
||||||
* networkId.
|
|
||||||
*/
|
*/
|
||||||
constructor(web3Wrapper: Web3Wrapper, networkId: number, address?: string) {
|
constructor(web3Wrapper: Web3Wrapper, networkId: number, address?: string) {
|
||||||
super(web3Wrapper, networkId);
|
super(web3Wrapper, networkId);
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"0x.js": "^1.0.8",
|
"0x.js": "^1.0.8",
|
||||||
"@0xproject/contract-addresses": "^1.0.0",
|
|
||||||
"@0xproject/subproviders": "^2.0.7",
|
"@0xproject/subproviders": "^2.0.7",
|
||||||
"@0xproject/typescript-typings": "^3.0.2",
|
"@0xproject/typescript-typings": "^3.0.2",
|
||||||
"@0xproject/utils": "^2.0.2",
|
"@0xproject/utils": "^2.0.2",
|
||||||
|
@ -11,7 +11,6 @@ import {
|
|||||||
SignedOrder,
|
SignedOrder,
|
||||||
Web3ProviderEngine,
|
Web3ProviderEngine,
|
||||||
} from '0x.js';
|
} from '0x.js';
|
||||||
import { getContractAddressesForNetwork } from '@0xproject/contract-addresses';
|
|
||||||
import { NonceTrackerSubprovider, PrivateKeyWalletSubprovider } from '@0xproject/subproviders';
|
import { NonceTrackerSubprovider, PrivateKeyWalletSubprovider } from '@0xproject/subproviders';
|
||||||
import { logUtils } from '@0xproject/utils';
|
import { logUtils } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
@ -68,7 +67,6 @@ export class Handler {
|
|||||||
const networkId = parseInt(networkIdString, 10);
|
const networkId = parseInt(networkIdString, 10);
|
||||||
const contractWrappersConfig = {
|
const contractWrappersConfig = {
|
||||||
networkId,
|
networkId,
|
||||||
contractAddresses: getContractAddressesForNetwork(networkId),
|
|
||||||
};
|
};
|
||||||
const contractWrappers = new ContractWrappers(providerObj, contractWrappersConfig);
|
const contractWrappers = new ContractWrappers(providerObj, contractWrappersConfig);
|
||||||
const dispatchQueue = new DispatchQueue();
|
const dispatchQueue = new DispatchQueue();
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"0x.js": "^0.38.6",
|
"0x.js": "^0.38.6",
|
||||||
"@0xproject/contract-addresses": "^1.0.0",
|
|
||||||
"@0xproject/contract-wrappers": "^2.0.2",
|
"@0xproject/contract-wrappers": "^2.0.2",
|
||||||
"@0xproject/json-schemas": "^1.0.7",
|
"@0xproject/json-schemas": "^1.0.7",
|
||||||
"@0xproject/order-utils": "^1.0.7",
|
"@0xproject/order-utils": "^1.0.7",
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { ZeroEx } from '0x.js';
|
||||||
import { getContractAddressesForNetwork } from '@0xproject/contract-addresses';
|
|
||||||
import {
|
import {
|
||||||
BlockRange,
|
BlockRange,
|
||||||
ContractWrappers,
|
ContractWrappers,
|
||||||
@ -864,7 +863,6 @@ export class Blockchain {
|
|||||||
} else {
|
} else {
|
||||||
const contractWrappersConfig = {
|
const contractWrappersConfig = {
|
||||||
networkId,
|
networkId,
|
||||||
contractAddresses: getContractAddressesForNetwork(networkId),
|
|
||||||
};
|
};
|
||||||
this._contractWrappers = new ContractWrappers(provider, contractWrappersConfig);
|
this._contractWrappers = new ContractWrappers(provider, contractWrappersConfig);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
{ "path": "./packages/asset-buyer" },
|
{ "path": "./packages/asset-buyer" },
|
||||||
{ "path": "./packages/base-contract" },
|
{ "path": "./packages/base-contract" },
|
||||||
{ "path": "./packages/connect" },
|
{ "path": "./packages/connect" },
|
||||||
|
{ "path": "./packages/contract-addresses" },
|
||||||
{ "path": "./packages/contract-artifacts" },
|
{ "path": "./packages/contract-artifacts" },
|
||||||
{ "path": "./packages/contract-wrappers" },
|
{ "path": "./packages/contract-wrappers" },
|
||||||
{ "path": "./packages/contracts" },
|
{ "path": "./packages/contracts" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user