@streamflow/distributor 7.3.3 → 7.4.0

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.
Files changed (25) hide show
  1. package/dist/cjs/solana/clients/BaseDistributorClient.js +44 -1
  2. package/dist/cjs/solana/clients/SolanaAlignedDistributorClient.js +9 -1
  3. package/dist/cjs/solana/descriptor/idl/aligned_distributor.json +103 -423
  4. package/dist/cjs/solana/generated/accounts/ClaimStatus.js +11 -1
  5. package/dist/cjs/solana/generated/accounts/MerkleDistributor.js +16 -6
  6. package/dist/cjs/solana/generated/errors/custom.js +66 -1
  7. package/dist/cjs/solana/generated/instructions/closeClaim.js +39 -3
  8. package/dist/cjs/solana/generated/instructions/newDistributor.js +3 -3
  9. package/dist/esm/solana/clients/BaseDistributorClient.d.ts +3 -1
  10. package/dist/esm/solana/clients/BaseDistributorClient.js +45 -2
  11. package/dist/esm/solana/clients/SolanaAlignedDistributorClient.js +9 -1
  12. package/dist/esm/solana/descriptor/aligned_distributor.d.ts +13 -3
  13. package/dist/esm/solana/descriptor/idl/aligned_distributor.json +103 -423
  14. package/dist/esm/solana/generated/accounts/ClaimStatus.d.ts +12 -0
  15. package/dist/esm/solana/generated/accounts/ClaimStatus.js +15 -1
  16. package/dist/esm/solana/generated/accounts/MerkleDistributor.d.ts +15 -3
  17. package/dist/esm/solana/generated/accounts/MerkleDistributor.js +21 -7
  18. package/dist/esm/solana/generated/errors/custom.d.ts +41 -1
  19. package/dist/esm/solana/generated/errors/custom.js +65 -0
  20. package/dist/esm/solana/generated/instructions/closeClaim.d.ts +9 -2
  21. package/dist/esm/solana/generated/instructions/closeClaim.js +15 -3
  22. package/dist/esm/solana/generated/instructions/newDistributor.d.ts +3 -1
  23. package/dist/esm/solana/generated/instructions/newDistributor.js +3 -3
  24. package/dist/esm/solana/types.d.ts +7 -2
  25. package/package.json +4 -4
@@ -42,6 +42,8 @@ class ClaimStatus {
42
42
  this.lastAmountPerUnlock = fields.lastAmountPerUnlock;
43
43
  this.closed = fields.closed;
44
44
  this.distributor = fields.distributor;
45
+ this.claimsCount = fields.claimsCount;
46
+ this.closedTs = fields.closedTs;
45
47
  this.buffer2 = fields.buffer2;
46
48
  }
47
49
  static async fetch(c, address, programId = programId_1.PROGRAM_ID) {
@@ -80,6 +82,8 @@ class ClaimStatus {
80
82
  lastAmountPerUnlock: dec.lastAmountPerUnlock,
81
83
  closed: dec.closed,
82
84
  distributor: dec.distributor,
85
+ claimsCount: dec.claimsCount,
86
+ closedTs: dec.closedTs,
83
87
  buffer2: dec.buffer2,
84
88
  });
85
89
  }
@@ -93,6 +97,8 @@ class ClaimStatus {
93
97
  lastAmountPerUnlock: this.lastAmountPerUnlock.toString(),
94
98
  closed: this.closed,
95
99
  distributor: this.distributor.toString(),
100
+ claimsCount: this.claimsCount,
101
+ closedTs: this.closedTs.toString(),
96
102
  buffer2: this.buffer2,
97
103
  };
98
104
  }
@@ -106,6 +112,8 @@ class ClaimStatus {
106
112
  lastAmountPerUnlock: new bn_js_1.default(obj.lastAmountPerUnlock),
107
113
  closed: obj.closed,
108
114
  distributor: new web3_js_1.PublicKey(obj.distributor),
115
+ claimsCount: obj.claimsCount,
116
+ closedTs: new bn_js_1.default(obj.closedTs),
109
117
  buffer2: obj.buffer2,
110
118
  });
