diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-04-23 06:18:55 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-04-24 00:57:13 +0800 |
commit | afb02b8bd16758f00d630c9ce6cf3bbc49ab307d (patch) | |
tree | fd7a80ae1451818d9794e21d265e84ed793720c8 /packages/contracts/src/utils | |
parent | 48b44342ab1642a78d0485e111019acfdbbfdfd5 (diff) | |
download | dexon-0x-contracts-afb02b8bd16758f00d630c9ce6cf3bbc49ab307d.tar dexon-0x-contracts-afb02b8bd16758f00d630c9ce6cf3bbc49ab307d.tar.gz dexon-0x-contracts-afb02b8bd16758f00d630c9ce6cf3bbc49ab307d.tar.bz2 dexon-0x-contracts-afb02b8bd16758f00d630c9ce6cf3bbc49ab307d.tar.lz dexon-0x-contracts-afb02b8bd16758f00d630c9ce6cf3bbc49ab307d.tar.xz dexon-0x-contracts-afb02b8bd16758f00d630c9ce6cf3bbc49ab307d.tar.zst dexon-0x-contracts-afb02b8bd16758f00d630c9ce6cf3bbc49ab307d.zip |
Fix and cleanup tests
Diffstat (limited to 'packages/contracts/src/utils')
-rw-r--r-- | packages/contracts/src/utils/address_utils.ts | 12 | ||||
-rw-r--r-- | packages/contracts/src/utils/order_factory.ts | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/packages/contracts/src/utils/address_utils.ts b/packages/contracts/src/utils/address_utils.ts new file mode 100644 index 000000000..01a7a6fd4 --- /dev/null +++ b/packages/contracts/src/utils/address_utils.ts @@ -0,0 +1,12 @@ +import { ZeroEx } from '0x.js'; + +import { crypto } from './crypto'; + +export const addressUtils = { + generatePseudoRandomAddress(): string { + const randomBigNum = ZeroEx.generatePseudoRandomSalt(); + const randomBuff = crypto.solSHA3([randomBigNum]); + const randomAddress = `0x${randomBuff.slice(0, 20).toString('hex')}`; + return randomAddress; + }, +}; diff --git a/packages/contracts/src/utils/order_factory.ts b/packages/contracts/src/utils/order_factory.ts index bdf5f9abe..08853054d 100644 --- a/packages/contracts/src/utils/order_factory.ts +++ b/packages/contracts/src/utils/order_factory.ts @@ -4,7 +4,7 @@ import * as _ from 'lodash'; import { orderUtils } from './order_utils'; import { signingUtils } from './signing_utils'; -import { DefaultOrderParams, SignatureType, SignedOrder, UnsignedOrder } from './types'; +import { SignatureType, SignedOrder, UnsignedOrder } from './types'; export class OrderFactory { private _defaultOrderParams: Partial<UnsignedOrder>; |