Skip to content
Open
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.3.74",
"version": "4.3.75",
"license": "AGPL-3.0",
"homepage": "https://docs.across.to/reference/sdk",
"files": [
Expand Down
21 changes: 21 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,24 @@ export class SpokePoolManager {
getSpokePoolClients(): { [chainId: number]: SpokePoolClient } {
return this.spokePoolClients;
}

/**
* Retrieves all SpokePoolClient Addresses mapped by chainId
* @returns { [chainId: number]: Address | undefined }
* @note This method returns all SpokePoolClient Addresses mapped by their chainId.
*/
getSpokePoolAddresses(): { [chainId: number]: Address | undefined } {
return Object.fromEntries(
Object.entries(this.spokePoolClients).map(([chainId, client]) => [chainId, 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.values(this.spokePoolClients).map((client) => client.chainId);
}
}