@streamflow/distributor 7.5.0 → 7.5.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.
@@ -131,6 +131,7 @@ class BaseDistributorClient {
131
131
  (new bn_js_1.default(data.amountLocked).gtn(0) && nowTs.sub(distributor.startTs).gte(distributor.unlockPeriod))) {
132
132
  ixs.push((0, instructions_1.claimLocked)(accounts, this.programId));
133
133
  }
134
+ ixs.push(this.prepareClaimFeeInstruction(extParams.invoker.publicKey));
134
135
  return ixs;
135
136
  }
136
137
  async closeClaim(data, extParams) {
@@ -242,6 +243,13 @@ class BaseDistributorClient {
242
243
  account: accounts_1.MerkleDistributor.decode(account.data),
243
244
  }));
244
245
  }
246
+ prepareClaimFeeInstruction(payer) {
247
+ return web3_js_1.SystemProgram.transfer({
248
+ fromPubkey: payer,
249
+ toPubkey: constants_1.STREAMFLOW_TREASURY_PUBLIC_KEY,
250
+ lamports: constants_1.AIRDROP_CLAIM_FEE,
251
+ });
252
+ }
245
253
  getNewDistributorArgs(data) {
246
254
  const args = {
247
255
  version: new bn_js_1.default(data.version),
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DISTRIBUTOR_PROGRAM_ID = exports.ALIGNED_DISTRIBUTOR_PROGRAM_ID = exports.ONE_IN_BASIS_POINTS = exports.ALIGNED_PRECISION_FACTOR_POW = exports.CLAIM_STATUS_PREFIX = exports.TEST_ORACLE_PREFIX = exports.ALIGNED_DISTRIBUTOR_PREFIX = exports.DISTRIBUTOR_PREFIX = exports.DISTRIBUTOR_ADMIN_OFFSET = exports.DISTRIBUTOR_MINT_OFFSET = exports.ANCHOR_DISCRIMINATOR_OFFSET = void 0;
3
+ exports.DISTRIBUTOR_PROGRAM_ID = exports.ALIGNED_DISTRIBUTOR_PROGRAM_ID = exports.ONE_IN_BASIS_POINTS = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.AIRDROP_CLAIM_FEE = exports.ALIGNED_PRECISION_FACTOR_POW = exports.CLAIM_STATUS_PREFIX = exports.TEST_ORACLE_PREFIX = exports.ALIGNED_DISTRIBUTOR_PREFIX = exports.DISTRIBUTOR_PREFIX = exports.DISTRIBUTOR_ADMIN_OFFSET = exports.DISTRIBUTOR_MINT_OFFSET = exports.ANCHOR_DISCRIMINATOR_OFFSET = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
4
5
  const common_1 = require("@streamflow/common");
5
6
  exports.ANCHOR_DISCRIMINATOR_OFFSET = 8;
6
7
  exports.DISTRIBUTOR_MINT_OFFSET = exports.ANCHOR_DISCRIMINATOR_OFFSET + 41;
@@ -10,6 +11,8 @@ exports.ALIGNED_DISTRIBUTOR_PREFIX = Buffer.from("aligned-distributor", "utf-8")
10
11
  exports.TEST_ORACLE_PREFIX = Buffer.from("test-oracle", "utf-8");
11
12
  exports.CLAIM_STATUS_PREFIX = Buffer.from("ClaimStatus", "utf-8");
12
13
  exports.ALIGNED_PRECISION_FACTOR_POW = 9;
14
+ exports.AIRDROP_CLAIM_FEE = BigInt(5200000);
15
+ exports.STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js_1.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
13
16
  exports.ONE_IN_BASIS_POINTS = BigInt(10000);
14
17
  exports.ALIGNED_DISTRIBUTOR_PROGRAM_ID = {
15
18
  [common_1.ICluster.Devnet]: "aMERKpFAWoChCi5oZwPvgsSCoGpZKBiU7fi76bdZjt2",
@@ -38,5 +38,6 @@ export default abstract class BaseDistributorClient {
38
38
  getClaims(data: IGetClaimData[]): Promise<(ClaimStatus | null)[]>;
39
39
  getDistributors(data: IGetDistributors): Promise<(MerkleDistributor | null)[]>;
40
40
  searchDistributors(data: ISearchDistributors): Promise<IProgramAccount<MerkleDistributor>[]>;
41
+ protected prepareClaimFeeInstruction(payer: PublicKey): TransactionInstruction;
41
42
  protected getNewDistributorArgs(data: ICreateDistributorData): NewDistributorArgs;
42
43
  }
@@ -4,7 +4,7 @@ import { ICluster } from "@streamflow/common";
4
4
  import { ata, checkOrCreateAtaBatch, prepareBaseInstructions, prepareTransaction, getMintAndProgram, buildSendThrottler, prepareWrappedAccount, pk, } from "@streamflow/common/solana";
5
5
  import { ASSOCIATED_TOKEN_PROGRAM_ID, createTransferCheckedInstruction, createTransferCheckedWithFeeInstruction, getTransferFeeConfig, NATIVE_MINT, } from "@solana/spl-token";
6
6
  import bs58 from "bs58";
7
- import { DISTRIBUTOR_ADMIN_OFFSET, DISTRIBUTOR_MINT_OFFSET, DISTRIBUTOR_PROGRAM_ID } from "../constants";
7
+ import { AIRDROP_CLAIM_FEE, DISTRIBUTOR_ADMIN_OFFSET, DISTRIBUTOR_MINT_OFFSET, DISTRIBUTOR_PROGRAM_ID, STREAMFLOW_TREASURY_PUBLIC_KEY, } from "../constants";
8
8
  import { claimLocked, newClaim, } from "../generated/instructions";
9
9
  import { ClaimStatus, MerkleDistributor } from "../generated/accounts";
10
10
  import { calculateAmountWithTransferFees, getClaimantStatusPda, getDistributorPda, getEventAuthorityPda, wrappedSignAndExecuteTransaction, } from "../utils";
@@ -130,6 +130,7 @@ export default class BaseDistributorClient {
130
130
  (new BN(data.amountLocked).gtn(0) && nowTs.sub(distributor.startTs).gte(distributor.unlockPeriod))) {
131
131
  ixs.push(claimLocked(accounts, this.programId));
132
132
  }
133
+ ixs.push(this.prepareClaimFeeInstruction(extParams.invoker.publicKey));
133
134
  return ixs;
134
135
  }
135
136
  async closeClaim(data, extParams) {
@@ -241,6 +242,13 @@ export default class BaseDistributorClient {
241
242
  account: MerkleDistributor.decode(account.data),
242
243
  }));
243
244
  }
