@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.
- package/dist/cjs/solana/clients/BaseDistributorClient.js +44 -1
- package/dist/cjs/solana/clients/SolanaAlignedDistributorClient.js +9 -1
- package/dist/cjs/solana/descriptor/idl/aligned_distributor.json +103 -423
- package/dist/cjs/solana/generated/accounts/ClaimStatus.js +11 -1
- package/dist/cjs/solana/generated/accounts/MerkleDistributor.js +16 -6
- package/dist/cjs/solana/generated/errors/custom.js +66 -1
- package/dist/cjs/solana/generated/instructions/closeClaim.js +39 -3
- package/dist/cjs/solana/generated/instructions/newDistributor.js +3 -3
- package/dist/esm/solana/clients/BaseDistributorClient.d.ts +3 -1
- package/dist/esm/solana/clients/BaseDistributorClient.js +45 -2
- package/dist/esm/solana/clients/SolanaAlignedDistributorClient.js +9 -1
- package/dist/esm/solana/descriptor/aligned_distributor.d.ts +13 -3
- package/dist/esm/solana/descriptor/idl/aligned_distributor.json +103 -423
- package/dist/esm/solana/generated/accounts/ClaimStatus.d.ts +12 -0
- package/dist/esm/solana/generated/accounts/ClaimStatus.js +15 -1
- package/dist/esm/solana/generated/accounts/MerkleDistributor.d.ts +15 -3
- package/dist/esm/solana/generated/accounts/MerkleDistributor.js +21 -7
- package/dist/esm/solana/generated/errors/custom.d.ts +41 -1
- package/dist/esm/solana/generated/errors/custom.js +65 -0
- package/dist/esm/solana/generated/instructions/closeClaim.d.ts +9 -2
- package/dist/esm/solana/generated/instructions/closeClaim.js +15 -3
- package/dist/esm/solana/generated/instructions/newDistributor.d.ts +3 -1
- package/dist/esm/solana/generated/instructions/newDistributor.js +3 -3
- package/dist/esm/solana/types.d.ts +7 -2
- package/package.json +4 -4
|
@@ -17,6 +17,10 @@ export interface ClaimStatusFields {
|
|
|
17
17
|
closed: boolean;
|
|
18
18
|
/** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
|
|
19
19
|
distributor: PublicKey;
|
|
20
|
+
/** Number of time amount has been claimed */
|
|
21
|
+
claimsCount: number;
|
|
22
|
+
/** Time when claim was closed */
|
|
23
|
+
closedTs: BN;
|
|
20
24
|
/** Buffer for additional fields */
|
|
21
25
|
buffer2: Array<number>;
|
|
22
26
|
}
|
|
@@ -37,6 +41,10 @@ export interface ClaimStatusJSON {
|
|
|
37
41
|
closed: boolean;
|
|
38
42
|
/** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
|
|
39
43
|
distributor: string;
|
|
44
|
+
/** Number of time amount has been claimed */
|
|
45
|
+
claimsCount: number;
|
|
46
|
+
/** Time when claim was closed */
|
|
47
|
+
closedTs: string;
|
|
40
48
|
/** Buffer for additional fields */
|
|
41
49
|
buffer2: Array<number>;
|
|
42
50
|
}
|
|
@@ -58,6 +66,10 @@ export declare class ClaimStatus {
|
|
|
58
66
|
readonly closed: boolean;
|
|
59
67
|
/** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
|
|
60
68
|
readonly distributor: PublicKey;
|
|
69
|
+
/** Number of time amount has been claimed */
|
|
70
|
+
readonly claimsCount: number;
|
|
71
|
+
/** Time when claim was closed */
|
|
72
|
+
readonly closedTs: BN;
|
|
61
73
|
/** Buffer for additional fields */
|
|
62
74
|
readonly buffer2: Array<number>;
|
|
63
75
|
static readonly discriminator: Buffer;
|
|
@@ -20,6 +20,10 @@ export class ClaimStatus {
|
|
|
20
20
|
closed;
|
|
21
21
|
/** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
|
|
22
22
|
distributor;
|
|
23
|
+
/** Number of time amount has been claimed */
|
|
24
|
+
claimsCount;
|
|
25
|
+
/** Time when claim was closed */
|
|
26
|
+
closedTs;
|
|
23
27
|
/** Buffer for additional fields */
|
|
24
28
|
buffer2;
|
|
25
29
|
static discriminator = Buffer.from([22, 183, 249, 157, 247, 95, 150, 96]);
|
|
@@ -32,7 +36,9 @@ export class ClaimStatus {
|
|
|
32
36
|
borsh.u64("lastAmountPerUnlock"),
|
|
33
37
|
borsh.bool("closed"),
|
|
34
38
|
borsh.publicKey("distributor"),
|
|
35
|
-
borsh.
|
|
39
|
+
borsh.u16("claimsCount"),
|
|
40
|
+
borsh.u64("closedTs"),
|
|
41
|
+
borsh.array(borsh.u8(), 22, "buffer2"),
|
|
36
42
|
]);
|
|
37
43
|
constructor(fields) {
|
|
38
44
|
this.claimant = fields.claimant;
|
|
@@ -43,6 +49,8 @@ export class ClaimStatus {
|
|
|
43
49
|
this.lastAmountPerUnlock = fields.lastAmountPerUnlock;
|
|
44
50
|
this.closed = fields.closed;
|
|
45
51
|
this.distributor = fields.distributor;
|
|
52
|
+
this.claimsCount = fields.claimsCount;
|
|
53
|
+
this.closedTs = fields.closedTs;
|
|
46
54
|
this.buffer2 = fields.buffer2;
|
|
47
55
|
}
|
|
48
56
|
static async fetch(c, address, programId = PROGRAM_ID) {
|
|
@@ -81,6 +89,8 @@ export class ClaimStatus {
|
|
|
81
89
|
lastAmountPerUnlock: dec.lastAmountPerUnlock,
|
|
82
90
|
closed: dec.closed,
|
|
83
91
|
distributor: dec.distributor,
|
|
92
|
+
claimsCount: dec.claimsCount,
|
|
93
|
+
closedTs: dec.closedTs,
|
|
84
94
|
buffer2: dec.buffer2,
|
|
85
95
|
});
|
|
86
96
|
}
|
|
@@ -94,6 +104,8 @@ export class ClaimStatus {
|
|
|
94
104
|
lastAmountPerUnlock: this.lastAmountPerUnlock.toString(),
|
|
95
105
|
closed: this.closed,
|
|
96
106
|
distributor: this.distributor.toString(),
|
|
107
|
+
claimsCount: this.claimsCount,
|
|
108
|
+
closedTs: this.closedTs.toString(),
|
|
97
109
|
buffer2: this.buffer2,
|
|
98
110
|
};
|
|
99
111
|
}
|
|
@@ -107,6 +119,8 @@ export class ClaimStatus {
|
|
|
107
119
|
lastAmountPerUnlock: new BN(obj.lastAmountPerUnlock),
|
|
108
120
|
closed: obj.closed,
|
|
109
121
|
distributor: new PublicKey(obj.distributor),
|
|
122
|
+
claimsCount: obj.claimsCount,
|
|
123
|
+
closedTs: new BN(obj.closedTs),
|
|
110
124
|
buffer2: obj.buffer2,
|
|
111
125
|
});
|
|
112
126
|
}
|
|
@@ -34,7 +34,7 @@ export interface MerkleDistributorFields {
|
|
|
34
34
|
/** Whether or not the distributor has been clawed back */
|
|
35
35
|
clawedBack: boolean;
|
|
36
36
|
/** Whether claims are closable by the admin or not */
|
|
37
|
-
|
|
37
|
+
claimsClosableByAdmin: boolean;
|
|
38
38
|
/** Whether admin can update vesting duration */
|
|
39
39
|
canUpdateDuration: boolean;
|
|
40
40
|
/** Total amount of funds unlocked (cliff/instant) */
|
|
@@ -47,6 +47,10 @@ export interface MerkleDistributorFields {
|
|
|
47
47
|
totalClaimablePreUpdate: BN;
|
|
48
48
|
/** Timestamp when funds were clawed back */
|
|
49
49
|
clawedBackTs: BN;
|
|
50
|
+
/** Whether claims are closable by the claimant or not */
|
|
51
|
+
claimsClosableByClaimant: boolean;
|
|
52
|
+
/** Limit number of claims */
|
|
53
|
+
claimsLimit: number;
|
|
50
54
|
/** Buffer for additional fields */
|
|
51
55
|
buffer2: Array<number>;
|
|
52
56
|
/** Buffer for additional fields */
|
|
@@ -86,7 +90,7 @@ export interface MerkleDistributorJSON {
|
|
|
86
90
|
/** Whether or not the distributor has been clawed back */
|
|
87
91
|
clawedBack: boolean;
|
|
88
92
|
/** Whether claims are closable by the admin or not */
|
|
89
|
-
|
|
93
|
+
claimsClosableByAdmin: boolean;
|
|
90
94
|
/** Whether admin can update vesting duration */
|
|
91
95
|
canUpdateDuration: boolean;
|
|
92
96
|
/** Total amount of funds unlocked (cliff/instant) */
|
|
@@ -99,6 +103,10 @@ export interface MerkleDistributorJSON {
|
|
|
99
103
|
totalClaimablePreUpdate: string;
|
|
100
104
|
/** Timestamp when funds were clawed back */
|
|
101
105
|
clawedBackTs: string;
|
|
106
|
+
/** Whether claims are closable by the claimant or not */
|
|
107
|
+
claimsClosableByClaimant: boolean;
|
|
108
|
+
/** Limit number of claims */
|
|
109
|
+
claimsLimit: number;
|
|
102
110
|
/** Buffer for additional fields */
|
|
103
111
|
buffer2: Array<number>;
|
|
104
112
|
/** Buffer for additional fields */
|
|
@@ -139,7 +147,7 @@ export declare class MerkleDistributor {
|
|
|
139
147
|
/** Whether or not the distributor has been clawed back */
|
|
140
148
|
readonly clawedBack: boolean;
|
|
141
149
|
/** Whether claims are closable by the admin or not */
|
|
142
|
-
readonly
|
|
150
|
+
readonly claimsClosableByAdmin: boolean;
|
|
143
151
|
/** Whether admin can update vesting duration */
|
|
144
152
|
readonly canUpdateDuration: boolean;
|
|
145
153
|
/** Total amount of funds unlocked (cliff/instant) */
|
|
@@ -152,6 +160,10 @@ export declare class MerkleDistributor {
|
|
|
152
160
|
readonly totalClaimablePreUpdate: BN;
|
|
153
161
|
/** Timestamp when funds were clawed back */
|
|
154
162
|
readonly clawedBackTs: BN;
|
|
163
|
+
/** Whether claims are closable by the claimant or not */
|
|
164
|
+
readonly claimsClosableByClaimant: boolean;
|
|
165
|
+
/** Limit number of claims */
|
|
166
|
+
readonly claimsLimit: number;
|
|
155
167
|
/** Buffer for additional fields */
|
|
156
168
|
readonly buffer2: Array<number>;
|
|
157
169
|
/** Buffer for additional fields */
|
|
@@ -37,7 +37,7 @@ export class MerkleDistributor {
|
|
|
37
37
|
/** Whether or not the distributor has been clawed back */
|
|
38
38
|
clawedBack;
|
|
39
39
|
/** Whether claims are closable by the admin or not */
|
|
40
|
-
|
|
40
|
+
claimsClosableByAdmin;
|
|
41
41
|
/** Whether admin can update vesting duration */
|
|
42
42
|
canUpdateDuration;
|
|
43
43
|
/** Total amount of funds unlocked (cliff/instant) */
|
|
@@ -50,6 +50,10 @@ export class MerkleDistributor {
|
|
|
50
50
|
totalClaimablePreUpdate;
|
|
51
51
|
/** Timestamp when funds were clawed back */
|
|
52
52
|
clawedBackTs;
|
|
53
|
+
/** Whether claims are closable by the claimant or not */
|
|
54
|
+
claimsClosableByClaimant;
|
|
55
|
+
/** Limit number of claims */
|
|
56
|
+
claimsLimit;
|
|
53
57
|
/** Buffer for additional fields */
|
|
54
58
|
buffer2;
|
|
55
59
|
/** Buffer for additional fields */
|
|
@@ -72,14 +76,16 @@ export class MerkleDistributor {
|
|
|
72
76
|
borsh.publicKey("clawbackReceiver"),
|
|
73
77
|
borsh.publicKey("admin"),
|
|
74
78
|
borsh.bool("clawedBack"),
|
|
75
|
-
borsh.bool("
|
|
79
|
+
borsh.bool("claimsClosableByAdmin"),
|
|
76
80
|
borsh.bool("canUpdateDuration"),
|
|
77
81
|
borsh.u64("totalAmountUnlocked"),
|
|
78
82
|
borsh.u64("totalAmountLocked"),
|
|
79
83
|
borsh.u64("lastDurationUpdateTs"),
|
|
80
84
|
borsh.u64("totalClaimablePreUpdate"),
|
|
81
85
|
borsh.u64("clawedBackTs"),
|
|
82
|
-
borsh.
|
|
86
|
+
borsh.bool("claimsClosableByClaimant"),
|
|
87
|
+
borsh.u16("claimsLimit"),
|
|
88
|
+
borsh.array(borsh.u8(), 20, "buffer2"),
|
|
83
89
|
borsh.array(borsh.u8(), 32, "buffer3"),
|
|
84
90
|
]);
|
|
85
91
|
constructor(fields) {
|
|
@@ -99,13 +105,15 @@ export class MerkleDistributor {
|
|
|
99
105
|
this.clawbackReceiver = fields.clawbackReceiver;
|
|
100
106
|
this.admin = fields.admin;
|
|
101
107
|
this.clawedBack = fields.clawedBack;
|
|
102
|
-
this.
|
|
108
|
+
this.claimsClosableByAdmin = fields.claimsClosableByAdmin;
|
|
103
109
|
this.canUpdateDuration = fields.canUpdateDuration;
|
|
104
110
|
this.totalAmountUnlocked = fields.totalAmountUnlocked;
|
|
105
111
|
this.totalAmountLocked = fields.totalAmountLocked;
|
|
106
112
|
this.lastDurationUpdateTs = fields.lastDurationUpdateTs;
|
|
107
113
|
this.totalClaimablePreUpdate = fields.totalClaimablePreUpdate;
|
|
108
114
|
this.clawedBackTs = fields.clawedBackTs;
|
|
115
|
+
this.claimsClosableByClaimant = fields.claimsClosableByClaimant;
|
|
116
|
+
this.claimsLimit = fields.claimsLimit;
|
|
109
117
|
this.buffer2 = fields.buffer2;
|
|
110
118
|
this.buffer3 = fields.buffer3;
|
|
111
119
|
}
|
|
@@ -153,13 +161,15 @@ export class MerkleDistributor {
|
|
|
153
161
|
clawbackReceiver: dec.clawbackReceiver,
|
|
154
162
|
admin: dec.admin,
|
|
155
163
|
clawedBack: dec.clawedBack,
|
|
156
|
-
|
|
164
|
+
claimsClosableByAdmin: dec.claimsClosableByAdmin,
|
|
157
165
|
canUpdateDuration: dec.canUpdateDuration,
|
|
158
166
|
totalAmountUnlocked: dec.totalAmountUnlocked,
|
|
159
167
|
totalAmountLocked: dec.totalAmountLocked,
|
|
160
168
|
lastDurationUpdateTs: dec.lastDurationUpdateTs,
|
|
161
169
|
totalClaimablePreUpdate: dec.totalClaimablePreUpdate,
|
|
162
170
|
clawedBackTs: dec.clawedBackTs,
|
|
171
|
+
claimsClosableByClaimant: dec.claimsClosableByClaimant,
|
|
172
|
+
claimsLimit: dec.claimsLimit,
|
|
163
173
|
buffer2: dec.buffer2,
|
|
164
174
|
buffer3: dec.buffer3,
|
|
165
175
|
});
|
|
@@ -182,13 +192,15 @@ export class MerkleDistributor {
|
|
|
182
192
|
clawbackReceiver: this.clawbackReceiver.toString(),
|
|
183
193
|
admin: this.admin.toString(),
|
|
184
194
|
clawedBack: this.clawedBack,
|
|
185
|
-
|
|
195
|
+
claimsClosableByAdmin: this.claimsClosableByAdmin,
|
|
186
196
|
canUpdateDuration: this.canUpdateDuration,
|
|
187
197
|
totalAmountUnlocked: this.totalAmountUnlocked.toString(),
|
|
188
198
|
totalAmountLocked: this.totalAmountLocked.toString(),
|
|
189
199
|
lastDurationUpdateTs: this.lastDurationUpdateTs.toString(),
|
|
190
200
|
totalClaimablePreUpdate: this.totalClaimablePreUpdate.toString(),
|
|
191
201
|
clawedBackTs: this.clawedBackTs.toString(),
|
|
202
|
+
claimsClosableByClaimant: this.claimsClosableByClaimant,
|
|
203
|
+
claimsLimit: this.claimsLimit,
|
|
192
204
|
buffer2: this.buffer2,
|
|
193
205
|
buffer3: this.buffer3,
|
|
194
206
|
};
|
|
@@ -211,13 +223,15 @@ export class MerkleDistributor {
|
|
|
211
223
|
clawbackReceiver: new PublicKey(obj.clawbackReceiver),
|
|
212
224
|
admin: new PublicKey(obj.admin),
|
|
213
225
|
clawedBack: obj.clawedBack,
|
|
214
|
-
|
|
226
|
+
claimsClosableByAdmin: obj.claimsClosableByAdmin,
|
|
215
227
|
canUpdateDuration: obj.canUpdateDuration,
|
|
216
228
|
totalAmountUnlocked: new BN(obj.totalAmountUnlocked),
|
|
217
229
|
totalAmountLocked: new BN(obj.totalAmountLocked),
|
|
218
230
|
lastDurationUpdateTs: new BN(obj.lastDurationUpdateTs),
|
|
219
231
|
totalClaimablePreUpdate: new BN(obj.totalClaimablePreUpdate),
|
|
220
232
|
clawedBackTs: new BN(obj.clawedBackTs),
|
|
233
|
+
claimsClosableByClaimant: obj.claimsClosableByClaimant,
|
|
234
|
+
claimsLimit: obj.claimsLimit,
|
|
221
235
|
buffer2: obj.buffer2,
|
|
222
236
|
buffer3: obj.buffer3,
|
|
223
237
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type CustomError = InsufficientUnlockedTokens | InvalidProof | ExceededMaxClaim | MaxNodesExceeded | Unauthorized | OwnerMismatch | ClawbackBeforeStart | ClawbackAlreadyClaimed | SameClawbackReceiver | ClawbackReceiverIsTokenVault | SameAdmin | ClaimExpired | ArithmeticError | StartTimestampAfterEnd | TimestampsNotInFuture | InvalidMint | ClaimIsClosed | ClaimsAreNotClosable | InvalidUnlockPeriod;
|
|
1
|
+
export type CustomError = InsufficientUnlockedTokens | InvalidProof | ExceededMaxClaim | MaxNodesExceeded | Unauthorized | OwnerMismatch | ClawbackBeforeStart | ClawbackAlreadyClaimed | SameClawbackReceiver | ClawbackReceiverIsTokenVault | SameAdmin | ClaimExpired | ArithmeticError | StartTimestampAfterEnd | TimestampsNotInFuture | InvalidMint | ClaimIsClosed | ClaimsAreNotClosable | InvalidUnlockPeriod | DurationUpdateNotAllowed | NoVestingAmount | VestingAlreadyFinished | InvalidAmounts | ClaimsLimitReached;
|
|
2
2
|
export declare class InsufficientUnlockedTokens extends Error {
|
|
3
3
|
readonly logs?: string[] | undefined;
|
|
4
4
|
static readonly code = 6000;
|
|
@@ -151,4 +151,44 @@ export declare class InvalidUnlockPeriod extends Error {
|
|
|
151
151
|
readonly msg = "Invalid unlock period";
|
|
152
152
|
constructor(logs?: string[] | undefined);
|
|
153
153
|
}
|
|
154
|
+
export declare class DurationUpdateNotAllowed extends Error {
|
|
155
|
+
readonly logs?: string[] | undefined;
|
|
156
|
+
static readonly code = 6019;
|
|
157
|
+
readonly code = 6019;
|
|
158
|
+
readonly name = "DurationUpdateNotAllowed";
|
|
159
|
+
readonly msg = "Duration update is not allowed";
|
|
160
|
+
constructor(logs?: string[] | undefined);
|
|
161
|
+
}
|
|
162
|
+
export declare class NoVestingAmount extends Error {
|
|
163
|
+
readonly logs?: string[] | undefined;
|
|
164
|
+
static readonly code = 6020;
|
|
165
|
+
readonly code = 6020;
|
|
166
|
+
readonly name = "NoVestingAmount";
|
|
167
|
+
readonly msg = "Vesting amounts are not set";
|
|
168
|
+
constructor(logs?: string[] | undefined);
|
|
169
|
+
}
|
|
170
|
+
export declare class VestingAlreadyFinished extends Error {
|
|
171
|
+
readonly logs?: string[] | undefined;
|
|
172
|
+
static readonly code = 6021;
|
|
173
|
+
readonly code = 6021;
|
|
174
|
+
readonly name = "VestingAlreadyFinished";
|
|
175
|
+
readonly msg = "Vesting already finished";
|
|
176
|
+
constructor(logs?: string[] | undefined);
|
|
177
|
+
}
|
|
178
|
+
export declare class InvalidAmounts extends Error {
|
|
179
|
+
readonly logs?: string[] | undefined;
|
|
180
|
+
static readonly code = 6022;
|
|
181
|
+
readonly code = 6022;
|
|
182
|
+
readonly name = "InvalidAmounts";
|
|
183
|
+
readonly msg = "Provided amounts are invalid";
|
|
184
|
+
constructor(logs?: string[] | undefined);
|
|
185
|
+
}
|
|
186
|
+
export declare class ClaimsLimitReached extends Error {
|
|
187
|
+
readonly logs?: string[] | undefined;
|
|
188
|
+
static readonly code = 6023;
|
|
189
|
+
readonly code = 6023;
|
|
190
|
+
readonly name = "ClaimsLimitReached";
|
|
191
|
+
readonly msg = "Claims limit has been reached";
|
|
192
|
+
constructor(logs?: string[] | undefined);
|
|
193
|
+
}
|
|
154
194
|
export declare function fromCode(code: number, logs?: string[]): CustomError | null;
|
|
@@ -207,6 +207,61 @@ export class InvalidUnlockPeriod extends Error {
|
|
|
207
207
|
this.logs = logs;
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
+
export class DurationUpdateNotAllowed extends Error {
|
|
211
|
+
logs;
|
|
212
|
+
static code = 6019;
|
|
213
|
+
code = 6019;
|
|
214
|
+
name = "DurationUpdateNotAllowed";
|
|
215
|
+
msg = "Duration update is not allowed";
|
|
216
|
+
constructor(logs) {
|
|
217
|
+
super("6019: Duration update is not allowed");
|
|
218
|
+
this.logs = logs;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
export class NoVestingAmount extends Error {
|
|
222
|
+
logs;
|
|
223
|
+
static code = 6020;
|
|
224
|
+
code = 6020;
|
|
225
|
+
name = "NoVestingAmount";
|
|
226
|
+
msg = "Vesting amounts are not set";
|
|
227
|
+
constructor(logs) {
|
|
228
|
+
super("6020: Vesting amounts are not set");
|
|
229
|
+
this.logs = logs;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
export class VestingAlreadyFinished extends Error {
|
|
233
|
+
logs;
|
|
234
|
+
static code = 6021;
|
|
235
|
+
code = 6021;
|
|
236
|
+
name = "VestingAlreadyFinished";
|
|
237
|
+
msg = "Vesting already finished";
|
|
238
|
+
constructor(logs) {
|
|
239
|
+
super("6021: Vesting already finished");
|
|
240
|
+
this.logs = logs;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
export class InvalidAmounts extends Error {
|
|
244
|
+
logs;
|
|
245
|
+
static code = 6022;
|
|
246
|
+
code = 6022;
|
|
247
|
+
name = "InvalidAmounts";
|
|
248
|
+
msg = "Provided amounts are invalid";
|
|
249
|
+
constructor(logs) {
|
|
250
|
+
super("6022: Provided amounts are invalid");
|
|
251
|
+
this.logs = logs;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
export class ClaimsLimitReached extends Error {
|
|
255
|
+
logs;
|
|
256
|
+
static code = 6023;
|
|
257
|
+
code = 6023;
|
|
258
|
+
name = "ClaimsLimitReached";
|
|
259
|
+
msg = "Claims limit has been reached";
|
|
260
|
+
constructor(logs) {
|
|
261
|
+
super("6023: Claims limit has been reached");
|
|
262
|
+
this.logs = logs;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
210
265
|
export function fromCode(code, logs) {
|
|
211
266
|
switch (code) {
|
|
212
267
|
case 6000:
|
|
@@ -247,6 +302,16 @@ export function fromCode(code, logs) {
|
|
|
247
302
|
return new ClaimsAreNotClosable(logs);
|
|
248
303
|
case 6018:
|
|
249
304
|
return new InvalidUnlockPeriod(logs);
|
|
305
|
+
case 6019:
|
|
306
|
+
return new DurationUpdateNotAllowed(logs);
|
|
307
|
+
case 6020:
|
|
308
|
+
return new NoVestingAmount(logs);
|
|
309
|
+
case 6021:
|
|
310
|
+
return new VestingAlreadyFinished(logs);
|
|
311
|
+
case 6022:
|
|
312
|
+
return new InvalidAmounts(logs);
|
|
313
|
+
case 6023:
|
|
314
|
+
return new ClaimsLimitReached(logs);
|
|
250
315
|
}
|
|
251
316
|
return null;
|
|
252
317
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { TransactionInstruction, PublicKey } from "@solana/web3.js";
|
|
2
|
+
import BN from "bn.js";
|
|
3
|
+
export interface CloseClaimArgs {
|
|
4
|
+
amountUnlocked?: BN;
|
|
5
|
+
amountLocked?: BN;
|
|
6
|
+
proof?: Array<Array<number>>;
|
|
7
|
+
}
|
|
2
8
|
export interface CloseClaimAccounts {
|
|
3
9
|
/** The [MerkleDistributor]. */
|
|
4
10
|
distributor: PublicKey;
|
|
5
11
|
/** Admin signer */
|
|
6
|
-
|
|
12
|
+
adminOrClaimant: PublicKey;
|
|
7
13
|
claimant: PublicKey;
|
|
8
14
|
/** Claim Status PDA */
|
|
9
15
|
claimStatus: PublicKey;
|
|
@@ -12,4 +18,5 @@ export interface CloseClaimAccounts {
|
|
|
12
18
|
eventAuthority: PublicKey;
|
|
13
19
|
program: PublicKey;
|
|
14
20
|
}
|
|
15
|
-
export declare
|
|
21
|
+
export declare const layout: any;
|
|
22
|
+
export declare function closeClaim(args: CloseClaimArgs, accounts: CloseClaimAccounts, programId?: PublicKey): TransactionInstruction;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { TransactionInstruction } from "@solana/web3.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import * as borsh from "@coral-xyz/borsh"; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
3
|
import { Buffer } from "buffer";
|
|
3
4
|
import { PROGRAM_ID } from "../programId";
|
|
4
|
-
export
|
|
5
|
+
export const layout = borsh.struct([
|
|
6
|
+
borsh.option(borsh.u64(), "amountUnlocked"),
|
|
7
|
+
borsh.option(borsh.u64(), "amountLocked"),
|
|
8
|
+
borsh.option(borsh.vec(borsh.array(borsh.u8(), 32)), "proof"),
|
|
9
|
+
]);
|
|
10
|
+
export function closeClaim(args, accounts, programId = PROGRAM_ID) {
|
|
5
11
|
const keys = [
|
|
6
12
|
{ pubkey: accounts.distributor, isSigner: false, isWritable: true },
|
|
7
|
-
{ pubkey: accounts.
|
|
13
|
+
{ pubkey: accounts.adminOrClaimant, isSigner: true, isWritable: true },
|
|
8
14
|
{ pubkey: accounts.claimant, isSigner: false, isWritable: false },
|
|
9
15
|
{ pubkey: accounts.claimStatus, isSigner: false, isWritable: true },
|
|
10
16
|
{ pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
|
|
@@ -12,7 +18,13 @@ export function closeClaim(accounts, programId = PROGRAM_ID) {
|
|
|
12
18
|
{ pubkey: accounts.program, isSigner: false, isWritable: false },
|
|
13
19
|
];
|
|
14
20
|
const identifier = Buffer.from([42, 177, 165, 35, 213, 179, 211, 19]);
|
|
15
|
-
const
|
|
21
|
+
const buffer = Buffer.alloc(1000);
|
|
22
|
+
const len = layout.encode({
|
|
23
|
+
amountUnlocked: args.amountUnlocked,
|
|
24
|
+
amountLocked: args.amountLocked,
|
|
25
|
+
proof: args.proof,
|
|
26
|
+
}, buffer);
|
|
27
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len);
|
|
16
28
|
const ix = new TransactionInstruction({ keys, programId, data });
|
|
17
29
|
return ix;
|
|
18
30
|
}
|
|
@@ -9,7 +9,9 @@ export interface NewDistributorArgs {
|
|
|
9
9
|
startVestingTs: BN;
|
|
10
10
|
endVestingTs: BN;
|
|
11
11
|
clawbackStartTs: BN;
|
|
12
|
-
|
|
12
|
+
claimsClosableByAdmin: boolean;
|
|
13
|
+
claimsClosableByClaimant?: boolean;
|
|
14
|
+
claimsLimit?: number;
|
|
13
15
|
}
|
|
14
16
|
export interface NewDistributorAccounts {
|
|
15
17
|
/** [MerkleDistributor]. */
|
|
@@ -64,12 +64,12 @@ export function newDistributor(args, accounts, programId = PROGRAM_ID) {
|
|
|
64
64
|
startVestingTs: args.startVestingTs,
|
|
65
65
|
endVestingTs: args.endVestingTs,
|
|
66
66
|
clawbackStartTs: args.clawbackStartTs,
|
|
67
|
-
claimsClosableByAdmin: args.
|
|
67
|
+
claimsClosableByAdmin: args.claimsClosableByAdmin,
|
|
68
68
|
canUpdateDuration: null,
|
|
69
69
|
totalAmountUnlocked: null,
|
|
70
70
|
totalAmountLocked: null,
|
|
71
|
-
claimsClosableByClaimant:
|
|
72
|
-
claimsLimit:
|
|
71
|
+
claimsClosableByClaimant: args.claimsClosableByClaimant,
|
|
72
|
+
claimsLimit: args.claimsLimit,
|
|
73
73
|
}, buffer);
|
|
74
74
|
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len);
|
|
75
75
|
const ix = new TransactionInstruction({ keys, programId, data });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SignerWalletAdapter } from "@solana/wallet-adapter-base";
|
|
2
|
-
import { Keypair } from "@solana/web3.js";
|
|
2
|
+
import { Keypair, PublicKey } from "@solana/web3.js";
|
|
3
3
|
import { ITransactionResult } from "@streamflow/common";
|
|
4
4
|
import { ITransactionSolanaExt } from "@streamflow/common/solana";
|
|
5
5
|
import BN from "bn.js";
|
|
@@ -23,7 +23,9 @@ export interface ICreateDistributorData {
|
|
|
23
23
|
startVestingTs: number;
|
|
24
24
|
endVestingTs: number;
|
|
25
25
|
clawbackStartTs: number;
|
|
26
|
-
|
|
26
|
+
claimsClosableByAdmin: boolean;
|
|
27
|
+
claimsClosableByClaimant?: boolean;
|
|
28
|
+
claimsLimit?: number;
|
|
27
29
|
}
|
|
28
30
|
export interface AlignedDistributorData {
|
|
29
31
|
sender: string;
|
|
@@ -67,6 +69,9 @@ export interface IClaimData {
|
|
|
67
69
|
amountLocked: BN;
|
|
68
70
|
proof: Array<Array<number>>;
|
|
69
71
|
}
|
|
72
|
+
export interface ICloseClaimData extends IClaimData {
|
|
73
|
+
claimant: string | PublicKey;
|
|
74
|
+
}
|
|
70
75
|
export interface IClawbackData {
|
|
71
76
|
id: string;
|
|
72
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/distributor",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
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": "
|
|
29
|
+
"gitHead": "7c307d2f70d9af073ceab20597865394295a459b",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@streamflow/eslint-config": "7.
|
|
31
|
+
"@streamflow/eslint-config": "7.4.0",
|
|
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.
|
|
43
|
+
"@streamflow/common": "7.4.0",
|
|
44
44
|
"bn.js": "5.2.1",
|
|
45
45
|
"borsh": "^2.0.0",
|
|
46
46
|
"bs58": "5.0.0",
|