@keelcodes/self-host 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Keel contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,88 @@
1
- # Temporary Holding Version
1
+ # @keelcodes/self-host
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The **reference self-host stack** for Keel: a complete ERC-4337 environment with
4
+ no hosted provider in the loop — the OxaChain path, and the local sandbox every
5
+ other chain can be developed against.
6
+
7
+ The deployable artifact is [`infra/docker-compose.yml`](../../infra/docker-compose.yml).
8
+ This package is its typed companion — the service model, the endpoint derivation
9
+ and the readiness probes — and it has **no runtime dependencies**.
10
+
11
+ ## The stack
12
+
13
+ | Service | Image | Role | Port |
14
+ |---|---|---|---|
15
+ | `anvil` | `ghcr.io/foundry-rs/foundry` | local EVM node, chain `31337` | `8545` |
16
+ | `contract-deployer` | `ghcr.io/pimlicolabs/mock-contract-deployer` | one-shot: EntryPoint + account factories | — |
17
+ | `bundler` | `ghcr.io/pimlicolabs/alto` | ERC-4337 bundler | `4337` |
18
+ | `paymaster` | `ghcr.io/pimlicolabs/mock-verifying-paymaster` | ERC-7677 paymaster service | `3000` |
19
+
20
+ ```bash
21
+ docker compose -f infra/docker-compose.yml up
22
+ ```
23
+
24
+ Then:
25
+
26
+ ```ts
27
+ import { localEndpoints, stackRpc, waitForStack, type FetchLike } from '@keelcodes/self-host';
28
+
29
+ const endpoints = localEndpoints(); // { chainId: 31337, rpcUrl, bundlerUrl, paymasterUrl }
30
+ const fetchImpl = fetch as unknown as FetchLike;
31
+ const { chain, bundler, paymaster } = stackRpc(endpoints, fetchImpl);
32
+
33
+ const readiness = await waitForStack({ chain, bundler, chainId: endpoints.chainId });
34
+ // { chain: true, bundler: true, ready: true, timedOut: false, elapsedMs: … }
35
+ ```
36
+
37
+ Point the rest of Keel at the same endpoints:
38
+
39
+ ```ts
40
+ import { createBundlerAdapter, createPaymasterAdapter } from '@keelcodes/adapters';
41
+
42
+ const bundlerAdapter = createBundlerAdapter('skandha', { url: endpoints.bundlerUrl });
43
+ const paymasterAdapter = createPaymasterAdapter('pimlico', { url: endpoints.paymasterUrl });
44
+ ```
45
+
46
+ The `kind` is only used for a provider's built-in URL layout; a self-hosted
47
+ endpoint always supplies an explicit `url`, so any kind works.
48
+
49
+ ## Why these services
50
+
51
+ - **anvil** — a deterministic local chain; its dev accounts and mnemonic
52
+ ([`ANVIL_MNEMONIC`](./src/stack.ts)) are public and funded on a local chain only.
53
+ - **contract-deployer** — deploys the canonical EntryPoint (v0.6 / v0.7 / v0.8)
54
+ and the Kernel / Nexus / Safe7579 account factories, so a fresh stack is usable
55
+ with no manual deploy step.
56
+ - **bundler (Alto)** — Pimlico's open-source bundler, driven by
57
+ [`infra/alto-config.json`](../../infra/alto-config.json).
58
+ - **paymaster** — the mock ERC-7677 service forwards every bundler method to the
59
+ bundler, so it doubles as a drop-in bundler URL, exactly how a hosted provider
60
+ exposes one URL for both.
61
+
62
+ ## Model
63
+
64
+ `SELF_HOST_SERVICES` is the machine-readable mirror of the compose file: the same
65
+ names, images, ports and dependencies. `localEndpoints()` derives the three URLs
66
+ from a host and port set, and the probes talk to injected `RpcCall` ports so they
67
+ run in CI with no chain and no network:
68
+
69
+ - `checkChain(rpc, chainId)` — `eth_chainId` matches.
70
+ - `checkBundler(rpc)` — `eth_supported_entryPoints` is non-empty.
71
+ - `waitForStack({ chain, bundler, ... })` — polls until both hold or the timeout
72
+ elapses. A probe that throws counts as "not ready yet", so a booting stack
73
+ never surfaces as an error. The paymaster is not polled: it forwards to the
74
+ bundler, so bundler readiness is the last thing to arrive.
75
+
76
+ ## Images and licensing
77
+
78
+ This compose file pulls **third-party images**; they are not built or distributed
79
+ by Keel. Alto and the two mock services are published by Pimlico (Alto is
80
+ GPL-3.0). Pin every image to a digest before running this anywhere but a sandbox,
81
+ and swap the mock paymaster for a real verifying paymaster service in production.
82
+
83
+ ## Develop
84
+
85
+ ```bash
86
+ pnpm --filter @keelcodes/self-host test
87
+ pnpm --filter @keelcodes/self-host typecheck
88
+ ```
@@ -0,0 +1,26 @@
1
+ export interface LocalStackPorts {
2
+ anvil: number;
3
+ bundler: number;
4
+ paymaster: number;
5
+ }
6
+ export interface LocalStackOptions {
7
+ /** Host the stack runs on. Defaults to `127.0.0.1`. */
8
+ host?: string;
9
+ /** Overrides for the published ports. */
10
+ ports?: Partial<LocalStackPorts>;
11
+ /** Expected chain id. Defaults to {@link LOCAL_CHAIN_ID}. */
12
+ chainId?: number;
13
+ }
14
+ /** The three JSON-RPC endpoints the reference stack exposes. */
15
+ export interface LocalStackEndpoints {
16
+ chainId: number;
17
+ rpcUrl: string;
18
+ bundlerUrl: string;
19
+ paymasterUrl: string;
20
+ }
21
+ /**
22
+ * Derives the endpoints of the local reference stack, so a consumer can point
23
+ * `@keelcodes/adapters` (or any ERC-4337 client) at it without hardcoding ports.
24
+ */
25
+ export declare function localEndpoints(options?: LocalStackOptions): LocalStackEndpoints;
26
+ //# sourceMappingURL=endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../src/endpoints.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,gEAAgE;AAChE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,iBAAsB,GAAG,mBAAmB,CASnF"}
@@ -0,0 +1,16 @@
1
+ import { DEFAULT_LOCAL_PORTS, LOCAL_CHAIN_ID } from './stack.js';
2
+ /**
3
+ * Derives the endpoints of the local reference stack, so a consumer can point
4
+ * `@keelcodes/adapters` (or any ERC-4337 client) at it without hardcoding ports.
5
+ */
6
+ export function localEndpoints(options = {}) {
7
+ const host = options.host ?? '127.0.0.1';
8
+ const ports = { ...DEFAULT_LOCAL_PORTS, ...options.ports };
9
+ return {
10
+ chainId: options.chainId ?? LOCAL_CHAIN_ID,
11
+ rpcUrl: `http://${host}:${ports.anvil}`,
12
+ bundlerUrl: `http://${host}:${ports.bundler}`,
13
+ paymasterUrl: `http://${host}:${ports.paymaster}`,
14
+ };
15
+ }
16
+ //# sourceMappingURL=endpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../src/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAyBjE;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,UAA6B,EAAE;IAC5D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,WAAW,CAAC;IACzC,MAAM,KAAK,GAAoB,EAAE,GAAG,mBAAmB,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAC5E,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,cAAc;QAC1C,MAAM,EAAE,UAAU,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;QACvC,UAAU,EAAE,UAAU,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE;QAC7C,YAAY,EAAE,UAAU,IAAI,IAAI,KAAK,CAAC,SAAS,EAAE;KAClD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { RpcCall } from './rpc.js';
2
+ /** The chain is up and reporting the expected chain id. */
3
+ export declare function checkChain(rpc: RpcCall, expectedChainId: number): Promise<boolean>;
4
+ /** The bundler is up and advertising at least one EntryPoint. */
5
+ export declare function checkBundler(rpc: RpcCall): Promise<boolean>;
6
+ export interface StackReadiness {
7
+ chain: boolean;
8
+ bundler: boolean;
9
+ ready: boolean;
10
+ timedOut: boolean;
11
+ elapsedMs: number;
12
+ }
13
+ export interface WaitForStackOptions {
14
+ chain: RpcCall;
15
+ bundler: RpcCall;
16
+ chainId: number;
17
+ /** Give up after this long. Defaults to 30s. */
18
+ timeoutMs?: number;
19
+ /** Delay between attempts. Defaults to 250ms. */
20
+ intervalMs?: number;
21
+ /** Clock, injectable for tests. Defaults to `Date.now`. */
22
+ now?: () => number;
23
+ /** Sleep, injectable for tests. Defaults to a timer. */
24
+ sleep?: (ms: number) => Promise<void>;
25
+ }
26
+ /**
27
+ * Polls the stack until the chain and the bundler are both up, or the timeout
28
+ * elapses. A probe that throws counts as "not ready yet", so a stack that is
29
+ * still booting never surfaces as an error.
30
+ *
31
+ * The paymaster is intentionally not polled: it forwards to the bundler, so
32
+ * bundler readiness is the last thing to arrive.
33
+ */
34
+ export declare function waitForStack(options: WaitForStackOptions): Promise<StackReadiness>;
35
+ //# sourceMappingURL=health.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../src/health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,2DAA2D;AAC3D,wBAAsB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGxF;AAED,iEAAiE;AACjE,wBAAsB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAGjE;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,wDAAwD;IACxD,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAsBD;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CA2BxF"}
package/dist/health.js ADDED
@@ -0,0 +1,61 @@
1
+ /** The chain is up and reporting the expected chain id. */
2
+ export async function checkChain(rpc, expectedChainId) {
3
+ const raw = await rpc('eth_chainId');
4
+ return typeof raw === 'string' && Number.parseInt(raw, 16) === expectedChainId;
5
+ }
6
+ /** The bundler is up and advertising at least one EntryPoint. */
7
+ export async function checkBundler(rpc) {
8
+ const raw = await rpc('eth_supportedEntryPoints');
9
+ return Array.isArray(raw) && raw.length > 0;
10
+ }
11
+ function defaultSleep(ms) {
12
+ const setTimer = globalThis.setTimeout;
13
+ if (setTimer === undefined) {
14
+ throw new Error('waitForStack: no timer available; pass options.sleep');
15
+ }
16
+ return new Promise((resolve) => {
17
+ setTimer(() => resolve(), ms);
18
+ });
19
+ }
20
+ async function safely(fn) {
21
+ try {
22
+ return await fn();
23
+ }
24
+ catch {
25
+ return false;
26
+ }
27
+ }
28
+ /**
29
+ * Polls the stack until the chain and the bundler are both up, or the timeout
30
+ * elapses. A probe that throws counts as "not ready yet", so a stack that is
31
+ * still booting never surfaces as an error.
32
+ *
33
+ * The paymaster is intentionally not polled: it forwards to the bundler, so
34
+ * bundler readiness is the last thing to arrive.
35
+ */
36
+ export async function waitForStack(options) {
37
+ const now = options.now ?? Date.now;
38
+ const sleep = options.sleep ?? defaultSleep;
39
+ const timeoutMs = options.timeoutMs ?? 30_000;
40
+ const intervalMs = options.intervalMs ?? 250;
41
+ const startedAt = now();
42
+ let chain = false;
43
+ let bundler = false;
44
+ while (!(chain && bundler)) {
45
+ if (!chain) {
46
+ chain = await safely(() => checkChain(options.chain, options.chainId));
47
+ }
48
+ if (chain && !bundler) {
49
+ bundler = await safely(() => checkBundler(options.bundler));
50
+ }
51
+ if (chain && bundler)
52
+ break;
53
+ const elapsedMs = now() - startedAt;
54
+ if (elapsedMs >= timeoutMs) {
55
+ return { chain, bundler, ready: false, timedOut: true, elapsedMs };
56
+ }
57
+ await sleep(intervalMs);
58
+ }
59
+ return { chain, bundler, ready: true, timedOut: false, elapsedMs: now() - startedAt };
60
+ }
61
+ //# sourceMappingURL=health.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.js","sourceRoot":"","sources":["../src/health.ts"],"names":[],"mappings":"AAEA,2DAA2D;AAC3D,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAY,EAAE,eAAuB;IACpE,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,CAAC;IACrC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,eAAe,CAAC;AACjF,CAAC;AAED,iEAAiE;AACjE,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAY;IAC7C,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,0BAA0B,CAAC,CAAC;IAClD,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;AAC9C,CAAC;AA0BD,SAAS,YAAY,CAAC,EAAU;IAC9B,MAAM,QAAQ,GAAI,UAAwB,CAAC,UAAU,CAAC;IACtD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,EAA0B;IAC9C,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAA4B;IAC7D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;IACpC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,YAAY,CAAC;IAC5C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC;IAC9C,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,GAAG,CAAC;IAC7C,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC;IAExB,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACzE,CAAC;QACD,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YACtB,OAAO,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9D,CAAC;QACD,IAAI,KAAK,IAAI,OAAO;YAAE,MAAM;QAE5B,MAAM,SAAS,GAAG,GAAG,EAAE,GAAG,SAAS,CAAC;QACpC,IAAI,SAAS,IAAI,SAAS,EAAE,CAAC;YAC3B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACrE,CAAC;QACD,MAAM,KAAK,CAAC,UAAU,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,SAAS,EAAE,CAAC;AACxF,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @keelcodes/self-host
3
+ *
4
+ * The reference stack a Keel consumer runs when it wants no hosted bundler or
5
+ * paymaster in the loop — the OxaChain path, and the local sandbox every other
6
+ * chain can be tested against.
7
+ *
8
+ * The deployable artifact is
9
+ * [`infra/docker-compose.yml`](../../../infra/docker-compose.yml); this package
10
+ * is its typed companion: the service model, the endpoint derivation and the
11
+ * readiness probes. It has no runtime dependencies.
12
+ */
13
+ export { ANVIL_MNEMONIC, DEFAULT_LOCAL_PORTS, LOCAL_CHAIN_ID, SELF_HOST_SERVICES, } from './stack.js';
14
+ export type { StackService, StackServiceRole } from './stack.js';
15
+ export { localEndpoints } from './endpoints.js';
16
+ export type { LocalStackEndpoints, LocalStackOptions, LocalStackPorts } from './endpoints.js';
17
+ export { httpRpc, stackRpc } from './rpc.js';
18
+ export type { FetchLike, JsonRpcError, JsonRpcRequest, JsonRpcResponse, RpcCall, StackRpc, } from './rpc.js';
19
+ export { checkBundler, checkChain, waitForStack } from './health.js';
20
+ export type { StackReadiness, WaitForStackOptions } from './health.js';
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE9F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EACV,SAAS,EACT,YAAY,EACZ,cAAc,EACd,eAAe,EACf,OAAO,EACP,QAAQ,GACT,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACrE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @keelcodes/self-host
3
+ *
4
+ * The reference stack a Keel consumer runs when it wants no hosted bundler or
5
+ * paymaster in the loop — the OxaChain path, and the local sandbox every other
6
+ * chain can be tested against.
7
+ *
8
+ * The deployable artifact is
9
+ * [`infra/docker-compose.yml`](../../../infra/docker-compose.yml); this package
10
+ * is its typed companion: the service model, the endpoint derivation and the
11
+ * readiness probes. It has no runtime dependencies.
12
+ */
13
+ export { ANVIL_MNEMONIC, DEFAULT_LOCAL_PORTS, LOCAL_CHAIN_ID, SELF_HOST_SERVICES, } from './stack.js';
14
+ export { localEndpoints } from './endpoints.js';
15
+ export { httpRpc, stackRpc } from './rpc.js';
16
+ export { checkBundler, checkChain, waitForStack } from './health.js';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAU7C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
package/dist/rpc.d.ts ADDED
@@ -0,0 +1,42 @@
1
+ import type { LocalStackEndpoints } from './endpoints.js';
2
+ /** A minimal JSON-RPC request envelope. */
3
+ export interface JsonRpcRequest {
4
+ jsonrpc: '2.0';
5
+ id: number;
6
+ method: string;
7
+ params: readonly unknown[];
8
+ }
9
+ export interface JsonRpcError {
10
+ code: number;
11
+ message: string;
12
+ }
13
+ export interface JsonRpcResponse {
14
+ result?: unknown;
15
+ error?: JsonRpcError;
16
+ }
17
+ /**
18
+ * The subset of `fetch` this package needs. Injectable so the probes run in
19
+ * tests and CI with no network, mirroring the port style used across Keel.
20
+ */
21
+ export type FetchLike = (url: string, init: {
22
+ method: string;
23
+ headers: Record<string, string>;
24
+ body: string;
25
+ }) => Promise<{
26
+ ok: boolean;
27
+ status: number;
28
+ json(): Promise<unknown>;
29
+ }>;
30
+ /** A single JSON-RPC method call bound to one endpoint. */
31
+ export type RpcCall = (method: string, params?: readonly unknown[]) => Promise<unknown>;
32
+ /** Builds an {@link RpcCall} for one JSON-RPC endpoint over an injected fetch. */
33
+ export declare function httpRpc(url: string, fetchImpl: FetchLike): RpcCall;
34
+ /** One {@link RpcCall} per stack endpoint. */
35
+ export interface StackRpc {
36
+ chain: RpcCall;
37
+ bundler: RpcCall;
38
+ paymaster: RpcCall;
39
+ }
40
+ /** Binds the three stack endpoints to JSON-RPC calls. */
41
+ export declare function stackRpc(endpoints: LocalStackEndpoints, fetchImpl: FetchLike): StackRpc;
42
+ //# sourceMappingURL=rpc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,2CAA2C;AAC3C,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,CACtB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,KACpE,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,CAAC;AAExE,2DAA2D;AAC3D,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAExF,kFAAkF;AAClF,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAkBlE;AAED,8CAA8C;AAC9C,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,yDAAyD;AACzD,wBAAgB,QAAQ,CAAC,SAAS,EAAE,mBAAmB,EAAE,SAAS,EAAE,SAAS,GAAG,QAAQ,CAMvF"}
package/dist/rpc.js ADDED
@@ -0,0 +1,29 @@
1
+ /** Builds an {@link RpcCall} for one JSON-RPC endpoint over an injected fetch. */
2
+ export function httpRpc(url, fetchImpl) {
3
+ let id = 0;
4
+ return async (method, params = []) => {
5
+ const request = { jsonrpc: '2.0', id: ++id, method, params };
6
+ const response = await fetchImpl(url, {
7
+ method: 'POST',
8
+ headers: { 'content-type': 'application/json' },
9
+ body: JSON.stringify(request),
10
+ });
11
+ if (!response.ok) {
12
+ throw new Error(`rpc ${method}: HTTP ${response.status}`);
13
+ }
14
+ const payload = (await response.json());
15
+ if (payload.error) {
16
+ throw new Error(`rpc ${method}: ${payload.error.code} ${payload.error.message}`);
17
+ }
18
+ return payload.result;
19
+ };
20
+ }
21
+ /** Binds the three stack endpoints to JSON-RPC calls. */
22
+ export function stackRpc(endpoints, fetchImpl) {
23
+ return {
24
+ chain: httpRpc(endpoints.rpcUrl, fetchImpl),
25
+ bundler: httpRpc(endpoints.bundlerUrl, fetchImpl),
26
+ paymaster: httpRpc(endpoints.paymasterUrl, fetchImpl),
27
+ };
28
+ }
29
+ //# sourceMappingURL=rpc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.js","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAgCA,kFAAkF;AAClF,MAAM,UAAU,OAAO,CAAC,GAAW,EAAE,SAAoB;IACvD,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,EAAE;QACnC,MAAM,OAAO,GAAmB,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAC7E,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE;YACpC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SAC9B,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,OAAO,MAAM,UAAU,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAC5D,CAAC;QACD,MAAM,OAAO,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAoB,CAAC;QAC3D,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,OAAO,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACnF,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC,CAAC;AACJ,CAAC;AASD,yDAAyD;AACzD,MAAM,UAAU,QAAQ,CAAC,SAA8B,EAAE,SAAoB;IAC3E,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC;QAC3C,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC;QACjD,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,YAAY,EAAE,SAAS,CAAC;KACtD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The self-host reference stack, as data.
3
+ *
4
+ * This is the machine-readable mirror of [`infra/docker-compose.yml`](../../../infra/docker-compose.yml):
5
+ * one entry per service, with the same image, port and dependency wiring the
6
+ * compose file declares. Keeping it here lets the endpoint model and the
7
+ * readiness probes share a single, testable description instead of scraping the
8
+ * YAML.
9
+ *
10
+ * The stack is deliberately small and neutral — a chain, a deployer, a bundler
11
+ * and a paymaster — because that is the minimum a Keel consumer needs to run
12
+ * ERC-4337 user operations with no hosted provider in the loop.
13
+ */
14
+ /** The reference chain's id (Foundry's default). */
15
+ export declare const LOCAL_CHAIN_ID = 31337;
16
+ /**
17
+ * Foundry's canonical development mnemonic. Every account it derives is public
18
+ * and funded on a local chain only — never point this at anything else.
19
+ */
20
+ export declare const ANVIL_MNEMONIC = "test test test test test test test test test test test junk";
21
+ /** Host ports the compose stack publishes. */
22
+ export declare const DEFAULT_LOCAL_PORTS: {
23
+ readonly anvil: 8545;
24
+ readonly bundler: 4337;
25
+ readonly paymaster: 3000;
26
+ };
27
+ export type StackServiceRole = 'chain' | 'deployer' | 'bundler' | 'paymaster';
28
+ /** One service in the reference stack. */
29
+ export interface StackService {
30
+ name: string;
31
+ image: string;
32
+ role: StackServiceRole;
33
+ /** Host port published by the service, when it exposes one. */
34
+ port?: number;
35
+ /** Services that must be healthy (or completed) first. */
36
+ dependsOn?: readonly string[];
37
+ note: string;
38
+ }
39
+ /** The reference stack, in dependency order. */
40
+ export declare const SELF_HOST_SERVICES: readonly StackService[];
41
+ //# sourceMappingURL=stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../src/stack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,oDAAoD;AACpD,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC;;;GAGG;AACH,eAAO,MAAM,cAAc,gEACoC,CAAC;AAEhE,8CAA8C;AAC9C,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;AAE9E,0CAA0C;AAC1C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,gBAAgB,CAAC;IACvB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gDAAgD;AAChD,eAAO,MAAM,kBAAkB,EAAE,SAAS,YAAY,EA+BrD,CAAC"}
package/dist/stack.js ADDED
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The self-host reference stack, as data.
3
+ *
4
+ * This is the machine-readable mirror of [`infra/docker-compose.yml`](../../../infra/docker-compose.yml):
5
+ * one entry per service, with the same image, port and dependency wiring the
6
+ * compose file declares. Keeping it here lets the endpoint model and the
7
+ * readiness probes share a single, testable description instead of scraping the
8
+ * YAML.
9
+ *
10
+ * The stack is deliberately small and neutral — a chain, a deployer, a bundler
11
+ * and a paymaster — because that is the minimum a Keel consumer needs to run
12
+ * ERC-4337 user operations with no hosted provider in the loop.
13
+ */
14
+ /** The reference chain's id (Foundry's default). */
15
+ export const LOCAL_CHAIN_ID = 31337;
16
+ /**
17
+ * Foundry's canonical development mnemonic. Every account it derives is public
18
+ * and funded on a local chain only — never point this at anything else.
19
+ */
20
+ export const ANVIL_MNEMONIC = 'test test test test test test test test test test test junk';
21
+ /** Host ports the compose stack publishes. */
22
+ export const DEFAULT_LOCAL_PORTS = {
23
+ anvil: 8545,
24
+ bundler: 4337,
25
+ paymaster: 3000,
26
+ };
27
+ /** The reference stack, in dependency order. */
28
+ export const SELF_HOST_SERVICES = [
29
+ {
30
+ name: 'anvil',
31
+ image: 'ghcr.io/foundry-rs/foundry:latest',
32
+ role: 'chain',
33
+ port: 8545,
34
+ note: `local EVM node, chain ${LOCAL_CHAIN_ID}, deterministic dev accounts`,
35
+ },
36
+ {
37
+ name: 'contract-deployer',
38
+ image: 'ghcr.io/pimlicolabs/mock-contract-deployer:main',
39
+ role: 'deployer',
40
+ dependsOn: ['anvil'],
41
+ note: 'one-shot: deploys EntryPoint and the account factories, then exits',
42
+ },
43
+ {
44
+ name: 'bundler',
45
+ image: 'ghcr.io/pimlicolabs/alto:latest',
46
+ role: 'bundler',
47
+ port: 4337,
48
+ dependsOn: ['anvil', 'contract-deployer'],
49
+ note: 'ERC-4337 bundler (Alto), driven by infra/alto-config.json',
50
+ },
51
+ {
52
+ name: 'paymaster',
53
+ image: 'ghcr.io/pimlicolabs/mock-verifying-paymaster:main',
54
+ role: 'paymaster',
55
+ port: 3000,
56
+ dependsOn: ['anvil', 'contract-deployer'],
57
+ note: 'ERC-7677 paymaster service; the mock forwards to the bundler',
58
+ },
59
+ ];
60
+ //# sourceMappingURL=stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.js","sourceRoot":"","sources":["../src/stack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,oDAAoD;AACpD,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GACzB,6DAA6D,CAAC;AAEhE,8CAA8C;AAC9C,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;CACP,CAAC;AAgBX,gDAAgD;AAChD,MAAM,CAAC,MAAM,kBAAkB,GAA4B;IACzD;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,mCAAmC;QAC1C,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,yBAAyB,cAAc,8BAA8B;KAC5E;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,iDAAiD;QACxD,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,CAAC,OAAO,CAAC;QACpB,IAAI,EAAE,oEAAoE;KAC3E;IACD;QACE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,iCAAiC;QACxC,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,CAAC,OAAO,EAAE,mBAAmB,CAAC;QACzC,IAAI,EAAE,2DAA2D;KAClE;IACD;QACE,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,mDAAmD;QAC1D,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,CAAC,OAAO,EAAE,mBAAmB,CAAC;QACzC,IAAI,EAAE,8DAA8D;KACrE;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "@keelcodes/self-host",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Reference self-host stack for Keel: the model, endpoints and readiness probes for a local anvil + bundler + paymaster sandbox.",
5
+ "license": "Apache-2.0",
6
+ "homepage": "https://keel.codes",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/keelcodes/keel.git",
10
+ "directory": "packages/self-host"
11
+ },
12
+ "type": "module",
13
+ "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
25
+ "sideEffects": false,
26
+ "devDependencies": {
27
+ "vitest": "^2.1.4"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "engines": {
33
+ "node": ">=20"
34
+ },
35
+ "keywords": [
36
+ "erc-4337",
37
+ "account-abstraction",
38
+ "bundler",
39
+ "paymaster",
40
+ "anvil",
41
+ "self-host",
42
+ "docker-compose"
43
+ ],
44
+ "scripts": {
45
+ "build": "tsc -p tsconfig.json",
46
+ "typecheck": "tsc -p tsconfig.json --noEmit",
47
+ "test": "vitest run",
48
+ "clean": "rm -rf dist"
49
+ }
6
50
  }