mirror of
https://github.com/logos-storage/nim-nitro.git
synced 2026-01-02 13:43:06 +00:00
Update to latest version of questionable
This commit is contained in:
parent
5837a655e0
commit
c824a3edd1
@ -5,7 +5,7 @@ description = "Nitro state channels"
|
||||
|
||||
requires "nim >= 1.2.6 & < 2.0.0"
|
||||
requires "nimcrypto >= 0.5.4 & < 0.6.0"
|
||||
requires "questionable >= 0.2.0 & < 0.3.0"
|
||||
requires "questionable >= 0.4.0 & < 0.5.0"
|
||||
requires "secp256k1"
|
||||
requires "stint"
|
||||
requires "stew"
|
||||
|
||||
@ -14,7 +14,7 @@ proc `$`*(destination: Destination): string =
|
||||
destination.toArray().toHex()
|
||||
|
||||
proc parse*(_: type Destination, s: string): ?Destination =
|
||||
Destination(array[32, byte].fromHex(s)).catch.toOption()
|
||||
Destination(array[32, byte].fromHex(s)).catch.option
|
||||
|
||||
proc `==`*(a, b: Destination): bool {.borrow.}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import pkg/questionable
|
||||
import pkg/questionable/results
|
||||
import pkg/stew/byteutils
|
||||
|
||||
export questionable
|
||||
@ -15,6 +16,6 @@ proc `$`*(a: EthAddress): string =
|
||||
a.toArray().toHex()
|
||||
|
||||
proc parse*(_: type EthAddress, hex: string): ?EthAddress =
|
||||
EthAddress(array[20, byte].fromHex(hex)).catch.toOption
|
||||
EthAddress(array[20, byte].fromHex(hex)).catch.option
|
||||
|
||||
proc `==`*(a, b: EthAddress): bool {.borrow.}
|
||||
|
||||
@ -21,7 +21,7 @@ proc `$`*(key: PrivateKey): string =
|
||||
key.toHex()
|
||||
|
||||
proc parse*(_: type PrivateKey, s: string): ?PrivateKey =
|
||||
SkSecretKey.fromHex(s).toOption()
|
||||
SkSecretKey.fromHex(s).option
|
||||
|
||||
proc toAddress*(key: PublicKey): EthAddress =
|
||||
let hash = keccak256.digest(key.toRaw())
|
||||
|
||||
@ -37,4 +37,4 @@ proc parse*(_: type Signature, s: string): ?Signature =
|
||||
var bytes = array[65, byte].fromHex(s)
|
||||
bytes[64] = bytes[64] - 27
|
||||
SkRecoverableSignature.fromRaw(bytes).get()
|
||||
signature.toOption()
|
||||
signature.option
|
||||
|
||||
@ -18,5 +18,6 @@ suite "nitro wallet":
|
||||
let expectedState = State(outcome: expectedOutcome)
|
||||
let expectedSignatures = @{wallet.address: key.sign(expectedState)}
|
||||
check channel.latest.isNone
|
||||
check channel.upcoming.?state == expectedState.some
|
||||
check channel.upcoming.?signatures == expectedSignatures.some
|
||||
check channel.upcoming?.state == expectedState.some
|
||||
check channel.upcoming?.signatures == expectedSignatures.some
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user