Skip to content

Commit

Permalink
feat(limit-order): add .isOrderPrivate method
Browse files Browse the repository at this point in the history
  • Loading branch information
vbrvk committed Mar 21, 2024
1 parent ee97349 commit f5ac0fd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/limit-order/limit-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {MakerTraits} from './maker-traits'
import {Extension} from './extension'
import {Address} from '../address'

const ZeroAddressHalf = '0'.repeat(20)

export class LimitOrder {
private static readonly Web3Type = `tuple(${[
'uint256 salt',
Expand Down Expand Up @@ -126,7 +128,7 @@ export class LimitOrder {
}
}

getTypedData(domain = getLimitOrderV4Domain(1)): EIP712TypedData {
public getTypedData(domain = getLimitOrderV4Domain(1)): EIP712TypedData {
return buildOrderTypedData(
domain.chainId,
domain.verifyingContract,
Expand All @@ -136,7 +138,11 @@ export class LimitOrder {
)
}

getOrderHash(chainId: number): string {
public getOrderHash(chainId: number): string {
return getOrderHash(this.getTypedData(getLimitOrderV4Domain(chainId)))
}

public isOrderPrivate(): boolean {
return this.makerTraits.allowedSender() !== ZeroAddressHalf
}
}

0 comments on commit f5ac0fd

Please sign in to comment.