@streamflow/distributor 6.0.0-alpha.5 → 6.0.0-alpha.7

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.
@@ -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, IGetClaimsData, IGetDistributors, ICreateSolanaExt, IInteractSolanaExt } from "./types";
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;
@@ -20,7 +20,7 @@ export default class SolanaDistributorClient {
20
20
  create(data: ICreateDistributorData, { invoker, isNative, computePrice, computeLimit }: ICreateSolanaExt): Promise<ICreateDistributorResult>;
21
21
  claim(data: IClaimData, { invoker, computePrice, computeLimit }: IInteractSolanaExt): Promise<ITransactionResult>;
22
22
  clawback(data: IClawbackData, { invoker, computePrice, computeLimit }: IInteractSolanaExt): Promise<ITransactionResult>;
23
- getClaims(data: IGetClaimsData): Promise<(ClaimStatus | null)[]>;
23
+ getClaims(data: IGetClaimData[]): Promise<(ClaimStatus | null)[]>;
24
24
  getDistributors(data: IGetDistributors): Promise<(MerkleDistributor | null)[]>;
25
25
  }
26
26
  export {};
@@ -140,7 +140,7 @@ var SolanaDistributorClient = /** @class */ (function () {
140
140
  case 5:
141
141
  ixs.push((0, instructions_1.newDistributor)(args, accounts, this.programId));
142
142
  ixs.push((0, spl_token_1.createTransferCheckedInstruction)(senderTokens, mint, tokenVault, invoker.publicKey, BigInt(data.maxTotalClaim.toString()), mintAccount.decimals));
143
- return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey, this.getCommitment())];
143
+ return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey)];
144
144
  case 6:
145
145
  _g = _h.sent(), tx = _g.tx, hash = _g.hash;
146
146
  return [4 /*yield*/, (0, utils_1.wrappedSignAndExecuteTransaction)(this.connection, invoker, tx, hash)];
@@ -205,7 +205,7 @@ var SolanaDistributorClient = /** @class */ (function () {
205
205
  ixs.push((0, instructions_1.newClaim)(args, accounts, this.programId));
206
206
  }
207
207
  ixs.push((0, instructions_1.claimLocked)(accounts, this.programId));
208
- return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey, this.getCommitment())];
208
+ return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey)];
209
209
  case 5:
210
210
  _f = _g.sent(), tx = _f.tx, hash = _f.hash;
211
211
  return [4 /*yield*/, (0, utils_1.wrappedSignAndExecuteTransaction)(this.connection, invoker, tx, hash)];
@@ -250,7 +250,7 @@ var SolanaDistributorClient = /** @class */ (function () {
250
250
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
251
251
  };
252
252
  ixs.push((0, instructions_1.clawback)(accounts, this.programId));
253
- return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey, this.getCommitment())];
253
+ return [4 /*yield*/, (0, solana_1.prepareTransaction)(this.connection, ixs, invoker.publicKey)];
254
254
  case 3:
255
255
  _f = _g.sent(), tx = _f.tx, hash = _f.hash;
256
256
  return [4 /*yield*/, (0, utils_1.wrappedSignAndExecuteTransaction)(this.connection, invoker, tx, hash)];
@@ -263,12 +263,12 @@ var SolanaDistributorClient = /** @class */ (function () {
263
263
  };
264
264
  SolanaDistributorClient.prototype.getClaims = function (data) {
265
265
  return __awaiter(this, void 0, void 0, function () {
266
- var distributorPublicKey, claimStatusPublicKeys;
266
+ var claimStatusPublicKeys;
267
267
  var _this = this;
268
268
  return __generator(this, function (_a) {
269
- distributorPublicKey = new web3_js_1.PublicKey(data.id);
270
- claimStatusPublicKeys = data.recipients.map(function (recipient) {
271
- return (0, utils_1.getClaimantStatusPda)(_this.programId, distributorPublicKey, new web3_js_1.PublicKey(recipient));
269
+ claimStatusPublicKeys = data.map(function (_a) {
270
+ var id = _a.id, recipient = _a.recipient;
271
+ return (0, utils_1.getClaimantStatusPda)(_this.programId, new web3_js_1.PublicKey(id), new web3_js_1.PublicKey(recipient));
272
272
  });
273
273
  return [2 /*return*/, accounts_1.ClaimStatus.fetchMultiple(this.connection, claimStatusPublicKeys, this.programId)];
274
274
  });
@@ -30,9 +30,9 @@ export interface IClaimData {
30
30
  export interface IClawbackData {
31
31
  id: string;
32
32
  }
33
- export interface IGetClaimsData {
33
+ export interface IGetClaimData {
34
34
  id: string;
35
- recipients: string[];
35
+ recipient: string;
36
36
  }
37
37
  export interface IGetDistributors {
38
38
  ids: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/distributor",
3
- "version": "6.0.0-alpha.5",
3
+ "version": "6.0.0-alpha.7",
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": "bfb144b9151a2df03cbf3fa5b7755dc375a8ecf9",
25
+ "gitHead": "7a112cdce28cc1864a4d51e623b1915ca6cce1b7",
26
26
  "devDependencies": {
27
- "@streamflow/eslint-config": "6.0.0-alpha.5",
27
+ "@streamflow/eslint-config": "6.0.0-alpha.7",
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.5",
41
+ "@streamflow/common": "6.0.0-alpha.7",
42
42
  "bn.js": "5.2.1",
43
43
  "borsh": "^2.0.0",
44
44
  "bs58": "5.0.0"