(commit: GenesisCommit)
| 36 | } |
| 37 | |
| 38 | export 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 | |
| 52 | export function generateRandomEvent(modelId: StreamID, controller: string): ReconEvent { |
| 53 | const commit = generateRandomRawEvent(modelId, controller) |
no test coverage detected