Skip to content

Commit b0a7101

Browse files
committed
Fix documentation.
1 parent 4996800 commit b0a7101

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

docs/setup.md

+25-14
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ This project is essentially a set of auto-generated decorators that call the C m
44
defined in `lightning.h`. The wrappers for the most part take care of conveniences such
55
as conversion of Swift types into C types, and parsing C types back into Swift.
66

7-
In `Bindings.swift`, there are various additional generic utility methods to aid the
7+
In `Bindings.swift`, there are various additional generic utility methods to aid the
88
developer in passing data back and forth.
99

10-
The greatest effort on the part of users of this project comes in when dealing with
10+
The greatest effort on the part of users of this project comes in when dealing with
1111
traits. All files located within `out/traits` are meant to be interpreted as
1212
abstract classes. However, as Swift does not allow abstract classes, and using protocols
1313
would shift both implementation and boilerplate burden on developers, I instead recommend
@@ -41,7 +41,7 @@ class MyFeeEstimator: FeeEstimator {
4141
}
4242
```
4343

44-
Second, somewhere within the app initialization context, e.g. the app delegate's
44+
Second, somewhere within the app initialization context, e.g. the app delegate's
4545
`didFinishLaunchingWithOptions` method, instantiate the fee estimator:
4646

4747
```swift
@@ -89,8 +89,7 @@ import LightningDevKit
8989

9090
class MyBroadcasterInterface: BroadcasterInterface {
9191

92-
override func broadcastTransaction(tx: [UInt8]) {
93-
92+
override func broadcastTransactions(txs: [[UInt8]]) {
9493
// insert code to broadcast transaction
9594
}
9695

@@ -117,22 +116,22 @@ import LightningDevKit
117116

118117
class MyPersister: Persist {
119118

120-
override func persistNewChannel(channelId: OutPoint, data: ChannelMonitor, updateId: MonitorUpdateId) -> ChannelMonitorUpdateStatus {
119+
override func persistNewChannel(channelId: Bindings.OutPoint, data: Bindings.ChannelMonitor, updateId: Bindings.MonitorUpdateId) -> Bindings.ChannelMonitorUpdateStatus {
121120
let idBytes: [UInt8] = channelId.write()
122121
let monitorBytes: [UInt8] = data.write()
123122

124123
// persist monitorBytes to disk, keyed by idBytes
125124

126-
return ChannelMonitorUpdateStatus.Completed
125+
return .Completed
127126
}
128127

129-
override func updatePersistedChannel(channelId: OutPoint, update: ChannelMonitorUpdate, data: ChannelMonitor, updateId: MonitorUpdateId) -> ChannelMonitorUpdateStatus {
128+
override func updatePersistedChannel(channelId: Bindings.OutPoint, update: Bindings.ChannelMonitorUpdate, data: Bindings.ChannelMonitor, updateId: Bindings.MonitorUpdateId) -> Bindings.ChannelMonitorUpdateStatus {
130129
let idBytes: [UInt8] = channelId.write()
131130
let monitorBytes: [UInt8] = data.write()
132131

133132
// modify persisted monitorBytes keyed by idBytes on disk
134133

135-
return ChannelMonitorUpdateStatus.Completed
134+
return .Completed
136135
}
137136

138137
}
@@ -261,12 +260,24 @@ If you have a channel manager you previously serialized, you can restore it like
261260
```swift
262261
let serializedChannelManager: [UInt8] = [1, 1, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 0, 10, 174, 219, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 238, 87, 135, 110, 67, 215, 108, 228, 66, 226, 192, 37, 6, 193, 120, 186, 5, 214, 209, 16, 169, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 113, 1, 2, 0, 0, 3, 2, 0, 0, 5, 33, 2, 89, 251, 100, 20, 141, 129, 167, 164, 253, 12, 110, 225, 21, 14, 42, 17, 23, 170, 54, 168, 175, 191, 155, 92, 7, 230, 198, 17, 219, 93, 1, 98, 7, 32, 227, 238, 107, 153, 58, 23, 23, 190, 44, 19, 147, 84, 4, 108, 20, 65, 184, 73, 193, 61, 62, 208, 250, 205, 198, 250, 214, 79, 148, 156, 191, 174, 9, 0, 11, 32, 134, 110, 74, 49, 160, 200, 160, 145, 147, 82, 141, 56, 13, 26, 225, 152, 160, 215, 152, 117, 30, 242, 250, 8, 119, 235, 144, 54, 177, 235, 97, 60]
263262
let serializedChannelMonitors: [[UInt8]] = []
263+
264+
let cmcParams = ChannelManagerConstructionParameters(
265+
config: config,
266+
entropySource: keysManager.asEntropySource(),
267+
nodeSigner: keysManager.asNodeSigner(),
268+
signerProvider: keysManager.asSignerProvider(),
269+
feeEstimator: feeEstimator,
270+
chainMonitor: chainMonitor,
271+
txBroadcaster: broadcaster,
272+
logger: logger
273+
)
274+
264275
let channelManagerConstructor = try ChannelManagerConstructor(
265-
channelManagerSerialized: serializedChannelManager,
266-
channelMonitorsSerialized: serializedChannelMonitors,
267-
netGraphSerialized: nil, // or networkGraph
268-
filter: filter,
269-
params: cmcParams,
276+
channelManagerSerialized: serializedChannelManager,
277+
channelMonitorsSerialized: serializedChannelMonitors,
278+
networkGraph: NetworkGraphArgument.instance(networkGraph),
279+
filter: filter,
280+
params: cmcParams
270281
)
271282

272283
let channelManager = channelManagerConstructor.channelManager

0 commit comments

Comments
 (0)