(epoch: number, id: Uint8Array)
| 37 | |
| 38 | // uses big endian |
| 39 | export function prefixEpochToArray(epoch: number, id: Uint8Array) { |
| 40 | for (let i = 0; i < epochLength; i++) { |
| 41 | const divisor = Math.pow(256, epochLength - 1 - i) |
| 42 | id[i] = Math.floor(epoch / divisor) % 256 |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | export function idToEpoch(id: Uint8Array): number { |
| 47 | let epoch = 0 |
no outgoing calls
no test coverage detected