-
Couldn't load subscription status.
- Fork 24
feat: Add more functionalities to SpokePoolManager #1258
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||||||
|
|
@@ -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); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Retrieves all SpokePoolClient chainIds | ||||||
| * @returns number[] | ||||||
| * @note This method returns all SpokePoolClient chainIds. | ||||||
| */ | ||||||
| getChainIds(): number[] { | ||||||
| return Object.keys(this.spokePoolClients).map(Number); | ||||||
|
||||||
| return Object.keys(this.spokePoolClients).map(Number); | |
| return Object.values(this.spokePoolClients).map({ chainId } => chainId); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0a4259e