@streamflow/distributor 6.0.0-alpha.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 (45) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +127 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +27 -0
  5. package/dist/solana/client.d.ts +25 -0
  6. package/dist/solana/client.js +300 -0
  7. package/dist/solana/constants.d.ts +6 -0
  8. package/dist/solana/constants.js +11 -0
  9. package/dist/solana/generated/accounts/ClaimStatus.d.ts +72 -0
  10. package/dist/solana/generated/accounts/ClaimStatus.js +183 -0
  11. package/dist/solana/generated/accounts/MerkleDistributor.d.ts +138 -0
  12. package/dist/solana/generated/accounts/MerkleDistributor.js +238 -0
  13. package/dist/solana/generated/accounts/index.d.ts +4 -0
  14. package/dist/solana/generated/accounts/index.js +7 -0
  15. package/dist/solana/generated/errors/anchor.d.ts +434 -0
  16. package/dist/solana/generated/errors/anchor.js +889 -0
  17. package/dist/solana/generated/errors/custom.d.ts +162 -0
  18. package/dist/solana/generated/errors/custom.js +344 -0
  19. package/dist/solana/generated/errors/index.d.ts +5 -0
  20. package/dist/solana/generated/errors/index.js +104 -0
  21. package/dist/solana/generated/instructions/claimLocked.d.ts +21 -0
  22. package/dist/solana/generated/instructions/claimLocked.js +22 -0
  23. package/dist/solana/generated/instructions/clawback.d.ts +20 -0
  24. package/dist/solana/generated/instructions/clawback.js +22 -0
  25. package/dist/solana/generated/instructions/closeClaim.d.ts +13 -0
  26. package/dist/solana/generated/instructions/closeClaim.js +20 -0
  27. package/dist/solana/generated/instructions/index.d.ts +14 -0
  28. package/dist/solana/generated/instructions/index.js +17 -0
  29. package/dist/solana/generated/instructions/newClaim.d.ts +27 -0
  30. package/dist/solana/generated/instructions/newClaim.js +58 -0
  31. package/dist/solana/generated/instructions/newDistributor.d.ts +56 -0
  32. package/dist/solana/generated/instructions/newDistributor.js +94 -0
  33. package/dist/solana/generated/instructions/setAdmin.d.ts +10 -0
  34. package/dist/solana/generated/instructions/setAdmin.js +18 -0
  35. package/dist/solana/generated/instructions/setClawbackReceiver.d.ts +10 -0
  36. package/dist/solana/generated/instructions/setClawbackReceiver.js +18 -0
  37. package/dist/solana/generated/programId.d.ts +3 -0
  38. package/dist/solana/generated/programId.js +8 -0
  39. package/dist/solana/index.d.ts +4 -0
  40. package/dist/solana/index.js +37 -0
  41. package/dist/solana/types.d.ts +203 -0
  42. package/dist/solana/types.js +159 -0
  43. package/dist/solana/utils.d.ts +5 -0
  44. package/dist/solana/utils.js +87 -0
  45. package/package.json +46 -0
