mirror of
https://github.com/logos-storage/nim-nitro.git
synced 2026-01-07 08:03:14 +00:00
Rename: EthAddress.fromHex() -> EthAddress.parse()
This commit is contained in:
parent
b758751211
commit
a8b2cfab5a
@ -8,7 +8,7 @@ type EthAddress* = distinct array[20, byte]
|
|||||||
proc toArray*(address: EthAddress): array[20, byte] =
|
proc toArray*(address: EthAddress): array[20, byte] =
|
||||||
array[20, byte](address)
|
array[20, byte](address)
|
||||||
|
|
||||||
proc fromHex*(_: type EthAddress, hex: string): ?EthAddress =
|
proc parse*(_: type EthAddress, hex: string): ?EthAddress =
|
||||||
EthAddress(array[20, byte].fromHex(hex)).catch.toOption
|
EthAddress(array[20, byte].fromHex(hex)).catch.toOption
|
||||||
|
|
||||||
proc `==`*(a, b: EthAddress): bool {.borrow.}
|
proc `==`*(a, b: EthAddress): bool {.borrow.}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ suite "channel definition":
|
|||||||
chainId: 9001.u256,
|
chainId: 9001.u256,
|
||||||
nonce: 1,
|
nonce: 1,
|
||||||
participants: @[
|
participants: @[
|
||||||
EthAddress.fromHex("24b905Dcc8A11C0FE57C2592f3D25f0447402C10").get()
|
EthAddress.parse("24b905Dcc8A11C0FE57C2592f3D25f0447402C10").get()
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
let expected = Destination.parse(
|
let expected = Destination.parse(
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import pkg/nitro/protocol/abi
|
import pkg/nitro/protocol/abi
|
||||||
import pkg/nimcrypto
|
import pkg/nimcrypto
|
||||||
import pkg/stew/byteutils
|
|
||||||
import ../basics
|
import ../basics
|
||||||
|
|
||||||
suite "outcome":
|
suite "outcome":
|
||||||
@ -91,7 +90,7 @@ suite "outcome":
|
|||||||
let outcome = Outcome(@[
|
let outcome = Outcome(@[
|
||||||
AssetOutcome(
|
AssetOutcome(
|
||||||
kind: allocationType,
|
kind: allocationType,
|
||||||
assetHolder: EthAddress.fromHex(
|
assetHolder: EthAddress.parse(
|
||||||
"1E90B49563da16D2537CA1Ddd9b1285279103D93"
|
"1E90B49563da16D2537CA1Ddd9b1285279103D93"
|
||||||
).get(),
|
).get(),
|
||||||
allocation: Allocation(@[
|
allocation: Allocation(@[
|
||||||
@ -105,7 +104,7 @@ suite "outcome":
|
|||||||
),
|
),
|
||||||
AssetOutcome(
|
AssetOutcome(
|
||||||
kind: guaranteeType,
|
kind: guaranteeType,
|
||||||
assetHolder: EthAddress.fromHex(
|
assetHolder: EthAddress.parse(
|
||||||
"1E90B49563da16D2537CA1Ddd9b1285279103D93"
|
"1E90B49563da16D2537CA1Ddd9b1285279103D93"
|
||||||
).get(),
|
).get(),
|
||||||
guarantee: Guarantee(
|
guarantee: Guarantee(
|
||||||
|
|||||||
@ -23,7 +23,7 @@ suite "signature":
|
|||||||
chainId: 0x1.u256,
|
chainId: 0x1.u256,
|
||||||
nonce: 1,
|
nonce: 1,
|
||||||
participants: @[
|
participants: @[
|
||||||
EthAddress.fromHex("0x8a64E10FF40Bc9C90EA5750313dB5e036495c10E").get()
|
EthAddress.parse("0x8a64E10FF40Bc9C90EA5750313dB5e036495c10E").get()
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
outcome: Outcome(@[]),
|
outcome: Outcome(@[]),
|
||||||
|
|||||||
@ -52,7 +52,7 @@ suite "state":
|
|||||||
chainId: 0x1.u256,
|
chainId: 0x1.u256,
|
||||||
nonce: 1,
|
nonce: 1,
|
||||||
participants: @[
|
participants: @[
|
||||||
EthAddress.fromHex("DBE821484648c73C1996Da25f2355342B9803eBD").get()
|
EthAddress.parse("DBE821484648c73C1996Da25f2355342B9803eBD").get()
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
outcome: Outcome(@[]),
|
outcome: Outcome(@[]),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user