mirror of
https://github.com/status-im/nim-codex.git
synced 2025-02-04 06:53:39 +00:00
e5df8c50d3
* style: nph setup * chore: formates codex/ and tests/ folder with nph 0.6.1
15 lines
371 B
Nim
15 lines
371 B
Nim
import std/hashes
|
|
import ../logutils
|
|
|
|
type PurchaseId* = distinct array[32, byte]
|
|
|
|
logutils.formatIt(LogFormat.textLines, PurchaseId):
|
|
it.short0xHexLog
|
|
logutils.formatIt(LogFormat.json, PurchaseId):
|
|
it.to0xHexLog
|
|
|
|
proc hash*(x: PurchaseId): Hash {.borrow.}
|
|
proc `==`*(x, y: PurchaseId): bool {.borrow.}
|
|
proc toHex*(x: PurchaseId): string =
|
|
array[32, byte](x).toHex
|