aboutsummaryrefslogblamecommitdiffstats
path: root/packages/contracts/src/utils/address_utils.ts
blob: dc63459f972e4bf81fa77d6035d4f63053d31aef (plain) (tree)
1
2
3
4
5
6
7
                                                                  




                                           
                                                        




                                                                             
import { generatePseudoRandomSalt } from '@0xproject/order-utils';

import { crypto } from './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;
    },
};