mirror of
https://github.com/logos-storage/nim-nitro.git
synced 2026-01-03 06:03:09 +00:00
Fix compilation with Nim 1.2.6
This commit is contained in:
parent
72ba624cdc
commit
415ab9d281
@ -1 +1 @@
|
||||
nim 1.4.2
|
||||
nim 1.4.4
|
||||
|
||||
@ -2,6 +2,8 @@ import pkg/stew/endians2
|
||||
import pkg/stint
|
||||
import ./types
|
||||
|
||||
include ./noerrors
|
||||
|
||||
type
|
||||
AbiEncoder* = object
|
||||
stack: seq[Tuple]
|
||||
@ -13,8 +15,6 @@ type
|
||||
head: Slice[int]
|
||||
tail: seq[byte]
|
||||
|
||||
{.push raises:[].}
|
||||
|
||||
proc write*[T](encoder: var AbiEncoder, value: T)
|
||||
proc encode*[T](_: type AbiEncoder, value: T): seq[byte]
|
||||
|
||||
|
||||
@ -2,6 +2,8 @@ import pkg/nimcrypto
|
||||
import ./abi
|
||||
import ./types
|
||||
|
||||
include ./noerrors
|
||||
|
||||
export types
|
||||
|
||||
type
|
||||
@ -10,8 +12,6 @@ type
|
||||
participants*: seq[EthAddress]
|
||||
chainId*: UInt256
|
||||
|
||||
{.push raises:[].}
|
||||
|
||||
proc getChannelId*(channel: Channel): array[32, byte] =
|
||||
var encoder= AbiEncoder.init()
|
||||
encoder.startTuple()
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import std/options
|
||||
import pkg/stew/results
|
||||
|
||||
include ./noerrors
|
||||
|
||||
export options
|
||||
export results
|
||||
|
||||
{.push raises:[].}
|
||||
|
||||
proc toOption*[T, E](res: Result[T, E]): Option[T] =
|
||||
if res.isOk:
|
||||
res.value.some
|
||||
res.unsafeGet().some
|
||||
else:
|
||||
T.none
|
||||
|
||||
8
nitro/noerrors.nim
Normal file
8
nitro/noerrors.nim
Normal file
@ -0,0 +1,8 @@
|
||||
## Include this file to indicate that your module does not raise Errors.
|
||||
## Disables compiler hints about unused declarations in Nim < 1.4.0
|
||||
|
||||
when (NimMajor, NimMinor, NimPatch) >= (1, 4, 0):
|
||||
{.push raises:[].}
|
||||
else:
|
||||
{.push raises: [Defect].}
|
||||
{.hint[XDeclaredButNotUsed]: off.}
|
||||
@ -2,6 +2,8 @@ import pkg/nimcrypto
|
||||
import ./abi
|
||||
import ./types
|
||||
|
||||
include ./noerrors
|
||||
|
||||
export types
|
||||
export abi
|
||||
|
||||
@ -25,8 +27,6 @@ type
|
||||
targetChannelId*: array[32, byte]
|
||||
destinations*: seq[array[32, byte]]
|
||||
|
||||
{.push raises:[].}
|
||||
|
||||
proc encode*(encoder: var AbiEncoder, guarantee: Guarantee) =
|
||||
encoder.startTuple()
|
||||
encoder.startTuple()
|
||||
|
||||
@ -5,6 +5,8 @@ import pkg/stew/byteutils
|
||||
import ./state
|
||||
import ./helpers
|
||||
|
||||
include ./noerrors
|
||||
|
||||
export options
|
||||
export toPublicKey
|
||||
|
||||
@ -13,8 +15,6 @@ type
|
||||
PublicKey* = SkPublicKey
|
||||
Signature* = SkRecoverableSignature
|
||||
|
||||
{.push raises:[].}
|
||||
|
||||
proc rng(data: var openArray[byte]): bool =
|
||||
randomBytes(data) == data.len
|
||||
|
||||
|
||||
@ -4,6 +4,8 @@ import ./channel
|
||||
import ./outcome
|
||||
import ./abi
|
||||
|
||||
include ./noerrors
|
||||
|
||||
export types
|
||||
export channel
|
||||
export outcome
|
||||
@ -27,8 +29,6 @@ type
|
||||
outcome*: seq[byte]
|
||||
appdata*: seq[byte]
|
||||
|
||||
{.push raises:[].}
|
||||
|
||||
proc fixedPart*(state: State): FixedPart =
|
||||
FixedPart(
|
||||
chainId: state.channel.chainId,
|
||||
|
||||
@ -3,6 +3,8 @@ import std/options
|
||||
import pkg/stint
|
||||
import pkg/stew/byteutils
|
||||
|
||||
include ./noerrors
|
||||
|
||||
export stint
|
||||
export options
|
||||
|
||||
@ -10,8 +12,6 @@ type
|
||||
UInt48* = range[0'u64..2'u64^48-1]
|
||||
EthAddress* = distinct array[20, byte]
|
||||
|
||||
{.push raises:[].}
|
||||
|
||||
proc toArray*(address: EthAddress): array[20, byte] =
|
||||
array[20, byte](address)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user