diff options
author | Fabio Berger <me@fabioberger.com> | 2018-05-25 00:39:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-25 00:39:28 +0800 |
commit | 62431fee8e0c79a61f7ebb7677e6c88f0ae95116 (patch) | |
tree | f7aa155da9dd3a88d531d525f9f26f89b10e0e2a /packages/json-schemas/schemas | |
parent | 2f7ab3e32d1c54f42c435503426bc421fa89afd8 (diff) | |
parent | 357201869a56f01d33f3b1bf91be18a6029d5d7f (diff) | |
download | dexon-sol-tools-62431fee8e0c79a61f7ebb7677e6c88f0ae95116.tar dexon-sol-tools-62431fee8e0c79a61f7ebb7677e6c88f0ae95116.tar.gz dexon-sol-tools-62431fee8e0c79a61f7ebb7677e6c88f0ae95116.tar.bz2 dexon-sol-tools-62431fee8e0c79a61f7ebb7677e6c88f0ae95116.tar.lz dexon-sol-tools-62431fee8e0c79a61f7ebb7677e6c88f0ae95116.tar.xz dexon-sol-tools-62431fee8e0c79a61f7ebb7677e6c88f0ae95116.tar.zst dexon-sol-tools-62431fee8e0c79a61f7ebb7677e6c88f0ae95116.zip |
Merge pull request #615 from 0xProject/refactor/json-schemas/for-v2
Refactor order schemas in json-schemas for v2
Diffstat (limited to 'packages/json-schemas/schemas')
-rw-r--r-- | packages/json-schemas/schemas/basic_type_schemas.ts | 6 | ||||
-rw-r--r-- | packages/json-schemas/schemas/ec_signature_schema.ts | 20 | ||||
-rw-r--r-- | packages/json-schemas/schemas/order_schemas.ts | 36 |
3 files changed, 24 insertions, 38 deletions
diff --git a/packages/json-schemas/schemas/basic_type_schemas.ts b/packages/json-schemas/schemas/basic_type_schemas.ts index 9d81ff333..7565df9e0 100644 --- a/packages/json-schemas/schemas/basic_type_schemas.ts +++ b/packages/json-schemas/schemas/basic_type_schemas.ts @@ -4,6 +4,12 @@ export const addressSchema = { pattern: '^0x[0-9a-f]{40}$', }; +export const hexSchema = { + id: '/Hex', + type: 'string', + pattern: '^0x([0-9a-f][0-9a-f])+$', +}; + export const numberSchema = { id: '/Number', type: 'string', diff --git a/packages/json-schemas/schemas/ec_signature_schema.ts b/packages/json-schemas/schemas/ec_signature_schema.ts deleted file mode 100644 index 71b840dd8..000000000 --- a/packages/json-schemas/schemas/ec_signature_schema.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const ecSignatureParameterSchema = { - id: '/ECSignatureParameter', - type: 'string', - pattern: '^0[xX][0-9A-Fa-f]{64}$', -}; - -export const ecSignatureSchema = { - id: '/ECSignature', - properties: { - v: { - type: 'number', - minimum: 27, - maximum: 28, - }, - r: { $ref: '/ECSignatureParameter' }, - s: { $ref: '/ECSignatureParameter' }, - }, - required: ['v', 'r', 's'], - type: 'object', -}; diff --git a/packages/json-schemas/schemas/order_schemas.ts b/packages/json-schemas/schemas/order_schemas.ts index 6f17224ad..183118c23 100644 --- a/packages/json-schemas/schemas/order_schemas.ts +++ b/packages/json-schemas/schemas/order_schemas.ts @@ -1,30 +1,30 @@ export const orderSchema = { id: '/Order', properties: { - maker: { $ref: '/Address' }, - taker: { $ref: '/Address' }, + makerAddress: { $ref: '/Address' }, + takerAddress: { $ref: '/Address' }, makerFee: { $ref: '/Number' }, takerFee: { $ref: '/Number' }, - makerTokenAmount: { $ref: '/Number' }, - takerTokenAmount: { $ref: '/Number' }, - makerTokenAddress: { $ref: '/Address' }, - takerTokenAddress: { $ref: '/Address' }, + makerAssetAmount: { $ref: '/Number' }, + takerAssetAmount: { $ref: '/Number' }, + makerAssetData: { $ref: '/Hex' }, + takerAssetData: { $ref: '/Hex' }, salt: { $ref: '/Number' }, - feeRecipient: { $ref: '/Address' }, - expirationUnixTimestampSec: { $ref: '/Number' }, - exchangeContractAddress: { $ref: '/Address' }, + feeRecipientAddress: { $ref: '/Address' }, + expirationTimeSeconds: { $ref: '/Number' }, }, required: [ - 'maker', - 'taker', + 'makerAddress', + 'takerAddress', 'makerFee', 'takerFee', - 'makerTokenAmount', - 'takerTokenAmount', + 'makerAssetAmount', + 'takerAssetAmount', + 'makerAssetData', + 'takerAssetData', 'salt', - 'feeRecipient', - 'expirationUnixTimestampSec', - 'exchangeContractAddress', + 'feeRecipientAddress', + 'expirationTimeSeconds', ], type: 'object', }; @@ -35,9 +35,9 @@ export const signedOrderSchema = { { $ref: '/Order' }, { properties: { - ecSignature: { $ref: '/ECSignature' }, + signature: { $ref: '/Hex' }, }, - required: ['ecSignature'], + required: ['signature'], }, ], }; |