diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-02-28 09:25:42 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-02-28 09:25:42 +0800 |
commit | a3c7af95e17dda91efaff83824c43f8ffb28f078 (patch) | |
tree | f45e2dd4bf2032501c22e519a09098e62840328f /packages | |
parent | 0987c9a7cfb1936469062b4cb6222158b5e110b7 (diff) | |
download | dexon-sol-tools-a3c7af95e17dda91efaff83824c43f8ffb28f078.tar.gz dexon-sol-tools-a3c7af95e17dda91efaff83824c43f8ffb28f078.tar.zst dexon-sol-tools-a3c7af95e17dda91efaff83824c43f8ffb28f078.zip |
Add stringified order object into globals
Diffstat (limited to 'packages')
-rw-r--r-- | packages/sra-report/src/index.ts | 5 | ||||
-rw-r--r-- | packages/sra-report/src/postman_environment_factory.ts | 11 |
2 files changed, 10 insertions, 6 deletions
diff --git a/packages/sra-report/src/index.ts b/packages/sra-report/src/index.ts index fade07095..bee9db192 100644 --- a/packages/sra-report/src/index.ts +++ b/packages/sra-report/src/index.ts @@ -1,6 +1,4 @@ #!/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'; @@ -62,10 +60,9 @@ const mainAsync = async () => { if (_.isUndefined(firstOrder)) { throw new Error('Could not get any orders from /orders endpoint'); } - const orderHash = ZeroEx.getOrderHashHex(firstOrder); const newmanEnvironmentOptions = { collection: sraReportCollectionJSON, - globals: postmanEnvironmentFactory.createGlobalEnvironment(args.url, orderHash), + globals: postmanEnvironmentFactory.createGlobalEnvironment(args.url, firstOrder), environment: postmanEnvironmentFactory.createNetworkEnvironment(args.networkId), }; const newmanReporterOptions = !_.isUndefined(args.output) diff --git a/packages/sra-report/src/postman_environment_factory.ts b/packages/sra-report/src/postman_environment_factory.ts index b0b69ddad..bea805ca6 100644 --- a/packages/sra-report/src/postman_environment_factory.ts +++ b/packages/sra-report/src/postman_environment_factory.ts @@ -1,3 +1,7 @@ +import { + SignedOrder, + ZeroEx, + } from '0x.js'; import { Schema, schemas as schemasByName } from '@0xproject/json-schemas'; import * as _ from 'lodash'; @@ -12,9 +16,11 @@ interface EnvironmentValue { } export const postmanEnvironmentFactory = { - createGlobalEnvironment(url: string, orderHash: string) { - const urlEnvironmentValue = createEnvironmentValue('url', url); + createGlobalEnvironment(url: string, order: SignedOrder) { + const orderHash = ZeroEx.getOrderHashHex(order); + const orderEnvironmentValue = createEnvironmentValue('order', JSON.stringify(order)); const orderHashEnvironmentValue = createEnvironmentValue('orderHash', orderHash); + const urlEnvironmentValue = createEnvironmentValue('url', url); const schemas: Schema[] = _.values(schemasByName); const schemaEnvironmentValues = _.compact( _.map(schemas, (schema: Schema) => { @@ -36,6 +42,7 @@ export const postmanEnvironmentFactory = { schemaEnvironmentValues, urlEnvironmentValue, schemaKeysEnvironmentValue, + orderEnvironmentValue, orderHashEnvironmentValue, ); const environment = { |