111
119
  }
@@ -121,5 +129,7 @@ ClaimStatus.layout = borsh.struct([
121
129
  borsh.u64("lastAmountPerUnlock"),
122
130
  borsh.bool("closed"),
123
131
  borsh.publicKey("distributor"),
124
- borsh.array(borsh.u8(), 32, "buffer2"),
132
+ borsh.u16("claimsCount"),
133
+ borsh.u64("closedTs"),
134
+ borsh.array(borsh.u8(), 22, "buffer2"),
125
135
  ]);
@@ -50,13 +50,15 @@ class MerkleDistributor {
50
50
  this.clawbackReceiver = fields.clawbackReceiver;
51
51
  this.admin = fields.admin;
52
52
  this.clawedBack = fields.clawedBack;
53
- this.claimsClosable = fields.claimsClosable;
53
+ this.claimsClosableByAdmin = fields.claimsClosableByAdmin;
54
54
  this.canUpdateDuration = fields.canUpdateDuration;
55
55
  this.totalAmountUnlocked = fields.totalAmountUnlocked;
56
56
  this.totalAmountLocked = fields.totalAmountLocked;
57
57
  this.lastDurationUpdateTs = fields.lastDurationUpdateTs;
58
58
  this.totalClaimablePreUpdate = fields.totalClaimablePreUpdate;
59
59
  this.clawedBackTs = fields.clawedBackTs;
60
+ this.claimsClosableByClaimant = fields.claimsClosableByClaimant;
61
+ this.claimsLimit = fields.claimsLimit;
60
62
  this.buffer2 = fields.buffer2;
61
63
  this.buffer3 = fields.buffer3;
62
64
  }
@@ -104,13 +106,15 @@ class MerkleDistributor {
104
106
  clawbackReceiver: dec.clawbackReceiver,
105
107
  admin: dec.admin,
106
108
  clawedBack: dec.clawedBack,
107
- claimsClosable: dec.claimsClosable,
109
+ claimsClosableByAdmin: dec.claimsClosableByAdmin,
108
110
  canUpdateDuration: dec.canUpdateDuration,
109
111
  totalAmountUnlocked: dec.totalAmountUnlocked,
110
112
  totalAmountLocked: dec.totalAmountLocked,
111
113
  lastDurationUpdateTs: dec.lastDurationUpdateTs,
112
114
  totalClaimablePreUpdate: dec.totalClaimablePreUpdate,
113
115
  clawedBackTs: dec.clawedBackTs,
116
+ claimsClosableByClaimant: dec.claimsClosableByClaimant,
117
+ claimsLimit: dec.claimsLimit,
114
118
  buffer2: dec.buffer2,
115
119
  buffer3: dec.buffer3,
116
120
  });
@@ -133,13 +137,15 @@ class MerkleDistributor {
133
137
  clawbackReceiver: this.clawbackReceiver.toString(),
134
138
  admin: this.admin.toString(),
135
139
  clawedBack: this.clawedBack,
136
- claimsClosable: this.claimsClosable,
140
+ claimsClosableByAdmin: this.claimsClosableByAdmin,
137
141
  canUpdateDuration: this.canUpdateDuration,
138
142
  totalAmountUnlocked: this.totalAmountUnlocked.toString(),
139
143
  totalAmountLocked: this.totalAmountLocked.toString(),
140
144
  lastDurationUpdateTs: this.lastDurationUpdateTs.toString(),
141
145
  totalClaimablePreUpdate: this.totalClaimablePreUpdate.toString(),
142
146
  clawedBackTs: this.clawedBackTs.toString(),
147
+ claimsClosableByClaimant: this.claimsClosableByClaimant,
148
+ claimsLimit: this.claimsLimit,
143
149
  buffer2: this.buffer2,
144
150
  buffer3: this.buffer3,
145
151
  };
