aboutsummaryrefslogtreecommitdiffstats
path: root/packages/json-schemas
diff options
context:
space:
mode:
Diffstat (limited to 'packages/json-schemas')
-rw-r--r--packages/json-schemas/schemas/relayer_api_orberbook_channel_subscribe_schema.ts3
-rw-r--r--packages/json-schemas/schemas/relayer_api_orderbook_channel_snapshot_schema.ts4
-rw-r--r--packages/json-schemas/schemas/relayer_api_orderbook_channel_update_response_schema.ts4
-rw-r--r--packages/json-schemas/test/schema_test.ts43
4 files changed, 39 insertions, 15 deletions
diff --git a/packages/json-schemas/schemas/relayer_api_orberbook_channel_subscribe_schema.ts b/packages/json-schemas/schemas/relayer_api_orberbook_channel_subscribe_schema.ts
index 8ded9adb0..2f71531c6 100644
--- a/packages/json-schemas/schemas/relayer_api_orberbook_channel_subscribe_schema.ts
+++ b/packages/json-schemas/schemas/relayer_api_orberbook_channel_subscribe_schema.ts
@@ -4,9 +4,10 @@ export const relayerApiOrderbookChannelSubscribeSchema = {
properties: {
type: {enum: ['subscribe']},
channel: {enum: ['orderbook']},
+ requestId: {type: 'number'},
payload: {$ref: '/RelayerApiOrderbookChannelSubscribePayload'},
},
- required: ['type', 'channel', 'payload'],
+ required: ['type', 'channel', 'requestId', 'payload'],
};
export const relayerApiOrderbookChannelSubscribePayload = {
diff --git a/packages/json-schemas/schemas/relayer_api_orderbook_channel_snapshot_schema.ts b/packages/json-schemas/schemas/relayer_api_orderbook_channel_snapshot_schema.ts
index cfc0ddc8f..99037865e 100644
--- a/packages/json-schemas/schemas/relayer_api_orderbook_channel_snapshot_schema.ts
+++ b/packages/json-schemas/schemas/relayer_api_orderbook_channel_snapshot_schema.ts
@@ -4,10 +4,10 @@ export const relayerApiOrderbookChannelSnapshotSchema = {
properties: {
type: {enum: ['snapshot']},
channel: {enum: ['orderbook']},
- channelId: {type: 'number'},
+ requestId: {type: 'number'},
payload: {$ref: '/RelayerApiOrderbookChannelSnapshotPayload'},
},
- required: ['type', 'channel', 'channelId', 'payload'],
+ required: ['type', 'channel', 'requestId', 'payload'],
};
export const relayerApiOrderbookChannelSnapshotPayload = {
diff --git a/packages/json-schemas/schemas/relayer_api_orderbook_channel_update_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orderbook_channel_update_response_schema.ts
index 51308ed49..90cfd8749 100644
--- a/packages/json-schemas/schemas/relayer_api_orderbook_channel_update_response_schema.ts
+++ b/packages/json-schemas/schemas/relayer_api_orderbook_channel_update_response_schema.ts
@@ -4,8 +4,8 @@ export const relayerApiOrderbookChannelUpdateSchema = {
properties: {
type: {enum: ['update']},
channel: {enum: ['orderbook']},
- channelId: {type: 'number'},
+ requestId: {type: 'number'},
payload: {$ref: '/SignedOrder'},
},
- required: ['type', 'channel', 'channelId', 'payload'],
+ required: ['type', 'channel', 'requestId', 'payload'],
};
diff --git a/packages/json-schemas/test/schema_test.ts b/packages/json-schemas/test/schema_test.ts
index 653f70852..758ccac61 100644
--- a/packages/json-schemas/test/schema_test.ts
+++ b/packages/json-schemas/test/schema_test.ts
@@ -432,6 +432,7 @@ describe('Schema', () => {
{
type: 'subscribe',
channel: 'orderbook',
+ requestId: 1,
payload: {
baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
quoteTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
@@ -442,6 +443,7 @@ describe('Schema', () => {
{
type: 'subscribe',
channel: 'orderbook',
+ requestId: 1,
payload: {
baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
quoteTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
@@ -454,8 +456,19 @@ describe('Schema', () => {
const checksummedAddress = '0xA2b31daCf30a9C50ca473337c01d8A201ae33e32';
const testCases = [
{
+ type: 'subscribe',
+ channel: 'orderbook',
+ payload: {
+ baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
+ quoteTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
+ snapshot: true,
+ limit: 100,
+ },
+ },
+ {
type: 'foo',
channel: 'orderbook',
+ requestId: 1,
payload: {
baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
quoteTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
@@ -464,6 +477,7 @@ describe('Schema', () => {
{
type: 'subscribe',
channel: 'bar',
+ requestId: 1,
payload: {
baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
quoteTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
@@ -472,6 +486,7 @@ describe('Schema', () => {
{
type: 'subscribe',
channel: 'orderbook',
+ requestId: 1,
payload: {
baseTokenAddress: checksummedAddress,
quoteTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
@@ -480,6 +495,7 @@ describe('Schema', () => {
{
type: 'subscribe',
channel: 'orderbook',
+ requestId: 1,
payload: {
baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
quoteTokenAddress: checksummedAddress,
@@ -488,6 +504,7 @@ describe('Schema', () => {
{
type: 'subscribe',
channel: 'orderbook',
+ requestId: 1,
payload: {
quoteTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
},
@@ -495,6 +512,7 @@ describe('Schema', () => {
{
type: 'subscribe',
channel: 'orderbook',
+ requestId: 1,
payload: {
baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
},
@@ -502,6 +520,7 @@ describe('Schema', () => {
{
type: 'subscribe',
channel: 'orderbook',
+ requestId: 1,
payload: {
baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
quoteTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
@@ -512,6 +531,7 @@ describe('Schema', () => {
{
type: 'subscribe',
channel: 'orderbook',
+ requestId: 1,
payload: {
baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
quoteTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
@@ -530,7 +550,7 @@ describe('Schema', () => {
{
type: 'snapshot',
channel: 'orderbook',
- channelId: 2,
+ requestId: 2,
payload: {
bids: [],
asks: [],
@@ -539,7 +559,7 @@ describe('Schema', () => {
{
type: 'snapshot',
channel: 'orderbook',
- channelId: 2,
+ requestId: 2,
payload: {
bids: [
signedOrder,
@@ -557,7 +577,7 @@ describe('Schema', () => {
{
type: 'foo',
channel: 'orderbook',
- channelId: 2,
+ requestId: 2,
payload: {
bids: [
signedOrder,
@@ -570,7 +590,7 @@ describe('Schema', () => {
{
type: 'snapshot',
channel: 'bar',
- channelId: 2,
+ requestId: 2,
payload: {
bids: [
signedOrder,
@@ -595,7 +615,7 @@ describe('Schema', () => {
{
type: 'snapshot',
channel: 'orderbook',
- channelId: '2',
+ requestId: '2',
payload: {
bids: [
signedOrder,
@@ -608,7 +628,7 @@ describe('Schema', () => {
{
type: 'snapshot',
channel: 'orderbook',
- channelId: 2,
+ requestId: 2,
payload: {
bids: [
signedOrder,
@@ -618,7 +638,7 @@ describe('Schema', () => {
{
type: 'snapshot',
channel: 'orderbook',
- channelId: 2,
+ requestId: 2,
payload: {
asks: [
signedOrder,
@@ -628,7 +648,7 @@ describe('Schema', () => {
{
type: 'snapshot',
channel: 'orderbook',
- channelId: 2,
+ requestId: 2,
payload: {
bids: [
signedOrder,
@@ -641,7 +661,7 @@ describe('Schema', () => {
{
type: 'snapshot',
channel: 'orderbook',
- channelId: 2,
+ requestId: 2,
payload: {
bids: [
{},
@@ -662,7 +682,7 @@ describe('Schema', () => {
{
type: 'update',
channel: 'orderbook',
- channelId: 2,
+ requestId: 2,
payload: signedOrder,
},
];
@@ -673,16 +693,19 @@ describe('Schema', () => {
{
type: 'foo',
channel: 'orderbook',
+ requestId: 2,
payload: signedOrder,
},
{
type: 'update',
channel: 'bar',
+ requestId: 2,
payload: signedOrder,
},
{
type: 'update',
channel: 'orderbook',
+ requestId: 2,
payload: {},
},
];