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

Commit

Permalink
feat: add kilt example
Browse files Browse the repository at this point in the history
  • Loading branch information
kratico committed Jun 28, 2023
1 parent 20f36c8 commit 44fb7bf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
19 changes: 19 additions & 0 deletions examples/kilt/did.eg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { spiritnet } from "@capi/spiritnet"
import { $, is } from "capi"

const { owner } = await spiritnet.Web3Names.Owner.value(
new TextEncoder().encode("ingo"),
)
.unhandle(is(undefined)).run()

const { authenticationKey, publicKeys } = await spiritnet.Did.Did.value(owner)
.unhandle(is(undefined)).run()

const value = [...publicKeys.entries()].find(([k, _v]) => bytesEqual(k, authenticationKey))

console.log("DID:", value![1].key.value)
$.assert($.uint8Array, value![1].key.value.value)

function bytesEqual(a: Uint8Array, b: Uint8Array) {
return a.every((x, i) => b[i] === x)
}
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",
})
3 changes: 3 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 All @@ -33,6 +34,7 @@ harrysolovay
hasher
hashers
hrmp
ingo
inherents
keypair
kiera
Expand Down Expand Up @@ -66,6 +68,7 @@ ryann
serde
sibl
smoldot
spiritnet
statemigration
statemine
statemint
Expand Down

0 comments on commit 44fb7bf

Please sign in to comment.