From 699e588d1fda7f7e8190a4b3347905964cef2d95 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 30 May 2017 12:00:23 +0200 Subject: Add signedOrderSchema and all subschemas --- src/schemas/signed_order_schema.ts | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/schemas/signed_order_schema.ts (limited to 'src/schemas') diff --git a/src/schemas/signed_order_schema.ts b/src/schemas/signed_order_schema.ts new file mode 100644 index 000000000..b9321cad1 --- /dev/null +++ b/src/schemas/signed_order_schema.ts @@ -0,0 +1,50 @@ +export const addressSchema = { + id: '/addressSchema', + type: 'string', + pattern: '^0[xX][0-9A-Fa-f]{40}$', +}; + +export const bigNumberSchema = { + id: '/bigNumberSchema', + type: 'string', + pattern: '^\d*$', +}; + +export const orderSchema = { + id: '/orderSchema', + properties: { + maker: {$ref: '/addressSchema'}, + taker: {$ref: '/addressSchema'}, + + makerFee: {$ref: '/bigNumberSchema'}, + takerFee: {$ref: '/bigNumberSchema'}, + + makerTokenAmount: {$ref: '/bigNumberSchema'}, + takerTokenAmount: {$ref: '/bigNumberSchema'}, + + makerTokenAddress: {$ref: '/addressSchema'}, + takerTokenAddress: {$ref: '/addressSchema'}, + + salt: {$ref: '/bigNumberSchema'}, + fillAmount: {$ref: '/bigNumberSchema'}, + feeRecipient: {$ref: '/addressSchema'}, + expirationUnixTimestampSec: {$ref: '/bigNumberSchema'}, + }, + required: [ + 'maker', /*'taker',*/ 'makerFee', 'takerFee', 'makerTokenAmount', 'takerTokenAmount', + 'salt', 'fillAmount', 'feeRecipient', 'expirationUnixTimestampSec', + ], + type: 'object', +}; + +export const signedOrderSchema = { + allOf: [ + { $ref: '/orderSchema' }, + { + properties: { + ecSignature: {$ref: '/addressSchema'}, + }, + required: ['ecSignature'], + }, + ], +}; -- cgit