1
1
# Capi
2
2
3
- > Capi is a work in progress. The documentation may not reflect the current
4
- > implementation. ** Expect a stable release and proper documentation in early
5
- > 2023** .
6
-
7
3
Capi is a framework for crafting interactions with Substrate chains. It consists
8
4
of a development server and fluent API, which facilitates multichain
9
5
interactions without compromising either performance or ease of use.
10
6
7
+ - [ Manual &rarr ; ] ( https://docs.capi.dev ) <br />Guides to get up and running
11
8
- [ Examples &rarr ; ] ( ./examples ) <br />SHOW ME THE CODE
12
9
- [ API Reference &rarr ; ] ( https://deno.land/x/capi/mod.ts ) <br />A generated API
13
10
reference, based on type signatures and TSDocs.
@@ -27,7 +24,8 @@ npm i capi
27
24
``` json
28
25
{
29
26
"imports" : {
30
- "capi" : " https://deno.land/x/capi/mod.ts"
27
+ "capi" : " https://deno.land/x/capi/mod.ts" ,
28
+ "capi/nets" : " https://deno.land/x/capi/nets/mod.ts"
31
29
}
32
30
}
33
31
```
@@ -39,7 +37,7 @@ npm i capi
39
37
Create a ` nets.ts ` and specify the chains with which you'd like to interact.
40
38
41
39
``` ts
42
- import { bins , net } from " capi"
40
+ import { bins , net } from " capi/nets "
43
41
44
42
const bin = bins ({ polkadot: [" polkadot" , " v0.9.38" ] })
45
43
@@ -78,15 +76,60 @@ deno run -A https://deno.land/x/capi/main.ts
78
76
## Codegen Chain-specific APIs
79
77
80
78
``` sh
81
- capi sync --package-json package.json
79
+ capi sync node
82
80
```
83
81
84
82
<details >
85
83
<summary >Deno Equivalent</summary >
86
84
<br >
87
85
88
86
``` sh
89
- capi sync --import-map import_map.json
87
+ capi sync deno
88
+ ```
89
+
90
+ </details >
91
+
92
+ ## Build Tool Integration
93
+
94
+ If you use a build tool such as Vite or Webpack during development, you'll need
95
+ to configure two environment variables.
96
+
97
+ <details >
98
+ <summary ><code >vite.config.ts</code > example</summary >
99
+ <br >
100
+
101
+ ``` ts
102
+ import { defineConfig } from " vite"
103
+
104
+ export default defineConfig ({
105
+ define: {
106
+ " process.env.CAPI_SERVER" : process .env .CAPI_SERVER ,
107
+ " process.env.CAPI_TARGET" : process .env .CAPI_TARGET ,
108
+ },
109
+ })
110
+ ```
111
+
112
+ </details >
113
+
114
+ <details >
115
+ <summary ><code >webpack.config.js</code > example</summary >
116
+ <br >
117
+
118
+ ``` ts
119
+ import webpack from " webpack"
120
+
121
+ export default {
122
+ plugins: [
123
+ new webpack .DefinePlugin ({
124
+ process: {
125
+ env: {
126
+ CAPI_SERVER: JSON .stringify (process .env .CAPI_SERVER ),
127
+ CAPI_TARGET: JSON .stringify (process .env .CAPI_TARGET ),
128
+ },
129
+ },
130
+ }),
131
+ ],
132
+ }
90
133
```
91
134
92
135
</details >
0 commit comments