Closed kratico closed 1 year ago
Example to get the first 10 owners
import { $didPublicKeyDetails, spiritnet } from "@capi/spiritnet" import { $, ArrayRune, is } from "capi" import { equals } from "../../deps/std/bytes.ts" const didPublicKeyDetails = await spiritnet.Web3Names.Owner .entries({ limit: 10 }) .into(ArrayRune) .mapArray((entry) => spiritnet.Did.Did .value(entry.access(1, "owner")) .unhandle(is(undefined)) .map(({ authenticationKey, publicKeys }) => [...publicKeys.entries()].find(([k, _v]) => equals(k, authenticationKey)) ) .unhandle(is(undefined)) ) .run() console.log("DID public key details:", didPublicKeyDetails) $.assert($.array($.tuple($.sizedUint8Array(32), $didPublicKeyDetails)), didPublicKeyDetails)
Example to get the first 10 owners