Skip to content

Commit

Permalink
readd toArray that went mssing (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnetheduck authored Oct 2, 2024
1 parent 25f96c8 commit 3e99be2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web3/primitives.nim
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ type
# Quantity is use in lieu of an ordinary `uint64` to avoid the default
# format that comes with json_serialization


Blob* = FixedBytes[fieldElementsPerBlob * 32]

template `==`*[minLen, maxLen](a, b: DynamicBytes[minLen, maxLen]): bool =
Expand Down Expand Up @@ -80,6 +79,9 @@ func fromHex*[minLen, maxLen](T: type DynamicBytes[minLen, maxLen], hexStr: stri

T hexToSeqByte(hexStr)

func toArray*[N](data: DynamicBytes[N, N]): array[N, byte] =
copyMem(addr result[0], unsafeAddr distinctBase(data)[0], N)

template data*(v: DynamicBytes): seq[byte] =
distinctBase v

Expand Down

0 comments on commit 3e99be2

Please sign in to comment.