MCPcopy Create free account
hub / github.com/ceramicnetwork/rust-ceramic / encodeRawEvent

Function encodeRawEvent

tests/suite/src/utils/rustCeramicHelpers.ts:38–50  ·  view source on GitHub ↗
(commit: GenesisCommit)

Source from the content-addressed store, hash-verified

36}
37
38export function encodeRawEvent(commit: GenesisCommit): ReconEvent {
39 const carFactory = new CARFactory()
40 carFactory.codecs.add(dagJson)
41 carFactory.hashers.add(sha256)
42 const car = carFactory.build().asV1()
43 dagCbor.encode(commit)
44 car.put(commit, { isRoot: true })
45 const cid = car.roots[0]
46 return {
47 data: car.toString('base64'),
48 id: cid.toString(),
49 }
50}
51
52export function generateRandomEvent(modelId: StreamID, controller: string): ReconEvent {
53 const commit = generateRandomRawEvent(modelId, controller)

Callers 2

get-events.test.tsFile · 0.90
generateRandomEventFunction · 0.85

Calls 5

addMethod · 0.45
buildMethod · 0.45
encodeMethod · 0.45
putMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected