nim-nitro/nitro/wallet/ledger.nim

21 lines
513 B
Nim
Raw Normal View History

2021-03-17 13:38:17 +01:00
import ../basics
import ../protocol
2021-03-17 13:10:49 +01:00
import ./signedstate
2021-03-16 12:50:46 +01:00
2021-03-17 12:22:00 +01:00
func startLedger*(me: EthAddress,
2021-03-16 12:50:46 +01:00
hub: EthAddress,
chainId: UInt256,
nonce: UInt48,
asset: EthAddress,
2021-03-17 13:10:49 +01:00
amount: UInt256): SignedState =
SignedState(
2021-03-16 12:50:46 +01:00
state: State(
channel: ChannelDefinition(
chainId: chainId,
participants: @[me, hub],
nonce: nonce
),
outcome: Outcome.init(asset, {me.toDestination: amount})
)
)