@streamflow/distributor 7.0.0-alpha.1 → 7.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/README.md +20 -5
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/solana/client.js +199 -347
- package/dist/cjs/solana/constants.js +11 -9
- package/dist/cjs/solana/generated/accounts/ClaimStatus.js +52 -110
- package/dist/cjs/solana/generated/accounts/MerkleDistributor.js +67 -125
- package/dist/cjs/solana/generated/errors/anchor.js +540 -717
- package/dist/cjs/solana/generated/errors/custom.js +171 -243
- package/dist/cjs/solana/generated/errors/index.js +12 -51
- package/dist/cjs/solana/generated/instructions/claimLocked.js +7 -8
- package/dist/cjs/solana/generated/instructions/clawback.js +8 -9
- package/dist/cjs/solana/generated/instructions/closeClaim.js +8 -9
- package/dist/cjs/solana/generated/instructions/newClaim.js +10 -11
- package/dist/cjs/solana/generated/instructions/newDistributor.js +17 -12
- package/dist/cjs/solana/generated/instructions/setAdmin.js +8 -9
- package/dist/cjs/solana/generated/instructions/setClawbackReceiver.js +8 -9
- package/dist/cjs/solana/generated/programId.js +1 -1
- package/dist/cjs/solana/index.js +6 -6
- package/dist/cjs/solana/utils.js +38 -92
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/solana/client.d.ts +3 -1
- package/dist/esm/solana/client.js +44 -18
- package/dist/esm/solana/constants.d.ts +3 -0
- package/dist/esm/solana/constants.js +3 -0
- package/dist/esm/solana/generated/accounts/ClaimStatus.d.ts +11 -11
- package/dist/esm/solana/generated/accounts/ClaimStatus.js +6 -6
- package/dist/esm/solana/generated/accounts/MerkleDistributor.d.ts +19 -19
- package/dist/esm/solana/generated/accounts/MerkleDistributor.js +10 -10
- package/dist/esm/solana/generated/instructions/newClaim.d.ts +3 -3
- package/dist/esm/solana/generated/instructions/newDistributor.d.ts +8 -8
- package/dist/esm/solana/generated/instructions/newDistributor.js +6 -0
- package/dist/esm/solana/index.d.ts +6 -6
- package/dist/esm/solana/index.js +6 -6
- package/dist/esm/solana/types.d.ts +9 -5
- package/package.json +7 -8
|
@@ -1,287 +1,215 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_this.msg = "Insufficient unlocked tokens";
|
|
27
|
-
return _this;
|
|
4
|
+
class InsufficientUnlockedTokens extends Error {
|
|
5
|
+
constructor(logs) {
|
|
6
|
+
super("6000: Insufficient unlocked tokens");
|
|
7
|
+
this.logs = logs;
|
|
8
|
+
this.code = 6000;
|
|
9
|
+
this.name = "InsufficientUnlockedTokens";
|
|
10
|
+
this.msg = "Insufficient unlocked tokens";
|
|
28
11
|
}
|
|
29
|
-
|
|
30
|
-
return InsufficientUnlockedTokens;
|
|
31
|
-
}(Error));
|
|
12
|
+
}
|
|
32
13
|
exports.InsufficientUnlockedTokens = InsufficientUnlockedTokens;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return _this;
|
|
14
|
+
InsufficientUnlockedTokens.code = 6000;
|
|
15
|
+
class InvalidProof extends Error {
|
|
16
|
+
constructor(logs) {
|
|
17
|
+
super("6001: Invalid Merkle proof");
|
|
18
|
+
this.logs = logs;
|
|
19
|
+
this.code = 6001;
|
|
20
|
+
this.name = "InvalidProof";
|
|
21
|
+
this.msg = "Invalid Merkle proof";
|
|
42
22
|
}
|
|
43
|
-
|
|
44
|
-
return InvalidProof;
|
|
45
|
-
}(Error));
|
|
23
|
+
}
|
|
46
24
|
exports.InvalidProof = InvalidProof;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return _this;
|
|
25
|
+
InvalidProof.code = 6001;
|
|
26
|
+
class ExceededMaxClaim extends Error {
|
|
27
|
+
constructor(logs) {
|
|
28
|
+
super("6002: Exceeded maximum claim amount");
|
|
29
|
+
this.logs = logs;
|
|
30
|
+
this.code = 6002;
|
|
31
|
+
this.name = "ExceededMaxClaim";
|
|
32
|
+
this.msg = "Exceeded maximum claim amount";
|
|
56
33
|
}
|
|
57
|
-
|
|
58
|
-
return ExceededMaxClaim;
|
|
59
|
-
}(Error));
|
|
34
|
+
}
|
|
60
35
|
exports.ExceededMaxClaim = ExceededMaxClaim;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return _this;
|
|
36
|
+
ExceededMaxClaim.code = 6002;
|
|
37
|
+
class MaxNodesExceeded extends Error {
|
|
38
|
+
constructor(logs) {
|
|
39
|
+
super("6003: Exceeded maximum node count");
|
|
40
|
+
this.logs = logs;
|
|
41
|
+
this.code = 6003;
|
|
42
|
+
this.name = "MaxNodesExceeded";
|
|
43
|
+
this.msg = "Exceeded maximum node count";
|
|
70
44
|
}
|
|
71
|
-
|
|
72
|
-
return MaxNodesExceeded;
|
|
73
|
-
}(Error));
|
|
45
|
+
}
|
|
74
46
|
exports.MaxNodesExceeded = MaxNodesExceeded;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return _this;
|
|
47
|
+
MaxNodesExceeded.code = 6003;
|
|
48
|
+
class Unauthorized extends Error {
|
|
49
|
+
constructor(logs) {
|
|
50
|
+
super("6004: Account is not authorized to execute this instruction");
|
|
51
|
+
this.logs = logs;
|
|
52
|
+
this.code = 6004;
|
|
53
|
+
this.name = "Unauthorized";
|
|
54
|
+
this.msg = "Account is not authorized to execute this instruction";
|
|
84
55
|
}
|
|
85
|
-
|
|
86
|
-
return Unauthorized;
|
|
87
|
-
}(Error));
|
|
56
|
+
}
|
|
88
57
|
exports.Unauthorized = Unauthorized;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return _this;
|
|
58
|
+
Unauthorized.code = 6004;
|
|
59
|
+
class OwnerMismatch extends Error {
|
|
60
|
+
constructor(logs) {
|
|
61
|
+
super("6005: Token account owner did not match intended owner");
|
|
62
|
+
this.logs = logs;
|
|
63
|
+
this.code = 6005;
|
|
64
|
+
this.name = "OwnerMismatch";
|
|
65
|
+
this.msg = "Token account owner did not match intended owner";
|
|
98
66
|
}
|
|
99
|
-
|
|
100
|
-
return OwnerMismatch;
|
|
101
|
-
}(Error));
|
|
67
|
+
}
|
|
102
68
|
exports.OwnerMismatch = OwnerMismatch;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return _this;
|
|
69
|
+
OwnerMismatch.code = 6005;
|
|
70
|
+
class ClawbackBeforeStart extends Error {
|
|
71
|
+
constructor(logs) {
|
|
72
|
+
super("6006: Attempted clawback before start");
|
|
73
|
+
this.logs = logs;
|
|
74
|
+
this.code = 6006;
|
|
75
|
+
this.name = "ClawbackBeforeStart";
|
|
76
|
+
this.msg = "Attempted clawback before start";
|
|
112
77
|
}
|
|
113
|
-
|
|
114
|
-
return ClawbackBeforeStart;
|
|
115
|
-
}(Error));
|
|
78
|
+
}
|
|
116
79
|
exports.ClawbackBeforeStart = ClawbackBeforeStart;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return _this;
|
|
80
|
+
ClawbackBeforeStart.code = 6006;
|
|
81
|
+
class ClawbackAlreadyClaimed extends Error {
|
|
82
|
+
constructor(logs) {
|
|
83
|
+
super("6007: Clawback already claimed");
|
|
84
|
+
this.logs = logs;
|
|
85
|
+
this.code = 6007;
|
|
86
|
+
this.name = "ClawbackAlreadyClaimed";
|
|
87
|
+
this.msg = "Clawback already claimed";
|
|
126
88
|
}
|
|
127
|
-
|
|
128
|
-
return ClawbackAlreadyClaimed;
|
|
129
|
-
}(Error));
|
|
89
|
+
}
|
|
130
90
|
exports.ClawbackAlreadyClaimed = ClawbackAlreadyClaimed;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return _this;
|
|
91
|
+
ClawbackAlreadyClaimed.code = 6007;
|
|
92
|
+
class SameClawbackReceiver extends Error {
|
|
93
|
+
constructor(logs) {
|
|
94
|
+
super("6008: New and old Clawback receivers are identical");
|
|
95
|
+
this.logs = logs;
|
|
96
|
+
this.code = 6008;
|
|
97
|
+
this.name = "SameClawbackReceiver";
|
|
98
|
+
this.msg = "New and old Clawback receivers are identical";
|
|
140
99
|
}
|
|
141
|
-
|
|
142
|
-
return SameClawbackReceiver;
|
|
143
|
-
}(Error));
|
|
100
|
+
}
|
|
144
101
|
exports.SameClawbackReceiver = SameClawbackReceiver;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return _this;
|
|
102
|
+
SameClawbackReceiver.code = 6008;
|
|
103
|
+
class ClawbackReceiverIsTokenVault extends Error {
|
|
104
|
+
constructor(logs) {
|
|
105
|
+
super("6009: Clawback receiver can not be the Token Vault");
|
|
106
|
+
this.logs = logs;
|
|
107
|
+
this.code = 6009;
|
|
108
|
+
this.name = "ClawbackReceiverIsTokenVault";
|
|
109
|
+
this.msg = "Clawback receiver can not be the Token Vault";
|
|
154
110
|
}
|
|
155
|
-
|
|
156
|
-
return ClawbackReceiverIsTokenVault;
|
|
157
|
-
}(Error));
|
|
111
|
+
}
|
|
158
112
|
exports.ClawbackReceiverIsTokenVault = ClawbackReceiverIsTokenVault;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return _this;
|
|
113
|
+
ClawbackReceiverIsTokenVault.code = 6009;
|
|
114
|
+
class SameAdmin extends Error {
|
|
115
|
+
constructor(logs) {
|
|
116
|
+
super("6010: New and old admin are identical");
|
|
117
|
+
this.logs = logs;
|
|
118
|
+
this.code = 6010;
|
|
119
|
+
this.name = "SameAdmin";
|
|
120
|
+
this.msg = "New and old admin are identical";
|
|
168
121
|
}
|
|
169
|
-
|
|
170
|
-
return SameAdmin;
|
|
171
|
-
}(Error));
|
|
122
|
+
}
|
|
172
123
|
exports.SameAdmin = SameAdmin;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return _this;
|
|
124
|
+
SameAdmin.code = 6010;
|
|
125
|
+
class ClaimExpired extends Error {
|
|
126
|
+
constructor(logs) {
|
|
127
|
+
super("6011: Claim window expired");
|
|
128
|
+
this.logs = logs;
|
|
129
|
+
this.code = 6011;
|
|
130
|
+
this.name = "ClaimExpired";
|
|
131
|
+
this.msg = "Claim window expired";
|
|
182
132
|
}
|
|
183
|
-
|
|
184
|
-
return ClaimExpired;
|
|
185
|
-
}(Error));
|
|
133
|
+
}
|
|
186
134
|
exports.ClaimExpired = ClaimExpired;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return _this;
|
|
135
|
+
ClaimExpired.code = 6011;
|
|
136
|
+
class ArithmeticError extends Error {
|
|
137
|
+
constructor(logs) {
|
|
138
|
+
super("6012: Arithmetic Error (overflow/underflow)");
|
|
139
|
+
this.logs = logs;
|
|
140
|
+
this.code = 6012;
|
|
141
|
+
this.name = "ArithmeticError";
|
|
142
|
+
this.msg = "Arithmetic Error (overflow/underflow)";
|
|
196
143
|
}
|
|
197
|
-
|
|
198
|
-
return ArithmeticError;
|
|
199
|
-
}(Error));
|
|
144
|
+
}
|
|
200
145
|
exports.ArithmeticError = ArithmeticError;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return _this;
|
|
146
|
+
ArithmeticError.code = 6012;
|
|
147
|
+
class StartTimestampAfterEnd extends Error {
|
|
148
|
+
constructor(logs) {
|
|
149
|
+
super("6013: Start Timestamp cannot be after end Timestamp");
|
|
150
|
+
this.logs = logs;
|
|
151
|
+
this.code = 6013;
|
|
152
|
+
this.name = "StartTimestampAfterEnd";
|
|
153
|
+
this.msg = "Start Timestamp cannot be after end Timestamp";
|
|
210
154
|
}
|
|
211
|
-
|
|
212
|
-
return StartTimestampAfterEnd;
|
|
213
|
-
}(Error));
|
|
155
|
+
}
|
|
214
156
|
exports.StartTimestampAfterEnd = StartTimestampAfterEnd;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return _this;
|
|
157
|
+
StartTimestampAfterEnd.code = 6013;
|
|
158
|
+
class TimestampsNotInFuture extends Error {
|
|
159
|
+
constructor(logs) {
|
|
160
|
+
super("6014: Timestamps cannot be in the past");
|
|
161
|
+
this.logs = logs;
|
|
162
|
+
this.code = 6014;
|
|
163
|
+
this.name = "TimestampsNotInFuture";
|
|
164
|
+
this.msg = "Timestamps cannot be in the past";
|
|
224
165
|
}
|
|
225
|
-
|
|
226
|
-
return TimestampsNotInFuture;
|
|
227
|
-
}(Error));
|
|
166
|
+
}
|
|
228
167
|
exports.TimestampsNotInFuture = TimestampsNotInFuture;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
return _this;
|
|
168
|
+
TimestampsNotInFuture.code = 6014;
|
|
169
|
+
class InvalidMint extends Error {
|
|
170
|
+
constructor(logs) {
|
|
171
|
+
super("6015: Invalid Mint");
|
|
172
|
+
this.logs = logs;
|
|
173
|
+
this.code = 6015;
|
|
174
|
+
this.name = "InvalidMint";
|
|
175
|
+
this.msg = "Invalid Mint";
|
|
238
176
|
}
|
|
239
|
-
|
|
240
|
-
return InvalidMint;
|
|
241
|
-
}(Error));
|
|
177
|
+
}
|
|
242
178
|
exports.InvalidMint = InvalidMint;
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
return _this;
|
|
179
|
+
InvalidMint.code = 6015;
|
|
180
|
+
class ClaimIsClosed extends Error {
|
|
181
|
+
constructor(logs) {
|
|
182
|
+
super("6016: Claim is closed");
|
|
183
|
+
this.logs = logs;
|
|
184
|
+
this.code = 6016;
|
|
185
|
+
this.name = "ClaimIsClosed";
|
|
186
|
+
this.msg = "Claim is closed";
|
|
252
187
|
}
|
|
253
|
-
|
|
254
|
-
return ClaimIsClosed;
|
|
255
|
-
}(Error));
|
|
188
|
+
}
|
|
256
189
|
exports.ClaimIsClosed = ClaimIsClosed;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
return _this;
|
|
190
|
+
ClaimIsClosed.code = 6016;
|
|
191
|
+
class ClaimsAreNotClosable extends Error {
|
|
192
|
+
constructor(logs) {
|
|
193
|
+
super("6017: Claims are not closable");
|
|
194
|
+
this.logs = logs;
|
|
195
|
+
this.code = 6017;
|
|
196
|
+
this.name = "ClaimsAreNotClosable";
|
|
197
|
+
this.msg = "Claims are not closable";
|
|
266
198
|
}
|
|
267
|
-
|
|
268
|
-
return ClaimsAreNotClosable;
|
|
269
|
-
}(Error));
|
|
199
|
+
}
|
|
270
200
|
exports.ClaimsAreNotClosable = ClaimsAreNotClosable;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
return _this;
|
|
201
|
+
ClaimsAreNotClosable.code = 6017;
|
|
202
|
+
class InvalidUnlockPeriod extends Error {
|
|
203
|
+
constructor(logs) {
|
|
204
|
+
super("6018: Invalid unlock period");
|
|
205
|
+
this.logs = logs;
|
|
206
|
+
this.code = 6018;
|
|
207
|
+
this.name = "InvalidUnlockPeriod";
|
|
208
|
+
this.msg = "Invalid unlock period";
|
|
280
209
|
}
|
|
281
|
-
|
|
282
|
-
return InvalidUnlockPeriod;
|
|
283
|
-
}(Error));
|
|
210
|
+
}
|
|
284
211
|
exports.InvalidUnlockPeriod = InvalidUnlockPeriod;
|
|
212
|
+
InvalidUnlockPeriod.code = 6018;
|
|
285
213
|
function fromCode(code, logs) {
|
|
286
214
|
switch (code) {
|
|
287
215
|
case 6000:
|
|
@@ -22,38 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __values = (this && this.__values) || function(o) {
|
|
26
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
27
|
-
if (m) return m.call(o);
|
|
28
|
-
if (o && typeof o.length === "number") return {
|
|
29
|
-
next: function () {
|
|
30
|
-
if (o && i >= o.length) o = void 0;
|
|
31
|
-
return { value: o && o[i++], done: !o };
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
35
|
-
};
|
|
36
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
37
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
38
|
-
if (!m) return o;
|
|
39
|
-
var i = m.call(o), r, ar = [], e;
|
|
40
|
-
try {
|
|
41
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
42
|
-
}
|
|
43
|
-
catch (error) { e = { error: error }; }
|
|
44
|
-
finally {
|
|
45
|
-
try {
|
|
46
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
47
|
-
}
|
|
48
|
-
finally { if (e) throw e.error; }
|
|
49
|
-
}
|
|
50
|
-
return ar;
|
|
51
|
-
};
|
|
52
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
26
|
exports.fromTxError = exports.fromCode = void 0;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
27
|
+
const programId_1 = require("../programId");
|
|
28
|
+
const anchor = __importStar(require("./anchor"));
|
|
29
|
+
const custom = __importStar(require("./custom"));
|
|
57
30
|
function fromCode(code, logs) {
|
|
58
31
|
return code >= 6000 ? custom.fromCode(code, logs) : anchor.fromCode(code, logs);
|
|
59
32
|
}
|
|
@@ -61,38 +34,26 @@ exports.fromCode = fromCode;
|
|
|
61
34
|
function hasOwnProperty(obj, prop) {
|
|
62
35
|
return Object.hasOwnProperty.call(obj, prop);
|
|
63
36
|
}
|
|
64
|
-
|
|
65
|
-
function fromTxError(err, programId) {
|
|
66
|
-
var e_1, _a;
|
|
67
|
-
if (programId === void 0) { programId = programId_1.PROGRAM_ID; }
|
|
37
|
+
const errorRe = /Program (\w+) failed: custom program error: (\w+)/;
|
|
38
|
+
function fromTxError(err, programId = programId_1.PROGRAM_ID) {
|
|
68
39
|
if (typeof err !== "object" || err === null || !hasOwnProperty(err, "logs") || !Array.isArray(err.logs)) {
|
|
69
40
|
return null;
|
|
70
41
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (firstMatch !== null) {
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
82
|
-
finally {
|
|
83
|
-
try {
|
|
84
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
42
|
+
let firstMatch = null;
|
|
43
|
+
for (const logLine of err.logs) {
|
|
44
|
+
firstMatch = errorRe.exec(logLine);
|
|
45
|
+
if (firstMatch !== null) {
|
|
46
|
+
break;
|
|
85
47
|
}
|
|
86
|
-
finally { if (e_1) throw e_1.error; }
|
|
87
48
|
}
|
|
88
49
|
if (firstMatch === null) {
|
|
89
50
|
return null;
|
|
90
51
|
}
|
|
91
|
-
|
|
52
|
+
const [programIdRaw, codeRaw] = firstMatch.slice(1);
|
|
92
53
|
if (programIdRaw !== programId.toString()) {
|
|
93
54
|
return null;
|
|
94
55
|
}
|
|
95
|
-
|
|
56
|
+
let errorCode;
|
|
96
57
|
try {
|
|
97
58
|
errorCode = parseInt(codeRaw, 16);
|
|
98
59
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.claimLocked = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function claimLocked(accounts, programId) {
|
|
7
|
-
|
|
8
|
-
var keys = [
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
const programId_1 = require("../programId");
|
|
6
|
+
function claimLocked(accounts, programId = programId_1.PROGRAM_ID) {
|
|
7
|
+
const keys = [
|
|
9
8
|
{ pubkey: accounts.distributor, isSigner: false, isWritable: true },
|
|
10
9
|
{ pubkey: accounts.claimStatus, isSigner: false, isWritable: true },
|
|
11
10
|
{ pubkey: accounts.from, isSigner: false, isWritable: true },
|
|
@@ -16,9 +15,9 @@ function claimLocked(accounts, programId) {
|
|
|
16
15
|
{ pubkey: accounts.eventAuthority, isSigner: false, isWritable: false },
|
|
17
16
|
{ pubkey: accounts.program, isSigner: false, isWritable: false },
|
|
18
17
|
];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const identifier = Buffer.from([34, 206, 181, 23, 11, 207, 147, 90]);
|
|
19
|
+
const data = identifier;
|
|
20
|
+
const ix = new web3_js_1.TransactionInstruction({ keys, programId, data });
|
|
22
21
|
return ix;
|
|
23
22
|
}
|
|
24
23
|
exports.claimLocked = claimLocked;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.clawback = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function clawback(accounts, programId) {
|
|
8
|
-
|
|
9
|
-
var keys = [
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
const buffer_1 = require("buffer");
|
|
6
|
+
const programId_1 = require("../programId");
|
|
7
|
+
function clawback(accounts, programId = programId_1.PROGRAM_ID) {
|
|
8
|
+
const keys = [
|
|
10
9
|
{ pubkey: accounts.distributor, isSigner: false, isWritable: true },
|
|
11
10
|
{ pubkey: accounts.from, isSigner: false, isWritable: true },
|
|
12
11
|
{ pubkey: accounts.to, isSigner: false, isWritable: true },
|
|
@@ -15,9 +14,9 @@ function clawback(accounts, programId) {
|
|
|
15
14
|
{ pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
|
|
16
15
|
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
|
|
17
16
|
];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const identifier = buffer_1.Buffer.from([111, 92, 142, 79, 33, 234, 82, 27]);
|
|
18
|
+
const data = identifier;
|
|
19
|
+
const ix = new web3_js_1.TransactionInstruction({ keys, programId, data });
|
|
21
20
|
return ix;
|
|
22
21
|
}
|
|
23
22
|
exports.clawback = clawback;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.closeClaim = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function closeClaim(accounts, programId) {
|
|
8
|
-
|
|
9
|
-
var keys = [
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js"); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
const buffer_1 = require("buffer");
|
|
6
|
+
const programId_1 = require("../programId");
|
|
7
|
+
function closeClaim(accounts, programId = programId_1.PROGRAM_ID) {
|
|
8
|
+
const keys = [
|
|
10
9
|
{ pubkey: accounts.distributor, isSigner: false, isWritable: true },
|
|
11
10
|
{ pubkey: accounts.admin, isSigner: true, isWritable: true },
|
|
12
11
|
{ pubkey: accounts.claimant, isSigner: false, isWritable: false },
|
|
@@ -15,9 +14,9 @@ function closeClaim(accounts, programId) {
|
|
|
15
14
|
{ pubkey: accounts.eventAuthority, isSigner: false, isWritable: false },
|
|
16
15
|
{ pubkey: accounts.program, isSigner: false, isWritable: false },
|
|
17
16
|
];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const identifier = buffer_1.Buffer.from([42, 177, 165, 35, 213, 179, 211, 19]);
|
|
18
|
+
const data = identifier;
|
|
19
|
+
const ix = new web3_js_1.TransactionInstruction({ keys, programId, data });
|
|
21
20
|
return ix;
|
|
22
21
|
}
|
|
23
22
|
exports.closeClaim = closeClaim;
|