245
+ prepareClaimFeeInstruction(payer) {
246
+ return SystemProgram.transfer({
247
+ fromPubkey: payer,
248
+ toPubkey: STREAMFLOW_TREASURY_PUBLIC_KEY,
249
+ lamports: AIRDROP_CLAIM_FEE,
250
+ });
251
+ }
244
252
  getNewDistributorArgs(data) {
245
253
  const args = {
246
254
  version: new BN(data.version),
@@ -1,3 +1,4 @@
1
+ import { PublicKey } from "@solana/web3.js";
1
2
  export declare const ANCHOR_DISCRIMINATOR_OFFSET = 8;
2
3
  export declare const DISTRIBUTOR_MINT_OFFSET: number;
3
4
  export declare const DISTRIBUTOR_ADMIN_OFFSET: number;
@@ -6,6 +7,8 @@ export declare const ALIGNED_DISTRIBUTOR_PREFIX: Buffer;
6
7
  export declare const TEST_ORACLE_PREFIX: Buffer;
7
8
  export declare const CLAIM_STATUS_PREFIX: Buffer;
8
9
  export declare const ALIGNED_PRECISION_FACTOR_POW = 9;
10
+ export declare const AIRDROP_CLAIM_FEE: bigint;
11
+ export declare const STREAMFLOW_TREASURY_PUBLIC_KEY: PublicKey;
9
12
  export declare const ONE_IN_BASIS_POINTS: bigint;
10
13
  export declare const ALIGNED_DISTRIBUTOR_PROGRAM_ID: {
11
14
  devnet: string;
@@ -1,3 +1,4 @@
1
+ import { PublicKey } from "@solana/web3.js";
1
2
  import { ICluster } from "@streamflow/common";
2
3
  export const ANCHOR_DISCRIMINATOR_OFFSET = 8;
3
4
  export const DISTRIBUTOR_MINT_OFFSET = ANCHOR_DISCRIMINATOR_OFFSET + 41;
@@ -7,6 +8,8 @@ export const ALIGNED_DISTRIBUTOR_PREFIX = Buffer.from("aligned-distributor", "ut
7
8
  export const TEST_ORACLE_PREFIX = Buffer.from("test-oracle", "utf-8");
8
9
  export const CLAIM_STATUS_PREFIX = Buffer.from("ClaimStatus", "utf-8");
9
10
  export const ALIGNED_PRECISION_FACTOR_POW = 9;
11
+ export const AIRDROP_CLAIM_FEE = BigInt(5_200_000);
12
+ export const STREAMFLOW_TREASURY_PUBLIC_KEY = new PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
10
13
  export const ONE_IN_BASIS_POINTS = BigInt(10_000);
11
14
  export const ALIGNED_DISTRIBUTOR_PROGRAM_ID = {
12
15
  [ICluster.Devnet]: "aMERKpFAWoChCi5oZwPvgsSCoGpZKBiU7fi76bdZjt2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/distributor",
3
- "version": "7.5.0",
3
+ "version": "7.5.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/esm/index.js",
@@ -31,9 +31,9 @@
31
31
  "lint": "eslint --fix .",
32
32
  "prepublishOnly": "npm run lint && npm run build"
33
33
  },
34
- "gitHead": "a17f597d53b6caff7fed8bfdf054a2a755431948",
34
+ "gitHead": "f19abd6ecfd39a972c15b59360921a6d05675886",
35
35
  "devDependencies": {
36
- "@streamflow/eslint-config": "7.5.0",
36
+ "@streamflow/eslint-config": "7.5.2",
37
37
  "@types/bn.js": "5.1.1",
38
38
  "date-fns": "2.28.0",
39
39
  "typescript": "^5.6.3"
@@ -45,7 +45,7 @@
45
45
  "@solana/spl-token": "0.4.9",
46
46
  "@solana/wallet-adapter-base": "0.9.19",
47
47
  "@solana/web3.js": "1.95.4",
48
- "@streamflow/common": "7.5.0",
48
+ "@streamflow/common": "7.5.2",
49
49
  "bn.js": "5.2.1",
50
50
  "borsh": "^2.0.0",
51
51
  "bs58": "5.0.0",