diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/0x.js/CHANGELOG.md | 2 | ||||
-rw-r--r-- | packages/0x.js/test/expiration_watcher_test.ts | 8 | ||||
-rw-r--r-- | packages/connect/CHANGELOG.md | 3 | ||||
-rw-r--r-- | packages/connect/package.json | 6 | ||||
-rw-r--r-- | packages/connect/scripts/postpublish.js | 33 | ||||
-rw-r--r-- | packages/connect/src/http_client.ts | 8 | ||||
-rw-r--r-- | packages/connect/src/index.ts | 4 | ||||
-rw-r--r-- | packages/connect/test/ws_orderbook_channel_test.ts | 2 |
8 files changed, 50 insertions, 16 deletions
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index 26e5f528b..235a6eedb 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -vx.x.x +v0.26.0 ------------------------ * Add post-formatter for logs converting `blockNumber`, `logIndex`, `transactionIndex` from hexes to numbers (#231) * Remove support for Async callback types when used in Subscribe functions (#222) diff --git a/packages/0x.js/test/expiration_watcher_test.ts b/packages/0x.js/test/expiration_watcher_test.ts index 0d5ebb909..0f2470070 100644 --- a/packages/0x.js/test/expiration_watcher_test.ts +++ b/packages/0x.js/test/expiration_watcher_test.ts @@ -12,11 +12,13 @@ import {TokenUtils} from './utils/token_utils'; import {ExpirationWatcher} from '../src/order_watcher/expiration_watcher'; import {Token, DoneCallback} from '../src/types'; import {ZeroEx} from '../src/0x'; +import {BlockchainLifecycle} from './utils/blockchain_lifecycle'; import {FillScenarios} from './utils/fill_scenarios'; import {reportCallbackErrors} from './utils/report_callback_errors'; chaiSetup.configure(); const expect = chai.expect; +const blockchainLifecycle = new BlockchainLifecycle(); describe('ExpirationWatcher', () => { let web3: Web3; @@ -52,14 +54,16 @@ describe('ExpirationWatcher', () => { makerTokenAddress = makerToken.address; takerTokenAddress = takerToken.address; }); - beforeEach(() => { + beforeEach(async () => { + await blockchainLifecycle.startAsync(); const sinonTimerConfig = {shouldAdvanceTime: true} as any; // This constructor has incorrect types timer = Sinon.useFakeTimers(sinonTimerConfig); currentUnixTimestampSec = utils.getCurrentUnixTimestampSec(); expirationWatcher = new ExpirationWatcher(); }); - afterEach(() => { + afterEach(async () => { + await blockchainLifecycle.revertAsync(); timer.restore(); expirationWatcher.unsubscribe(); }); diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index f3367f4ce..a6e30ed4a 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -1,4 +1,5 @@ # CHANGELOG -v0.0.0 - _Nov. 15, 2017_ +v0.0.2 - _November 22, 2017_ ------------------------ + * Provide a HttpClient class for interacting with standard relayer api compliant HTTP urls diff --git a/packages/connect/package.json b/packages/connect/package.json index ff6253fb6..180a79eea 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -3,7 +3,7 @@ "version": "0.0.1", "description": "A javascript library for interacting with the standard relayer api", "keywords": [ - "0x-connect", + "connect", "0xproject", "ethereum", "tokens", @@ -14,9 +14,10 @@ "scripts": { "build": "tsc", "clean": "shx rm -rf _bundles lib test_temp", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_DIR", + "upload_docs_json": "aws s3 cp docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type aplication/json", "copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures", "lint": "tslint src/**/*.ts test/**/*.ts", - "prepublishOnly": "run-p build", "run_mocha": "mocha lib/test/**/*_test.js", "test": "run-s clean build copy_test_fixtures run_mocha", "test:circleci": "yarn test" @@ -62,6 +63,7 @@ "npm-run-all": "^4.0.2", "shx": "^0.2.2", "tslint": "5.8.0", + "typedoc": "~0.8.0", "typescript": "~2.6.1", "web3-typescript-typings": "^0.7.1" } diff --git a/packages/connect/scripts/postpublish.js b/packages/connect/scripts/postpublish.js index 7fa452b08..ba0f8507d 100644 --- a/packages/connect/scripts/postpublish.js +++ b/packages/connect/scripts/postpublish.js @@ -1,14 +1,39 @@ +const execAsync = require('async-child-process').execAsync; const postpublish_utils = require('../../../scripts/postpublish_utils'); const packageJSON = require('../package.json'); +const cwd = __dirname + '/..'; const subPackageName = packageJSON.name; +const S3BucketPath = 's3://connect-docs-jsons/'; +let tag; +let version; postpublish_utils.getLatestTagAndVersionAsync(subPackageName) .then(function(result) { - const releaseName = postpublish_utils.getReleaseName(subPackageName, result.version); - const assets = []; - return postpublish_utils.publishReleaseNotes(result.tag, releaseName, assets); + tag = result.tag; + version = result.version; + const releaseName = postpublish_utils.getReleaseName(subPackageName, version); + return postpublish_utils.publishReleaseNotes(tag, releaseName); }) - .catch (function(err) { + .then(function(release) { + console.log('POSTPUBLISH: Release successful, generating docs...'); + return execAsync( + 'JSON_FILE_PATH=' + __dirname + '/../docs/index.json PROJECT_DIR=' + __dirname + '/.. yarn docs:json', + { + cwd, + } + ); + }) + .then(function(result) { + if (result.stderr !== '') { + throw new Error(result.stderr); + } + const fileName = 'v' + version + '.json'; + console.log('POSTPUBLISH: Doc generation successful, uploading docs... as ', fileName); + const s3Url = S3BucketPath + fileName; + return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json', { + cwd, + }); + }).catch (function(err) { throw err; }); diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts index ab8c6bfa1..85dc83c61 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -18,6 +18,11 @@ import { 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 +BigNumber.config({ + EXPONENTIAL_AT: 1000, +}); + interface RequestOptions { params?: object; payload?: object; @@ -157,9 +162,10 @@ export class HttpClient implements Client { const headers = new Headers({ 'content-type': 'application/json', }); + const response = await fetch(url, { method: requestType, - body: payload, + body: JSON.stringify(payload), headers, }); if (!response.ok) { diff --git a/packages/connect/src/index.ts b/packages/connect/src/index.ts index 5e97f4f26..c9ebde510 100644 --- a/packages/connect/src/index.ts +++ b/packages/connect/src/index.ts @@ -1,12 +1,8 @@ export {HttpClient} from './http_client'; -export {WebSocketOrderbookChannel} from './ws_orderbook_channel'; export { Client, FeesRequest, FeesResponse, - OrderbookChannel, - OrderbookChannelHandler, - OrderbookChannelSubscriptionOpts, OrderbookRequest, OrderbookResponse, OrdersRequest, diff --git a/packages/connect/test/ws_orderbook_channel_test.ts b/packages/connect/test/ws_orderbook_channel_test.ts index f3dead9ae..e92c6f44a 100644 --- a/packages/connect/test/ws_orderbook_channel_test.ts +++ b/packages/connect/test/ws_orderbook_channel_test.ts @@ -4,7 +4,7 @@ import * as dirtyChai from 'dirty-chai'; import * as chai from 'chai'; import { WebSocketOrderbookChannel, -} from '../src/index'; +} from '../src/ws_orderbook_channel'; chai.config.includeStack = true; chai.use(dirtyChai); |