mirror of
https://github.com/logos-storage/nim-nitro.git
synced 2026-01-11 01:53:08 +00:00
- 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
18 lines
391 B
Nim
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.}
|