{"id":32119037,"url":"https://github.com/paritytech/capi","last_synced_at":"2025-10-20T17:56:13.368Z","repository":{"id":36996162,"uuid":"470813774","full_name":"paritytech/capi","owner":"paritytech","description":"[WIP] A framework for crafting interactions with Substrate chains","archived":true,"fork":false,"pushed_at":"2023-07-30T00:24:59.000Z","size":53978,"stargazers_count":104,"open_issues_count":121,"forks_count":9,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-10-20T17:55:58.867Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.capi.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paritytech.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-17T01:56:40.000Z","updated_at":"2025-08-27T13:19:41.000Z","dependencies_parsed_at":"2024-06-19T11:25:59.970Z","dependency_job_id":"4c29e4e0-565e-42fe-a02a-bf6df638bb6f","html_url":"https://github.com/paritytech/capi","commit_stats":{"total_commits":490,"total_committers":13,"mean_commits":37.69230769230769,"dds":0.5142857142857142,"last_synced_commit":"c7c4993afa6b351f8a5dec049085931ed205dce0"},"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"purl":"pkg:github/paritytech/capi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fcapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fcapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fcapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fcapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paritytech","download_url":"https://codeload.github.com/paritytech/capi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fcapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280135884,"owners_count":26278444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-20T02:00:06.978Z","response_time":62,"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":"2025-10-20T17:56:11.210Z","updated_at":"2025-10-20T17:56:13.346Z","avatar_url":"https://github.com/paritytech.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Capi\n\n\u003e [Announcing Capi v0.1.0-gamma.0](https://docs.capi.dev/blog/2023/06/29/v0.1.0-gamma.0)\n\nCapi is a framework for crafting interactions with Substrate chains. It consists\nof a development server and fluent API, which facilitates multichain\ninteractions without compromising either performance or ease of use.\n\n- [Manual \u0026rarr;](https://docs.capi.dev)\u003cbr /\u003eGuides to get up and running\n- [Examples \u0026rarr;](./examples)\u003cbr /\u003eSHOW ME THE CODE\n- [API Reference \u0026rarr;](https://deno.land/x/capi/mod.ts)\u003cbr /\u003eA generated API\n  reference, based on type signatures and TSDocs.\n\n## Installation\n\n```sh\nnpm i capi\n```\n\n\u003e Note: Capi depends on the standard\n\u003e [Web Crypto API](https://nodejs.org/docs/latest-v20.x/api/webcrypto.html#web-crypto-api)\n\u003e (**Node 20.3.1 and above**). See\n\u003e [shimming instructions](https://docs.capi.dev/setup/#web-crypto-api).\n\n\u003cdetails\u003e\n\u003csummary\u003eDeno Equivalent\u003c/summary\u003e\n\u003cbr\u003e\n\n`import_map.json`\n\n```json\n{\n  \"imports\": {\n    \"capi\": \"https://deno.land/x/capi/mod.ts\",\n    \"capi/nets\": \"https://deno.land/x/capi/nets/mod.ts\"\n  }\n}\n```\n\n\u003e Note: For now, we only support the latest 1.x version of Deno.\n\n\u003c/details\u003e\n\n## Configuration\n\nCreate a `nets.ts` and specify the chains with which you'd like to interact.\n\n```ts\nimport { bins, net } from \"capi/nets\"\n\nconst bin = bins({ polkadot: [\"polkadot\", \"v0.9.38\"] })\n\n// A Polkadot development network\nexport const polkadotDev = net.dev({\n  bin: bin.polkadot,\n  chain: \"polkadot-dev\",\n})\n\n// The Polkadot relay chain\nexport const polkadot = net.ws({\n  url: \"wss://rpc.polkadot.io/\",\n  targets: { dev: polkadotDev },\n})\n```\n\n\u003e Note: if the type declarations for `capi/nets` are not resolved, chances are\n\u003e your tsconfig does not reflect the following requirements.\n\u003e\n\u003e ```json\n\u003e {\n\u003e   \"target\": \"ESNext\",\n\u003e   \"module\": \"NodeNext\"\n\u003e }\n\u003e ```\n\u003e\n\u003e For more information, see\n\u003e [Node's `exports` docs](https://nodejs.org/api/packages.html#exports) and\n\u003e [TypeScript's module resolution docs](https://www.typescriptlang.org/tsconfig#moduleResolution).\n\n## Command Line Tool\n\nIn this documentation, we use Capi's CLI via the alias \"capi\", instead of via\nits full path:\n\n```sh\n./node_modules/.bin/capi\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eDeno Equivalent\u003c/summary\u003e\n\u003cbr\u003e\n\n```sh\ndeno run -A https://deno.land/x/capi/main.ts\n```\n\n\u003c/details\u003e\n\n## Codegen Chain-specific APIs\n\n```sh\ncapi sync node\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eDeno Equivalent\u003c/summary\u003e\n\u003cbr\u003e\n\n```sh\ncapi sync deno\n```\n\n\u003c/details\u003e\n\n## At a Glance\n\nRetrieve the first 10 entries from a storage map of Polkadot.\n\n```ts\nimport { polkadot } from \"@capi/polkadot\"\n\nconst accounts = await polkadot.System.Account.entries({ limit: 10 }).run()\n```\n\n## Development Networks\n\nDuring development, we may want to swap out the underlying connection with that\nof a devnet. This can be achieved via targets — by specifying alternate targets\nin your `nets.ts` file, you can switch to them by wrapping your command with\n`capi serve --target someTarget --`. For example:\n\n```sh\ncapi serve --target dev -- node main.js\n```\n\n\u003e Other examples:\n\u003e\n\u003e - `capi serve --target dev -- npm run start`\n\u003e - `capi serve --target dev -- deno run -A ./main.ts`\n\n## Running Examples\n\nWithin a fresh clone of this repository...\n\n\u003c!-- TODO: track https://github.com/denoland/dotland/issues/2650#issuecomment-1437015262 --\u003e\n\n```sh\ndeno task sync # only needed once\ndeno task run examples/\u003cexample_path\u003e\n```\n\nOr, to run an example with Node:\n\n```sh\ndeno task sync # only needed once\ndeno task dnt --examples # only needed once\ndeno task capi serve -- node target/npm/capi-examples/esm/examples/\u003cexample_path\u003e\n```\n\n## Rationale\n\nIn a likely future of specialized, interoperable chains, developers will need to\nmake use of on-chain programs to satisfy varying use cases; the expertise\nrequired to interact with these on-chain programs is currently greater than that\nwhich _should_ be expected of app developers. Does this mean that app developers\nmust forgo integrating with this blossoming infrastructure? We think not; **the\nopen source community can use Capi to abstract over the atomics of the on-chain\nworld**. An interaction spanning several chains and dozens of methods can be\ndescribed with a single Rune[^1].\n\nAs you read through this documentation, please consider use cases over which you\nmight like to abstract; if you wish to add your use case to\n[Capi's standard library](patterns), please\n[submit an issue](https://github.com/paritytech/capi/issues/new?title=pattern%20idea:%20).\n\n## Code of Conduct\n\nEveryone interacting in this repo is expected to follow the\n[code of conduct](CODE_OF_CONDUCT.md).\n\n## Contributing\n\nContributions are welcome and appreciated! Check out the\n[contributing guide](CONTRIBUTING.md) before you dive in.\n\n## License\n\nCapi is [Apache licensed](LICENSE).\n\n[^1]: Rune is the unit of composition with which we model Capi programs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparitytech%2Fcapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparitytech%2Fcapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparitytech%2Fcapi/lists"}