@1001-digital/proxies 0.0.1 → 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/README.md +33 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,6 +6,27 @@ Given a contract address, resolve where the real code lives: one implementation
|
|
|
6
6
|
|
|
7
7
|
Narrow on purpose: this package knows proxy conventions, selectors, and ABIs. Anything richer — Sourcify, NatSpec, repository metadata — is the consumer's concern. Bring your own enricher.
|
|
8
8
|
|
|
9
|
+
## Who this is for
|
|
10
|
+
|
|
11
|
+
Use this package when you need a small, composable proxy-resolution layer in:
|
|
12
|
+
|
|
13
|
+
- explorer and indexer backends
|
|
14
|
+
- contract introspection CLIs
|
|
15
|
+
- ABI fetchers and decoding pipelines
|
|
16
|
+
- developer tooling that needs implementation or facet discovery without owning proxy-specific logic
|
|
17
|
+
|
|
18
|
+
## What this package is not
|
|
19
|
+
|
|
20
|
+
This package intentionally does not try to be:
|
|
21
|
+
|
|
22
|
+
- a contract metadata SDK
|
|
23
|
+
- a verification or source-code retrieval client
|
|
24
|
+
- a recursive proxy resolver
|
|
25
|
+
- an upgrade history tracker
|
|
26
|
+
- an opinionated registry or indexing layer
|
|
27
|
+
|
|
28
|
+
If you need sources, NatSpec, repository metadata, verification status, or custom per-target fields, use `detect()` and own enrichment yourself.
|
|
29
|
+
|
|
9
30
|
## Install
|
|
10
31
|
|
|
11
32
|
```bash
|
|
@@ -153,6 +174,12 @@ Creates a proxies client.
|
|
|
153
174
|
|
|
154
175
|
Each detector returns `null` if the pattern doesn't match; otherwise a `RawProxy`.
|
|
155
176
|
|
|
177
|
+
### Detection tradeoffs
|
|
178
|
+
|
|
179
|
+
- **First match wins** — detector order is intentional. If a contract could satisfy multiple heuristics, `detectProxy` returns the first supported pattern in priority order.
|
|
180
|
+
- **Single-hop resolution** — if a resolved implementation is itself a proxy, detection stops there. Beacon remains supported as a defined two-step pattern.
|
|
181
|
+
- **Error isolation** — one failed RPC probe does not poison the full detection pipeline.
|
|
182
|
+
|
|
156
183
|
### Composition
|
|
157
184
|
|
|
158
185
|
- **`enrichTargets(targets, enricher | null)`** — applies the enricher to each target; ABIs are filtered to live selectors for diamonds, passed through for plain proxies.
|
|
@@ -271,6 +298,12 @@ type TargetEnricher = (address: string) => Promise<TargetEnrichment | null>
|
|
|
271
298
|
- **Single-hop resolution** — if a resolved implementation is itself a proxy, `detectProxy` does not recurse. Beacon stays supported as a defined two-step pattern.
|
|
272
299
|
- **Minimal runtime deps** — only `@noble/hashes` for keccak256.
|
|
273
300
|
|
|
301
|
+
## Example consumers
|
|
302
|
+
|
|
303
|
+
- An explorer backend can call `detect()` to resolve a proxy and then enrich targets from Sourcify or an internal cache.
|
|
304
|
+
- A CLI can call `fetch()` to print the detected pattern, target addresses, and a composite ABI for downstream decoding.
|
|
305
|
+
- An indexing pipeline can treat `detectProxy → enrichTargets → buildCompositeAbi` as a reusable normalization step before storage.
|
|
306
|
+
|
|
274
307
|
## License
|
|
275
308
|
|
|
276
309
|
MIT
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1001-digital/proxies",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Ethereum proxy pattern detection primitives — ERC-2535 diamonds, EIP-1967, EIP-1167, beacon, Safe, EIP-1822, EIP-897. Detect, enrich, compose.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/1001-digital/
|
|
8
|
+
"url": "https://github.com/1001-digital/proxies.git"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
11
11
|
"ethereum",
|