@streamflow/distributor 13.2.0 → 13.2.1-alpha.p371.2d28b7a
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/index.cjs +5 -3
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/solana/index.cjs +5 -3
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +3 -0
- package/dist/esm/index.js +5 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +3 -0
- package/dist/esm/solana/index.js +5 -3
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -601,6 +601,9 @@ declare function resolveAirdropFeeLamportsUsingApi(params: {
|
|
|
601
601
|
cluster: ICluster;
|
|
602
602
|
apiUrl: string;
|
|
603
603
|
apiKey?: string;
|
|
604
|
+
/** On-chain claim_max_fee from the distributor account (in lamports). When provided, used as
|
|
605
|
+
* the authoritative upper bound and as a safe fallback when price data is unavailable. */
|
|
606
|
+
claimMaxFeeLamports?: number;
|
|
604
607
|
}): Promise<bigint>;
|
|
605
608
|
|
|
606
609
|
type index_AirdropFeeClient = AirdropFeeClient;
|
package/dist/esm/solana/index.js
CHANGED
|
@@ -5557,7 +5557,8 @@ function calculateDynamicFeeFromSolParams(params) {
|
|
|
5557
5557
|
return raw;
|
|
5558
5558
|
}
|
|
5559
5559
|
async function resolveAirdropFeeLamportsUsingApi(params) {
|
|
5560
|
-
const { distributorAddress, mintAccount, claimableAmount, cluster, apiUrl, apiKey } = params;
|
|
5560
|
+
const { distributorAddress, mintAccount, claimableAmount, cluster, apiUrl, apiKey, claimMaxFeeLamports } = params;
|
|
5561
|
+
const maxFeeBigint = claimMaxFeeLamports !== void 0 ? BigInt(claimMaxFeeLamports) : void 0;
|
|
5561
5562
|
let apiFeesResponse = void 0;
|
|
5562
5563
|
try {
|
|
5563
5564
|
apiFeesResponse = await fetchAirdropFee(distributorAddress, apiUrl, apiKey);
|
|
@@ -5578,7 +5579,7 @@ async function resolveAirdropFeeLamportsUsingApi(params) {
|
|
|
5578
5579
|
}
|
|
5579
5580
|
const claimFeeDynamic = response?.claimFeeDynamic ?? defaultAPIFeesResponse.claimFeeDynamic;
|
|
5580
5581
|
if (!tokenPrice?.value || !solPrice?.value) {
|
|
5581
|
-
return MINIMUM_FEE_FALLBACK;
|
|
5582
|
+
return maxFeeBigint ?? MINIMUM_FEE_FALLBACK;
|
|
5582
5583
|
}
|
|
5583
5584
|
const baseLamports = calculateClaimableLamportsFromPrices({
|
|
5584
5585
|
claimableAmount,
|
|
@@ -5586,9 +5587,10 @@ async function resolveAirdropFeeLamportsUsingApi(params) {
|
|
|
5586
5587
|
solPriceUsd: solPrice.value,
|
|
5587
5588
|
tokenDecimals: mintAccount.decimals
|
|
5588
5589
|
});
|
|
5590
|
+
const maxPriceOverride = maxFeeBigint !== void 0 ? lamportsToSolString(maxFeeBigint) : claimFeeDynamic.maxPrice;
|
|
5589
5591
|
return calculateDynamicFeeFromSolParams({
|
|
5590
5592
|
minPrice: claimFeeDynamic.minPrice,
|
|
5591
|
-
maxPrice:
|
|
5593
|
+
maxPrice: maxPriceOverride,
|
|
5592
5594
|
allocationFactor: claimFeeDynamic.allocationFactor,
|
|
5593
5595
|
claimableLamports: baseLamports
|
|
5594
5596
|
});
|