mempool-startos/scripts/procedures/setConfig.ts
Sirius 5f7d71a974
Add Fulcrum to Mempool (#46)
* Bump version to 3.2.1.3 and add Fulcrum indexer

Updated version to 3.2.1.3 and added Fulcrum as an optional indexer.

* Add indexer configuration

* Update address lookup instructions for Electrs and Fulcrum

* Refactor getConfig.ts for add fulcrum

* Update to v3.2.1.3 with fulcrum

* Update setConfig to support indexer selection

Enhanced CustomConfig to include indexer properties and updated dependency handling for both indexer and lightning types.

* Update manifest.yaml

sounds good to me

Co-authored-by: Dominion5254 <musashidisciple@proton.me>

* Update manifest.yaml

* Add 3.2.1.3 migrations

* Rollback to old migration.ts and add 3.2.1.3 as current

Removed unused indexer matching logic and related comments.

* fucrum migration

---------

Co-authored-by: Dominion5254 <musashidisciple@proton.me>
2025-12-09 08:16:55 -07:00

44 lines
1.5 KiB
TypeScript

import { compat, types as T } from "../deps.ts";
// Define a custom type for T.Config to include the 'lightning' and 'indexer' properties
interface CustomConfig extends T.Config {
lightning?: {
type?: string; // Lightning node type (lnd, cln, etc.)
};
indexer?: {
type?: string; // Indexer type (electrs, fulcrum)
};
}
// deno-lint-ignore require-await
export const setConfig: T.ExpectedExports.setConfig = async (
effects: T.Effects,
newConfig: CustomConfig
) => {
// Set dependencies based on indexer type (Electrs or Fulcrum)
const dependsOnElectrs: { [key: string]: string[] } = newConfig?.indexer?.type === "electrs"
? { electrs: ["synced"] }
: {};
const dependsOnFulcrum: { [key: string]: string[] } = newConfig?.indexer?.type === "fulcrum"
? { fulcrum: ["synced"] }
: {};
// Set dependencies based on lightning type (LND or CLN)
const depsLnd: { [key: string]: string[] } = newConfig?.lightning?.type === "lnd"
? { lnd: [] }
: {};
const depsCln: { [key: string]: string[] } = newConfig?.lightning?.type === "cln"
? { "c-lightning": [] }
: {};
// Return the final configuration with all dependencies
return compat.setConfig(effects, newConfig, {
...dependsOnElectrs, // Electrs dependencies (if applicable)
...dependsOnFulcrum, // Fulcrum dependencies (if applicable)
...depsLnd, // LND dependencies (if applicable)
...depsCln, // CLN dependencies (if applicable)
});
};