@lodestar/api 1.20.0-dev.82a9384b27 → 1.20.0-dev.85dc0ba06d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/beacon/client/beacon.d.ts +4 -3
- package/lib/beacon/client/beacon.js +3 -36
- package/lib/beacon/client/beacon.js.map +1 -1
- package/lib/beacon/client/config.d.ts +4 -3
- package/lib/beacon/client/config.js +3 -6
- package/lib/beacon/client/config.js.map +1 -1
- package/lib/beacon/client/debug.d.ts +4 -3
- package/lib/beacon/client/debug.js +4 -45
- package/lib/beacon/client/debug.js.map +1 -1
- package/lib/beacon/client/events.d.ts +5 -2
- package/lib/beacon/client/events.js +32 -35
- package/lib/beacon/client/events.js.map +1 -1
- package/lib/beacon/client/index.d.ts +6 -3
- package/lib/beacon/client/index.js +2 -2
- package/lib/beacon/client/index.js.map +1 -1
- package/lib/beacon/client/lightclient.d.ts +4 -3
- package/lib/beacon/client/lightclient.js +4 -7
- package/lib/beacon/client/lightclient.js.map +1 -1
- package/lib/beacon/client/lodestar.d.ts +4 -3
- package/lib/beacon/client/lodestar.js +4 -7
- package/lib/beacon/client/lodestar.js.map +1 -1
- package/lib/beacon/client/node.d.ts +4 -3
- package/lib/beacon/client/node.js +4 -7
- package/lib/beacon/client/node.js.map +1 -1
- package/lib/beacon/client/proof.d.ts +5 -4
- package/lib/beacon/client/proof.js +5 -61
- package/lib/beacon/client/proof.js.map +1 -1
- package/lib/beacon/client/validator.d.ts +4 -3
- package/lib/beacon/client/validator.js +4 -7
- package/lib/beacon/client/validator.js.map +1 -1
- package/lib/beacon/index.d.ts +5 -5
- package/lib/beacon/index.js.map +1 -1
- package/lib/beacon/routes/beacon/block.d.ts +282 -164
- package/lib/beacon/routes/beacon/block.js +324 -116
- package/lib/beacon/routes/beacon/block.js.map +1 -1
- package/lib/beacon/routes/beacon/index.d.ts +6 -588
- package/lib/beacon/routes/beacon/index.js +16 -26
- package/lib/beacon/routes/beacon/index.js.map +1 -1
- package/lib/beacon/routes/beacon/pool.d.ts +155 -117
- package/lib/beacon/routes/beacon/pool.js +146 -42
- package/lib/beacon/routes/beacon/pool.js.map +1 -1
- package/lib/beacon/routes/beacon/rewards.d.ts +113 -101
- package/lib/beacon/routes/beacon/rewards.js +98 -63
- package/lib/beacon/routes/beacon/rewards.js.map +1 -1
- package/lib/beacon/routes/beacon/state.d.ts +172 -226
- package/lib/beacon/routes/beacon/state.js +204 -126
- package/lib/beacon/routes/beacon/state.js.map +1 -1
- package/lib/beacon/routes/config.d.ts +21 -36
- package/lib/beacon/routes/config.js +45 -24
- package/lib/beacon/routes/config.js.map +1 -1
- package/lib/beacon/routes/debug.d.ts +32 -95
- package/lib/beacon/routes/debug.js +87 -45
- package/lib/beacon/routes/debug.js.map +1 -1
- package/lib/beacon/routes/events.d.ts +20 -16
- package/lib/beacon/routes/events.js +39 -17
- package/lib/beacon/routes/events.js.map +1 -1
- package/lib/beacon/routes/index.d.ts +19 -19
- package/lib/beacon/routes/index.js +1 -0
- package/lib/beacon/routes/index.js.map +1 -1
- package/lib/beacon/routes/lightclient.d.ts +33 -55
- package/lib/beacon/routes/lightclient.js +107 -47
- package/lib/beacon/routes/lightclient.js.map +1 -1
- package/lib/beacon/routes/lodestar.d.ts +74 -148
- package/lib/beacon/routes/lodestar.js +126 -77
- package/lib/beacon/routes/lodestar.js.map +1 -1
- package/lib/beacon/routes/node.d.ts +48 -82
- package/lib/beacon/routes/node.js +90 -57
- package/lib/beacon/routes/node.js.map +1 -1
- package/lib/beacon/routes/proof.d.ts +25 -31
- package/lib/beacon/routes/proof.js +44 -24
- package/lib/beacon/routes/proof.js.map +1 -1
- package/lib/beacon/routes/validator.d.ts +547 -320
- package/lib/beacon/routes/validator.js +494 -213
- package/lib/beacon/routes/validator.js.map +1 -1
- package/lib/beacon/server/beacon.d.ts +3 -4
- package/lib/beacon/server/beacon.js +4 -57
- package/lib/beacon/server/beacon.js.map +1 -1
- package/lib/beacon/server/config.d.ts +3 -4
- package/lib/beacon/server/config.js +4 -5
- package/lib/beacon/server/config.js.map +1 -1
- package/lib/beacon/server/debug.d.ts +3 -4
- package/lib/beacon/server/debug.js +4 -54
- package/lib/beacon/server/debug.js.map +1 -1
- package/lib/beacon/server/events.d.ts +4 -4
- package/lib/beacon/server/events.js +17 -23
- package/lib/beacon/server/events.js.map +1 -1
- package/lib/beacon/server/index.d.ts +7 -8
- package/lib/beacon/server/index.js +13 -14
- package/lib/beacon/server/index.js.map +1 -1
- package/lib/beacon/server/lightclient.d.ts +3 -4
- package/lib/beacon/server/lightclient.js +4 -5
- package/lib/beacon/server/lightclient.js.map +1 -1
- package/lib/beacon/server/lodestar.d.ts +3 -4
- package/lib/beacon/server/lodestar.js +4 -5
- package/lib/beacon/server/lodestar.js.map +1 -1
- package/lib/beacon/server/node.d.ts +3 -4
- package/lib/beacon/server/node.js +4 -18
- package/lib/beacon/server/node.js.map +1 -1
- package/lib/beacon/server/proof.d.ts +3 -4
- package/lib/beacon/server/proof.js +4 -36
- package/lib/beacon/server/proof.js.map +1 -1
- package/lib/beacon/server/validator.d.ts +3 -4
- package/lib/beacon/server/validator.js +4 -21
- package/lib/beacon/server/validator.js.map +1 -1
- package/lib/builder/client.d.ts +4 -6
- package/lib/builder/client.js +3 -9
- package/lib/builder/client.js.map +1 -1
- package/lib/builder/index.d.ts +8 -5
- package/lib/builder/index.js +4 -1
- package/lib/builder/index.js.map +1 -1
- package/lib/builder/routes.d.ts +24 -38
- package/lib/builder/routes.js +77 -33
- package/lib/builder/routes.js.map +1 -1
- package/lib/builder/server/index.d.ts +6 -6
- package/lib/builder/server/index.js +7 -8
- package/lib/builder/server/index.js.map +1 -1
- package/lib/index.d.ts +9 -6
- package/lib/index.js +5 -4
- package/lib/index.js.map +1 -1
- package/lib/keymanager/client.d.ts +4 -3
- package/lib/keymanager/client.js +4 -7
- package/lib/keymanager/client.js.map +1 -1
- package/lib/keymanager/index.d.ts +5 -4
- package/lib/keymanager/index.js +1 -1
- package/lib/keymanager/index.js.map +1 -1
- package/lib/keymanager/routes.d.ts +155 -177
- package/lib/keymanager/routes.js +236 -123
- package/lib/keymanager/routes.js.map +1 -1
- package/lib/keymanager/server/index.d.ts +6 -6
- package/lib/keymanager/server/index.js +7 -8
- package/lib/keymanager/server/index.js.map +1 -1
- package/lib/server/index.d.ts +2 -0
- package/lib/server/index.js +3 -0
- package/lib/server/index.js.map +1 -0
- package/lib/utils/client/error.d.ts +6 -0
- package/lib/utils/client/error.js +8 -0
- package/lib/utils/client/error.js.map +1 -0
- package/lib/utils/client/httpClient.d.ts +35 -75
- package/lib/utils/client/httpClient.js +201 -153
- package/lib/utils/client/httpClient.js.map +1 -1
- package/lib/utils/client/index.d.ts +6 -2
- package/lib/utils/client/index.js +6 -2
- package/lib/utils/client/index.js.map +1 -1
- package/lib/utils/client/method.d.ts +11 -0
- package/lib/utils/client/method.js +27 -0
- package/lib/utils/client/method.js.map +1 -0
- package/lib/utils/client/request.d.ts +33 -0
- package/lib/utils/client/request.js +66 -0
- package/lib/utils/client/request.js.map +1 -0
- package/lib/utils/client/response.d.ts +35 -0
- package/lib/utils/client/response.js +166 -0
- package/lib/utils/client/response.js.map +1 -0
- package/lib/utils/codecs.d.ts +28 -0
- package/lib/utils/codecs.js +105 -0
- package/lib/utils/codecs.js.map +1 -0
- package/lib/utils/fork.d.ts +8 -0
- package/lib/utils/fork.js +35 -0
- package/lib/utils/fork.js.map +1 -0
- package/lib/utils/headers.d.ts +37 -0
- package/lib/utils/headers.js +134 -0
- package/lib/utils/headers.js.map +1 -0
- package/lib/utils/httpStatusCode.js.map +1 -0
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/metadata.d.ts +88 -0
- package/lib/utils/metadata.js +126 -0
- package/lib/utils/metadata.js.map +1 -0
- package/lib/utils/schema.d.ts +31 -17
- package/lib/utils/schema.js +18 -6
- package/lib/utils/schema.js.map +1 -1
- package/lib/utils/serdes.d.ts +3 -0
- package/lib/utils/serdes.js +13 -0
- package/lib/utils/serdes.js.map +1 -1
- package/lib/utils/server/{errors.d.ts → error.d.ts} +2 -2
- package/lib/utils/server/{errors.js → error.js} +1 -1
- package/lib/utils/server/error.js.map +1 -0
- package/lib/utils/server/handler.d.ts +11 -0
- package/lib/utils/server/handler.js +117 -0
- package/lib/utils/server/handler.js.map +1 -0
- package/lib/utils/server/index.d.ts +5 -4
- package/lib/utils/server/index.js +5 -4
- package/lib/utils/server/index.js.map +1 -1
- package/lib/utils/server/method.d.ts +35 -0
- package/lib/utils/server/method.js +2 -0
- package/lib/utils/server/method.js.map +1 -0
- package/lib/utils/server/parser.d.ts +3 -0
- package/lib/utils/server/parser.js +20 -0
- package/lib/utils/server/parser.js.map +1 -0
- package/lib/utils/server/route.d.ts +20 -0
- package/lib/utils/server/route.js +19 -0
- package/lib/utils/server/route.js.map +1 -0
- package/lib/utils/types.d.ts +116 -104
- package/lib/utils/types.js +2 -155
- package/lib/utils/types.js.map +1 -1
- package/lib/utils/urlFormat.d.ts +2 -2
- package/lib/utils/urlFormat.js +3 -3
- package/lib/utils/urlFormat.js.map +1 -1
- package/lib/utils/wireFormat.d.ts +8 -0
- package/lib/utils/wireFormat.js +23 -0
- package/lib/utils/wireFormat.js.map +1 -0
- package/package.json +9 -6
- package/lib/interfaces.d.ts +0 -44
- package/lib/interfaces.js +0 -2
- package/lib/interfaces.js.map +0 -1
- package/lib/utils/acceptHeader.d.ts +0 -9
- package/lib/utils/acceptHeader.js +0 -62
- package/lib/utils/acceptHeader.js.map +0 -1
- package/lib/utils/client/client.d.ts +0 -29
- package/lib/utils/client/client.js +0 -88
- package/lib/utils/client/client.js.map +0 -1
- package/lib/utils/client/httpStatusCode.js.map +0 -1
- package/lib/utils/routes.d.ts +0 -6
- package/lib/utils/routes.js +0 -31
- package/lib/utils/routes.js.map +0 -1
- package/lib/utils/server/errors.js.map +0 -1
- package/lib/utils/server/genericJsonServer.d.ts +0 -13
- package/lib/utils/server/genericJsonServer.js +0 -32
- package/lib/utils/server/genericJsonServer.js.map +0 -1
- package/lib/utils/server/registerRoute.d.ts +0 -3
- package/lib/utils/server/registerRoute.js +0 -13
- package/lib/utils/server/registerRoute.js.map +0 -1
- package/lib/utils/server/types.d.ts +0 -22
- package/lib/utils/server/types.js +0 -2
- package/lib/utils/server/types.js.map +0 -1
- /package/lib/utils/{client/httpStatusCode.d.ts → httpStatusCode.d.ts} +0 -0
- /package/lib/utils/{client/httpStatusCode.js → httpStatusCode.js} +0 -0
|
@@ -1,38 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export function getRoutes(config,
|
|
4
|
-
|
|
5
|
-
const serverRoutes = getGenericJsonServer({ routesData, getReturnTypes, getReqSerializers }, config, api);
|
|
6
|
-
return {
|
|
7
|
-
// Non-JSON routes. Return binary
|
|
8
|
-
getStateProof: {
|
|
9
|
-
...serverRoutes.getStateProof,
|
|
10
|
-
handler: async (req) => {
|
|
11
|
-
const args = reqSerializers.getStateProof.parseReq(req);
|
|
12
|
-
const { data } = await api.getStateProof(...args);
|
|
13
|
-
const leaves = data.leaves;
|
|
14
|
-
const response = new Uint8Array(32 * leaves.length);
|
|
15
|
-
for (let i = 0; i < leaves.length; i++) {
|
|
16
|
-
response.set(leaves[i], i * 32);
|
|
17
|
-
}
|
|
18
|
-
// Fastify 4.x.x will automatically add header `Content-Type: application/octet-stream` if TypedArray
|
|
19
|
-
return response;
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
getBlockProof: {
|
|
23
|
-
...serverRoutes.getBlockProof,
|
|
24
|
-
handler: async (req) => {
|
|
25
|
-
const args = reqSerializers.getBlockProof.parseReq(req);
|
|
26
|
-
const { data } = await api.getBlockProof(...args);
|
|
27
|
-
const leaves = data.leaves;
|
|
28
|
-
const response = new Uint8Array(32 * leaves.length);
|
|
29
|
-
for (let i = 0; i < leaves.length; i++) {
|
|
30
|
-
response.set(leaves[i], i * 32);
|
|
31
|
-
}
|
|
32
|
-
// Fastify 4.x.x will automatically add header `Content-Type: application/octet-stream` if TypedArray
|
|
33
|
-
return response;
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
};
|
|
1
|
+
import { createFastifyRoutes } from "../../utils/server/index.js";
|
|
2
|
+
import { getDefinitions } from "../routes/proof.js";
|
|
3
|
+
export function getRoutes(config, methods) {
|
|
4
|
+
return createFastifyRoutes(getDefinitions(config), methods);
|
|
37
5
|
}
|
|
38
6
|
//# sourceMappingURL=proof.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proof.js","sourceRoot":"","sources":["../../../src/beacon/server/proof.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proof.js","sourceRoot":"","sources":["../../../src/beacon/server/proof.ts"],"names":[],"mappings":"AACA,OAAO,EAAoC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AACnG,OAAO,EAAY,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAE7D,MAAM,UAAU,SAAS,CAAC,MAAuB,EAAE,OAAsC;IACvF,OAAO,mBAAmB,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ChainForkConfig } from "@lodestar/config";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare function getRoutes(config: ChainForkConfig, api: ServerApi<Api>): ServerRoutes<Api, ReqTypes>;
|
|
2
|
+
import { ApplicationMethods, FastifyRoutes } from "../../utils/server/index.js";
|
|
3
|
+
import { Endpoints } from "../routes/validator.js";
|
|
4
|
+
export declare function getRoutes(config: ChainForkConfig, methods: ApplicationMethods<Endpoints>): FastifyRoutes<Endpoints>;
|
|
6
5
|
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export function getRoutes(config,
|
|
4
|
-
|
|
5
|
-
const returnTypes = getReturnTypes();
|
|
6
|
-
// Most of routes return JSON, use a server auto-generator
|
|
7
|
-
const serverRoutes = getGenericJsonServer({ routesData, getReturnTypes, getReqSerializers }, config, api);
|
|
8
|
-
return {
|
|
9
|
-
...serverRoutes,
|
|
10
|
-
produceBlockV3: {
|
|
11
|
-
...serverRoutes.produceBlockV3,
|
|
12
|
-
handler: async (req, res) => {
|
|
13
|
-
const response = await api.produceBlockV3(...reqSerializers.produceBlockV3.parseReq(req));
|
|
14
|
-
void res.header("Eth-Consensus-Version", response.version);
|
|
15
|
-
void res.header("Eth-Execution-Payload-Blinded", response.executionPayloadBlinded);
|
|
16
|
-
void res.header("Eth-Execution-Payload-Value", response.executionPayloadValue);
|
|
17
|
-
void res.header("Eth-Consensus-Block-Value", response.consensusBlockValue);
|
|
18
|
-
return returnTypes.produceBlockV3.toJson(response);
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
1
|
+
import { createFastifyRoutes } from "../../utils/server/index.js";
|
|
2
|
+
import { getDefinitions } from "../routes/validator.js";
|
|
3
|
+
export function getRoutes(config, methods) {
|
|
4
|
+
return createFastifyRoutes(getDefinitions(config), methods);
|
|
22
5
|
}
|
|
23
6
|
//# sourceMappingURL=validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../src/beacon/server/validator.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../src/beacon/server/validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAoC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AACnG,OAAO,EAAY,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAEjE,MAAM,UAAU,SAAS,CAAC,MAAuB,EAAE,OAAsC;IACvF,OAAO,mBAAmB,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC"}
|
package/lib/builder/client.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ChainForkConfig } from "@lodestar/config";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
export declare function getClient(config: ChainForkConfig, httpClient: IHttpClient): ApiWithExtraOpts<Api>;
|
|
2
|
+
import { ApiClientMethods, IHttpClient } from "../utils/client/index.js";
|
|
3
|
+
import { Endpoints } from "./routes.js";
|
|
4
|
+
export type ApiClient = ApiClientMethods<Endpoints>;
|
|
5
|
+
export declare function getClient(config: ChainForkConfig, httpClient: IHttpClient): ApiClient;
|
|
8
6
|
//# sourceMappingURL=client.d.ts.map
|
package/lib/builder/client.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
4
|
-
* REST HTTP client for builder routes
|
|
5
|
-
*/
|
|
1
|
+
import { createApiClientMethods } from "../utils/client/index.js";
|
|
2
|
+
import { getDefinitions } from "./routes.js";
|
|
6
3
|
export function getClient(config, httpClient) {
|
|
7
|
-
|
|
8
|
-
const returnTypes = getReturnTypes();
|
|
9
|
-
// All routes return JSON, use a client auto-generator
|
|
10
|
-
return generateGenericJsonClient(routesData, reqSerializers, returnTypes, httpClient);
|
|
4
|
+
return createApiClientMethods(getDefinitions(config), httpClient);
|
|
11
5
|
}
|
|
12
6
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/builder/client.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/builder/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAY,cAAc,EAAC,MAAM,aAAa,CAAC;AAItD,MAAM,UAAU,SAAS,CAAC,MAAuB,EAAE,UAAuB;IACxE,OAAO,sBAAsB,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC;AACpE,CAAC"}
|
package/lib/builder/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { ChainForkConfig } from "@lodestar/config";
|
|
2
|
-
import { HttpClientModules, HttpClientOptions, IHttpClient
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { HttpClientModules, HttpClientOptions, IHttpClient } from "../utils/client/httpClient.js";
|
|
3
|
+
import { Endpoints } from "./routes.js";
|
|
4
|
+
import type { ApiClient } from "./client.js";
|
|
5
|
+
export type { ApiClient, Endpoints };
|
|
5
6
|
type ClientModules = HttpClientModules & {
|
|
6
7
|
config: ChainForkConfig;
|
|
7
8
|
httpClient?: IHttpClient;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* REST HTTP client for builder routes
|
|
12
|
+
*/
|
|
13
|
+
export declare function getClient(opts: HttpClientOptions, modules: ClientModules): ApiClient;
|
|
11
14
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/builder/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { HttpClient
|
|
1
|
+
import { HttpClient } from "../utils/client/httpClient.js";
|
|
2
2
|
import * as builder from "./client.js";
|
|
3
|
+
/**
|
|
4
|
+
* REST HTTP client for builder routes
|
|
5
|
+
*/
|
|
3
6
|
export function getClient(opts, modules) {
|
|
4
7
|
const { config } = modules;
|
|
5
8
|
const httpClient = modules.httpClient ?? new HttpClient(opts, modules);
|
package/lib/builder/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/builder/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/builder/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAoD,MAAM,+BAA+B,CAAC;AAI5G,OAAO,KAAK,OAAO,MAAM,aAAa,CAAC;AAavC;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAuB,EAAE,OAAsB;IACvE,MAAM,EAAC,MAAM,EAAC,GAAG,OAAO,CAAC;IACzB,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEvE,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAC/C,CAAC"}
|
package/lib/builder/routes.d.ts
CHANGED
|
@@ -1,49 +1,35 @@
|
|
|
1
1
|
import { allForks, bellatrix, Slot, Root, BLSPubkey } from "@lodestar/types";
|
|
2
|
-
import { ForkName } from "@lodestar/params";
|
|
3
2
|
import { ChainForkConfig } from "@lodestar/config";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
export type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, HttpStatusCode.BAD_REQUEST>>;
|
|
14
|
-
getHeader(slot: Slot, parentHash: Root, proposerPubKey: BLSPubkey): Promise<ApiClientResponse<{
|
|
15
|
-
[HttpStatusCode.OK]: {
|
|
16
|
-
data: allForks.SignedBuilderBid;
|
|
17
|
-
version: ForkName;
|
|
18
|
-
};
|
|
19
|
-
}, HttpStatusCode.NOT_FOUND | HttpStatusCode.BAD_REQUEST>>;
|
|
20
|
-
submitBlindedBlock(signedBlock: allForks.SignedBlindedBeaconBlock): Promise<ApiClientResponse<{
|
|
21
|
-
[HttpStatusCode.OK]: {
|
|
22
|
-
data: allForks.ExecutionPayload | allForks.ExecutionPayloadAndBlobsBundle;
|
|
23
|
-
version: ForkName;
|
|
24
|
-
};
|
|
25
|
-
}, HttpStatusCode.SERVICE_UNAVAILABLE>>;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Define javascript values for each route
|
|
29
|
-
*/
|
|
30
|
-
export declare const routesData: RoutesData<Api>;
|
|
31
|
-
export type ReqTypes = {
|
|
32
|
-
status: ReqEmpty;
|
|
33
|
-
registerValidator: {
|
|
3
|
+
import { Endpoint, RouteDefinitions } from "../utils/index.js";
|
|
4
|
+
import { MetaHeader, VersionMeta } from "../utils/metadata.js";
|
|
5
|
+
import { EmptyArgs, EmptyMeta, EmptyRequest, EmptyResponseData } from "../utils/codecs.js";
|
|
6
|
+
export type MaybeSignedBuilderBid = allForks.SignedBuilderBid | undefined;
|
|
7
|
+
export type Endpoints = {
|
|
8
|
+
status: Endpoint<"GET", EmptyArgs, EmptyRequest, EmptyResponseData, EmptyMeta>;
|
|
9
|
+
registerValidator: Endpoint<"POST", {
|
|
10
|
+
registrations: bellatrix.SignedValidatorRegistrationV1[];
|
|
11
|
+
}, {
|
|
34
12
|
body: unknown;
|
|
35
|
-
}
|
|
36
|
-
getHeader: {
|
|
13
|
+
}, EmptyResponseData, EmptyMeta>;
|
|
14
|
+
getHeader: Endpoint<"GET", {
|
|
15
|
+
slot: Slot;
|
|
16
|
+
parentHash: Root;
|
|
17
|
+
proposerPubkey: BLSPubkey;
|
|
18
|
+
}, {
|
|
37
19
|
params: {
|
|
38
20
|
slot: Slot;
|
|
39
21
|
parent_hash: string;
|
|
40
22
|
pubkey: string;
|
|
41
23
|
};
|
|
42
|
-
}
|
|
43
|
-
submitBlindedBlock: {
|
|
24
|
+
}, MaybeSignedBuilderBid, VersionMeta>;
|
|
25
|
+
submitBlindedBlock: Endpoint<"POST", {
|
|
26
|
+
signedBlindedBlock: allForks.SignedBlindedBeaconBlock;
|
|
27
|
+
}, {
|
|
44
28
|
body: unknown;
|
|
45
|
-
|
|
29
|
+
headers: {
|
|
30
|
+
[MetaHeader.Version]: string;
|
|
31
|
+
};
|
|
32
|
+
}, allForks.ExecutionPayload | allForks.ExecutionPayloadAndBlobsBundle, VersionMeta>;
|
|
46
33
|
};
|
|
47
|
-
export declare function
|
|
48
|
-
export declare function getReturnTypes(): ReturnTypes<Api>;
|
|
34
|
+
export declare function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoints>;
|
|
49
35
|
//# sourceMappingURL=routes.d.ts.map
|
package/lib/builder/routes.js
CHANGED
|
@@ -1,43 +1,87 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
1
2
|
import { fromHexString, toHexString } from "@chainsafe/ssz";
|
|
2
3
|
import { ssz } from "@lodestar/types";
|
|
3
|
-
import {
|
|
4
|
-
import { Schema
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
registerValidator: { url: "/eth/v1/builder/validators", method: "POST" },
|
|
14
|
-
getHeader: { url: "/eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}", method: "GET" },
|
|
15
|
-
submitBlindedBlock: { url: "/eth/v1/builder/blinded_blocks", method: "POST" },
|
|
16
|
-
};
|
|
17
|
-
export function getReqSerializers(config) {
|
|
4
|
+
import { isForkBlobs } from "@lodestar/params";
|
|
5
|
+
import { Schema } from "../utils/index.js";
|
|
6
|
+
import { MetaHeader, VersionCodec } from "../utils/metadata.js";
|
|
7
|
+
import { ArrayOf, EmptyRequestCodec, EmptyResponseCodec, JsonOnlyReq, WithVersion, } from "../utils/codecs.js";
|
|
8
|
+
import { getBlindedForkTypes, getExecutionForkTypes, toForkName } from "../utils/fork.js";
|
|
9
|
+
import { fromHeaders } from "../utils/headers.js";
|
|
10
|
+
const RegistrationsType = ArrayOf(ssz.bellatrix.SignedValidatorRegistrationV1);
|
|
11
|
+
// NOTE: Builder API does not support SSZ as per spec, need to keep routes as JSON-only for now
|
|
12
|
+
// See https://github.com/ethereum/builder-specs/issues/53 for more details
|
|
13
|
+
export function getDefinitions(config) {
|
|
18
14
|
return {
|
|
19
|
-
status:
|
|
20
|
-
|
|
15
|
+
status: {
|
|
16
|
+
url: "/eth/v1/builder/status",
|
|
17
|
+
method: "GET",
|
|
18
|
+
req: EmptyRequestCodec,
|
|
19
|
+
resp: EmptyResponseCodec,
|
|
20
|
+
},
|
|
21
|
+
registerValidator: {
|
|
22
|
+
url: "/eth/v1/builder/validators",
|
|
23
|
+
method: "POST",
|
|
24
|
+
req: JsonOnlyReq({
|
|
25
|
+
writeReqJson: ({ registrations }) => ({ body: RegistrationsType.toJson(registrations) }),
|
|
26
|
+
parseReqJson: ({ body }) => ({ registrations: RegistrationsType.fromJson(body) }),
|
|
27
|
+
schema: { body: Schema.ObjectArray },
|
|
28
|
+
}),
|
|
29
|
+
resp: EmptyResponseCodec,
|
|
30
|
+
},
|
|
21
31
|
getHeader: {
|
|
22
|
-
|
|
23
|
-
|
|
32
|
+
url: "/eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}",
|
|
33
|
+
method: "GET",
|
|
34
|
+
req: {
|
|
35
|
+
writeReq: ({ slot, parentHash, proposerPubkey: proposerPubKey }) => ({
|
|
36
|
+
params: { slot, parent_hash: toHexString(parentHash), pubkey: toHexString(proposerPubKey) },
|
|
37
|
+
}),
|
|
38
|
+
parseReq: ({ params }) => ({
|
|
39
|
+
slot: params.slot,
|
|
40
|
+
parentHash: fromHexString(params.parent_hash),
|
|
41
|
+
proposerPubkey: fromHexString(params.pubkey),
|
|
42
|
+
}),
|
|
43
|
+
schema: {
|
|
44
|
+
params: { slot: Schema.UintRequired, parent_hash: Schema.StringRequired, pubkey: Schema.StringRequired },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
resp: {
|
|
48
|
+
data: WithVersion((fork) => getExecutionForkTypes(fork).SignedBuilderBid),
|
|
49
|
+
meta: VersionCodec,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
submitBlindedBlock: {
|
|
53
|
+
url: "/eth/v1/builder/blinded_blocks",
|
|
54
|
+
method: "POST",
|
|
55
|
+
req: JsonOnlyReq({
|
|
56
|
+
writeReqJson: ({ signedBlindedBlock }) => {
|
|
57
|
+
const fork = config.getForkName(signedBlindedBlock.message.slot);
|
|
58
|
+
return {
|
|
59
|
+
body: getBlindedForkTypes(fork).SignedBeaconBlock.toJson(signedBlindedBlock),
|
|
60
|
+
headers: {
|
|
61
|
+
[MetaHeader.Version]: fork,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
parseReqJson: ({ body, headers }) => {
|
|
66
|
+
const fork = toForkName(fromHeaders(headers, MetaHeader.Version));
|
|
67
|
+
return {
|
|
68
|
+
signedBlindedBlock: getBlindedForkTypes(fork).SignedBeaconBlock.fromJson(body),
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
schema: {
|
|
72
|
+
body: Schema.Object,
|
|
73
|
+
headers: { [MetaHeader.Version]: Schema.String },
|
|
74
|
+
},
|
|
24
75
|
}),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
76
|
+
resp: {
|
|
77
|
+
data: WithVersion((fork) => {
|
|
78
|
+
return isForkBlobs(fork)
|
|
79
|
+
? ssz.allForksBlobs[fork].ExecutionPayloadAndBlobsBundle
|
|
80
|
+
: getExecutionForkTypes(fork).ExecutionPayload;
|
|
81
|
+
}),
|
|
82
|
+
meta: VersionCodec,
|
|
28
83
|
},
|
|
29
84
|
},
|
|
30
|
-
submitBlindedBlock: getBeaconReqSerializers(config)["publishBlindedBlock"],
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export function getReturnTypes() {
|
|
34
|
-
return {
|
|
35
|
-
getHeader: WithVersion((fork) => isForkExecution(fork) ? ssz.allForksExecution[fork].SignedBuilderBid : ssz.bellatrix.SignedBuilderBid),
|
|
36
|
-
submitBlindedBlock: WithVersion((fork) => isForkBlobs(fork)
|
|
37
|
-
? ssz.allForksBlobs[fork].ExecutionPayloadAndBlobsBundle
|
|
38
|
-
: isForkExecution(fork)
|
|
39
|
-
? ssz.allForksExecution[fork].ExecutionPayload
|
|
40
|
-
: ssz.bellatrix.ExecutionPayload),
|
|
41
85
|
};
|
|
42
86
|
}
|
|
43
87
|
//# sourceMappingURL=routes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/builder/routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAC,GAAG,EAA6C,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAW,
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/builder/routes.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
1
2
|
import { ChainForkConfig } from "@lodestar/config";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function registerRoutes(server: ServerInstance, config: ChainForkConfig, api: ServerApi<Api>): void;
|
|
3
|
+
import { ApplicationMethods, FastifyRoutes } from "../../utils/server/index.js";
|
|
4
|
+
import { Endpoints } from "../routes.js";
|
|
5
|
+
export type BuilderApiMethods = ApplicationMethods<Endpoints>;
|
|
6
|
+
export declare function getRoutes(config: ChainForkConfig, methods: BuilderApiMethods): FastifyRoutes<Endpoints>;
|
|
7
|
+
export declare function registerRoutes(server: FastifyInstance, config: ChainForkConfig, methods: BuilderApiMethods): void;
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export function getRoutes(config,
|
|
4
|
-
|
|
5
|
-
return getGenericJsonServer({ routesData, getReturnTypes, getReqSerializers }, config, api);
|
|
1
|
+
import { createFastifyRoutes } from "../../utils/server/index.js";
|
|
2
|
+
import { getDefinitions } from "../routes.js";
|
|
3
|
+
export function getRoutes(config, methods) {
|
|
4
|
+
return createFastifyRoutes(getDefinitions(config), methods);
|
|
6
5
|
}
|
|
7
|
-
export function registerRoutes(server, config,
|
|
8
|
-
const routes = getRoutes(config,
|
|
6
|
+
export function registerRoutes(server, config, methods) {
|
|
7
|
+
const routes = getRoutes(config, methods);
|
|
9
8
|
for (const route of Object.values(routes)) {
|
|
10
|
-
|
|
9
|
+
server.route(route);
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/builder/server/index.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/builder/server/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkD,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AACjH,OAAO,EAAY,cAAc,EAAC,MAAM,cAAc,CAAC;AAKvD,MAAM,UAAU,SAAS,CAAC,MAAuB,EAAE,OAA0B;IAC3E,OAAO,mBAAmB,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAuB,EAAE,MAAuB,EAAE,OAA0B;IACzG,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE1C,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1C,MAAM,CAAC,KAAK,CAAC,KAAkC,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export * from "./beacon/index.js";
|
|
2
|
-
export
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
7
|
-
export
|
|
2
|
+
export { HttpStatusCode } from "./utils/httpStatusCode.js";
|
|
3
|
+
export { WireFormat } from "./utils/wireFormat.js";
|
|
4
|
+
export { HttpHeader, MediaType } from "./utils/headers.js";
|
|
5
|
+
export type { HttpErrorCodes, HttpSuccessCodes } from "./utils/httpStatusCode.js";
|
|
6
|
+
export { ApiResponse, HttpClient, FetchError, isFetchError, fetch, defaultInit } from "./utils/client/index.js";
|
|
7
|
+
export type { ApiRequestInit } from "./utils/client/request.js";
|
|
8
|
+
export type { Endpoint } from "./utils/types.js";
|
|
9
|
+
export type { ApiClientMethods, IHttpClient, HttpClientOptions, HttpClientModules, Metrics, } from "./utils/client/index.js";
|
|
10
|
+
export { ApiError } from "./utils/client/error.js";
|
|
8
11
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// Re-exporting beacon only for backwards compatibility
|
|
2
2
|
export * from "./beacon/index.js";
|
|
3
|
-
export
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
3
|
+
export { HttpStatusCode } from "./utils/httpStatusCode.js";
|
|
4
|
+
export { WireFormat } from "./utils/wireFormat.js";
|
|
5
|
+
export { HttpHeader, MediaType } from "./utils/headers.js";
|
|
6
|
+
export { ApiResponse, HttpClient, FetchError, isFetchError, fetch, defaultInit } from "./utils/client/index.js";
|
|
7
|
+
export { ApiError } from "./utils/client/error.js";
|
|
7
8
|
// NOTE: Don't export server here so it's not bundled to all consumers
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,cAAc,mBAAmB,CAAC;AAClC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAC,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAU9G,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAEjD,sEAAsE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChainForkConfig } from "@lodestar/config";
|
|
2
|
-
import { IHttpClient } from "../utils/client/index.js";
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
2
|
+
import { ApiClientMethods, IHttpClient } from "../utils/client/index.js";
|
|
3
|
+
import { Endpoints } from "./routes.js";
|
|
4
|
+
export type ApiClient = ApiClientMethods<Endpoints>;
|
|
5
|
+
export declare function getClient(config: ChainForkConfig, httpClient: IHttpClient): ApiClient;
|
|
5
6
|
//# sourceMappingURL=client.d.ts.map
|
package/lib/keymanager/client.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export function getClient(
|
|
4
|
-
|
|
5
|
-
const returnTypes = getReturnTypes();
|
|
6
|
-
// All routes return JSON, use a client auto-generator
|
|
7
|
-
return generateGenericJsonClient(routesData, reqSerializers, returnTypes, httpClient);
|
|
1
|
+
import { createApiClientMethods } from "../utils/client/index.js";
|
|
2
|
+
import { getDefinitions } from "./routes.js";
|
|
3
|
+
export function getClient(config, httpClient) {
|
|
4
|
+
return createApiClientMethods(getDefinitions(config), httpClient);
|
|
8
5
|
}
|
|
9
6
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/keymanager/client.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/keymanager/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAY,cAAc,EAAC,MAAM,aAAa,CAAC;AAItD,MAAM,UAAU,SAAS,CAAC,MAAuB,EAAE,UAAuB;IACxE,OAAO,sBAAsB,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { ChainForkConfig } from "@lodestar/config";
|
|
2
2
|
import { IHttpClient, HttpClientModules, HttpClientOptions } from "../utils/client/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import type { ApiClient } from "./client.js";
|
|
4
4
|
export { ImportStatus, DeletionStatus, ImportRemoteKeyStatus, DeleteRemoteKeyStatus } from "./routes.js";
|
|
5
|
-
export type { ResponseStatus, SignerDefinition, KeystoreStr, SlashingProtectionData, PubkeyHex,
|
|
5
|
+
export type { ResponseStatus, SignerDefinition, RemoteSignerDefinition, KeystoreStr, SlashingProtectionData, PubkeyHex, Endpoints, FeeRecipientData, GraffitiData, GasLimitData, BuilderBoostFactorData, } from "./routes.js";
|
|
6
|
+
export type { ApiClient };
|
|
6
7
|
type ClientModules = HttpClientModules & {
|
|
7
8
|
config: ChainForkConfig;
|
|
8
9
|
httpClient?: IHttpClient;
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
|
-
* REST HTTP client for
|
|
12
|
+
* REST HTTP client for keymanager routes
|
|
12
13
|
*/
|
|
13
|
-
export declare function getClient(opts: HttpClientOptions, modules: ClientModules):
|
|
14
|
+
export declare function getClient(opts: HttpClientOptions, modules: ClientModules): ApiClient;
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/keymanager/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as keymanager from "./client.js";
|
|
|
3
3
|
// NOTE: Don't export server here so it's not bundled to all consumers
|
|
4
4
|
export { ImportStatus, DeletionStatus, ImportRemoteKeyStatus, DeleteRemoteKeyStatus } from "./routes.js";
|
|
5
5
|
/**
|
|
6
|
-
* REST HTTP client for
|
|
6
|
+
* REST HTTP client for keymanager routes
|
|
7
7
|
*/
|
|
8
8
|
export function getClient(opts, modules) {
|
|
9
9
|
const { config } = modules;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keymanager/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keymanager/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,UAAU,EAAuC,MAAM,0BAA0B,CAAC;AAEvG,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAE1C,sEAAsE;AAEtE,OAAO,EAAC,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAC,MAAM,aAAa,CAAC;AAsBvG;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAuB,EAAE,OAAsB;IACvE,MAAM,EAAC,MAAM,EAAC,GAAG,OAAO,CAAC;IACzB,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEvE,OAAO,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAClD,CAAC"}
|