@xyo-network/xl1-rpc 2.1.9 → 2.2.0
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/dist/neutral/engine/index.d.ts +1 -0
- package/dist/neutral/engine/index.d.ts.map +1 -1
- package/dist/neutral/engine-node/composedRpcEngineFromConnection.d.ts +20 -0
- package/dist/neutral/engine-node/composedRpcEngineFromConnection.d.ts.map +1 -0
- package/dist/neutral/engine-node/index.d.ts +2 -0
- package/dist/neutral/engine-node/index.d.ts.map +1 -1
- package/dist/neutral/engine-node/middleware/RpcContext.d.ts +25 -0
- package/dist/neutral/engine-node/middleware/RpcContext.d.ts.map +1 -0
- package/dist/neutral/engine-node/middleware/createHandlerMiddleware.d.ts +38 -0
- package/dist/neutral/engine-node/middleware/createHandlerMiddleware.d.ts.map +1 -0
- package/dist/neutral/engine-node/middleware/createLoggingMiddleware.d.ts +9 -0
- package/dist/neutral/engine-node/middleware/createLoggingMiddleware.d.ts.map +1 -0
- package/dist/neutral/engine-node/middleware/createMethodNotFoundMiddleware.d.ts +7 -0
- package/dist/neutral/engine-node/middleware/createMethodNotFoundMiddleware.d.ts.map +1 -0
- package/dist/neutral/engine-node/middleware/createValidationMiddleware.d.ts +10 -0
- package/dist/neutral/engine-node/middleware/createValidationMiddleware.d.ts.map +1 -0
- package/dist/neutral/engine-node/middleware/index.d.ts +6 -0
- package/dist/neutral/engine-node/middleware/index.d.ts.map +1 -0
- package/dist/neutral/index.mjs +71 -68
- package/dist/neutral/index.mjs.map +3 -3
- package/dist/neutral/provider/runner/JsonRpcXyoRunner.d.ts +6 -6
- package/dist/neutral/provider/signer/JsonRpcXyoSignerMethods.d.ts +23 -23
- package/dist/neutral/provider/signer/JsonRpcXyoSignerMethods.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcAccountBalanceViewer/JsonRpcAccountBalanceViewer.d.ts +1 -1
- package/dist/neutral/provider/viewer/JsonRpcAccountBalanceViewer/JsonRpcAccountBalanceViewer.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcAccountBalanceViewer/JsonRpcAccountBalanceViewerMethods.d.ts +50 -50
- package/dist/neutral/provider/viewer/JsonRpcAccountBalanceViewer/JsonRpcAccountBalanceViewerMethods.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcBlockViewer/JsonRpcBlockViewerMethods.d.ts +2 -2
- package/dist/neutral/provider/viewer/JsonRpcFinalizationViewer/JsonRpcFinalizationViewerMethods.d.ts +4 -4
- package/dist/neutral/provider/viewer/JsonRpcMempoolViewer/JsonRpcMempoolViewerMethods.d.ts +10 -10
- package/dist/neutral/provider/viewer/JsonRpcNetworkStakeStepRewardsByPositionViewer/JsonRpcNetworkStakeStepRewardsByPositionViewerMethods.d.ts +10 -10
- package/dist/neutral/provider/viewer/JsonRpcNetworkStakeStepRewardsByStakerViewer/JsonRpcNetworkStakeStepRewardsByStakerViewerMethods.d.ts +20 -20
- package/dist/neutral/provider/viewer/JsonRpcNetworkStakeStepRewardsByStepViewer/JsonRpcNetworkStakeStepRewardsByStepViewerMethods.d.ts +20 -20
- package/dist/neutral/provider/viewer/JsonRpcNetworkStakeStepRewardsTotalViewer/JsonRpcNetworkStakeStepRewardsTotalViewerMethods.d.ts +10 -10
- package/dist/neutral/provider/viewer/JsonRpcStakeTotalsViewer/JsonRpcStakeTotalsViewerMethods.d.ts +9 -9
- package/dist/neutral/provider/viewer/JsonRpcStakeTotalsViewer/JsonRpcStakeTotalsViewerMethods.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcStakeViewer/JsonRpcStakeViewerMethods.d.ts +69 -69
- package/dist/neutral/provider/viewer/JsonRpcStakeViewer/JsonRpcStakeViewerMethods.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcTimeSyncViewer/JsonRpcTimeSyncViewerMethods.d.ts +1 -1
- package/dist/neutral/provider/viewer/JsonRpcTimeSyncViewer/JsonRpcTimeSyncViewerMethods.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcTransactionViewer/JsonRpcTransactionViewer.d.ts +3 -270
- package/dist/neutral/provider/viewer/JsonRpcTransactionViewer/JsonRpcTransactionViewer.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts +250 -138
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/neutral/types/TransactionViewerRpc.d.ts +10 -2
- package/dist/neutral/types/TransactionViewerRpc.d.ts.map +1 -1
- package/dist/neutral/types/schema/AccountBalanceViewerRpcSchemas.d.ts +48 -48
- package/dist/neutral/types/schema/AllRpcSchemas.d.ts +492 -650
- package/dist/neutral/types/schema/AllRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/BlockViewerRpcSchemas.d.ts +2 -2
- package/dist/neutral/types/schema/BlockViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/FinalizationViewerRpcSchemas.d.ts +4 -4
- package/dist/neutral/types/schema/MempoolRunnerRpcSchemas.d.ts +10 -10
- package/dist/neutral/types/schema/MempoolViewerRpcSchemas.d.ts +10 -10
- package/dist/neutral/types/schema/RewardsByPositionViewerRpcSchemas.d.ts +10 -10
- package/dist/neutral/types/schema/RewardsByStakerViewerRpcSchemas.d.ts +20 -20
- package/dist/neutral/types/schema/RewardsByStepViewerRpcSchemas.d.ts +20 -20
- package/dist/neutral/types/schema/RewardsTotalViewerRpcSchemas.d.ts +10 -10
- package/dist/neutral/types/schema/StakeTotalsViewerRpcSchemas.d.ts +8 -8
- package/dist/neutral/types/schema/StakeViewerRpcSchemas.d.ts +58 -58
- package/dist/neutral/types/schema/StepViewerRpcSchemas.d.ts +12 -12
- package/dist/neutral/types/schema/TransactionViewerRpcSchema.d.ts +15 -280
- package/dist/neutral/types/schema/TransactionViewerRpcSchema.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoRunnerRpcSchemas.d.ts +6 -6
- package/dist/neutral/types/schema/XyoSignerRpcSchemas.d.ts +22 -22
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts +306 -192
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/engine/index.d.ts +1 -0
- package/dist/node/engine/index.d.ts.map +1 -1
- package/dist/node/engine-node/composedRpcEngineFromConnection.d.ts +20 -0
- package/dist/node/engine-node/composedRpcEngineFromConnection.d.ts.map +1 -0
- package/dist/node/engine-node/index.d.ts +2 -0
- package/dist/node/engine-node/index.d.ts.map +1 -1
- package/dist/node/engine-node/middleware/RpcContext.d.ts +25 -0
- package/dist/node/engine-node/middleware/RpcContext.d.ts.map +1 -0
- package/dist/node/engine-node/middleware/createHandlerMiddleware.d.ts +38 -0
- package/dist/node/engine-node/middleware/createHandlerMiddleware.d.ts.map +1 -0
- package/dist/node/engine-node/middleware/createLoggingMiddleware.d.ts +9 -0
- package/dist/node/engine-node/middleware/createLoggingMiddleware.d.ts.map +1 -0
- package/dist/node/engine-node/middleware/createMethodNotFoundMiddleware.d.ts +7 -0
- package/dist/node/engine-node/middleware/createMethodNotFoundMiddleware.d.ts.map +1 -0
- package/dist/node/engine-node/middleware/createValidationMiddleware.d.ts +10 -0
- package/dist/node/engine-node/middleware/createValidationMiddleware.d.ts.map +1 -0
- package/dist/node/engine-node/middleware/index.d.ts +6 -0
- package/dist/node/engine-node/middleware/index.d.ts.map +1 -0
- package/dist/node/index-node.mjs +225 -74
- package/dist/node/index-node.mjs.map +4 -4
- package/dist/node/provider/runner/JsonRpcXyoRunner.d.ts +6 -6
- package/dist/node/provider/signer/JsonRpcXyoSignerMethods.d.ts +23 -23
- package/dist/node/provider/signer/JsonRpcXyoSignerMethods.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcAccountBalanceViewer/JsonRpcAccountBalanceViewer.d.ts +1 -1
- package/dist/node/provider/viewer/JsonRpcAccountBalanceViewer/JsonRpcAccountBalanceViewer.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcAccountBalanceViewer/JsonRpcAccountBalanceViewerMethods.d.ts +50 -50
- package/dist/node/provider/viewer/JsonRpcAccountBalanceViewer/JsonRpcAccountBalanceViewerMethods.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcBlockViewer/JsonRpcBlockViewerMethods.d.ts +2 -2
- package/dist/node/provider/viewer/JsonRpcFinalizationViewer/JsonRpcFinalizationViewerMethods.d.ts +4 -4
- package/dist/node/provider/viewer/JsonRpcMempoolViewer/JsonRpcMempoolViewerMethods.d.ts +10 -10
- package/dist/node/provider/viewer/JsonRpcNetworkStakeStepRewardsByPositionViewer/JsonRpcNetworkStakeStepRewardsByPositionViewerMethods.d.ts +10 -10
- package/dist/node/provider/viewer/JsonRpcNetworkStakeStepRewardsByStakerViewer/JsonRpcNetworkStakeStepRewardsByStakerViewerMethods.d.ts +20 -20
- package/dist/node/provider/viewer/JsonRpcNetworkStakeStepRewardsByStepViewer/JsonRpcNetworkStakeStepRewardsByStepViewerMethods.d.ts +20 -20
- package/dist/node/provider/viewer/JsonRpcNetworkStakeStepRewardsTotalViewer/JsonRpcNetworkStakeStepRewardsTotalViewerMethods.d.ts +10 -10
- package/dist/node/provider/viewer/JsonRpcStakeTotalsViewer/JsonRpcStakeTotalsViewerMethods.d.ts +9 -9
- package/dist/node/provider/viewer/JsonRpcStakeTotalsViewer/JsonRpcStakeTotalsViewerMethods.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcStakeViewer/JsonRpcStakeViewerMethods.d.ts +69 -69
- package/dist/node/provider/viewer/JsonRpcStakeViewer/JsonRpcStakeViewerMethods.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcTimeSyncViewer/JsonRpcTimeSyncViewerMethods.d.ts +1 -1
- package/dist/node/provider/viewer/JsonRpcTimeSyncViewer/JsonRpcTimeSyncViewerMethods.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcTransactionViewer/JsonRpcTransactionViewer.d.ts +3 -270
- package/dist/node/provider/viewer/JsonRpcTransactionViewer/JsonRpcTransactionViewer.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts +250 -138
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/node/types/TransactionViewerRpc.d.ts +10 -2
- package/dist/node/types/TransactionViewerRpc.d.ts.map +1 -1
- package/dist/node/types/schema/AccountBalanceViewerRpcSchemas.d.ts +48 -48
- package/dist/node/types/schema/AllRpcSchemas.d.ts +492 -650
- package/dist/node/types/schema/AllRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/BlockViewerRpcSchemas.d.ts +2 -2
- package/dist/node/types/schema/BlockViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/FinalizationViewerRpcSchemas.d.ts +4 -4
- package/dist/node/types/schema/MempoolRunnerRpcSchemas.d.ts +10 -10
- package/dist/node/types/schema/MempoolViewerRpcSchemas.d.ts +10 -10
- package/dist/node/types/schema/RewardsByPositionViewerRpcSchemas.d.ts +10 -10
- package/dist/node/types/schema/RewardsByStakerViewerRpcSchemas.d.ts +20 -20
- package/dist/node/types/schema/RewardsByStepViewerRpcSchemas.d.ts +20 -20
- package/dist/node/types/schema/RewardsTotalViewerRpcSchemas.d.ts +10 -10
- package/dist/node/types/schema/StakeTotalsViewerRpcSchemas.d.ts +8 -8
- package/dist/node/types/schema/StakeViewerRpcSchemas.d.ts +58 -58
- package/dist/node/types/schema/StepViewerRpcSchemas.d.ts +12 -12
- package/dist/node/types/schema/TransactionViewerRpcSchema.d.ts +15 -280
- package/dist/node/types/schema/TransactionViewerRpcSchema.d.ts.map +1 -1
- package/dist/node/types/schema/XyoRunnerRpcSchemas.d.ts +6 -6
- package/dist/node/types/schema/XyoSignerRpcSchemas.d.ts +22 -22
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts +306 -192
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts.map +1 -1
- package/package.json +5 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XyoViewerRpcSchemas.d.ts","sourceRoot":"","sources":["../../../../src/types/schema/XyoViewerRpcSchemas.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"XyoViewerRpcSchemas.d.ts","sourceRoot":"","sources":["../../../../src/types/schema/XyoViewerRpcSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAMjD,OAAO,KAAK,EAE2C,cAAc,EACpE,MAAM,+BAA+B,CAAA;AAUtC,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAA;AA2C5B,oCAAoC;AACpC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsVgB,CAAA;AAEhD,gCAAgC;AAChC,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
|
|
@@ -12,5 +12,6 @@ export * from './rpcMethodHandlersFromPermissions.ts';
|
|
|
12
12
|
export * from './rpcMethodHandlersFromRunner.ts';
|
|
13
13
|
export * from './rpcMethodHandlersFromSigner.ts';
|
|
14
14
|
export * from './rpcMethodHandlersFromTimeSyncViewer.ts';
|
|
15
|
+
export * from './rpcMethodHandlersFromTransactionViewer.ts';
|
|
15
16
|
export * from './rpcMethodHandlersFromViewer.ts';
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,gDAAgD,CAAA;AAC9D,cAAc,uCAAuC,CAAA;AACrD,cAAc,sCAAsC,CAAA;AACpD,cAAc,8CAA8C,CAAA;AAC5D,cAAc,yCAAyC,CAAA;AACvD,cAAc,yCAAyC,CAAA;AACvD,cAAc,mEAAmE,CAAA;AACjF,cAAc,qEAAqE,CAAA;AACnF,cAAc,gDAAgD,CAAA;AAC9D,cAAc,uCAAuC,CAAA;AACrD,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,0CAA0C,CAAA;AACxD,cAAc,kCAAkC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,gDAAgD,CAAA;AAC9D,cAAc,uCAAuC,CAAA;AACrD,cAAc,sCAAsC,CAAA;AACpD,cAAc,8CAA8C,CAAA;AAC5D,cAAc,yCAAyC,CAAA;AACvD,cAAc,yCAAyC,CAAA;AACvD,cAAc,mEAAmE,CAAA;AACjF,cAAc,qEAAqE,CAAA;AACnF,cAAc,gDAAgD,CAAA;AAC9D,cAAc,uCAAuC,CAAA;AACrD,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,0CAA0C,CAAA;AACxD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,kCAAkC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { JsonRpcRequest } from '@metamask/json-rpc-engine/v2';
|
|
2
|
+
import { JsonRpcEngineV2, JsonRpcServer } from '@metamask/json-rpc-engine/v2';
|
|
3
|
+
import type { Logger } from '@xylabs/sdk-js';
|
|
4
|
+
import type { XyoConnection } from '@xyo-network/xl1-protocol-lib';
|
|
5
|
+
import type { RpcContext, RpcMiddleware } from './middleware/index.ts';
|
|
6
|
+
/**
|
|
7
|
+
* Composed alternative to {@link rpcEngineFromConnection}. Builds the same
|
|
8
|
+
* engine surface, but as a stack of small middleware:
|
|
9
|
+
*
|
|
10
|
+
* logging → [sub-engine per viewer/runner namespace] → method-not-found
|
|
11
|
+
*
|
|
12
|
+
* Each sub-engine pairs a {@link createValidationMiddleware} with a
|
|
13
|
+
* {@link createTypedHandlerMiddleware}, isolating one viewer's schemas + handlers.
|
|
14
|
+
* Cross-cutting concerns (logging, error mapping, future auth/rate-limit) live
|
|
15
|
+
* once at the root rather than inside the dispatch loop.
|
|
16
|
+
*/
|
|
17
|
+
export declare const composedRpcEngineFromConnection: (connection: XyoConnection, logger?: Logger) => JsonRpcEngineV2<JsonRpcRequest, RpcContext>;
|
|
18
|
+
/** Convenience wrapper that returns a spec-compliant {@link JsonRpcServer}. */
|
|
19
|
+
export declare const composedRpcServerFromConnection: (connection: XyoConnection, logger?: Logger) => JsonRpcServer<RpcMiddleware>;
|
|
20
|
+
//# sourceMappingURL=composedRpcEngineFromConnection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composedRpcEngineFromConnection.d.ts","sourceRoot":"","sources":["../../../src/engine-node/composedRpcEngineFromConnection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,EACL,eAAe,EACf,aAAa,EACd,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AA2BlE,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EAEd,MAAM,uBAAuB,CAAA;AA6B9B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,+BAA+B,GAC1C,YAAY,aAAa,EACzB,SAAS,MAAM,KAEd,eAAe,CAAC,cAAc,EAAE,UAAU,CAkF5C,CAAA;AAED,+EAA+E;AAC/E,eAAO,MAAM,+BAA+B,GAC1C,YAAY,aAAa,EACzB,SAAS,MAAM,KACd,aAAa,CAAC,aAAa,CAG7B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine-node/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine-node/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAA;AACpD,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Json, JsonRpcMiddleware, JsonRpcRequest, MiddlewareContext } from '@metamask/json-rpc-engine/v2';
|
|
2
|
+
import type { RequestResponseSchemas } from '../../types/index.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Keys that validation middleware stamps into the per-request context.
|
|
5
|
+
*
|
|
6
|
+
* Must be a type alias (not an interface): `MiddlewareContext<K>` constrains
|
|
7
|
+
* `K extends Record<PropertyKey, unknown>`, which interfaces can't satisfy
|
|
8
|
+
* because they're open to declaration merging.
|
|
9
|
+
*/
|
|
10
|
+
export type RpcContextKeyValues = {
|
|
11
|
+
/** Pre-validated, deserialized params; safe for handlers to consume. */
|
|
12
|
+
params: unknown;
|
|
13
|
+
/** The schema entry for the dispatched method; used to encode the result. */
|
|
14
|
+
schema: RequestResponseSchemas;
|
|
15
|
+
};
|
|
16
|
+
/** Typed MiddlewareContext used throughout the RPC engine. */
|
|
17
|
+
export type RpcContext = MiddlewareContext<RpcContextKeyValues>;
|
|
18
|
+
/**
|
|
19
|
+
* Middleware shape used throughout the RPC engine. We only handle
|
|
20
|
+
* {@link JsonRpcRequest}s (no notifications), so Result is constrained to
|
|
21
|
+
* {@link Json}. This matches what `createScaffoldMiddleware` and a sub-engine
|
|
22
|
+
* built purely from request-handling middleware will produce.
|
|
23
|
+
*/
|
|
24
|
+
export type RpcMiddleware = JsonRpcMiddleware<JsonRpcRequest, Json, RpcContext>;
|
|
25
|
+
//# sourceMappingURL=RpcContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RpcContext.d.ts","sourceRoot":"","sources":["../../../../src/engine-node/middleware/RpcContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EAClB,MAAM,8BAA8B,CAAA;AAErC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAElE;;;;;;GAMG;AAEH,MAAM,MAAM,mBAAmB,GAAG;IAChC,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAA;IACf,6EAA6E;IAC7E,MAAM,EAAE,sBAAsB,CAAA;CAC/B,CAAA;AAED,8DAA8D;AAC9D,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,CAAA;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC,cAAc,EAAE,IAAI,EAAE,UAAU,CAAC,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Promisable } from '@xylabs/sdk-js';
|
|
2
|
+
import type { z } from 'zod/mini';
|
|
3
|
+
import type { RpcSchemaMap } from '../../types/index.ts';
|
|
4
|
+
import type { RpcMiddleware } from './RpcContext.ts';
|
|
5
|
+
/**
|
|
6
|
+
* Handler record whose signatures are derived directly from a schema map.
|
|
7
|
+
*
|
|
8
|
+
* params: `z.output<params.from>` — the in-memory shape that
|
|
9
|
+
* `params.from` produces by parsing the wire request on the
|
|
10
|
+
* server. This is what the handler actually receives.
|
|
11
|
+
*
|
|
12
|
+
* result: `z.input<result.to>` — the in-memory shape the handler
|
|
13
|
+
* returns, which `result.to` then encodes for the wire. For
|
|
14
|
+
* schemas without a `.transform()`, `z.input` and `z.output`
|
|
15
|
+
* are identical; for transform pipes (e.g. `BigIntToJsonZod`
|
|
16
|
+
* mapping `bigint` → `BrandedHex`) they diverge, and the
|
|
17
|
+
* handler must produce the pre-transform `bigint`/AttoXL1.
|
|
18
|
+
*
|
|
19
|
+
* A schema change forces a corresponding handler update (and vice versa).
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const handlers: TypedRpcHandlerRecord<typeof FinalizationViewerRpcSchemas> = {
|
|
23
|
+
* finalizationViewer_head: () => viewer.head(),
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
26
|
+
export type TypedRpcHandlerRecord<TSchemas extends RpcSchemaMap> = {
|
|
27
|
+
[K in keyof TSchemas]: (params: z.output<TSchemas[K]['params']['from']>) => Promisable<z.input<TSchemas[K]['result']['to']>>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Builds a scaffold middleware that dispatches by method name to the matching
|
|
31
|
+
* handler. `handlers` is constrained at the type level against `TSchemas` so
|
|
32
|
+
* adding/removing/retyping a method in the schema map forces a corresponding
|
|
33
|
+
* handler update (and vice versa). The `schemas` runtime argument exists only
|
|
34
|
+
* to drive type inference — it's not consumed at runtime; each request's
|
|
35
|
+
* schema entry is read from `MiddlewareContext` after upstream validation.
|
|
36
|
+
*/
|
|
37
|
+
export declare const createTypedHandlerMiddleware: <TSchemas extends RpcSchemaMap>(_schemas: TSchemas, handlers: TypedRpcHandlerRecord<TSchemas>) => RpcMiddleware;
|
|
38
|
+
//# sourceMappingURL=createHandlerMiddleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createHandlerMiddleware.d.ts","sourceRoot":"","sources":["../../../../src/engine-node/middleware/createHandlerMiddleware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,iBAAiB,CAAA;AA8BhE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,qBAAqB,CAAC,QAAQ,SAAS,YAAY,IAAI;KAChE,CAAC,IAAI,MAAM,QAAQ,GAAG,CACrB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAC5C,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;CACtD,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,GAAI,QAAQ,SAAS,YAAY,EACxE,UAAU,QAAQ,EAClB,UAAU,qBAAqB,CAAC,QAAQ,CAAC,KACxC,aAA+C,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Logger } from '@xylabs/sdk-js';
|
|
2
|
+
import type { RpcMiddleware } from './RpcContext.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Wraps downstream middleware in a try/catch and logs any thrown error
|
|
5
|
+
* with the offending RPC method name. Re-throws so JsonRpcServer can
|
|
6
|
+
* still format a spec-compliant error response.
|
|
7
|
+
*/
|
|
8
|
+
export declare const createLoggingMiddleware: (logger?: Logger) => RpcMiddleware;
|
|
9
|
+
//# sourceMappingURL=createLoggingMiddleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createLoggingMiddleware.d.ts","sourceRoot":"","sources":["../../../../src/engine-node/middleware/createLoggingMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,MAAM,KAAG,aAOzD,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RpcMiddleware } from './RpcContext.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Terminal middleware. Reached only when no sibling middleware/sub-engine
|
|
4
|
+
* matched the request method; throws a JSON-RPC "method not found" error.
|
|
5
|
+
*/
|
|
6
|
+
export declare const createMethodNotFoundMiddleware: () => RpcMiddleware;
|
|
7
|
+
//# sourceMappingURL=createMethodNotFoundMiddleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMethodNotFoundMiddleware.d.ts","sourceRoot":"","sources":["../../../../src/engine-node/middleware/createMethodNotFoundMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD;;;GAGG;AACH,eAAO,MAAM,8BAA8B,QAAO,aAEjD,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RpcSchemaMap } from '../../types/index.ts';
|
|
2
|
+
import type { RpcMiddleware } from './RpcContext.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Validates the request against the matching Zod schema in `schemas`, then
|
|
5
|
+
* stamps `params` and `schema` into the MiddlewareContext for downstream
|
|
6
|
+
* handlers. If the method is not in `schemas`, the request is passed through
|
|
7
|
+
* via `next()` — letting a sibling sub-engine or terminal middleware handle it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const createValidationMiddleware: (schemas: RpcSchemaMap) => RpcMiddleware;
|
|
10
|
+
//# sourceMappingURL=createValidationMiddleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createValidationMiddleware.d.ts","sourceRoot":"","sources":["../../../../src/engine-node/middleware/createValidationMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAI,SAAS,YAAY,KAAG,aAoBlE,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './createHandlerMiddleware.ts';
|
|
2
|
+
export * from './createLoggingMiddleware.ts';
|
|
3
|
+
export * from './createMethodNotFoundMiddleware.ts';
|
|
4
|
+
export * from './createValidationMiddleware.ts';
|
|
5
|
+
export * from './RpcContext.ts';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/engine-node/middleware/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qCAAqC,CAAA;AACnD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA"}
|