aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-05-23 00:25:02 +0800
committerFabio Berger <me@fabioberger.com>2018-05-23 00:25:02 +0800
commit4a0c8d72b05152ee2fd71245873d5a70f7281058 (patch)
tree2c28ad8214aaaa10913a621509d0ae4020ee4d3d /packages/contract-wrappers/src
parentd460c0e8b9c6f4081803fff4e2d2347be8cd5ce3 (diff)
parentab9cfd293b3ccc2aacb4238aebe2b033e55b7935 (diff)
downloaddexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.tar
dexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.tar.gz
dexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.tar.bz2
dexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.tar.lz
dexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.tar.xz
dexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.tar.zst
dexon-sol-tools-4a0c8d72b05152ee2fd71245873d5a70f7281058.zip
merge development
Diffstat (limited to 'packages/contract-wrappers/src')
-rw-r--r--packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts16
-rw-r--r--packages/contract-wrappers/src/utils/constants.ts1
-rw-r--r--packages/contract-wrappers/src/utils/filter_utils.ts8
-rw-r--r--packages/contract-wrappers/src/utils/utils.ts3
4 files changed, 22 insertions, 6 deletions
diff --git a/packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts b/packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts
index bf1000afa..304cd100b 100644
--- a/packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts
+++ b/packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts
@@ -1,9 +1,23 @@
+const networkNameToId: { [networkName: string]: number } = {
+ mainnet: 1,
+ ropsten: 3,
+ rinkeby: 4,
+ kovan: 42,
+ ganache: 50,
+};
+
export const contractWrappersPublicNetworkConfigSchema = {
id: '/ZeroExContractPublicNetworkConfig',
properties: {
networkId: {
type: 'number',
- enum: [1, 3, 4, 42, 50],
+ enum: [
+ networkNameToId.mainnet,
+ networkNameToId.kovan,
+ networkNameToId.ropsten,
+ networkNameToId.rinkeby,
+ networkNameToId.ganache,
+ ],
},
gasPrice: { $ref: '/Number' },
zrxContractAddress: { $ref: '/Address' },
diff --git a/packages/contract-wrappers/src/utils/constants.ts b/packages/contract-wrappers/src/utils/constants.ts
index 07da6745d..76d805cac 100644
--- a/packages/contract-wrappers/src/utils/constants.ts
+++ b/packages/contract-wrappers/src/utils/constants.ts
@@ -6,6 +6,7 @@ export const constants = {
INVALID_JUMP_PATTERN: 'invalid JUMP at',
OUT_OF_GAS_PATTERN: 'out of gas',
INVALID_TAKER_FORMAT: 'instance.taker is not of a type(s) string',
+ // tslint:disable-next-line:custom-no-magic-numbers
UNLIMITED_ALLOWANCE_IN_BASE_UNITS: new BigNumber(2).pow(256).minus(1),
DEFAULT_BLOCK_POLLING_INTERVAL: 1000,
};
diff --git a/packages/contract-wrappers/src/utils/filter_utils.ts b/packages/contract-wrappers/src/utils/filter_utils.ts
index c5df7321e..4ec9e256b 100644
--- a/packages/contract-wrappers/src/utils/filter_utils.ts
+++ b/packages/contract-wrappers/src/utils/filter_utils.ts
@@ -73,14 +73,14 @@ export const filterUtils = {
return false;
}
if (!_.isUndefined(filter.topics)) {
- return filterUtils.matchesTopics(log.topics, filter.topics);
+ return filterUtils.doesMatchTopics(log.topics, filter.topics);
}
return true;
},
- matchesTopics(logTopics: string[], filterTopics: Array<string[] | string | null>): boolean {
+ doesMatchTopics(logTopics: string[], filterTopics: Array<string[] | string | null>): boolean {
const matchesTopic = _.zipWith(logTopics, filterTopics, filterUtils.matchesTopic.bind(filterUtils));
- const matchesTopics = _.every(matchesTopic);
- return matchesTopics;
+ const doesMatchTopics = _.every(matchesTopic);
+ return doesMatchTopics;
},
matchesTopic(logTopic: string, filterTopic: string[] | string | null): boolean {
if (_.isArray(filterTopic)) {
diff --git a/packages/contract-wrappers/src/utils/utils.ts b/packages/contract-wrappers/src/utils/utils.ts
index af1125632..7cf9450a0 100644
--- a/packages/contract-wrappers/src/utils/utils.ts
+++ b/packages/contract-wrappers/src/utils/utils.ts
@@ -5,7 +5,8 @@ export const utils = {
return new Error(`Unexpected switch value: ${value} encountered for ${name}`);
},
getCurrentUnixTimestampSec(): BigNumber {
- return new BigNumber(Date.now() / 1000).round();
+ const milisecondsInSecond = 1000;
+ return new BigNumber(Date.now() / milisecondsInSecond).round();
},
getCurrentUnixTimestampMs(): BigNumber {
return new BigNumber(Date.now());