@streamflow/distributor 6.0.0-alpha.1 → 6.0.0-alpha.10
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/solana/client.d.ts +6 -5
- package/dist/solana/client.js +52 -55
- package/dist/solana/generated/accounts/ClaimStatus.js +2 -2
- package/dist/solana/generated/errors/custom.d.ts +48 -56
- package/dist/solana/generated/errors/custom.js +95 -111
- package/dist/solana/generated/instructions/claimLocked.js +1 -1
- package/dist/solana/generated/instructions/clawback.d.ts +2 -5
- package/dist/solana/generated/instructions/clawback.js +2 -2
- package/dist/solana/generated/instructions/closeClaim.js +1 -1
- package/dist/solana/generated/instructions/newClaim.js +2 -2
- package/dist/solana/generated/instructions/newDistributor.js +2 -2
- package/dist/solana/generated/instructions/setAdmin.js +1 -1
- package/dist/solana/generated/instructions/setClawbackReceiver.js +1 -1
- package/dist/solana/types.d.ts +4 -3
- package/dist/solana/utils.js +3 -5
- package/package.json +4 -4
package/dist/solana/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Commitment, ConnectionConfig } from "@solana/web3.js";
|
|
2
2
|
import { ICluster, ITransactionResult } from "@streamflow/common";
|
|
3
|
-
import { IClaimData, IClawbackData, ICreateDistributorData, ICreateDistributorResult,
|
|
3
|
+
import { IClaimData, IClawbackData, ICreateDistributorData, ICreateDistributorResult, IGetClaimData, IGetDistributors, ICreateSolanaExt, IInteractSolanaExt } from "./types";
|
|
4
4
|
import { ClaimStatus, MerkleDistributor } from "./generated/accounts";
|
|
5
5
|
interface IInitOptions {
|
|
6
6
|
clusterUrl: string;
|
|
@@ -16,10 +16,11 @@ export default class SolanaDistributorClient {
|
|
|
16
16
|
* Create Stream instance
|
|
17
17
|
*/
|
|
18
18
|
constructor({ clusterUrl, cluster, commitment, programId }: IInitOptions);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
getCommitment(): Commitment | undefined;
|
|
20
|
+
create(data: ICreateDistributorData, { invoker, isNative, computePrice, computeLimit }: ICreateSolanaExt): Promise<ICreateDistributorResult>;
|
|
21
|
+
claim(data: IClaimData, { invoker, computePrice, computeLimit }: IInteractSolanaExt): Promise<ITransactionResult>;
|
|
22
|
+
clawback(data: IClawbackData, { invoker, computePrice, computeLimit }: IInteractSolanaExt): Promise<ITransactionResult>;
|
|
23
|
+
getClaims(data: IGetClaimData[]): Promise<(ClaimStatus | null)[]>;
|
|
23
24
|
getDistributors(data: IGetDistributors): Promise<(MerkleDistributor | null)[]>;
|
|
24
25
|
}
|
|
25
26
|
export {};
|
package/dist/solana/client.js
CHANGED
|
@@ -83,18 +83,20 @@ var SolanaDistributorClient = /** @class */ (function () {
|
|
|
83
83
|
this.connection = new web3_js_1.Connection(clusterUrl, this.commitment);
|
|
84
84
|
this.programId = programId !== "" ? new web3_js_1.PublicKey(programId) : new web3_js_1.PublicKey(constants_1.DISTRIBUTOR_PROGRAM_ID[cluster]);
|
|
85
85
|
}
|
|
86
|
+
SolanaDistributorClient.prototype.getCommitment = function () {
|
|
87
|
+
return typeof this.commitment == "string" ? this.commitment : this.commitment.commitment;
|
|
88
|
+
};
|
|
86
89
|
SolanaDistributorClient.prototype.create = function (data, _a) {
|
|
87
|
-
var invoker = _a.invoker, _b = _a.isNative, isNative = _b === void 0 ? false : _b;
|
|
90
|
+
var invoker = _a.invoker, _b = _a.isNative, isNative = _b === void 0 ? false : _b, computePrice = _a.computePrice, computeLimit = _a.computeLimit;
|
|
88
91
|
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
-
var ixs, mint, mintAccount, distributorPublicKey, tokenVault, senderTokens, args, accounts, _c, _d, _e, _f,
|
|
90
|
-
var _g;
|
|
92
|
+
var ixs, mint, mintAccount, distributorPublicKey, tokenVault, senderTokens, args, accounts, _c, _d, _e, _f, nowTs, endVestingTs, startVestingTs, _g, tx, hash, signature;
|
|
91
93
|
return __generator(this, function (_h) {
|
|
92
94
|
switch (_h.label) {
|
|
93
95
|
case 0:
|
|
94
96
|
if (!invoker.publicKey) {
|
|
95
97
|
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
96
98
|
}
|
|
97
|
-
ixs =
|
|
99
|
+
ixs = (0, solana_1.prepareBaseInstructions)(this.connection, { computePrice: computePrice, computeLimit: computeLimit });
|
|
98
100
|
mint = isNative ? spl_token_1.NATIVE_MINT : new web3_js_1.PublicKey(data.mint);
|
|
99
101
|
return [4 /*yield*/, (0, spl_token_1.getMint)(this.connection, mint)];
|
|
100
102
|
case 1:
|
|
@@ -136,17 +138,17 @@ var SolanaDistributorClient = /** @class */ (function () {
|
|
|
136
138
|
_d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
|
|
137
139
|
_h.label = 5;
|
|
138
140
|
case 5:
|
|
141
|
+
nowTs = new bn_js_1.default(Math.floor(Date.now() / 1000));
|
|
142
|
+
endVestingTs = args.endVestingTs.eqn(0) ? nowTs : args.endVestingTs;
|
|
143
|
+
startVestingTs = args.startVestingTs.eqn(0) ? nowTs : args.startVestingTs;
|
|
144
|
+
if (endVestingTs.gt(startVestingTs) && endVestingTs.sub(startVestingTs).lt(args.unlockPeriod)) {
|
|
145
|
+
throw new Error("The unlock period cannot be longer than the total vesting duration!");
|
|
146
|
+
}
|
|
139
147
|
ixs.push((0, instructions_1.newDistributor)(args, accounts, this.programId));
|
|
140
148
|
ixs.push((0, spl_token_1.createTransferCheckedInstruction)(senderTokens, mint, tokenVault, invoker.publicKey, BigInt(data.maxTotalClaim.toString()), mintAccount.decimals));
|
|
141
|
-
|
|
142
|
-
return [4 /*yield*/, this.connection.getLatestBlockhash(commitment)];
|
|
149
|
+
return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey)];
|
|
143
150
|
case 6:
|
|
144
|
-
|
|
145
|
-
tx = (_g = new web3_js_1.Transaction({
|
|
146
|
-
feePayer: invoker.publicKey,
|
|
147
|
-
blockhash: hash.blockhash,
|
|
148
|
-
lastValidBlockHeight: hash.lastValidBlockHeight,
|
|
149
|
-
})).add.apply(_g, __spreadArray([], __read(ixs), false));
|
|
151
|
+
_g = _h.sent(), tx = _g.tx, hash = _g.hash;
|
|
150
152
|
return [4 /*yield*/, (0, utils_1.wrappedSignAndExecuteTransaction)(this.connection, invoker, tx, hash)];
|
|
151
153
|
case 7:
|
|
152
154
|
signature = _h.sent();
|
|
@@ -160,12 +162,11 @@ var SolanaDistributorClient = /** @class */ (function () {
|
|
|
160
162
|
});
|
|
161
163
|
};
|
|
162
164
|
SolanaDistributorClient.prototype.claim = function (data, _a) {
|
|
163
|
-
var invoker = _a.invoker;
|
|
165
|
+
var invoker = _a.invoker, computePrice = _a.computePrice, computeLimit = _a.computeLimit;
|
|
164
166
|
return __awaiter(this, void 0, void 0, function () {
|
|
165
|
-
var distributorPublicKey, distributor, ixs, invokerTokens, claimStatusPublicKey, claimStatus, accounts, args,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
switch (_c.label) {
|
|
167
|
+
var distributorPublicKey, distributor, ixs, _b, _c, _d, _e, invokerTokens, claimStatusPublicKey, claimStatus, accounts, args, nowTs, _f, tx, hash, signature;
|
|
168
|
+
return __generator(this, function (_g) {
|
|
169
|
+
switch (_g.label) {
|
|
169
170
|
case 0:
|
|
170
171
|
if (!invoker.publicKey) {
|
|
171
172
|
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
@@ -173,20 +174,24 @@ var SolanaDistributorClient = /** @class */ (function () {
|
|
|
173
174
|
distributorPublicKey = new web3_js_1.PublicKey(data.id);
|
|
174
175
|
return [4 /*yield*/, accounts_1.MerkleDistributor.fetch(this.connection, distributorPublicKey)];
|
|
175
176
|
case 1:
|
|
176
|
-
distributor =
|
|
177
|
+
distributor = _g.sent();
|
|
177
178
|
if (!distributor) {
|
|
178
179
|
throw new Error("Couldn't get account info");
|
|
179
180
|
}
|
|
181
|
+
ixs = (0, solana_1.prepareBaseInstructions)(this.connection, { computePrice: computePrice, computeLimit: computeLimit });
|
|
182
|
+
_c = (_b = ixs.push).apply;
|
|
183
|
+
_d = [ixs];
|
|
184
|
+
_e = [[]];
|
|
180
185
|
return [4 /*yield*/, (0, solana_1.checkOrCreateAtaBatch)(this.connection, [invoker.publicKey], distributor.mint, invoker)];
|
|
181
186
|
case 2:
|
|
182
|
-
|
|
187
|
+
_c.apply(_b, _d.concat([__spreadArray.apply(void 0, _e.concat([__read.apply(void 0, [(_g.sent())]), false]))]));
|
|
183
188
|
return [4 /*yield*/, (0, solana_1.ata)(distributor.mint, invoker.publicKey)];
|
|
184
189
|
case 3:
|
|
185
|
-
invokerTokens =
|
|
190
|
+
invokerTokens = _g.sent();
|
|
186
191
|
claimStatusPublicKey = (0, utils_1.getClaimantStatusPda)(this.programId, distributorPublicKey, invoker.publicKey);
|
|
187
192
|
return [4 /*yield*/, accounts_1.ClaimStatus.fetch(this.connection, claimStatusPublicKey)];
|
|
188
193
|
case 4:
|
|
189
|
-
claimStatus =
|
|
194
|
+
claimStatus = _g.sent();
|
|
190
195
|
accounts = {
|
|
191
196
|
distributor: distributorPublicKey,
|
|
192
197
|
claimStatus: claimStatusPublicKey,
|
|
@@ -197,10 +202,7 @@ var SolanaDistributorClient = /** @class */ (function () {
|
|
|
197
202
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
198
203
|
systemProgram: web3_js_1.SystemProgram.programId,
|
|
199
204
|
};
|
|
200
|
-
if (claimStatus) {
|
|
201
|
-
ixs.push((0, instructions_1.claimLocked)(accounts, this.programId));
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
205
|
+
if (!claimStatus) {
|
|
204
206
|
args = {
|
|
205
207
|
amountLocked: data.amountLocked,
|
|
206
208
|
amountUnlocked: data.amountUnlocked,
|
|
@@ -208,30 +210,27 @@ var SolanaDistributorClient = /** @class */ (function () {
|
|
|
208
210
|
};
|
|
209
211
|
ixs.push((0, instructions_1.newClaim)(args, accounts, this.programId));
|
|
210
212
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
+
nowTs = new bn_js_1.default(Math.floor(Date.now() / 1000));
|
|
214
|
+
if (claimStatus || (data.amountLocked.gtn(0) && nowTs.sub(distributor.startTs).gte(distributor.unlockPeriod))) {
|
|
215
|
+
ixs.push((0, instructions_1.claimLocked)(accounts, this.programId));
|
|
216
|
+
}
|
|
217
|
+
return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey)];
|
|
213
218
|
case 5:
|
|
214
|
-
|
|
215
|
-
tx = (_b = new web3_js_1.Transaction({
|
|
216
|
-
feePayer: invoker.publicKey,
|
|
217
|
-
blockhash: hash.blockhash,
|
|
218
|
-
lastValidBlockHeight: hash.lastValidBlockHeight,
|
|
219
|
-
})).add.apply(_b, __spreadArray([], __read(ixs), false));
|
|
219
|
+
_f = _g.sent(), tx = _f.tx, hash = _f.hash;
|
|
220
220
|
return [4 /*yield*/, (0, utils_1.wrappedSignAndExecuteTransaction)(this.connection, invoker, tx, hash)];
|
|
221
221
|
case 6:
|
|
222
|
-
signature =
|
|
222
|
+
signature = _g.sent();
|
|
223
223
|
return [2 /*return*/, { ixs: ixs, txId: signature }];
|
|
224
224
|
}
|
|
225
225
|
});
|
|
226
226
|
});
|
|
227
227
|
};
|
|
228
228
|
SolanaDistributorClient.prototype.clawback = function (data, _a) {
|
|
229
|
-
var invoker = _a.invoker;
|
|
229
|
+
var invoker = _a.invoker, computePrice = _a.computePrice, computeLimit = _a.computeLimit;
|
|
230
230
|
return __awaiter(this, void 0, void 0, function () {
|
|
231
|
-
var distributorPublicKey, distributor, ixs,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
switch (_c.label) {
|
|
231
|
+
var distributorPublicKey, distributor, ixs, _b, _c, _d, _e, accounts, _f, tx, hash, signature;
|
|
232
|
+
return __generator(this, function (_g) {
|
|
233
|
+
switch (_g.label) {
|
|
235
234
|
case 0:
|
|
236
235
|
if (!invoker.publicKey) {
|
|
237
236
|
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
@@ -239,35 +238,33 @@ var SolanaDistributorClient = /** @class */ (function () {
|
|
|
239
238
|
distributorPublicKey = new web3_js_1.PublicKey(data.id);
|
|
240
239
|
return [4 /*yield*/, accounts_1.MerkleDistributor.fetch(this.connection, distributorPublicKey)];
|
|
241
240
|
case 1:
|
|
242
|
-
distributor =
|
|
241
|
+
distributor = _g.sent();
|
|
243
242
|
if (!distributor) {
|
|
244
243
|
throw new Error("Couldn't get account info");
|
|
245
244
|
}
|
|
245
|
+
ixs = (0, solana_1.prepareBaseInstructions)(this.connection, { computePrice: computePrice, computeLimit: computeLimit });
|
|
246
|
+
_c = (_b = ixs.push).apply;
|
|
247
|
+
_d = [ixs];
|
|
248
|
+
_e = [[]];
|
|
246
249
|
return [4 /*yield*/, (0, solana_1.checkOrCreateAtaBatch)(this.connection, [invoker.publicKey], distributor.mint, invoker)];
|
|
247
250
|
case 2:
|
|
248
|
-
|
|
251
|
+
_c.apply(_b, _d.concat([__spreadArray.apply(void 0, _e.concat([__read.apply(void 0, [(_g.sent())]), false]))]));
|
|
249
252
|
accounts = {
|
|
250
253
|
distributor: distributorPublicKey,
|
|
251
254
|
from: distributor.tokenVault,
|
|
252
255
|
to: distributor.clawbackReceiver,
|
|
253
|
-
|
|
256
|
+
admin: invoker.publicKey,
|
|
254
257
|
mint: distributor.mint,
|
|
255
258
|
systemProgram: web3_js_1.SystemProgram.programId,
|
|
256
259
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
257
260
|
};
|
|
258
261
|
ixs.push((0, instructions_1.clawback)(accounts, this.programId));
|
|
259
|
-
|
|
260
|
-
return [4 /*yield*/, this.connection.getLatestBlockhash(commitment)];
|
|
262
|
+
return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey)];
|
|
261
263
|
case 3:
|
|
262
|
-
|
|
263
|
-
tx = (_b = new web3_js_1.Transaction({
|
|
264
|
-
feePayer: invoker.publicKey,
|
|
265
|
-
blockhash: hash.blockhash,
|
|
266
|
-
lastValidBlockHeight: hash.lastValidBlockHeight,
|
|
267
|
-
})).add.apply(_b, __spreadArray([], __read(ixs), false));
|
|
264
|
+
_f = _g.sent(), tx = _f.tx, hash = _f.hash;
|
|
268
265
|
return [4 /*yield*/, (0, utils_1.wrappedSignAndExecuteTransaction)(this.connection, invoker, tx, hash)];
|
|
269
266
|
case 4:
|
|
270
|
-
signature =
|
|
267
|
+
signature = _g.sent();
|
|
271
268
|
return [2 /*return*/, { ixs: ixs, txId: signature }];
|
|
272
269
|
}
|
|
273
270
|
});
|
|
@@ -275,12 +272,12 @@ var SolanaDistributorClient = /** @class */ (function () {
|
|
|
275
272
|
};
|
|
276
273
|
SolanaDistributorClient.prototype.getClaims = function (data) {
|
|
277
274
|
return __awaiter(this, void 0, void 0, function () {
|
|
278
|
-
var
|
|
275
|
+
var claimStatusPublicKeys;
|
|
279
276
|
var _this = this;
|
|
280
277
|
return __generator(this, function (_a) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return (0, utils_1.getClaimantStatusPda)(_this.programId,
|
|
278
|
+
claimStatusPublicKeys = data.map(function (_a) {
|
|
279
|
+
var id = _a.id, recipient = _a.recipient;
|
|
280
|
+
return (0, utils_1.getClaimantStatusPda)(_this.programId, new web3_js_1.PublicKey(id), new web3_js_1.PublicKey(recipient));
|
|
284
281
|
});
|
|
285
282
|
return [2 /*return*/, accounts_1.ClaimStatus.fetchMultiple(this.connection, claimStatusPublicKeys, this.programId)];
|
|
286
283
|
});
|
|
@@ -64,8 +64,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
64
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
65
|
exports.ClaimStatus = void 0;
|
|
66
66
|
var web3_js_1 = require("@solana/web3.js");
|
|
67
|
-
var bn_js_1 = __importDefault(require("bn.js"));
|
|
68
|
-
var borsh = __importStar(require("@coral-xyz/borsh"));
|
|
67
|
+
var bn_js_1 = __importDefault(require("bn.js")); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
68
|
+
var borsh = __importStar(require("@coral-xyz/borsh")); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
69
69
|
var programId_1 = require("../programId");
|
|
70
70
|
/** Holds whether or not a claimant has claimed tokens. */
|
|
71
71
|
var ClaimStatus = /** @class */ (function () {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type CustomError = InsufficientUnlockedTokens |
|
|
1
|
+
export type CustomError = InsufficientUnlockedTokens | InvalidProof | ExceededMaxClaim | MaxNodesExceeded | Unauthorized | OwnerMismatch | ClawbackBeforeStart | ClawbackAlreadyClaimed | SameClawbackReceiver | ClawbackReceiverIsTokenVault | SameAdmin | ClaimExpired | ArithmeticError | StartTimestampAfterEnd | TimestampsNotInFuture | InvalidMint | ClaimIsClosed | ClaimsAreNotClosable | InvalidUnlockPeriod;
|
|
2
2
|
export declare class InsufficientUnlockedTokens extends Error {
|
|
3
3
|
readonly logs?: string[] | undefined;
|
|
4
4
|
static readonly code = 6000;
|
|
@@ -7,156 +7,148 @@ export declare class InsufficientUnlockedTokens extends Error {
|
|
|
7
7
|
readonly msg = "Insufficient unlocked tokens";
|
|
8
8
|
constructor(logs?: string[] | undefined);
|
|
9
9
|
}
|
|
10
|
-
export declare class
|
|
10
|
+
export declare class InvalidProof extends Error {
|
|
11
11
|
readonly logs?: string[] | undefined;
|
|
12
12
|
static readonly code = 6001;
|
|
13
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
14
|
readonly name = "InvalidProof";
|
|
23
15
|
readonly msg = "Invalid Merkle proof";
|
|
24
16
|
constructor(logs?: string[] | undefined);
|
|
25
17
|
}
|
|
26
18
|
export declare class ExceededMaxClaim extends Error {
|
|
27
19
|
readonly logs?: string[] | undefined;
|
|
28
|
-
static readonly code =
|
|
29
|
-
readonly code =
|
|
20
|
+
static readonly code = 6002;
|
|
21
|
+
readonly code = 6002;
|
|
30
22
|
readonly name = "ExceededMaxClaim";
|
|
31
23
|
readonly msg = "Exceeded maximum claim amount";
|
|
32
24
|
constructor(logs?: string[] | undefined);
|
|
33
25
|
}
|
|
34
26
|
export declare class MaxNodesExceeded extends Error {
|
|
35
27
|
readonly logs?: string[] | undefined;
|
|
36
|
-
static readonly code =
|
|
37
|
-
readonly code =
|
|
28
|
+
static readonly code = 6003;
|
|
29
|
+
readonly code = 6003;
|
|
38
30
|
readonly name = "MaxNodesExceeded";
|
|
39
31
|
readonly msg = "Exceeded maximum node count";
|
|
40
32
|
constructor(logs?: string[] | undefined);
|
|
41
33
|
}
|
|
42
34
|
export declare class Unauthorized extends Error {
|
|
43
35
|
readonly logs?: string[] | undefined;
|
|
44
|
-
static readonly code =
|
|
45
|
-
readonly code =
|
|
36
|
+
static readonly code = 6004;
|
|
37
|
+
readonly code = 6004;
|
|
46
38
|
readonly name = "Unauthorized";
|
|
47
39
|
readonly msg = "Account is not authorized to execute this instruction";
|
|
48
40
|
constructor(logs?: string[] | undefined);
|
|
49
41
|
}
|
|
50
42
|
export declare class OwnerMismatch extends Error {
|
|
51
43
|
readonly logs?: string[] | undefined;
|
|
52
|
-
static readonly code =
|
|
53
|
-
readonly code =
|
|
44
|
+
static readonly code = 6005;
|
|
45
|
+
readonly code = 6005;
|
|
54
46
|
readonly name = "OwnerMismatch";
|
|
55
47
|
readonly msg = "Token account owner did not match intended owner";
|
|
56
48
|
constructor(logs?: string[] | undefined);
|
|
57
49
|
}
|
|
58
50
|
export declare class ClawbackBeforeStart extends Error {
|
|
59
51
|
readonly logs?: string[] | undefined;
|
|
60
|
-
static readonly code =
|
|
61
|
-
readonly code =
|
|
52
|
+
static readonly code = 6006;
|
|
53
|
+
readonly code = 6006;
|
|
62
54
|
readonly name = "ClawbackBeforeStart";
|
|
63
55
|
readonly msg = "Attempted clawback before start";
|
|
64
56
|
constructor(logs?: string[] | undefined);
|
|
65
57
|
}
|
|
66
58
|
export declare class ClawbackAlreadyClaimed extends Error {
|
|
67
59
|
readonly logs?: string[] | undefined;
|
|
68
|
-
static readonly code =
|
|
69
|
-
readonly code =
|
|
60
|
+
static readonly code = 6007;
|
|
61
|
+
readonly code = 6007;
|
|
70
62
|
readonly name = "ClawbackAlreadyClaimed";
|
|
71
63
|
readonly msg = "Clawback already claimed";
|
|
72
64
|
constructor(logs?: string[] | undefined);
|
|
73
65
|
}
|
|
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
66
|
export declare class SameClawbackReceiver extends Error {
|
|
83
67
|
readonly logs?: string[] | undefined;
|
|
84
|
-
static readonly code =
|
|
85
|
-
readonly code =
|
|
68
|
+
static readonly code = 6008;
|
|
69
|
+
readonly code = 6008;
|
|
86
70
|
readonly name = "SameClawbackReceiver";
|
|
87
71
|
readonly msg = "New and old Clawback receivers are identical";
|
|
88
72
|
constructor(logs?: string[] | undefined);
|
|
89
73
|
}
|
|
74
|
+
export declare class ClawbackReceiverIsTokenVault extends Error {
|
|
75
|
+
readonly logs?: string[] | undefined;
|
|
76
|
+
static readonly code = 6009;
|
|
77
|
+
readonly code = 6009;
|
|
78
|
+
readonly name = "ClawbackReceiverIsTokenVault";
|
|
79
|
+
readonly msg = "Clawback receiver can not be the Token Vault";
|
|
80
|
+
constructor(logs?: string[] | undefined);
|
|
81
|
+
}
|
|
90
82
|
export declare class SameAdmin extends Error {
|
|
91
83
|
readonly logs?: string[] | undefined;
|
|
92
|
-
static readonly code =
|
|
93
|
-
readonly code =
|
|
84
|
+
static readonly code = 6010;
|
|
85
|
+
readonly code = 6010;
|
|
94
86
|
readonly name = "SameAdmin";
|
|
95
87
|
readonly msg = "New and old admin are identical";
|
|
96
88
|
constructor(logs?: string[] | undefined);
|
|
97
89
|
}
|
|
98
90
|
export declare class ClaimExpired extends Error {
|
|
99
91
|
readonly logs?: string[] | undefined;
|
|
100
|
-
static readonly code =
|
|
101
|
-
readonly code =
|
|
92
|
+
static readonly code = 6011;
|
|
93
|
+
readonly code = 6011;
|
|
102
94
|
readonly name = "ClaimExpired";
|
|
103
95
|
readonly msg = "Claim window expired";
|
|
104
96
|
constructor(logs?: string[] | undefined);
|
|
105
97
|
}
|
|
106
98
|
export declare class ArithmeticError extends Error {
|
|
107
99
|
readonly logs?: string[] | undefined;
|
|
108
|
-
static readonly code =
|
|
109
|
-
readonly code =
|
|
100
|
+
static readonly code = 6012;
|
|
101
|
+
readonly code = 6012;
|
|
110
102
|
readonly name = "ArithmeticError";
|
|
111
103
|
readonly msg = "Arithmetic Error (overflow/underflow)";
|
|
112
104
|
constructor(logs?: string[] | undefined);
|
|
113
105
|
}
|
|
114
106
|
export declare class StartTimestampAfterEnd extends Error {
|
|
115
107
|
readonly logs?: string[] | undefined;
|
|
116
|
-
static readonly code =
|
|
117
|
-
readonly code =
|
|
108
|
+
static readonly code = 6013;
|
|
109
|
+
readonly code = 6013;
|
|
118
110
|
readonly name = "StartTimestampAfterEnd";
|
|
119
111
|
readonly msg = "Start Timestamp cannot be after end Timestamp";
|
|
120
112
|
constructor(logs?: string[] | undefined);
|
|
121
113
|
}
|
|
122
114
|
export declare class TimestampsNotInFuture extends Error {
|
|
123
115
|
readonly logs?: string[] | undefined;
|
|
124
|
-
static readonly code =
|
|
125
|
-
readonly code =
|
|
116
|
+
static readonly code = 6014;
|
|
117
|
+
readonly code = 6014;
|
|
126
118
|
readonly name = "TimestampsNotInFuture";
|
|
127
119
|
readonly msg = "Timestamps cannot be in the past";
|
|
128
120
|
constructor(logs?: string[] | undefined);
|
|
129
121
|
}
|
|
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
122
|
export declare class InvalidMint extends Error {
|
|
139
123
|
readonly logs?: string[] | undefined;
|
|
140
|
-
static readonly code =
|
|
141
|
-
readonly code =
|
|
124
|
+
static readonly code = 6015;
|
|
125
|
+
readonly code = 6015;
|
|
142
126
|
readonly name = "InvalidMint";
|
|
143
127
|
readonly msg = "Invalid Mint";
|
|
144
128
|
constructor(logs?: string[] | undefined);
|
|
145
129
|
}
|
|
146
130
|
export declare class ClaimIsClosed extends Error {
|
|
147
131
|
readonly logs?: string[] | undefined;
|
|
148
|
-
static readonly code =
|
|
149
|
-
readonly code =
|
|
132
|
+
static readonly code = 6016;
|
|
133
|
+
readonly code = 6016;
|
|
150
134
|
readonly name = "ClaimIsClosed";
|
|
151
135
|
readonly msg = "Claim is closed";
|
|
152
136
|
constructor(logs?: string[] | undefined);
|
|
153
137
|
}
|
|
154
138
|
export declare class ClaimsAreNotClosable extends Error {
|
|
155
139
|
readonly logs?: string[] | undefined;
|
|
156
|
-
static readonly code =
|
|
157
|
-
readonly code =
|
|
140
|
+
static readonly code = 6017;
|
|
141
|
+
readonly code = 6017;
|
|
158
142
|
readonly name = "ClaimsAreNotClosable";
|
|
159
143
|
readonly msg = "Claims are not closable";
|
|
160
144
|
constructor(logs?: string[] | undefined);
|
|
161
145
|
}
|
|
146
|
+
export declare class InvalidUnlockPeriod extends Error {
|
|
147
|
+
readonly logs?: string[] | undefined;
|
|
148
|
+
static readonly code = 6018;
|
|
149
|
+
readonly code = 6018;
|
|
150
|
+
readonly name = "InvalidUnlockPeriod";
|
|
151
|
+
readonly msg = "Invalid unlock period";
|
|
152
|
+
constructor(logs?: string[] | undefined);
|
|
153
|
+
}
|
|
162
154
|
export declare function fromCode(code: number, logs?: string[]): CustomError | null;
|
|
@@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.fromCode = exports.
|
|
18
|
+
exports.fromCode = 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;
|
|
19
19
|
var InsufficientUnlockedTokens = /** @class */ (function (_super) {
|
|
20
20
|
__extends(InsufficientUnlockedTokens, _super);
|
|
21
21
|
function InsufficientUnlockedTokens(logs) {
|
|
@@ -30,314 +30,298 @@ var InsufficientUnlockedTokens = /** @class */ (function (_super) {
|
|
|
30
30
|
return InsufficientUnlockedTokens;
|
|
31
31
|
}(Error));
|
|
32
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
33
|
var InvalidProof = /** @class */ (function (_super) {
|
|
48
34
|
__extends(InvalidProof, _super);
|
|
49
35
|
function InvalidProof(logs) {
|
|
50
|
-
var _this = _super.call(this, "
|
|
36
|
+
var _this = _super.call(this, "6001: Invalid Merkle proof") || this;
|
|
51
37
|
_this.logs = logs;
|
|
52
|
-
_this.code =
|
|
38
|
+
_this.code = 6001;
|
|
53
39
|
_this.name = "InvalidProof";
|
|
54
40
|
_this.msg = "Invalid Merkle proof";
|
|
55
41
|
return _this;
|
|
56
42
|
}
|
|
57
|
-
InvalidProof.code =
|
|
43
|
+
InvalidProof.code = 6001;
|
|
58
44
|
return InvalidProof;
|
|
59
45
|
}(Error));
|
|
60
46
|
exports.InvalidProof = InvalidProof;
|
|
61
47
|
var ExceededMaxClaim = /** @class */ (function (_super) {
|
|
62
48
|
__extends(ExceededMaxClaim, _super);
|
|
63
49
|
function ExceededMaxClaim(logs) {
|
|
64
|
-
var _this = _super.call(this, "
|
|
50
|
+
var _this = _super.call(this, "6002: Exceeded maximum claim amount") || this;
|
|
65
51
|
_this.logs = logs;
|
|
66
|
-
_this.code =
|
|
52
|
+
_this.code = 6002;
|
|
67
53
|
_this.name = "ExceededMaxClaim";
|
|
68
54
|
_this.msg = "Exceeded maximum claim amount";
|
|
69
55
|
return _this;
|
|
70
56
|
}
|
|
71
|
-
ExceededMaxClaim.code =
|
|
57
|
+
ExceededMaxClaim.code = 6002;
|
|
72
58
|
return ExceededMaxClaim;
|
|
73
59
|
}(Error));
|
|
74
60
|
exports.ExceededMaxClaim = ExceededMaxClaim;
|
|
75
61
|
var MaxNodesExceeded = /** @class */ (function (_super) {
|
|
76
62
|
__extends(MaxNodesExceeded, _super);
|
|
77
63
|
function MaxNodesExceeded(logs) {
|
|
78
|
-
var _this = _super.call(this, "
|
|
64
|
+
var _this = _super.call(this, "6003: Exceeded maximum node count") || this;
|
|
79
65
|
_this.logs = logs;
|
|
80
|
-
_this.code =
|
|
66
|
+
_this.code = 6003;
|
|
81
67
|
_this.name = "MaxNodesExceeded";
|
|
82
68
|
_this.msg = "Exceeded maximum node count";
|
|
83
69
|
return _this;
|
|
84
70
|
}
|
|
85
|
-
MaxNodesExceeded.code =
|
|
71
|
+
MaxNodesExceeded.code = 6003;
|
|
86
72
|
return MaxNodesExceeded;
|
|
87
73
|
}(Error));
|
|
88
74
|
exports.MaxNodesExceeded = MaxNodesExceeded;
|
|
89
75
|
var Unauthorized = /** @class */ (function (_super) {
|
|
90
76
|
__extends(Unauthorized, _super);
|
|
91
77
|
function Unauthorized(logs) {
|
|
92
|
-
var _this = _super.call(this, "
|
|
78
|
+
var _this = _super.call(this, "6004: Account is not authorized to execute this instruction") || this;
|
|
93
79
|
_this.logs = logs;
|
|
94
|
-
_this.code =
|
|
80
|
+
_this.code = 6004;
|
|
95
81
|
_this.name = "Unauthorized";
|
|
96
82
|
_this.msg = "Account is not authorized to execute this instruction";
|
|
97
83
|
return _this;
|
|
98
84
|
}
|
|
99
|
-
Unauthorized.code =
|
|
85
|
+
Unauthorized.code = 6004;
|
|
100
86
|
return Unauthorized;
|
|
101
87
|
}(Error));
|
|
102
88
|
exports.Unauthorized = Unauthorized;
|
|
103
89
|
var OwnerMismatch = /** @class */ (function (_super) {
|
|
104
90
|
__extends(OwnerMismatch, _super);
|
|
105
91
|
function OwnerMismatch(logs) {
|
|
106
|
-
var _this = _super.call(this, "
|
|
92
|
+
var _this = _super.call(this, "6005: Token account owner did not match intended owner") || this;
|
|
107
93
|
_this.logs = logs;
|
|
108
|
-
_this.code =
|
|
94
|
+
_this.code = 6005;
|
|
109
95
|
_this.name = "OwnerMismatch";
|
|
110
96
|
_this.msg = "Token account owner did not match intended owner";
|
|
111
97
|
return _this;
|
|
112
98
|
}
|
|
113
|
-
OwnerMismatch.code =
|
|
99
|
+
OwnerMismatch.code = 6005;
|
|
114
100
|
return OwnerMismatch;
|
|
115
101
|
}(Error));
|
|
116
102
|
exports.OwnerMismatch = OwnerMismatch;
|
|
117
103
|
var ClawbackBeforeStart = /** @class */ (function (_super) {
|
|
118
104
|
__extends(ClawbackBeforeStart, _super);
|
|
119
105
|
function ClawbackBeforeStart(logs) {
|
|
120
|
-
var _this = _super.call(this, "
|
|
106
|
+
var _this = _super.call(this, "6006: Attempted clawback before start") || this;
|
|
121
107
|
_this.logs = logs;
|
|
122
|
-
_this.code =
|
|
108
|
+
_this.code = 6006;
|
|
123
109
|
_this.name = "ClawbackBeforeStart";
|
|
124
110
|
_this.msg = "Attempted clawback before start";
|
|
125
111
|
return _this;
|
|
126
112
|
}
|
|
127
|
-
ClawbackBeforeStart.code =
|
|
113
|
+
ClawbackBeforeStart.code = 6006;
|
|
128
114
|
return ClawbackBeforeStart;
|
|
129
115
|
}(Error));
|
|
130
116
|
exports.ClawbackBeforeStart = ClawbackBeforeStart;
|
|
131
117
|
var ClawbackAlreadyClaimed = /** @class */ (function (_super) {
|
|
132
118
|
__extends(ClawbackAlreadyClaimed, _super);
|
|
133
119
|
function ClawbackAlreadyClaimed(logs) {
|
|
134
|
-
var _this = _super.call(this, "
|
|
120
|
+
var _this = _super.call(this, "6007: Clawback already claimed") || this;
|
|
135
121
|
_this.logs = logs;
|
|
136
|
-
_this.code =
|
|
122
|
+
_this.code = 6007;
|
|
137
123
|
_this.name = "ClawbackAlreadyClaimed";
|
|
138
124
|
_this.msg = "Clawback already claimed";
|
|
139
125
|
return _this;
|
|
140
126
|
}
|
|
141
|
-
ClawbackAlreadyClaimed.code =
|
|
127
|
+
ClawbackAlreadyClaimed.code = 6007;
|
|
142
128
|
return ClawbackAlreadyClaimed;
|
|
143
129
|
}(Error));
|
|
144
130
|
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
131
|
var SameClawbackReceiver = /** @class */ (function (_super) {
|
|
160
132
|
__extends(SameClawbackReceiver, _super);
|
|
161
133
|
function SameClawbackReceiver(logs) {
|
|
162
|
-
var _this = _super.call(this, "
|
|
134
|
+
var _this = _super.call(this, "6008: New and old Clawback receivers are identical") || this;
|
|
163
135
|
_this.logs = logs;
|
|
164
|
-
_this.code =
|
|
136
|
+
_this.code = 6008;
|
|
165
137
|
_this.name = "SameClawbackReceiver";
|
|
166
138
|
_this.msg = "New and old Clawback receivers are identical";
|
|
167
139
|
return _this;
|
|
168
140
|
}
|
|
169
|
-
SameClawbackReceiver.code =
|
|
141
|
+
SameClawbackReceiver.code = 6008;
|
|
170
142
|
return SameClawbackReceiver;
|
|
171
143
|
}(Error));
|
|
172
144
|
exports.SameClawbackReceiver = SameClawbackReceiver;
|
|
145
|
+
var ClawbackReceiverIsTokenVault = /** @class */ (function (_super) {
|
|
146
|
+
__extends(ClawbackReceiverIsTokenVault, _super);
|
|
147
|
+
function ClawbackReceiverIsTokenVault(logs) {
|
|
148
|
+
var _this = _super.call(this, "6009: Clawback receiver can not be the Token Vault") || this;
|
|
149
|
+
_this.logs = logs;
|
|
150
|
+
_this.code = 6009;
|
|
151
|
+
_this.name = "ClawbackReceiverIsTokenVault";
|
|
152
|
+
_this.msg = "Clawback receiver can not be the Token Vault";
|
|
153
|
+
return _this;
|
|
154
|
+
}
|
|
155
|
+
ClawbackReceiverIsTokenVault.code = 6009;
|
|
156
|
+
return ClawbackReceiverIsTokenVault;
|
|
157
|
+
}(Error));
|
|
158
|
+
exports.ClawbackReceiverIsTokenVault = ClawbackReceiverIsTokenVault;
|
|
173
159
|
var SameAdmin = /** @class */ (function (_super) {
|
|
174
160
|
__extends(SameAdmin, _super);
|
|
175
161
|
function SameAdmin(logs) {
|
|
176
|
-
var _this = _super.call(this, "
|
|
162
|
+
var _this = _super.call(this, "6010: New and old admin are identical") || this;
|
|
177
163
|
_this.logs = logs;
|
|
178
|
-
_this.code =
|
|
164
|
+
_this.code = 6010;
|
|
179
165
|
_this.name = "SameAdmin";
|
|
180
166
|
_this.msg = "New and old admin are identical";
|
|
181
167
|
return _this;
|
|
182
168
|
}
|
|
183
|
-
SameAdmin.code =
|
|
169
|
+
SameAdmin.code = 6010;
|
|
184
170
|
return SameAdmin;
|
|
185
171
|
}(Error));
|
|
186
172
|
exports.SameAdmin = SameAdmin;
|
|
187
173
|
var ClaimExpired = /** @class */ (function (_super) {
|
|
188
174
|
__extends(ClaimExpired, _super);
|
|
189
175
|
function ClaimExpired(logs) {
|
|
190
|
-
var _this = _super.call(this, "
|
|
176
|
+
var _this = _super.call(this, "6011: Claim window expired") || this;
|
|
191
177
|
_this.logs = logs;
|
|
192
|
-
_this.code =
|
|
178
|
+
_this.code = 6011;
|
|
193
179
|
_this.name = "ClaimExpired";
|
|
194
180
|
_this.msg = "Claim window expired";
|
|
195
181
|
return _this;
|
|
196
182
|
}
|
|
197
|
-
ClaimExpired.code =
|
|
183
|
+
ClaimExpired.code = 6011;
|
|
198
184
|
return ClaimExpired;
|
|
199
185
|
}(Error));
|
|
200
186
|
exports.ClaimExpired = ClaimExpired;
|
|
201
187
|
var ArithmeticError = /** @class */ (function (_super) {
|
|
202
188
|
__extends(ArithmeticError, _super);
|
|
203
189
|
function ArithmeticError(logs) {
|
|
204
|
-
var _this = _super.call(this, "
|
|
190
|
+
var _this = _super.call(this, "6012: Arithmetic Error (overflow/underflow)") || this;
|
|
205
191
|
_this.logs = logs;
|
|
206
|
-
_this.code =
|
|
192
|
+
_this.code = 6012;
|
|
207
193
|
_this.name = "ArithmeticError";
|
|
208
194
|
_this.msg = "Arithmetic Error (overflow/underflow)";
|
|
209
195
|
return _this;
|
|
210
196
|
}
|
|
211
|
-
ArithmeticError.code =
|
|
197
|
+
ArithmeticError.code = 6012;
|
|
212
198
|
return ArithmeticError;
|
|
213
199
|
}(Error));
|
|
214
200
|
exports.ArithmeticError = ArithmeticError;
|
|
215
201
|
var StartTimestampAfterEnd = /** @class */ (function (_super) {
|
|
216
202
|
__extends(StartTimestampAfterEnd, _super);
|
|
217
203
|
function StartTimestampAfterEnd(logs) {
|
|
218
|
-
var _this = _super.call(this, "
|
|
204
|
+
var _this = _super.call(this, "6013: Start Timestamp cannot be after end Timestamp") || this;
|
|
219
205
|
_this.logs = logs;
|
|
220
|
-
_this.code =
|
|
206
|
+
_this.code = 6013;
|
|
221
207
|
_this.name = "StartTimestampAfterEnd";
|
|
222
208
|
_this.msg = "Start Timestamp cannot be after end Timestamp";
|
|
223
209
|
return _this;
|
|
224
210
|
}
|
|
225
|
-
StartTimestampAfterEnd.code =
|
|
211
|
+
StartTimestampAfterEnd.code = 6013;
|
|
226
212
|
return StartTimestampAfterEnd;
|
|
227
213
|
}(Error));
|
|
228
214
|
exports.StartTimestampAfterEnd = StartTimestampAfterEnd;
|
|
229
215
|
var TimestampsNotInFuture = /** @class */ (function (_super) {
|
|
230
216
|
__extends(TimestampsNotInFuture, _super);
|
|
231
217
|
function TimestampsNotInFuture(logs) {
|
|
232
|
-
var _this = _super.call(this, "
|
|
218
|
+
var _this = _super.call(this, "6014: Timestamps cannot be in the past") || this;
|
|
233
219
|
_this.logs = logs;
|
|
234
|
-
_this.code =
|
|
220
|
+
_this.code = 6014;
|
|
235
221
|
_this.name = "TimestampsNotInFuture";
|
|
236
222
|
_this.msg = "Timestamps cannot be in the past";
|
|
237
223
|
return _this;
|
|
238
224
|
}
|
|
239
|
-
TimestampsNotInFuture.code =
|
|
225
|
+
TimestampsNotInFuture.code = 6014;
|
|
240
226
|
return TimestampsNotInFuture;
|
|
241
227
|
}(Error));
|
|
242
228
|
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
229
|
var InvalidMint = /** @class */ (function (_super) {
|
|
258
230
|
__extends(InvalidMint, _super);
|
|
259
231
|
function InvalidMint(logs) {
|
|
260
|
-
var _this = _super.call(this, "
|
|
232
|
+
var _this = _super.call(this, "6015: Invalid Mint") || this;
|
|
261
233
|
_this.logs = logs;
|
|
262
|
-
_this.code =
|
|
234
|
+
_this.code = 6015;
|
|
263
235
|
_this.name = "InvalidMint";
|
|
264
236
|
_this.msg = "Invalid Mint";
|
|
265
237
|
return _this;
|
|
266
238
|
}
|
|
267
|
-
InvalidMint.code =
|
|
239
|
+
InvalidMint.code = 6015;
|
|
268
240
|
return InvalidMint;
|
|
269
241
|
}(Error));
|
|
270
242
|
exports.InvalidMint = InvalidMint;
|
|
271
243
|
var ClaimIsClosed = /** @class */ (function (_super) {
|
|
272
244
|
__extends(ClaimIsClosed, _super);
|
|
273
245
|
function ClaimIsClosed(logs) {
|
|
274
|
-
var _this = _super.call(this, "
|
|
246
|
+
var _this = _super.call(this, "6016: Claim is closed") || this;
|
|
275
247
|
_this.logs = logs;
|
|
276
|
-
_this.code =
|
|
248
|
+
_this.code = 6016;
|
|
277
249
|
_this.name = "ClaimIsClosed";
|
|
278
250
|
_this.msg = "Claim is closed";
|
|
279
251
|
return _this;
|
|
280
252
|
}
|
|
281
|
-
ClaimIsClosed.code =
|
|
253
|
+
ClaimIsClosed.code = 6016;
|
|
282
254
|
return ClaimIsClosed;
|
|
283
255
|
}(Error));
|
|
284
256
|
exports.ClaimIsClosed = ClaimIsClosed;
|
|
285
257
|
var ClaimsAreNotClosable = /** @class */ (function (_super) {
|
|
286
258
|
__extends(ClaimsAreNotClosable, _super);
|
|
287
259
|
function ClaimsAreNotClosable(logs) {
|
|
288
|
-
var _this = _super.call(this, "
|
|
260
|
+
var _this = _super.call(this, "6017: Claims are not closable") || this;
|
|
289
261
|
_this.logs = logs;
|
|
290
|
-
_this.code =
|
|
262
|
+
_this.code = 6017;
|
|
291
263
|
_this.name = "ClaimsAreNotClosable";
|
|
292
264
|
_this.msg = "Claims are not closable";
|
|
293
265
|
return _this;
|
|
294
266
|
}
|
|
295
|
-
ClaimsAreNotClosable.code =
|
|
267
|
+
ClaimsAreNotClosable.code = 6017;
|
|
296
268
|
return ClaimsAreNotClosable;
|
|
297
269
|
}(Error));
|
|
298
270
|
exports.ClaimsAreNotClosable = ClaimsAreNotClosable;
|
|
271
|
+
var InvalidUnlockPeriod = /** @class */ (function (_super) {
|
|
272
|
+
__extends(InvalidUnlockPeriod, _super);
|
|
273
|
+
function InvalidUnlockPeriod(logs) {
|
|
274
|
+
var _this = _super.call(this, "6018: Invalid unlock period") || this;
|
|
275
|
+
_this.logs = logs;
|
|
276
|
+
_this.code = 6018;
|
|
277
|
+
_this.name = "InvalidUnlockPeriod";
|
|
278
|
+
_this.msg = "Invalid unlock period";
|
|
279
|
+
return _this;
|
|
280
|
+
}
|
|
281
|
+
InvalidUnlockPeriod.code = 6018;
|
|
282
|
+
return InvalidUnlockPeriod;
|
|
283
|
+
}(Error));
|
|
284
|
+
exports.InvalidUnlockPeriod = InvalidUnlockPeriod;
|
|
299
285
|
function fromCode(code, logs) {
|
|
300
286
|
switch (code) {
|
|
301
287
|
case 6000:
|
|
302
288
|
return new InsufficientUnlockedTokens(logs);
|
|
303
289
|
case 6001:
|
|
304
|
-
return new StartTooFarInFuture(logs);
|
|
305
|
-
case 6002:
|
|
306
290
|
return new InvalidProof(logs);
|
|
307
|
-
case
|
|
291
|
+
case 6002:
|
|
308
292
|
return new ExceededMaxClaim(logs);
|
|
309
|
-
case
|
|
293
|
+
case 6003:
|
|
310
294
|
return new MaxNodesExceeded(logs);
|
|
311
|
-
case
|
|
295
|
+
case 6004:
|
|
312
296
|
return new Unauthorized(logs);
|
|
313
|
-
case
|
|
297
|
+
case 6005:
|
|
314
298
|
return new OwnerMismatch(logs);
|
|
315
|
-
case
|
|
299
|
+
case 6006:
|
|
316
300
|
return new ClawbackBeforeStart(logs);
|
|
317
|
-
case
|
|
301
|
+
case 6007:
|
|
318
302
|
return new ClawbackAlreadyClaimed(logs);
|
|
303
|
+
case 6008:
|
|
304
|
+
return new SameClawbackReceiver(logs);
|
|
319
305
|
case 6009:
|
|
320
|
-
return new
|
|
306
|
+
return new ClawbackReceiverIsTokenVault(logs);
|
|
321
307
|
case 6010:
|
|
322
|
-
return new SameClawbackReceiver(logs);
|
|
323
|
-
case 6011:
|
|
324
308
|
return new SameAdmin(logs);
|
|
325
|
-
case
|
|
309
|
+
case 6011:
|
|
326
310
|
return new ClaimExpired(logs);
|
|
327
|
-
case
|
|
311
|
+
case 6012:
|
|
328
312
|
return new ArithmeticError(logs);
|
|
329
|
-
case
|
|
313
|
+
case 6013:
|
|
330
314
|
return new StartTimestampAfterEnd(logs);
|
|
331
|
-
case
|
|
315
|
+
case 6014:
|
|
332
316
|
return new TimestampsNotInFuture(logs);
|
|
333
|
-
case
|
|
334
|
-
return new InvalidVersion(logs);
|
|
335
|
-
case 6017:
|
|
317
|
+
case 6015:
|
|
336
318
|
return new InvalidMint(logs);
|
|
337
|
-
case
|
|
319
|
+
case 6016:
|
|
338
320
|
return new ClaimIsClosed(logs);
|
|
339
|
-
case
|
|
321
|
+
case 6017:
|
|
340
322
|
return new ClaimsAreNotClosable(logs);
|
|
323
|
+
case 6018:
|
|
324
|
+
return new InvalidUnlockPeriod(logs);
|
|
341
325
|
}
|
|
342
326
|
return null;
|
|
343
327
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.claimLocked = void 0;
|
|
4
|
-
var web3_js_1 = require("@solana/web3.js");
|
|
4
|
+
var web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
5
|
var programId_1 = require("../programId");
|
|
6
6
|
function claimLocked(accounts, programId) {
|
|
7
7
|
if (programId === void 0) { programId = programId_1.PROGRAM_ID; }
|
|
@@ -6,11 +6,8 @@ export interface ClawbackAccounts {
|
|
|
6
6
|
from: PublicKey;
|
|
7
7
|
/** The Clawback token account. */
|
|
8
8
|
to: PublicKey;
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
* Anyone can claw back the funds if clawback is done at least a day after vesting has ended
|
|
12
|
-
*/
|
|
13
|
-
claimant: PublicKey;
|
|
9
|
+
/** Only Admin can trigger the clawback of funds */
|
|
10
|
+
admin: PublicKey;
|
|
14
11
|
mint: PublicKey;
|
|
15
12
|
/** The [System] program. */
|
|
16
13
|
systemProgram: PublicKey;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.clawback = void 0;
|
|
4
|
-
var web3_js_1 = require("@solana/web3.js");
|
|
4
|
+
var web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
5
|
var programId_1 = require("../programId");
|
|
6
6
|
function clawback(accounts, programId) {
|
|
7
7
|
if (programId === void 0) { programId = programId_1.PROGRAM_ID; }
|
|
@@ -9,7 +9,7 @@ function clawback(accounts, programId) {
|
|
|
9
9
|
{ pubkey: accounts.distributor, isSigner: false, isWritable: true },
|
|
10
10
|
{ pubkey: accounts.from, isSigner: false, isWritable: true },
|
|
11
11
|
{ pubkey: accounts.to, isSigner: false, isWritable: true },
|
|
12
|
-
{ pubkey: accounts.
|
|
12
|
+
{ pubkey: accounts.admin, isSigner: true, isWritable: true },
|
|
13
13
|
{ pubkey: accounts.mint, isSigner: false, isWritable: false },
|
|
14
14
|
{ pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
|
|
15
15
|
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.closeClaim = void 0;
|
|
4
|
-
var web3_js_1 = require("@solana/web3.js");
|
|
4
|
+
var web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
5
|
var programId_1 = require("../programId");
|
|
6
6
|
function closeClaim(accounts, programId) {
|
|
7
7
|
if (programId === void 0) { programId = programId_1.PROGRAM_ID; }
|
|
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.newClaim = exports.layout = void 0;
|
|
27
|
-
var web3_js_1 = require("@solana/web3.js");
|
|
28
|
-
var borsh = __importStar(require("@coral-xyz/borsh"));
|
|
27
|
+
var web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
28
|
+
var borsh = __importStar(require("@coral-xyz/borsh")); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
29
29
|
var programId_1 = require("../programId");
|
|
30
30
|
exports.layout = borsh.struct([
|
|
31
31
|
borsh.u64("amountUnlocked"),
|
|
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.newDistributor = exports.layout = void 0;
|
|
27
|
-
var web3_js_1 = require("@solana/web3.js");
|
|
28
|
-
var borsh = __importStar(require("@coral-xyz/borsh"));
|
|
27
|
+
var web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
28
|
+
var borsh = __importStar(require("@coral-xyz/borsh")); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
29
29
|
var programId_1 = require("../programId");
|
|
30
30
|
exports.layout = borsh.struct([
|
|
31
31
|
borsh.u64("version"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setAdmin = void 0;
|
|
4
|
-
var web3_js_1 = require("@solana/web3.js");
|
|
4
|
+
var web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
5
|
var programId_1 = require("../programId");
|
|
6
6
|
function setAdmin(accounts, programId) {
|
|
7
7
|
if (programId === void 0) { programId = programId_1.PROGRAM_ID; }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setClawbackReceiver = void 0;
|
|
4
|
-
var web3_js_1 = require("@solana/web3.js");
|
|
4
|
+
var web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
5
|
var programId_1 = require("../programId");
|
|
6
6
|
function setClawbackReceiver(accounts, programId) {
|
|
7
7
|
if (programId === void 0) { programId = programId_1.PROGRAM_ID; }
|
package/dist/solana/types.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import BN from "bn.js";
|
|
|
2
2
|
import { SignerWalletAdapter } from "@solana/wallet-adapter-base";
|
|
3
3
|
import { Keypair } from "@solana/web3.js";
|
|
4
4
|
import { ITransactionResult } from "@streamflow/common";
|
|
5
|
-
|
|
5
|
+
import { ITransactionSolanaExt } from "@streamflow/common/solana";
|
|
6
|
+
export interface IInteractSolanaExt extends ITransactionSolanaExt {
|
|
6
7
|
invoker: SignerWalletAdapter | Keypair;
|
|
7
8
|
}
|
|
8
9
|
export interface ICreateSolanaExt extends IInteractSolanaExt {
|
|
@@ -29,9 +30,9 @@ export interface IClaimData {
|
|
|
29
30
|
export interface IClawbackData {
|
|
30
31
|
id: string;
|
|
31
32
|
}
|
|
32
|
-
export interface
|
|
33
|
+
export interface IGetClaimData {
|
|
33
34
|
id: string;
|
|
34
|
-
|
|
35
|
+
recipient: string;
|
|
35
36
|
}
|
|
36
37
|
export interface IGetDistributors {
|
|
37
38
|
ids: string[];
|
package/dist/solana/utils.js
CHANGED
|
@@ -61,21 +61,19 @@ function getClaimantStatusPda(programId, distributor, claimant) {
|
|
|
61
61
|
exports.getClaimantStatusPda = getClaimantStatusPda;
|
|
62
62
|
function wrappedSignAndExecuteTransaction(connection, invoker, tx, hash) {
|
|
63
63
|
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
-
var
|
|
64
|
+
var err_1, parsed;
|
|
65
65
|
return __generator(this, function (_a) {
|
|
66
66
|
switch (_a.label) {
|
|
67
67
|
case 0:
|
|
68
68
|
_a.trys.push([0, 2, , 3]);
|
|
69
69
|
return [4 /*yield*/, (0, solana_1.signAndExecuteTransaction)(connection, invoker, tx, hash)];
|
|
70
|
-
case 1:
|
|
71
|
-
signature = _a.sent();
|
|
72
|
-
return [2 /*return*/, signature];
|
|
70
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
73
71
|
case 2:
|
|
74
72
|
err_1 = _a.sent();
|
|
75
73
|
if (err_1 instanceof Error) {
|
|
76
74
|
parsed = (0, errors_1.fromTxError)(err_1);
|
|
77
75
|
if (parsed) {
|
|
78
|
-
throw new common_1.ContractError(err_1, parsed.name);
|
|
76
|
+
throw new common_1.ContractError(err_1, parsed.name, parsed.msg);
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
throw err_1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/distributor",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.10",
|
|
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/index.js",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"lint": "eslint --fix .",
|
|
23
23
|
"prepublishOnly": "npm run lint && npm run build"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "ba69862bbf25947672eb767e5852c9763a4a1165",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@streamflow/eslint-config": "6.0.0-alpha.
|
|
27
|
+
"@streamflow/eslint-config": "6.0.0-alpha.10",
|
|
28
28
|
"@types/bn.js": "5.1.1",
|
|
29
29
|
"@types/jest": "29.2.4",
|
|
30
30
|
"date-fns": "2.28.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@solana/spl-token": "0.3.6",
|
|
39
39
|
"@solana/wallet-adapter-base": "0.9.19",
|
|
40
40
|
"@solana/web3.js": "1.70.1",
|
|
41
|
-
"@streamflow/common": "6.0.0-alpha.
|
|
41
|
+
"@streamflow/common": "6.0.0-alpha.10",
|
|
42
42
|
"bn.js": "5.2.1",
|
|
43
43
|
"borsh": "^2.0.0",
|
|
44
44
|
"bs58": "5.0.0"
|