Skip to content

Fix inheritance, add seaport validator, refactor API/Types #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Oct 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: spender type
  • Loading branch information
nickadamson committed Oct 17, 2023
commit 918eb7791da2d6a2b3e07ff734620ea9dc99eecb
6 changes: 4 additions & 2 deletions src/entities/trader/base-trader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export interface TraderConstructorArgs {
chain: Chain;
}

type Spender = typeof CLEAR_ADDRESS | typeof SEAPORT_ADDRESS;

export class Trader {
public account: Account;
public chain: Chain;
Expand Down Expand Up @@ -250,7 +252,7 @@ export class Trader {
amount,
}: {
erc20: ERC20Contract;
spender: typeof CLEAR_ADDRESS | typeof SEAPORT_ADDRESS;
spender: Spender;
amount: bigint;
}) => {
const approvedAmount = await this.getAllowanceFor({ erc20, spender });
Expand All @@ -272,7 +274,7 @@ export class Trader {
spender,
}: {
erc20: ERC20Contract;
spender: typeof CLEAR_ADDRESS | typeof SEAPORT_ADDRESS;
spender: Spender;
}) => {
const cachedAllowance = this.erc20Allowances.get(erc20.address)?.[spender];
if (cachedAllowance) {
Expand Down