Use 3-arg compat.setConfig form in setConfig

The 1-arg form tried to call effects.createDir which doesn't
exist in the 0.3.5.1 effects API, crashing config save with
'TypeError: effects.createDir is not a function'. The 3-arg
form (effects, newConfig, deps) just wires up dependencies
based on the chosen bitcoind variant without touching the
filesystem.
This commit is contained in:
satoshi
2026-04-14 10:28:37 +03:00
parent 8c9bfb33af
commit 31abbbd4a1
+23 -12
View File
@@ -1,14 +1,25 @@
import { compat, types as T } from "../deps.ts"; import { compat, types as T } from "../deps.ts";
export const setConfig: T.ExpectedExports.setConfig = compat.setConfig({ interface KamadoConfig extends T.Config {
"bitcoind": { bitcoind?: {
"bitcoind": [{ type?: string;
"name": "bitcoind", };
"version": ">=24.0.0 <30.0.0", }
}],
"bitcoind-testnet": [{ // deno-lint-ignore require-await
"name": "bitcoind-testnet", export const setConfig: T.ExpectedExports.setConfig = async (
"version": ">=24.0.0 <30.0.0", effects: T.Effects,
}], newConfig: KamadoConfig,
}, ) => {
}); const mainnetDep: { [key: string]: string[] } =
newConfig?.bitcoind?.type === "bitcoind" ? { bitcoind: [] } : {};
const testnetDep: { [key: string]: string[] } =
newConfig?.bitcoind?.type === "bitcoind-testnet"
? { "bitcoind-testnet": [] }
: {};
return compat.setConfig(effects, newConfig, {
...mainnetDep,
...testnetDep,
});
};