@keelcodes/adapters 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.
Files changed (55) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +172 -2
  3. package/dist/abi.d.ts +84 -0
  4. package/dist/abi.d.ts.map +1 -0
  5. package/dist/abi.js +23 -0
  6. package/dist/abi.js.map +1 -0
  7. package/dist/bundler.d.ts +24 -0
  8. package/dist/bundler.d.ts.map +1 -0
  9. package/dist/bundler.js +22 -0
  10. package/dist/bundler.js.map +1 -0
  11. package/dist/chains.d.ts +41 -0
  12. package/dist/chains.d.ts.map +1 -0
  13. package/dist/chains.js +90 -0
  14. package/dist/chains.js.map +1 -0
  15. package/dist/endpoints.d.ts +62 -0
  16. package/dist/endpoints.d.ts.map +1 -0
  17. package/dist/endpoints.js +50 -0
  18. package/dist/endpoints.js.map +1 -0
  19. package/dist/erc7579.d.ts +17 -0
  20. package/dist/erc7579.d.ts.map +1 -0
  21. package/dist/erc7579.js +43 -0
  22. package/dist/erc7579.js.map +1 -0
  23. package/dist/index.d.ts +37 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +29 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/kernel.d.ts +38 -0
  28. package/dist/kernel.d.ts.map +1 -0
  29. package/dist/kernel.js +44 -0
  30. package/dist/kernel.js.map +1 -0
  31. package/dist/module-probe.d.ts +32 -0
  32. package/dist/module-probe.d.ts.map +1 -0
  33. package/dist/module-probe.js +44 -0
  34. package/dist/module-probe.js.map +1 -0
  35. package/dist/nexus.d.ts +15 -0
  36. package/dist/nexus.d.ts.map +1 -0
  37. package/dist/nexus.js +17 -0
  38. package/dist/nexus.js.map +1 -0
  39. package/dist/paymaster.d.ts +24 -0
  40. package/dist/paymaster.d.ts.map +1 -0
  41. package/dist/paymaster.js +22 -0
  42. package/dist/paymaster.js.map +1 -0
  43. package/dist/registry.d.ts +9 -0
  44. package/dist/registry.d.ts.map +1 -0
  45. package/dist/registry.js +23 -0
  46. package/dist/registry.js.map +1 -0
  47. package/dist/safe7579.d.ts +20 -0
  48. package/dist/safe7579.d.ts.map +1 -0
  49. package/dist/safe7579.js +22 -0
  50. package/dist/safe7579.js.map +1 -0
  51. package/dist/types.d.ts +60 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/types.js +8 -0
  54. package/dist/types.js.map +1 -0
  55. package/package.json +51 -3
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,173 @@
1
- # Temporary Holding Version
1
+ # @keelcodes/adapters
2
+
3
+ Thin adapters that expose different smart-account implementations behind a
4
+ single interface.
5
+
6
+ ## Principle
7
+
8
+ Keel does **not** implement account modules. Every supported account already
9
+ speaks **ERC-7579**:
10
+
11
+ - Safe7579 is itself an adapter that makes Safe ERC-7579 compatible.
12
+ - Kernel (ZeroDev) and Nexus (Biconomy) are ERC-7579 compatible.
13
+
14
+ So supporting three accounts is **one interface plus thin per-account install
15
+ glue**, not three separate stacks.
16
+
17
+ ```
18
+ keel policy (account-agnostic)
19
+ ▲
20
+ ERC-7579 (unified interface)
21
+ ┌──────────────┼──────────────┐
22
+ Kernel Nexus Safe7579
23
+ ```
24
+
25
+ ## Adapters
26
+
27
+ | kind | account | notes |
28
+ |---|---|---|
29
+ | `kernel` | Kernel (ZeroDev) | version-branched validator `initData` (`0.3.0-beta` / `0.3.1`) |
30
+ | `nexus` | Nexus (Biconomy) | standards-faithful, no install-time quirk |
31
+ | `safe7579` | Safe7579 | account must already have Safe7579 enabled |
32
+
33
+ Every adapter shares one ERC-7579 base (`ERC7579AccountAdapter`) and exposes:
34
+
35
+ - `isModuleInstalled({ account, module, moduleType? })` — on-chain probe; returns
36
+ `false` for an undeployed account
37
+ - `encodeInstallModule({ moduleType, module, initData? })`
38
+ - `encodeUninstallModule({ moduleType, module, deInitData? })`
39
+
40
+ Use `createAdapter(kind, { client })` when the account kind is only known at
41
+ runtime, or instantiate a concrete adapter when it is known statically.
42
+
43
+ ```ts
44
+ import { createPublicClient, http } from 'viem';
45
+ import { bsc } from 'viem/chains';
46
+ import { KernelAdapter, MODULE_TYPE } from '@keelcodes/adapters';
47
+
48
+ const client = createPublicClient({ chain: bsc, transport: http() });
49
+ const kernel = new KernelAdapter({ client }); // defaults to Kernel 0.3.1
50
+
51
+ await kernel.isModuleInstalled({ account, module });
52
+
53
+ const initData = kernel.encodeValidatorInstallData(enableData); // Kernel layout
54
+ const call = kernel.encodeInstallModule({
55
+ moduleType: MODULE_TYPE.VALIDATOR,
56
+ module,
57
+ initData,
58
+ });
59
+ // → wrap `call` in the account's execute() inside a UserOp
60
+ ```
61
+
62
+ ## Module probe
63
+
64
+ `createViemModuleProbe(client)` returns the two-sided ERC-7579 probe that
65
+ `@keelcodes/migrate` consumes: `isModuleInstalled` asks the **account** whether a
66
+ module is registered, and `isModuleInitialized` asks the **module** whether it
67
+ stored state for the account. Modules that do not implement `isInitialized`
68
+ revert, so the probe catches that and returns `false` — a silent no-op install
69
+ surfaces as data instead of an exception. The return value is structurally
70
+ compatible with migrate's `ModuleProbe`; the packages stay decoupled (no import
71
+ either way).
72
+
73
+ ```ts
74
+ import { createPublicClient, http } from 'viem';
75
+ import { bsc } from 'viem/chains';
76
+ import { createViemModuleProbe } from '@keelcodes/adapters';
77
+
78
+ const probe = createViemModuleProbe(createPublicClient({ chain: bsc, transport: http() }));
79
+ await probe.isModuleInstalled({ account, module, moduleTypeId: 4n });
80
+ await probe.isModuleInitialized(module, account); // false on revert, never throws
81
+ ```
82
+
83
+ ### Fork drill
84
+
85
+ `pnpm --filter @keelcodes/adapters fork-drill` forks BSC with anvil (port 8546),
86
+ validates the real address book, deploys Keel's own validator, hook and minimal
87
+ account to the fork, and runs the probe positive and negative — no credentials,
88
+ no real transactions. Override the fork source with `BSC_RPC_URL`; the drill
89
+ always tears the fork down and exits non-zero on any failed assertion.
90
+
91
+ ### Migration drill
92
+
93
+ `pnpm --filter @keelcodes/adapters migration-drill` forks BSC with anvil (port
94
+ 8547) and rehearses the path the fork drill does **not** cover: installing Keel
95
+ onto an account that **already exists**, rather than at creation. It creates a
96
+ Rhinestone MSA without the hook, drives the real `@keelcodes/migrate` state
97
+ machine (`routeSession` → `migrateSession`) with the real two-sided probe, then
98
+ hot-installs the hook in a **separate** transaction from the account itself
99
+ (`installModule(4, hook, initData)`), asserts the account address is unchanged,
100
+ and confirms the cut-over only once both probe halves hold. It exits non-zero on
101
+ any failed assertion. (Requires this package and `packages/migrate` built.)
102
+
103
+ Two findings it reports rather than hides:
104
+
105
+ - **The state machine refuses to confirm a migration on absent evidence** —
106
+ `migrateSession` before the install lands in `exception`, never `migrated`.
107
+ - **On accounts that gate module management with their hook** (the MSA's
108
+ `withHook` passes `uninstallModule` calldata to `preCheck`, which only parses
109
+ `execute(...)`), the on-chain **reverse is refused**: the drill attempts it and
110
+ asserts the migrated state is left intact. Kernel does not gate module
111
+ management this way, so a reverse there needs its own rehearsal.
112
+
113
+ ## Bundler & paymaster
114
+
115
+ Bundlers and paymaster services are both addressed **per chain** — ERC-7677 states
116
+ that paymaster service URLs are "not typically multichain" — so adapters resolve an
117
+ endpoint per chain rather than assuming one multichain URL.
118
+
119
+ ```ts
120
+ import { createBundlerAdapter, createPaymasterAdapter, BUNDLER_RPC, PAYMASTER_RPC } from '@keelcodes/adapters';
121
+
122
+ const bundler = createBundlerAdapter('pimlico', { apiKey: process.env.PIMLICO_KEY! });
123
+ bundler.endpoint({ chainId: 56 }).url; // https://api.pimlico.io/v2/56/rpc?apikey=...
124
+ BUNDLER_RPC.sendUserOperation; // 'eth_sendUserOperation'
125
+
126
+ const paymaster = createPaymasterAdapter('alchemy', { urls: { 8453: 'https://…/paymaster' } });
127
+ paymaster.endpoint({ chainId: 8453 }).url;
128
+ PAYMASTER_RPC.getPaymasterStubData; // 'pm_getPaymasterStubData'
129
+ ```
130
+
131
+ Endpoint precedence is `urls[chainId]` → `url` → provider builder, and a missing
132
+ endpoint throws rather than dialling the wrong host.
133
+
134
+ Keel hardcodes a URL builder **only for Pimlico** (a stable, public layout); every
135
+ other provider's endpoint is caller-supplied, so a provider re-sharding its URL can
136
+ never silently break a consumer. Adapters resolve endpoints only — they do **not**
137
+ implement the JSON-RPC calls.
138
+
139
+ ## Chains
140
+
141
+ `chains.ts` is the single source of truth for which chains Keel ships defaults
142
+ for and which account kinds run on them. The per-chain `accountKinds` are
143
+ derived from the per-account chain sets, so the two can never drift.
144
+
145
+ `DEFAULT_CHAIN_ID` is **BSC mainnet** — the primary launch chain, and the chain
146
+ the fleet is deployed on. Testnets remain in the per-account chain sets but are
147
+ no longer the default.
148
+
149
+ ```ts
150
+ import { DEFAULT_CHAIN_ID, accountsFor, getChain } from '@keelcodes/adapters';
151
+
152
+ getChain(DEFAULT_CHAIN_ID); // { chainId: 56, name: 'BNB Smart Chain', testnet: false, accountKinds: ['kernel', 'safe7579'] }
153
+ accountsFor(8453); // ['kernel', 'nexus', 'safe7579']
154
+ ```
155
+
156
+ `getChain` / `accountsFor` throw on an unknown chain rather than returning a
157
+ partial default, so a typo surfaces as a config error.
158
+
159
+ ## Status
160
+
161
+ - ✅ Account adapters (Kernel / Nexus / Safe7579)
162
+ - ✅ Bundler endpoint adapters (Pimlico, Alchemy, CDP, Skandha, Rundler, MegaFuel)
163
+ - ✅ Paymaster endpoint adapters (ERC-7677: Pimlico, Alchemy, CDP, MegaFuel)
164
+ - ✅ Multi-chain configuration helper (`CHAINS` / `getChain` / `accountsFor`)
165
+
166
+ Pre-alpha. The public API is not stable yet.
167
+
168
+ ## Out of scope
169
+
170
+ - Account module implementations
171
+ - Bundler or paymaster implementations
172
+ - Custody, billing, multi-tenancy
2
173
 
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.
package/dist/abi.d.ts ADDED
@@ -0,0 +1,84 @@
1
+ /**
2
+ * ERC-7579 account module-manager surface, shared by Kernel, Nexus and
3
+ * Safe7579. All three speak this exact ABI, which is why Keel needs a single
4
+ * base implementation plus three thin account-specific shims.
5
+ */
6
+ export declare const erc7579AccountAbi: readonly [{
7
+ readonly name: "isModuleInstalled";
8
+ readonly type: "function";
9
+ readonly stateMutability: "view";
10
+ readonly inputs: readonly [{
11
+ readonly type: "uint256";
12
+ readonly name: "moduleTypeId";
13
+ }, {
14
+ readonly type: "address";
15
+ readonly name: "module";
16
+ }, {
17
+ readonly type: "bytes";
18
+ readonly name: "additionalContext";
19
+ }];
20
+ readonly outputs: readonly [{
21
+ readonly type: "bool";
22
+ }];
23
+ }, {
24
+ readonly name: "installModule";
25
+ readonly type: "function";
26
+ readonly stateMutability: "nonpayable";
27
+ readonly inputs: readonly [{
28
+ readonly type: "uint256";
29
+ readonly name: "moduleTypeId";
30
+ }, {
31
+ readonly type: "address";
32
+ readonly name: "module";
33
+ }, {
34
+ readonly type: "bytes";
35
+ readonly name: "initData";
36
+ }];
37
+ readonly outputs: readonly [];
38
+ }, {
39
+ readonly name: "uninstallModule";
40
+ readonly type: "function";
41
+ readonly stateMutability: "nonpayable";
42
+ readonly inputs: readonly [{
43
+ readonly type: "uint256";
44
+ readonly name: "moduleTypeId";
45
+ }, {
46
+ readonly type: "address";
47
+ readonly name: "module";
48
+ }, {
49
+ readonly type: "bytes";
50
+ readonly name: "deInitData";
51
+ }];
52
+ readonly outputs: readonly [];
53
+ }];
54
+ /**
55
+ * The ERC-7579 `IModule` surface a module exposes about itself. `isInitialized`
56
+ * is the module-side half of the migration probe: it reports whether the module
57
+ * actually stored state for an account during `onInstall`, which is the fact an
58
+ * AA24-class silent no-op install gets wrong while `isModuleInstalled` on the
59
+ * account still returns true.
60
+ */
61
+ export declare const erc7579ModuleAbi: readonly [{
62
+ readonly name: "isInitialized";
63
+ readonly type: "function";
64
+ readonly stateMutability: "view";
65
+ readonly inputs: readonly [{
66
+ readonly type: "address";
67
+ readonly name: "smartAccount";
68
+ }];
69
+ readonly outputs: readonly [{
70
+ readonly type: "bool";
71
+ }];
72
+ }, {
73
+ readonly name: "isModuleType";
74
+ readonly type: "function";
75
+ readonly stateMutability: "view";
76
+ readonly inputs: readonly [{
77
+ readonly type: "uint256";
78
+ readonly name: "moduleTypeId";
79
+ }];
80
+ readonly outputs: readonly [{
81
+ readonly type: "bool";
82
+ }];
83
+ }];
84
+ //# sourceMappingURL=abi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI5B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;EAG3B,CAAC"}
package/dist/abi.js ADDED
@@ -0,0 +1,23 @@
1
+ import { parseAbi } from 'viem';
2
+ /**
3
+ * ERC-7579 account module-manager surface, shared by Kernel, Nexus and
4
+ * Safe7579. All three speak this exact ABI, which is why Keel needs a single
5
+ * base implementation plus three thin account-specific shims.
6
+ */
7
+ export const erc7579AccountAbi = parseAbi([
8
+ 'function isModuleInstalled(uint256 moduleTypeId, address module, bytes additionalContext) view returns (bool)',
9
+ 'function installModule(uint256 moduleTypeId, address module, bytes initData)',
10
+ 'function uninstallModule(uint256 moduleTypeId, address module, bytes deInitData)',
11
+ ]);
12
+ /**
13
+ * The ERC-7579 `IModule` surface a module exposes about itself. `isInitialized`
14
+ * is the module-side half of the migration probe: it reports whether the module
15
+ * actually stored state for an account during `onInstall`, which is the fact an
16
+ * AA24-class silent no-op install gets wrong while `isModuleInstalled` on the
17
+ * account still returns true.
18
+ */
19
+ export const erc7579ModuleAbi = parseAbi([
20
+ 'function isInitialized(address smartAccount) view returns (bool)',
21
+ 'function isModuleType(uint256 moduleTypeId) view returns (bool)',
22
+ ]);
23
+ //# sourceMappingURL=abi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abi.js","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACxC,+GAA+G;IAC/G,8EAA8E;IAC9E,kFAAkF;CACnF,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACvC,kEAAkE;IAClE,iEAAiE;CAClE,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { type EndpointResolver, type EndpointResolverOptions } from './endpoints.js';
2
+ /** Bundler providers Keel ships endpoint glue for. */
3
+ export type BundlerKind = 'pimlico' | 'alchemy' | 'cdp' | 'skandha' | 'rundler' | 'megafuel';
4
+ /** Standard ERC-4337 bundler JSON-RPC methods. */
5
+ export declare const BUNDLER_RPC: {
6
+ readonly sendUserOperation: "eth_sendUserOperation";
7
+ readonly estimateUserOperationGas: "eth_estimateUserOperationGas";
8
+ readonly getUserOperationReceipt: "eth_getUserOperationReceipt";
9
+ readonly getUserOperationByHash: "eth_getUserOperationByHash";
10
+ readonly supportedEntryPoints: "eth_supportedEntryPoints";
11
+ };
12
+ /** Resolves the bundler endpoint for a chain. */
13
+ export type BundlerAdapter = EndpointResolver<BundlerKind>;
14
+ export type BundlerAdapterOptions = EndpointResolverOptions;
15
+ /**
16
+ * Builds a bundler adapter. Only `pimlico` has a built-in URL builder (see
17
+ * {@link pimlicoUrl}); every other kind requires an explicit `url`/`urls`,
18
+ * because their endpoints are account- or deployment-specific.
19
+ *
20
+ * The adapter resolves endpoints only — it does not implement the bundler RPC.
21
+ * {@link BUNDLER_RPC} provides the method names to call against the endpoint.
22
+ */
23
+ export declare function createBundlerAdapter(kind: BundlerKind, options: BundlerAdapterOptions): BundlerAdapter;
24
+ //# sourceMappingURL=bundler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../src/bundler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzH,sDAAsD;AACtD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAE7F,kDAAkD;AAClD,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC;AAEX,iDAAiD;AACjD,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAE3D,MAAM,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAE5D;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,qBAAqB,GAC7B,cAAc,CAGhB"}
@@ -0,0 +1,22 @@
1
+ import { createEndpointResolver, pimlicoUrl } from './endpoints.js';
2
+ /** Standard ERC-4337 bundler JSON-RPC methods. */
3
+ export const BUNDLER_RPC = {
4
+ sendUserOperation: 'eth_sendUserOperation',
5
+ estimateUserOperationGas: 'eth_estimateUserOperationGas',
6
+ getUserOperationReceipt: 'eth_getUserOperationReceipt',
7
+ getUserOperationByHash: 'eth_getUserOperationByHash',
8
+ supportedEntryPoints: 'eth_supportedEntryPoints',
9
+ };
10
+ /**
11
+ * Builds a bundler adapter. Only `pimlico` has a built-in URL builder (see
12
+ * {@link pimlicoUrl}); every other kind requires an explicit `url`/`urls`,
13
+ * because their endpoints are account- or deployment-specific.
14
+ *
15
+ * The adapter resolves endpoints only — it does not implement the bundler RPC.
16
+ * {@link BUNDLER_RPC} provides the method names to call against the endpoint.
17
+ */
18
+ export function createBundlerAdapter(kind, options) {
19
+ const fallback = kind === 'pimlico' ? pimlicoUrl : undefined;
20
+ return createEndpointResolver(kind, options, fallback);
21
+ }
22
+ //# sourceMappingURL=bundler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler.js","sourceRoot":"","sources":["../src/bundler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAuD,MAAM,gBAAgB,CAAC;AAKzH,kDAAkD;AAClD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,iBAAiB,EAAE,uBAAuB;IAC1C,wBAAwB,EAAE,8BAA8B;IACxD,uBAAuB,EAAE,6BAA6B;IACtD,sBAAsB,EAAE,4BAA4B;IACpD,oBAAoB,EAAE,0BAA0B;CACxC,CAAC;AAOX;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAiB,EACjB,OAA8B;IAE9B,MAAM,QAAQ,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7D,OAAO,sBAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { AccountKind } from './types.js';
2
+ /** Well-known chain ids referenced by the default adapter chain sets. */
3
+ export declare const CHAIN_ID: {
4
+ readonly ethereum: 1;
5
+ readonly sepolia: 11155111;
6
+ readonly bsc: 56;
7
+ readonly bscTestnet: 97;
8
+ readonly base: 8453;
9
+ readonly baseSepolia: 84532;
10
+ readonly arbitrum: 42161;
11
+ readonly optimism: 10;
12
+ readonly polygon: 137;
13
+ };
14
+ /**
15
+ * Default chain sets. BSC leads the Kernel set because BSC is Keel's primary
16
+ * launch chain; the others are kept for the standard account/ecosystem spread.
17
+ */
18
+ export declare const KERNEL_CHAIN_IDS: readonly number[];
19
+ export declare const NEXUS_CHAIN_IDS: readonly number[];
20
+ export declare const SAFE7579_CHAIN_IDS: readonly number[];
21
+ /** A chain Keel ships defaults for, plus the account kinds supported there. */
22
+ export interface ChainInfo {
23
+ readonly chainId: number;
24
+ readonly name: string;
25
+ readonly testnet: boolean;
26
+ /** Account implementations known to support this chain. */
27
+ readonly accountKinds: readonly AccountKind[];
28
+ }
29
+ /** Keel's default chain: BSC mainnet — the primary launch chain, and the one the
30
+ * fleet is actually deployed on. Testnets stay in the chain sets below but are
31
+ * no longer the default. */
32
+ export declare const DEFAULT_CHAIN_ID: number;
33
+ /** Every chain Keel ships defaults for, with the account kinds supported there. */
34
+ export declare const CHAINS: readonly ChainInfo[];
35
+ /** Whether Keel ships defaults for `chainId`. */
36
+ export declare function isChainSupported(chainId: number): boolean;
37
+ /** Chain metadata for `chainId`; throws rather than returning a partial default. */
38
+ export declare function getChain(chainId: number): ChainInfo;
39
+ /** Account kinds supported on `chainId`; throws for an unsupported chain. */
40
+ export declare function accountsFor(chainId: number): readonly AccountKind[];
41
+ //# sourceMappingURL=chains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../src/chains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,yEAAyE;AACzE,eAAO,MAAM,QAAQ;;;;;;;;;;CAUX,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAO7C,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAO5C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAO/C,CAAC;AAEF,+EAA+E;AAC/E,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,CAAC;CAC/C;AAED;;6BAE6B;AAC7B,eAAO,MAAM,gBAAgB,EAAE,MAAqB,CAAC;AAwBrD,mFAAmF;AACnF,eAAO,MAAM,MAAM,EAAE,SAAS,SAAS,EAGpC,CAAC;AAIJ,iDAAiD;AACjD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,oFAAoF;AACpF,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAMnD;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,WAAW,EAAE,CAEnE"}