You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/develop/01_sdk/01_quickstart.md
+21-18Lines changed: 21 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,10 +68,11 @@ To enable ES modules in your project, add `"type": "module"` to the `package.jso
68
68
69
69
Declare an `async main` function in the `quickstart.ts` file that executes the rest of the code in this quickstart and call the `main()` function by default:
70
70
71
-
{/_ TODO: Do we need to test this or provide JS/TS equivalent? _/}
71
+
{/* TODO: Do we need to test this or provide JS/TS equivalent? */}
72
72
73
73
```js
74
-
asyncfunctionmain() {}
74
+
asyncfunctionmain() {
75
+
}
75
76
76
77
main()
77
78
```
@@ -83,8 +84,10 @@ main()
83
84
Begin by importing the **KILT SDK** and **Axios** at the top of the file:
84
85
85
86
```js
86
-
import*asKiltfrom'@kiltprotocol/sdk-js'
87
-
importaxiosfrom'axios'
87
+
import*asKiltfrom"@kiltprotocol/sdk-js";
88
+
importaxiosfrom"axios";
89
+
import*asDidfrom"@kiltprotocol/did";
90
+
import {types}from"@kiltprotocol/credentials"
88
91
```
89
92
90
93
Now, you can access the SDK and all its functionality.
@@ -124,9 +127,9 @@ You should add all other code before this function call:
124
127
125
128
<SnippetBlock
126
129
className="language-ts"
127
-
128
-
> {Disconnect}
129
-
> </SnippetBlock>
130
+
>
131
+
{Disconnect}
132
+
</SnippetBlock>
130
133
131
134
By adding `await Kilt.disconnect()`, you ensure that the connection to the blockchain node is properly closed when the script finishes executing, which helps maintain the integrity of your application and is a good practice to follow.
132
135
@@ -166,9 +169,9 @@ Between the `Kilt.connect()` and `Kilt.disconnect()` lines, add the following co
166
169
<SnippetBlock
167
170
className="language-ts"
168
171
dropTail="1"
169
-
170
-
> {FetchDid}
171
-
> </SnippetBlock>
172
+
>
173
+
{FetchDid}
174
+
</SnippetBlock>
172
175
173
176
Try running the code and check the result.
174
177
@@ -188,9 +191,9 @@ It retrieves the services exposed by the DID found for `kiltnerd123`:
188
191
<SnippetBlock
189
192
className="language-ts"
190
193
dropTail="1"
191
-
192
-
> {FetchEndpoints}
193
-
> </SnippetBlock>
194
+
>
195
+
{FetchEndpoints}
196
+
</SnippetBlock>
194
197
195
198
The code should print endpoints as JSON.
196
199
@@ -212,15 +215,15 @@ Add it before `await Kilt.disconnect()`:
212
215
213
216
<SnippetBlock
214
217
className="language-ts"
215
-
216
-
> {VerifyCredential}
217
-
> </SnippetBlock>
218
+
>
219
+
{VerifyCredential}
220
+
</SnippetBlock>
218
221
219
222
Run the code and wait to see if you can retrieve **and** verify one of kiltnerd123's credentials!
220
223
221
224
:::info Next steps
222
225
223
-
-If you want to explore more of KILT's features, read our [Concepts section](../../concepts/01_what_is_kilt.md).
224
-
-If you want to dive deeper into the SDK, read the next section, [the KILT Cookbook](./02_cookbook/01_dids/01_light_did_creation.md).
226
+
- If you want to explore more of KILT's features, read our [Concepts section](../../concepts/01_what_is_kilt.md).
227
+
- If you want to dive deeper into the SDK, read the next section, [the KILT Cookbook](./02_cookbook/01_dids/01_light_did_creation.md).
0 commit comments