@@ -162,13 +168,15 @@ class MerkleDistributor {
162
168
  clawbackReceiver: new web3_js_1.PublicKey(obj.clawbackReceiver),
163
169
  admin: new web3_js_1.PublicKey(obj.admin),
164
170
  clawedBack: obj.clawedBack,
165
- claimsClosable: obj.claimsClosable,
171
+ claimsClosableByAdmin: obj.claimsClosableByAdmin,
166
172
  canUpdateDuration: obj.canUpdateDuration,
167
173
  totalAmountUnlocked: new bn_js_1.default(obj.totalAmountUnlocked),
168
174
  totalAmountLocked: new bn_js_1.default(obj.totalAmountLocked),
169
175
  lastDurationUpdateTs: new bn_js_1.default(obj.lastDurationUpdateTs),
170
176
  totalClaimablePreUpdate: new bn_js_1.default(obj.totalClaimablePreUpdate),
171
177
  clawedBackTs: new bn_js_1.default(obj.clawedBackTs),
178
+ claimsClosableByClaimant: obj.claimsClosableByClaimant,
179
+ claimsLimit: obj.claimsLimit,
172
180
  buffer2: obj.buffer2,
173
181
  buffer3: obj.buffer3,
174
182
  });
@@ -193,13 +201,15 @@ MerkleDistributor.layout = borsh.struct([
193
201
  borsh.publicKey("clawbackReceiver"),
194
202
  borsh.publicKey("admin"),
195
203
  borsh.bool("clawedBack"),
196
- borsh.bool("claimsClosable"),
204
+ borsh.bool("claimsClosableByAdmin"),
197
205
  borsh.bool("canUpdateDuration"),
198
206
  borsh.u64("totalAmountUnlocked"),
199
207
  borsh.u64("totalAmountLocked"),
200
208
  borsh.u64("lastDurationUpdateTs"),
201
209
  borsh.u64("totalClaimablePreUpdate"),
202
210
  borsh.u64("clawedBackTs"),
203
- borsh.array(borsh.u8(), 23, "buffer2"),
211
+ borsh.bool("claimsClosableByClaimant"),
212
+ borsh.u16("claimsLimit"),
213
+ borsh.array(borsh.u8(), 20, "buffer2"),
204
214
  borsh.array(borsh.u8(), 32, "buffer3"),
205
215
  ]);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InvalidUnlockPeriod = exports.ClaimsAreNotClosable = exports.ClaimIsClosed = exports.InvalidMint = exports.TimestampsNotInFuture = exports.StartTimestampAfterEnd = exports.ArithmeticError = exports.ClaimExpired = exports.SameAdmin = exports.ClawbackReceiverIsTokenVault = exports.SameClawbackReceiver = exports.ClawbackAlreadyClaimed = exports.ClawbackBeforeStart = exports.OwnerMismatch = exports.Unauthorized = exports.MaxNodesExceeded = exports.ExceededMaxClaim = exports.InvalidProof = exports.InsufficientUnlockedTokens = void 0;
3
+ exports.ClaimsLimitReached = exports.InvalidAmounts = exports.VestingAlreadyFinished = exports.NoVestingAmount = exports.DurationUpdateNotAllowed = exports.InvalidUnlockPeriod = exports.ClaimsAreNotClosable = exports.ClaimIsClosed = exports.InvalidMint = exports.TimestampsNotInFuture = exports.StartTimestampAfterEnd = exports.ArithmeticError = exports.ClaimExpired = exports.SameAdmin = exports.ClawbackReceiverIsTokenVault = exports.SameClawbackReceiver = exports.ClawbackAlreadyClaimed = exports.ClawbackBeforeStart = exports.OwnerMismatch = exports.Unauthorized = exports.MaxNodesExceeded = exports.ExceededMaxClaim = exports.InvalidProof = exports.InsufficientUnlockedTokens = void 0;
4
4
  exports.fromCode = fromCode;
