UNPKG

11 kBPlain TextView Raw
1/**
2 * This file was automatically generated by json-schema-to-typescript.
3 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4 * and run json-schema-to-typescript to regenerate this file.
5 */
6
7/**
8 * Connector configuration schema.
9 */
10export class Config {
11 /**
12 * Determines what type of network the connector is a part of. Can be: 'production', 'test'. Default: 'test'
13 */
14 env?: "production" | "test";
15 /**
16 * ILP address of the connector. This property can be omitted if an account with `relation=parent` is configured under `accounts`.
17 */
18 ilpAddress?: string;
19 /**
20 * If there are multiple parents, and `ilpAddress` is not set explicit, specify the account ID of the parent that we should load our address from. Defaults to the first parent in the `accounts` map.
21 */
22 ilpAddressInheritFrom?: string;
23 /**
24 * Description of connector account plugins.
25 */
26 accounts!: {
27 /**
28 * Description of individual account.
29 */
30 [k: string]: {
31 /**
32 * Relationship between the connector and the counterparty that the account is with.
33 */
34 relation: "parent" | "peer" | "child";
35 /**
36 * Name or instance of the ILP plugin that should be used for this account. A plugin instance can only be passed when instantiating the connector from JavaScript.
37 */
38 plugin:
39 | string
40 | {
41 [k: string]: any;
42 };
43 /**
44 * Currency code or other asset identifier that will be passed to the backend to select the correct rate for this account.
45 */
46 assetCode: string;
47 /**
48 * Interledger amounts are integers, but most currencies are typically represented as fractional units, e.g. cents. This property defines how many Interledger units make up one regular units. For dollars, this would usually be set to 9, so that Interledger amounts are expressed in nanodollars.
49 */
50 assetScale: number;
51 /**
52 * Defines whether the connector should maintain and enforce a balance for this account. The balance is always from the connector's perspective. Therefore, a negative balance implies the connector owes money to the counterparty and a positive balance implies the counterparty owes money to the connector. This setting is enforced by the built-in `balance` middleware.
53 */
54 balance?: {
55 /**
56 * Minimum balance (in this account's indivisible base units) the connector must maintain. The connector will reject outgoing packets if they would put it below this balance. The format is a string containing an integer (which may be prefixed with `-` to indicate a negative value), `"-Infinity"` or `"Infinity"`.
57 */
58 minimum?: string;
59 /**
60 * Maximum balance (in this account's indivisible base units) the connector will allow. The connector will reject incoming packets if they would put it above this balance. The format is a string containing an integer (which may be prefixed with `-` to indicate a negative value), `"-Infinity"` or `"Infinity"`.
61 */
62 maximum: string;
63 /**
64 * Balance (in this account's indivisible base units) numerically below which the connector will automatically initiate a settlement. The format is a string containing an integer (which may be prefixed with `-` to indicate a negative value) or `"-Infinity"`.
65 */
66 settleThreshold?: string;
67 /**
68 * Balance (in this account's indivisible base units) the connector will attempt to reach when settling. The format is an integer (which may be prefixed with `-` to indicate a negative value) as a string.
69 */
70 settleTo?: string;
71 };
72 /**
73 * Maximum amount per packet for incoming prepare packets. Connector will reject any incoming prepare packets from this account with a higher amount. Amount should be provided as an integer in a string (in atomic units). This setting is enforced by the built-in `maxPacketAmount` middleware.
74 */
75 maxPacketAmount?: string;
76 /**
77 * Configuration to limit the total amount sent via Interledger per unit of time. This setting is enforced by the built-in `throughput` middleware.
78 */
79 throughput?: {
80 /**
81 * Length of time (in milliseconds) during which the token balance increases by `incomingAmount`/`outgoingAmount` tokens. Defaults to one second.
82 */
83 refillPeriod?: number;
84 /**
85 * Maximum incoming throughput amount (in atomic units; per second) for incoming packets. If this setting is not set, the incoming throughput limit is disabled.
86 */
87 incomingAmount?: string;
88 /**
89 * Maximum throughput amount (in atomic units; per second) for outgoing packets. If this setting is not set, the outgoing throughput limit is disabled.
90 */
91 outgoingAmount?: string;
92 };
93 /**
94 * Maximum rate of incoming packets. Limit is implemented as a token bucket with a constant refill rate. When the token bucket is empty, all requests are immediately rejected. This setting is enforced by the built-in `rateLimit` middleware.
95 */
96 rateLimit?: {
97 /**
98 * Length of time (in milliseconds) during which the token balance increases by `refillCount` tokens. Defaults to one second.
99 */
100 refillPeriod?: number;
101 /**
102 * How many tokens are refilled per period. The default refill period is one second, so this would be the average number of requests per second.
103 */
104 refillCount?: number;
105 /**
106 * Maximum number of tokens in the bucket.
107 */
108 capacity?: number;
109 };
110 /**
111 * Prevents sending duplicate packets.
112 */
113 deduplicate?: {
114 /**
115 * Frequency at which the connector removes old deduplicate records. (in milliseconds, default: 30000)
116 */
117 cleanupInterval?: number;
118 /**
119 * Lifetime of a cache record. (in milliseconds, default: 30000)
120 */
121 packetLifetime?: number;
122 };
123 /**
124 * Whether we should broadcast routes to this peer. Defaults to `false` for `relation=child` and `true` otherwise.
125 */
126 sendRoutes?: boolean;
127 /**
128 * Whether we should receive and process route broadcasts from this peer. Defaults to `false` for `relation=child` and `true` otherwise.
129 */
130 receiveRoutes?: boolean;
131 /**
132 * Options that will be passed to the plugin constructor.
133 */
134 options?: {
135 [k: string]: any;
136 };
137 /**
138 * What segment will be appended to the connector's ILP address to form this account's ILP address. Only applicable to accounts with `relation=child`. Defaults to the id of the account, i.e. the key used in the `accounts` config object.
139 */
140 ilpAddressSegment?: string;
141 };
142 };
143 /**
144 * Which account should be used as the default route for all other traffic. Can be set to empty string to disable the default route or 'auto' to automatically use the first parent in the `accounts` map. Default: 'auto'
145 */
146 defaultRoute?: string;
147 /**
148 * Additional routes to add to the connector's routing table.
149 */
150 routes?: {
151 /**
152 * ILP address prefix that this route applies to. Configured routes take precedence over the same or shorter prefixes that are local or published by peers. More specific prefixes will still take precedence. Prefixes should NOT include a trailing period.
153 */
154 targetPrefix: string;
155 /**
156 * ID of the account that destinations matching `targetPrefix` should be forwarded to. Must be one of the accounts in `accounts`.
157 */
158 peerId: string;
159 }[];
160 /**
161 * How much of a spread to add on top of the reference exchange rate. Determines the connector's margin.
162 */
163 spread?: number;
164 /**
165 * Minimum time the connector wants to budget for getting a message to the accounts its trading on. In milliseconds.
166 */
167 minMessageWindow?: number;
168 /**
169 * Maximum duration (in milliseconds) the connector is willing to place funds on hold while waiting for the outcome of a transaction.
170 */
171 maxHoldTime?: number;
172 /**
173 * Whether to broadcast known routes.
174 */
175 routeBroadcastEnabled?: boolean;
176 /**
177 * Frequency at which the connector broadcasts its routes to adjacent connectors. (in milliseconds)
178 */
179 routeBroadcastInterval?: number;
180 /**
181 * The frequency at which the connector checks for expired routes. (in milliseconds)
182 */
183 routeCleanupInterval?: number;
184 /**
185 * The maximum age of a route provided by this connector. (in milliseconds)
186 */
187 routeExpiry?: number;
188 /**
189 * Seed used for generating routing table auth values.
190 */
191 routingSecret?: string;
192 /**
193 * Name of the backend (can be built-in or a require-able module name). Built-in modules are: ecb, ecb-plus-xrp, ecb-plus-coinmarketcap, one-to-one
194 */
195 backend?: string;
196 /**
197 * Additional configuration for the backend.
198 */
199 backendConfig?: {
200 [k: string]: any;
201 };
202 /**
203 * Name of the store (can be built-in or a require-able module name). Built-in modules are: memory
204 */
205 store?: string;
206 /**
207 * Shorthand for `config.storeConfig.path`.
208 */
209 storePath?: string;
210 /**
211 * Additional options to be passed to the `store`'s constructor.
212 */
213 storeConfig?: {
214 [k: string]: any;
215 };
216 /**
217 * Additional middleware that should be added to the middleware stack.
218 */
219 middlewares?: {
220 /**
221 * Object describing middleware instance.
222 */
223 [k: string]: {
224 /**
225 * NPM module that should be `require`d to load the middleware constructor.
226 */
227 type: string;
228 /**
229 * Options that will be passed to the middleware constructor.
230 */
231 options?: {
232 [k: string]: any;
233 };
234 [k: string]: any;
235 };
236 };
237 /**
238 * List of built-in middlewares that should be disabled. Can be used to replace built-in middleware with your own custom version.
239 */
240 disableMiddleware?: (
241 | "errorHandler"
242 | "rateLimit"
243 | "balance"
244 | "maxPacketAmount"
245 | "throughput"
246 | "deduplicate"
247 | "validateFulfillment"
248 | "expire"
249 | "stats"
250 | "alert")[];
251 /**
252 * Whether to allow routing payments back to the account that sent them.
253 */
254 reflectPayments?: boolean;
255 /**
256 * How long the connector should wait for account plugins to connect before launching other subsystems. (in milliseconds)
257 */
258 initialConnectTimeout?: number;
259 /**
260 * Whether the admin API is enabled or not. Default: false (disabled)
261 */
262 adminApi?: boolean;
263 /**
264 * Which port the admin API should listen on. Default: 7780
265 */
266 adminApiPort?: number;
267 /**
268 * Host to bind to. Warning: The admin API interface should never be made public! Default: '127.0.0.1'
269 */
270 adminApiHost?: string;
271 /**
272 * Whether the Prometheus exporter should include system metrics or not. Default: false (no)
273 */
274 collectDefaultMetrics?: boolean;
275}