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

[sdk-core] add getTotalAmountReceivedByPoolMember #1902

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
3 changes: 3 additions & 0 deletions packages/sdk-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Added
- Added `getTotalAmountReceivedByMember`

### Changed
- Map the name from subgraph to an unknown event, instead of "\_Unknown".
- Don't lock metadata version to a specific version, use semver (^).
Expand Down
26 changes: 26 additions & 0 deletions packages/sdk-core/src/SuperfluidPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
GetClaimableParams,
GetDisconnectedBalanceParams,
GetMemberFlowRateParams,
GetTotalAmountReceivedByMemberParams,
GetUnitsParams,
SuperfluidPoolDecreaseAllowanceParams,
SuperfluidPoolIncreaseAllowanceParams,
Expand Down Expand Up @@ -236,6 +237,31 @@ export default class SuperfluidPoolClass {
}
};

/**
* Retrieves the flow rate for a specific member.
* @param member The member's address.
* @param providerOrSigner A provider or signer object
* @returns The total amount received by the member.
*/
getTotalAmountReceivedByMember = async (
params: GetTotalAmountReceivedByMemberParams
): Promise<string> => {
try {
return (
await this.contract
.connect(params.providerOrSigner)
.getTotalAmountReceivedByMember(params.member)
).toString();
} catch (err) {
throw new SFError({
type: "SUPERFLUID_POOL_READ",
message:
"There was an error getting the total amount received by member.",
cause: err,
});
}
};

/**
* Retrieves the claimable amount for a specific member and time.
* @param member The member's address.
Expand Down
5 changes: 5 additions & 0 deletions packages/sdk-core/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,11 @@ export interface GetMemberFlowRateParams {
readonly providerOrSigner: ethers.providers.Provider | ethers.Signer;
}

export interface GetTotalAmountReceivedByMemberParams {
readonly member: string;
readonly providerOrSigner: ethers.providers.Provider | ethers.Signer;
}

export interface ClaimAllForMemberParams {
readonly member: string;
readonly signer: ethers.Signer;
Expand Down
Loading
Loading