aboutsummaryrefslogtreecommitdiffstats
path: root/src/schemas
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-06-09 00:13:54 +0800
committerFabio Berger <me@fabioberger.com>2017-06-09 00:13:54 +0800
commit23a4dcb729084c0e00c759da487ae3959f436b3a (patch)
tree17446623d60c9beecedab6248e4485082fe1ad5e /src/schemas
parent2b08c04d4d7b67592d3f846dc31d01892bdbeaeb (diff)
downloaddexon-0x-contracts-23a4dcb729084c0e00c759da487ae3959f436b3a.tar.gz
dexon-0x-contracts-23a4dcb729084c0e00c759da487ae3959f436b3a.tar.zst
dexon-0x-contracts-23a4dcb729084c0e00c759da487ae3959f436b3a.zip
Add orderFillOrKillRequestsSchema and validate using it instead of looping over the requests and validating them individually
Diffstat (limited to 'src/schemas')
-rw-r--r--src/schemas/basic_type_schemas.ts11
-rw-r--r--src/schemas/order_fill_or_kill_requests_schema.ts12
-rw-r--r--src/schemas/order_schemas.ts12
3 files changed, 23 insertions, 12 deletions
diff --git a/src/schemas/basic_type_schemas.ts b/src/schemas/basic_type_schemas.ts
new file mode 100644
index 000000000..c3b81185d
--- /dev/null
+++ b/src/schemas/basic_type_schemas.ts
@@ -0,0 +1,11 @@
+export const addressSchema = {
+ id: '/addressSchema',
+ type: 'string',
+ pattern: '^0[xX][0-9A-Fa-f]{40}$',
+};
+
+export const numberSchema = {
+ id: '/numberSchema',
+ type: 'string',
+ pattern: '^\\d+(\\.\\d+)?$',
+};
diff --git a/src/schemas/order_fill_or_kill_requests_schema.ts b/src/schemas/order_fill_or_kill_requests_schema.ts
new file mode 100644
index 000000000..4db7113de
--- /dev/null
+++ b/src/schemas/order_fill_or_kill_requests_schema.ts
@@ -0,0 +1,12 @@
+export const orderFillOrKillRequestsSchema = {
+ id: '/OrderFillOrKillRequests',
+ type: 'array',
+ items: {
+ properties: {
+ signedOrder: {$ref: '/signedOrderSchema'},
+ fillTakerAmount: {type: '/numberSchema'},
+ },
+ required: ['signedOrder', 'fillTakerAmount'],
+ type: 'object',
+ },
+};
diff --git a/src/schemas/order_schemas.ts b/src/schemas/order_schemas.ts
index 4999f3e9d..133736b3d 100644
--- a/src/schemas/order_schemas.ts
+++ b/src/schemas/order_schemas.ts
@@ -1,15 +1,3 @@
-export const addressSchema = {
- id: '/addressSchema',
- type: 'string',
- pattern: '^0[xX][0-9A-Fa-f]{40}$',
-};
-
-export const numberSchema = {
- id: '/numberSchema',
- type: 'string',
- pattern: '^\\d+(\\.\\d+)?$',
-};
-
export const orderSchema = {
id: '/orderSchema',
properties: {