Migrate all contract-related tooling and tests to accept a chain ID in domain separators.

This commit is contained in:
Lawrence Forman
2019-03-22 16:18:49 -04:00
committed by Amir Bandeali
parent 92fe720ac3
commit 2d28fde24d
39 changed files with 282 additions and 64 deletions

View File

@@ -8,10 +8,16 @@ import { hashUtils, SignedCoordinatorApproval } from './index';
export class ApprovalFactory {
private readonly _privateKey: Buffer;
private readonly _verifyingContractAddress: string;
private readonly _chainId: number;
constructor(privateKey: Buffer, verifyingContractAddress: string) {
constructor(
privateKey: Buffer,
verifyingContractAddress: string,
chainId: number,
) {
this._privateKey = privateKey;
this._verifyingContractAddress = verifyingContractAddress;
this._chainId = chainId;
}
public newSignedApproval(
@@ -23,6 +29,7 @@ export class ApprovalFactory {
const approvalHashBuff = hashUtils.getApprovalHashBuffer(
transaction,
this._verifyingContractAddress,
this._chainId,
txOrigin,
approvalExpirationTimeSeconds,
);