mirror of
https://github.com/logos-storage/nim-nitro.git
synced 2026-01-05 23:23:07 +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 pkg/stint
|
||||||
import ./types
|
import ./types
|
||||||
|
|
||||||
|
include ./noerrors
|
||||||
|
|
||||||
type
|
type
|
||||||
AbiEncoder* = object
|
AbiEncoder* = object
|
||||||
stack: seq[Tuple]
|
stack: seq[Tuple]
|
||||||
@ -13,8 +15,6 @@ type
|
|||||||
head: Slice[int]
|
head: Slice[int]
|
||||||
tail: seq[byte]
|
tail: seq[byte]
|
||||||
|
|
||||||
{.push raises:[].}
|
|
||||||
|
|
||||||
proc write*[T](encoder: var AbiEncoder, value: T)
|
proc write*[T](encoder: var AbiEncoder, value: T)
|
||||||
proc encode*[T](_: type AbiEncoder, value: T): seq[byte]
|
proc encode*[T](_: type AbiEncoder, value: T): seq[byte]
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,8 @@ import pkg/nimcrypto
|
|||||||
import ./abi
|
import ./abi
|
||||||
import ./types
|
import ./types
|
||||||
|
|
||||||
|
include ./noerrors
|
||||||
|
|
||||||
export types
|
export types
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -10,8 +12,6 @@ type
|
|||||||
participants*: seq[EthAddress]
|
participants*: seq[EthAddress]
|
||||||
chainId*: UInt256
|
chainId*: UInt256
|
||||||
|
|
||||||
{.push raises:[].}
|
|
||||||
|
|
||||||
proc getChannelId*(channel: Channel): array[32, byte] =
|
proc getChannelId*(channel: Channel): array[32, byte] =
|
||||||
var encoder= AbiEncoder.init()
|
var encoder= AbiEncoder.init()
|
||||||
encoder.startTuple()
|
encoder.startTuple()
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import std/options
|
import std/options
|
||||||
import pkg/stew/results
|
import pkg/stew/results
|
||||||
|
|
||||||
|
include ./noerrors
|
||||||
|
|
||||||
export options
|
export options
|
||||||
export results
|
export results
|
||||||
|
|
||||||
{.push raises:[].}
|
|
||||||
|
|
||||||
proc toOption*[T, E](res: Result[T, E]): Option[T] =
|
proc toOption*[T, E](res: Result[T, E]): Option[T] =
|
||||||
if res.isOk:
|
if res.isOk:
|
||||||
res.value.some
|
res.unsafeGet().some
|
||||||
else:
|
else:
|
||||||
T.none
|
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 ./abi
|
||||||
import ./types
|
import ./types
|
||||||
|
|
||||||
|
include ./noerrors
|
||||||
|
|
||||||
export types
|
export types
|
||||||
export abi
|
export abi
|
||||||
|
|
||||||
@ -25,8 +27,6 @@ type
|
|||||||
targetChannelId*: array[32, byte]
|
targetChannelId*: array[32, byte]
|
||||||
destinations*: seq[array[32, byte]]
|
destinations*: seq[array[32, byte]]
|
||||||
|
|
||||||
{.push raises:[].}
|
|
||||||
|
|
||||||
proc encode*(encoder: var AbiEncoder, guarantee: Guarantee) =
|
proc encode*(encoder: var AbiEncoder, guarantee: Guarantee) =
|
||||||
encoder.startTuple()
|
encoder.startTuple()
|
||||||
encoder.startTuple()
|
encoder.startTuple()
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import pkg/stew/byteutils
|
|||||||
import ./state
|
import ./state
|
||||||
import ./helpers
|
import ./helpers
|
||||||
|
|
||||||
|
include ./noerrors
|
||||||
|
|
||||||
export options
|
export options
|
||||||
export toPublicKey
|
export toPublicKey
|
||||||
|
|
||||||
@ -13,8 +15,6 @@ type
|
|||||||
PublicKey* = SkPublicKey
|
PublicKey* = SkPublicKey
|
||||||
Signature* = SkRecoverableSignature
|
Signature* = SkRecoverableSignature
|
||||||
|
|
||||||
{.push raises:[].}
|
|
||||||
|
|
||||||
proc rng(data: var openArray[byte]): bool =
|
proc rng(data: var openArray[byte]): bool =
|
||||||
randomBytes(data) == data.len
|
randomBytes(data) == data.len
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import ./channel
|
|||||||
import ./outcome
|
import ./outcome
|
||||||
import ./abi
|
import ./abi
|
||||||
|
|
||||||
|
include ./noerrors
|
||||||
|
|
||||||
export types
|
export types
|
||||||
export channel
|
export channel
|
||||||
export outcome
|
export outcome
|
||||||
@ -27,8 +29,6 @@ type
|
|||||||
outcome*: seq[byte]
|
outcome*: seq[byte]
|
||||||
appdata*: seq[byte]
|
appdata*: seq[byte]
|
||||||
|
|
||||||
{.push raises:[].}
|
|
||||||
|
|
||||||
proc fixedPart*(state: State): FixedPart =
|
proc fixedPart*(state: State): FixedPart =
|
||||||
FixedPart(
|
FixedPart(
|
||||||
chainId: state.channel.chainId,
|
chainId: state.channel.chainId,
|
||||||
|
|||||||
@ -3,6 +3,8 @@ import std/options
|
|||||||
import pkg/stint
|
import pkg/stint
|
||||||
import pkg/stew/byteutils
|
import pkg/stew/byteutils
|
||||||
|
|
||||||
|
include ./noerrors
|
||||||
|
|
||||||
export stint
|
export stint
|
||||||
export options
|
export options
|
||||||
|
|
||||||
@ -10,8 +12,6 @@ type
|
|||||||
UInt48* = range[0'u64..2'u64^48-1]
|
UInt48* = range[0'u64..2'u64^48-1]
|
||||||
EthAddress* = distinct array[20, byte]
|
EthAddress* = distinct array[20, byte]
|
||||||
|
|
||||||
{.push raises:[].}
|
|
||||||
|
|
||||||
proc toArray*(address: EthAddress): array[20, byte] =
|
proc toArray*(address: EthAddress): array[20, byte] =
|
||||||
array[20, byte](address)
|
array[20, byte](address)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user