5
5
  class InsufficientUnlockedTokens extends Error {
6
6
  constructor(logs) {
@@ -211,6 +211,61 @@ class InvalidUnlockPeriod extends Error {
211
211
  }
212
212
  exports.InvalidUnlockPeriod = InvalidUnlockPeriod;
213
213
  InvalidUnlockPeriod.code = 6018;
214
+ class DurationUpdateNotAllowed extends Error {
215
+ constructor(logs) {
216
+ super("6019: Duration update is not allowed");
217
+ this.logs = logs;
218
+ this.code = 6019;
219
+ this.name = "DurationUpdateNotAllowed";
220
+ this.msg = "Duration update is not allowed";
221
+ }
222
+ }
223
+ exports.DurationUpdateNotAllowed = DurationUpdateNotAllowed;
224
+ DurationUpdateNotAllowed.code = 6019;
225
+ class NoVestingAmount extends Error {
226
+ constructor(logs) {
227
+ super("6020: Vesting amounts are not set");
228
+ this.logs = logs;
229
+ this.code = 6020;
230
+ this.name = "NoVestingAmount";
231
+ this.msg = "Vesting amounts are not set";
232
+ }
233
+ }
234
+ exports.NoVestingAmount = NoVestingAmount;
235
+ NoVestingAmount.code = 6020;
236
+ class VestingAlreadyFinished extends Error {
237
+ constructor(logs) {
238
+ super("6021: Vesting already finished");
239
+ this.logs = logs;
240
+ this.code = 6021;
241
+ this.name = "VestingAlreadyFinished";
242
+ this.msg = "Vesting already finished";
243
+ }
244
+ }
245
+ exports.VestingAlreadyFinished = VestingAlreadyFinished;
246
+ VestingAlreadyFinished.code = 6021;
247
+ class InvalidAmounts extends Error {
248
+ constructor(logs) {
249
+ super("6022: Provided amounts are invalid");
250
+ this.logs = logs;
251
+ this.code = 6022;
252
+ this.name = "InvalidAmounts";
253
+ this.msg = "Provided amounts are invalid";
254
+ }
255
+ }
256
+ exports.InvalidAmounts = InvalidAmounts;
257
+ InvalidAmounts.code = 6022;
258
+ class ClaimsLimitReached extends Error {
259
+ constructor(logs) {
260
+ super("6023: Claims limit has been reached");
261
+ this.logs = logs;
262
+ this.code = 6023;
263
+ this.name = "ClaimsLimitReached";
264
+ this.msg = "Claims limit has been reached";
265
+ }
266
+ }
267
+ exports.ClaimsLimitReached = ClaimsLimitReached;
268
+ ClaimsLimitReached.code = 6023;
214
269
  function fromCode(code, logs) {
215
270
  switch (code) {
216
271
  case 6000:
@@ -251,6 +306,16 @@ function fromCode(code, logs) {
251
306
  return new ClaimsAreNotClosable(logs);
252
307
  case 6018:
253
308
  return new InvalidUnlockPeriod(logs);
309
+ case 6019:
310
+ return new DurationUpdateNotAllowed(logs);
311
+ case 6020:
312
+ return new NoVestingAmount(logs);
313
+ case 6021:
314
+ return new VestingAlreadyFinished(logs);
315
+ case 6022:
316
+ return new InvalidAmounts(logs);
317
+ case 6023:
318
+ return new ClaimsLimitReached(logs);
254
319
  }
255
320
  return null;
256
321
  }
@@ -1,13 +1,43 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.layout = void 0;
3
27
  exports.closeClaim = closeClaim;
4
28
  const web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
29
+ const borsh = __importStar(require("@coral-xyz/borsh")); // eslint-disable-line @typescript-eslint/no-unused-vars
5
30
  const buffer_1 = require("buffer");
6
31
  const programId_1 = require("../programId");
7
- function closeClaim(accounts, programId = programId_1.PROGRAM_ID) {
32
+ exports.layout = borsh.struct([
33
+ borsh.option(borsh.u64(), "amountUnlocked"),
34
+ borsh.option(borsh.u64(), "amountLocked"),
35
+ borsh.option(borsh.vec(borsh.array(borsh.u8(), 32)), "proof"),
36
+ ]);
37
+ function closeClaim(args, accounts, programId = programId_1.PROGRAM_ID) {
8
38
  const keys = [
9
39
  { pubkey: accounts.distributor, isSigner: false, isWritable: true },
10
- { pubkey: accounts.admin, isSigner: true, isWritable: true },
40
+ { pubkey: accounts.adminOrClaimant, isSigner: true, isWritable: true },
11
41
  { pubkey: accounts.claimant, isSigner: false, isWritable: false },
12
42
  { pubkey: accounts.claimStatus, isSigner: false, isWritable: true },
13
43
  { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
@@ -15,7 +45,13 @@ function closeClaim(accounts, programId = programId_1.PROGRAM_ID) {
15
45
  { pubkey: accounts.program, isSigner: false, isWritable: false },
16
46
  ];
17
47
  const identifier = buffer_1.Buffer.from([42, 177, 165, 35, 213, 179, 211, 19]);
18
- const data = identifier;
48
+ const buffer = buffer_1.Buffer.alloc(1000);
49
+ const len = exports.layout.encode({
50
+ amountUnlocked: args.amountUnlocked,
51
+ amountLocked: args.amountLocked,
52
+ proof: args.proof,
53
+ }, buffer);
54
+ const data = buffer_1.Buffer.concat([identifier, buffer]).slice(0, 8 + len);
19
55
  const ix = new web3_js_1.TransactionInstruction({ keys, programId, data });
20
56
  return ix;
21
57
  }
@@ -91,12 +91,12 @@ function newDistributor(args, accounts, programId = programId_1.PROGRAM_ID) {
91
91
  startVestingTs: args.startVestingTs,
92
92
  endVestingTs: args.endVestingTs,
93
93
  clawbackStartTs: args.clawbackStartTs,
94
- claimsClosableByAdmin: args.claimsClosable,
94
+ claimsClosableByAdmin: args.claimsClosableByAdmin,
95
95
  canUpdateDuration: null,
96
96
  totalAmountUnlocked: null,
97
97
  totalAmountLocked: null,
98
- claimsClosableByClaimant: null,
99
- claimsLimit: null,
98
+ claimsClosableByClaimant: args.claimsClosableByClaimant,
99
+ claimsLimit: args.claimsLimit,
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 });
@@ -2,7 +2,7 @@ import PQueue from "p-queue";
2
2
  import { Connection, PublicKey, TransactionInstruction, Commitment, ConnectionConfig } from "@solana/web3.js";
3
3
  import { ICluster, ITransactionResult } from "@streamflow/common";
4
4
  import { IProgramAccount } from "@streamflow/common/solana";
5
- import { IClaimData, IClawbackData, ICreateDistributorResult, IGetClaimData, IGetDistributors, ICreateSolanaExt, IInteractSolanaExt, ICreateDistributorData, ICreateAlignedDistributorData, ISearchDistributors } from "../types";
5
+ import { IClaimData, IClawbackData, ICreateDistributorResult, IGetClaimData, IGetDistributors, ICreateSolanaExt, IInteractSolanaExt, ICreateDistributorData, ICreateAlignedDistributorData, ISearchDistributors, ICloseClaimData } from "../types";
6
6
  import { ClawbackAccounts, NewDistributorAccounts, NewDistributorArgs } from "../generated/instructions";
7
7
  import { ClaimStatus, MerkleDistributor } from "../generated/accounts";
8
8
  export interface IInitOptions {
@@ -30,6 +30,8 @@ export default abstract class BaseDistributorClient {
30
30
  create(data: ICreateDistributorData | ICreateAlignedDistributorData, extParams: ICreateSolanaExt): Promise<ICreateDistributorResult>;
31
31
  claim(data: IClaimData, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
32
32
  prepareClaimInstructions(data: IClaimData, extParams: IInteractSolanaExt): Promise<TransactionInstruction[]>;
33
+ closeClaim(data: ICloseClaimData, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
34
+ prepareCloseClaimInstructions(data: ICloseClaimData, extParams: IInteractSolanaExt): Promise<TransactionInstruction[]>;
33
35
  prepareClawbackInstructions(data: IClawbackData, extParams: IInteractSolanaExt): Promise<TransactionInstruction[]>;
34
36
  clawback(data: IClawbackData, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
35
37
  getClaims(data: IGetClaimData[]): Promise<(ClaimStatus | null)[]>;
@@ -1,13 +1,14 @@
1
1
  import BN from "bn.js";
2
2
  import { Connection, PublicKey, SystemProgram, } from "@solana/web3.js";
3
3
  import { ICluster } from "@streamflow/common";
4
- import { ata, checkOrCreateAtaBatch, prepareBaseInstructions, prepareTransaction, getMintAndProgram, buildSendThrottler, prepareWrappedAccount, } from "@streamflow/common/solana";
4
+ import { ata, checkOrCreateAtaBatch, prepareBaseInstructions, prepareTransaction, getMintAndProgram, buildSendThrottler, prepareWrappedAccount, pk, } from "@streamflow/common/solana";
5
5
  import { ASSOCIATED_TOKEN_PROGRAM_ID, createTransferCheckedInstruction, createTransferCheckedWithFeeInstruction, getTransferFeeConfig, NATIVE_MINT, } from "@solana/spl-token";
6
6
  import bs58 from "bs58";
7
7
  import { DISTRIBUTOR_ADMIN_OFFSET, DISTRIBUTOR_MINT_OFFSET, DISTRIBUTOR_PROGRAM_ID } from "../constants";
8
8
  import { claimLocked, newClaim, } from "../generated/instructions";
9
9
  import { ClaimStatus, MerkleDistributor } from "../generated/accounts";
10
10
  import { calculateAmountWithTransferFees, getClaimantStatusPda, getDistributorPda, getEventAuthorityPda, wrappedSignAndExecuteTransaction, } from "../utils";
11
+ import { closeClaim } from "../generated/instructions/closeClaim";
11
12
  export default class BaseDistributorClient {
12
13
  connection;
13
14
  programId;
@@ -128,6 +129,46 @@ export default class BaseDistributorClient {
128
129
  }
129
130
  return ixs;
130
131
  }
132
+ async closeClaim(data, extParams) {
133
+ const ixs = await this.prepareCloseClaimInstructions(data, extParams);
134
+ const { tx, hash, context } = await prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
135
+ const signature = await wrappedSignAndExecuteTransaction(this.connection, extParams.invoker, tx, {
136
+ hash,
137
+ context,
138
+ commitment: this.getCommitment(),
139
+ }, { sendThrottler: this.sendThrottler });
140
+ return { ixs, txId: signature };
141
+ }
142
+ async prepareCloseClaimInstructions(data, extParams) {
143
+ if (!extParams.invoker.publicKey) {
144
+ throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
145
+ }
146
+ const distributorPublicKey = new PublicKey(data.id);
147
+ const distributor = await MerkleDistributor.fetch(this.connection, distributorPublicKey);
148
+ const claimantPublicKey = pk(data.claimant);
149
+ if (!distributor) {
150
+ throw new Error("Couldn't get distributor account info");
151
+ }
152
+ const ixs = prepareBaseInstructions(this.connection, extParams);
153
+ const claimStatusPublicKey = getClaimantStatusPda(this.programId, distributorPublicKey, claimantPublicKey);
154
+ const eventAuthorityPublicKey = getEventAuthorityPda(this.programId);
155
+ const closeClaimAccounts = {
156
+ adminOrClaimant: extParams.invoker.publicKey,
157
+ distributor: distributorPublicKey,
158
+ claimStatus: claimStatusPublicKey,
159
+ claimant: claimantPublicKey,
160
+ systemProgram: SystemProgram.programId,
161
+ eventAuthority: eventAuthorityPublicKey,
162
+ program: this.programId,
163
+ };
164
+ const closeClaimArgs = {
165
+ amountLocked: new BN(data.amountLocked),
166
+ amountUnlocked: new BN(data.amountUnlocked),
167
+ proof: data.proof,
168
+ };
169
+ ixs.push(closeClaim(closeClaimArgs, closeClaimAccounts, this.programId));
170
+ return ixs;
171
+ }
131
172
  async prepareClawbackInstructions(data, extParams) {
132
173
  if (!extParams.invoker.publicKey) {
133
174
  throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
@@ -207,7 +248,9 @@ export default class BaseDistributorClient {
207
248
  startVestingTs: new BN(data.startVestingTs),
208
249
  endVestingTs: new BN(data.endVestingTs),
209
250
  clawbackStartTs: new BN(data.clawbackStartTs),
210
- claimsClosable: data.claimsClosable,
251
+ claimsClosableByAdmin: data.claimsClosableByAdmin,
252
+ claimsClosableByClaimant: data.claimsClosableByClaimant,
253
+ claimsLimit: data.claimsLimit,
211
254
  };
212
255
  const nowTs = new BN(Math.floor(Date.now() / 1000));
213
256
  const endVestingTs = args.endVestingTs.isZero() ? nowTs : args.endVestingTs;
@@ -48,7 +48,15 @@ export default class SolanaAlignedDistributorClient extends BaseDistributorClien
48
48
  : getTestOraclePda(this.alignedProxyProgram.programId, mint, admin);
49
49
  const newDistributorIx = await this.alignedProxyProgram.methods
50
50
  .newDistributor({
51
- ...baseArgs,
51
+ claimsClosable: baseArgs.claimsClosableByAdmin,
52
+ version: baseArgs.version,
53
+ root: baseArgs.root,
54
+ maxTotalClaim: baseArgs.maxTotalClaim,
55
+ maxNumNodes: baseArgs.maxNumNodes,
56
+ unlockPeriod: baseArgs.unlockPeriod,
57
+ startVestingTs: baseArgs.startVestingTs,
58
+ endVestingTs: baseArgs.endVestingTs,
59
+ clawbackStartTs: baseArgs.clawbackStartTs,
52
60
  ...alignedArgs,
53
61
  })
54
62
  .accounts({
@@ -8,7 +8,7 @@ export type AlignedDistributor = {
8
8
  address: "aMERKpFAWoChCi5oZwPvgsSCoGpZKBiU7fi76bdZjt2";
9
9
  metadata: {
10
10
  name: "alignedDistributor";
11
- version: "1.2.0";
11
+ version: "1.3.0";
12
12
  spec: "0.1.0";
13
13
  description: "Proxy for merkle distributor that updates Vesting duration according to token market performance.";
14
14
  };
@@ -695,7 +695,7 @@ export type AlignedDistributor = {
695
695
  type: "bool";
696
696
  },
697
697
  {
698
- name: "claimsClosable";
698
+ name: "claimsClosableByAdmin";
699
699
  docs: ["Whether claims are closable by the admin or not"];
700
700
  type: "bool";
701
701
  },
@@ -731,11 +731,21 @@ export type AlignedDistributor = {
731
731
  docs: ["Timestamp when funds were clawed back"];
732
732
  type: "u64";
733
733
  },
734
+ {
735
+ name: "claimsClosableByClaimant";
736
+ docs: ["Whether claims are closable by claimant or not"];
737
+ type: "bool";
738
+ },
739
+ {
740
+ name: "claimsLimit";
741
+ docs: ["Limit number of claims"];
742
+ type: "u16";
743
+ },
734
744
  {
735
745
  name: "buffer2";
736
746
  docs: ["Buffer for additional fields"];
737
747
  type: {
738
- array: ["u8", 23];
748
+ array: ["u8", 20];
739
749
  };
740
750
  },
741
751
  {