From b82b50e2f0b18530da110e3d8ae2c07950a5cdef Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 6 Dec 2017 19:05:22 -0600 Subject: Use assert.isHexString --- packages/subproviders/src/subproviders/ledger.ts | 7 +++---- packages/subproviders/src/types.ts | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/src/subproviders/ledger.ts b/packages/subproviders/src/subproviders/ledger.ts index ccc94d76f..eba1a48a4 100644 --- a/packages/subproviders/src/subproviders/ledger.ts +++ b/packages/subproviders/src/subproviders/ledger.ts @@ -1,6 +1,7 @@ +import {assert} from '@0xproject/assert'; import promisify = require('es6-promisify'); import {isAddress} from 'ethereum-address'; -import * as EthereumTx from 'ethereumjs-tx'; +import EthereumTx from 'ethereumjs-tx'; import ethUtil = require('ethereumjs-util'); import * as ledger from 'ledgerco'; import * as _ from 'lodash'; @@ -53,9 +54,7 @@ export class LedgerSubprovider extends Subprovider { if (_.isUndefined(msgParams.data)) { throw new Error(LedgerSubproviderErrors.DataMissingForSignPersonalMessage); } - if (!LedgerSubprovider.isValidHex(msgParams.data)) { - throw new Error(LedgerSubproviderErrors.DataNotValidHexForSignPersonalMessage); - } + assert.isHexString('data', msgParams.data); } private static validateSender(sender: string) { if (_.isUndefined(sender) || !isAddress(sender)) { diff --git a/packages/subproviders/src/types.ts b/packages/subproviders/src/types.ts index 43ee32870..9dacc91b5 100644 --- a/packages/subproviders/src/types.ts +++ b/packages/subproviders/src/types.ts @@ -107,7 +107,6 @@ export enum LedgerSubproviderErrors { TooOldLedgerFirmware = 'TOO_OLD_LEDGER_FIRMWARE', FromAddressMissingOrInvalid = 'FROM_ADDRESS_MISSING_OR_INVALID', DataMissingForSignPersonalMessage = 'DATA_MISSING_FOR_SIGN_PERSONAL_MESSAGE', - DataNotValidHexForSignPersonalMessage = 'DATA_NOT_VALID_HEX_FOR_SIGN_PERSONAL_MESSAGE', SenderInvalidOrNotSupplied = 'SENDER_INVALID_OR_NOT_SUPPLIED', MultipleOpenConnectionsDisallowed = 'MULTIPLE_OPEN_CONNECTIONS_DISALLOWED', } -- cgit v1.2.3