@@ -0,0 +1,162 @@
1
+ export type CustomError = InsufficientUnlockedTokens | StartTooFarInFuture | InvalidProof | ExceededMaxClaim | MaxNodesExceeded | Unauthorized | OwnerMismatch | ClawbackBeforeStart | ClawbackAlreadyClaimed | InsufficientClawbackDelay | SameClawbackReceiver | SameAdmin | ClaimExpired | ArithmeticError | StartTimestampAfterEnd | TimestampsNotInFuture | InvalidVersion | InvalidMint | ClaimIsClosed | ClaimsAreNotClosable;
2
+ export declare class InsufficientUnlockedTokens extends Error {
3
+ readonly logs?: string[] | undefined;
4
+ static readonly code = 6000;
5
+ readonly code = 6000;
6
+ readonly name = "InsufficientUnlockedTokens";
7
+ readonly msg = "Insufficient unlocked tokens";
8
+ constructor(logs?: string[] | undefined);
9
+ }
10
+ export declare class StartTooFarInFuture extends Error {
11
+ readonly logs?: string[] | undefined;
12
+ static readonly code = 6001;
13
+ readonly code = 6001;
14
+ readonly name = "StartTooFarInFuture";
15
+ readonly msg = "Deposit Start too far in future";
16
+ constructor(logs?: string[] | undefined);
17
+ }
18
+ export declare class InvalidProof extends Error {
19
+ readonly logs?: string[] | undefined;
20
+ static readonly code = 6002;
21
+ readonly code = 6002;
22
+ readonly name = "InvalidProof";
23
+ readonly msg = "Invalid Merkle proof";
24
+ constructor(logs?: string[] | undefined);
25
+ }
26
+ export declare class ExceededMaxClaim extends Error {
27
+ readonly logs?: string[] | undefined;
28
+ static readonly code = 6003;
29
+ readonly code = 6003;
30
+ readonly name = "ExceededMaxClaim";
31
+ readonly msg = "Exceeded maximum claim amount";
32
+ constructor(logs?: string[] | undefined);
33
+ }
34
+ export declare class MaxNodesExceeded extends Error {
35
+ readonly logs?: string[] | undefined;
36
+ static readonly code = 6004;
37
+ readonly code = 6004;
38
+ readonly name = "MaxNodesExceeded";
39
+ readonly msg = "Exceeded maximum node count";
40
+ constructor(logs?: string[] | undefined);
41
+ }
42
+ export declare class Unauthorized extends Error {
43
+ readonly logs?: string[] | undefined;
44
+ static readonly code = 6005;
45
+ readonly code = 6005;
46
+ readonly name = "Unauthorized";
47
+ readonly msg = "Account is not authorized to execute this instruction";
48
+ constructor(logs?: string[] | undefined);
49
+ }
50
+ export declare class OwnerMismatch extends Error {
51
+ readonly logs?: string[] | undefined;
52
+ static readonly code = 6006;
53
+ readonly code = 6006;
54
+ readonly name = "OwnerMismatch";
55
+ readonly msg = "Token account owner did not match intended owner";
56
+ constructor(logs?: string[] | undefined);
57
+ }
58
+ export declare class ClawbackBeforeStart extends Error {
59
+ readonly logs?: string[] | undefined;
60
+ static readonly code = 6007;
61
+ readonly code = 6007;
62
+ readonly name = "ClawbackBeforeStart";
63
+ readonly msg = "Attempted clawback before start";
64
+ constructor(logs?: string[] | undefined);
65
+ }
66
+ export declare class ClawbackAlreadyClaimed extends Error {
67
+ readonly logs?: string[] | undefined;
68
+ static readonly code = 6008;
69
+ readonly code = 6008;
70
+ readonly name = "ClawbackAlreadyClaimed";
71
+ readonly msg = "Clawback already claimed";
72
+ constructor(logs?: string[] | undefined);
73
+ }
74
+ export declare class InsufficientClawbackDelay extends Error {
75
+ readonly logs?: string[] | undefined;
76
+ static readonly code = 6009;
77
+ readonly code = 6009;
78
+ readonly name = "InsufficientClawbackDelay";
79
+ readonly msg = "Clawback start must be at least one day after vesting end";
80
+ constructor(logs?: string[] | undefined);
81
+ }
82
+ export declare class SameClawbackReceiver extends Error {
83
+ readonly logs?: string[] | undefined;
84
+ static readonly code = 6010;
85
+ readonly code = 6010;
86
+ readonly name = "SameClawbackReceiver";
87
+ readonly msg = "New and old Clawback receivers are identical";
88
+ constructor(logs?: string[] | undefined);
89
+ }
90
+ export declare class SameAdmin extends Error {
91
+ readonly logs?: string[] | undefined;
92
+ static readonly code = 6011;
93
+ readonly code = 6011;
94
+ readonly name = "SameAdmin";
95
+ readonly msg = "New and old admin are identical";
96
+ constructor(logs?: string[] | undefined);
97
+ }
98
+ export declare class ClaimExpired extends Error {
99
+ readonly logs?: string[] | undefined;
100
+ static readonly code = 6012;
101
+ readonly code = 6012;
102
+ readonly name = "ClaimExpired";
103
+ readonly msg = "Claim window expired";
104
+ constructor(logs?: string[] | undefined);
105
+ }
106
+ export declare class ArithmeticError extends Error {
107
+ readonly logs?: string[] | undefined;
108
+ static readonly code = 6013;
109
+ readonly code = 6013;
110
+ readonly name = "ArithmeticError";
111
+ readonly msg = "Arithmetic Error (overflow/underflow)";
112
+ constructor(logs?: string[] | undefined);
113
+ }
114
+ export declare class StartTimestampAfterEnd extends Error {
115
+ readonly logs?: string[] | undefined;
116
+ static readonly code = 6014;
117
+ readonly code = 6014;
118
+ readonly name = "StartTimestampAfterEnd";
119
+ readonly msg = "Start Timestamp cannot be after end Timestamp";
120
+ constructor(logs?: string[] | undefined);
121
+ }
122
+ export declare class TimestampsNotInFuture extends Error {
123
+ readonly logs?: string[] | undefined;
124
+ static readonly code = 6015;
125
+ readonly code = 6015;
126
+ readonly name = "TimestampsNotInFuture";
127
+ readonly msg = "Timestamps cannot be in the past";
128
+ constructor(logs?: string[] | undefined);
129
+ }
130
+ export declare class InvalidVersion extends Error {
131
+ readonly logs?: string[] | undefined;
132
+ static readonly code = 6016;
133
+ readonly code = 6016;
134
+ readonly name = "InvalidVersion";
135
+ readonly msg = "Airdrop Version Mismatch";
136
+ constructor(logs?: string[] | undefined);
137
+ }
138
+ export declare class InvalidMint extends Error {
139
+ readonly logs?: string[] | undefined;
140
+ static readonly code = 6017;
141
+ readonly code = 6017;
142
+ readonly name = "InvalidMint";
143
+ readonly msg = "Invalid Mint";
144
+ constructor(logs?: string[] | undefined);
145
+ }
146
+ export declare class ClaimIsClosed extends Error {
147
+ readonly logs?: string[] | undefined;
148
+ static readonly code = 6018;
149
+ readonly code = 6018;
150
+ readonly name = "ClaimIsClosed";
151
+ readonly msg = "Claim is closed";
152
+ constructor(logs?: string[] | undefined);
153
+ }
154
+ export declare class ClaimsAreNotClosable extends Error {
155
+ readonly logs?: string[] | undefined;
156
+ static readonly code = 6019;
157
+ readonly code = 6019;
158
+ readonly name = "ClaimsAreNotClosable";
159
+ readonly msg = "Claims are not closable";
160
+ constructor(logs?: string[] | undefined);
161
+ }
162
+ export declare function fromCode(code: number, logs?: string[]): CustomError | null;
@@ -0,0 +1,344 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.fromCode = exports.ClaimsAreNotClosable = exports.ClaimIsClosed = exports.InvalidMint = exports.InvalidVersion = exports.TimestampsNotInFuture = exports.StartTimestampAfterEnd = exports.ArithmeticError = exports.ClaimExpired = exports.SameAdmin = exports.SameClawbackReceiver = exports.InsufficientClawbackDelay = exports.ClawbackAlreadyClaimed = exports.ClawbackBeforeStart = exports.OwnerMismatch = exports.Unauthorized = exports.MaxNodesExceeded = exports.ExceededMaxClaim = exports.InvalidProof = exports.StartTooFarInFuture = exports.InsufficientUnlockedTokens = void 0;
19
+ var InsufficientUnlockedTokens = /** @class */ (function (_super) {
20
+ __extends(InsufficientUnlockedTokens, _super);
21
+ function InsufficientUnlockedTokens(logs) {
22
+ var _this = _super.call(this, "6000: Insufficient unlocked tokens") || this;
23
+ _this.logs = logs;
24
+ _this.code = 6000;
25
+ _this.name = "InsufficientUnlockedTokens";
26
+ _this.msg = "Insufficient unlocked tokens";
27
+ return _this;
28
+ }
29
+ InsufficientUnlockedTokens.code = 6000;
30
+ return InsufficientUnlockedTokens;
31
+ }(Error));
32
+ exports.InsufficientUnlockedTokens = InsufficientUnlockedTokens;
33
+ var StartTooFarInFuture = /** @class */ (function (_super) {
34
+ __extends(StartTooFarInFuture, _super);
35
+ function StartTooFarInFuture(logs) {
36
+ var _this = _super.call(this, "6001: Deposit Start too far in future") || this;
37
+ _this.logs = logs;
38
+ _this.code = 6001;
39
+ _this.name = "StartTooFarInFuture";
40
+ _this.msg = "Deposit Start too far in future";
41
+ return _this;
42
+ }
43
+ StartTooFarInFuture.code = 6001;
44
+ return StartTooFarInFuture;
45
+ }(Error));
46
+ exports.StartTooFarInFuture = StartTooFarInFuture;
47
+ var InvalidProof = /** @class */ (function (_super) {
48
+ __extends(InvalidProof, _super);
49
+ function InvalidProof(logs) {
50
+ var _this = _super.call(this, "6002: Invalid Merkle proof") || this;
51
+ _this.logs = logs;
52
+ _this.code = 6002;
53
+ _this.name = "InvalidProof";
54
+ _this.msg = "Invalid Merkle proof";
55
+ return _this;
56
+ }
57
+ InvalidProof.code = 6002;
58
+ return InvalidProof;
59
+ }(Error));
60
+ exports.InvalidProof = InvalidProof;
61
+ var ExceededMaxClaim = /** @class */ (function (_super) {
62
+ __extends(ExceededMaxClaim, _super);
63
+ function ExceededMaxClaim(logs) {
64
+ var _this = _super.call(this, "6003: Exceeded maximum claim amount") || this;
65
+ _this.logs = logs;
66
+ _this.code = 6003;
67
+ _this.name = "ExceededMaxClaim";
68
+ _this.msg = "Exceeded maximum claim amount";
69
+ return _this;
70
+ }
71
+ ExceededMaxClaim.code = 6003;
72
+ return ExceededMaxClaim;
73
+ }(Error));
74
+ exports.ExceededMaxClaim = ExceededMaxClaim;
75
+ var MaxNodesExceeded = /** @class */ (function (_super) {
76
+ __extends(MaxNodesExceeded, _super);
77
+ function MaxNodesExceeded(logs) {
78
+ var _this = _super.call(this, "6004: Exceeded maximum node count") || this;
79
+ _this.logs = logs;
80
+ _this.code = 6004;
81
+ _this.name = "MaxNodesExceeded";
82
+ _this.msg = "Exceeded maximum node count";
83
+ return _this;
84
+ }
85
+ MaxNodesExceeded.code = 6004;
86
+ return MaxNodesExceeded;
87
+ }(Error));
88
+ exports.MaxNodesExceeded = MaxNodesExceeded;
89
+ var Unauthorized = /** @class */ (function (_super) {
90
+ __extends(Unauthorized, _super);
91
+ function Unauthorized(logs) {
92
+ var _this = _super.call(this, "6005: Account is not authorized to execute this instruction") || this;
93
+ _this.logs = logs;
94
+ _this.code = 6005;
95
+ _this.name = "Unauthorized";
96
+ _this.msg = "Account is not authorized to execute this instruction";
97
+ return _this;
98
+ }
99
+ Unauthorized.code = 6005;
100
+ return Unauthorized;
101
+ }(Error));
102
+ exports.Unauthorized = Unauthorized;
103
+ var OwnerMismatch = /** @class */ (function (_super) {
104
+ __extends(OwnerMismatch, _super);
105
+ function OwnerMismatch(logs) {
106
+ var _this = _super.call(this, "6006: Token account owner did not match intended owner") || this;
107
+ _this.logs = logs;
108
+ _this.code = 6006;
109
+ _this.name = "OwnerMismatch";
110
+ _this.msg = "Token account owner did not match intended owner";
111
+ return _this;
112
+ }
113
+ OwnerMismatch.code = 6006;
114
+ return OwnerMismatch;
115
+ }(Error));
116
+ exports.OwnerMismatch = OwnerMismatch;
117
+ var ClawbackBeforeStart = /** @class */ (function (_super) {
118
+ __extends(ClawbackBeforeStart, _super);
119
+ function ClawbackBeforeStart(logs) {
120
+ var _this = _super.call(this, "6007: Attempted clawback before start") || this;
121
+ _this.logs = logs;
122
+ _this.code = 6007;
123
+ _this.name = "ClawbackBeforeStart";
124
+ _this.msg = "Attempted clawback before start";
125
+ return _this;
126
+ }
127
+ ClawbackBeforeStart.code = 6007;
128
+ return ClawbackBeforeStart;
129
+ }(Error));
130
+ exports.ClawbackBeforeStart = ClawbackBeforeStart;
131
+ var ClawbackAlreadyClaimed = /** @class */ (function (_super) {
132
+ __extends(ClawbackAlreadyClaimed, _super);
133
+ function ClawbackAlreadyClaimed(logs) {
134
+ var _this = _super.call(this, "6008: Clawback already claimed") || this;
135
+ _this.logs = logs;
136
+ _this.code = 6008;
137
+ _this.name = "ClawbackAlreadyClaimed";
138
+ _this.msg = "Clawback already claimed";
139
+ return _this;
140
+ }
141
+ ClawbackAlreadyClaimed.code = 6008;
142
+ return ClawbackAlreadyClaimed;
143
+ }(Error));
144
+ exports.ClawbackAlreadyClaimed = ClawbackAlreadyClaimed;
145
+ var InsufficientClawbackDelay = /** @class */ (function (_super) {
146
+ __extends(InsufficientClawbackDelay, _super);
147
+ function InsufficientClawbackDelay(logs) {
148
+ var _this = _super.call(this, "6009: Clawback start must be at least one day after vesting end") || this;
149
+ _this.logs = logs;
150
+ _this.code = 6009;
151
+ _this.name = "InsufficientClawbackDelay";
152
+ _this.msg = "Clawback start must be at least one day after vesting end";
153
+ return _this;
154
+ }
155
+ InsufficientClawbackDelay.code = 6009;
156
+ return InsufficientClawbackDelay;
157
+ }(Error));
158
+ exports.InsufficientClawbackDelay = InsufficientClawbackDelay;
159
+ var SameClawbackReceiver = /** @class */ (function (_super) {
160
+ __extends(SameClawbackReceiver, _super);
161
+ function SameClawbackReceiver(logs) {
162
+ var _this = _super.call(this, "6010: New and old Clawback receivers are identical") || this;
163
+ _this.logs = logs;
164
+ _this.code = 6010;
165
+ _this.name = "SameClawbackReceiver";
166
+ _this.msg = "New and old Clawback receivers are identical";
167
+ return _this;
168
+ }
169
+ SameClawbackReceiver.code = 6010;
170
+ return SameClawbackReceiver;
171
+ }(Error));
172
+ exports.SameClawbackReceiver = SameClawbackReceiver;
173
+ var SameAdmin = /** @class */ (function (_super) {
174
+ __extends(SameAdmin, _super);
175
+ function SameAdmin(logs) {
176
+ var _this = _super.call(this, "6011: New and old admin are identical") || this;
177
+ _this.logs = logs;
178
+ _this.code = 6011;
179
+ _this.name = "SameAdmin";
180
+ _this.msg = "New and old admin are identical";
181
+ return _this;
182
+ }
183
+ SameAdmin.code = 6011;
184
+ return SameAdmin;
185
+ }(Error));
186
+ exports.SameAdmin = SameAdmin;
187
+ var ClaimExpired = /** @class */ (function (_super) {
188
+ __extends(ClaimExpired, _super);
189
+ function ClaimExpired(logs) {
190
+ var _this = _super.call(this, "6012: Claim window expired") || this;
191
+ _this.logs = logs;
192
+ _this.code = 6012;
193
+ _this.name = "ClaimExpired";
194
+ _this.msg = "Claim window expired";
195
+ return _this;
196
+ }
197
+ ClaimExpired.code = 6012;
198
+ return ClaimExpired;
199
+ }(Error));
200
+ exports.ClaimExpired = ClaimExpired;
201
+ var ArithmeticError = /** @class */ (function (_super) {
202
+ __extends(ArithmeticError, _super);
203
+ function ArithmeticError(logs) {
204
+ var _this = _super.call(this, "6013: Arithmetic Error (overflow/underflow)") || this;
205
+ _this.logs = logs;
206
+ _this.code = 6013;
207
+ _this.name = "ArithmeticError";
208
+ _this.msg = "Arithmetic Error (overflow/underflow)";
209
+ return _this;
210
+ }
211
+ ArithmeticError.code = 6013;
212
+ return ArithmeticError;
213
+ }(Error));
214
+ exports.ArithmeticError = ArithmeticError;
215
+ var StartTimestampAfterEnd = /** @class */ (function (_super) {
216
+ __extends(StartTimestampAfterEnd, _super);
217
+ function StartTimestampAfterEnd(logs) {
218
+ var _this = _super.call(this, "6014: Start Timestamp cannot be after end Timestamp") || this;
219
+ _this.logs = logs;
220
+ _this.code = 6014;
221
+ _this.name = "StartTimestampAfterEnd";
222
+ _this.msg = "Start Timestamp cannot be after end Timestamp";
223
+ return _this;
224
+ }
225
+ StartTimestampAfterEnd.code = 6014;
226
+ return StartTimestampAfterEnd;
227
+ }(Error));
228
+ exports.StartTimestampAfterEnd = StartTimestampAfterEnd;
229
+ var TimestampsNotInFuture = /** @class */ (function (_super) {
230
+ __extends(TimestampsNotInFuture, _super);
231
+ function TimestampsNotInFuture(logs) {
232
+ var _this = _super.call(this, "6015: Timestamps cannot be in the past") || this;
233
+ _this.logs = logs;
234
+ _this.code = 6015;
235
+ _this.name = "TimestampsNotInFuture";
236
+ _this.msg = "Timestamps cannot be in the past";
237
+ return _this;
238
+ }
239
+ TimestampsNotInFuture.code = 6015;
240
+ return TimestampsNotInFuture;
241
+ }(Error));
242
+ exports.TimestampsNotInFuture = TimestampsNotInFuture;
243
+ var InvalidVersion = /** @class */ (function (_super) {
244
+ __extends(InvalidVersion, _super);
245
+ function InvalidVersion(logs) {
246
+ var _this = _super.call(this, "6016: Airdrop Version Mismatch") || this;
247
+ _this.logs = logs;
248
+ _this.code = 6016;
249
+ _this.name = "InvalidVersion";
250
+ _this.msg = "Airdrop Version Mismatch";
251
+ return _this;
252
+ }
253
+ InvalidVersion.code = 6016;
254
+ return InvalidVersion;
255
+ }(Error));
256
+ exports.InvalidVersion = InvalidVersion;
257
+ var InvalidMint = /** @class */ (function (_super) {
258
+ __extends(InvalidMint, _super);
259
+ function InvalidMint(logs) {
260
+ var _this = _super.call(this, "6017: Invalid Mint") || this;
261
+ _this.logs = logs;
262
+ _this.code = 6017;
263
+ _this.name = "InvalidMint";
264
+ _this.msg = "Invalid Mint";
265
+ return _this;
266
+ }
267
+ InvalidMint.code = 6017;
268
+ return InvalidMint;
269
+ }(Error));
270
+ exports.InvalidMint = InvalidMint;
271
+ var ClaimIsClosed = /** @class */ (function (_super) {
272
+ __extends(ClaimIsClosed, _super);
273
+ function ClaimIsClosed(logs) {
274
+ var _this = _super.call(this, "6018: Claim is closed") || this;
275
+ _this.logs = logs;
276
+ _this.code = 6018;
277
+ _this.name = "ClaimIsClosed";
278
+ _this.msg = "Claim is closed";
279
+ return _this;
280
+ }
281
+ ClaimIsClosed.code = 6018;
282
+ return ClaimIsClosed;
283
+ }(Error));
284
+ exports.ClaimIsClosed = ClaimIsClosed;
285
+ var ClaimsAreNotClosable = /** @class */ (function (_super) {
286
+ __extends(ClaimsAreNotClosable, _super);
287
+ function ClaimsAreNotClosable(logs) {
288
+ var _this = _super.call(this, "6019: Claims are not closable") || this;
289
+ _this.logs = logs;
290
+ _this.code = 6019;
291
+ _this.name = "ClaimsAreNotClosable";
292
+ _this.msg = "Claims are not closable";
293
+ return _this;
294
+ }
295
+ ClaimsAreNotClosable.code = 6019;
296
+ return ClaimsAreNotClosable;
297
+ }(Error));
298
+ exports.ClaimsAreNotClosable = ClaimsAreNotClosable;
299
+ function fromCode(code, logs) {
300
+ switch (code) {
301
+ case 6000:
302
+ return new InsufficientUnlockedTokens(logs);
303
+ case 6001:
304
+ return new StartTooFarInFuture(logs);
305
+ case 6002:
306
+ return new InvalidProof(logs);
307
+ case 6003:
308
+ return new ExceededMaxClaim(logs);
309
+ case 6004:
310
+ return new MaxNodesExceeded(logs);
311
+ case 6005:
312
+ return new Unauthorized(logs);
313
+ case 6006:
314
+ return new OwnerMismatch(logs);
315
+ case 6007:
316
+ return new ClawbackBeforeStart(logs);
317
+ case 6008:
318
+ return new ClawbackAlreadyClaimed(logs);
319
+ case 6009:
320
+ return new InsufficientClawbackDelay(logs);
321
+ case 6010:
322
+ return new SameClawbackReceiver(logs);
323
+ case 6011:
324
+ return new SameAdmin(logs);
325
+ case 6012:
326
+ return new ClaimExpired(logs);
327
+ case 6013:
328
+ return new ArithmeticError(logs);
329
+ case 6014:
330
+ return new StartTimestampAfterEnd(logs);
331
+ case 6015:
332
+ return new TimestampsNotInFuture(logs);
333
+ case 6016:
334
+ return new InvalidVersion(logs);
335
+ case 6017:
336
+ return new InvalidMint(logs);
337
+ case 6018:
338
+ return new ClaimIsClosed(logs);
339
+ case 6019:
340
+ return new ClaimsAreNotClosable(logs);
341
+ }
342
+ return null;
343
+ }
344
+ exports.fromCode = fromCode;
@@ -0,0 +1,5 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ import * as anchor from "./anchor";
3
+ import * as custom from "./custom";
4
+ export declare function fromCode(code: number, logs?: string[]): custom.CustomError | anchor.AnchorError | null;
5
+ export declare function fromTxError(err: unknown, programId?: PublicKey): custom.CustomError | anchor.AnchorError | null;
@@ -0,0 +1,104 @@
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
+ };
25
+ var __values = (this && this.__values) || function(o) {
26
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
27
+ if (m) return m.call(o);
28
+ if (o && typeof o.length === "number") return {
29
+ next: function () {
30
+ if (o && i >= o.length) o = void 0;
31
+ return { value: o && o[i++], done: !o };
32
+ }
33
+ };
34
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
35
+ };
36
+ var __read = (this && this.__read) || function (o, n) {
37
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
38
+ if (!m) return o;
39
+ var i = m.call(o), r, ar = [], e;
40
+ try {
41
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
42
+ }
43
+ catch (error) { e = { error: error }; }
44
+ finally {
45
+ try {
46
+ if (r && !r.done && (m = i["return"])) m.call(i);
47
+ }
48
+ finally { if (e) throw e.error; }
49
+ }
50
+ return ar;
51
+ };
52
+ Object.defineProperty(exports, "__esModule", { value: true });
53
+ exports.fromTxError = exports.fromCode = void 0;
54
+ var programId_1 = require("../programId");
55
+ var anchor = __importStar(require("./anchor"));
56
+ var custom = __importStar(require("./custom"));
57
+ function fromCode(code, logs) {
58
+ return code >= 6000 ? custom.fromCode(code, logs) : anchor.fromCode(code, logs);
59
+ }
60
+ exports.fromCode = fromCode;
61
+ function hasOwnProperty(obj, prop) {
62
+ return Object.hasOwnProperty.call(obj, prop);
63
+ }
64
+ var errorRe = /Program (\w+) failed: custom program error: (\w+)/;
65
+ function fromTxError(err, programId) {
66
+ var e_1, _a;
67
+ if (programId === void 0) { programId = programId_1.PROGRAM_ID; }
68
+ if (typeof err !== "object" || err === null || !hasOwnProperty(err, "logs") || !Array.isArray(err.logs)) {
69
+ return null;
70
+ }
71
+ var firstMatch = null;
72
+ try {
73
+ for (var _b = __values(err.logs), _c = _b.next(); !_c.done; _c = _b.next()) {
74
+ var logLine = _c.value;
75
+ firstMatch = errorRe.exec(logLine);
76
+ if (firstMatch !== null) {
77
+ break;
78
+ }
79
+ }
80
+ }
81
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
82
+ finally {
83
+ try {
84
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
85
+ }
86
+ finally { if (e_1) throw e_1.error; }
87
+ }
88
+ if (firstMatch === null) {
89
+ return null;
90
+ }
91
+ var _d = __read(firstMatch.slice(1), 2), programIdRaw = _d[0], codeRaw = _d[1];
92
+ if (programIdRaw !== programId.toString()) {
93
+ return null;
94
+ }
95
+ var errorCode;
96
+ try {
97
+ errorCode = parseInt(codeRaw, 16);
98
+ }
99
+ catch (parseErr) {
100
+ return null;
101
+ }
102
+ return fromCode(errorCode, err.logs);
103
+ }
104
+ exports.fromTxError = fromTxError;
@@ -0,0 +1,21 @@
1
+ import { TransactionInstruction, PublicKey } from "@solana/web3.js";
2
+ export interface ClaimLockedAccounts {
3
+ /** The [MerkleDistributor]. */
4
+ distributor: PublicKey;
5
+ /** Claim Status PDA */
6
+ claimStatus: PublicKey;
7
+ /** Distributor ATA containing the tokens to distribute. */
8
+ from: PublicKey;
9
+ /**
10
+ * Account to send the claimed tokens to.
11
+ * Claimant must sign the transaction and can only claim on behalf of themself
12
+ */
13
+ to: PublicKey;
14
+ /** Who is claiming the tokens. */
15
+ claimant: PublicKey;
16
+ /** The mint to claim. */
17
+ mint: PublicKey;
18
+ /** SPL [Token] program. */
19
+ tokenProgram: PublicKey;
20
+ }
21
+ export declare function claimLocked(accounts: ClaimLockedAccounts, programId?: PublicKey): TransactionInstruction;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.claimLocked = void 0;
4
+ var web3_js_1 = require("@solana/web3.js");
5
+ var programId_1 = require("../programId");
6
+ function claimLocked(accounts, programId) {
7
+ if (programId === void 0) { programId = programId_1.PROGRAM_ID; }
8
+ var keys = [
9
+ { pubkey: accounts.distributor, isSigner: false, isWritable: true },
10
+ { pubkey: accounts.claimStatus, isSigner: false, isWritable: true },
11
+ { pubkey: accounts.from, isSigner: false, isWritable: true },
12
+ { pubkey: accounts.to, isSigner: false, isWritable: true },
13
+ { pubkey: accounts.claimant, isSigner: true, isWritable: true },
14
+ { pubkey: accounts.mint, isSigner: false, isWritable: false },
15
+ { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
16
+ ];
17
+ var identifier = Buffer.from([34, 206, 181, 23, 11, 207, 147, 90]);
18
+ var data = identifier;
19
+ var ix = new web3_js_1.TransactionInstruction({ keys: keys, programId: programId, data: data });
20
+ return ix;
21
+ }
22
+ exports.claimLocked = claimLocked;
@@ -0,0 +1,20 @@
1
+ import { TransactionInstruction, PublicKey } from "@solana/web3.js";
2
+ export interface ClawbackAccounts {
3
+ /** The [MerkleDistributor]. */
4
+ distributor: PublicKey;
5
+ /** Distributor ATA containing the tokens to distribute. */
6
+ from: PublicKey;
7
+ /** The Clawback token account. */
8
+ to: PublicKey;
9
+ /**
10
+ * Claimant account
11
+ * Anyone can claw back the funds if clawback is done at least a day after vesting has ended
12
+ */
13
+ claimant: PublicKey;
14
+ mint: PublicKey;
15
+ /** The [System] program. */
16
+ systemProgram: PublicKey;
17
+ /** SPL [Token] program. */
18
+ tokenProgram: PublicKey;
19
+ }
20
+ export declare function clawback(accounts: ClawbackAccounts, programId?: PublicKey): TransactionInstruction;