{"id":51270020,"url":"https://github.com/halaprix/domino","last_synced_at":"2026-06-29T17:01:14.985Z","repository":{"id":361821656,"uuid":"1255016243","full_name":"halaprix/domino","owner":"halaprix","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-01T11:29:06.000Z","size":442,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-01T13:03:24.813Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/halaprix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-31T09:42:32.000Z","updated_at":"2026-06-01T11:29:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"51b7bc8f-3c51-4077-bc8a-5c9e21d42b5f","html_url":"https://github.com/halaprix/domino","commit_stats":null,"previous_names":["halaprix/domino"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/halaprix/domino","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halaprix%2Fdomino","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halaprix%2Fdomino/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halaprix%2Fdomino/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halaprix%2Fdomino/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halaprix","download_url":"https://codeload.github.com/halaprix/domino/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halaprix%2Fdomino/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34935530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-29T17:01:12.771Z","updated_at":"2026-06-29T17:01:14.950Z","avatar_url":"https://github.com/halaprix.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# domino\n\n```\n        ┌─────────┬─────────┐\n        │  ●   ●  │  ●      │\n        │         │    ●    │\n        │  ●   ●  │      ●  │\n        └─────────┴─────────┘\n   turns M calls × N steps into M multicalls\n\n   _|                            _|\n _|_|_|    _|_|    _|_|_|  _|_|        _|_|_|      _|_|\n_|    _|  _|    _|  _|    _|    _|  _|  _|    _|  _|    _|\n_|    _|  _|    _|  _|    _|    _|  _|  _|    _|  _|    _|\n  _|_|_|    _|_|    _|    _|    _|  _|  _|    _|    _|_|\n```\n\n[![CI](https://github.com/halaprix/domino/actions/workflows/ci.yml/badge.svg)](https://github.com/halaprix/domino/actions/workflows/ci.yml)\n[![npm version](https://img.shields.io/npm/v/@halaprix/domino)](https://www.npmjs.com/package/@halaprix/domino)\n[![bundle size](https://img.shields.io/badge/gzip-1.8%E2%80%932.4KB-brightgreen)](https://www.npmjs.com/package/@halaprix/domino)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.5-blue)](https://www.typescriptlang.org/)\n[![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n**A state machine for on-chain reads.** Define steps, push results through. One multicall per step.\n\n```bash\nnpm install @halaprix/domino\n```\n\n## But wait — it's just a state machine\n\nMulticall is great for batched reads. But what about when step 2 needs step 1's results?\n\nInstead of N separate RPC calls per step, domino runs your state machine **as a batch** — one `multicall` per step. You define the steps, it wires them together.\n\n```typescript\nimport { createPublicClient, http, mainnet } from \"viem\"\nimport { MulticallResolver, Eip1193Executor } from \"@halaprix/domino\"\n\nconst provider = createPublicClient({ chain: mainnet, transport: http() })\nconst resolver = new MulticallResolver(new Eip1193Executor(provider))\n\n// 🧠 Any state machine — define steps, domino batches them:\nconst result = await resolver.run({\n  taskName: \"price-check\",\n\n  // Step 1: batch of independent reads\n  *steps() {\n    yield {\n      calls: [\n        { key: \"price\", abi: oracleAbi, functionName: \"latestAnswer\" },\n        { key: \"decimals\", abi: erc20Abi, functionName: \"decimals\" },\n      ],\n    }\n\n    // Step 2: uses results from step 1\n    const price = this.getResult(\"price\").value\n    const decimals = this.getResult(\"decimals\").value\n    const scaledPrice = price * (10n ** (18n - decimals))\n\n    yield {\n      calls: [], // optional — if you need more steps\n    }\n  },\n\n  // finalize: assemble the answer\n  finalize() {\n    const price = this.getResult(\"price\").value\n    const decimals = this.getResult(\"decimals\").value\n    return { price, decimals, scaledPrice: price * (10n ** (18n - decimals)) }\n  },\n})\n```\n\nThat's the whole API. Two pages — read the source of [`erc4626.ts`](src/handlers/erc4626.ts) if you want to see a complete example.\n\n## Built-in task builders\n\nFor convenience, domino ships with pre-built task builders:\n\n```typescript\nimport { buildErc4626Task, resolveErc4626Vault } from \"@halaprix/domino\"\n\n// One vault — 2 multicalls (metadata + convertToAssets)\nconst vault = await resolveErc4626Vault({\n  client: executor,\n  vault: \"0x...\",\n  owner: \"0x...\",\n})\n// { name, symbol, decimals, balance, assets, ... }\n\n// 100 vaults — still just 2 multicalls\nconst vaults = await resolveErc4626VaultsBulk({\n  client: executor,\n  entries: vaultAddresses.map(a =\u003e ({ vault: a, owner })),\n})\n```\n\nSame pattern for ERC20, and you can `buildErc4626Task()` / `buildErc20Task()` to compose them into custom pipelines.\n\n## Historical blocks\n\nQuery any block with EIP-1898:\n\n```typescript\nconst oldVault = await resolveErc4626Vault({\n  client: executor,\n  vault: \"0x...\",\n  block: { blockNumber: 19_000_000n },\n})\n```\n\nWorks with `blockHash`, `blockTag`, or `blockNumber`. Even on chains where Multicall3 didn't exist yet — domino falls back to deployless multicall automatically.\n\n## When NOT to use it\n\n- Pure batches (no dependencies) → plain `multicall` is simpler.\n- Write transactions → wrong tool. This reads only.\n- Single reads → just use `client.readContract()` directly.\n\n## API at a glance\n\n| Export | What it is |\n|--------|-----------|\n| `MulticallResolver` | Convenience layer — call `run()` to execute a state machine |\n| `Eip1193Executor` | Single engine — works with any EIP-1193 provider |\n| `runMultistepTasks()` | Core FSM — bare-metal version of the resolver |\n| `buildErc20Task()` | Build a task definition for ERC20 token reads |\n| `buildErc4626Task()` | Build a task definition for ERC4626 vault reads |\n| `resolveErc20Token()` | One-shot ERC20: `{ symbol, decimals, balance }` |\n| `resolveErc4626Vault()` | One-shot ERC4626: `{ name, assets, ... }` |\n| `BlockParam` | `{ blockNumber?, blockTag?, blockHash? }` |\n\n## Documentation\n\n- [Architecture \u0026 AI Context](CLAUDE.md)\n- [API Reference](docs/api-reference.md)\n- [Benchmarks](docs/benchmarks.md)\n- [Migration Guide](MIGRATION.md)\n- [Changelog](CHANGELOG.md)\n\n## Contributing\n\nSee our [Contributing Guide](CONTRIBUTING.md).\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalaprix%2Fdomino","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalaprix%2Fdomino","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalaprix%2Fdomino/lists"}