@reinconsole/erc8004 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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rein contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # @reinconsole/erc8004
2
+
3
+ [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) registry integration for **[Rein](https://github.com/bugiiiii11/rein)** — on-chain agent identity and reputation. Reads identity facts from the ratified Identity Registry (an ERC-721; tokenId = the spec's agentId) and turns them into link facts for [`@reinconsole/graph`](https://www.npmjs.com/package/@reinconsole/graph); publishes Rein's graph-derived scores on-chain through the Reputation Registry's `giveFeedback`.
4
+
5
+ > **Status: v0.1 — early open-source infrastructure, live on testnet.** Verified against the real singleton deployments on Base Sepolia — including a live registration (agentId 7393) carrying its rein-score on-chain. APIs may change before 1.0.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @reinconsole/erc8004
11
+ ```
12
+
13
+ ## What's in it
14
+
15
+ ```ts
16
+ import {
17
+ identityRegistryReader, // viem-backed IdentityRegistryReader (ownerOf / agentWallet / agentURI)
18
+ registerAgent, // the write path: simulate → write → decode the Registered event
19
+ linkAgentFromRegistry, // registry facts → graph link facts (agents become erc8004-canonical)
20
+ linkVendorFromRegistry, // vendors stay host-canonical; identity + treasury fold into the host row
21
+ publishAgentScore, // graph score → giveFeedback on the Reputation Registry, evidence anchored
22
+ readSummary, // on-chain score summary (resolves getClients first — see below)
23
+ MockIdentityRegistry, MockReputationRegistry, // in-memory twins for every offline path
24
+ } from '@reinconsole/erc8004';
25
+ ```
26
+
27
+ - **One identity, one history.** A registered agent's reputation keys by the canonical id `eip155:{chainId}:{registry}/{tokenId}` (formatted by `@reinconsole/core`); its local id and every wallet — `ownerOf`, the verified `agentWallet` — fold in as aliases. Two deployments claiming the same registration merge into one history; key rotation never splits a score.
28
+ - **Foreign-registry guard.** A document naming another chain's or another registry's id is never resolved against ours; stale docs degrade to local linking (lenient), network errors stay loud — a dead RPC is never misread as "not registered".
29
+ - **Scores go on-chain.** `scoreToFeedback` maps a 0–100 graph score to `giveFeedback` (value at decimals 0, `rein-score` tag, confidence tag); evidence documents are keccak-anchored self-verifying `data:` URIs — nothing to host.
30
+ - **Deployment-verified quirks handled.** `getAgentWallet` returns the zero address rather than reverting; the live Base Sepolia Reputation Registry requires an explicit client list for `getSummary` (`readSummary` resolves `getClients` first). Both learned against the real contracts, not the repo source.
31
+ - **Offline twins included.** `MockIdentityRegistry` / `MockReputationRegistry` mirror the deployed semantics (1-based feedback indexes, self-feedback ban, zero-address fidelity) for tests and demos.
32
+
33
+ Singleton deployment addresses ship as constants (`BASE_SEPOLIA_REGISTRY`, `IDENTITY_REGISTRY_MAINNET`, `BASE_SEPOLIA_REPUTATION`, …).
34
+
35
+ MIT © Rein contributors · [Repository](https://github.com/bugiiiii11/rein) · [Issues](https://github.com/bugiiiii11/rein/issues)