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

feat: add kilt example #1114

Merged
merged 11 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions examples/read/kilt.eg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @title Read Kilt public key details of first owner in web3 names owners map
* @description Read the first entry of the Web3Names map, and access
* the DID public key details of the owner.
*/

import { $didPublicKeyDetails, spiritnet } from "@capi/spiritnet"
import { $, is, ValueRune } from "capi"

/// Reference the `owner` field of the first entry of the the web3 names owners map.
const owner = spiritnet.Web3Names.Owner
.entries({ limit: 1 })
.into(ValueRune)
.access(0, 1, "owner")

/// Retrieve the associated DID public key details.
const details = await spiritnet.Did.Did
.value(owner)
.unhandle(is(undefined))
.map(({ authenticationKey, publicKeys }) => publicKeys.get(authenticationKey))
.run()

/// Ensure `details` is of the expected shape.
console.log("DID public key details:", details)
$.assert($didPublicKeyDetails, details)
2 changes: 1 addition & 1 deletion import_map.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"imports": {
"@capi/": "http://localhost:4646/ed956cd5bde67584/"
"@capi/": "http://localhost:4646/7544978d8abdc81c/"
},
"scopes": {
"examples/": {
Expand Down
4 changes: 4 additions & 0 deletions nets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ export const rococoDevXcmStatemine = rococoDevXcm.parachain({
export const collectives = net.ws({
url: "wss://collectives.api.onfinality.io/public-ws",
})

export const spiritnet = net.ws({
url: "wss://kilt-rpc.dwellir.com",
})
2 changes: 2 additions & 0 deletions words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ devnet
devnets
dispatchable
dprint
dwellir
esbenp
extrinsics
ferdie
Expand Down Expand Up @@ -67,6 +68,7 @@ ryann
serde
sibl
smoldot
spiritnet
statemigration
statemine
statemint
Expand Down