@streamflow/distributor 6.0.0-alpha.8 → 6.0.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.
@@ -89,7 +89,7 @@ var SolanaDistributorClient = /** @class */ (function () {
89
89
  SolanaDistributorClient.prototype.create = function (data, _a) {
90
90
  var invoker = _a.invoker, _b = _a.isNative, isNative = _b === void 0 ? false : _b, computePrice = _a.computePrice, computeLimit = _a.computeLimit;
91
91
  return __awaiter(this, void 0, void 0, function () {
92
- var ixs, mint, mintAccount, distributorPublicKey, tokenVault, senderTokens, args, accounts, _c, _d, _e, _f, _g, tx, hash, signature;
92
+ var ixs, mint, mintAccount, distributorPublicKey, tokenVault, senderTokens, args, accounts, _c, _d, _e, _f, nowTs, endVestingTs, startVestingTs, _g, tx, hash, signature;
93
93
  return __generator(this, function (_h) {
94
94
  switch (_h.label) {
95
95
  case 0:
@@ -138,6 +138,12 @@ var SolanaDistributorClient = /** @class */ (function () {
138
138
  _d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
139
139
  _h.label = 5;
140
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
+ }
141
147
  ixs.push((0, instructions_1.newDistributor)(args, accounts, this.programId));
142
148
  ixs.push((0, spl_token_1.createTransferCheckedInstruction)(senderTokens, mint, tokenVault, invoker.publicKey, BigInt(data.maxTotalClaim.toString()), mintAccount.decimals));
143
149
  return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey)];
@@ -158,7 +164,7 @@ var SolanaDistributorClient = /** @class */ (function () {
158
164
  SolanaDistributorClient.prototype.claim = function (data, _a) {
159
165
  var invoker = _a.invoker, computePrice = _a.computePrice, computeLimit = _a.computeLimit;
160
166
  return __awaiter(this, void 0, void 0, function () {
161
- var distributorPublicKey, distributor, ixs, _b, _c, _d, _e, invokerTokens, claimStatusPublicKey, claimStatus, accounts, args, _f, tx, hash, signature;
167
+ var distributorPublicKey, distributor, ixs, _b, _c, _d, _e, invokerTokens, claimStatusPublicKey, claimStatus, accounts, args, nowTs, _f, tx, hash, signature;
162
168
  return __generator(this, function (_g) {
163
169
  switch (_g.label) {
164
170
  case 0:
@@ -204,7 +210,8 @@ var SolanaDistributorClient = /** @class */ (function () {
204
210
  };
205
211
  ixs.push((0, instructions_1.newClaim)(args, accounts, this.programId));
206
212
  }
207
- if (data.amountLocked.gtn(0)) {
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))) {
208
215
  ixs.push((0, instructions_1.claimLocked)(accounts, this.programId));
209
216
  }
210
217
  return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey)];
@@ -246,7 +253,7 @@ var SolanaDistributorClient = /** @class */ (function () {
246
253
  distributor: distributorPublicKey,
247
254
  from: distributor.tokenVault,
248
255
  to: distributor.clawbackReceiver,
249
- claimant: invoker.publicKey,
256
+ admin: invoker.publicKey,
250
257
  mint: distributor.mint,
251
258
  systemProgram: web3_js_1.SystemProgram.programId,
252
259
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
@@ -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 | StartTooFarInFuture | InvalidProof | ExceededMaxClaim | MaxNodesExceeded | Unauthorized | OwnerMismatch | ClawbackBeforeStart | ClawbackAlreadyClaimed | InsufficientClawbackDelay | SameClawbackReceiver | SameAdmin | ClaimExpired | ArithmeticError | StartTimestampAfterEnd | TimestampsNotInFuture | InvalidVersion | InvalidMint | ClaimIsClosed | ClaimsAreNotClosable;
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 StartTooFarInFuture extends Error {
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 = 6003;
29
- readonly code = 6003;
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 = 6004;
37
- readonly code = 6004;
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 = 6005;
45
- readonly code = 6005;
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 = 6006;
53
- readonly code = 6006;
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 = 6007;
61
- readonly code = 6007;
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 = 6008;
69
- readonly code = 6008;
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 = 6010;
85
- readonly code = 6010;
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 = 6011;
93
- readonly code = 6011;
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 = 6012;
101
- readonly code = 6012;
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 = 6013;
109
- readonly code = 6013;
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 = 6014;
117
- readonly code = 6014;
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 = 6015;
125
- readonly code = 6015;
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 = 6017;
141
- readonly code = 6017;
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 = 6018;
149
- readonly code = 6018;
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 = 6019;
157
- readonly code = 6019;
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.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;
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, "6002: Invalid Merkle proof") || this;
36
+ var _this = _super.call(this, "6001: Invalid Merkle proof") || this;
51
37
  _this.logs = logs;
52
- _this.code = 6002;
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 = 6002;
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, "6003: Exceeded maximum claim amount") || this;
50
+ var _this = _super.call(this, "6002: Exceeded maximum claim amount") || this;
65
51
  _this.logs = logs;
66
- _this.code = 6003;
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 = 6003;
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, "6004: Exceeded maximum node count") || this;
64
+ var _this = _super.call(this, "6003: Exceeded maximum node count") || this;
79
65
  _this.logs = logs;
80
- _this.code = 6004;
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 = 6004;
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, "6005: Account is not authorized to execute this instruction") || 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 = 6005;
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 = 6005;
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, "6006: Token account owner did not match intended owner") || 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 = 6006;
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 = 6006;
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, "6007: Attempted clawback before start") || this;
106
+ var _this = _super.call(this, "6006: Attempted clawback before start") || this;
121
107
  _this.logs = logs;
122
- _this.code = 6007;
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 = 6007;
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, "6008: Clawback already claimed") || this;
120
+ var _this = _super.call(this, "6007: Clawback already claimed") || this;
135
121
  _this.logs = logs;
136
- _this.code = 6008;
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 = 6008;
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, "6010: New and old Clawback receivers are identical") || this;
134
+ var _this = _super.call(this, "6008: New and old Clawback receivers are identical") || this;
163
135
  _this.logs = logs;
164
- _this.code = 6010;
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 = 6010;
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, "6011: New and old admin are identical") || this;
162
+ var _this = _super.call(this, "6010: New and old admin are identical") || this;
177
163
  _this.logs = logs;
178
- _this.code = 6011;
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 = 6011;
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, "6012: Claim window expired") || this;
176
+ var _this = _super.call(this, "6011: Claim window expired") || this;
191
177
  _this.logs = logs;
192
- _this.code = 6012;
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 = 6012;
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, "6013: Arithmetic Error (overflow/underflow)") || this;
190
+ var _this = _super.call(this, "6012: Arithmetic Error (overflow/underflow)") || this;
205
191
  _this.logs = logs;
206
- _this.code = 6013;
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 = 6013;
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, "6014: Start Timestamp cannot be after end Timestamp") || this;
204
+ var _this = _super.call(this, "6013: Start Timestamp cannot be after end Timestamp") || this;
219
205
  _this.logs = logs;
220
- _this.code = 6014;
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 = 6014;
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, "6015: Timestamps cannot be in the past") || this;
218
+ var _this = _super.call(this, "6014: Timestamps cannot be in the past") || this;
233
219
  _this.logs = logs;
234
- _this.code = 6015;
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 = 6015;
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, "6017: Invalid Mint") || this;
232
+ var _this = _super.call(this, "6015: Invalid Mint") || this;
261
233
  _this.logs = logs;
