From 074fa58ebaca40c7104751a36b3106ed07deaddc Mon Sep 17 00:00:00 2001 From: Tatomir Date: Wed, 29 Jan 2025 16:14:24 +0100 Subject: [PATCH] Claim limit fixes - optional params (#255) * 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 --- packages/common/package.json | 2 +- packages/distributor/package.json | 2 +- .../distributor/solana/clients/BaseDistributorClient.ts | 4 ++-- .../solana/generated/instructions/closeClaim.ts | 6 +++--- .../solana/generated/instructions/newDistributor.ts | 8 ++++---- packages/distributor/solana/types.ts | 3 ++- packages/eslint-config/package.json | 2 +- packages/launchpad/package.json | 2 +- packages/staking/package.json | 2 +- packages/stream/package.json | 2 +- 10 files changed, 17 insertions(+), 16 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index c189a8f..77c6869 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -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", diff --git a/packages/distributor/package.json b/packages/distributor/package.json index 76e9e26..827862b 100644 --- a/packages/distributor/package.json +++ b/packages/distributor/package.json @@ -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", diff --git a/packages/distributor/solana/clients/BaseDistributorClient.ts b/packages/distributor/solana/clients/BaseDistributorClient.ts index 44cae6a..6c688c2 100644 --- a/packages/distributor/solana/clients/BaseDistributorClient.ts +++ b/packages/distributor/solana/clients/BaseDistributorClient.ts @@ -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, }; diff --git a/packages/distributor/solana/generated/instructions/closeClaim.ts b/packages/distributor/solana/generated/instructions/closeClaim.ts index 72933dc..6997c7e 100644 --- a/packages/distributor/solana/generated/instructions/closeClaim.ts +++ b/packages/distributor/solana/generated/instructions/closeClaim.ts @@ -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, ); diff --git a/packages/distributor/solana/generated/instructions/newDistributor.ts b/packages/distributor/solana/generated/instructions/newDistributor.ts index 5636264..f9b176e 100644 --- a/packages/distributor/solana/generated/instructions/newDistributor.ts +++ b/packages/distributor/solana/generated/instructions/newDistributor.ts @@ -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 { @@ -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, ); diff --git a/packages/distributor/solana/types.ts b/packages/distributor/solana/types.ts index 9cef9de..66aba0c 100644 --- a/packages/distributor/solana/types.ts +++ b/packages/distributor/solana/types.ts @@ -81,7 +81,8 @@ export interface IClaimData { proof: Array>; } -export interface ICloseClaimData extends IClaimData { +export interface ICloseClaimData extends Partial> { + id: string; claimant: string | PublicKey; } diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 641f01f..8ebd288 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -1,6 +1,6 @@ { "name": "@streamflow/eslint-config", - "version": "7.4.0", + "version": "7.4.1", "license": "ISC", "main": "index.js", "files": [ diff --git a/packages/launchpad/package.json b/packages/launchpad/package.json index 1653ede..cf70873 100644 --- a/packages/launchpad/package.json +++ b/packages/launchpad/package.json @@ -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", diff --git a/packages/staking/package.json b/packages/staking/package.json index 40f9fe7..c0cd474 100644 --- a/packages/staking/package.json +++ b/packages/staking/package.json @@ -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", diff --git a/packages/stream/package.json b/packages/stream/package.json index c8a915d..bc541e7 100644 --- a/packages/stream/package.json +++ b/packages/stream/package.json @@ -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",