Fix exchange package build
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { generatePseudoRandomSalt, transactionHashUtils } from '@0x/order-utils';
|
||||
import { SignatureType, SignedZeroExTransaction } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
|
||||
import { getLatestBlockTimestampAsync } from './block_timestamp';
|
||||
import { signingUtils } from './signing_utils';
|
||||
|
||||
export class TransactionFactory {
|
||||
@@ -16,16 +18,19 @@ export class TransactionFactory {
|
||||
this._chainId = chainId;
|
||||
this._signerBuff = ethUtil.privateToAddress(this._privateKey);
|
||||
}
|
||||
public newSignedTransaction(
|
||||
public async newSignedTransactionAsync(
|
||||
data: string,
|
||||
signatureType: SignatureType = SignatureType.EthSign,
|
||||
): SignedZeroExTransaction {
|
||||
): Promise<SignedZeroExTransaction> {
|
||||
const tenMinutesInSeconds = 10 * 60;
|
||||
const currentBlockTimestamp = await getLatestBlockTimestampAsync();
|
||||
const salt = generatePseudoRandomSalt();
|
||||
const signerAddress = `0x${this._signerBuff.toString('hex')}`;
|
||||
const transaction = {
|
||||
salt,
|
||||
signerAddress,
|
||||
data,
|
||||
expirationTimeSeconds: new BigNumber(currentBlockTimestamp).plus(tenMinutesInSeconds),
|
||||
domain: {
|
||||
verifyingContractAddress: this._exchangeAddress,
|
||||
chainId: this._chainId,
|
||||
|
Reference in New Issue
Block a user