Skip to content
Open
Show file tree
Hide file tree
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
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.3.74",
"version": "4.3.75",
"license": "AGPL-3.0",
"homepage": "https://docs.across.to/reference/sdk",
"files": [
Expand Down
19 changes: 19 additions & 0 deletions src/clients/SpokePoolClient/SpokePoolClientManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import winston from "winston";
import { SpokePoolClient } from "./SpokePoolClient";
import { Address } from "../../utils";

/**
* SpokePoolClientManager is a wrapper around spokePoolClients. We want to use wrapper almost always
Expand Down Expand Up @@ -33,4 +34,22 @@ export class SpokePoolManager {
getSpokePoolClients(): { [chainId: number]: SpokePoolClient } {
return this.spokePoolClients;
}

/**
* Retrieves all SpokePoolClient Addresses
* @returns (Address | undefined)[]
* @note This method returns all SpokePoolClient Addresses.
*/
getSpokePoolAddresses(): (Address | undefined)[] {
return Object.values(this.spokePoolClients).map((client) => client.spokePoolAddress);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how useful this is as an array because the address alone isn't very useful without the corresponding chainId. Might make sense to just return an Object mapping chainId to Address.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


/**
* Retrieves all SpokePoolClient chainIds
* @returns number[]
* @note This method returns all SpokePoolClient chainIds.
*/
getChainIds(): number[] {
return Object.keys(this.spokePoolClients).map(Number);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this I prefer using the chainId member of the SpokePoolClient instance itself.

Suggested change
return Object.keys(this.spokePoolClients).map(Number);
return Object.values(this.spokePoolClients).map({ chainId } => chainId);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am okey with that, but is there case where that can be different?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}