diff options
-rw-r--r-- | packages/utils/src/address_utils.ts | 5 | ||||
-rw-r--r-- | packages/utils/src/transaction_decoder.ts | 2 | ||||
-rw-r--r-- | packages/utils/test/transaction_decoder_test.ts | 3 |
3 files changed, 7 insertions, 3 deletions
diff --git a/packages/utils/src/address_utils.ts b/packages/utils/src/address_utils.ts index b700cd944..b269c26b4 100644 --- a/packages/utils/src/address_utils.ts +++ b/packages/utils/src/address_utils.ts @@ -1,4 +1,4 @@ -import { addHexPrefix, stripHexPrefix, sha3 } from 'ethereumjs-util'; +import { addHexPrefix, sha3, stripHexPrefix } from 'ethereumjs-util'; import * as jsSHA3 from 'js-sha3'; import * as _ from 'lodash'; @@ -63,7 +63,8 @@ export const addressUtils = { generatePseudoRandomAddress(): string { const randomBigNum = addressUtils.generatePseudoRandomSalt(); const randomBuff = sha3(randomBigNum.toString()); - const randomAddress = `0x${randomBuff.slice(0, 20).toString('hex')}`; + const addressLengthInBytes = 20; + const randomAddress = `0x${randomBuff.slice(0, addressLengthInBytes).toString('hex')}`; return randomAddress; }, }; diff --git a/packages/utils/src/transaction_decoder.ts b/packages/utils/src/transaction_decoder.ts index dd1b4d19a..9d567286e 100644 --- a/packages/utils/src/transaction_decoder.ts +++ b/packages/utils/src/transaction_decoder.ts @@ -36,9 +36,11 @@ export class TransactionDecoder { deploymentInfos?: DeployedContractInfo[], ): void { // Disregard definitions that are not functions + // tslint:disable no-unnecessary-type-assertion const functionAbis = _.filter(abiDefinitions, abiEntry => { return abiEntry.type === 'function'; }) as MethodAbi[]; + // tslint:enable no-unnecessary-type-assertion // Record function ABI's _.each(functionAbis, functionAbi => { const abiEncoder = new AbiEncoder.Method(functionAbi); diff --git a/packages/utils/test/transaction_decoder_test.ts b/packages/utils/test/transaction_decoder_test.ts index 3845bb134..725ad5032 100644 --- a/packages/utils/test/transaction_decoder_test.ts +++ b/packages/utils/test/transaction_decoder_test.ts @@ -2,9 +2,10 @@ import * as chai from 'chai'; import { MethodAbi } from 'ethereum-types'; import 'mocha'; -import { chaiSetup } from './utils/chai_setup'; import { AbiEncoder, TransactionDecoder } from '../src'; +import { chaiSetup } from './utils/chai_setup'; + chaiSetup.configure(); const expect = chai.expect; |