@streamflow/distributor 7.4.0 → 7.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -163,8 +163,8 @@ class BaseDistributorClient {
163
163
  program: this.programId,
164
164
  };
165
165
  const closeClaimArgs = {
166
- amountLocked: new bn_js_1.default(data.amountLocked),
167
- amountUnlocked: new bn_js_1.default(data.amountUnlocked),
166
+ amountLocked: data.amountLocked ? new bn_js_1.default(data.amountLocked) : undefined,
167
+ amountUnlocked: data.amountUnlocked ? new bn_js_1.default(data.amountUnlocked) : undefined,
168
168
  proof: data.proof,
169
169
  };
170
170
  ixs.push((0, closeClaim_1.closeClaim)(closeClaimArgs, closeClaimAccounts, this.programId));
@@ -47,9 +47,9 @@ function closeClaim(args, accounts, programId = programId_1.PROGRAM_ID) {
47
47
  const identifier = buffer_1.Buffer.from([42, 177, 165, 35, 213, 179, 211, 19]);
48
48
  const buffer = buffer_1.Buffer.alloc(1000);
49
49
  const len = exports.layout.encode({
50
- amountUnlocked: args.amountUnlocked,
51
- amountLocked: args.amountLocked,
52
- proof: args.proof,
50
+ amountUnlocked: args.amountUnlocked ?? null,
51
+ amountLocked: args.amountLocked ?? null,
52
+ proof: args.proof ?? null,
53
53
  }, buffer);
54
54
  const data = buffer_1.Buffer.concat([identifier, buffer]).slice(0, 8 + len);
55
55
  const ix = new web3_js_1.TransactionInstruction({ keys, programId, data });
@@ -95,8 +95,8 @@ function newDistributor(args, accounts, programId = programId_1.PROGRAM_ID) {
95
95
  canUpdateDuration: null,
96
96
  totalAmountUnlocked: null,
97
97
  totalAmountLocked: null,
98
- claimsClosableByClaimant: args.claimsClosableByClaimant,
99
- claimsLimit: args.claimsLimit,
98
+ claimsClosableByClaimant: args.claimsClosableByClaimant ?? null,
99
+ claimsLimit: args.claimsLimit ?? null,
100
100
  }, buffer);
101
101
  const data = buffer_1.Buffer.concat([identifier, buffer]).slice(0, 8 + len);
102
102
  const ix = new web3_js_1.TransactionInstruction({ keys, programId, data });
@@ -162,8 +162,8 @@ export default class BaseDistributorClient {
162
162
  program: this.programId,
163
163
  };
164
164
  const closeClaimArgs = {
165
- amountLocked: new BN(data.amountLocked),
166
- amountUnlocked: new BN(data.amountUnlocked),
165
+ amountLocked: data.amountLocked ? new BN(data.amountLocked) : undefined,
166
+ amountUnlocked: data.amountUnlocked ? new BN(data.amountUnlocked) : undefined,
167
167
  proof: data.proof,
168
168
  };
169
169
  ixs.push(closeClaim(closeClaimArgs, closeClaimAccounts, this.programId));
@@ -20,9 +20,9 @@ export function closeClaim(args, accounts, programId = PROGRAM_ID) {
20
20
  const identifier = Buffer.from([42, 177, 165, 35, 213, 179, 211, 19]);
21
21
  const buffer = Buffer.alloc(1000);
22
22
  const len = layout.encode({
23
- amountUnlocked: args.amountUnlocked,
24
- amountLocked: args.amountLocked,
25
- proof: args.proof,
23
+ amountUnlocked: args.amountUnlocked ?? null,
24
+ amountLocked: args.amountLocked ?? null,
25
+ proof: args.proof ?? null,
26
26
  }, buffer);
27
27
  const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len);
28
28
  const ix = new TransactionInstruction({ keys, programId, data });
@@ -10,8 +10,8 @@ export interface NewDistributorArgs {
10
10
  endVestingTs: BN;
11
11
  clawbackStartTs: BN;
12
12
  claimsClosableByAdmin: boolean;
13
- claimsClosableByClaimant?: boolean;
14
- claimsLimit?: number;
13
+ claimsClosableByClaimant?: boolean | null;
14
+ claimsLimit?: number | null;
15
15
  }
16
16
  export interface NewDistributorAccounts {
17
17
  /** [MerkleDistributor]. */
@@ -68,8 +68,8 @@ export function newDistributor(args, accounts, programId = PROGRAM_ID) {
68
68
  canUpdateDuration: null,
69
69
  totalAmountUnlocked: null,
70
70
  totalAmountLocked: null,
71
- claimsClosableByClaimant: args.claimsClosableByClaimant,
72
- claimsLimit: args.claimsLimit,
71
+ claimsClosableByClaimant: args.claimsClosableByClaimant ?? null,
72
+ claimsLimit: args.claimsLimit ?? null,
73
73
  }, buffer);
74
74
  const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len);
75
75
  const ix = new TransactionInstruction({ keys, programId, data });
@@ -69,7 +69,8 @@ export interface IClaimData {
69
69
  amountLocked: BN;
70
70
  proof: Array<Array<number>>;
71
71
  }
72
- export interface ICloseClaimData extends IClaimData {
72
+ export interface ICloseClaimData extends Partial<Omit<IClaimData, "id">> {
73
+ id: string;
73
74
  claimant: string | PublicKey;
74
75
  }
75
76
  export interface IClawbackData {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/distributor",
3
- "version": "7.4.0",
3
+ "version": "7.4.1",
4
4
  "description": "JavaScript SDK to interact with Streamflow Airdrop protocol.",
5
5
  "homepage": "https://github.com/streamflow-finance/js-sdk/",
6
6
  "main": "dist/esm/index.js",
@@ -26,9 +26,9 @@
26
26
  "lint": "eslint --fix .",
27
27
  "prepublishOnly": "npm run lint && npm run build"
28
28
  },
29
- "gitHead": "7c307d2f70d9af073ceab20597865394295a459b",
29
+ "gitHead": "cb4f1c8472b358d5fcd2591e2d40932e7980a4af",
30
30
  "devDependencies": {
31
- "@streamflow/eslint-config": "7.4.0",
31
+ "@streamflow/eslint-config": "7.4.1",
32
32
  "@types/bn.js": "5.1.1",
33
33
  "date-fns": "2.28.0",
34
34
  "typescript": "^5.6.3"
@@ -40,7 +40,7 @@
40
40
  "@solana/spl-token": "0.4.9",
41
41
  "@solana/wallet-adapter-base": "0.9.19",
42
42
  "@solana/web3.js": "1.95.4",
43
- "@streamflow/common": "7.4.0",
43
+ "@streamflow/common": "7.4.1",
44
44
  "bn.js": "5.2.1",
45
45
  "borsh": "^2.0.0",
46
46
  "bs58": "5.0.0",