Skip to content

Commit 646fb9e

Browse files
committed
refactor: enhance type safety and consistency in program configuration handling
1 parent 1f405c6 commit 646fb9e

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

governance/xc_admin/packages/xc_admin_common/src/programs/core/core_functions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
PriceRawConfig,
3535
RawConfig,
3636
ValidationResult,
37-
GetConfigParams,
3837
ProgramType,
3938
} from "../types";
4039
import { Program } from "@coral-xyz/anchor";

governance/xc_admin/packages/xc_admin_common/src/programs/lazer/lazer_functions.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ export type LazerFeed = {
6868
*/
6969
export function isAvailableOnCluster(cluster: PythCluster): boolean {
7070
return (
71-
cluster === "pythnet" ??
72-
cluster === "mainnet-beta" ??
73-
cluster === "devnet" ??
71+
cluster === "pythnet" ||
72+
cluster === "mainnet-beta" ||
73+
cluster === "devnet" ||
7474
cluster === "testnet"
7575
);
7676
}
@@ -105,8 +105,8 @@ export function getConfig(
105105
cluster: options?.cluster as PythCluster | undefined,
106106
feeds: [],
107107
metadata: {
108-
source: endpoint || "unknown",
109-
network: network || "unknown",
108+
source: endpoint ?? "unknown",
109+
network: network ?? "unknown",
110110
},
111111
};
112112
}
@@ -129,10 +129,10 @@ export function getDownloadableConfig(config: LazerConfig): DownloadableConfig {
129129
symbol: feed.id,
130130
// Convert feed metadata to match expected Product metadata format
131131
// This is a placeholder and will need to be adjusted based on actual metadata
132-
asset_type: feed.metadata.asset_type?.toString() || "",
133-
country: feed.metadata.country?.toString() || "",
134-
quote_currency: feed.metadata.quote_currency?.toString() || "",
135-
tenor: feed.metadata.tenor?.toString() || "",
132+
asset_type: feed.metadata.asset_type?.toString() ?? "",
133+
country: feed.metadata.country?.toString() ?? "",
134+
quote_currency: feed.metadata.quote_currency?.toString() ?? "",
135+
tenor: feed.metadata.tenor?.toString() ?? "",
136136
// Add other required fields
137137
},
138138
priceAccounts: [

governance/xc_admin/packages/xc_admin_common/src/programs/program_registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const validateUploadedConfig: Record<
8080
ProgramType,
8181
(
8282
existingConfig: DownloadableConfig,
83-
uploadedConfig: unknown,
83+
uploadedConfig: DownloadableConfig,
8484
cluster: PythCluster,
8585
) => ValidationResult
8686
> = {

0 commit comments

Comments
 (0)