diff options
author | Fabio Berger <me@fabioberger.com> | 2017-12-07 09:05:22 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-12-07 09:05:22 +0800 |
commit | b82b50e2f0b18530da110e3d8ae2c07950a5cdef (patch) | |
tree | 267657613534dd707f027d474d39ca08193cb910 | |
parent | e893e8c44234fc65789c906aefb240145100fe4e (diff) | |
download | dexon-sol-tools-b82b50e2f0b18530da110e3d8ae2c07950a5cdef.tar.gz dexon-sol-tools-b82b50e2f0b18530da110e3d8ae2c07950a5cdef.tar.zst dexon-sol-tools-b82b50e2f0b18530da110e3d8ae2c07950a5cdef.zip |
Use assert.isHexString
-rw-r--r-- | packages/subproviders/src/subproviders/ledger.ts | 7 | ||||
-rw-r--r-- | packages/subproviders/src/types.ts | 1 |
2 files changed, 3 insertions, 5 deletions
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', } |