@streamflow/distributor 7.0.0-alpha.12 → 7.0.0-alpha.14
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/cjs/solana/utils.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateAmountWithTransferFees = exports.wrappedSignAndExecuteTransaction = exports.getEventAuthorityPda = exports.getClaimantStatusPda = exports.getDistributorPda =
|
|
3
|
+
exports.calculateAmountWithTransferFees = exports.wrappedSignAndExecuteTransaction = exports.getEventAuthorityPda = exports.getClaimantStatusPda = exports.getDistributorPda = void 0;
|
|
4
4
|
const buffer_1 = require("buffer");
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
6
|
const common_1 = require("@streamflow/common");
|
|
7
7
|
const solana_1 = require("@streamflow/common/solana");
|
|
8
8
|
const errors_1 = require("./generated/errors");
|
|
9
9
|
const constants_1 = require("./constants");
|
|
10
|
-
const divCeilN = (n, d) => n / d + (n % d ? BigInt(1) : BigInt(0));
|
|
11
|
-
exports.divCeilN = divCeilN;
|
|
12
10
|
function getDistributorPda(programId, mint, version) {
|
|
13
11
|
// Constructing the seed for the PDA
|
|
14
12
|
const seeds = [
|
|
@@ -59,7 +57,7 @@ async function calculateAmountWithTransferFees(connection, transferFeeConfig, tr
|
|
|
59
57
|
if (transferFeeBasisPoints !== BigInt(0)) {
|
|
60
58
|
const numerator = transferAmount * constants_1.ONE_IN_BASIS_POINTS;
|
|
61
59
|
const denominator = constants_1.ONE_IN_BASIS_POINTS - transferFeeBasisPoints;
|
|
62
|
-
const rawPreFeeAmount = (0,
|
|
60
|
+
const rawPreFeeAmount = (0, common_1.divCeilN)(numerator, denominator);
|
|
63
61
|
const fee = rawPreFeeAmount - transferAmount;
|
|
64
62
|
transferAmount = rawPreFeeAmount;
|
|
65
63
|
feeCharged = fee > transferFee.maximumFee ? transferFee.maximumFee : fee;
|
|
@@ -13,8 +13,8 @@ export interface ICreateDistributorData {
|
|
|
13
13
|
mint: string;
|
|
14
14
|
version: number;
|
|
15
15
|
root: Array<number>;
|
|
16
|
-
maxTotalClaim: BN;
|
|
17
|
-
maxNumNodes: number | string;
|
|
16
|
+
maxTotalClaim: BN | number | string;
|
|
17
|
+
maxNumNodes: BN | number | string;
|
|
18
18
|
unlockPeriod: number;
|
|
19
19
|
startVestingTs: number;
|
|
20
20
|
endVestingTs: number;
|
|
@@ -2,7 +2,6 @@ import { TransferFeeConfig } from "@solana/spl-token";
|
|
|
2
2
|
import { SignerWalletAdapter } from "@solana/wallet-adapter-base";
|
|
3
3
|
import { Connection, Keypair, PublicKey, Transaction, VersionedTransaction } from "@solana/web3.js";
|
|
4
4
|
import { ConfirmationParams, ThrottleParams } from "@streamflow/common/solana";
|
|
5
|
-
export declare const divCeilN: (n: bigint, d: bigint) => bigint;
|
|
6
5
|
export declare function getDistributorPda(programId: PublicKey, mint: PublicKey, version: number): PublicKey;
|
|
7
6
|
export declare function getClaimantStatusPda(programId: PublicKey, distributor: PublicKey, claimant: PublicKey): PublicKey;
|
|
8
7
|
export declare function getEventAuthorityPda(programId: PublicKey): PublicKey;
|
package/dist/esm/solana/utils.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Buffer } from "buffer";
|
|
2
2
|
import { PublicKey } from "@solana/web3.js";
|
|
3
|
-
import { ContractError } from "@streamflow/common";
|
|
3
|
+
import { ContractError, divCeilN } from "@streamflow/common";
|
|
4
4
|
import { signAndExecuteTransaction } from "@streamflow/common/solana";
|
|
5
5
|
import { fromTxError } from "./generated/errors";
|
|
6
6
|
import { ONE_IN_BASIS_POINTS } from "./constants";
|
|
7
|
-
export const divCeilN = (n, d) => n / d + (n % d ? BigInt(1) : BigInt(0));
|
|
8
7
|
export function getDistributorPda(programId, mint, version) {
|
|
9
8
|
// Constructing the seed for the PDA
|
|
10
9
|
const seeds = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/distributor",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.14",
|
|
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",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"lint": "eslint --fix .",
|
|
27
27
|
"prepublishOnly": "npm run lint && npm run build"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "ce9df65df6f69ceac7a2ae4f3404060659ada89b",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@streamflow/eslint-config": "7.0.0-alpha.
|
|
31
|
+
"@streamflow/eslint-config": "7.0.0-alpha.14",
|
|
32
32
|
"@types/bn.js": "5.1.1",
|
|
33
33
|
"date-fns": "2.28.0",
|
|
34
34
|
"typescript": "^4.9.5"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@solana/spl-token": "0.3.6",
|
|
40
40
|
"@solana/wallet-adapter-base": "0.9.19",
|
|
41
41
|
"@solana/web3.js": "1.90.2",
|
|
42
|
-
"@streamflow/common": "7.0.0-alpha.
|
|
42
|
+
"@streamflow/common": "7.0.0-alpha.14",
|
|
43
43
|
"bn.js": "5.2.1",
|
|
44
44
|
"borsh": "^2.0.0",
|
|
45
45
|
"bs58": "5.0.0",
|