aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/connect/CHANGELOG.json9
-rw-r--r--packages/connect/src/http_client.ts2
-rw-r--r--packages/connect/src/types.ts6
-rw-r--r--packages/connect/test/http_client_test.ts13
4 files changed, 20 insertions, 10 deletions
diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json
index 8ccb6afe2..cecafc6f7 100644
--- a/packages/connect/CHANGELOG.json
+++ b/packages/connect/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0-rc.3",
+ "changes": [
+ {
+ "note": "Change `OrderConfigRequest` to use BigNumber instead of string for relevant fields.",
+ "pr": 1058
+ }
+ ]
+ },
+ {
"version": "2.0.0-rc.2",
"changes": [
{
diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts
index b90c2c35f..87d5c30be 100644
--- a/packages/connect/src/http_client.ts
+++ b/packages/connect/src/http_client.ts
@@ -151,7 +151,7 @@ export class HttpClient implements Client {
params: requestOpts,
payload: request,
};
- const responseJson = await this._requestAsync('/order_config', HttpRequestType.Post, httpRequestOpts);
+ const responseJson = await this._requestAsync('/order_config', HttpRequestType.Get, httpRequestOpts);
const fees = relayerResponseJsonParsers.parseOrderConfigResponseJson(responseJson);
return fees;
}
diff --git a/packages/connect/src/types.ts b/packages/connect/src/types.ts
index 06ae732a5..b76af081c 100644
--- a/packages/connect/src/types.ts
+++ b/packages/connect/src/types.ts
@@ -126,12 +126,12 @@ export interface PaginatedCollection<T> {
export interface OrderConfigRequest {
makerAddress: string;
takerAddress: string;
- makerAssetAmount: string;
- takerAssetAmount: string;
+ makerAssetAmount: BigNumber;
+ takerAssetAmount: BigNumber;
makerAssetData: string;
takerAssetData: string;
exchangeAddress: string;
- expirationTimeSeconds: string;
+ expirationTimeSeconds: BigNumber;
}
export interface OrderConfigResponse {
diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts
index 5b564e97b..83b77021a 100644
--- a/packages/connect/test/http_client_test.ts
+++ b/packages/connect/test/http_client_test.ts
@@ -1,3 +1,4 @@
+import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import * as dirtyChai from 'dirty-chai';
@@ -138,21 +139,21 @@ describe('HttpClient', () => {
const request = {
makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
- makerAssetAmount: '10000000000000000',
- takerAssetAmount: '20000000000000000',
- expirationTimeSeconds: '1532560590',
+ makerAssetAmount: new BigNumber('10000000000000000'),
+ takerAssetAmount: new BigNumber('20000000000000000'),
+ expirationTimeSeconds: new BigNumber('1532560590'),
makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d',
takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990',
exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093',
};
const url = `${relayUrl}/order_config`;
it('gets order config', async () => {
- fetchMock.post(url, orderConfigResponseJSON);
+ fetchMock.get(url, orderConfigResponseJSON);
const fees = await relayerClient.getOrderConfigAsync(request);
expect(fees).to.be.deep.equal(orderConfigResponse);
});
it('does not mutate input', async () => {
- fetchMock.post(url, orderConfigResponseJSON);
+ fetchMock.get(url, orderConfigResponseJSON);
const makerAssetAmountBefore = request.makerAssetAmount;
const takerAssetAmountBefore = request.takerAssetAmount;
const expirationTimeSecondsBefore = request.expirationTimeSeconds;
@@ -162,7 +163,7 @@ describe('HttpClient', () => {
expect(expirationTimeSecondsBefore).to.be.deep.equal(request.expirationTimeSeconds);
});
it('throws an error for invalid JSON response', async () => {
- fetchMock.post(url, { test: 'dummy' });
+ fetchMock.get(url, { test: 'dummy' });
expect(relayerClient.getOrderConfigAsync(request)).to.be.rejected();
});
});