Skip to content
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

feat(SpokePoolClient): Permit querying a fill for a single deposit #686

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
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
10 changes: 10 additions & 0 deletions src/clients/SpokePoolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,16 @@ export class SpokePoolClient extends BaseAbstractClient {
return validateFillForDeposit(fill, depositWithMatchingDepositId) ? depositWithMatchingDepositId : undefined;
}

/**
* Find a valid fill for a given deposit.
* @param deposit A deposit event.
* @returns A valid fill for the deposit, or undefined.
*/
public getFillForDeposit(deposit: Deposit): FillWithBlock | undefined {
const fills = this.depositHashesToFills[this.getDepositHash(deposit)];
return fills?.find((fill) => validateFillForDeposit(fill, deposit));
}

/**
* Find the unfilled amount for a given deposit. This is the full deposit amount minus the total filled amount.
* @param deposit The deposit to find the unfilled amount for.
Expand Down
Loading