update types

This commit is contained in:
Matt Hill
2023-03-27 12:46:06 -06:00
parent ce1ba50e82
commit 2709c6ba0b
7 changed files with 366 additions and 460 deletions

View File

@@ -21,7 +21,7 @@ import {
"masked": null, "masked": null,
"placeholder": null, "placeholder": null,
"pattern": "^[a-zA-Z0-9_-]+:([0-9a-fA-F]{2})+\\$([0-9a-fA-F]{2})+$", "pattern": "^[a-zA-Z0-9_-]+:([0-9a-fA-F]{2})+\\$([0-9a-fA-F]{2})+$",
"pattern-description": "patternDescription":
'Each item must be of the form "<USERNAME>:<SALT>$<HASH>".', 'Each item must be of the form "<USERNAME>:<SALT>$<HASH>".',
"textarea": false, "textarea": false,
}, },
@@ -65,8 +65,8 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
range: string; range: string;
spec: { spec: {
spec: Config<InputSpec>; spec: Config<InputSpec>;
"display-as": null | string; displayAs: null | string;
"unique-by": null | UniqueBy; uniqueBy: null | UniqueBy;
}; };
} }
>(a: A) { >(a: A) {
@@ -94,18 +94,13 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
Default<string[]> & { Default<string[]> & {
range: string; range: string;
spec: { spec: {
tag: { id: B;
id: B; name: string;
name: string; description: null | string;
description: null | string; warning: null | string;
warning: null | string; variants: Variants<{ [key: string]: { name: string, spec: InputSpec } }>;
"variant-names": { displayAs: null | string;
[key: string]: string; uniqueBy: UniqueBy;
};
};
variants: Variants<{ [key: string]: InputSpec }>;
"display-as": null | string;
"unique-by": UniqueBy;
default: string; default: string;
}; };
}, },

View File

@@ -33,7 +33,7 @@ export type StringSpec = {
masked: boolean | null; masked: boolean | null;
placeholder: string | null; placeholder: string | null;
pattern: null | string; pattern: null | string;
"pattern-description": null | string; patternDescription: null | string;
textarea: boolean | null; textarea: boolean | null;
}; };
export type NumberSpec = { export type NumberSpec = {
@@ -64,7 +64,7 @@ export type Nullable = {
masked: null, // If there is a masked, then the value is going to be masked in the FE, like a password masked: null, // If there is a masked, then the value is going to be masked in the FE, like a password
placeholder: null, // If there is a placeholder, then the value is going to be masked in the FE, like a password placeholder: null, // If there is a placeholder, then the value is going to be masked in the FE, like a password
pattern: null, // A regex pattern to validate the value pattern: null, // A regex pattern to validate the value
"pattern-description": null, patternDescription: null,
textarea: null textarea: null
}) })
``` ```
@@ -99,7 +99,7 @@ export class Value<A extends ValueSpec> extends IBuilder<A> {
A extends Description & A extends Description &
Default<string> & { Default<string> & {
values: readonly string[] | string[]; values: readonly string[] | string[];
"value-names": Record<string, string>; valueNames: Record<string, string>;
} }
>(a: A) { >(a: A) {
return new Value({ return new Value({
@@ -113,10 +113,10 @@ export class Value<A extends ValueSpec> extends IBuilder<A> {
description: string | null; description: string | null;
warning: string | null; warning: string | null;
default: null | { [k: string]: unknown }; default: null | { [k: string]: unknown };
"display-as": null | string; displayAs: null | string;
"unique-by": null | string; uniqueBy: null | string;
spec: Config<InputSpec>; spec: Config<InputSpec>;
"value-names": Record<string, string>; valueNames: Record<string, string>;
} }
>(a: A) { >(a: A) {
const { spec: previousSpec, ...rest } = a; const { spec: previousSpec, ...rest } = a;
@@ -135,13 +135,13 @@ export class Value<A extends ValueSpec> extends IBuilder<A> {
name: string; name: string;
description: string | null; description: string | null;
warning: string | null; warning: string | null;
"variant-names": { variantNames: {
[key: string]: string; [key: string]: string;
}; };
}; };
variants: Variants<{ [key: string]: InputSpec }>; variants: Variants<{ [key: string]: InputSpec }>;
"display-as": string | null; displayAs: string | null;
"unique-by": UniqueBy; uniqueBy: UniqueBy;
}, },
B extends string B extends string
>(a: A) { >(a: A) {

View File

@@ -26,15 +26,15 @@ import { Config } from ".";
"description": "description":
'- Disabled: Disable pruning\n- Automatic: Limit blockchain size on disk to a certain number of megabytes\n- Manual: Prune blockchain with the "pruneblockchain" RPC\n', '- Disabled: Disable pruning\n- Automatic: Limit blockchain size on disk to a certain number of megabytes\n- Manual: Prune blockchain with the "pruneblockchain" RPC\n',
"warning": null, "warning": null,
"variant-names": { "variantNames": {
"disabled": "Disabled", "disabled": "Disabled",
"automatic": "Automatic", "automatic": "Automatic",
"manual": "Manual", "manual": "Manual",
}, },
}, },
"display-as": null, "displayAs": null,
"unique-by": null, "uniqueBy": null,
"variant-names": null, "variantNames": null,
}); });
``` ```
*/ */

View File

@@ -60,7 +60,7 @@ export default async function makeFileContent(
masked: value.masked || null, masked: value.masked || null,
placeholder: value.placeholder || null, placeholder: value.placeholder || null,
pattern: value.pattern || null, pattern: value.pattern || null,
"pattern-description": value["pattern-description"] || null, patternDescription: value["pattern-description"] || null,
textarea: value.textarea || null, textarea: value.textarea || null,
}, },
null, null,
@@ -104,7 +104,7 @@ export default async function makeFileContent(
warning: value.warning || null, warning: value.warning || null,
default: value.default || null, default: value.default || null,
values: value.values || null, values: value.values || null,
"value-names": value["value-names"] || null, valueNames: value["value-names"] || null,
}, },
null, null,
2 2
@@ -120,10 +120,10 @@ export default async function makeFileContent(
description: ${JSON.stringify(value.description || null)}, description: ${JSON.stringify(value.description || null)},
warning: ${JSON.stringify(value.warning || null)}, warning: ${JSON.stringify(value.warning || null)},
default: ${JSON.stringify(value.default || null)}, default: ${JSON.stringify(value.default || null)},
"display-as": ${JSON.stringify(value["display-as"] || null)}, displayAs: ${JSON.stringify(value["display-as"] || null)},
"unique-by": ${JSON.stringify(value["unique-by"] || null)}, uniqueBy: ${JSON.stringify(value["unique-by"] || null)},
spec: ${specName}, spec: ${specName},
"value-names": ${JSON.stringify(value["value-names"] || {})}, valueNames: ${JSON.stringify(value["value-names"] || {})},
})`; })`;
} }
case "union": { case "union": {
@@ -138,15 +138,15 @@ export default async function makeFileContent(
default: ${JSON.stringify(value.default || null)}, default: ${JSON.stringify(value.default || null)},
variants: ${variants}, variants: ${variants},
tag: ${JSON.stringify({ tag: ${JSON.stringify({
id: value?.tag?.["id"] || null, id: value?.tag?.id || null,
name: value?.tag?.["name"] || null, name: value?.tag?.name || null,
description: value?.tag?.["description"] || null, description: value?.tag?.description || null,
warning: value?.tag?.["warning"] || null, warning: value?.tag?.warning || null,
"variant-names": value?.tag?.["variant-names"] || {}, variantNames: value?.tag?.["variant-names"] || {},
})}, })},
"display-as": ${JSON.stringify(value["display-as"] || null)}, displayAs: ${JSON.stringify(value["display-as"] || null)},
"unique-by": ${JSON.stringify(value["unique-by"] || null)}, uniqueBy: ${JSON.stringify(value["unique-by"] || null)},
"variant-names": ${JSON.stringify( variantNames: ${JSON.stringify(
(value["variant-names"] as any) || null (value["variant-names"] as any) || null
)}, )},
})`; })`;
@@ -170,12 +170,12 @@ export default async function makeFileContent(
name: value.name || null, name: value.name || null,
range: value.range || null, range: value.range || null,
spec: { spec: {
masked: value?.spec?.["masked"] || null, masked: value?.spec?.masked || null,
placeholder: value?.spec?.["placeholder"] || null, placeholder: value?.spec?.placeholder || null,
pattern: value?.spec?.["pattern"] || null, pattern: value?.spec?.pattern || null,
"pattern-description": patternDescription:
value?.spec?.["pattern-description"] || null, value?.spec?.["pattern-description"] || null,
textarea: value?.spec?.["textarea"] || false, textarea: value?.spec?.textarea || false,
}, },
default: value.default || null, default: value.default || null,
description: value.description || null, description: value.description || null,
@@ -210,7 +210,7 @@ export default async function makeFileContent(
name: value.name || null, name: value.name || null,
range: value.range || null, range: value.range || null,
values: value?.spec?.["values"] || null, values: value?.spec?.["values"] || null,
"value-names": value?.spec?.["value-names"] || {}, valueNames: value?.spec?.["value-names"] || {},
default: value.default || null, default: value.default || null,
description: value.description || null, description: value.description || null,
warning: value.warning || null, warning: value.warning || null,
@@ -229,10 +229,10 @@ export default async function makeFileContent(
range: ${JSON.stringify(value.range || null)}, range: ${JSON.stringify(value.range || null)},
spec: { spec: {
spec: ${specName}, spec: ${specName},
"display-as": ${JSON.stringify( displayAs: ${JSON.stringify(
value?.spec?.["display-as"] || null value?.spec?.["display-as"] || null
)}, )},
"unique-by": ${JSON.stringify(value?.spec?.["unique-by"] || null)}, uniqueBy: ${JSON.stringify(value?.spec?.["unique-by"] || null)},
}, },
default: ${JSON.stringify(value.default || null)}, default: ${JSON.stringify(value.default || null)},
description: ${JSON.stringify(value.description || null)}, description: ${JSON.stringify(value.description || null)},
@@ -252,26 +252,26 @@ export default async function makeFileContent(
tag: { tag: {
"id":${JSON.stringify(value?.spec?.tag?.["id"] || null)}, "id":${JSON.stringify(value?.spec?.tag?.["id"] || null)},
"name": ${JSON.stringify( "name": ${JSON.stringify(
value?.spec?.tag?.["name"] || null value?.spec?.tag?.name || null
)}, )},
"description": ${JSON.stringify( "description": ${JSON.stringify(
value?.spec?.tag?.["description"] || null value?.spec?.tag?.description || null
)}, )},
"warning": ${JSON.stringify( "warning": ${JSON.stringify(
value?.spec?.tag?.["warning"] || null value?.spec?.tag?.warning || null
)}, )},
"variant-names": ${JSON.stringify( variantNames: ${JSON.stringify(
value?.spec?.tag?.["variant-names"] || {} value?.spec?.tag?.["variant-names"] || {}
)}, )},
}, },
variants: ${variants}, variants: ${variants},
"display-as": ${JSON.stringify( displayAs: ${JSON.stringify(
value?.spec?.["display-as"] || null value?.spec?.["display-as"] || null
)}, )},
"unique-by": ${JSON.stringify( uniqueBy: ${JSON.stringify(
value?.spec?.["unique-by"] || null value?.spec?.["unique-by"] || null
)}, )},
default: ${JSON.stringify(value?.spec?.["default"] || null)}, default: ${JSON.stringify(value?.spec?.default || null)},
}, },
default: ${JSON.stringify(value.default || null)}, default: ${JSON.stringify(value.default || null)},
description: ${JSON.stringify(value.description || null)}, description: ${JSON.stringify(value.description || null)},

View File

@@ -63,10 +63,9 @@ export interface ValueSpecBoolean extends WithStandalone {
default: boolean; default: boolean;
} }
export interface ValueSpecUnion { export interface ValueSpecUnion extends WithStandalone {
type: "union"; type: "union";
tag: UnionTagSpec; variants: { [key: string]: { name: string, spec: InputSpec } };
variants: { [key: string]: InputSpec };
default: string; default: string;
} }
@@ -89,8 +88,7 @@ export interface WithStandalone {
} }
export interface SelectBase { export interface SelectBase {
values: string[] | readonly string[]; values: { [value: string]: string };
"value-names": { [value: string]: string };
} }
/** no lists of booleans, lists*/ /** no lists of booleans, lists*/
@@ -132,7 +130,7 @@ export function isValueSpecListOf<S extends ListValueSpecType>(t: ValueSpecList,
export interface ListValueSpecString { export interface ListValueSpecString {
pattern: null | string; pattern: null | string;
"pattern-description": null | string; patternDescription: null | string;
masked: boolean; masked: boolean;
placeholder: null | string; placeholder: null | string;
} }
@@ -149,9 +147,9 @@ export interface ListValueSpecObject {
/** this is a mapped type of the config object at this level, replacing the object's values with specs on those values */ /** this is a mapped type of the config object at this level, replacing the object's values with specs on those values */
spec: InputSpec; spec: InputSpec;
/** indicates whether duplicates can be permitted in the list */ /** indicates whether duplicates can be permitted in the list */
"unique-by": UniqueBy; uniqueBy: UniqueBy;
/** this should be a handlebars template which can make use of the entire config which corresponds to 'spec' */ /** this should be a handlebars template which can make use of the entire config which corresponds to 'spec' */
"display-as": null | string; displayAs: null | string;
} }
export type UniqueBy = export type UniqueBy =
@@ -162,25 +160,12 @@ export type UniqueBy =
| { all: readonly UniqueBy[] | UniqueBy[] }; | { all: readonly UniqueBy[] | UniqueBy[] };
export interface ListValueSpecUnion { export interface ListValueSpecUnion {
tag: UnionTagSpec; variants: { [key: string]: { name: string, spec: InputSpec } };
variants: { [key: string]: InputSpec };
/** this may be a handlebars template which can conditionally (on tag.id) make use of each union's entries, or if left blank will display as tag.id*/ /** this may be a handlebars template which can conditionally (on tag.id) make use of each union's entries, or if left blank will display as tag.id*/
"display-as": null | string; displayAs: null | string;
"unique-by": UniqueBy; uniqueBy: UniqueBy;
/** this should be the variantName which one prefers a user to start with by default when creating a new union instance in a list*/ /** this should be the variantName which one prefers a user to start with by default when creating a new union instance in a list*/
default: string; default: string;
} }
export interface UnionTagSpec {
/** The name of the field containing one of the union variants*/
id: string;
"variant-names": {
/** the name of each variant*/
[variant: string]: string;
};
name: string;
description: null | string;
warning: null | string;
}
export type DefaultString = string | { charset: string; len: number }; export type DefaultString = string | { charset: string; len: number };

View File

@@ -65,7 +65,7 @@ writeConvertedFile(
name: "Serialization Version", name: "Serialization Version",
description: description:
"Return raw transaction or block hex with Segwit or non-SegWit serialization.", "Return raw transaction or block hex with Segwit or non-SegWit serialization.",
type: "select", type: "enum",
values: ["non-segwit", "segwit"], values: ["non-segwit", "segwit"],
"value-names": {}, "value-names": {},
default: "segwit", default: "segwit",

View File

@@ -1,450 +1,376 @@
import { Config, Value, List, Variants } from "../../config/builder";
import {Config, Value, List, Variants} from '../../config/builder';
export const enable = Value.boolean({ export const enable = Value.boolean({
name: "Enable", "name": "Enable",
default: true, "default": true,
description: "Allow remote RPC requests.", "description": "Allow remote RPC requests.",
warning: null, "warning": null
}); });
export const username = Value.string({ export const username = Value.string({
name: "Username", "name": "Username",
default: "bitcoin", "default": "bitcoin",
description: "The username for connecting to Bitcoin over RPC.", "description": "The username for connecting to Bitcoin over RPC.",
warning: null, "warning": null,
nullable: false, "nullable": false,
masked: true, "masked": true,
placeholder: null, "placeholder": null,
pattern: "^[a-zA-Z0-9_]+$", "pattern": "^[a-zA-Z0-9_]+$",
"pattern-description": "Must be alphanumeric (can contain underscore).", "patternDescription": "Must be alphanumeric (can contain underscore).",
textarea: null, "textarea": null
}); });
export const password = Value.string({ export const password = Value.string({
name: "RPC Password", "name": "RPC Password",
default: { "default": {
charset: "a-z,2-7", "charset": "a-z,2-7",
len: 20, "len": 20
}, },
description: "The password for connecting to Bitcoin over RPC.", "description": "The password for connecting to Bitcoin over RPC.",
warning: null, "warning": null,
nullable: false, "nullable": false,
masked: true, "masked": true,
placeholder: null, "placeholder": null,
pattern: '^[^\\n"]*$', "pattern": "^[^\\n\"]*$",
"pattern-description": "Must not contain newline or quote characters.", "patternDescription": "Must not contain newline or quote characters.",
textarea: null, "textarea": null
}); });
export const authorizationList = List.string({ export const authorizationList = List.string({
name: "Authorization", "name": "Authorization",
range: "[0,*)", "range": "[0,*)",
spec: { "spec": {
masked: null, "masked": null,
placeholder: null, "placeholder": null,
pattern: "^[a-zA-Z0-9_-]+:([0-9a-fA-F]{2})+\\$([0-9a-fA-F]{2})+$", "pattern": "^[a-zA-Z0-9_-]+:([0-9a-fA-F]{2})+\\$([0-9a-fA-F]{2})+$",
"pattern-description": "patternDescription": "Each item must be of the form \"<USERNAME>:<SALT>$<HASH>\".",
'Each item must be of the form "<USERNAME>:<SALT>$<HASH>".', "textarea": false
textarea: false,
}, },
default: [], "default": [],
description: "description": "Username and hashed password for JSON-RPC connections. RPC clients connect using the usual http basic authentication.",
"Username and hashed password for JSON-RPC connections. RPC clients connect using the usual http basic authentication.", "warning": null
warning: null,
}); });
export const auth = Value.list(authorizationList); export const auth = Value.list(authorizationList);
export const serialversion = Value.select({ export const serialversion = Value.select({
name: "Serialization Version", "name": "Serialization Version",
description: "description": "Return raw transaction or block hex with Segwit or non-SegWit serialization.",
"Return raw transaction or block hex with Segwit or non-SegWit serialization.", "warning": null,
warning: null, "default": "segwit",
default: "segwit", "values": [
values: ["non-segwit", "segwit"], "non-segwit",
"value-names": {}, "segwit"
],
"valueNames": {}
}); });
export const servertimeout = Value.number({ export const servertimeout = Value.number({
name: "Rpc Server Timeout", "name": "Rpc Server Timeout",
default: 30, "default": 30,
description: "description": "Number of seconds after which an uncompleted RPC call will time out.",
"Number of seconds after which an uncompleted RPC call will time out.", "warning": null,
warning: null, "nullable": false,
nullable: false, "range": "[5,300]",
range: "[5,300]", "integral": true,
integral: true, "units": "seconds",
units: "seconds", "placeholder": null
placeholder: null,
}); });
export const threads = Value.number({ export const threads = Value.number({
name: "Threads", "name": "Threads",
default: 16, "default": 16,
description: "description": "Set the number of threads for handling RPC calls. You may wish to increase this if you are making lots of calls via an integration.",
"Set the number of threads for handling RPC calls. You may wish to increase this if you are making lots of calls via an integration.", "warning": null,
warning: null, "nullable": false,
nullable: false, "range": "[1,64]",
range: "[1,64]", "integral": true,
integral: true, "units": null,
units: null, "placeholder": null
placeholder: null,
}); });
export const workqueue = Value.number({ export const workqueue = Value.number({
name: "Work Queue", "name": "Work Queue",
default: 128, "default": 128,
description: "description": "Set the depth of the work queue to service RPC calls. Determines how long the backlog of RPC requests can get before it just rejects new ones.",
"Set the depth of the work queue to service RPC calls. Determines how long the backlog of RPC requests can get before it just rejects new ones.", "warning": null,
warning: null, "nullable": false,
nullable: false, "range": "[8,256]",
range: "[8,256]", "integral": true,
integral: true, "units": "requests",
units: "requests", "placeholder": null
placeholder: null,
});
export const advancedSpec = Config.of({
auth: auth,
serialversion: serialversion,
servertimeout: servertimeout,
threads: threads,
workqueue: workqueue,
}); });
export const advancedSpec = Config.of({"auth": auth,"serialversion": serialversion,"servertimeout": servertimeout,"threads": threads,"workqueue": workqueue,});;
export const advanced = Value.object({ export const advanced = Value.object({
name: "Advanced", name: "Advanced",
description: "Advanced RPC Settings", description: "Advanced RPC Settings",
warning: null, warning: null,
default: null, default: null,
"display-as": null, displayAs: null,
"unique-by": null, uniqueBy: null,
spec: advancedSpec, spec: advancedSpec,
"value-names": {}, valueNames: {},
}); });
export const rpcSettingsSpec = Config.of({ export const rpcSettingsSpec = Config.of({"enable": enable,"username": username,"password": password,"advanced": advanced,});;
enable: enable,
username: username,
password: password,
advanced: advanced,
});
export const rpc = Value.object({ export const rpc = Value.object({
name: "RPC Settings", name: "RPC Settings",
description: "RPC configuration options.", description: "RPC configuration options.",
warning: null, warning: null,
default: null, default: null,
"display-as": null, displayAs: null,
"unique-by": null, uniqueBy: null,
spec: rpcSettingsSpec, spec: rpcSettingsSpec,
"value-names": {}, valueNames: {},
}); });
export const zmqEnabled = Value.boolean({ export const zmqEnabled = Value.boolean({
name: "ZeroMQ Enabled", "name": "ZeroMQ Enabled",
default: true, "default": true,
description: "Enable the ZeroMQ interface", "description": "Enable the ZeroMQ interface",
warning: null, "warning": null
}); });
export const txindex = Value.boolean({ export const txindex = Value.boolean({
name: "Transaction Index", "name": "Transaction Index",
default: true, "default": true,
description: "Enable the Transaction Index (txindex)", "description": "Enable the Transaction Index (txindex)",
warning: null, "warning": null
}); });
export const enable1 = Value.boolean({ export const enable1 = Value.boolean({
name: "Enable Wallet", "name": "Enable Wallet",
default: true, "default": true,
description: "Load the wallet and enable wallet RPC calls.", "description": "Load the wallet and enable wallet RPC calls.",
warning: null, "warning": null
}); });
export const avoidpartialspends = Value.boolean({ export const avoidpartialspends = Value.boolean({
name: "Avoid Partial Spends", "name": "Avoid Partial Spends",
default: true, "default": true,
description: "description": "Group outputs by address, selecting all or none, instead of selecting on a per-output basis. This improves privacy at the expense of higher transaction fees.",
"Group outputs by address, selecting all or none, instead of selecting on a per-output basis. This improves privacy at the expense of higher transaction fees.", "warning": null
warning: null,
}); });
export const discardfee = Value.number({ export const discardfee = Value.number({
name: "Discard Change Tolerance", "name": "Discard Change Tolerance",
default: 0.0001, "default": 0.0001,
description: "description": "The fee rate (in BTC/kB) that indicates your tolerance for discarding change by adding it to the fee.",
"The fee rate (in BTC/kB) that indicates your tolerance for discarding change by adding it to the fee.", "warning": null,
warning: null, "nullable": false,
nullable: false, "range": "[0,.01]",
range: "[0,.01]", "integral": false,
integral: false, "units": "BTC/kB",
units: "BTC/kB", "placeholder": null
placeholder: null,
});
export const walletSpec = Config.of({
enable: enable1,
avoidpartialspends: avoidpartialspends,
discardfee: discardfee,
}); });
export const walletSpec = Config.of({"enable": enable1,"avoidpartialspends": avoidpartialspends,"discardfee": discardfee,});;
export const wallet = Value.object({ export const wallet = Value.object({
name: "Wallet", name: "Wallet",
description: "Wallet Settings", description: "Wallet Settings",
warning: null, warning: null,
default: null, default: null,
"display-as": null, displayAs: null,
"unique-by": null, uniqueBy: null,
spec: walletSpec, spec: walletSpec,
"value-names": {}, valueNames: {},
}); });
export const mempoolfullrbf = Value.boolean({ export const mempoolfullrbf = Value.boolean({
name: "Enable Full RBF", "name": "Enable Full RBF",
default: false, "default": false,
description: "description": "Policy for your node to use for relaying and mining unconfirmed transactions. For details, see https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-24.0.md#notice-of-new-option-for-transaction-replacement-policies",
"Policy for your node to use for relaying and mining unconfirmed transactions. For details, see https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-24.0.md#notice-of-new-option-for-transaction-replacement-policies", "warning": null
warning: null,
}); });
export const persistmempool = Value.boolean({ export const persistmempool = Value.boolean({
name: "Persist Mempool", "name": "Persist Mempool",
default: true, "default": true,
description: "Save the mempool on shutdown and load on restart.", "description": "Save the mempool on shutdown and load on restart.",
warning: null, "warning": null
}); });
export const maxmempool = Value.number({ export const maxmempool = Value.number({
name: "Max Mempool Size", "name": "Max Mempool Size",
default: 300, "default": 300,
description: "Keep the transaction memory pool below <n> megabytes.", "description": "Keep the transaction memory pool below <n> megabytes.",
warning: null, "warning": null,
nullable: false, "nullable": false,
range: "[1,*)", "range": "[1,*)",
integral: true, "integral": true,
units: "MiB", "units": "MiB",
placeholder: null, "placeholder": null
}); });
export const mempoolexpiry = Value.number({ export const mempoolexpiry = Value.number({
name: "Mempool Expiration", "name": "Mempool Expiration",
default: 336, "default": 336,
description: "Do not keep transactions in the mempool longer than <n> hours.", "description": "Do not keep transactions in the mempool longer than <n> hours.",
warning: null, "warning": null,
nullable: false, "nullable": false,
range: "[1,*)", "range": "[1,*)",
integral: true, "integral": true,
units: "Hr", "units": "Hr",
placeholder: null, "placeholder": null
});
export const mempoolSpec = Config.of({
mempoolfullrbf: mempoolfullrbf,
persistmempool: persistmempool,
maxmempool: maxmempool,
mempoolexpiry: mempoolexpiry,
}); });
export const mempoolSpec = Config.of({"mempoolfullrbf": mempoolfullrbf,"persistmempool": persistmempool,"maxmempool": maxmempool,"mempoolexpiry": mempoolexpiry,});;
export const mempool = Value.object({ export const mempool = Value.object({
name: "Mempool", name: "Mempool",
description: "Mempool Settings", description: "Mempool Settings",
warning: null, warning: null,
default: null, default: null,
"display-as": null, displayAs: null,
"unique-by": null, uniqueBy: null,
spec: mempoolSpec, spec: mempoolSpec,
"value-names": {}, valueNames: {},
}); });
export const listen = Value.boolean({ export const listen = Value.boolean({
name: "Make Public", "name": "Make Public",
default: true, "default": true,
description: "Allow other nodes to find your server on the network.", "description": "Allow other nodes to find your server on the network.",
warning: null, "warning": null
}); });
export const onlyconnect = Value.boolean({ export const onlyconnect = Value.boolean({
name: "Disable Peer Discovery", "name": "Disable Peer Discovery",
default: false, "default": false,
description: "Only connect to specified peers.", "description": "Only connect to specified peers.",
warning: null, "warning": null
}); });
export const onlyonion = Value.boolean({ export const onlyonion = Value.boolean({
name: "Disable Clearnet", "name": "Disable Clearnet",
default: false, "default": false,
description: "Only connect to peers over Tor.", "description": "Only connect to peers over Tor.",
warning: null, "warning": null
}); });
export const hostname = Value.string({ export const hostname = Value.string({
name: "Hostname", "name": "Hostname",
default: null, "default": null,
description: "Domain or IP address of bitcoin peer", "description": "Domain or IP address of bitcoin peer",
warning: null, "warning": null,
nullable: false, "nullable": false,
masked: null, "masked": null,
placeholder: null, "placeholder": null,
pattern: "pattern": "(^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$)|((^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$)|(^[a-z2-7]{16}\\.onion$)|(^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$))",
"(^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$)|((^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$)|(^[a-z2-7]{16}\\.onion$)|(^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$))", "patternDescription": "Must be either a domain name, or an IPv4 or IPv6 address. Do not include protocol scheme (eg 'http://') or port.",
"pattern-description": "textarea": null
"Must be either a domain name, or an IPv4 or IPv6 address. Do not include protocol scheme (eg 'http://') or port.",
textarea: null,
}); });
export const port = Value.number({ export const port = Value.number({
name: "Port", "name": "Port",
default: null, "default": null,
description: "Port that peer is listening on for inbound p2p connections", "description": "Port that peer is listening on for inbound p2p connections",
warning: null, "warning": null,
nullable: true, "nullable": true,
range: "[0,65535]", "range": "[0,65535]",
integral: true, "integral": true,
units: null, "units": null,
placeholder: null, "placeholder": null
}); });
export const addNodesSpec = Config.of({ hostname: hostname, port: port }); export const addNodesSpec = Config.of({"hostname": hostname,"port": port,});;
export const addNodesList = List.obj({ export const addNodesList = List.obj({
name: "Add Nodes", name: "Add Nodes",
range: "[0,*)", range: "[0,*)",
spec: { spec: {
spec: addNodesSpec, spec: addNodesSpec,
"display-as": null, displayAs: null,
"unique-by": null, uniqueBy: null,
}, },
default: [], default: [],
description: "Add addresses of nodes to connect to.", description: "Add addresses of nodes to connect to.",
warning: null, warning: null,
}); });
export const addnode = Value.list(addNodesList); export const addnode = Value.list(addNodesList);
export const peersSpec = Config.of({ export const peersSpec = Config.of({"listen": listen,"onlyconnect": onlyconnect,"onlyonion": onlyonion,"addnode": addnode,});;
listen: listen,
onlyconnect: onlyconnect,
onlyonion: onlyonion,
addnode: addnode,
});
export const peers = Value.object({ export const peers = Value.object({
name: "Peers", name: "Peers",
description: "Peer Connection Settings", description: "Peer Connection Settings",
warning: null, warning: null,
default: null, default: null,
"display-as": null, displayAs: null,
"unique-by": null, uniqueBy: null,
spec: peersSpec, spec: peersSpec,
"value-names": {}, valueNames: {},
}); });
export const dbcache = Value.number({ export const dbcache = Value.number({
name: "Database Cache", "name": "Database Cache",
default: null, "default": null,
description: "description": "How much RAM to allocate for caching the TXO set. Higher values improve syncing performance, but increase your chance of using up all your system's memory or corrupting your database in the event of an ungraceful shutdown. Set this high but comfortably below your system's total RAM during IBD, then turn down to 450 (or leave blank) once the sync completes.",
"How much RAM to allocate for caching the TXO set. Higher values improve syncing performance, but increase your chance of using up all your system's memory or corrupting your database in the event of an ungraceful shutdown. Set this high but comfortably below your system's total RAM during IBD, then turn down to 450 (or leave blank) once the sync completes.", "warning": "WARNING: Increasing this value results in a higher chance of ungraceful shutdowns, which can leave your node unusable if it happens during the initial block download. Use this setting with caution. Be sure to set this back to the default (450 or leave blank) once your node is synced. DO NOT press the STOP button if your dbcache is large. Instead, set this number back to the default, hit save, and wait for bitcoind to restart on its own.",
warning: "nullable": true,
"WARNING: Increasing this value results in a higher chance of ungraceful shutdowns, which can leave your node unusable if it happens during the initial block download. Use this setting with caution. Be sure to set this back to the default (450 or leave blank) once your node is synced. DO NOT press the STOP button if your dbcache is large. Instead, set this number back to the default, hit save, and wait for bitcoind to restart on its own.", "range": "(0,*)",
nullable: true, "integral": true,
range: "(0,*)", "units": "MiB",
integral: true, "placeholder": null
units: "MiB",
placeholder: null,
}); });
export const disabled = Config.of({}); export const disabled = Config.of({});;
export const size = Value.number({ export const size = Value.number({
name: "Max Chain Size", "name": "Max Chain Size",
default: 550, "default": 550,
description: "Limit of blockchain size on disk.", "description": "Limit of blockchain size on disk.",
warning: "Increasing this value will require re-syncing your node.", "warning": "Increasing this value will require re-syncing your node.",
nullable: false, "nullable": false,
range: "[550,1000000)", "range": "[550,1000000)",
integral: true, "integral": true,
units: "MiB", "units": "MiB",
placeholder: null, "placeholder": null
}); });
export const automatic = Config.of({ size: size }); export const automatic = Config.of({"size": size,});;
export const size1 = Value.number({ export const size1 = Value.number({
name: "Failsafe Chain Size", "name": "Failsafe Chain Size",
default: 65536, "default": 65536,
description: "Prune blockchain if size expands beyond this.", "description": "Prune blockchain if size expands beyond this.",
warning: null, "warning": null,
nullable: false, "nullable": false,
range: "[550,1000000)", "range": "[550,1000000)",
integral: true, "integral": true,
units: "MiB", "units": "MiB",
placeholder: null, "placeholder": null
});
export const manual = Config.of({ size: size1 });
export const pruningSettingsVariants = Variants.of({
disabled: disabled,
automatic: automatic,
manual: manual,
}); });
export const manual = Config.of({"size": size1,});;
export const pruningSettingsVariants = Variants.of({"disabled": disabled,"automatic": automatic,"manual": manual,});
export const pruning = Value.union({ export const pruning = Value.union({
name: "Pruning Settings", name: "Pruning Settings",
description: description: "Blockchain Pruning Options\nReduce the blockchain size on disk\n",
"Blockchain Pruning Options\nReduce the blockchain size on disk\n", warning: "If you set pruning to Manual and your disk is smaller than the total size of the blockchain, you MUST have something running that prunes these blocks or you may overfill your disk!\nDisabling pruning will convert your node into a full archival node. This requires a resync of the entire blockchain, a process that may take several days. Make sure you have enough free disk space or you may fill up your disk.\n",
warning: default: "disabled",
"If you set pruning to Manual and your disk is smaller than the total size of the blockchain, you MUST have something running that prunes these blocks or you may overfill your disk!\nDisabling pruning will convert your node into a full archival node. This requires a resync of the entire blockchain, a process that may take several days. Make sure you have enough free disk space or you may fill up your disk.\n", variants: pruningSettingsVariants,
default: "disabled", tag: {"id":"mode","name":"Pruning Mode","description":"- Disabled: Disable pruning\n- Automatic: Limit blockchain size on disk to a certain number of megabytes\n- Manual: Prune blockchain with the \"pruneblockchain\" RPC\n","warning":null,"variantNames":{"disabled":"Disabled","automatic":"Automatic","manual":"Manual"}},
variants: pruningSettingsVariants, displayAs: null,
tag: { uniqueBy: null,
id: "mode", variantNames: null,
name: "Pruning Mode", });
description:
'- Disabled: Disable pruning\n- Automatic: Limit blockchain size on disk to a certain number of megabytes\n- Manual: Prune blockchain with the "pruneblockchain" RPC\n',
warning: null,
"variant-names": {
disabled: "Disabled",
automatic: "Automatic",
manual: "Manual",
},
},
"display-as": null,
"unique-by": null,
"variant-names": null,
});
export const blockfilterindex = Value.boolean({ export const blockfilterindex = Value.boolean({
name: "Compute Compact Block Filters (BIP158)", "name": "Compute Compact Block Filters (BIP158)",
default: true, "default": true,
description: "description": "Generate Compact Block Filters during initial sync (IBD) to enable 'getblockfilter' RPC. This is useful if dependent services need block filters to efficiently scan for addresses/transactions etc.",
"Generate Compact Block Filters during initial sync (IBD) to enable 'getblockfilter' RPC. This is useful if dependent services need block filters to efficiently scan for addresses/transactions etc.", "warning": null
warning: null,
}); });
export const peerblockfilters = Value.boolean({ export const peerblockfilters = Value.boolean({
name: "Serve Compact Block Filters to Peers (BIP157)", "name": "Serve Compact Block Filters to Peers (BIP157)",
default: false, "default": false,
description: "description": "Serve Compact Block Filters as a peer service to other nodes on the network. This is useful if you wish to connect an SPV client to your node to make it efficient to scan transactions without having to download all block data. 'Compute Compact Block Filters (BIP158)' is required.",
"Serve Compact Block Filters as a peer service to other nodes on the network. This is useful if you wish to connect an SPV client to your node to make it efficient to scan transactions without having to download all block data. 'Compute Compact Block Filters (BIP158)' is required.", "warning": null
warning: null,
});
export const blockFiltersSpec = Config.of({
blockfilterindex: blockfilterindex,
peerblockfilters: peerblockfilters,
}); });
export const blockFiltersSpec = Config.of({"blockfilterindex": blockfilterindex,"peerblockfilters": peerblockfilters,});;
export const blockfilters = Value.object({ export const blockfilters = Value.object({
name: "Block Filters", name: "Block Filters",
description: "Settings for storing and serving compact block filters", description: "Settings for storing and serving compact block filters",
warning: null, warning: null,
default: null, default: null,
"display-as": null, displayAs: null,
"unique-by": null, uniqueBy: null,
spec: blockFiltersSpec, spec: blockFiltersSpec,
"value-names": {}, valueNames: {},
}); });
export const peerbloomfilters = Value.boolean({ export const peerbloomfilters = Value.boolean({
name: "Serve Bloom Filters to Peers", "name": "Serve Bloom Filters to Peers",
default: false, "default": false,
description: "description": "Peers have the option of setting filters on each connection they make after the version handshake has completed. Bloom filters are for clients implementing SPV (Simplified Payment Verification) that want to check that block headers connect together correctly, without needing to verify the full blockchain. The client must trust that the transactions in the chain are in fact valid. It is highly recommended AGAINST using for anything except Bisq integration.",
"Peers have the option of setting filters on each connection they make after the version handshake has completed. Bloom filters are for clients implementing SPV (Simplified Payment Verification) that want to check that block headers connect together correctly, without needing to verify the full blockchain. The client must trust that the transactions in the chain are in fact valid. It is highly recommended AGAINST using for anything except Bisq integration.", "warning": "This is ONLY for use with Bisq integration, please use Block Filters for all other applications."
warning:
"This is ONLY for use with Bisq integration, please use Block Filters for all other applications.",
});
export const bloomFiltersBip37Spec = Config.of({
peerbloomfilters: peerbloomfilters,
}); });
export const bloomFiltersBip37Spec = Config.of({"peerbloomfilters": peerbloomfilters,});;
export const bloomfilters = Value.object({ export const bloomfilters = Value.object({
name: "Bloom Filters (BIP37)", name: "Bloom Filters (BIP37)",
description: "Setting for serving Bloom Filters", description: "Setting for serving Bloom Filters",
warning: null, warning: null,
default: null, default: null,
"display-as": null, displayAs: null,
"unique-by": null, uniqueBy: null,
spec: bloomFiltersBip37Spec, spec: bloomFiltersBip37Spec,
"value-names": {}, valueNames: {},
}); });
export const advancedSpec1 = Config.of({ export const advancedSpec1 = Config.of({"mempool": mempool,"peers": peers,"dbcache": dbcache,"pruning": pruning,"blockfilters": blockfilters,"bloomfilters": bloomfilters,});;
mempool: mempool,
peers: peers,
dbcache: dbcache,
pruning: pruning,
blockfilters: blockfilters,
bloomfilters: bloomfilters,
});
export const advanced1 = Value.object({ export const advanced1 = Value.object({
name: "Advanced", name: "Advanced",
description: "Advanced Settings", description: "Advanced Settings",
warning: null, warning: null,
default: null, default: null,
"display-as": null, displayAs: null,
"unique-by": null, uniqueBy: null,
spec: advancedSpec1, spec: advancedSpec1,
"value-names": {}, valueNames: {},
}); });
export const InputSpec = Config.of({ export const inputSpec = Config.of({"rpc": rpc,"zmq-enabled": zmqEnabled,"txindex": txindex,"wallet": wallet,"advanced": advanced1,});;
rpc: rpc, export const matchInputSpec = inputSpec.validator();
"zmq-enabled": zmqEnabled,
txindex: txindex,
wallet: wallet,
advanced: advanced1,
});
export const matchInputSpec = InputSpec.validator();
export type InputSpec = typeof matchInputSpec._TYPE; export type InputSpec = typeof matchInputSpec._TYPE;