import { assetDataUtils , generatePseudoRandomSalt } from '0x-v2-order-utils' ; import * as cryptoRandomString from 'crypto-random-string' ; import { orderBNToString } from '../utils' ; import { NULL_ADDRESS } from '../constants' ; export const buildSignedOrder = ( order , makerAddress , wethAddress ) : any => { const makerAssetAddress = order . makerAssetAddress . toLowerCase ( ) ; const takerAssetAddress = order . takerAssetAddress . toLowerCase ( ) ; order . makerAddress = makerAddress ; if ( makerAssetAddress === wethAddress . toLowerCase ( ) ) { order . makerAssetAddress = NULL_ADDRESS ; order . makerAssetData = assetDataUtils . encodeERC20AssetData ( NULL_ADDRESS ) ; } if ( takerAssetAddress === wethAddress . toLowerCase ( ) ) { order . takerAssetAddress = NULL_ADDRESS ; order . takerAssetData = assetDataUtils . encodeERC20AssetData ( NULL_ADDRESS ) ; } const signedOrder = { ... order , salt : generatePseudoRandomSalt ( ) , makerWalletSignature : cryptoRandomString ( { length : 40 } ) , } ; return orderBNToString ( signedOrder ) ; } ;