{"_id":"@credit-cooperative/address-book","_rev":"5-1deb3256e5cae44b0a9cf047fbaafbbe","name":"@credit-cooperative/address-book","dist-tags":{"latest":"0.5.0"},"versions":{"0.1.0":{"name":"@credit-cooperative/address-book","version":"0.1.0","keywords":["address-book","blockchain","credit-cooperative","deployments","ethereum","foundry","solidity"],"author":{"url":"https://app.creditcoop.xyz","name":"credit-cooperative"},"_id":"@credit-cooperative/address-book@0.1.0","maintainers":[{"name":"ir-creditcoop","email":"ivo@creditcoop.xyz"},{"name":"nz-creditcoop","email":"neil@creditcoop.xyz"},{"name":"audichya","email":"surbhi@creditcoop.xyz"},{"name":"mostarz","email":"mo@creditcoop.xyz"}],"homepage":"https://github.com/credit-cooperative/address-book#readme","bugs":{"url":"https://github.com/credit-cooperative/address-book/issues"},"dist":{"shasum":"e836da9e584ad1a6d8b6fd32330629a930d02ef7","tarball":"https://registry.npmjs.org/@credit-cooperative/address-book/-/address-book-0.1.0.tgz","fileCount":8,"integrity":"sha512-odsLfwvvxUAvvbeoymPPROOBbq71A/Djzf+DQNK+16yfRsQlvKFNnTr5rDBX5tLqouSPjKDz/cdmiwUr22OVdQ==","signatures":[{"sig":"MEQCIFAQKusf0ggA6phj5Ho9cS2LVceuOcfHgI5cFxjU/xCuAiBoEzrHKecvtUw6nN2HyFpUK2wBeEOjivlVRHRbVP8/RA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9097},"main":"ts/index.ts","type":"module","types":"ts/index.ts","module":"ts/index.ts","exports":{".":"./ts/index.ts"},"gitHead":"ea6a2d36ce66c4dc4767500d2fd427c0b47abeb6","private":false,"scripts":{"setup":"husky","prepack":"bun scripts/generate.ts --check","generate":"bun scripts/generate.ts","generate:check":"bun scripts/generate.ts --check"},"_npmUser":{"name":"audichya","email":"surbhi@creditcoop.xyz"},"repository":{"url":"git+https://github.com/credit-cooperative/address-book.git","type":"git"},"_npmVersion":"11.6.2","description":"Canonical registry of Credit Cooperative deployed contract addresses for Solidity and TypeScript","directories":{},"_nodeVersion":"25.2.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"viem":"^2.52.2","husky":"^9.1","solhint":"^6.0","prettier":"^3.5","forge-std":"github:foundry-rs/forge-std#v1.10.0","lint-staged":"^16.1","@credit-cooperative/devkit":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/address-book_0.1.0_1781639762781_0.9443290155291495","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@credit-cooperative/address-book","version":"0.2.0","keywords":["address-book","blockchain","credit-cooperative","deployments","ethereum","foundry","solidity"],"author":{"url":"https://app.creditcoop.xyz","name":"credit-cooperative"},"_id":"@credit-cooperative/address-book@0.2.0","maintainers":[{"name":"ir-creditcoop","email":"ivo@creditcoop.xyz"},{"name":"nz-creditcoop","email":"neil@creditcoop.xyz"},{"name":"audichya","email":"surbhi@creditcoop.xyz"},{"name":"mostarz","email":"mo@creditcoop.xyz"}],"homepage":"https://github.com/credit-cooperative/address-book#readme","bugs":{"url":"https://github.com/credit-cooperative/address-book/issues"},"dist":{"shasum":"0ffce5c2b0dea40d8e88ea3720a47fccda386831","tarball":"https://registry.npmjs.org/@credit-cooperative/address-book/-/address-book-0.2.0.tgz","fileCount":9,"integrity":"sha512-i0yHQeHdApLQbHlkPB7K80RpkKIoPydKS4fUQ1rlsnyAy+tUr3DQhokggkpTHUFuiZWgcV/ZgUvlDvGtUks6DA==","signatures":[{"sig":"MEUCIHKZ9K76RHMJrs0Y5++HfDwtzoerEB7+VEtByv3JI2e6AiEA1w7sO9+LErGDsEf9YbTiMmnF9gCnTQXHB+9QwTSQ4h4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9111},"main":"ts/index.ts","type":"module","types":"ts/index.ts","module":"ts/index.ts","exports":{".":"./ts/index.ts"},"gitHead":"0eb61586d927d0f9146f371a2fd1fe7e7ad99cb6","private":false,"scripts":{"setup":"husky","prepack":"bun scripts/generate.ts --check","generate":"bun scripts/generate.ts","generate:check":"bun scripts/generate.ts --check"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ffc09816-c835-4383-8f33-e60d62ecf7a6"}},"repository":{"url":"git+https://github.com/credit-cooperative/address-book.git","type":"git"},"_npmVersion":"11.18.0","description":"Canonical registry of Credit Cooperative deployed contract addresses for Solidity and TypeScript","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"viem":"^2.52.2","husky":"^9.1","solhint":"^6.0","prettier":"^3.5","forge-std":"github:foundry-rs/forge-std#v1.10.0","lint-staged":"^16.1","@credit-cooperative/devkit":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/address-book_0.2.0_1782846101542_0.9984267863794849","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@credit-cooperative/address-book","version":"0.3.0","keywords":["address-book","blockchain","credit-cooperative","deployments","ethereum","foundry","solidity"],"author":{"url":"https://app.creditcoop.xyz","name":"credit-cooperative"},"_id":"@credit-cooperative/address-book@0.3.0","maintainers":[{"name":"ir-creditcoop","email":"ivo@creditcoop.xyz"},{"name":"nz-creditcoop","email":"neil@creditcoop.xyz"},{"name":"audichya","email":"surbhi@creditcoop.xyz"},{"name":"mostarz","email":"mo@creditcoop.xyz"}],"homepage":"https://github.com/credit-cooperative/address-book#readme","bugs":{"url":"https://github.com/credit-cooperative/address-book/issues"},"dist":{"shasum":"d81b6ea1f541cfd68971642c10b2c3c71f082a71","tarball":"https://registry.npmjs.org/@credit-cooperative/address-book/-/address-book-0.3.0.tgz","fileCount":11,"integrity":"sha512-QG90zOw0nMlFE646duw9r526af1wdgLl7pfH/mCq8zbfeZxLSlWEtZ1hovBGMwVMYS7CtDj0QOVaaQmBuAI2ng==","signatures":[{"sig":"MEYCIQCLg1yGfAx0rXGQ/WJglfg4R5PXhNRSP+VmozM16yLQggIhAI1DMW4LAK5re4l0tqobeODaIBZjwnFSiGbMT/zTTmqe","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17030},"main":"ts/index.ts","type":"module","types":"ts/index.ts","module":"ts/index.ts","exports":{".":"./ts/index.ts"},"gitHead":"fd268aff1af92caea70227160f420f57ec052fb2","private":false,"scripts":{"setup":"husky","prepack":"bun scripts/generate.ts --check","generate":"bun scripts/generate.ts","generate:check":"bun scripts/generate.ts --check"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ffc09816-c835-4383-8f33-e60d62ecf7a6"}},"repository":{"url":"git+https://github.com/credit-cooperative/address-book.git","type":"git"},"_npmVersion":"11.18.0","description":"Canonical registry of Credit Cooperative deployed contract addresses for Solidity and TypeScript","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"viem":"^2.52.2","husky":"^9.1","solhint":"^6.0","prettier":"^3.5","forge-std":"github:foundry-rs/forge-std#v1.10.0","lint-staged":"^16.1","@credit-cooperative/devkit":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/address-book_0.3.0_1782856844727_0.7253249810947522","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@credit-cooperative/address-book","version":"0.4.0","keywords":["address-book","blockchain","credit-cooperative","deployments","ethereum","foundry","solidity"],"author":{"url":"https://app.creditcoop.xyz","name":"credit-cooperative"},"_id":"@credit-cooperative/address-book@0.4.0","maintainers":[{"name":"ir-creditcoop","email":"ivo@creditcoop.xyz"},{"name":"nz-creditcoop","email":"neil@creditcoop.xyz"},{"name":"audichya","email":"surbhi@creditcoop.xyz"},{"name":"mostarz","email":"mo@creditcoop.xyz"}],"homepage":"https://github.com/credit-cooperative/address-book#readme","bugs":{"url":"https://github.com/credit-cooperative/address-book/issues"},"dist":{"shasum":"6a1e1bf8a909b08bdf04fa2edd58a8c5ddbb2751","tarball":"https://registry.npmjs.org/@credit-cooperative/address-book/-/address-book-0.4.0.tgz","fileCount":31,"integrity":"sha512-HY63gBxjAZWjcYaTNReB3hAhiVep6+d84bGcOsNI1hf/2Lz7cAB9G8Vgc5Sx5fCGIQbdgYL+BwzKix0fZ8djwQ==","signatures":[{"sig":"MEQCIDsSGo/M/hHLN4N4rGzSXgnJX2unyIx2cE1vp+ZJFPi2AiBOGdp/LxhT146/NSAdAEdgPzjil3VBEVCpVIQ5sk6+3w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":340476},"main":"ts/index.ts","type":"module","types":"ts/index.ts","module":"ts/index.ts","exports":{".":"./ts/index.ts","./abis":"./ts/abis.ts"},"gitHead":"a80662a6cca721f6fd750b9a4485c40eb72f1d43","private":false,"scripts":{"setup":"husky","prepack":"bun scripts/generate.ts --check","generate":"bun scripts/generate.ts","generate:check":"bun scripts/generate.ts --check"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ffc09816-c835-4383-8f33-e60d62ecf7a6"}},"repository":{"url":"git+https://github.com/credit-cooperative/address-book.git","type":"git"},"_npmVersion":"11.18.0","description":"Canonical registry of Credit Cooperative deployed contract addresses for Solidity and TypeScript","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"viem":"^2.52.2","husky":"^9.1","solhint":"^6.0","prettier":"^3.5","forge-std":"github:foundry-rs/forge-std#v1.10.0","lint-staged":"^16.1","@credit-cooperative/devkit":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/address-book_0.4.0_1782987432212_0.7793270512353287","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@credit-cooperative/address-book","description":"Canonical registry of Credit Cooperative deployed contract addresses for Solidity and TypeScript","private":false,"version":"0.5.0","author":{"name":"credit-cooperative","url":"https://app.creditcoop.xyz"},"type":"module","main":"ts/index.ts","module":"ts/index.ts","types":"ts/index.ts","exports":{".":"./ts/index.ts","./abis":"./ts/abis.ts","./resolve":"./ts/resolve.ts"},"devDependencies":{"@credit-cooperative/devkit":"^1.0.0","forge-std":"github:foundry-rs/forge-std#v1.10.0","husky":"^9.1","lint-staged":"^16.1","prettier":"^3.5","solhint":"^6.0","viem":"^2.52.2"},"keywords":["address-book","blockchain","credit-cooperative","deployments","ethereum","foundry","solidity"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/credit-cooperative/address-book.git"},"scripts":{"generate":"bun scripts/generate.ts","generate:check":"bun scripts/generate.ts --check","prepack":"bun scripts/generate.ts --check","setup":"husky"},"gitHead":"fe5607061890694c2a0c17268b430bad9290f15e","_id":"@credit-cooperative/address-book@0.5.0","bugs":{"url":"https://github.com/credit-cooperative/address-book/issues"},"homepage":"https://github.com/credit-cooperative/address-book#readme","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-zpXe7y/6nFPVnvZOCNrN/ljUmlp6HQkWpTC7J685voK2cmZPRsuou+/crrtoT7T4WzVZyh7LuqCKcg3XKgGlug==","shasum":"7d120fdc902a04248a9588975278f0fcbf18a35f","tarball":"https://registry.npmjs.org/@credit-cooperative/address-book/-/address-book-0.5.0.tgz","fileCount":37,"unpackedSize":414802,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDVdS66gXoMl0BokgB6z7OxcBZOV3XLWpZbzYLonWK5WgIgVhJg9F3smVwJOps8NtgnI+43sqvVQ55ttOOWzFJeDNo="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ffc09816-c835-4383-8f33-e60d62ecf7a6"}},"directories":{},"maintainers":[{"name":"ir-creditcoop","email":"ivo@creditcoop.xyz"},{"name":"nz-creditcoop","email":"neil@creditcoop.xyz"},{"name":"audichya","email":"surbhi@creditcoop.xyz"},{"name":"mostarz","email":"mo@creditcoop.xyz"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/address-book_0.5.0_1783551437432_0.37916475245714176"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-16T19:56:02.546Z","modified":"2026-07-08T22:57:17.762Z","0.1.0":"2026-06-16T19:56:02.915Z","0.2.0":"2026-06-30T19:01:41.687Z","0.3.0":"2026-06-30T22:00:44.882Z","0.4.0":"2026-07-02T10:17:12.405Z","0.5.0":"2026-07-08T22:57:17.579Z"},"bugs":{"url":"https://github.com/credit-cooperative/address-book/issues"},"author":{"name":"credit-cooperative","url":"https://app.creditcoop.xyz"},"homepage":"https://github.com/credit-cooperative/address-book#readme","keywords":["address-book","blockchain","credit-cooperative","deployments","ethereum","foundry","solidity"],"repository":{"type":"git","url":"git+https://github.com/credit-cooperative/address-book.git"},"description":"Canonical registry of Credit Cooperative deployed contract addresses for Solidity and TypeScript","maintainers":[{"name":"ir-creditcoop","email":"ivo@creditcoop.xyz"},{"name":"nz-creditcoop","email":"neil@creditcoop.xyz"},{"name":"audichya","email":"surbhi@creditcoop.xyz"},{"name":"mostarz","email":"mo@creditcoop.xyz"}],"readme":"# Credit Cooperative Address Book\n\n[![License: MIT][license-badge]][license]\n\n[license]: https://opensource.org/licenses/MIT\n[license-badge]: https://img.shields.io/badge/License-MIT-blue.svg\n\nThe canonical registry of Credit Cooperative deployed contract addresses, for use in both Solidity and\nTypeScript/JavaScript projects. It aggregates the per-chain deployment registries that each protocol repo\ncommits under `deployments/<chainId>.json` (produced by [`@credit-cooperative/devkit`](https://github.com/credit-cooperative/devkit))\nand republishes them as typed, per-chain libraries.\n\n## What's inside\n\n- **`data/<project>/<chainId>.json`** — the source registries, mirrored from each protocol repo. **This is the\n  input.** Everything else is generated from it.\n- **`data/<project>/abis/<Contract>.json`** — chain-independent ABIs, exported as typed `as const` values from\n  `ts/abis.ts` (`@credit-cooperative/address-book/abis`).\n- **`data/<project>/facility-types.json`** — `facilityType()` string → ABI contract name (e.g. `\"RCF\"` →\n  `\"RCFFacility\"`), for identifying factory-created facilities at runtime.\n- **`data/<project>/instances/<chainId>.json`** — factory-created facility/servicing instances discovered\n  on-chain by `bun scripts/sync-instances.ts` (Aave-style static enumeration; only as fresh as the last sync).\n- **`src/<Project><Chain>.sol`** — generated Solidity libraries of `address` constants (e.g.\n  `V3ProtocolPaymentRailsSepolia`, `V3ProtocolPaymentRailsBase`).\n- **`ts/index.ts`** — generated TypeScript twin (chain-keyed address maps + `getAddress`/`getContract` helpers,\n  plus the `facilityTypes` and `instances` maps, no runtime deps).\n- **`ts/resolve.ts`** — hand-written runtime resolver (`@credit-cooperative/address-book/resolve`): identify an\n  arbitrary address and pair it with its ABI.\n\n> `src/` and `ts/` are **generated and committed**. Do not hand-edit them — run `bun run generate`. CI fails if\n> they drift from `data/`.\n\n## Usage\n\n### Solidity (`forge install`)\n\n```sh\nforge install credit-cooperative/address-book\n```\n\n```solidity\nimport { V3ProtocolPaymentRailsSepolia } from \"address-book/src/V3ProtocolPaymentRailsSepolia.sol\";\n\ncontract MyContract {\n    address node = V3ProtocolPaymentRailsSepolia.NODE;\n}\n```\n\n### TypeScript (npm)\n\n```sh\nbun add @credit-cooperative/address-book\n```\n\n```ts\nimport {\n  v3ProtocolPaymentRails,\n  getAddress,\n} from \"@credit-cooperative/address-book\";\n\nconst node = v3ProtocolPaymentRails[11155111].Node;\nconst cowSwap = getAddress(\"v3ProtocolPaymentRails\", 8453, \"CowSwapModule\");\n```\n\n### ABIs\n\n```ts\nimport { v3ProtocolDeploymentMarketplaceAbi } from \"@credit-cooperative/address-book/abis\";\nimport { getContract } from \"@credit-cooperative/address-book\";\n\nconst marketplace = getContract(\n  \"v3ProtocolDeployment\",\n  11155111,\n  \"Marketplace\",\n); // { address, abi }\n```\n\n### Identifying a contract from just its address\n\nFacilities (`RCFFacility`, `TLAFacility`, `TieredFacility`, `DDTLFacility`) and `Servicing` contracts are\ndeployed per-deal by factories, so they are not in the static address maps. Two complementary mechanisms:\n\n1. **Static instance registry** — `bun scripts/sync-instances.ts --chain <id>` scans the `OnboardingHub`'s\n   `FactorySet`/`FacilityDeployed`/`ServicingCreated` events into `data/<project>/instances/<chainId>.json`\n   (facilities, servicings, and factory addresses), which `bun run generate` emits as the `instances` map.\n   Known deals then resolve offline. The scan stays `--confirmations` blocks (default 15) behind the head so\n   reorgs cannot commit phantom entries.\n2. **Runtime resolver** — for addresses deployed since the last sync, `resolveContract` probes the contract's\n   `facilityType()` on-chain and picks the matching ABI. Factories expose `facilityType()` too, so a\n   follow-up `borrower()` probe (facility-only) distinguishes `kind: \"facility\"` from `kind: \"factory\"`.\n\n```ts\nimport {\n  resolveContract,\n  reverseLookup,\n} from \"@credit-cooperative/address-book/resolve\";\n\n// Offline (static book + synced instances only):\nconst known = reverseLookup(11155111, \"0x…\");\n\n// Full resolution — any viem PublicClient works as the client:\nconst resolved = await resolveContract(publicClient, 11155111, \"0x…\");\n// -> { kind: \"singleton\" | \"facility\" | \"factory\" | \"servicing\" | \"unknown\", name?, abi?, ... }\n```\n\nThe resolver has no runtime dependencies; the client just needs an EIP-1193 `request` supporting `eth_call`.\n`Servicing` has no `facilityType()`, so it is detected via the Servicing-unique `totalAdvancedValue()` probe —\nor, more strictly, pass `{ borrower }` to confirm via `OnboardingHub.servicingOf(borrower)` (on chains where\nthe hub is not in the book, this falls back to the heuristic probe).\n\nTwo caveats:\n\n- On-chain reverts mean \"not this contract type\"; **transport/RPC failures are re-thrown** — a rate-limited\n  endpoint never comes back as `kind: \"unknown\"`.\n- `abi` is `undefined` when the address book ships no ABI for that contract — check it before use. (All\n  current projects ship ABIs; this can happen for newly onboarded projects whose `abis/` dir lags.)\n\n## How it updates\n\n1. A protocol repo runs `just deploy …`, which writes/updates its `deployments/<chainId>.json`, and the change is\n   merged to `main`.\n2. The repo's `deployments.yml` workflow dispatches a `deployments-updated` event here.\n3. `dispatch-receive.yml` mirrors the changed files into `data/<project>/`, regenerates `src/` + `ts/`, and opens a PR.\n4. Merging + tagging publishes the npm package and updates the `forge install` source.\n\nTo regenerate locally after editing `data/`:\n\n```sh\nbun run generate         # rewrite src/ and ts/\nbun run generate:check   # CI guard: fail if committed output is stale\nforge test               # sanity + (with --fork-url) on-chain code checks\nbun test ts/             # TypeScript consumption tests\n```\n\n## Multi-chain note\n\nAddresses are **not** assumed identical across chains — every entry is keyed by `chainId`. Always confirm you are\nreading the library/map for the chain you are deploying against.\n","readmeFilename":"README.md"}