diff options
author | Fabio Berger <me@fabioberger.com> | 2017-11-28 07:15:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-28 07:15:18 +0800 |
commit | 54ef916b93ba0939dcb8824149c9a9fb74df4f2e (patch) | |
tree | 6559179e99d077ae8d78350580a082e75d50a7c8 /packages/connect | |
parent | 4a770dee84ee49e8038da7dd32ce26338176bf36 (diff) | |
parent | f862a2af6d9802c2c75f813025517e0c52cd513c (diff) | |
download | dexon-sol-tools-54ef916b93ba0939dcb8824149c9a9fb74df4f2e.tar dexon-sol-tools-54ef916b93ba0939dcb8824149c9a9fb74df4f2e.tar.gz dexon-sol-tools-54ef916b93ba0939dcb8824149c9a9fb74df4f2e.tar.bz2 dexon-sol-tools-54ef916b93ba0939dcb8824149c9a9fb74df4f2e.tar.lz dexon-sol-tools-54ef916b93ba0939dcb8824149c9a9fb74df4f2e.tar.xz dexon-sol-tools-54ef916b93ba0939dcb8824149c9a9fb74df4f2e.tar.zst dexon-sol-tools-54ef916b93ba0939dcb8824149c9a9fb74df4f2e.zip |
Merge pull request #233 from 0xProject/feature/passNetworkId
Forces the users of 0x.js to pass the network id
Diffstat (limited to 'packages/connect')
10 files changed, 41 insertions, 30 deletions
diff --git a/packages/connect/package.json b/packages/connect/package.json index 00378397c..acb2bd053 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -17,7 +17,7 @@ "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_DIR", "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json", "copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures", - "lint": "tslint src/**/*.ts test/**/*.ts", + "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", "run_mocha": "mocha lib/test/**/*_test.js", "test": "run-s clean build copy_test_fixtures run_mocha", "test:circleci": "yarn test" diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts index 18855693f..3a9e11a7d 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -1,10 +1,12 @@ +import {SignedOrder} from '0x.js'; +import {assert} from '@0xproject/assert'; +import {schemas} from '@0xproject/json-schemas'; +import {BigNumber} from 'bignumber.js'; import 'isomorphic-fetch'; import * as _ from 'lodash'; -import {BigNumber} from 'bignumber.js'; import * as queryString from 'query-string'; -import {assert} from '@0xproject/assert'; -import {schemas} from '@0xproject/json-schemas'; -import {SignedOrder} from '0x.js'; + +import {schemas as clientSchemas} from './schemas/schemas'; import { Client, FeesRequest, @@ -17,7 +19,6 @@ import { TokenPairsItem, TokenPairsRequest, } from './types'; -import {schemas as clientSchemas} from './schemas/schemas'; import {typeConverters} from './utils/type_converters'; // TODO: move this and bigNumberConfigs in the 0x.js package into one place diff --git a/packages/connect/src/utils/orderbook_channel_message_parsers.ts b/packages/connect/src/utils/orderbook_channel_message_parsers.ts index b590b189b..f3497db34 100644 --- a/packages/connect/src/utils/orderbook_channel_message_parsers.ts +++ b/packages/connect/src/utils/orderbook_channel_message_parsers.ts @@ -1,11 +1,13 @@ -import * as _ from 'lodash'; import {SignedOrder} from '0x.js'; import {assert} from '@0xproject/assert'; import {schemas} from '@0xproject/json-schemas'; +import * as _ from 'lodash'; + import { OrderbookChannelMessage, OrderbookChannelMessageTypes, } from '../types'; + import {typeConverters} from './type_converters'; export const orderbookChannelMessageParsers = { diff --git a/packages/connect/src/utils/type_converters.ts b/packages/connect/src/utils/type_converters.ts index bf17a5629..c136382fd 100644 --- a/packages/connect/src/utils/type_converters.ts +++ b/packages/connect/src/utils/type_converters.ts @@ -1,5 +1,5 @@ -import * as _ from 'lodash'; import {BigNumber} from 'bignumber.js'; +import * as _ from 'lodash'; // TODO: convert all of these to non-mutating, pure functions export const typeConverters = { diff --git a/packages/connect/src/ws_orderbook_channel.ts b/packages/connect/src/ws_orderbook_channel.ts index 769a52237..f5badf624 100644 --- a/packages/connect/src/ws_orderbook_channel.ts +++ b/packages/connect/src/ws_orderbook_channel.ts @@ -1,8 +1,9 @@ -import * as _ from 'lodash'; -import * as WebSocket from 'websocket'; +import {SignedOrder} from '0x.js'; import {assert} from '@0xproject/assert'; import {schemas} from '@0xproject/json-schemas'; -import {SignedOrder} from '0x.js'; +import * as _ from 'lodash'; +import * as WebSocket from 'websocket'; + import { OrderbookChannel, OrderbookChannelHandler, diff --git a/packages/connect/test/fixtures/standard_relayer_api/fees.ts b/packages/connect/test/fixtures/standard_relayer_api/fees.ts index c57b42717..68421880e 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/fees.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/fees.ts @@ -1,4 +1,5 @@ import {BigNumber} from 'bignumber.js'; + import {FeesResponse} from '../../../src/types'; export const feesResponse: FeesResponse = { diff --git a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts index 250277436..b3ae7a1b1 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts @@ -1,4 +1,5 @@ import {BigNumber} from 'bignumber.js'; + import {TokenPairsItem} from '../../../src/types'; export const tokenPairsResponse: TokenPairsItem[] = [ diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts index 4ac93df76..3d72ca185 100644 --- a/packages/connect/test/http_client_test.ts +++ b/packages/connect/test/http_client_test.ts @@ -1,23 +1,25 @@ -import 'mocha'; -import * as dirtyChai from 'dirty-chai'; +import {BigNumber} from 'bignumber.js'; import * as chai from 'chai'; import * as chaiAsPromised from 'chai-as-promised'; +import * as dirtyChai from 'dirty-chai'; import * as fetchMock from 'fetch-mock'; -import {BigNumber} from 'bignumber.js'; +import 'mocha'; + import {HttpClient} from '../src/index'; + import {feesResponse} from './fixtures/standard_relayer_api/fees'; +import * as feesResponseJSON from './fixtures/standard_relayer_api/fees.json'; import { orderResponse, } from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f'; -import {ordersResponse} from './fixtures/standard_relayer_api/orders'; -import {tokenPairsResponse} from './fixtures/standard_relayer_api/token_pairs'; -import {orderbookResponse} from './fixtures/standard_relayer_api/orderbook'; -import * as feesResponseJSON from './fixtures/standard_relayer_api/fees.json'; // tslint:disable-next-line:max-line-length import * as orderResponseJSON from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json'; +import {orderbookResponse} from './fixtures/standard_relayer_api/orderbook'; +import * as orderbookJSON from './fixtures/standard_relayer_api/orderbook.json'; +import {ordersResponse} from './fixtures/standard_relayer_api/orders'; import * as ordersResponseJSON from './fixtures/standard_relayer_api/orders.json'; +import {tokenPairsResponse} from './fixtures/standard_relayer_api/token_pairs'; import * as tokenPairsResponseJSON from './fixtures/standard_relayer_api/token_pairs.json'; -import * as orderbookJSON from './fixtures/standard_relayer_api/orderbook.json'; chai.config.includeStack = true; chai.use(dirtyChai); diff --git a/packages/connect/test/orderbook_channel_message_parsers_test.ts b/packages/connect/test/orderbook_channel_message_parsers_test.ts index 8efc5e500..0ad0b12b3 100644 --- a/packages/connect/test/orderbook_channel_message_parsers_test.ts +++ b/packages/connect/test/orderbook_channel_message_parsers_test.ts @@ -1,19 +1,21 @@ -import 'mocha'; -import * as dirtyChai from 'dirty-chai'; import * as chai from 'chai'; +import * as dirtyChai from 'dirty-chai'; +import 'mocha'; + import {orderbookChannelMessageParsers} from '../src/utils/orderbook_channel_message_parsers'; + +// tslint:disable-next-line:max-line-length +import {orderResponse} from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f'; +import {orderbookResponse} from './fixtures/standard_relayer_api/orderbook'; import { - snapshotOrderbookChannelMessage, malformedSnapshotOrderbookChannelMessage, + snapshotOrderbookChannelMessage, } from './fixtures/standard_relayer_api/snapshot_orderbook_channel_message'; +import {unknownOrderbookChannelMessage} from './fixtures/standard_relayer_api/unknown_orderbook_channel_message'; import { - updateOrderbookChannelMessage, malformedUpdateOrderbookChannelMessage, + updateOrderbookChannelMessage, } from './fixtures/standard_relayer_api/update_orderbook_channel_message'; -import {unknownOrderbookChannelMessage} from './fixtures/standard_relayer_api/unknown_orderbook_channel_message'; -import {orderbookResponse} from './fixtures/standard_relayer_api/orderbook'; -// tslint:disable-next-line:max-line-length -import {orderResponse} from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f'; chai.config.includeStack = true; chai.use(dirtyChai); diff --git a/packages/connect/test/ws_orderbook_channel_test.ts b/packages/connect/test/ws_orderbook_channel_test.ts index e92c6f44a..6190a5ac3 100644 --- a/packages/connect/test/ws_orderbook_channel_test.ts +++ b/packages/connect/test/ws_orderbook_channel_test.ts @@ -1,7 +1,8 @@ -import 'mocha'; -import * as _ from 'lodash'; -import * as dirtyChai from 'dirty-chai'; import * as chai from 'chai'; +import * as dirtyChai from 'dirty-chai'; +import * as _ from 'lodash'; +import 'mocha'; + import { WebSocketOrderbookChannel, } from '../src/ws_orderbook_channel'; |