@streamflow/distributor 10.0.0-alpha.p313.fe3720a → 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/README.md +2 -2
- 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
|
@@ -627,6 +627,8 @@ interface IInitOptions {
|
|
|
627
627
|
programId?: string;
|
|
628
628
|
sendRate?: number;
|
|
629
629
|
sendThrottler?: PQueue;
|
|
630
|
+
apiUrl: string;
|
|
631
|
+
apiKey?: string;
|
|
630
632
|
}
|
|
631
633
|
declare abstract class BaseDistributorClient {
|
|
632
634
|
protected connection: Connection;
|
|
@@ -635,7 +637,9 @@ declare abstract class BaseDistributorClient {
|
|
|
635
637
|
protected sendThrottler: PQueue;
|
|
636
638
|
merkleDistributorProgram: Program<MerkleDistributor$1>;
|
|
637
639
|
protected cluster: ICluster;
|
|
638
|
-
|
|
640
|
+
protected apiUrl: string;
|
|
641
|
+
protected apiKey?: string;
|
|
642
|
+
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler, apiUrl, apiKey, }: IInitOptions);
|
|
639
643
|
protected abstract getNewDistributorInstruction(data: ICreateDistributorData | ICreateAlignedDistributorData, accounts: NewDistributorAccounts): Promise<TransactionInstruction>;
|
|
640
644
|
protected abstract getClawbackInstruction(account: ClawbackAccounts): Promise<TransactionInstruction>;
|
|
641
645
|
getConnection(): Connection;
|
|
@@ -685,7 +689,7 @@ declare class SolanaDistributorClient extends BaseDistributorClient {
|
|
|
685
689
|
|
|
686
690
|
declare class SolanaAlignedDistributorClient extends BaseDistributorClient {
|
|
687
691
|
alignedProxyProgram: Program<AlignedDistributor>;
|
|
688
|
-
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler }: IInitOptions);
|
|
692
|
+
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler, apiUrl, apiKey }: IInitOptions);
|
|
689
693
|
getAlignedDistributorProgramId(): PublicKey;
|
|
690
694
|
getAlignedDistributorAddress(distributorAddress: string): PublicKey;
|
|
691
695
|
getAlignedDistributorData(distributorAddress: string): Promise<AlignedDistributorData>;
|
|
@@ -1393,7 +1397,7 @@ interface AirdropFeeQueryOptionsOverrides {
|
|
|
1393
1397
|
retry?: number | boolean;
|
|
1394
1398
|
refetchOnWindowFocus?: boolean;
|
|
1395
1399
|
}
|
|
1396
|
-
declare const fetchAirdropFee: (distributorId: string,
|
|
1400
|
+
declare const fetchAirdropFee: (distributorId: string, apiUrl: string, apiKey?: string, fetchFn?: typeof fetch) => Promise<AirdropFeeResponse>;
|
|
1397
1401
|
|
|
1398
1402
|
type AirdropFeeDynamic = {
|
|
1399
1403
|
minPrice: string;
|
|
@@ -1450,6 +1454,8 @@ declare function resolveAirdropFeeLamportsUsingApi(params: {
|
|
|
1450
1454
|
mintAccount: Mint;
|
|
1451
1455
|
claimableAmount: bigint;
|
|
1452
1456
|
cluster: ICluster;
|
|
1457
|
+
apiUrl: string;
|
|
1458
|
+
apiKey?: string;
|
|
1453
1459
|
}): Promise<bigint>;
|
|
1454
1460
|
|
|
1455
1461
|
type index_AirdropFeeClient = AirdropFeeClient;
|
package/dist/esm/solana/index.js
CHANGED
|
@@ -311,13 +311,15 @@ var DISTRIBUTOR_PROGRAM_ID = {
|
|
|
311
311
|
[ICluster.Testnet]: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N",
|
|
312
312
|
[ICluster.Local]: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N"
|
|
313
313
|
};
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
314
|
+
|
|
315
|
+
// solana/fetchAirdropFee.ts
|
|
316
|
+
var fetchAirdropFee = async (distributorId, apiUrl, apiKey, fetchFn = fetch) => {
|
|
317
|
+
const url = `${apiUrl}/v2/api/airdrops/${encodeURIComponent(distributorId)}/fees`;
|
|
317
318
|
const res = await fetchFn(url, {
|
|
318
319
|
method: "GET",
|
|
319
320
|
headers: {
|
|
320
|
-
"Content-Type": "application/json"
|
|
321
|
+
"Content-Type": "application/json",
|
|
322
|
+
...apiKey ? { "x-api-key": apiKey } : {}
|
|
321
323
|
}
|
|
322
324
|
});
|
|
323
325
|
if (!res.ok) {
|
|
@@ -427,10 +429,10 @@ function calculateDynamicFeeFromSolParams(params) {
|
|
|
427
429
|
return raw;
|
|
428
430
|
}
|
|
429
431
|
async function resolveAirdropFeeLamportsUsingApi(params) {
|
|
430
|
-
const { distributorAddress, mintAccount, claimableAmount, cluster } = params;
|
|
432
|
+
const { distributorAddress, mintAccount, claimableAmount, cluster, apiUrl, apiKey } = params;
|
|
431
433
|
let apiFeesResponse = void 0;
|
|
432
434
|
try {
|
|
433
|
-
apiFeesResponse = await fetchAirdropFee(distributorAddress,
|
|
435
|
+
apiFeesResponse = await fetchAirdropFee(distributorAddress, apiUrl, apiKey);
|
|
434
436
|
} catch (_) {
|
|
435
437
|
}
|
|
436
438
|
let solPrice = null;
|
|
@@ -443,7 +445,7 @@ async function resolveAirdropFeeLamportsUsingApi(params) {
|
|
|
443
445
|
} catch (_) {
|
|
444
446
|
}
|
|
445
447
|
const response = apiFeesResponse ?? defaultAPIFeesResponse;
|
|
446
|
-
if (response?.isCustom && response.claimFee !== void 0) {
|
|
448
|
+
if (response?.isCustom && response.claimFee !== void 0 && response.claimFee !== null) {
|
|
447
449
|
return toLamportsSOL(response.claimFee);
|
|
448
450
|
}
|
|
449
451
|
const claimFeeDynamic = response?.claimFeeDynamic ?? defaultAPIFeesResponse.claimFeeDynamic;
|
|
@@ -3535,7 +3537,9 @@ var BaseDistributorClient = class {
|
|
|
3535
3537
|
commitment = "confirmed",
|
|
3536
3538
|
programId = "",
|
|
3537
3539
|
sendRate = 1,
|
|
3538
|
-
sendThrottler
|
|
3540
|
+
sendThrottler,
|
|
3541
|
+
apiUrl,
|
|
3542
|
+
apiKey
|
|
3539
3543
|
}) {
|
|
3540
3544
|
this.commitment = commitment;
|
|
3541
3545
|
this.cluster = cluster;
|
|
@@ -3546,6 +3550,8 @@ var BaseDistributorClient = class {
|
|
|
3546
3550
|
...merkle_distributor_default
|
|
3547
3551
|
};
|
|
3548
3552
|
this.merkleDistributorProgram = new Program(merkleDistributorProgram, { connection: this.connection });
|
|
3553
|
+
this.apiUrl = apiUrl;
|
|
3554
|
+
this.apiKey = apiKey;
|
|
3549
3555
|
}
|
|
3550
3556
|
getConnection() {
|
|
3551
3557
|
return this.connection;
|
|
@@ -3737,7 +3743,9 @@ var BaseDistributorClient = class {
|
|
|
3737
3743
|
distributorAddress: distributorPublicKey.toBase58(),
|
|
3738
3744
|
mintAccount,
|
|
3739
3745
|
claimableAmount,
|
|
3740
|
-
cluster: this.cluster
|
|
3746
|
+
cluster: this.cluster,
|
|
3747
|
+
apiUrl: this.apiUrl,
|
|
3748
|
+
apiKey: this.apiKey
|
|
3741
3749
|
});
|
|
3742
3750
|
} catch (_) {
|
|
3743
3751
|
feeLamports = MINIMUM_FEE_FALLBACK;
|
|
@@ -5502,8 +5510,8 @@ var aligned_distributor_default = {
|
|
|
5502
5510
|
|
|
5503
5511
|
// solana/clients/SolanaAlignedDistributorClient.ts
|
|
5504
5512
|
var SolanaAlignedDistributorClient = class extends BaseDistributorClient {
|
|
5505
|
-
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler }) {
|
|
5506
|
-
super({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler });
|
|
5513
|
+
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler, apiUrl, apiKey }) {
|
|
5514
|
+
super({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler, apiUrl, apiKey });
|
|
5507
5515
|
const alignedAirdropsProgram = {
|
|
5508
5516
|
...aligned_distributor_default
|
|
5509
5517
|
};
|