@minip2p/react-native 0.5.4 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,13 +99,13 @@ const stringConverter = (() => {
99
99
  const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
100
100
 
101
101
  /**
102
- * Signed-discovery configuration.
102
+ * State snapshot of the transport connection selected for a peer.
103
103
  */
104
104
 
105
105
  /**
106
- * Generated factory for {@link DiscoveryOptions} record objects.
106
+ * Generated factory for {@link ConnectionInfo} record objects.
107
107
  */
108
- export const DiscoveryOptions = (() => {
108
+ export const ConnectionInfo = (() => {
109
109
  const defaults = () => ({});
110
110
  const create = (() => {
111
111
  return uniffiCreateRecord(defaults);
@@ -116,24 +116,20 @@ export const DiscoveryOptions = (() => {
116
116
  defaults: () => Object.freeze(defaults())
117
117
  });
118
118
  })();
119
- const FfiConverterTypeDiscoveryOptions = (() => {
119
+ const FfiConverterTypeConnectionInfo = (() => {
120
120
  class FFIConverter extends AbstractFfiConverterByteArray {
121
121
  readFromCursor(c) {
122
122
  return {
123
- topic: FfiConverterString.readFromCursor(c),
124
- beaconIntervalMs: FfiConverterUInt64.readFromCursor(c),
125
- peerTtlMs: FfiConverterUInt64.readFromCursor(c),
126
- autoDial: FfiConverterBool.readFromCursor(c)
123
+ connId: FfiConverterUInt64.readFromCursor(c),
124
+ remoteAddr: FfiConverterOptionalString.readFromCursor(c)
127
125
  };
128
126
  }
129
127
  writeIntoCursor(value, c) {
130
- FfiConverterString.writeIntoCursor(value.topic, c);
131
- FfiConverterUInt64.writeIntoCursor(value.beaconIntervalMs, c);
132
- FfiConverterUInt64.writeIntoCursor(value.peerTtlMs, c);
133
- FfiConverterBool.writeIntoCursor(value.autoDial, c);
128
+ FfiConverterUInt64.writeIntoCursor(value.connId, c);
129
+ FfiConverterOptionalString.writeIntoCursor(value.remoteAddr, c);
134
130
  }
135
131
  allocationSize(value) {
136
- return FfiConverterString.allocationSize(value.topic) + FfiConverterUInt64.allocationSize(value.beaconIntervalMs) + FfiConverterUInt64.allocationSize(value.peerTtlMs) + FfiConverterBool.allocationSize(value.autoDial);
132
+ return FfiConverterUInt64.allocationSize(value.connId) + FfiConverterOptionalString.allocationSize(value.remoteAddr);
137
133
  }
138
134
  }
139
135
  ;
@@ -141,13 +137,13 @@ const FfiConverterTypeDiscoveryOptions = (() => {
141
137
  })();
142
138
 
143
139
  /**
144
- * One enabled transport and the addresses it should listen on.
140
+ * Signed-discovery configuration.
145
141
  */
146
142
 
147
143
  /**
148
- * Generated factory for {@link TransportOptions} record objects.
144
+ * Generated factory for {@link DiscoveryOptions} record objects.
149
145
  */
150
- export const TransportOptions = (() => {
146
+ export const DiscoveryOptions = (() => {
151
147
  const defaults = () => ({});
152
148
  const create = (() => {
153
149
  return uniffiCreateRecord(defaults);
@@ -158,65 +154,30 @@ export const TransportOptions = (() => {
158
154
  defaults: () => Object.freeze(defaults())
159
155
  });
160
156
  })();
161
- const FfiConverterTypeTransportOptions = (() => {
157
+ const FfiConverterTypeDiscoveryOptions = (() => {
162
158
  class FFIConverter extends AbstractFfiConverterByteArray {
163
159
  readFromCursor(c) {
164
160
  return {
165
- listenAddrs: FfiConverterOptionalSequenceString.readFromCursor(c)
161
+ topic: FfiConverterString.readFromCursor(c),
162
+ beaconIntervalMs: FfiConverterUInt64.readFromCursor(c),
163
+ peerTtlMs: FfiConverterUInt64.readFromCursor(c),
164
+ autoDial: FfiConverterBool.readFromCursor(c)
166
165
  };
167
166
  }
168
167
  writeIntoCursor(value, c) {
169
- FfiConverterOptionalSequenceString.writeIntoCursor(value.listenAddrs, c);
168
+ FfiConverterString.writeIntoCursor(value.topic, c);
169
+ FfiConverterUInt64.writeIntoCursor(value.beaconIntervalMs, c);
170
+ FfiConverterUInt64.writeIntoCursor(value.peerTtlMs, c);
171
+ FfiConverterBool.writeIntoCursor(value.autoDial, c);
170
172
  }
171
173
  allocationSize(value) {
172
- return FfiConverterOptionalSequenceString.allocationSize(value.listenAddrs);
174
+ return FfiConverterString.allocationSize(value.topic) + FfiConverterUInt64.allocationSize(value.beaconIntervalMs) + FfiConverterUInt64.allocationSize(value.peerTtlMs) + FfiConverterBool.allocationSize(value.autoDial);
173
175
  }
174
176
  }
175
177
  ;
176
178
  return new FFIConverter();
177
179
  })();
178
180
 
179
- /**
180
- * Pubsub routing engine selected at endpoint construction.
181
- */
182
- export let PubsubRouter = /*#__PURE__*/function (PubsubRouter) {
183
- /**
184
- * Mesh-based gossipsub routing.
185
- */
186
- PubsubRouter[PubsubRouter["Gossipsub"] = 0] = "Gossipsub";
187
- /**
188
- * Flood-to-all-subscribers floodsub routing.
189
- */
190
- PubsubRouter[PubsubRouter["Floodsub"] = 1] = "Floodsub";
191
- return PubsubRouter;
192
- }({});
193
- const FfiConverterTypePubsubRouter = (() => {
194
- class FFIConverter extends AbstractFfiConverterByteArray {
195
- readFromCursor(c) {
196
- switch (c.readI32()) {
197
- case 1:
198
- return PubsubRouter.Gossipsub;
199
- case 2:
200
- return PubsubRouter.Floodsub;
201
- default:
202
- throw new UniffiInternalError.UnexpectedEnumCase();
203
- }
204
- }
205
- writeIntoCursor(value, c) {
206
- switch (value) {
207
- case PubsubRouter.Gossipsub:
208
- return c.writeI32(1);
209
- case PubsubRouter.Floodsub:
210
- return c.writeI32(2);
211
- }
212
- }
213
- allocationSize(value) {
214
- return 4;
215
- }
216
- }
217
- return new FFIConverter();
218
- })();
219
-
220
181
  /**
221
182
  * Local-link mDNS discovery configuration.
222
183
  */
@@ -292,11 +253,9 @@ const FfiConverterTypeEndpointConfig = (() => {
292
253
  agentVersion: FfiConverterOptionalString.readFromCursor(c),
293
254
  relays: FfiConverterSequenceString.readFromCursor(c),
294
255
  autonatServers: FfiConverterSequenceString.readFromCursor(c),
295
- quic: FfiConverterOptionalTypeTransportOptions.readFromCursor(c),
296
- tcp: FfiConverterOptionalTypeTransportOptions.readFromCursor(c),
256
+ listen: FfiConverterOptionalSequenceString.readFromCursor(c),
297
257
  forceRelay: FfiConverterBool.readFromCursor(c),
298
258
  allowUnsigned: FfiConverterBool.readFromCursor(c),
299
- pubsubRouter: FfiConverterTypePubsubRouter.readFromCursor(c),
300
259
  protocols: FfiConverterSequenceString.readFromCursor(c),
301
260
  discovery: FfiConverterOptionalTypeDiscoveryOptions.readFromCursor(c),
302
261
  mdns: FfiConverterOptionalTypeMdnsOptions.readFromCursor(c)
@@ -306,17 +265,15 @@ const FfiConverterTypeEndpointConfig = (() => {
306
265
  FfiConverterOptionalString.writeIntoCursor(value.agentVersion, c);
307
266
  FfiConverterSequenceString.writeIntoCursor(value.relays, c);
308
267
  FfiConverterSequenceString.writeIntoCursor(value.autonatServers, c);
309
- FfiConverterOptionalTypeTransportOptions.writeIntoCursor(value.quic, c);
310
- FfiConverterOptionalTypeTransportOptions.writeIntoCursor(value.tcp, c);
268
+ FfiConverterOptionalSequenceString.writeIntoCursor(value.listen, c);
311
269
  FfiConverterBool.writeIntoCursor(value.forceRelay, c);
312
270
  FfiConverterBool.writeIntoCursor(value.allowUnsigned, c);
313
- FfiConverterTypePubsubRouter.writeIntoCursor(value.pubsubRouter, c);
314
271
  FfiConverterSequenceString.writeIntoCursor(value.protocols, c);
315
272
  FfiConverterOptionalTypeDiscoveryOptions.writeIntoCursor(value.discovery, c);
316
273
  FfiConverterOptionalTypeMdnsOptions.writeIntoCursor(value.mdns, c);
317
274
  }
318
275
  allocationSize(value) {
319
- return FfiConverterOptionalString.allocationSize(value.agentVersion) + FfiConverterSequenceString.allocationSize(value.relays) + FfiConverterSequenceString.allocationSize(value.autonatServers) + FfiConverterOptionalTypeTransportOptions.allocationSize(value.quic) + FfiConverterOptionalTypeTransportOptions.allocationSize(value.tcp) + FfiConverterBool.allocationSize(value.forceRelay) + FfiConverterBool.allocationSize(value.allowUnsigned) + FfiConverterTypePubsubRouter.allocationSize(value.pubsubRouter) + FfiConverterSequenceString.allocationSize(value.protocols) + FfiConverterOptionalTypeDiscoveryOptions.allocationSize(value.discovery) + FfiConverterOptionalTypeMdnsOptions.allocationSize(value.mdns);
276
+ return FfiConverterOptionalString.allocationSize(value.agentVersion) + FfiConverterSequenceString.allocationSize(value.relays) + FfiConverterSequenceString.allocationSize(value.autonatServers) + FfiConverterOptionalSequenceString.allocationSize(value.listen) + FfiConverterBool.allocationSize(value.forceRelay) + FfiConverterBool.allocationSize(value.allowUnsigned) + FfiConverterSequenceString.allocationSize(value.protocols) + FfiConverterOptionalTypeDiscoveryOptions.allocationSize(value.discovery) + FfiConverterOptionalTypeMdnsOptions.allocationSize(value.mdns);
320
277
  }
321
278
  }
322
279
  ;
@@ -493,6 +450,139 @@ const FfiConverterTypeRelayReservationInfo = (() => {
493
450
  return new FFIConverter();
494
451
  })();
495
452
 
453
+ // Enum: ConnectTarget
454
+ export let ConnectTarget_Tags = /*#__PURE__*/function (ConnectTarget_Tags) {
455
+ ConnectTarget_Tags["Peer"] = "Peer";
456
+ ConnectTarget_Tags["Addresses"] = "Addresses";
457
+ return ConnectTarget_Tags;
458
+ }({});
459
+ /**
460
+ * What a foreign runtime supplies to start one Connection attempt.
461
+ *
462
+ * Validation lives in `minip2p-ffi-core`; this mirror only declares the shape.
463
+ */
464
+ export const ConnectTarget = (() => {
465
+ /**
466
+ * Peer ID only: the endpoint applies its discovery-book and relay
467
+ * policy.
468
+ */
469
+ class Peer_ extends UniffiEnum {
470
+ /**
471
+ * @private
472
+ * This field is private and should not be used, use `tag` instead.
473
+ */
474
+ [uniffiTypeNameSymbol] = "ConnectTarget";
475
+ tag = ConnectTarget_Tags.Peer;
476
+ constructor(inner) {
477
+ super("ConnectTarget", "Peer");
478
+ this.inner = Object.freeze(inner);
479
+ }
480
+ static new(inner) {
481
+ return new Peer_(inner);
482
+ }
483
+ static instanceOf(obj) {
484
+ return obj.tag === ConnectTarget_Tags.Peer;
485
+ }
486
+ }
487
+ /**
488
+ * One or more complete direct peer addresses that all name the same
489
+ * peer. One address is the single-address form.
490
+ */
491
+ class Addresses_ extends UniffiEnum {
492
+ /**
493
+ * @private
494
+ * This field is private and should not be used, use `tag` instead.
495
+ */
496
+ [uniffiTypeNameSymbol] = "ConnectTarget";
497
+ tag = ConnectTarget_Tags.Addresses;
498
+ constructor(inner) {
499
+ super("ConnectTarget", "Addresses");
500
+ this.inner = Object.freeze(inner);
501
+ }
502
+ static new(inner) {
503
+ return new Addresses_(inner);
504
+ }
505
+ static instanceOf(obj) {
506
+ return obj.tag === ConnectTarget_Tags.Addresses;
507
+ }
508
+ }
509
+ function instanceOf(obj) {
510
+ return obj[uniffiTypeNameSymbol] === "ConnectTarget";
511
+ }
512
+ return Object.freeze({
513
+ instanceOf,
514
+ Peer: Peer_,
515
+ Addresses: Addresses_
516
+ });
517
+ })();
518
+ /**
519
+ * What a foreign runtime supplies to start one Connection attempt.
520
+ *
521
+ * Validation lives in `minip2p-ffi-core`; this mirror only declares the shape.
522
+ */
523
+
524
+ // FfiConverter for enum ConnectTarget
525
+ const FfiConverterTypeConnectTarget = (() => {
526
+ class FFIConverter extends AbstractFfiConverterByteArray {
527
+ readFromCursor(c) {
528
+ switch (c.readI32()) {
529
+ case 1:
530
+ return new ConnectTarget.Peer({
531
+ peerId: FfiConverterString.readFromCursor(c)
532
+ });
533
+ case 2:
534
+ return new ConnectTarget.Addresses({
535
+ addresses: FfiConverterSequenceString.readFromCursor(c)
536
+ });
537
+ default:
538
+ throw new UniffiInternalError.UnexpectedEnumCase();
539
+ }
540
+ }
541
+ writeIntoCursor(value, c) {
542
+ switch (value.tag) {
543
+ case ConnectTarget_Tags.Peer:
544
+ {
545
+ c.writeI32(1);
546
+ const inner = value.inner;
547
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
548
+ return;
549
+ }
550
+ case ConnectTarget_Tags.Addresses:
551
+ {
552
+ c.writeI32(2);
553
+ const inner = value.inner;
554
+ FfiConverterSequenceString.writeIntoCursor(inner.addresses, c);
555
+ return;
556
+ }
557
+ default:
558
+ // Throwing from here means that ConnectTarget_Tags hasn't matched an ordinal.
559
+ throw new UniffiInternalError.UnexpectedEnumCase();
560
+ }
561
+ }
562
+ allocationSize(value) {
563
+ switch (value.tag) {
564
+ case ConnectTarget_Tags.Peer:
565
+ {
566
+ const inner = value.inner;
567
+ let size = 4;
568
+ size += FfiConverterString.allocationSize(inner.peerId);
569
+ return size;
570
+ }
571
+ case ConnectTarget_Tags.Addresses:
572
+ {
573
+ const inner = value.inner;
574
+ let size = 4;
575
+ size += FfiConverterSequenceString.allocationSize(inner.addresses);
576
+ return size;
577
+ }
578
+ default:
579
+ throw new UniffiInternalError.UnexpectedEnumCase();
580
+ }
581
+ }
582
+ }
583
+ return new FFIConverter();
584
+ })();
585
+
496
586
  /**
497
587
  * Source that contributed a discovery observation.
498
588
  */
@@ -1581,14 +1671,14 @@ export let P2pEvent_Tags = /*#__PURE__*/function (P2pEvent_Tags) {
1581
1671
  P2pEvent_Tags["InboundPathEstablished"] = "InboundPathEstablished";
1582
1672
  P2pEvent_Tags["PathUpgraded"] = "PathUpgraded";
1583
1673
  P2pEvent_Tags["HolePunchFailed"] = "HolePunchFailed";
1584
- P2pEvent_Tags["FellBackToRelay"] = "FellBackToRelay";
1585
1674
  P2pEvent_Tags["ConnectFailed"] = "ConnectFailed";
1675
+ P2pEvent_Tags["ConnectCancelled"] = "ConnectCancelled";
1586
1676
  P2pEvent_Tags["InboundDirectUpgrade"] = "InboundDirectUpgrade";
1587
1677
  P2pEvent_Tags["Message"] = "Message";
1588
1678
  P2pEvent_Tags["PeerSubscribed"] = "PeerSubscribed";
1589
1679
  P2pEvent_Tags["PeerUnsubscribed"] = "PeerUnsubscribed";
1590
- P2pEvent_Tags["PubsubOutboundFailure"] = "PubsubOutboundFailure";
1591
- P2pEvent_Tags["PubsubProtocolViolation"] = "PubsubProtocolViolation";
1680
+ P2pEvent_Tags["GossipsubOutboundFailure"] = "GossipsubOutboundFailure";
1681
+ P2pEvent_Tags["GossipsubProtocolViolation"] = "GossipsubProtocolViolation";
1592
1682
  P2pEvent_Tags["PeerDiscovered"] = "PeerDiscovered";
1593
1683
  P2pEvent_Tags["PeerUpdated"] = "PeerUpdated";
1594
1684
  P2pEvent_Tags["PeerExpired"] = "PeerExpired";
@@ -2042,45 +2132,46 @@ export const P2pEvent = (() => {
2042
2132
  }
2043
2133
  }
2044
2134
  /**
2045
- * Direct upgrade attempts ended with the relay path retained.
2135
+ * A connection attempt ended without a usable path.
2046
2136
  */
2047
- class FellBackToRelay_ extends UniffiEnum {
2137
+ class ConnectFailed_ extends UniffiEnum {
2048
2138
  /**
2049
2139
  * @private
2050
2140
  * This field is private and should not be used, use `tag` instead.
2051
2141
  */
2052
2142
  [uniffiTypeNameSymbol] = "P2pEvent";
2053
- tag = P2pEvent_Tags.FellBackToRelay;
2143
+ tag = P2pEvent_Tags.ConnectFailed;
2054
2144
  constructor(inner) {
2055
- super("P2pEvent", "FellBackToRelay");
2145
+ super("P2pEvent", "ConnectFailed");
2056
2146
  this.inner = Object.freeze(inner);
2057
2147
  }
2058
2148
  static new(inner) {
2059
- return new FellBackToRelay_(inner);
2149
+ return new ConnectFailed_(inner);
2060
2150
  }
2061
2151
  static instanceOf(obj) {
2062
- return obj.tag === P2pEvent_Tags.FellBackToRelay;
2152
+ return obj.tag === P2pEvent_Tags.ConnectFailed;
2063
2153
  }
2064
2154
  }
2065
2155
  /**
2066
- * A connection attempt ended without a usable path.
2156
+ * A Connection attempt was cancelled by `cancel_connect` before it
2157
+ * settled. Terminal for that Connect ID.
2067
2158
  */
2068
- class ConnectFailed_ extends UniffiEnum {
2159
+ class ConnectCancelled_ extends UniffiEnum {
2069
2160
  /**
2070
2161
  * @private
2071
2162
  * This field is private and should not be used, use `tag` instead.
2072
2163
  */
2073
2164
  [uniffiTypeNameSymbol] = "P2pEvent";
2074
- tag = P2pEvent_Tags.ConnectFailed;
2165
+ tag = P2pEvent_Tags.ConnectCancelled;
2075
2166
  constructor(inner) {
2076
- super("P2pEvent", "ConnectFailed");
2167
+ super("P2pEvent", "ConnectCancelled");
2077
2168
  this.inner = Object.freeze(inner);
2078
2169
  }
2079
2170
  static new(inner) {
2080
- return new ConnectFailed_(inner);
2171
+ return new ConnectCancelled_(inner);
2081
2172
  }
2082
2173
  static instanceOf(obj) {
2083
- return obj.tag === P2pEvent_Tags.ConnectFailed;
2174
+ return obj.tag === P2pEvent_Tags.ConnectCancelled;
2084
2175
  }
2085
2176
  }
2086
2177
  /**
@@ -2172,45 +2263,45 @@ export const P2pEvent = (() => {
2172
2263
  }
2173
2264
  }
2174
2265
  /**
2175
- * Pubsub outbound work was discarded.
2266
+ * Gossipsub outbound work was discarded.
2176
2267
  */
2177
- class PubsubOutboundFailure_ extends UniffiEnum {
2268
+ class GossipsubOutboundFailure_ extends UniffiEnum {
2178
2269
  /**
2179
2270
  * @private
2180
2271
  * This field is private and should not be used, use `tag` instead.
2181
2272
  */
2182
2273
  [uniffiTypeNameSymbol] = "P2pEvent";
2183
- tag = P2pEvent_Tags.PubsubOutboundFailure;
2274
+ tag = P2pEvent_Tags.GossipsubOutboundFailure;
2184
2275
  constructor(inner) {
2185
- super("P2pEvent", "PubsubOutboundFailure");
2276
+ super("P2pEvent", "GossipsubOutboundFailure");
2186
2277
  this.inner = Object.freeze(inner);
2187
2278
  }
2188
2279
  static new(inner) {
2189
- return new PubsubOutboundFailure_(inner);
2280
+ return new GossipsubOutboundFailure_(inner);
2190
2281
  }
2191
2282
  static instanceOf(obj) {
2192
- return obj.tag === P2pEvent_Tags.PubsubOutboundFailure;
2283
+ return obj.tag === P2pEvent_Tags.GossipsubOutboundFailure;
2193
2284
  }
2194
2285
  }
2195
2286
  /**
2196
- * A peer violated the pubsub protocol.
2287
+ * A peer violated the gossipsub protocol.
2197
2288
  */
2198
- class PubsubProtocolViolation_ extends UniffiEnum {
2289
+ class GossipsubProtocolViolation_ extends UniffiEnum {
2199
2290
  /**
2200
2291
  * @private
2201
2292
  * This field is private and should not be used, use `tag` instead.
2202
2293
  */
2203
2294
  [uniffiTypeNameSymbol] = "P2pEvent";
2204
- tag = P2pEvent_Tags.PubsubProtocolViolation;
2295
+ tag = P2pEvent_Tags.GossipsubProtocolViolation;
2205
2296
  constructor(inner) {
2206
- super("P2pEvent", "PubsubProtocolViolation");
2297
+ super("P2pEvent", "GossipsubProtocolViolation");
2207
2298
  this.inner = Object.freeze(inner);
2208
2299
  }
2209
2300
  static new(inner) {
2210
- return new PubsubProtocolViolation_(inner);
2301
+ return new GossipsubProtocolViolation_(inner);
2211
2302
  }
2212
2303
  static instanceOf(obj) {
2213
- return obj.tag === P2pEvent_Tags.PubsubProtocolViolation;
2304
+ return obj.tag === P2pEvent_Tags.GossipsubProtocolViolation;
2214
2305
  }
2215
2306
  }
2216
2307
  /**
@@ -2344,14 +2435,14 @@ export const P2pEvent = (() => {
2344
2435
  InboundPathEstablished: InboundPathEstablished_,
2345
2436
  PathUpgraded: PathUpgraded_,
2346
2437
  HolePunchFailed: HolePunchFailed_,
2347
- FellBackToRelay: FellBackToRelay_,
2348
2438
  ConnectFailed: ConnectFailed_,
2439
+ ConnectCancelled: ConnectCancelled_,
2349
2440
  InboundDirectUpgrade: InboundDirectUpgrade_,
2350
2441
  Message: Message_,
2351
2442
  PeerSubscribed: PeerSubscribed_,
2352
2443
  PeerUnsubscribed: PeerUnsubscribed_,
2353
- PubsubOutboundFailure: PubsubOutboundFailure_,
2354
- PubsubProtocolViolation: PubsubProtocolViolation_,
2444
+ GossipsubOutboundFailure: GossipsubOutboundFailure_,
2445
+ GossipsubProtocolViolation: GossipsubProtocolViolation_,
2355
2446
  PeerDiscovered: PeerDiscovered_,
2356
2447
  PeerUpdated: PeerUpdated_,
2357
2448
  PeerExpired: PeerExpired_,
@@ -2371,7 +2462,8 @@ const FfiConverterTypeP2pEvent = (() => {
2371
2462
  case 1:
2372
2463
  return new P2pEvent.EventsDropped({
2373
2464
  dropped: FfiConverterUInt64.readFromCursor(c),
2374
- totalDropped: FfiConverterUInt64.readFromCursor(c)
2465
+ totalDropped: FfiConverterUInt64.readFromCursor(c),
2466
+ terminalConnectIds: FfiConverterSequenceUInt64.readFromCursor(c)
2375
2467
  });
2376
2468
  case 2:
2377
2469
  return new P2pEvent.DriverFailed({
@@ -2465,6 +2557,7 @@ const FfiConverterTypeP2pEvent = (() => {
2465
2557
  return new P2pEvent.PathEstablished({
2466
2558
  connectId: FfiConverterUInt64.readFromCursor(c),
2467
2559
  peerId: FfiConverterString.readFromCursor(c),
2560
+ connId: FfiConverterUInt64.readFromCursor(c),
2468
2561
  path: FfiConverterTypePathKind.readFromCursor(c)
2469
2562
  });
2470
2563
  case 19:
@@ -2486,17 +2579,17 @@ const FfiConverterTypeP2pEvent = (() => {
2486
2579
  reason: FfiConverterString.readFromCursor(c)
2487
2580
  });
2488
2581
  case 22:
2489
- return new P2pEvent.FellBackToRelay({
2490
- connectId: FfiConverterUInt64.readFromCursor(c),
2491
- peerId: FfiConverterString.readFromCursor(c)
2492
- });
2493
- case 23:
2494
2582
  return new P2pEvent.ConnectFailed({
2495
2583
  connectId: FfiConverterUInt64.readFromCursor(c),
2496
2584
  peerId: FfiConverterString.readFromCursor(c),
2497
2585
  kind: FfiConverterTypeNatErrorKind.readFromCursor(c),
2498
2586
  detail: FfiConverterString.readFromCursor(c)
2499
2587
  });
2588
+ case 23:
2589
+ return new P2pEvent.ConnectCancelled({
2590
+ connectId: FfiConverterUInt64.readFromCursor(c),
2591
+ peerId: FfiConverterString.readFromCursor(c)
2592
+ });
2500
2593
  case 24:
2501
2594
  return new P2pEvent.InboundDirectUpgrade({
2502
2595
  peerId: FfiConverterString.readFromCursor(c)
@@ -2520,12 +2613,12 @@ const FfiConverterTypeP2pEvent = (() => {
2520
2613
  topic: FfiConverterString.readFromCursor(c)
2521
2614
  });
2522
2615
  case 28:
2523
- return new P2pEvent.PubsubOutboundFailure({
2616
+ return new P2pEvent.GossipsubOutboundFailure({
2524
2617
  peerId: FfiConverterString.readFromCursor(c),
2525
2618
  reason: FfiConverterString.readFromCursor(c)
2526
2619
  });
2527
2620
  case 29:
2528
- return new P2pEvent.PubsubProtocolViolation({
2621
+ return new P2pEvent.GossipsubProtocolViolation({
2529
2622
  peerId: FfiConverterString.readFromCursor(c),
2530
2623
  reason: FfiConverterString.readFromCursor(c)
2531
2624
  });
@@ -2569,6 +2662,7 @@ const FfiConverterTypeP2pEvent = (() => {
2569
2662
  const inner = value.inner;
2570
2663
  FfiConverterUInt64.writeIntoCursor(inner.dropped, c);
2571
2664
  FfiConverterUInt64.writeIntoCursor(inner.totalDropped, c);
2665
+ FfiConverterSequenceUInt64.writeIntoCursor(inner.terminalConnectIds, c);
2572
2666
  return;
2573
2667
  }
2574
2668
  case P2pEvent_Tags.DriverFailed:
@@ -2713,6 +2807,7 @@ const FfiConverterTypeP2pEvent = (() => {
2713
2807
  const inner = value.inner;
2714
2808
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
2715
2809
  FfiConverterString.writeIntoCursor(inner.peerId, c);
2810
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
2716
2811
  FfiConverterTypePathKind.writeIntoCursor(inner.path, c);
2717
2812
  return;
2718
2813
  }
@@ -2743,22 +2838,22 @@ const FfiConverterTypeP2pEvent = (() => {
2743
2838
  FfiConverterString.writeIntoCursor(inner.reason, c);
2744
2839
  return;
2745
2840
  }
2746
- case P2pEvent_Tags.FellBackToRelay:
2841
+ case P2pEvent_Tags.ConnectFailed:
2747
2842
  {
2748
2843
  c.writeI32(22);
2749
2844
  const inner = value.inner;
2750
2845
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
2751
2846
  FfiConverterString.writeIntoCursor(inner.peerId, c);
2847
+ FfiConverterTypeNatErrorKind.writeIntoCursor(inner.kind, c);
2848
+ FfiConverterString.writeIntoCursor(inner.detail, c);
2752
2849
  return;
2753
2850
  }
2754
- case P2pEvent_Tags.ConnectFailed:
2851
+ case P2pEvent_Tags.ConnectCancelled:
2755
2852
  {
2756
2853
  c.writeI32(23);
2757
2854
  const inner = value.inner;
2758
2855
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
2759
2856
  FfiConverterString.writeIntoCursor(inner.peerId, c);
2760
- FfiConverterTypeNatErrorKind.writeIntoCursor(inner.kind, c);
2761
- FfiConverterString.writeIntoCursor(inner.detail, c);
2762
2857
  return;
2763
2858
  }
2764
2859
  case P2pEvent_Tags.InboundDirectUpgrade:
@@ -2795,7 +2890,7 @@ const FfiConverterTypeP2pEvent = (() => {
2795
2890
  FfiConverterString.writeIntoCursor(inner.topic, c);
2796
2891
  return;
2797
2892
  }
2798
- case P2pEvent_Tags.PubsubOutboundFailure:
2893
+ case P2pEvent_Tags.GossipsubOutboundFailure:
2799
2894
  {
2800
2895
  c.writeI32(28);
2801
2896
  const inner = value.inner;
@@ -2803,7 +2898,7 @@ const FfiConverterTypeP2pEvent = (() => {
2803
2898
  FfiConverterString.writeIntoCursor(inner.reason, c);
2804
2899
  return;
2805
2900
  }
2806
- case P2pEvent_Tags.PubsubProtocolViolation:
2901
+ case P2pEvent_Tags.GossipsubProtocolViolation:
2807
2902
  {
2808
2903
  c.writeI32(29);
2809
2904
  const inner = value.inner;
@@ -2867,6 +2962,7 @@ const FfiConverterTypeP2pEvent = (() => {
2867
2962
  let size = 4;
2868
2963
  size += FfiConverterUInt64.allocationSize(inner.dropped);
2869
2964
  size += FfiConverterUInt64.allocationSize(inner.totalDropped);
2965
+ size += FfiConverterSequenceUInt64.allocationSize(inner.terminalConnectIds);
2870
2966
  return size;
2871
2967
  }
2872
2968
  case P2pEvent_Tags.DriverFailed:
@@ -3011,6 +3107,7 @@ const FfiConverterTypeP2pEvent = (() => {
3011
3107
  let size = 4;
3012
3108
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3013
3109
  size += FfiConverterString.allocationSize(inner.peerId);
3110
+ size += FfiConverterUInt64.allocationSize(inner.connId);
3014
3111
  size += FfiConverterTypePathKind.allocationSize(inner.path);
3015
3112
  return size;
3016
3113
  }
@@ -3041,22 +3138,22 @@ const FfiConverterTypeP2pEvent = (() => {
3041
3138
  size += FfiConverterString.allocationSize(inner.reason);
3042
3139
  return size;
3043
3140
  }
3044
- case P2pEvent_Tags.FellBackToRelay:
3141
+ case P2pEvent_Tags.ConnectFailed:
3045
3142
  {
3046
3143
  const inner = value.inner;
3047
3144
  let size = 4;
3048
3145
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3049
3146
  size += FfiConverterString.allocationSize(inner.peerId);
3147
+ size += FfiConverterTypeNatErrorKind.allocationSize(inner.kind);
3148
+ size += FfiConverterString.allocationSize(inner.detail);
3050
3149
  return size;
3051
3150
  }
3052
- case P2pEvent_Tags.ConnectFailed:
3151
+ case P2pEvent_Tags.ConnectCancelled:
3053
3152
  {
3054
3153
  const inner = value.inner;
3055
3154
  let size = 4;
3056
3155
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3057
3156
  size += FfiConverterString.allocationSize(inner.peerId);
3058
- size += FfiConverterTypeNatErrorKind.allocationSize(inner.kind);
3059
- size += FfiConverterString.allocationSize(inner.detail);
3060
3157
  return size;
3061
3158
  }
3062
3159
  case P2pEvent_Tags.InboundDirectUpgrade:
@@ -3093,7 +3190,7 @@ const FfiConverterTypeP2pEvent = (() => {
3093
3190
  size += FfiConverterString.allocationSize(inner.topic);
3094
3191
  return size;
3095
3192
  }
3096
- case P2pEvent_Tags.PubsubOutboundFailure:
3193
+ case P2pEvent_Tags.GossipsubOutboundFailure:
3097
3194
  {
3098
3195
  const inner = value.inner;
3099
3196
  let size = 4;
@@ -3101,7 +3198,7 @@ const FfiConverterTypeP2pEvent = (() => {
3101
3198
  size += FfiConverterString.allocationSize(inner.reason);
3102
3199
  return size;
3103
3200
  }
3104
- case P2pEvent_Tags.PubsubProtocolViolation:
3201
+ case P2pEvent_Tags.GossipsubProtocolViolation:
3105
3202
  {
3106
3203
  const inner = value.inner;
3107
3204
  let size = 4;
@@ -3341,29 +3438,11 @@ export class P2pEndpoint extends UniffiAbstractObject {
3341
3438
  }
3342
3439
 
3343
3440
  /**
3344
- * Starts a connection attempt.
3345
- */
3346
- connect(peerId) /*throws*/{
3347
- return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3348
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc), callStatus);
3349
- }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3350
- }
3351
-
3352
- /**
3353
- * Starts a direct-address connection attempt.
3354
- */
3355
- connectAddr(address) /*throws*/{
3356
- return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3357
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect_addr(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(address, nativeModule().rustbuffer_alloc), callStatus);
3358
- }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3359
- }
3360
-
3361
- /**
3362
- * Starts a connection attempt with explicit addresses.
3441
+ * Starts one Connection attempt and returns its Connect ID.
3363
3442
  */
3364
- connectWithAddrs(peerId, addresses) /*throws*/{
3443
+ connect(target) /*throws*/{
3365
3444
  return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3366
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect_with_addrs(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc), FfiConverterSequenceString.lower(addresses, nativeModule().rustbuffer_alloc), callStatus);
3445
+ return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterTypeConnectTarget.lower(target, nativeModule().rustbuffer_alloc), callStatus);
3367
3446
  }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3368
3447
  }
3369
3448
 
@@ -3382,37 +3461,19 @@ export class P2pEndpoint extends UniffiAbstractObject {
3382
3461
  }
3383
3462
 
3384
3463
  /**
3385
- * Dials on all applicable address families.
3464
+ * Returns the transport connection selected for a peer.
3386
3465
  */
3387
- dial(address) /*throws*/{
3466
+ connectionInfo(peerId) /*throws*/{
3388
3467
  const __rb = uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3389
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_dial(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(address, nativeModule().rustbuffer_alloc), callStatus);
3468
+ return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connection_info(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc), callStatus);
3390
3469
  }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString));
3391
3470
  try {
3392
- return FfiConverterSequenceUInt64.lift(__rb);
3471
+ return FfiConverterOptionalTypeConnectionInfo.lift(__rb);
3393
3472
  } finally {
3394
3473
  nativeModule().rustbuffer_free(__rb);
3395
3474
  }
3396
3475
  }
3397
3476
 
3398
- /**
3399
- * Dials using IPv4.
3400
- */
3401
- dialIp4(address) /*throws*/{
3402
- return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3403
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_dial_ip4(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(address, nativeModule().rustbuffer_alloc), callStatus);
3404
- }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3405
- }
3406
-
3407
- /**
3408
- * Dials using IPv6.
3409
- */
3410
- dialIp6(address) /*throws*/{
3411
- return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3412
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_dial_ip6(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(address, nativeModule().rustbuffer_alloc), callStatus);
3413
- }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3414
- }
3415
-
3416
3477
  /**
3417
3478
  * Disconnects a peer.
3418
3479
  */
@@ -3712,9 +3773,6 @@ const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
3712
3773
  // FfiConverter for Array<string> | undefined
3713
3774
  const FfiConverterOptionalSequenceString = new FfiConverterOptional(FfiConverterSequenceString);
3714
3775
 
3715
- // FfiConverter for TransportOptions | undefined
3716
- const FfiConverterOptionalTypeTransportOptions = new FfiConverterOptional(FfiConverterTypeTransportOptions);
3717
-
3718
3776
  // FfiConverter for DiscoveryOptions | undefined
3719
3777
  const FfiConverterOptionalTypeDiscoveryOptions = new FfiConverterOptional(FfiConverterTypeDiscoveryOptions);
3720
3778
 
@@ -3727,11 +3785,14 @@ const FfiConverterOptionalBytes = new FfiConverterOptional(FfiConverterArrayBuff
3727
3785
  // FfiConverter for bigint | undefined
3728
3786
  const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
3729
3787
 
3788
+ // FfiConverter for Array<bigint>
3789
+ const FfiConverterSequenceUInt64 = new FfiConverterArray(FfiConverterUInt64);
3790
+
3730
3791
  // FfiConverter for RelayReservationInfo | undefined
3731
3792
  const FfiConverterOptionalTypeRelayReservationInfo = new FfiConverterOptional(FfiConverterTypeRelayReservationInfo);
3732
3793
 
3733
- // FfiConverter for Array<bigint>
3734
- const FfiConverterSequenceUInt64 = new FfiConverterArray(FfiConverterUInt64);
3794
+ // FfiConverter for ConnectionInfo | undefined
3795
+ const FfiConverterOptionalTypeConnectionInfo = new FfiConverterOptional(FfiConverterTypeConnectionInfo);
3735
3796
 
3736
3797
  // FfiConverter for Array<P2pEvent>
3737
3798
  const FfiConverterSequenceTypeP2pEvent = new FfiConverterArray(FfiConverterTypeP2pEvent);
@@ -3790,26 +3851,14 @@ function uniffiEnsureInitialized() {
3790
3851
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write() !== 17994) {
3791
3852
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write");
3792
3853
  }
3793
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !== 42064) {
3854
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !== 53603) {
3794
3855
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect");
3795
3856
  }
3796
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_addr() !== 56611) {
3797
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_addr");
3798
- }
3799
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_with_addrs() !== 2062) {
3800
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_with_addrs");
3801
- }
3802
3857
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers() !== 64148) {
3803
3858
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers");
3804
3859
  }
3805
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial() !== 35216) {
3806
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial");
3807
- }
3808
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip4() !== 54241) {
3809
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip4");
3810
- }
3811
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip6() !== 3676) {
3812
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip6");
3860
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info() !== 24337) {
3861
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info");
3813
3862
  }
3814
3863
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect() !== 23975) {
3815
3864
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect");
@@ -3885,6 +3934,8 @@ function uniffiEnsureInitialized() {
3885
3934
  export default Object.freeze({
3886
3935
  initialize: uniffiEnsureInitialized,
3887
3936
  converters: {
3937
+ FfiConverterTypeConnectTarget,
3938
+ FfiConverterTypeConnectionInfo,
3888
3939
  FfiConverterTypeDiscoveryOptions,
3889
3940
  FfiConverterTypeDiscoverySource,
3890
3941
  FfiConverterTypeDriverFailureKind,
@@ -3900,10 +3951,8 @@ export default Object.freeze({
3900
3951
  FfiConverterTypeP2pEvent,
3901
3952
  FfiConverterTypeP2pEventDoorbell,
3902
3953
  FfiConverterTypePathKind,
3903
- FfiConverterTypePubsubRouter,
3904
3954
  FfiConverterTypeReachability,
3905
- FfiConverterTypeRelayReservationInfo,
3906
- FfiConverterTypeTransportOptions
3955
+ FfiConverterTypeRelayReservationInfo
3907
3956
  }
3908
3957
  });
3909
3958
  //# sourceMappingURL=minip2p_ffi.js.map