aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/test
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-15 05:40:52 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-15 05:40:52 +0800
commitce88086e080e05ed71c1ef4e31f2d0ce530af67f (patch)
treef2022bb7bc42c9bc85cbef19c684b666e2d7f66f /packages/connect/test
parentc1cc92a46f9ebfa4408a5dc515f1e100fe3a7054 (diff)
downloaddexon-sol-tools-ce88086e080e05ed71c1ef4e31f2d0ce530af67f.tar
dexon-sol-tools-ce88086e080e05ed71c1ef4e31f2d0ce530af67f.tar.gz
dexon-sol-tools-ce88086e080e05ed71c1ef4e31f2d0ce530af67f.tar.bz2
dexon-sol-tools-ce88086e080e05ed71c1ef4e31f2d0ce530af67f.tar.lz
dexon-sol-tools-ce88086e080e05ed71c1ef4e31f2d0ce530af67f.tar.xz
dexon-sol-tools-ce88086e080e05ed71c1ef4e31f2d0ce530af67f.tar.zst
dexon-sol-tools-ce88086e080e05ed71c1ef4e31f2d0ce530af67f.zip
Update types to reflect v2
Diffstat (limited to 'packages/connect/test')
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/fees.ts4
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json8
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts8
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/orderbook.json16
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/orderbook.ts16
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/orders.json8
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/orders.ts8
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts17
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/token_pairs.json4
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts6
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts2
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts4
-rw-r--r--packages/connect/test/http_client_test.ts70
-rw-r--r--packages/connect/test/orderbook_channel_message_parsers_test.ts22
-rw-r--r--packages/connect/test/ws_orderbook_channel_test.ts6
15 files changed, 91 insertions, 108 deletions
diff --git a/packages/connect/test/fixtures/standard_relayer_api/fees.ts b/packages/connect/test/fixtures/standard_relayer_api/fees.ts
index fecbaacff..7a526b491 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/fees.ts
+++ b/packages/connect/test/fixtures/standard_relayer_api/fees.ts
@@ -1,8 +1,8 @@
import { BigNumber } from '@0xproject/utils';
-import { FeesResponse } from '../../../src/types';
+import { OrderConfigResponse } from '../../../src/types';
-export const feesResponse: FeesResponse = {
+export const feesResponse: OrderConfigResponse = {
feeRecipient: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
makerFee: new BigNumber('10000000000000000'),
takerFee: new BigNumber('30000000000000000'),
diff --git a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json
index e84954b0d..23e4fb327 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json
+++ b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json
@@ -3,14 +3,14 @@
"taker": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
"makerFee": "100000000000000",
"takerFee": "200000000000000",
- "makerTokenAmount": "10000000000000000",
- "takerTokenAmount": "20000000000000000",
+ "makerAssetAmount": "10000000000000000",
+ "takerAssetAmount": "20000000000000000",
"makerTokenAddress": "0x323b5d4c32345ced77393b3530b1eed0f346429d",
"takerTokenAddress": "0xef7fff64389b814a946f3e92105513705ca6b990",
"salt": "256",
"feeRecipient": "0xb046140686d052fff581f63f8136cce132e857da",
- "exchangeContractAddress": "0x12459c951127e0c374ff9105dda097662a027093",
- "expirationUnixTimestampSec": "42",
+ "exchangeAddress": "0x12459c951127e0c374ff9105dda097662a027093",
+ "expirationTimeSeconds": "42",
"ecSignature": {
"v": 27,
"r": "0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33",
diff --git a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts
index 5a03a2ff6..68446c83a 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts
+++ b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts
@@ -5,14 +5,14 @@ export const orderResponse = {
taker: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
makerFee: new BigNumber('100000000000000'),
takerFee: new BigNumber('200000000000000'),
- makerTokenAmount: new BigNumber('10000000000000000'),
- takerTokenAmount: new BigNumber('20000000000000000'),
+ makerAssetAmount: new BigNumber('10000000000000000'),
+ takerAssetAmount: new BigNumber('20000000000000000'),
makerTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
takerTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
salt: new BigNumber('256'),
feeRecipient: '0xb046140686d052fff581f63f8136cce132e857da',
- exchangeContractAddress: '0x12459c951127e0c374ff9105dda097662a027093',
- expirationUnixTimestampSec: new BigNumber('42'),
+ exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093',
+ expirationTimeSeconds: new BigNumber('42'),
ecSignature: {
v: 27,
r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
diff --git a/packages/connect/test/fixtures/standard_relayer_api/orderbook.json b/packages/connect/test/fixtures/standard_relayer_api/orderbook.json
index 825be34c2..2dec4b0fe 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/orderbook.json
+++ b/packages/connect/test/fixtures/standard_relayer_api/orderbook.json
@@ -5,14 +5,14 @@
"taker": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
"makerFee": "100000000000000",
"takerFee": "200000000000000",
- "makerTokenAmount": "10000000000000000",
- "takerTokenAmount": "20000000000000000",
+ "makerAssetAmount": "10000000000000000",
+ "takerAssetAmount": "20000000000000000",
"makerTokenAddress": "0x323b5d4c32345ced77393b3530b1eed0f346429d",
"takerTokenAddress": "0xef7fff64389b814a946f3e92105513705ca6b990",
"salt": "256",
"feeRecipient": "0xb046140686d052fff581f63f8136cce132e857da",
- "exchangeContractAddress": "0x12459c951127e0c374ff9105dda097662a027093",
- "expirationUnixTimestampSec": "42",
+ "exchangeAddress": "0x12459c951127e0c374ff9105dda097662a027093",
+ "expirationTimeSeconds": "42",
"ecSignature": {
"v": 27,
"r": "0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33",
@@ -26,14 +26,14 @@
"taker": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
"makerFee": "100000000000000",
"takerFee": "200000000000000",
- "makerTokenAmount": "10000000000000000",
- "takerTokenAmount": "20000000000000000",
+ "makerAssetAmount": "10000000000000000",
+ "takerAssetAmount": "20000000000000000",
"makerTokenAddress": "0x323b5d4c32345ced77393b3530b1eed0f346429d",
"takerTokenAddress": "0xef7fff64389b814a946f3e92105513705ca6b990",
"salt": "256",
"feeRecipient": "0xb046140686d052fff581f63f8136cce132e857da",
- "exchangeContractAddress": "0x12459c951127e0c374ff9105dda097662a027093",
- "expirationUnixTimestampSec": "42",
+ "exchangeAddress": "0x12459c951127e0c374ff9105dda097662a027093",
+ "expirationTimeSeconds": "42",
"ecSignature": {
"v": 27,
"r": "0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33",
diff --git a/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts b/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts
index 6684ac2e5..9f80988ce 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts
+++ b/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts
@@ -7,14 +7,14 @@ export const orderbookResponse = {
taker: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
makerFee: new BigNumber('100000000000000'),
takerFee: new BigNumber('200000000000000'),
- makerTokenAmount: new BigNumber('10000000000000000'),
- takerTokenAmount: new BigNumber('20000000000000000'),
+ makerAssetAmount: new BigNumber('10000000000000000'),
+ takerAssetAmount: new BigNumber('20000000000000000'),
makerTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
takerTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
salt: new BigNumber('256'),
feeRecipient: '0xb046140686d052fff581f63f8136cce132e857da',
- exchangeContractAddress: '0x12459c951127e0c374ff9105dda097662a027093',
- expirationUnixTimestampSec: new BigNumber('42'),
+ exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093',
+ expirationTimeSeconds: new BigNumber('42'),
ecSignature: {
v: 27,
r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
@@ -28,14 +28,14 @@ export const orderbookResponse = {
taker: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
makerFee: new BigNumber('100000000000000'),
takerFee: new BigNumber('200000000000000'),
- makerTokenAmount: new BigNumber('10000000000000000'),
- takerTokenAmount: new BigNumber('20000000000000000'),
+ makerAssetAmount: new BigNumber('10000000000000000'),
+ takerAssetAmount: new BigNumber('20000000000000000'),
makerTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
takerTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
salt: new BigNumber('256'),
feeRecipient: '0xb046140686d052fff581f63f8136cce132e857da',
- exchangeContractAddress: '0x12459c951127e0c374ff9105dda097662a027093',
- expirationUnixTimestampSec: new BigNumber('42'),
+ exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093',
+ expirationTimeSeconds: new BigNumber('42'),
ecSignature: {
v: 27,
r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
diff --git a/packages/connect/test/fixtures/standard_relayer_api/orders.json b/packages/connect/test/fixtures/standard_relayer_api/orders.json
index cfa780dc4..929dde4a8 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/orders.json
+++ b/packages/connect/test/fixtures/standard_relayer_api/orders.json
@@ -4,14 +4,14 @@
"taker": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
"makerFee": "100000000000000",
"takerFee": "200000000000000",
- "makerTokenAmount": "10000000000000000",
- "takerTokenAmount": "20000000000000000",
+ "makerAssetAmount": "10000000000000000",
+ "takerAssetAmount": "20000000000000000",
"makerTokenAddress": "0x323b5d4c32345ced77393b3530b1eed0f346429d",
"takerTokenAddress": "0xef7fff64389b814a946f3e92105513705ca6b990",
"salt": "256",
"feeRecipient": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
- "exchangeContractAddress": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
- "expirationUnixTimestampSec": "42",
+ "exchangeAddress": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
+ "expirationTimeSeconds": "42",
"ecSignature": {
"v": 27,
"r": "0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33",
diff --git a/packages/connect/test/fixtures/standard_relayer_api/orders.ts b/packages/connect/test/fixtures/standard_relayer_api/orders.ts
index 5044777bd..6d32fd3f3 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/orders.ts
+++ b/packages/connect/test/fixtures/standard_relayer_api/orders.ts
@@ -6,14 +6,14 @@ export const ordersResponse = [
taker: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
makerFee: new BigNumber('100000000000000'),
takerFee: new BigNumber('200000000000000'),
- makerTokenAmount: new BigNumber('10000000000000000'),
- takerTokenAmount: new BigNumber('20000000000000000'),
+ makerAssetAmount: new BigNumber('10000000000000000'),
+ takerAssetAmount: new BigNumber('20000000000000000'),
makerTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
takerTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
salt: new BigNumber('256'),
feeRecipient: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
- exchangeContractAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
- expirationUnixTimestampSec: new BigNumber('42'),
+ exchangeAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
+ expirationTimeSeconds: new BigNumber('42'),
ecSignature: {
v: 27,
r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
diff --git a/packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts b/packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts
deleted file mode 100644
index 1d7e67055..000000000
--- a/packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import * as orderbookJSON from './orderbook.json';
-
-const orderbookJsonString = JSON.stringify(orderbookJSON);
-
-export const snapshotOrderbookChannelMessage = `{
- "type": "snapshot",
- "channel": "orderbook",
- "requestId": 1,
- "payload": ${orderbookJsonString}
-}`;
-
-export const malformedSnapshotOrderbookChannelMessage = `{
- "type": "snapshot",
- "channel": "orderbook",
- "requestId": 1,
- "payload": {}
-}`;
diff --git a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.json b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.json
index 90f57a974..2d9610e3d 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.json
+++ b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.json
@@ -1,12 +1,12 @@
[
{
- "tokenA": {
+ "assetDataA": {
"address": "0x323b5d4c32345ced77393b3530b1eed0f346429d",
"minAmount": "0",
"maxAmount": "10000000000000000000",
"precision": 5
},
- "tokenB": {
+ "assetDataB": {
"address": "0xef7fff64389b814a946f3e92105513705ca6b990",
"minAmount": "0",
"maxAmount": "50000000000000000000",
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 f48b1e877..1225ac4fc 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts
+++ b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts
@@ -2,15 +2,15 @@ import { BigNumber } from '@0xproject/utils';
import { TokenPairsItem } from '../../../src/types';
-export const tokenPairsResponse: TokenPairsItem[] = [
+export const assetDataPairsResponse: TokenPairsItem[] = [
{
- tokenA: {
+ assetDataA: {
address: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
minAmount: new BigNumber(0),
maxAmount: new BigNumber('10000000000000000000'),
precision: 5,
},
- tokenB: {
+ assetDataB: {
address: '0xef7fff64389b814a946f3e92105513705ca6b990',
minAmount: new BigNumber(0),
maxAmount: new BigNumber('50000000000000000000'),
diff --git a/packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts b/packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts
index cbedff60e..c0e924a4b 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts
+++ b/packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts
@@ -2,7 +2,7 @@ import * as orderResponseJSON from './order/0xabc67323774bdbd24d94f977fa9ac94a50
const orderJSONString = JSON.stringify(orderResponseJSON);
-export const unknownOrderbookChannelMessage = `{
+export const unknownOrdersChannelMessage = `{
"type": "superGoodUpdate",
"channel": "orderbook",
"requestId": 1,
diff --git a/packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts b/packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts
index 0e2c7523b..daab20368 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts
+++ b/packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts
@@ -2,14 +2,14 @@ import * as orderResponseJSON from './order/0xabc67323774bdbd24d94f977fa9ac94a50
const orderJSONString = JSON.stringify(orderResponseJSON);
-export const updateOrderbookChannelMessage = `{
+export const updateOrdersChannelMessage = `{
"type": "update",
"channel": "orderbook",
"requestId": 1,
"payload": ${orderJSONString}
}`;
-export const malformedUpdateOrderbookChannelMessage = `{
+export const malformedUpdateOrdersChannelMessage = `{
"type": "update",
"channel": "orderbook",
"requestId": 1,
diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts
index 38327b090..ea5717327 100644
--- a/packages/connect/test/http_client_test.ts
+++ b/packages/connect/test/http_client_test.ts
@@ -15,8 +15,8 @@ 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 { assetDataPairsResponse } from './fixtures/standard_relayer_api/assetData_pairs';
+import * as assetDataPairsResponseJSON from './fixtures/standard_relayer_api/assetData_pairs.json';
chai.config.includeStack = true;
chai.use(dirtyChai);
@@ -39,24 +39,24 @@ describe('HttpClient', () => {
});
});
describe('#getAssetPairsAsync', () => {
- const url = `${relayUrl}/token_pairs`;
- it('gets token pairs with default options when none are provided', async () => {
+ const url = `${relayUrl}/assetData_pairs`;
+ it('gets assetData pairs with default options when none are provided', async () => {
const urlWithQuery = `${url}?page=1&per_page=100`;
- fetchMock.get(urlWithQuery, tokenPairsResponseJSON);
- const tokenPairs = await relayerClient.getAssetPairsAsync();
- expect(tokenPairs).to.be.deep.equal(tokenPairsResponse);
+ fetchMock.get(urlWithQuery, assetDataPairsResponseJSON);
+ const assetDataPairs = await relayerClient.getAssetPairsAsync();
+ expect(assetDataPairs).to.be.deep.equal(assetDataPairsResponse);
});
- it('gets token pairs with specified request options', async () => {
- const tokenAddress = '0x323b5d4c32345ced77393b3530b1eed0f346429d';
+ it('gets assetData pairs with specified request options', async () => {
+ const assetDataAddress = '0x323b5d4c32345ced77393b3530b1eed0f346429d';
const AssetPairsRequestOpts = {
- tokenA: tokenAddress,
+ assetDataA: assetDataAddress,
page: 3,
perPage: 50,
};
- const urlWithQuery = `${url}?page=3&per_page=50&tokenA=${tokenAddress}`;
- fetchMock.get(urlWithQuery, tokenPairsResponseJSON);
- const tokenPairs = await relayerClient.getAssetPairsAsync(AssetPairsRequestOpts);
- expect(tokenPairs).to.be.deep.equal(tokenPairsResponse);
+ const urlWithQuery = `${url}?page=3&per_page=50&assetDataA=${assetDataAddress}`;
+ fetchMock.get(urlWithQuery, assetDataPairsResponseJSON);
+ const assetDataPairs = await relayerClient.getAssetPairsAsync(AssetPairsRequestOpts);
+ expect(assetDataPairs).to.be.deep.equal(assetDataPairsResponse);
});
it('throws an error for invalid JSON response', async () => {
fetchMock.get(url, { test: 'dummy' });
@@ -72,13 +72,13 @@ describe('HttpClient', () => {
expect(orders).to.be.deep.equal(ordersResponse);
});
it('gets orders with specified request options', async () => {
- const tokenAddress = '0x323b5d4c32345ced77393b3530b1eed0f346429d';
+ const assetDataAddress = '0x323b5d4c32345ced77393b3530b1eed0f346429d';
const ordersRequest = {
- tokenAddress,
+ assetDataAddress,
page: 3,
perPage: 50,
};
- const urlWithQuery = `${url}?page=3&per_page=50&tokenAddress=${tokenAddress}`;
+ const urlWithQuery = `${url}?page=3&per_page=50&assetDataAddress=${assetDataAddress}`;
fetchMock.get(urlWithQuery, ordersResponseJSON);
const orders = await relayerClient.getOrdersAsync(ordersRequest);
expect(orders).to.be.deep.equal(ordersResponse);
@@ -103,22 +103,22 @@ describe('HttpClient', () => {
});
describe('#getOrderBookAsync', () => {
const request = {
- baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
- quoteTokenAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ baseAssetData: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
+ quoteAssetData: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
};
const url = `${relayUrl}/orderbook`;
it('gets orderbook with default page options when none are provided', async () => {
- const urlWithQuery = `${url}?baseTokenAddress=${
- request.baseTokenAddress
- }&page=1&per_page=100&quoteTokenAddress=${request.quoteTokenAddress}`;
+ const urlWithQuery = `${url}?baseAssetData=${
+ request.baseAssetData
+ }&page=1&per_page=100&quoteAssetData=${request.quoteAssetData}`;
fetchMock.get(urlWithQuery, orderbookJSON);
const orderbook = await relayerClient.getOrderbookAsync(request);
expect(orderbook).to.be.deep.equal(orderbookResponse);
});
it('gets orderbook with specified page options', async () => {
- const urlWithQuery = `${url}?baseTokenAddress=${
- request.baseTokenAddress
- }&page=3&per_page=50&quoteTokenAddress=${request.quoteTokenAddress}`;
+ const urlWithQuery = `${url}?baseAssetData=${
+ request.baseAssetData
+ }&page=3&per_page=50&quoteAssetData=${request.quoteAssetData}`;
fetchMock.get(urlWithQuery, orderbookJSON);
const pagedRequestOptions = {
page: 3,
@@ -134,15 +134,15 @@ describe('HttpClient', () => {
});
describe('#getOrderConfigAsync', () => {
const request = {
- exchangeContractAddress: '0x12459c951127e0c374ff9105dda097662a027093',
+ exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093',
maker: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
taker: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
makerTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
takerTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
- makerTokenAmount: new BigNumber('10000000000000000000'),
- takerTokenAmount: new BigNumber('30000000000000000000'),
+ makerAssetAmount: new BigNumber('10000000000000000000'),
+ takerAssetAmount: new BigNumber('30000000000000000000'),
salt: new BigNumber('256'),
- expirationUnixTimestampSec: new BigNumber('42'),
+ expirationTimeSeconds: new BigNumber('42'),
};
const url = `${relayUrl}/fees`;
it('gets fees', async () => {
@@ -152,15 +152,15 @@ describe('HttpClient', () => {
});
it('does not mutate input', async () => {
fetchMock.post(url, feesResponseJSON);
- const makerTokenAmountBefore = new BigNumber(request.makerTokenAmount);
- const takerTokenAmountBefore = new BigNumber(request.takerTokenAmount);
+ const makerAssetAmountBefore = new BigNumber(request.makerAssetAmount);
+ const takerAssetAmountBefore = new BigNumber(request.takerAssetAmount);
const saltBefore = new BigNumber(request.salt);
- const expirationUnixTimestampSecBefore = new BigNumber(request.expirationUnixTimestampSec);
+ const expirationTimeSecondsBefore = new BigNumber(request.expirationTimeSeconds);
await relayerClient.getOrderConfigAsync(request);
- expect(makerTokenAmountBefore).to.be.deep.equal(request.makerTokenAmount);
- expect(takerTokenAmountBefore).to.be.deep.equal(request.takerTokenAmount);
+ expect(makerAssetAmountBefore).to.be.deep.equal(request.makerAssetAmount);
+ expect(takerAssetAmountBefore).to.be.deep.equal(request.takerAssetAmount);
expect(saltBefore).to.be.deep.equal(request.salt);
- expect(expirationUnixTimestampSecBefore).to.be.deep.equal(request.expirationUnixTimestampSec);
+ expect(expirationTimeSecondsBefore).to.be.deep.equal(request.expirationTimeSeconds);
});
it('throws an error for invalid JSON response', async () => {
fetchMock.post(url, { test: 'dummy' });
diff --git a/packages/connect/test/orderbook_channel_message_parsers_test.ts b/packages/connect/test/orderbook_channel_message_parsers_test.ts
index 3e1f44384..ce881e627 100644
--- a/packages/connect/test/orderbook_channel_message_parsers_test.ts
+++ b/packages/connect/test/orderbook_channel_message_parsers_test.ts
@@ -7,13 +7,13 @@ import { orderbookChannelMessageParser } from '../src/utils/orderbook_channel_me
import { orderResponse } from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f';
import { orderbookResponse } from './fixtures/standard_relayer_api/orderbook';
import {
- malformedSnapshotOrderbookChannelMessage,
- snapshotOrderbookChannelMessage,
+ malformedSnapshotOrdersChannelMessage,
+ snapshotOrdersChannelMessage,
} from './fixtures/standard_relayer_api/snapshot_orderbook_channel_message';
-import { unknownOrderbookChannelMessage } from './fixtures/standard_relayer_api/unknown_orderbook_channel_message';
+import { unknownOrdersChannelMessage } from './fixtures/standard_relayer_api/unknown_orderbook_channel_message';
import {
- malformedUpdateOrderbookChannelMessage,
- updateOrderbookChannelMessage,
+ malformedUpdateOrdersChannelMessage,
+ updateOrdersChannelMessage,
} from './fixtures/standard_relayer_api/update_orderbook_channel_message';
chai.config.includeStack = true;
@@ -23,17 +23,17 @@ const expect = chai.expect;
describe('orderbookChannelMessageParser', () => {
describe('#parser', () => {
it('parses snapshot messages', () => {
- const snapshotMessage = orderbookChannelMessageParser.parse(snapshotOrderbookChannelMessage);
+ const snapshotMessage = orderbookChannelMessageParser.parse(snapshotOrdersChannelMessage);
expect(snapshotMessage.type).to.be.equal('snapshot');
expect(snapshotMessage.payload).to.be.deep.equal(orderbookResponse);
});
it('parses update messages', () => {
- const updateMessage = orderbookChannelMessageParser.parse(updateOrderbookChannelMessage);
+ const updateMessage = orderbookChannelMessageParser.parse(updateOrdersChannelMessage);
expect(updateMessage.type).to.be.equal('update');
expect(updateMessage.payload).to.be.deep.equal(orderResponse);
});
it('returns unknown message for messages with unsupported types', () => {
- const unknownMessage = orderbookChannelMessageParser.parse(unknownOrderbookChannelMessage);
+ const unknownMessage = orderbookChannelMessageParser.parse(unknownOrdersChannelMessage);
expect(unknownMessage.type).to.be.equal('unknown');
expect(unknownMessage.payload).to.be.undefined();
});
@@ -57,20 +57,20 @@ describe('orderbookChannelMessageParser', () => {
expect(badCall).throws('Expected type to be of type string, encountered: 1');
});
it('throws when snapshot message has malformed payload', () => {
- const badCall = () => orderbookChannelMessageParser.parse(malformedSnapshotOrderbookChannelMessage);
+ const badCall = () => orderbookChannelMessageParser.parse(malformedSnapshotOrdersChannelMessage);
// tslint:disable-next-line:max-line-length
const errMsg =
'Validation errors: instance.payload requires property "bids", instance.payload requires property "asks"';
expect(badCall).throws(errMsg);
});
it('throws when update message has malformed payload', () => {
- const badCall = () => orderbookChannelMessageParser.parse(malformedUpdateOrderbookChannelMessage);
+ const badCall = () => orderbookChannelMessageParser.parse(malformedUpdateOrdersChannelMessage);
expect(badCall).throws(/^Expected message to conform to schema/);
});
it('throws when input message is not valid JSON', () => {
const nonJsonString = 'h93b{sdfs9fsd f';
const badCall = () => orderbookChannelMessageParser.parse(nonJsonString);
- expect(badCall).throws('Unexpected token h in JSON at position 0');
+ expect(badCall).throws('Unexpected assetData h in JSON at position 0');
});
});
});
diff --git a/packages/connect/test/ws_orderbook_channel_test.ts b/packages/connect/test/ws_orderbook_channel_test.ts
index 5a63cbdcc..b5682af36 100644
--- a/packages/connect/test/ws_orderbook_channel_test.ts
+++ b/packages/connect/test/ws_orderbook_channel_test.ts
@@ -32,8 +32,8 @@ describe('WebSocketOrderbookChannel', () => {
Sinon.stub(openClient, 'send').callsFake(_.noop.bind(_));
const openOrderbookChannel = new WebSocketOrderbookChannel(openClient, emptyOrderbookChannelHandler);
const subscriptionOpts = {
- baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
- quoteTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
+ baseAssetData: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
+ quoteAssetData: '0xef7fff64389b814a946f3e92105513705ca6b990',
snapshot: true,
limit: 100,
};
@@ -41,7 +41,7 @@ describe('WebSocketOrderbookChannel', () => {
it('throws when subscriptionOpts does not conform to schema', () => {
const badSubscribeCall = openOrderbookChannel.subscribe.bind(openOrderbookChannel, {});
expect(badSubscribeCall).throws(
- 'Expected subscriptionOpts to conform to schema /RelayerApiOrderbookChannelSubscribePayload\nEncountered: {}\nValidation errors: instance requires property "baseTokenAddress", instance requires property "quoteTokenAddress"',
+ 'Expected subscriptionOpts to conform to schema /RelayerApiOrderbookChannelSubscribePayload\nEncountered: {}\nValidation errors: instance requires property "baseAssetData", instance requires property "quoteAssetData"',
);
});
it('does not throw when inputs are of correct types', () => {