Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
docs: update readme (#1093)
Browse files Browse the repository at this point in the history
Co-authored-by: tjjfvi <[email protected]>
  • Loading branch information
harrysolovay and tjjfvi authored Jun 22, 2023
1 parent 0589359 commit 27f08d5
Showing 1 changed file with 51 additions and 8 deletions.
59 changes: 51 additions & 8 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# Capi

> Capi is a work in progress. The documentation may not reflect the current
> implementation. **Expect a stable release and proper documentation in early
> 2023**.
Capi is a framework for crafting interactions with Substrate chains. It consists
of a development server and fluent API, which facilitates multichain
interactions without compromising either performance or ease of use.

- [Manual &rarr;](https://docs.capi.dev)<br />Guides to get up and running
- [Examples &rarr;](./examples)<br />SHOW ME THE CODE
- [API Reference &rarr;](https://deno.land/x/capi/mod.ts)<br />A generated API
reference, based on type signatures and TSDocs.
Expand All @@ -27,7 +24,8 @@ npm i capi
```json
{
"imports": {
"capi": "https://deno.land/x/capi/mod.ts"
"capi": "https://deno.land/x/capi/mod.ts",
"capi/nets": "https://deno.land/x/capi/nets/mod.ts"
}
}
```
Expand All @@ -39,7 +37,7 @@ npm i capi
Create a `nets.ts` and specify the chains with which you'd like to interact.

```ts
import { bins, net } from "capi"
import { bins, net } from "capi/nets"

const bin = bins({ polkadot: ["polkadot", "v0.9.38"] })

Expand Down Expand Up @@ -78,15 +76,60 @@ deno run -A https://deno.land/x/capi/main.ts
## Codegen Chain-specific APIs

```sh
capi sync --package-json package.json
capi sync node
```

<details>
<summary>Deno Equivalent</summary>
<br>

```sh
capi sync --import-map import_map.json
capi sync deno
```

</details>

## Build Tool Integration

If you use a build tool such as Vite or Webpack during development, you'll need
to configure two environment variables.

<details>
<summary><code>vite.config.ts</code> example</summary>
<br>

```ts
import { defineConfig } from "vite"

export default defineConfig({
define: {
"process.env.CAPI_SERVER": process.env.CAPI_SERVER,
"process.env.CAPI_TARGET": process.env.CAPI_TARGET,
},
})
```

</details>

<details>
<summary><code>webpack.config.js</code> example</summary>
<br>

```ts
import webpack from "webpack"

export default {
plugins: [
new webpack.DefinePlugin({
process: {
env: {
CAPI_SERVER: JSON.stringify(process.env.CAPI_SERVER),
CAPI_TARGET: JSON.stringify(process.env.CAPI_TARGET),
},
},
}),
],
}
```

</details>
Expand Down

0 comments on commit 27f08d5

Please sign in to comment.