262
- _this.code = 6017;
234
+ _this.code = 6015;
263
235
  _this.name = "InvalidMint";
264
236
  _this.msg = "Invalid Mint";
265
237
  return _this;
266
238
  }
267
- InvalidMint.code = 6017;
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, "6018: Claim is closed") || this;
246
+ var _this = _super.call(this, "6016: Claim is closed") || this;
275
247
  _this.logs = logs;
276
- _this.code = 6018;
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 = 6018;
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, "6019: Claims are not closable") || this;
260
+ var _this = _super.call(this, "6017: Claims are not closable") || this;
289
261
  _this.logs = logs;
290
- _this.code = 6019;
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 = 6019;
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 6003:
291
+ case 6002:
308
292
  return new ExceededMaxClaim(logs);
309
- case 6004:
293
+ case 6003:
310
294
  return new MaxNodesExceeded(logs);
311
- case 6005:
295
+ case 6004:
312
296
  return new Unauthorized(logs);
313
- case 6006:
297
+ case 6005:
314
298
  return new OwnerMismatch(logs);
315
- case 6007:
299
+ case 6006:
316
300
  return new ClawbackBeforeStart(logs);
317
- case 6008:
301
+ case 6007:
318
302
  return new ClawbackAlreadyClaimed(logs);
303
+ case 6008:
304
+ return new SameClawbackReceiver(logs);
319
305
  case 6009:
320
- return new InsufficientClawbackDelay(logs);
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 6012:
309
+ case 6011:
326
310
  return new ClaimExpired(logs);
327
- case 6013:
311
+ case 6012:
328
312
  return new ArithmeticError(logs);
329
- case 6014:
313
+ case 6013:
330
314
  return new StartTimestampAfterEnd(logs);
331
- case 6015:
315
+ case 6014:
332
316
  return new TimestampsNotInFuture(logs);
333
- case 6016:
334
- return new InvalidVersion(logs);
335
- case 6017:
317
+ case 6015:
336
318
  return new InvalidMint(logs);
337
- case 6018:
319
+ case 6016:
338
320
  return new ClaimIsClosed(logs);
339
- case 6019:
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
- * 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;
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.claimant, isSigner: true, isWritable: false },
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/distributor",
3
- "version": "6.0.0-alpha.8",
3
+ "version": "6.0.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/index.js",
@@ -22,9 +22,9 @@
22
22
  "lint": "eslint --fix .",
23
23
  "prepublishOnly": "npm run lint && npm run build"
24
24
  },
25
- "gitHead": "1daaf0af241b2cc9b72a15022f461ee641e591f9",
25
+ "gitHead": "29f0a936ac05651c8b61d0e3db35f2f06533178c",
26
26
  "devDependencies": {
27
- "@streamflow/eslint-config": "6.0.0-alpha.8",
27
+ "@streamflow/eslint-config": "6.0.0",
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.8",
41
+ "@streamflow/common": "6.0.0",
42
42
  "bn.js": "5.2.1",
43
43
  "borsh": "^2.0.0",
44
44
  "bs58": "5.0.0"