@streamflow/distributor 13.3.0 → 13.3.1-alpha.p371.561653f

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.
@@ -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/index.js CHANGED
@@ -5589,7 +5589,8 @@ function calculateDynamicFeeFromSolParams(params) {
5589
5589
  return raw;
5590
5590
  }
5591
5591
  async function resolveAirdropFeeLamportsUsingApi(params) {
5592
- const { distributorAddress, mintAccount, claimableAmount, cluster, apiUrl, apiKey } = params;
5592
+ const { distributorAddress, mintAccount, claimableAmount, cluster, apiUrl, apiKey, claimMaxFeeLamports } = params;
5593
+ const maxFeeBigint = claimMaxFeeLamports !== void 0 ? BigInt(claimMaxFeeLamports) : void 0;
5593
5594
  let apiFeesResponse = void 0;
5594
5595
  try {
5595
5596
  apiFeesResponse = await fetchAirdropFee(distributorAddress, apiUrl, apiKey);
@@ -5610,7 +5611,7 @@ async function resolveAirdropFeeLamportsUsingApi(params) {
5610
5611
  }
5611
5612
  const claimFeeDynamic = response?.claimFeeDynamic ?? defaultAPIFeesResponse.claimFeeDynamic;
5612
5613
  if (!tokenPrice?.value || !solPrice?.value) {
5613
- return MINIMUM_FEE_FALLBACK;
5614
+ return maxFeeBigint ?? MINIMUM_FEE_FALLBACK;
5614
5615
  }
5615
5616
  const baseLamports = calculateClaimableLamportsFromPrices({
5616
5617
  claimableAmount,
@@ -5618,9 +5619,10 @@ async function resolveAirdropFeeLamportsUsingApi(params) {
5618
5619
  solPriceUsd: solPrice.value,
5619
5620
  tokenDecimals: mintAccount.decimals
5620
5621
  });
5622
+ const maxPriceOverride = maxFeeBigint !== void 0 ? lamportsToSolString(maxFeeBigint) : claimFeeDynamic.maxPrice;
5621
5623
  return calculateDynamicFeeFromSolParams({
5622
5624
  minPrice: claimFeeDynamic.minPrice,
5623
- maxPrice: claimFeeDynamic.maxPrice,
5625
+ maxPrice: maxPriceOverride,
5624
5626
  allocationFactor: claimFeeDynamic.allocationFactor,
5625
5627
  claimableLamports: baseLamports
5626
5628
  });