{"_id":"@avapulse/icm-core","name":"@avapulse/icm-core","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@avapulse/icm-core","version":"0.1.0","description":"Teleporter/ICM message lifecycle engine: event decoding, messageID correlation, lifecycle state machine","license":"MIT","type":"module","repository":{"type":"git","url":"git+https://github.com/Pratikkale26/AvaPulse.git","directory":"packages/icm-core"},"homepage":"https://ava-pulse.vercel.app","keywords":["avalanche","icm","teleporter","cross-chain","interchain-messaging","monitoring"],"publishConfig":{"access":"public"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":"./dist/index.js"},"scripts":{"build":"tsc -p tsconfig.json","test":"vitest run","typecheck":"tsc -p tsconfig.json --noEmit"},"dependencies":{"viem":"^2.38.0"},"devDependencies":{"@types/node":"^22","typescript":"^5","vitest":"^3"},"gitHead":"38c05a6ed6cd3589e77e22cea975f2167f80a49a","_id":"@avapulse/icm-core@0.1.0","bugs":{"url":"https://github.com/Pratikkale26/AvaPulse/issues"},"_nodeVersion":"24.10.0","_npmVersion":"11.18.0","dist":{"integrity":"sha512-NbcT//K7zJiYo/HhhwaXAcvPecXZqhR9fOt4PlzOcuy4accnVkU0IxdqphJzDioS7bBv6g0vbNVodwD6ErldKQ==","shasum":"454810e683dab9269e8b2a66481e17f1a090c121","tarball":"https://registry.npmjs.org/@avapulse/icm-core/-/icm-core-0.1.0.tgz","fileCount":20,"unpackedSize":34763,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIH07QY3OvmRJ4aSOqskdfTOxjEvAv0ahjantV1TKy5odAiAnpBnpXT4Mf8Xy3x0JbzR39F5sb9q3dkp1VOKMoihLnw=="}]},"_npmUser":{"name":"pratikkale26","email":"Pratikkale7661@gmail.com"},"directories":{},"maintainers":[{"name":"pratikkale26","email":"Pratikkale7661@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/icm-core_0.1.0_1786043615772_0.9991505721100515"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-06T19:13:35.613Z","0.1.0":"2026-08-06T19:13:35.917Z","modified":"2026-08-06T19:13:36.192Z"},"maintainers":[{"name":"pratikkale26","email":"Pratikkale7661@gmail.com"}],"description":"Teleporter/ICM message lifecycle engine: event decoding, messageID correlation, lifecycle state machine","homepage":"https://ava-pulse.vercel.app","keywords":["avalanche","icm","teleporter","cross-chain","interchain-messaging","monitoring"],"repository":{"type":"git","url":"git+https://github.com/Pratikkale26/AvaPulse.git","directory":"packages/icm-core"},"bugs":{"url":"https://github.com/Pratikkale26/AvaPulse/issues"},"license":"MIT","readme":"# @avapulse/icm-core\n\nTeleporter/ICM message lifecycle engine for Avalanche: typed event decoding, cross-chain correlation by `messageID`, and stuck-message detection. The shared core behind [AvaPulse](https://ava-pulse.vercel.app) (live monitoring) and [ICM Trace](https://icm-trace.vercel.app) (post-mortem debugging).\n\n```bash\nnpm install @avapulse/icm-core viem\n```\n\n## What it does\n\n- **Decode** TeleporterMessenger event logs (`SendCrossChainMessage`, `ReceiveCrossChainMessage`, `MessageExecuted`, `MessageExecutionFailed`, `ReceiptReceived`) into typed records.\n- **Correlate** events from any number of chains into per-message lifecycles — idempotent, order-independent, retry-aware.\n- **Detect** stuck messages: sent but not executed within a delivery threshold.\n- **Ingest** via `fetchTeleporterEvents` (range fetch with public-RPC-safe chunking) or the polling `TeleporterWatcher`.\n\n## Quick start\n\n```ts\nimport { createPublicClient, http } from \"viem\"\nimport { fetchTeleporterEvents, LifecycleStore } from \"@avapulse/icm-core\"\n\nconst client = createPublicClient({\n  transport: http(\"https://api.avax-test.network/ext/bc/C/rpc\"),\n})\n\nconst head = await client.getBlockNumber()\nconst events = await fetchTeleporterEvents({\n  client,\n  chain: \"fuji-c\",\n  fromBlock: head - 2000n,\n  toBlock: head,\n})\n\nconst store = new LifecycleStore()\nfor (const e of events) store.apply(e)\n\nconsole.log(store.all().map((lc) => `${lc.messageID} ${lc.status}`))\nconsole.log(\"stuck:\", store.stuck(Date.now() / 1000, 120))\n```\n\nLive watching across a chain pair:\n\n```ts\nimport { TeleporterWatcher, LifecycleStore } from \"@avapulse/icm-core\"\n\nconst store = new LifecycleStore()\nconst watcher = new TeleporterWatcher({\n  chains: [\n    { chain: \"c-chain\", client: cChainClient },\n    { chain: \"my-l1\", client: myL1Client },\n  ],\n  onEvent: (e) => {\n    const lc = store.apply(e)\n    if (lc.status === \"execution_failed\") notifySomeone(lc)\n  },\n})\nawait watcher.start()\n```\n\n## License\n\nMIT — part of the [AvaPulse](https://github.com/Pratikkale26/AvaPulse) project.\n","readmeFilename":"README.md","_rev":"1-7d1c0222a5d208f5eba1eaf541c7d1c7"}