diff options
author | Fabio Berger <me@fabioberger.com> | 2017-05-30 00:13:07 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-05-30 00:13:07 +0800 |
commit | 46fb1914cfef6af8423897ef5edb477ba5e40665 (patch) | |
tree | c393edd9f1f421d69bcd67b9e3cf561e9c521233 | |
parent | 43082b576ce764cf896d6c3b9fdae8c414467794 (diff) | |
download | dexon-0x-contracts-46fb1914cfef6af8423897ef5edb477ba5e40665.tar dexon-0x-contracts-46fb1914cfef6af8423897ef5edb477ba5e40665.tar.gz dexon-0x-contracts-46fb1914cfef6af8423897ef5edb477ba5e40665.tar.bz2 dexon-0x-contracts-46fb1914cfef6af8423897ef5edb477ba5e40665.tar.lz dexon-0x-contracts-46fb1914cfef6af8423897ef5edb477ba5e40665.tar.xz dexon-0x-contracts-46fb1914cfef6af8423897ef5edb477ba5e40665.tar.zst dexon-0x-contracts-46fb1914cfef6af8423897ef5edb477ba5e40665.zip |
Lowercase schema names
-rw-r--r-- | src/0x.js.ts | 4 | ||||
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 4 | ||||
-rw-r--r-- | src/schemas/ec_signature_schema.ts | 10 | ||||
-rw-r--r-- | src/utils/schema_validator.ts | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/src/0x.js.ts b/src/0x.js.ts index aed7513a8..d708a8db6 100644 --- a/src/0x.js.ts +++ b/src/0x.js.ts @@ -11,7 +11,7 @@ import {assert} from './utils/assert'; import findVersions = require('find-versions'); import compareVersions = require('compare-versions'); import {ExchangeWrapper} from './contract_wrappers/exchange_wrapper'; -import {ECSignatureSchema} from './schemas/ec_signature_schema'; +import {ecSignatureSchema} from './schemas/ec_signature_schema'; import {SolidityTypes, ECSignature, ZeroExError} from './types'; const MAX_DIGITS_IN_UNSIGNED_256_INT = 78; @@ -67,7 +67,7 @@ export class ZeroEx { */ public static isValidSignature(dataHex: string, signature: ECSignature, signerAddressHex: string): boolean { assert.isHexString('dataHex', dataHex); - assert.doesConformToSchema('signature', signature, ECSignatureSchema); + assert.doesConformToSchema('signature', signature, ecSignatureSchema); assert.isETHAddressHex('signerAddressHex', signerAddressHex); const dataBuff = ethUtil.toBuffer(dataHex); diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index f9585e991..f0f153c2b 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -4,7 +4,7 @@ import {ECSignature, ZeroExError, ExchangeContract} from '../types'; import {assert} from '../utils/assert'; import {ContractWrapper} from './contract_wrapper'; import * as ExchangeArtifacts from '../artifacts/Exchange.json'; -import {ECSignatureSchema} from '../schemas/ec_signature_schema'; +import {ecSignatureSchema} from '../schemas/ec_signature_schema'; export class ExchangeWrapper extends ContractWrapper { constructor(web3Wrapper: Web3Wrapper) { @@ -13,7 +13,7 @@ export class ExchangeWrapper extends ContractWrapper { public async isValidSignatureAsync(dataHex: string, ecSignature: ECSignature, signerAddressHex: string): Promise<boolean> { assert.isHexString('dataHex', dataHex); - assert.doesConformToSchema('ecSignature', ecSignature, ECSignatureSchema); + assert.doesConformToSchema('ecSignature', ecSignature, ecSignatureSchema); assert.isETHAddressHex('signerAddressHex', signerAddressHex); const senderAddressIfExists = await this.web3Wrapper.getSenderAddressIfExistsAsync(); diff --git a/src/schemas/ec_signature_schema.ts b/src/schemas/ec_signature_schema.ts index 94e58e53c..e39a8bd70 100644 --- a/src/schemas/ec_signature_schema.ts +++ b/src/schemas/ec_signature_schema.ts @@ -1,10 +1,10 @@ -export const ECSignatureParameter = { - id: '/ECSignatureParameter', +export const ecSignatureParameter = { + id: '/ecSignatureParameter', type: 'string', pattern: '^0[xX][0-9A-Fa-f]{64}$', }; -export const ECSignatureSchema = { +export const ecSignatureSchema = { id: '/ECSignature', properties: { v: { @@ -12,8 +12,8 @@ export const ECSignatureSchema = { minimum: 27, maximum: 28, }, - r: {$ref: '/ECSignatureParameter'}, - s: {$ref: '/ECSignatureParameter'}, + r: {$ref: '/ecSignatureParameter'}, + s: {$ref: '/ecSignatureParameter'}, }, required: ['v', 'r', 's'], type: 'object', diff --git a/src/utils/schema_validator.ts b/src/utils/schema_validator.ts index bd2f97d2b..61f4c09c8 100644 --- a/src/utils/schema_validator.ts +++ b/src/utils/schema_validator.ts @@ -1,12 +1,12 @@ import {Validator, ValidatorResult} from 'jsonschema'; -import {ECSignatureSchema, ECSignatureParameter} from '../schemas/ec_signature_schema'; +import {ecSignatureSchema, ecSignatureParameter} from '../schemas/ec_signature_schema'; export class SchemaValidator { private validator: Validator; constructor() { this.validator = new Validator(); - this.validator.addSchema(ECSignatureParameter, ECSignatureParameter.id); - this.validator.addSchema(ECSignatureSchema, ECSignatureSchema.id); + this.validator.addSchema(ecSignatureParameter, ecSignatureParameter.id); + this.validator.addSchema(ecSignatureSchema, ecSignatureSchema.id); } public validate(instance: object, schema: Schema): ValidatorResult { return this.validator.validate(instance, schema); |