@streamflow/distributor 10.0.0-alpha.p317.e143b57 → 10.0.1
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 +19 -11
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/solana/index.cjs +19 -11
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +9 -3
- package/dist/esm/index.js +19 -11
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +9 -3
- package/dist/esm/solana/index.js +19 -11
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -376,13 +376,15 @@ var DISTRIBUTOR_PROGRAM_ID = {
|
|
|
376
376
|
[common.ICluster.Testnet]: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N",
|
|
377
377
|
[common.ICluster.Local]: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N"
|
|
378
378
|
};
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
379
|
+
|
|
380
|
+
// solana/fetchAirdropFee.ts
|
|
381
|
+
var fetchAirdropFee = async (distributorId, apiUrl, apiKey, fetchFn = fetch) => {
|
|
382
|
+
const url = `${apiUrl}/v2/api/airdrops/${encodeURIComponent(distributorId)}/fees`;
|
|
382
383
|
const res = await fetchFn(url, {
|
|
383
384
|
method: "GET",
|
|
384
385
|
headers: {
|
|
385
|
-
"Content-Type": "application/json"
|
|
386
|
+
"Content-Type": "application/json",
|
|
387
|
+
...apiKey ? { "x-api-key": apiKey } : {}
|
|
386
388
|
}
|
|
387
389
|
});
|
|
388
390
|
if (!res.ok) {
|
|
@@ -492,10 +494,10 @@ function calculateDynamicFeeFromSolParams(params) {
|
|
|
492
494
|
return raw;
|
|
493
495
|
}
|
|
494
496
|
async function resolveAirdropFeeLamportsUsingApi(params) {
|
|
495
|
-
const { distributorAddress, mintAccount, claimableAmount, cluster } = params;
|
|
497
|
+
const { distributorAddress, mintAccount, claimableAmount, cluster, apiUrl, apiKey } = params;
|
|
496
498
|
let apiFeesResponse = void 0;
|
|
497
499
|
try {
|
|
498
|
-
apiFeesResponse = await fetchAirdropFee(distributorAddress,
|
|
500
|
+
apiFeesResponse = await fetchAirdropFee(distributorAddress, apiUrl, apiKey);
|
|
499
501
|
} catch (_) {
|
|
500
502
|
}
|
|
501
503
|
let solPrice = null;
|
|
@@ -508,7 +510,7 @@ async function resolveAirdropFeeLamportsUsingApi(params) {
|
|
|
508
510
|
} catch (_) {
|
|
509
511
|
}
|
|
510
512
|
const response = apiFeesResponse ?? defaultAPIFeesResponse;
|
|
511
|
-
if (response?.isCustom && response.claimFee !== void 0) {
|
|
513
|
+
if (response?.isCustom && response.claimFee !== void 0 && response.claimFee !== null) {
|
|
512
514
|
return toLamportsSOL(response.claimFee);
|
|
513
515
|
}
|
|
514
516
|
const claimFeeDynamic = response?.claimFeeDynamic ?? defaultAPIFeesResponse.claimFeeDynamic;
|
|
@@ -3600,7 +3602,9 @@ var BaseDistributorClient = class {
|
|
|
3600
3602
|
commitment = "confirmed",
|
|
3601
3603
|
programId = "",
|
|
3602
3604
|
sendRate = 1,
|
|
3603
|
-
sendThrottler
|
|
3605
|
+
sendThrottler,
|
|
3606
|
+
apiUrl,
|
|
3607
|
+
apiKey
|
|
3604
3608
|
}) {
|
|
3605
3609
|
this.commitment = commitment;
|
|
3606
3610
|
this.cluster = cluster;
|
|
@@ -3611,6 +3615,8 @@ var BaseDistributorClient = class {
|
|
|
3611
3615
|
...merkle_distributor_default
|
|
3612
3616
|
};
|
|
3613
3617
|
this.merkleDistributorProgram = new anchor.Program(merkleDistributorProgram, { connection: this.connection });
|
|
3618
|
+
this.apiUrl = apiUrl;
|
|
3619
|
+
this.apiKey = apiKey;
|
|
3614
3620
|
}
|
|
3615
3621
|
getConnection() {
|
|
3616
3622
|
return this.connection;
|
|
@@ -3802,7 +3808,9 @@ var BaseDistributorClient = class {
|
|
|
3802
3808
|
distributorAddress: distributorPublicKey.toBase58(),
|
|
3803
3809
|
mintAccount,
|
|
3804
3810
|
claimableAmount,
|
|
3805
|
-
cluster: this.cluster
|
|
3811
|
+
cluster: this.cluster,
|
|
3812
|
+
apiUrl: this.apiUrl,
|
|
3813
|
+
apiKey: this.apiKey
|
|
3806
3814
|
});
|
|
3807
3815
|
} catch (_) {
|
|
3808
3816
|
feeLamports = MINIMUM_FEE_FALLBACK;
|
|
@@ -5567,8 +5575,8 @@ var aligned_distributor_default = {
|
|
|
5567
5575
|
|
|
5568
5576
|
// solana/clients/SolanaAlignedDistributorClient.ts
|
|
5569
5577
|
var SolanaAlignedDistributorClient = class extends BaseDistributorClient {
|
|
5570
|
-
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler }) {
|
|
5571
|
-
super({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler });
|
|
5578
|
+
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler, apiUrl, apiKey }) {
|
|
5579
|
+
super({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler, apiUrl, apiKey });
|
|
5572
5580
|
const alignedAirdropsProgram = {
|
|
5573
5581
|
...aligned_distributor_default
|
|
5574
5582
|
};
|