Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async _generateApprovalSignatureAsync(
txOrigin: string,
signedTransaction: SignedZeroExTransaction,
coordinatorOrders: Order[],
chainId: number,
approvalExpirationTimeSeconds: number,
): Promise {
const contractWrappers = this._chainIdToContractWrappers[chainId];
const typedData = await eip712Utils.createCoordinatorApprovalTypedDataAsync(
signedTransaction,
contractWrappers.coordinator.address,
txOrigin,
);
const approvalHashBuff = signTypedDataUtils.generateTypedDataHash(typedData);
// Since a coordinator can have multiple feeRecipientAddresses,
// we need to make sure we issue a signature for each feeRecipientAddress
// found in the orders submitted (i.e., someone can batch fill two coordinator
// orders, each with a different feeRecipientAddress). In that case, we issue a
// signature/expiration for each feeRecipientAddress
const feeRecipientAddressSet = new Set();
_.each(coordinatorOrders, o => {
feeRecipientAddressSet.add(o.feeRecipientAddress);
});
const signatures = [];
async getApprovalHashBufferAsync(
transaction: SignedZeroExTransaction,
verifyingContract: string,
txOrigin: string,
): Promise {
const typedData = await eip712Utils.createCoordinatorApprovalTypedDataAsync(
transaction,
verifyingContract,
txOrigin,
);
const hashBuffer = signTypedDataUtils.generateTypedDataHash(typedData);
return hashBuffer;
},
async getApprovalHashHexAsync(