Skip to content

Commit 2a8bfac

Browse files
revert git add -A check and make apiUrl required
1 parent d299de5 commit 2a8bfac

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

packages/distributor/solana/clients/BaseDistributorClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export interface IInitOptions {
7777
programId?: string;
7878
sendRate?: number;
7979
sendThrottler?: PQueue;
80-
apiUrl?: string;
80+
apiUrl: string;
8181
apiKey?: string;
8282
}
8383

@@ -94,7 +94,7 @@ export default abstract class BaseDistributorClient {
9494

9595
protected cluster: ICluster;
9696

97-
protected apiUrl?: string;
97+
protected apiUrl: string;
9898

9999
protected apiKey?: string;
100100

packages/distributor/solana/clients/SolanaAlignedDistributorClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import { getAlignedDistributorPda, getTestOraclePda } from "../utils.js";
2121
export default class SolanaAlignedDistributorClient extends BaseDistributorClient {
2222
public alignedProxyProgram: Program<AlignedAirdropsProgramType>;
2323

24-
public constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler }: IInitOptions) {
25-
super({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler });
24+
public constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler, apiUrl, apiKey }: IInitOptions) {
25+
super({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler, apiUrl, apiKey });
2626
const alignedAirdropsProgram = {
2727
...StreamflowAlignedAirdropsIDL,
2828
} as AlignedAirdropsProgramType;

packages/distributor/solana/fees.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ export async function resolveAirdropFeeLamportsUsingApi(params: {
167167
mintAccount: Mint;
168168
claimableAmount: bigint;
169169
cluster: ICluster;
170-
apiUrl?: string;
170+
apiUrl: string;
171171
apiKey?: string;
172172
}): Promise<bigint> {
173173
const { distributorAddress, mintAccount, claimableAmount, cluster, apiUrl, apiKey } = params;
174174
let apiFeesResponse = undefined;
175175

176176
try {
177-
apiFeesResponse = await fetchAirdropFee(distributorAddress, cluster, apiUrl, apiKey);
177+
apiFeesResponse = await fetchAirdropFee(distributorAddress, apiUrl, apiKey);
178178
} catch (_) {
179179
// ignore and fallback
180180
}
@@ -192,7 +192,7 @@ export async function resolveAirdropFeeLamportsUsingApi(params: {
192192

193193
const response = apiFeesResponse ?? defaultAPIFeesResponse;
194194

195-
if (response?.isCustom && !!response.claimFee) {
195+
if (response?.isCustom && response.claimFee !== undefined && response.claimFee !== null) {
196196
return toLamportsSOL(response.claimFee);
197197
}
198198

packages/distributor/solana/fetchAirdropFee.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { ICluster } from "@streamflow/common";
2-
31
export type AirdropFeeResponse = {
42
claimFee: string | number;
53
claimFeeDynamic?: {
@@ -19,13 +17,11 @@ export interface AirdropFeeQueryOptionsOverrides {
1917

2018
export const fetchAirdropFee = async (
2119
distributorId: string,
22-
cluster: ICluster,
23-
apiUrl?: string,
20+
apiUrl: string,
2421
apiKey?: string,
2522
fetchFn: typeof fetch = fetch,
2623
): Promise<AirdropFeeResponse> => {
27-
const baseUrl = apiUrl ?? cluster === ICluster.Mainnet ? "https://api.streamflow.finance" : "https://staging-api.streamflow.finance";
28-
const url = `${baseUrl}/v2/api/airdrops/${encodeURIComponent(distributorId)}/fees`;
24+
const url = `${apiUrl}/v2/api/airdrops/${encodeURIComponent(distributorId)}/fees`;
2925

3026
const res = await fetchFn(url, {
3127
method: "GET",

0 commit comments

Comments
 (0)