-
Create a keypair for the server
npx ucan-key ed --json
Note down
did
andkey
values!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\x01\x55\x00\x00 | |
bafkqaaa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export STORACHA_SERVICE_DID=did:web:staging.upload.storacha.network | |
export STORACHA_SERVICE_URL=https://staging.upload.storacha.network | |
export STORACHA_STORE_NAME=storacha-cli-staging | |
export STORACHA_RECEIPTS_URL=https://staging.upload.storacha.network/receipt/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node mkdelegate.js <private-key> | |
import { delegate } from '@ucanto/core' | |
import * as ed25519 from '@ucanto/principal/ed25519' | |
import * as Link from 'multiformats/link' | |
import { identity } from 'multiformats/hashes/identity' | |
import { base64 } from 'multiformats/bases/base64' | |
import * as DID from '@ipld/dag-ucan/did' | |
const indexingServiceDID = 'did:web:staging.indexer.storacha.network' | |
const uploadServiceDID = 'did:web:staging.upload.storacha.network' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cids = [ | |
'bafybeiei72mvsmckxh6jliaxtgtmktcucw6zjktmjko6lpdb76uy677nym', | |
'bafybeige7or65xqaqzbrsrnyf3alrcmr3mbkiwvbevc3hpkpiydbixjcte', | |
'bafybeidovp3gf6h6aye6vv25o3r6ayc32c3znzgijtvqqmqrnsfcljvz7i', | |
'bafybeigqhr6wptfw6a2jjvvd6alq73mgnn2ugfmnnzdksmaid44divhnju', | |
'bafybeicih3gpoxip4n2ozuqqfskdwymxcr27i6xgtdmnivuhy5q76weklu', | |
'bafybeia2fnngg5gzhc6v6ul23j67m4b4j3ekyxnonvyx5n4uo7jtq236my', | |
'bafybeieymcyqlnif4rtzt3cfterlyudr6lz6bpt3kkchji7bxgcjq3a4iy', | |
'bafybeibh4swn5lir77xo3sdxps5h3kl6xygmhutdkqwewnyrdvjz435nue', | |
'bafybeifef47tawlpfdjlrmvohjrnxgozarrwxkrdcqx3mmwigf4fakfr6a', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go test -coverprofile=c.out -v ./... | |
go tool cover -html="c.out" | |
# or | |
go install github.com/cancue/covreport@latest | |
go test -coverprofile=c.out -v ./... | |
~/go/bin/covreport -i c.out | |
open cover.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get state for multiple elements | |
// getState is passed an element and should return a promise that gets some state | |
// e.g. http://nightwatchjs.org/api#elementIdText | |
// Callback will be called with an array of the state values once they're all resolved | |
exports.command = function getElementsState (selector, getState, callback) { | |
this.elements('css selector', selector, function (elements) { | |
const values = elements.value.map(getState) | |
Promise.all(values).then(callback) | |
}) | |
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sumUsage = client => { | |
const period = getPeriod(new Date()) | |
/** @type {Record<ProviderDID, Record<SpaceDID, number>>} */ | |
let totalBySpace = {} | |
let total = 0 | |
for (const account of Object.values(client.accounts())) { | |
const subscriptions = await client.capability.subscriptions.list(account.did()) | |
for (const { consumers } of subscriptions.results) { | |
for (const space of consumers) { | |
const report = await client.capability.usage.report(space) |
Want to do an async task of adding two number together? Not problem.
invoke do/async-addition 40, 2
# create a delegation for the result and get the CID
result-cid = cid-for(delegate(do/async-addition-result 40, 2))
# create a receipt for this invocation, including the CID of the result delegation
receipt = generate-receipt-for(do/async-addition 40, 2, fx.join: result-cid)
NewerOlder