@streamflow/distributor 6.3.1 → 6.3.2
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.js +21 -15
- package/dist/solana/types.d.ts +1 -0
- package/package.json +4 -4
package/dist/solana/client.js
CHANGED
|
@@ -168,9 +168,9 @@ var SolanaDistributorClient = /** @class */ (function () {
|
|
|
168
168
|
SolanaDistributorClient.prototype.claim = function (data, _a) {
|
|
169
169
|
var invoker = _a.invoker, computePrice = _a.computePrice, computeLimit = _a.computeLimit;
|
|
170
170
|
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
-
var distributorPublicKey, distributor, tokenProgramId, ixs, _b, _c, _d, _e, invokerTokens, claimStatusPublicKey, eventAuthorityPublicKey, claimStatus, accounts, args, nowTs,
|
|
172
|
-
return __generator(this, function (
|
|
173
|
-
switch (
|
|
171
|
+
var distributorPublicKey, distributor, tokenProgramId, ixs, _b, _c, _d, _e, invokerTokens, _f, claimStatusPublicKey, eventAuthorityPublicKey, claimStatus, accounts, args, nowTs, _g, tx, hash, context, signature;
|
|
172
|
+
return __generator(this, function (_h) {
|
|
173
|
+
switch (_h.label) {
|
|
174
174
|
case 0:
|
|
175
175
|
if (!invoker.publicKey) {
|
|
176
176
|
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
@@ -178,28 +178,34 @@ var SolanaDistributorClient = /** @class */ (function () {
|
|
|
178
178
|
distributorPublicKey = new web3_js_1.PublicKey(data.id);
|
|
179
179
|
return [4 /*yield*/, accounts_1.MerkleDistributor.fetch(this.connection, distributorPublicKey)];
|
|
180
180
|
case 1:
|
|
181
|
-
distributor =
|
|
181
|
+
distributor = _h.sent();
|
|
182
182
|
if (!distributor) {
|
|
183
183
|
throw new Error("Couldn't get account info");
|
|
184
184
|
}
|
|
185
185
|
return [4 /*yield*/, (0, solana_1.getMintAndProgram)(this.connection, distributor.mint)];
|
|
186
186
|
case 2:
|
|
187
|
-
tokenProgramId = (
|
|
187
|
+
tokenProgramId = (_h.sent()).tokenProgramId;
|
|
188
188
|
ixs = (0, solana_1.prepareBaseInstructions)(this.connection, { computePrice: computePrice, computeLimit: computeLimit });
|
|
189
189
|
_c = (_b = ixs.push).apply;
|
|
190
190
|
_d = [ixs];
|
|
191
191
|
_e = [[]];
|
|
192
192
|
return [4 /*yield*/, (0, solana_1.checkOrCreateAtaBatch)(this.connection, [invoker.publicKey], distributor.mint, invoker, tokenProgramId)];
|
|
193
193
|
case 3:
|
|
194
|
-
_c.apply(_b, _d.concat([__spreadArray.apply(void 0, _e.concat([__read.apply(void 0, [(
|
|
195
|
-
return [
|
|
196
|
-
|
|
197
|
-
|
|
194
|
+
_c.apply(_b, _d.concat([__spreadArray.apply(void 0, _e.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
|
|
195
|
+
if (!data.tokenAccount) return [3 /*break*/, 4];
|
|
196
|
+
_f = new web3_js_1.PublicKey(data.tokenAccount);
|
|
197
|
+
return [3 /*break*/, 6];
|
|
198
|
+
case 4: return [4 /*yield*/, (0, solana_1.ata)(distributor.mint, invoker.publicKey, tokenProgramId)];
|
|
199
|
+
case 5:
|
|
200
|
+
_f = _h.sent();
|
|
201
|
+
_h.label = 6;
|
|
202
|
+
case 6:
|
|
203
|
+
invokerTokens = _f;
|
|
198
204
|
claimStatusPublicKey = (0, utils_1.getClaimantStatusPda)(this.programId, distributorPublicKey, invoker.publicKey);
|
|
199
205
|
eventAuthorityPublicKey = (0, utils_1.getEventAuthorityPda)(this.programId);
|
|
200
206
|
return [4 /*yield*/, accounts_1.ClaimStatus.fetch(this.connection, claimStatusPublicKey)];
|
|
201
|
-
case
|
|
202
|
-
claimStatus =
|
|
207
|
+
case 7:
|
|
208
|
+
claimStatus = _h.sent();
|
|
203
209
|
accounts = {
|
|
204
210
|
distributor: distributorPublicKey,
|
|
205
211
|
claimStatus: claimStatusPublicKey,
|
|
@@ -225,15 +231,15 @@ var SolanaDistributorClient = /** @class */ (function () {
|
|
|
225
231
|
ixs.push((0, instructions_1.claimLocked)(accounts, this.programId));
|
|
226
232
|
}
|
|
227
233
|
return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey)];
|
|
228
|
-
case
|
|
229
|
-
|
|
234
|
+
case 8:
|
|
235
|
+
_g = _h.sent(), tx = _g.tx, hash = _g.hash, context = _g.context;
|
|
230
236
|
return [4 /*yield*/, (0, utils_1.wrappedSignAndExecuteTransaction)(this.connection, invoker, tx, {
|
|
231
237
|
hash: hash,
|
|
232
238
|
context: context,
|
|
233
239
|
commitment: this.getCommitment(),
|
|
234
240
|
})];
|
|
235
|
-
case
|
|
236
|
-
signature =
|
|
241
|
+
case 9:
|
|
242
|
+
signature = _h.sent();
|
|
237
243
|
return [2 /*return*/, { ixs: ixs, txId: signature }];
|
|
238
244
|
}
|
|
239
245
|
});
|
package/dist/solana/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/distributor",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.2",
|
|
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": "8fa0da9107e1a1b9ea900d1f7159169c0d256d31",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@streamflow/eslint-config": "6.3.
|
|
27
|
+
"@streamflow/eslint-config": "6.3.2",
|
|
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.3.
|
|
41
|
+
"@streamflow/common": "6.3.2",
|
|
42
42
|
"bn.js": "5.2.1",
|
|
43
43
|
"borsh": "^2.0.0",
|
|
44
44
|
"bs58": "5.0.0"
|