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): add getter for slow fill requests #890

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@across-protocol/sdk",
"author": "UMA Team",
"version": "4.1.12",
"version": "4.1.13",
"license": "AGPL-3.0",
"homepage": "https://docs.across.to/reference/sdk",
"files": [
Expand Down
10 changes: 9 additions & 1 deletion src/clients/SpokePoolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,18 @@ export class SpokePoolClient extends BaseAbstractClient {
return Object.values(this.depositHashes).find(({ depositId: _depositId }) => _depositId.eq(depositId));
}

/**
* Retrieves a list of slow fill requests from the SpokePool contract.
* @returns A list of slow fill requests.
*/
public getSlowFillRequests(): SlowFillRequestWithBlock[] {
return sortEventsAscendingInPlace(Object.values(this.slowFillRequests));
}

/**
* Find a SlowFillRequested event based on its deposit RelayData.
* @param relayData RelayData field for the SlowFill request.
* @returns The corresponding SlowFIllRequest event if found, otherwise undefined.
* @returns The corresponding SlowFillRequest event if found, otherwise undefined.
*/
public getSlowFillRequest(relayData: RelayData): SlowFillRequestWithBlock | undefined {
const messageHash = getMessageHash(relayData.message);
Expand Down
9 changes: 6 additions & 3 deletions test/SpokePoolClient.v3Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ describe("SpokePoolClient: Event Filtering", function () {
}
await destinationSpokePoolClient.update(slowFillRequestedEvents);

// Should receive _all_ fills submitted on the destination chain.
// Should receive _all_ slow fills submitted on the destination chain.
const slowFillRequests = destinationSpokePoolClient.getSlowFillRequests();
expect(slowFillRequests.length).to.equal(requests.length);

requests.forEach((event) => {
let { args } = event;
expect(args).to.not.be.undefined;
Expand Down Expand Up @@ -363,7 +366,7 @@ describe("SpokePoolClient: Event Filtering", function () {
expect(deposit.depositId).to.equal(depositEvent.args!.depositId);

const v3Fill = fillFromDeposit(deposit, relayer);
fillEvents.push(destinationSpokePoolClient.fillV3Relay(v3Fill as FillWithBlock));
fillEvents.push(destinationSpokePoolClient.fillV3Relay(v3Fill as FillWithBlock & { message: string }));
}
await destinationSpokePoolClient.update(filledRelayEvents);

Expand Down Expand Up @@ -447,7 +450,7 @@ describe("SpokePoolClient: Event Filtering", function () {
exclusiveRelayer,
relayer,
depositId: toBN(i),
} as FillWithBlock);
} as FillWithBlock & { message: string });
await originSpokePoolClient.update(["FilledV3Relay"]);
let relay = originSpokePoolClient.getFills().at(-1);
expect(relay).to.exist;
Expand Down