nim-nitro/nitro/types.nim
Mark Spanbroek 34072f4749 Fix ABI encoding of Nitro state to match javascript implementation
- rewrite ABI encoding to properly handle dynamic tuples
- surround Nitro types with extra tuples to match javascript
- test with examples of encoding extracted from javascript
2021-02-25 09:11:46 +01:00

18 lines
391 B
Nim

import std/math
import pkg/stint
import pkg/stew/byteutils
export stint
type
UInt48* = range[0'u64..2'u64^48-1]
EthAddress* = distinct array[20, byte]
proc toArray*(address: EthAddress): array[20, byte] =
array[20, byte](address)
proc fromHex*(_: type EthAddress, hex: string): EthAddress =
EthAddress(array[20, byte].fromHex(hex))
proc `==`*(a, b: EthAddress): bool {.borrow.}