aboutsummaryrefslogtreecommitdiffstats
path: root/packages/json-schemas
diff options
context:
space:
mode:
Diffstat (limited to 'packages/json-schemas')
-rw-r--r--packages/json-schemas/CHANGELOG.json8
-rw-r--r--packages/json-schemas/schemas/paginated_collection_schema.ts10
-rw-r--r--packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts38
-rw-r--r--packages/json-schemas/schemas/relayer_api_fees_payload_schema.ts24
-rw-r--r--packages/json-schemas/schemas/relayer_api_fees_response_schema.ts10
-rw-r--r--packages/json-schemas/schemas/relayer_api_orberbook_channel_subscribe_schema.ts23
-rw-r--r--packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts24
-rw-r--r--packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts11
-rw-r--r--packages/json-schemas/schemas/relayer_api_order_schema.ts9
-rw-r--r--packages/json-schemas/schemas/relayer_api_orderbook_channel_snapshot_schema.ts21
-rw-r--r--packages/json-schemas/schemas/relayer_api_orderbook_channel_update_response_schema.ts11
-rw-r--r--packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts4
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts26
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts11
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_response_schema.ts13
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_schema.ts5
-rw-r--r--packages/json-schemas/schemas/relayer_api_token_pairs_response_schema.ts24
17 files changed, 157 insertions, 115 deletions
diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json
index 31da6a7f7..d4557d872 100644
--- a/packages/json-schemas/CHANGELOG.json
+++ b/packages/json-schemas/CHANGELOG.json
@@ -1,5 +1,13 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade Relayer API schemas for relayer API V1"
+ }
+ ]
+ },
+ {
"version": "1.0.1-rc.3",
"changes": [
{
diff --git a/packages/json-schemas/schemas/paginated_collection_schema.ts b/packages/json-schemas/schemas/paginated_collection_schema.ts
new file mode 100644
index 000000000..5dd82ab3d
--- /dev/null
+++ b/packages/json-schemas/schemas/paginated_collection_schema.ts
@@ -0,0 +1,10 @@
+export const paginatedCollectionSchema = {
+ id: '/PaginatedCollection',
+ type: 'object',
+ properties: {
+ total: { $ref: '/Number' },
+ per_page: { $ref: '/Number' },
+ page: { $ref: '/Number' },
+ },
+ required: ['total', 'per_page', 'page'],
+};
diff --git a/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts b/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts
new file mode 100644
index 000000000..74b919a8f
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts
@@ -0,0 +1,38 @@
+export const relayerApiAssetDataPairsResponseSchema = {
+ id: '/RelayerApiAssetDataPairsResponse',
+ type: 'object',
+ allOf: [
+ { $ref: '/PaginatedCollection' },
+ {
+ properties: {
+ records: { $ref: '/RelayerApiAssetDataPairs' },
+ },
+ required: ['records'],
+ },
+ ],
+};
+
+export const relayerApiAssetDataPairsSchema = {
+ id: '/RelayerApiAssetDataPairs',
+ type: 'array',
+ items: {
+ properties: {
+ assetDataA: { $ref: '/RelayerApiAssetDataTradeInfo' },
+ assetDataB: { $ref: '/RelayerApiAssetDataTradeInfo' },
+ },
+ required: ['assetDataA', 'assetDataB'],
+ type: 'object',
+ },
+};
+
+export const relayerApiAssetDataTradeInfoSchema = {
+ id: '/RelayerApiAssetDataTradeInfo',
+ type: 'object',
+ properties: {
+ assetData: { $ref: '/Hex' },
+ minAmount: { $ref: '/Number' },
+ maxAmount: { $ref: '/Number' },
+ precision: { type: 'number' },
+ },
+ required: ['assetData'],
+};
diff --git a/packages/json-schemas/schemas/relayer_api_fees_payload_schema.ts b/packages/json-schemas/schemas/relayer_api_fees_payload_schema.ts
deleted file mode 100644
index eaaf777a1..000000000
--- a/packages/json-schemas/schemas/relayer_api_fees_payload_schema.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-export const relayerApiFeesPayloadSchema = {
- id: '/RelayerApiFeesPayload',
- type: 'object',
- properties: {
- exchangeContractAddress: { $ref: '/Address' },
- maker: { $ref: '/Address' },
- taker: { $ref: '/Address' },
- makerTokenAddress: { $ref: '/Address' },
- takerTokenAddress: { $ref: '/Address' },
- makerTokenAmount: { $ref: '/Number' },
- takerTokenAmount: { $ref: '/Number' },
- expirationUnixTimestampSec: { $ref: '/Number' },
- salt: { $ref: '/Number' },
- },
- required: [
- 'exchangeContractAddress',
- 'maker',
- 'taker',
- 'makerTokenAddress',
- 'takerTokenAddress',
- 'expirationUnixTimestampSec',
- 'salt',
- ],
-};
diff --git a/packages/json-schemas/schemas/relayer_api_fees_response_schema.ts b/packages/json-schemas/schemas/relayer_api_fees_response_schema.ts
deleted file mode 100644
index e7440613f..000000000
--- a/packages/json-schemas/schemas/relayer_api_fees_response_schema.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export const relayerApiFeesResponseSchema = {
- id: '/RelayerApiFeesResponse',
- type: 'object',
- properties: {
- makerFee: { $ref: '/Number' },
- takerFee: { $ref: '/Number' },
- feeRecipient: { $ref: '/Address' },
- },
- required: ['makerFee', 'takerFee', 'feeRecipient'],
-};
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
deleted file mode 100644
index d93fa73d6..000000000
--- a/packages/json-schemas/schemas/relayer_api_orberbook_channel_subscribe_schema.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-export const relayerApiOrderbookChannelSubscribeSchema = {
- id: '/RelayerApiOrderbookChannelSubscribe',
- type: 'object',
- properties: {
- type: { enum: ['subscribe'] },
- channel: { enum: ['orderbook'] },
- requestId: { type: 'number' },
- payload: { $ref: '/RelayerApiOrderbookChannelSubscribePayload' },
- },
- required: ['type', 'channel', 'requestId', 'payload'],
-};
-
-export const relayerApiOrderbookChannelSubscribePayload = {
- id: '/RelayerApiOrderbookChannelSubscribePayload',
- type: 'object',
- properties: {
- baseTokenAddress: { $ref: '/Address' },
- quoteTokenAddress: { $ref: '/Address' },
- snapshot: { type: 'boolean' },
- limit: { type: 'number' },
- },
- required: ['baseTokenAddress', 'quoteTokenAddress'],
-};
diff --git a/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts b/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts
new file mode 100644
index 000000000..7b4a88e84
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts
@@ -0,0 +1,24 @@
+export const relayerApiOrderConfigPayloadSchema = {
+ id: '/RelayerApiOrderConfigPayload',
+ type: 'object',
+ properties: {
+ makerAddress: { $ref: '/Address' },
+ takerAddress: { $ref: '/Address' },
+ makerAssetAmount: { $ref: '/Number' },
+ takerAssetAmount: { $ref: '/Number' },
+ makerAssetData: { $ref: '/Hex' },
+ takerAssetData: { $ref: '/Hex' },
+ exchangeAddress: { $ref: '/Address' },
+ expirationTimeSeconds: { $ref: '/Number' },
+ },
+ required: [
+ 'makerAddress',
+ 'takerAddress',
+ 'makerAssetAmount',
+ 'takerAssetAmount',
+ 'makerAssetData',
+ 'takerAssetData',
+ 'exchangeAddress',
+ 'expirationTimeSeconds',
+ ],
+};
diff --git a/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts b/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts
new file mode 100644
index 000000000..d7960cd9d
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts
@@ -0,0 +1,11 @@
+export const relayerApiOrderConfigResponseSchema = {
+ id: '/RelayerApiOrderConfigResponse',
+ type: 'object',
+ properties: {
+ makerFee: { $ref: '/Number' },
+ takerFee: { $ref: '/Number' },
+ feeRecipientAddress: { $ref: '/Address' },
+ senderAddress: { $ref: '/Address' },
+ },
+ required: ['makerFee', 'takerFee', 'feeRecipientAddress', 'senderAddress'],
+};
diff --git a/packages/json-schemas/schemas/relayer_api_order_schema.ts b/packages/json-schemas/schemas/relayer_api_order_schema.ts
new file mode 100644
index 000000000..4e138af12
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_order_schema.ts
@@ -0,0 +1,9 @@
+export const relayerApiOrderSchema = {
+ id: '/RelayerApiOrder',
+ type: 'object',
+ properties: {
+ order: { $ref: '/Order' },
+ remainingFillableAmount: { $ref: '/Number' },
+ },
+ required: ['order', 'remainingFillableAmount'],
+};
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
deleted file mode 100644
index fe1510d5b..000000000
--- a/packages/json-schemas/schemas/relayer_api_orderbook_channel_snapshot_schema.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-export const relayerApiOrderbookChannelSnapshotSchema = {
- id: '/RelayerApiOrderbookChannelSnapshot',
- type: 'object',
- properties: {
- type: { enum: ['snapshot'] },
- channel: { enum: ['orderbook'] },
- requestId: { type: 'number' },
- payload: { $ref: '/RelayerApiOrderbookChannelSnapshotPayload' },
- },
- required: ['type', 'channel', 'requestId', 'payload'],
-};
-
-export const relayerApiOrderbookChannelSnapshotPayload = {
- id: '/RelayerApiOrderbookChannelSnapshotPayload',
- type: 'object',
- properties: {
- bids: { $ref: '/signedOrdersSchema' },
- asks: { $ref: '/signedOrdersSchema' },
- },
- required: ['bids', 'asks'],
-};
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
deleted file mode 100644
index 9a6d83d4c..000000000
--- a/packages/json-schemas/schemas/relayer_api_orderbook_channel_update_response_schema.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export const relayerApiOrderbookChannelUpdateSchema = {
- id: '/RelayerApiOrderbookChannelUpdate',
- type: 'object',
- properties: {
- type: { enum: ['update'] },
- channel: { enum: ['orderbook'] },
- requestId: { type: 'number' },
- payload: { $ref: '/SignedOrder' },
- },
- required: ['type', 'channel', 'requestId', 'payload'],
-};
diff --git a/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts
index 5c409c807..f311908db 100644
--- a/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts
+++ b/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts
@@ -2,8 +2,8 @@ export const relayerApiOrderBookResponseSchema = {
id: '/RelayerApiOrderBookResponse',
type: 'object',
properties: {
- bids: { $ref: '/signedOrdersSchema' },
- asks: { $ref: '/signedOrdersSchema' },
+ bids: { $ref: '/RelayerApiOrdersResponse' },
+ asks: { $ref: '/RelayerApiOrdersResponse' },
},
required: ['bids', 'asks'],
};
diff --git a/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts
new file mode 100644
index 000000000..1fe612949
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts
@@ -0,0 +1,26 @@
+export const relayerApiOrdersChannelSubscribeSchema = {
+ id: '/RelayerApiOrdersChannelSubscribe',
+ type: 'object',
+ properties: {
+ type: { enum: ['subscribe'] },
+ channel: { enum: ['orders'] },
+ requestId: { type: 'string' },
+ payload: { $ref: '/RelayerApiOrdersChannelSubscribePayload' },
+ },
+ required: ['type', 'channel', 'requestId'],
+};
+
+export const relayerApiOrdersChannelSubscribePayload = {
+ id: '/RelayerApiOrdersChannelSubscribePayload',
+ type: 'object',
+ properties: {
+ makerAssetProxyId: { $ref: '/Address' },
+ takerAssetProxyId: { $ref: '/Address' },
+ networkId: { type: 'number' },
+ makerAssetAddress: { $ref: '/Address' },
+ takerAssetAddress: { $ref: '/Address' },
+ makerAssetData: { $ref: '/Hex' },
+ takerAssetData: { $ref: '/Hex' },
+ traderAssetData: { $ref: '/Hex' },
+ },
+};
diff --git a/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts
new file mode 100644
index 000000000..38306391b
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts
@@ -0,0 +1,11 @@
+export const relayerApiOrdersChannelUpdateSchema = {
+ id: '/RelayerApiOrdersChannelUpdate',
+ type: 'object',
+ properties: {
+ type: { enum: ['update'] },
+ channel: { enum: ['orders'] },
+ requestId: { type: 'string' },
+ payload: { $ref: '/RelayerApiOrders' },
+ },
+ required: ['type', 'channel', 'requestId', 'payload'],
+};
diff --git a/packages/json-schemas/schemas/relayer_api_orders_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_response_schema.ts
new file mode 100644
index 000000000..4bef260c1
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_orders_response_schema.ts
@@ -0,0 +1,13 @@
+export const relayerApiOrdersResponseSchema = {
+ id: '/RelayerApiOrdersResponse',
+ type: 'object',
+ allOf: [
+ { $ref: '/PaginatedCollection' },
+ {
+ properties: {
+ records: { $ref: '/RelayerApiOrders' },
+ },
+ required: ['records'],
+ },
+ ],
+};
diff --git a/packages/json-schemas/schemas/relayer_api_orders_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_schema.ts
new file mode 100644
index 000000000..da739a300
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_orders_schema.ts
@@ -0,0 +1,5 @@
+export const relayerApiOrdersSchema = {
+ id: '/RelayerApiOrders',
+ type: 'array',
+ items: { $ref: '/RelayerApiOrder' },
+};
diff --git a/packages/json-schemas/schemas/relayer_api_token_pairs_response_schema.ts b/packages/json-schemas/schemas/relayer_api_token_pairs_response_schema.ts
deleted file mode 100644
index 5009c7955..000000000
--- a/packages/json-schemas/schemas/relayer_api_token_pairs_response_schema.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-export const relayerApiTokenPairsResponseSchema = {
- id: '/RelayerApiTokenPairsResponse',
- type: 'array',
- items: {
- properties: {
- tokenA: { $ref: '/RelayerApiTokenTradeInfo' },
- tokenB: { $ref: '/RelayerApiTokenTradeInfo' },
- },
- required: ['tokenA', 'tokenB'],
- type: 'object',
- },
-};
-
-export const relayerApiTokenTradeInfoSchema = {
- id: '/RelayerApiTokenTradeInfo',
- type: 'object',
- properties: {
- address: { $ref: '/Address' },
- minAmount: { $ref: '/Number' },
- maxAmount: { $ref: '/Number' },
- precision: { type: 'number' },
- },
- required: ['address'],
-};