aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-report/src/index.ts
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-02-28 06:06:33 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-02-28 06:11:45 +0800
commite48a3edacba891a18e641e01708e3d73fd6588ac (patch)
tree5a17b49eafdf114d6f623f99caa2c1525bc6cb84 /packages/sra-report/src/index.ts
parent9c8501a84e92faf3ef015ae8ab4d1da9354f9a9d (diff)
downloaddexon-sol-tools-e48a3edacba891a18e641e01708e3d73fd6588ac.tar
dexon-sol-tools-e48a3edacba891a18e641e01708e3d73fd6588ac.tar.gz
dexon-sol-tools-e48a3edacba891a18e641e01708e3d73fd6588ac.tar.bz2
dexon-sol-tools-e48a3edacba891a18e641e01708e3d73fd6588ac.tar.lz
dexon-sol-tools-e48a3edacba891a18e641e01708e3d73fd6588ac.tar.xz
dexon-sol-tools-e48a3edacba891a18e641e01708e3d73fd6588ac.tar.zst
dexon-sol-tools-e48a3edacba891a18e641e01708e3d73fd6588ac.zip
Get orderHash via 0x connect
Diffstat (limited to 'packages/sra-report/src/index.ts')
-rw-r--r--packages/sra-report/src/index.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/packages/sra-report/src/index.ts b/packages/sra-report/src/index.ts
index d273d74a4..bd0615480 100644
--- a/packages/sra-report/src/index.ts
+++ b/packages/sra-report/src/index.ts
@@ -1,6 +1,8 @@
#!/usr/bin/env node
+import { ZeroEx } from '0x.js';
import { assert } from '@0xproject/assert';
+import { HttpClient } from '@0xproject/connect';
import { Schema, schemas } from '@0xproject/json-schemas';
import { promisify } from '@0xproject/utils';
import chalk from 'chalk';
@@ -14,7 +16,6 @@ import { postmanEnvironmentFactory } from './postman_environment_factory';
import { utils } from './utils';
const newmanRunAsync = promisify<void>(newman.run);
-
const DEFAULT_NETWORK_ID = 1;
const SUPPORTED_NETWORK_IDS = [1, 42];
@@ -55,14 +56,20 @@ if (!_.includes(SUPPORTED_NETWORK_IDS, args.networkId)) {
}
const mainAsync = async () => {
+ const httpClient = new HttpClient(args.url);
+ const orders = await httpClient.getOrdersAsync();
+ const firstOrder = _.head(orders);
+ if (_.isUndefined(firstOrder)) {
+ throw new Error('Could not get any orders from /orders endpoint');
+ }
+ const orderHash = ZeroEx.getOrderHashHex(firstOrder);
const newmanRunOptions = {
collection: sraReportCollectionJSON,
reporters: 'cli',
- globals: postmanEnvironmentFactory.createGlobalEnvironment(args.url),
+ globals: postmanEnvironmentFactory.createGlobalEnvironment(args.url, orderHash),
environment: postmanEnvironmentFactory.createNetworkEnvironment(args.networkId),
};
await newmanRunAsync(newmanRunOptions);
};
-mainAsync()
- .catch(err => utils.log);
+mainAsync().catch(utils.log);