diff options
Diffstat (limited to 'contracts/test-utils/src/address_utils.ts')
-rw-r--r-- | contracts/test-utils/src/address_utils.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/contracts/test-utils/src/address_utils.ts b/contracts/test-utils/src/address_utils.ts new file mode 100644 index 000000000..634da0c16 --- /dev/null +++ b/contracts/test-utils/src/address_utils.ts @@ -0,0 +1,11 @@ +import { generatePseudoRandomSalt } from '@0x/order-utils'; +import { crypto } from '@0x/order-utils/lib/src/crypto'; + +export const addressUtils = { + generatePseudoRandomAddress(): string { + const randomBigNum = generatePseudoRandomSalt(); + const randomBuff = crypto.solSHA3([randomBigNum]); + const randomAddress = `0x${randomBuff.slice(0, 20).toString('hex')}`; + return randomAddress; + }, +}; |