diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-02 08:29:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-02 08:29:44 +0800 |
commit | d50fbac5f937602d7a90343ea8ff88cee5c4542f (patch) | |
tree | d1c818e64b75c1f4fed1c7d797892fb0d35dd779 /packages/json-schemas | |
parent | 62e60e2ba6d07b9b892b4f2e92a5421c54f5fa20 (diff) | |
parent | d3c64bd5b493dc1779a24c7c051c255106a4292a (diff) | |
download | dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.tar dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.tar.gz dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.tar.bz2 dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.tar.lz dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.tar.xz dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.tar.zst dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.zip |
Merge pull request #636 from 0xProject/refactor/order-utils/for-v2
Refactor order-utils for v2
Diffstat (limited to 'packages/json-schemas')
-rw-r--r-- | packages/json-schemas/package.json | 2 | ||||
-rw-r--r-- | packages/json-schemas/schemas/ec_signature_schema.ts | 20 | ||||
-rw-r--r-- | packages/json-schemas/schemas/order_schemas.ts | 4 | ||||
-rw-r--r-- | packages/json-schemas/src/schemas.ts | 2 | ||||
-rw-r--r-- | packages/json-schemas/test/schema_test.ts | 2 |
5 files changed, 29 insertions, 1 deletions
diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 60a79d165..603e5ab73 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/json-schemas", - "version": "0.7.24", + "version": "1.0.0", "engines": { "node": ">=6.12" }, diff --git a/packages/json-schemas/schemas/ec_signature_schema.ts b/packages/json-schemas/schemas/ec_signature_schema.ts new file mode 100644 index 000000000..71b840dd8 --- /dev/null +++ b/packages/json-schemas/schemas/ec_signature_schema.ts @@ -0,0 +1,20 @@ +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 183118c23..dcbfde6e0 100644 --- a/packages/json-schemas/schemas/order_schemas.ts +++ b/packages/json-schemas/schemas/order_schemas.ts @@ -5,11 +5,13 @@ export const orderSchema = { takerAddress: { $ref: '/Address' }, makerFee: { $ref: '/Number' }, takerFee: { $ref: '/Number' }, + senderAddress: { $ref: '/Address' }, makerAssetAmount: { $ref: '/Number' }, takerAssetAmount: { $ref: '/Number' }, makerAssetData: { $ref: '/Hex' }, takerAssetData: { $ref: '/Hex' }, salt: { $ref: '/Number' }, + exchangeAddress: { $ref: '/Address' }, feeRecipientAddress: { $ref: '/Address' }, expirationTimeSeconds: { $ref: '/Number' }, }, @@ -18,11 +20,13 @@ export const orderSchema = { 'takerAddress', 'makerFee', 'takerFee', + 'senderAddress', 'makerAssetAmount', 'takerAssetAmount', 'makerAssetData', 'takerAssetData', 'salt', + 'exchangeAddress', 'feeRecipientAddress', 'expirationTimeSeconds', ], diff --git a/packages/json-schemas/src/schemas.ts b/packages/json-schemas/src/schemas.ts index 26d6e6cf1..77ea88f5c 100644 --- a/packages/json-schemas/src/schemas.ts +++ b/packages/json-schemas/src/schemas.ts @@ -1,5 +1,6 @@ import { addressSchema, hexSchema, numberSchema } from '../schemas/basic_type_schemas'; import { blockParamSchema, blockRangeSchema } from '../schemas/block_range_schema'; +import { ecSignatureSchema } from '../schemas/ec_signature_schema'; import { indexFilterValuesSchema } from '../schemas/index_filter_values_schema'; import { orderCancellationRequestsSchema } from '../schemas/order_cancel_schema'; import { orderFillOrKillRequestsSchema } from '../schemas/order_fill_or_kill_requests_schema'; @@ -31,6 +32,7 @@ export const schemas = { numberSchema, addressSchema, hexSchema, + ecSignatureSchema, indexFilterValuesSchema, orderCancellationRequestsSchema, orderFillOrKillRequestsSchema, diff --git a/packages/json-schemas/test/schema_test.ts b/packages/json-schemas/test/schema_test.ts index 379f92442..3858c7fa7 100644 --- a/packages/json-schemas/test/schema_test.ts +++ b/packages/json-schemas/test/schema_test.ts @@ -171,6 +171,7 @@ describe('Schema', () => { const order = { makerAddress: NULL_ADDRESS, takerAddress: NULL_ADDRESS, + senderAddress: NULL_ADDRESS, makerFee: '1', takerFee: '2', makerAssetAmount: '1', @@ -179,6 +180,7 @@ describe('Schema', () => { takerAssetData: NULL_ADDRESS, salt: '67006738228878699843088602623665307406148487219438534730168799356281242528500', feeRecipientAddress: NULL_ADDRESS, + exchangeAddress: NULL_ADDRESS, expirationTimeSeconds: '42', }; describe('#orderSchema', () => { |