Skip to content

Commit

Permalink
Claim limit fixes - optional params (#255)
Browse files Browse the repository at this point in the history
* address PR comments

* fix comment

* make close claim data parameters optional

* fix passing undefined to newDistributor

* remove leftover console logs

* fix for closeClaim optionals as well
  • Loading branch information
tatomir-streamflow authored Jan 29, 2025
1 parent 7c307d2 commit 074fa58
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/common",
"version": "7.4.0",
"version": "7.4.1",
"description": "Common utilities and types used by streamflow packages.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "./dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/distributor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/distributor",
"version": "7.4.0",
"version": "7.4.1",
"description": "JavaScript SDK to interact with Streamflow Airdrop protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/esm/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/distributor/solana/clients/BaseDistributorClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ export default abstract class BaseDistributorClient {
};

const closeClaimArgs: CloseClaimArgs = {
amountLocked: new BN(data.amountLocked),
amountUnlocked: new BN(data.amountUnlocked),
amountLocked: data.amountLocked ? new BN(data.amountLocked) : undefined,
amountUnlocked: data.amountUnlocked ? new BN(data.amountUnlocked) : undefined,
proof: data.proof,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export function closeClaim(args: CloseClaimArgs, accounts: CloseClaimAccounts, p
const buffer = Buffer.alloc(1000);
const len = layout.encode(
{
amountUnlocked: args.amountUnlocked,
amountLocked: args.amountLocked,
proof: args.proof,
amountUnlocked: args.amountUnlocked ?? null,
amountLocked: args.amountLocked ?? null,
proof: args.proof ?? null,
},
buffer,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export interface NewDistributorArgs {
endVestingTs: BN;
clawbackStartTs: BN;
claimsClosableByAdmin: boolean;
claimsClosableByClaimant?: boolean;
claimsLimit?: number;
claimsClosableByClaimant?: boolean | null;
claimsLimit?: number | null;
}

export interface NewDistributorAccounts {
Expand Down Expand Up @@ -113,8 +113,8 @@ export function newDistributor(
canUpdateDuration: null,
totalAmountUnlocked: null,
totalAmountLocked: null,
claimsClosableByClaimant: args.claimsClosableByClaimant,
claimsLimit: args.claimsLimit,
claimsClosableByClaimant: args.claimsClosableByClaimant ?? null,
claimsLimit: args.claimsLimit ?? null,
},
buffer,
);
Expand Down
3 changes: 2 additions & 1 deletion packages/distributor/solana/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ export interface IClaimData {
proof: Array<Array<number>>;
}

export interface ICloseClaimData extends IClaimData {
export interface ICloseClaimData extends Partial<Omit<IClaimData, "id">> {
id: string;
claimant: string | PublicKey;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/eslint-config",
"version": "7.4.0",
"version": "7.4.1",
"license": "ISC",
"main": "index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/launchpad/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/launchpad",
"version": "7.4.0",
"version": "7.4.1",
"description": "JavaScript SDK to interact with Streamflow Launchpad protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/staking/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/staking",
"version": "7.4.0",
"version": "7.4.1",
"description": "JavaScript SDK to interact with Streamflow Staking protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/stream/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/stream",
"version": "7.4.0",
"version": "7.4.1",
"description": "JavaScript SDK to interact with Streamflow protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "./dist/esm/index.js",
Expand Down

0 comments on commit 074fa58

Please sign in to comment.