@streamflow/distributor 6.1.2 → 6.2.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, _c, mintAccount, programId, distributorPublicKey, tokenVault, senderTokens, args, accounts, _d, _e, _f, _g, nowTs, endVestingTs, startVestingTs, _h, tx, hash, context, signature;
92
+ var ixs, mint, _c, mintAccount, tokenProgramId, distributorPublicKey, tokenVault, senderTokens, args, accounts, _d, _e, _f, _g, nowTs, endVestingTs, startVestingTs, _h, tx, hash, context, signature;
93
93
  return __generator(this, function (_j) {
94
94
  switch (_j.label) {
95
95
  case 0:
@@ -100,12 +100,12 @@ var SolanaDistributorClient = /** @class */ (function () {
100
100
  mint = isNative ? spl_token_1.NATIVE_MINT : new web3_js_1.PublicKey(data.mint);
101
101
  return [4 /*yield*/, (0, solana_1.getMintAndProgram)(this.connection, mint)];
102
102
  case 1:
103
- _c = _j.sent(), mintAccount = _c.mint, programId = _c.programId;
103
+ _c = _j.sent(), mintAccount = _c.mint, tokenProgramId = _c.tokenProgramId;
104
104
  distributorPublicKey = (0, utils_1.getDistributorPda)(this.programId, mint, data.version);
105
- return [4 /*yield*/, (0, solana_1.ata)(mint, distributorPublicKey, programId)];
105
+ return [4 /*yield*/, (0, solana_1.ata)(mint, distributorPublicKey, tokenProgramId)];
106
106
  case 2:
107
107
  tokenVault = _j.sent();
108
- return [4 /*yield*/, (0, solana_1.ata)(mint, invoker.publicKey, programId)];
108
+ return [4 /*yield*/, (0, solana_1.ata)(mint, invoker.publicKey, tokenProgramId)];
109
109
  case 3:
110
110
  senderTokens = _j.sent();
111
111
  args = {
@@ -127,7 +127,7 @@ var SolanaDistributorClient = /** @class */ (function () {
127
127
  admin: invoker.publicKey,
128
128
  systemProgram: web3_js_1.SystemProgram.programId,
129
129
  associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
130
- tokenProgram: programId,
130
+ tokenProgram: tokenProgramId,
131
131
  };
132
132
  if (!isNative) return [3 /*break*/, 5];
133
133
  _e = (_d = ixs.push).apply;
@@ -145,7 +145,7 @@ var SolanaDistributorClient = /** @class */ (function () {
145
145
  throw new Error("The unlock period cannot be longer than the total vesting duration!");
146
146
  }
147
147
  ixs.push((0, instructions_1.newDistributor)(args, accounts, this.programId));
148
- ixs.push((0, spl_token_1.createTransferCheckedInstruction)(senderTokens, mint, tokenVault, invoker.publicKey, BigInt(data.maxTotalClaim.toString()), mintAccount.decimals, undefined, programId));
148
+ ixs.push((0, spl_token_1.createTransferCheckedInstruction)(senderTokens, mint, tokenVault, invoker.publicKey, BigInt(data.maxTotalClaim.toString()), mintAccount.decimals, undefined, tokenProgramId));
149
149
  return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey)];
150
150
  case 6:
151
151
  _h = _j.sent(), tx = _h.tx, hash = _h.hash, context = _h.context;
@@ -168,7 +168,7 @@ 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, programId, ixs, _b, _c, _d, _e, invokerTokens, claimStatusPublicKey, claimStatus, accounts, args, nowTs, _f, tx, hash, context, signature;
171
+ var distributorPublicKey, distributor, tokenProgramId, ixs, _b, _c, _d, _e, invokerTokens, claimStatusPublicKey, claimStatus, accounts, args, nowTs, _f, tx, hash, context, signature;
172
172
  return __generator(this, function (_g) {
173
173
  switch (_g.label) {
174
174
  case 0:
@@ -184,15 +184,15 @@ var SolanaDistributorClient = /** @class */ (function () {
184
184
  }
185
185
  return [4 /*yield*/, (0, solana_1.getMintAndProgram)(this.connection, distributor.mint)];
186
186
  case 2:
187
- programId = (_g.sent()).programId;
187
+ tokenProgramId = (_g.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
- return [4 /*yield*/, (0, solana_1.checkOrCreateAtaBatch)(this.connection, [invoker.publicKey], distributor.mint, invoker, programId)];
192
+ return [4 /*yield*/, (0, solana_1.checkOrCreateAtaBatch)(this.connection, [invoker.publicKey], distributor.mint, invoker, tokenProgramId)];
193
193
  case 3:
194
194
  _c.apply(_b, _d.concat([__spreadArray.apply(void 0, _e.concat([__read.apply(void 0, [(_g.sent())]), false]))]));
195
- return [4 /*yield*/, (0, solana_1.ata)(distributor.mint, invoker.publicKey, programId)];
195
+ return [4 /*yield*/, (0, solana_1.ata)(distributor.mint, invoker.publicKey, tokenProgramId)];
196
196
  case 4:
197
197
  invokerTokens = _g.sent();
198
198
  claimStatusPublicKey = (0, utils_1.getClaimantStatusPda)(this.programId, distributorPublicKey, invoker.publicKey);
@@ -206,7 +206,7 @@ var SolanaDistributorClient = /** @class */ (function () {
206
206
  to: invokerTokens,
207
207
  claimant: invoker.publicKey,
208
208
  mint: distributor.mint,
209
- tokenProgram: programId,
209
+ tokenProgram: tokenProgramId,
210
210
  systemProgram: web3_js_1.SystemProgram.programId,
211
211
  };
212
212
  if (!claimStatus) {
@@ -239,7 +239,7 @@ var SolanaDistributorClient = /** @class */ (function () {
239
239
  SolanaDistributorClient.prototype.clawback = function (data, _a) {
240
240
  var invoker = _a.invoker, computePrice = _a.computePrice, computeLimit = _a.computeLimit;
241
241
  return __awaiter(this, void 0, void 0, function () {
242
- var distributorPublicKey, distributor, programId, ixs, _b, _c, _d, _e, accounts, _f, tx, hash, context, signature;
242
+ var distributorPublicKey, distributor, tokenProgramId, ixs, _b, _c, _d, _e, accounts, _f, tx, hash, context, signature;
243
243
  return __generator(this, function (_g) {
244
244
  switch (_g.label) {
245
245
  case 0:
@@ -255,12 +255,12 @@ var SolanaDistributorClient = /** @class */ (function () {
255
255
  }
256
256
  return [4 /*yield*/, (0, solana_1.getMintAndProgram)(this.connection, distributor.mint)];
257
257
  case 2:
258
- programId = (_g.sent()).programId;
258
+ tokenProgramId = (_g.sent()).tokenProgramId;
259
259
  ixs = (0, solana_1.prepareBaseInstructions)(this.connection, { computePrice: computePrice, computeLimit: computeLimit });
260
260
  _c = (_b = ixs.push).apply;
261
261
  _d = [ixs];
262
262
  _e = [[]];
263
- return [4 /*yield*/, (0, solana_1.checkOrCreateAtaBatch)(this.connection, [invoker.publicKey], distributor.mint, invoker, programId)];
263
+ return [4 /*yield*/, (0, solana_1.checkOrCreateAtaBatch)(this.connection, [invoker.publicKey], distributor.mint, invoker, tokenProgramId)];
264
264
  case 3:
265
265
  _c.apply(_b, _d.concat([__spreadArray.apply(void 0, _e.concat([__read.apply(void 0, [(_g.sent())]), false]))]));
266
266
  accounts = {
@@ -270,7 +270,7 @@ var SolanaDistributorClient = /** @class */ (function () {
270
270
  admin: invoker.publicKey,
271
271
  mint: distributor.mint,
272
272
  systemProgram: web3_js_1.SystemProgram.programId,
273
- tokenProgram: programId,
273
+ tokenProgram: tokenProgramId,
274
274
  };
275
275
  ixs.push((0, instructions_1.clawback)(accounts, this.programId));
276
276
  return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/distributor",
3
- "version": "6.1.2",
3
+ "version": "6.2.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,7 +22,7 @@
22
22
  "lint": "eslint --fix .",
23
23
  "prepublishOnly": "npm run lint && npm run build"
24
24
  },
25
- "gitHead": "1104b998070b9c5c70142025ba8aa22895990b10",
25
+ "gitHead": "06f6635b47854013b63db62e9da401b4f004bfdc",
26
26
  "devDependencies": {
27
27
  "@streamflow/eslint-config": "6.0.0",
28
28
  "@types/bn.js": "5.1.1",
@@ -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.1.2",
41
+ "@streamflow/common": "6.2.0",
42
42
  "bn.js": "5.2.1",
43
43
  "borsh": "^2.0.0",
44
44
  "bs58": "5.0.0"