Skip to content

Commit

Permalink
add getTotalAmountReceivedByPoolMember to sdk-core
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparkallas committed Mar 20, 2024
1 parent 2b90dce commit e32279b
Show file tree
Hide file tree
Showing 4 changed files with 257 additions and 412 deletions.
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

0 comments on commit e32279b

Please sign in to comment.