diff --git a/nitro.nimble b/nitro.nimble index b6f62c0..21162bd 100644 --- a/nitro.nimble +++ b/nitro.nimble @@ -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" diff --git a/nitro/destination.nim b/nitro/destination.nim index d0baded..b6c664b 100644 --- a/nitro/destination.nim +++ b/nitro/destination.nim @@ -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.} diff --git a/nitro/ethaddress.nim b/nitro/ethaddress.nim index 7a099a5..9f68fcb 100644 --- a/nitro/ethaddress.nim +++ b/nitro/ethaddress.nim @@ -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.} diff --git a/nitro/keys.nim b/nitro/keys.nim index 0dc0640..8158f6c 100644 --- a/nitro/keys.nim +++ b/nitro/keys.nim @@ -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()) diff --git a/nitro/protocol/signature.nim b/nitro/protocol/signature.nim index 8e1a00a..97e9f8f 100644 --- a/nitro/protocol/signature.nim +++ b/nitro/protocol/signature.nim @@ -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 diff --git a/tests/nitro/testWallet.nim b/tests/nitro/testWallet.nim index a211794..3883d30 100644 --- a/tests/nitro/testWallet.nim +++ b/tests/nitro/testWallet.nim @@ -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 +