Skip to content

Commit

Permalink
Only use compact signature when signature length is 132 chars (0x + 6…
Browse files Browse the repository at this point in the history
…5 bytes) (#325)
  • Loading branch information
ryanio authored Jul 27, 2023
1 parent d9a28a9 commit eafcd1c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/seaport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,18 @@ export class Seaport {

const domainData = await this._getDomainData();

const signature = await signer._signTypedData(
let signature = await signer._signTypedData(
domainData,
EIP_712_ORDER_TYPE,
orderComponents,
);

// Use EIP-2098 compact signatures to save gas.
return ethers.utils.splitSignature(signature).compact;
if (signature.length === 132) {
signature = ethers.utils.splitSignature(signature).compact;
}

return signature;
}

/**
Expand Down Expand Up @@ -541,7 +545,9 @@ export class Seaport {
);

// Use EIP-2098 compact signatures to save gas.
signature = ethers.utils.splitSignature(signature).compact;
if (signature.length === 132) {
signature = ethers.utils.splitSignature(signature).compact;
}

const orders: OrderWithCounter[] = orderComponents.map((parameters, i) => ({
parameters,
Expand Down

0 comments on commit eafcd1c

Please sign in to comment.