aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/src/utils
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2017-12-05 15:58:33 +0800
committerBrandon Millman <brandon.millman@gmail.com>2017-12-06 03:28:32 +0800
commit20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414 (patch)
tree7d9e64905865dfb81b91b287f0c93a34dbc028ef /packages/connect/src/utils
parentc0015c2c118c0fd563fa8d2ee672c28dca7ef809 (diff)
downloaddexon-sol-tools-20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414.tar
dexon-sol-tools-20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414.tar.gz
dexon-sol-tools-20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414.tar.bz2
dexon-sol-tools-20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414.tar.lz
dexon-sol-tools-20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414.tar.xz
dexon-sol-tools-20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414.tar.zst
dexon-sol-tools-20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414.zip
Add requestId to subscription messages and update json-schemas
Diffstat (limited to 'packages/connect/src/utils')
-rw-r--r--packages/connect/src/utils/orderbook_channel_message_parsers.ts12
1 files changed, 4 insertions, 8 deletions
diff --git a/packages/connect/src/utils/orderbook_channel_message_parsers.ts b/packages/connect/src/utils/orderbook_channel_message_parsers.ts
index 9cd160428..486a416ef 100644
--- a/packages/connect/src/utils/orderbook_channel_message_parsers.ts
+++ b/packages/connect/src/utils/orderbook_channel_message_parsers.ts
@@ -15,28 +15,24 @@ export const orderbookChannelMessageParsers = {
const messageObj = JSON.parse(utf8Data);
const type: string = _.get(messageObj, 'type');
assert.assert(!_.isUndefined(type), `Message is missing a type parameter: ${utf8Data}`);
+ assert.isString('type', type);
switch (type) {
case (OrderbookChannelMessageTypes.Snapshot): {
assert.doesConformToSchema('message', messageObj, schemas.relayerApiOrderbookChannelSnapshotSchema);
const orderbook = messageObj.payload;
typeConverters.convertOrderbookStringFieldsToBigNumber(orderbook);
- return {
- type,
- payload: orderbook,
- };
+ return messageObj;
}
case (OrderbookChannelMessageTypes.Update): {
assert.doesConformToSchema('message', messageObj, schemas.relayerApiOrderbookChannelUpdateSchema);
const order = messageObj.payload;
typeConverters.convertOrderStringFieldsToBigNumber(order);
- return {
- type,
- payload: order,
- };
+ return messageObj;
}
default: {
return {
type: OrderbookChannelMessageTypes.Unknown,
+ requestId: 0,
payload: undefined,
};
}