import { matches, types as T } from "../deps.ts"; const { shape, boolean, arrayOf, string, dictionary, any } = matches; const bitcoindMatcher = shape({ "rpc": shape({ "enable": boolean, "username": string, "password": string, }, ["enable", "username", "password"]), "advanced": shape({ "peers": shape({ "listen": boolean, }, ["listen"]), }, ["peers"]), }, ["rpc", "advanced"]); const checkBitcoind: T.ExpectedExports.dependencyConfig["check"] = async ( effects, input, ) => { const res = bitcoindMatcher.test(input); if (!res) return { error: "Bitcoin Core RPC settings are missing." }; if (!input.rpc.enable) { return { error: "Bitcoin Core RPC must be enabled." }; } return { result: null }; }; const autoBitcoind: T.ExpectedExports.dependencyConfig["autoConfigure"] = async (effects, input) => { input.rpc.enable = true; return { result: input }; }; export const dependencies: T.ExpectedExports.dependencies = { "bitcoind": { check: checkBitcoind, autoConfigure: autoBitcoind, }, "bitcoind-testnet": { check: checkBitcoind, autoConfigure: autoBitcoind, }, };