@minip2p/react-native 0.7.3 → 0.7.5

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.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/android/CMakeLists.txt +1 -0
  3. package/android/src/main/jniLibs/arm64-v8a/libminip2p_ffi.so +0 -0
  4. package/android/src/main/jniLibs/x86_64/libminip2p_ffi.so +0 -0
  5. package/build/Minip2pFfi.xcframework/Info.plist +4 -4
  6. package/build/Minip2pFfi.xcframework/ios-arm64/libminip2p_ffi.a +2 -2
  7. package/build/Minip2pFfi.xcframework/ios-arm64-simulator/libminip2p_ffi.a +2 -2
  8. package/cpp/generated/minip2p_ffi.cpp +45 -3
  9. package/cpp/generated/minip2p_ffi.hpp +2 -0
  10. package/cpp/generated/minip2p_ffi_core.cpp +1999 -0
  11. package/cpp/generated/minip2p_ffi_core.hpp +51 -0
  12. package/cpp/react-native-minip2p.cpp +2 -0
  13. package/lib/module/adapter.js +78 -64
  14. package/lib/module/adapter.js.map +1 -1
  15. package/lib/module/generated/minip2p_ffi-ffi.js.map +1 -1
  16. package/lib/module/generated/minip2p_ffi.js +68 -3287
  17. package/lib/module/generated/minip2p_ffi.js.map +1 -1
  18. package/lib/module/generated/minip2p_ffi_core-ffi.js +20 -0
  19. package/lib/module/generated/minip2p_ffi_core-ffi.js.map +1 -0
  20. package/lib/module/generated/minip2p_ffi_core.js +3441 -0
  21. package/lib/module/generated/minip2p_ffi_core.js.map +1 -0
  22. package/lib/module/low-level.js +1 -0
  23. package/lib/module/low-level.js.map +1 -1
  24. package/lib/module/native.js +5 -1
  25. package/lib/module/native.js.map +1 -1
  26. package/lib/typescript/src/adapter.d.ts.map +1 -1
  27. package/lib/typescript/src/generated/minip2p_ffi-ffi.d.ts +3 -1
  28. package/lib/typescript/src/generated/minip2p_ffi-ffi.d.ts.map +1 -1
  29. package/lib/typescript/src/generated/minip2p_ffi.d.ts +24 -3396
  30. package/lib/typescript/src/generated/minip2p_ffi.d.ts.map +1 -1
  31. package/lib/typescript/src/generated/minip2p_ffi_core-ffi.d.ts +67 -0
  32. package/lib/typescript/src/generated/minip2p_ffi_core-ffi.d.ts.map +1 -0
  33. package/lib/typescript/src/generated/minip2p_ffi_core.d.ts +3522 -0
  34. package/lib/typescript/src/generated/minip2p_ffi_core.d.ts.map +1 -0
  35. package/lib/typescript/src/low-level.d.ts +1 -0
  36. package/lib/typescript/src/low-level.d.ts.map +1 -1
  37. package/lib/typescript/src/native.d.ts +3 -0
  38. package/lib/typescript/src/native.d.ts.map +1 -1
  39. package/package.json +4 -4
  40. package/src/adapter.ts +107 -71
  41. package/src/generated/minip2p_ffi-ffi.ts +3 -1
  42. package/src/generated/minip2p_ffi.ts +77 -3864
  43. package/src/generated/minip2p_ffi_core-ffi.ts +97 -0
  44. package/src/generated/minip2p_ffi_core.ts +4049 -0
  45. package/src/low-level.ts +1 -0
  46. package/src/native.tsx +4 -0
  47. package/lib/module/event-drain.js +0 -71
  48. package/lib/module/event-drain.js.map +0 -1
  49. package/lib/typescript/src/event-drain.d.ts +0 -10
  50. package/lib/typescript/src/event-drain.d.ts.map +0 -1
  51. package/src/event-drain.ts +0 -80
@@ -6,7 +6,21 @@
6
6
  /* eslint-disable */
7
7
  // @ts-nocheck
8
8
  import nativeModule from "./minip2p_ffi-ffi.js";
9
- import { AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt32, FfiConverterUInt64, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiTraitInterfaceCall, uniffiTypeNameSymbol } from "@ubjs/core";
9
+ import { FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt32, FfiConverterUInt64, UniffiAbstractObject, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiTraitInterfaceCall, uniffiTypeNameSymbol } from "@ubjs/core";
10
+ import uniffiMinip2pFfiCoreModule from "./minip2p_ffi_core.js";
11
+ const {
12
+ FfiConverterTypeConnectTarget,
13
+ FfiConverterTypeConnectionInfo,
14
+ FfiConverterTypeEndpointConfig,
15
+ FfiConverterTypeFfiError,
16
+ FfiConverterTypeIdentifyInfo,
17
+ FfiConverterTypeKnownPeerInfo,
18
+ FfiConverterTypeOpenStreamResult,
19
+ FfiConverterTypeP2pEvent,
20
+ FfiConverterTypePathKind,
21
+ FfiConverterTypeReachability,
22
+ FfiConverterTypeRelayReservationInfo
23
+ } = uniffiMinip2pFfiCoreModule.converters;
10
24
  const uniffiCaller = new UniffiRustCaller(() => ({
11
25
  code: 0
12
26
  }));
@@ -98,3222 +112,6 @@ const stringConverter = (() => {
98
112
  })();
99
113
  const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
100
114
 
101
- /**
102
- * State snapshot of the transport connection selected for a peer.
103
- */
104
-
105
- /**
106
- * Generated factory for {@link ConnectionInfo} record objects.
107
- */
108
- export const ConnectionInfo = (() => {
109
- const defaults = () => ({});
110
- const create = (() => {
111
- return uniffiCreateRecord(defaults);
112
- })();
113
- return Object.freeze({
114
- create,
115
- new: create,
116
- defaults: () => Object.freeze(defaults())
117
- });
118
- })();
119
- const FfiConverterTypeConnectionInfo = (() => {
120
- class FFIConverter extends AbstractFfiConverterByteArray {
121
- readFromCursor(c) {
122
- return {
123
- connId: FfiConverterUInt64.readFromCursor(c),
124
- remoteAddr: FfiConverterOptionalString.readFromCursor(c),
125
- readyProtocols: FfiConverterOptionalSequenceString.readFromCursor(c)
126
- };
127
- }
128
- writeIntoCursor(value, c) {
129
- FfiConverterUInt64.writeIntoCursor(value.connId, c);
130
- FfiConverterOptionalString.writeIntoCursor(value.remoteAddr, c);
131
- FfiConverterOptionalSequenceString.writeIntoCursor(value.readyProtocols, c);
132
- }
133
- allocationSize(value) {
134
- return FfiConverterUInt64.allocationSize(value.connId) + FfiConverterOptionalString.allocationSize(value.remoteAddr) + FfiConverterOptionalSequenceString.allocationSize(value.readyProtocols);
135
- }
136
- }
137
- ;
138
- return new FFIConverter();
139
- })();
140
-
141
- /**
142
- * Signed-discovery configuration.
143
- */
144
-
145
- /**
146
- * Generated factory for {@link DiscoveryOptions} record objects.
147
- */
148
- export const DiscoveryOptions = (() => {
149
- const defaults = () => ({});
150
- const create = (() => {
151
- return uniffiCreateRecord(defaults);
152
- })();
153
- return Object.freeze({
154
- create,
155
- new: create,
156
- defaults: () => Object.freeze(defaults())
157
- });
158
- })();
159
- const FfiConverterTypeDiscoveryOptions = (() => {
160
- class FFIConverter extends AbstractFfiConverterByteArray {
161
- readFromCursor(c) {
162
- return {
163
- topic: FfiConverterString.readFromCursor(c),
164
- beaconIntervalMs: FfiConverterUInt64.readFromCursor(c),
165
- peerTtlMs: FfiConverterUInt64.readFromCursor(c),
166
- autoDial: FfiConverterBool.readFromCursor(c)
167
- };
168
- }
169
- writeIntoCursor(value, c) {
170
- FfiConverterString.writeIntoCursor(value.topic, c);
171
- FfiConverterUInt64.writeIntoCursor(value.beaconIntervalMs, c);
172
- FfiConverterUInt64.writeIntoCursor(value.peerTtlMs, c);
173
- FfiConverterBool.writeIntoCursor(value.autoDial, c);
174
- }
175
- allocationSize(value) {
176
- return FfiConverterString.allocationSize(value.topic) + FfiConverterUInt64.allocationSize(value.beaconIntervalMs) + FfiConverterUInt64.allocationSize(value.peerTtlMs) + FfiConverterBool.allocationSize(value.autoDial);
177
- }
178
- }
179
- ;
180
- return new FFIConverter();
181
- })();
182
-
183
- /**
184
- * Local-link mDNS discovery configuration.
185
- */
186
-
187
- /**
188
- * Generated factory for {@link MdnsOptions} record objects.
189
- */
190
- export const MdnsOptions = (() => {
191
- const defaults = () => ({});
192
- const create = (() => {
193
- return uniffiCreateRecord(defaults);
194
- })();
195
- return Object.freeze({
196
- create,
197
- new: create,
198
- defaults: () => Object.freeze(defaults())
199
- });
200
- })();
201
- const FfiConverterTypeMdnsOptions = (() => {
202
- class FFIConverter extends AbstractFfiConverterByteArray {
203
- readFromCursor(c) {
204
- return {
205
- enableIpv6: FfiConverterBool.readFromCursor(c),
206
- ttlMs: FfiConverterUInt64.readFromCursor(c),
207
- queryIntervalMs: FfiConverterUInt64.readFromCursor(c),
208
- maxPacketBytes: FfiConverterUInt32.readFromCursor(c),
209
- maxAnnouncedAddrs: FfiConverterUInt32.readFromCursor(c),
210
- interfaceRefreshMs: FfiConverterUInt64.readFromCursor(c),
211
- socketPollIntervalMs: FfiConverterUInt64.readFromCursor(c),
212
- autoDial: FfiConverterBool.readFromCursor(c)
213
- };
214
- }
215
- writeIntoCursor(value, c) {
216
- FfiConverterBool.writeIntoCursor(value.enableIpv6, c);
217
- FfiConverterUInt64.writeIntoCursor(value.ttlMs, c);
218
- FfiConverterUInt64.writeIntoCursor(value.queryIntervalMs, c);
219
- FfiConverterUInt32.writeIntoCursor(value.maxPacketBytes, c);
220
- FfiConverterUInt32.writeIntoCursor(value.maxAnnouncedAddrs, c);
221
- FfiConverterUInt64.writeIntoCursor(value.interfaceRefreshMs, c);
222
- FfiConverterUInt64.writeIntoCursor(value.socketPollIntervalMs, c);
223
- FfiConverterBool.writeIntoCursor(value.autoDial, c);
224
- }
225
- allocationSize(value) {
226
- return FfiConverterBool.allocationSize(value.enableIpv6) + FfiConverterUInt64.allocationSize(value.ttlMs) + FfiConverterUInt64.allocationSize(value.queryIntervalMs) + FfiConverterUInt32.allocationSize(value.maxPacketBytes) + FfiConverterUInt32.allocationSize(value.maxAnnouncedAddrs) + FfiConverterUInt64.allocationSize(value.interfaceRefreshMs) + FfiConverterUInt64.allocationSize(value.socketPollIntervalMs) + FfiConverterBool.allocationSize(value.autoDial);
227
- }
228
- }
229
- ;
230
- return new FFIConverter();
231
- })();
232
-
233
- /**
234
- * Configuration used to construct an FFI endpoint.
235
- */
236
-
237
- /**
238
- * Generated factory for {@link EndpointConfig} record objects.
239
- */
240
- export const EndpointConfig = (() => {
241
- const defaults = () => ({});
242
- const create = (() => {
243
- return uniffiCreateRecord(defaults);
244
- })();
245
- return Object.freeze({
246
- create,
247
- new: create,
248
- defaults: () => Object.freeze(defaults())
249
- });
250
- })();
251
- const FfiConverterTypeEndpointConfig = (() => {
252
- class FFIConverter extends AbstractFfiConverterByteArray {
253
- readFromCursor(c) {
254
- return {
255
- agentVersion: FfiConverterOptionalString.readFromCursor(c),
256
- relays: FfiConverterSequenceString.readFromCursor(c),
257
- autonatServers: FfiConverterSequenceString.readFromCursor(c),
258
- listen: FfiConverterOptionalSequenceString.readFromCursor(c),
259
- forceRelay: FfiConverterBool.readFromCursor(c),
260
- allowUnsigned: FfiConverterBool.readFromCursor(c),
261
- protocols: FfiConverterSequenceString.readFromCursor(c),
262
- discovery: FfiConverterOptionalTypeDiscoveryOptions.readFromCursor(c),
263
- mdns: FfiConverterOptionalTypeMdnsOptions.readFromCursor(c)
264
- };
265
- }
266
- writeIntoCursor(value, c) {
267
- FfiConverterOptionalString.writeIntoCursor(value.agentVersion, c);
268
- FfiConverterSequenceString.writeIntoCursor(value.relays, c);
269
- FfiConverterSequenceString.writeIntoCursor(value.autonatServers, c);
270
- FfiConverterOptionalSequenceString.writeIntoCursor(value.listen, c);
271
- FfiConverterBool.writeIntoCursor(value.forceRelay, c);
272
- FfiConverterBool.writeIntoCursor(value.allowUnsigned, c);
273
- FfiConverterSequenceString.writeIntoCursor(value.protocols, c);
274
- FfiConverterOptionalTypeDiscoveryOptions.writeIntoCursor(value.discovery, c);
275
- FfiConverterOptionalTypeMdnsOptions.writeIntoCursor(value.mdns, c);
276
- }
277
- allocationSize(value) {
278
- 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);
279
- }
280
- }
281
- ;
282
- return new FFIConverter();
283
- })();
284
-
285
- /**
286
- * Foreign-friendly snapshot of a peer's Identify message.
287
- */
288
-
289
- /**
290
- * Generated factory for {@link IdentifyInfo} record objects.
291
- */
292
- export const IdentifyInfo = (() => {
293
- const defaults = () => ({});
294
- const create = (() => {
295
- return uniffiCreateRecord(defaults);
296
- })();
297
- return Object.freeze({
298
- create,
299
- new: create,
300
- defaults: () => Object.freeze(defaults())
301
- });
302
- })();
303
- const FfiConverterTypeIdentifyInfo = (() => {
304
- class FFIConverter extends AbstractFfiConverterByteArray {
305
- readFromCursor(c) {
306
- return {
307
- publicKey: FfiConverterOptionalBytes.readFromCursor(c),
308
- listenAddrs: FfiConverterSequenceString.readFromCursor(c),
309
- protocols: FfiConverterSequenceString.readFromCursor(c),
310
- observedAddr: FfiConverterOptionalString.readFromCursor(c),
311
- protocolVersion: FfiConverterOptionalString.readFromCursor(c),
312
- agentVersion: FfiConverterOptionalString.readFromCursor(c)
313
- };
314
- }
315
- writeIntoCursor(value, c) {
316
- FfiConverterOptionalBytes.writeIntoCursor(value.publicKey, c);
317
- FfiConverterSequenceString.writeIntoCursor(value.listenAddrs, c);
318
- FfiConverterSequenceString.writeIntoCursor(value.protocols, c);
319
- FfiConverterOptionalString.writeIntoCursor(value.observedAddr, c);
320
- FfiConverterOptionalString.writeIntoCursor(value.protocolVersion, c);
321
- FfiConverterOptionalString.writeIntoCursor(value.agentVersion, c);
322
- }
323
- allocationSize(value) {
324
- return FfiConverterOptionalBytes.allocationSize(value.publicKey) + FfiConverterSequenceString.allocationSize(value.listenAddrs) + FfiConverterSequenceString.allocationSize(value.protocols) + FfiConverterOptionalString.allocationSize(value.observedAddr) + FfiConverterOptionalString.allocationSize(value.protocolVersion) + FfiConverterOptionalString.allocationSize(value.agentVersion);
325
- }
326
- }
327
- ;
328
- return new FFIConverter();
329
- })();
330
-
331
- /**
332
- * One peer in the shared discovery address book.
333
- */
334
-
335
- /**
336
- * Generated factory for {@link KnownPeerInfo} record objects.
337
- */
338
- export const KnownPeerInfo = (() => {
339
- const defaults = () => ({});
340
- const create = (() => {
341
- return uniffiCreateRecord(defaults);
342
- })();
343
- return Object.freeze({
344
- create,
345
- new: create,
346
- defaults: () => Object.freeze(defaults())
347
- });
348
- })();
349
- const FfiConverterTypeKnownPeerInfo = (() => {
350
- class FFIConverter extends AbstractFfiConverterByteArray {
351
- readFromCursor(c) {
352
- return {
353
- peerId: FfiConverterString.readFromCursor(c),
354
- addrs: FfiConverterSequenceString.readFromCursor(c),
355
- beaconAddrs: FfiConverterSequenceString.readFromCursor(c),
356
- mdnsAddrs: FfiConverterSequenceString.readFromCursor(c),
357
- beaconLastSeenAgeMs: FfiConverterOptionalUInt64.readFromCursor(c),
358
- mdnsLastSeenAgeMs: FfiConverterOptionalUInt64.readFromCursor(c),
359
- connected: FfiConverterBool.readFromCursor(c)
360
- };
361
- }
362
- writeIntoCursor(value, c) {
363
- FfiConverterString.writeIntoCursor(value.peerId, c);
364
- FfiConverterSequenceString.writeIntoCursor(value.addrs, c);
365
- FfiConverterSequenceString.writeIntoCursor(value.beaconAddrs, c);
366
- FfiConverterSequenceString.writeIntoCursor(value.mdnsAddrs, c);
367
- FfiConverterOptionalUInt64.writeIntoCursor(value.beaconLastSeenAgeMs, c);
368
- FfiConverterOptionalUInt64.writeIntoCursor(value.mdnsLastSeenAgeMs, c);
369
- FfiConverterBool.writeIntoCursor(value.connected, c);
370
- }
371
- allocationSize(value) {
372
- return FfiConverterString.allocationSize(value.peerId) + FfiConverterSequenceString.allocationSize(value.addrs) + FfiConverterSequenceString.allocationSize(value.beaconAddrs) + FfiConverterSequenceString.allocationSize(value.mdnsAddrs) + FfiConverterOptionalUInt64.allocationSize(value.beaconLastSeenAgeMs) + FfiConverterOptionalUInt64.allocationSize(value.mdnsLastSeenAgeMs) + FfiConverterBool.allocationSize(value.connected);
373
- }
374
- }
375
- ;
376
- return new FFIConverter();
377
- })();
378
-
379
- /**
380
- * Full identity allocated for an outbound application stream.
381
- */
382
-
383
- /**
384
- * Generated factory for {@link OpenStreamResult} record objects.
385
- */
386
- export const OpenStreamResult = (() => {
387
- const defaults = () => ({});
388
- const create = (() => {
389
- return uniffiCreateRecord(defaults);
390
- })();
391
- return Object.freeze({
392
- create,
393
- new: create,
394
- defaults: () => Object.freeze(defaults())
395
- });
396
- })();
397
- const FfiConverterTypeOpenStreamResult = (() => {
398
- class FFIConverter extends AbstractFfiConverterByteArray {
399
- readFromCursor(c) {
400
- return {
401
- connId: FfiConverterUInt64.readFromCursor(c),
402
- streamId: FfiConverterUInt64.readFromCursor(c)
403
- };
404
- }
405
- writeIntoCursor(value, c) {
406
- FfiConverterUInt64.writeIntoCursor(value.connId, c);
407
- FfiConverterUInt64.writeIntoCursor(value.streamId, c);
408
- }
409
- allocationSize(value) {
410
- return FfiConverterUInt64.allocationSize(value.connId) + FfiConverterUInt64.allocationSize(value.streamId);
411
- }
412
- }
413
- ;
414
- return new FFIConverter();
415
- })();
416
-
417
- /**
418
- * Snapshot of the active inbound relay reservation.
419
- */
420
-
421
- /**
422
- * Generated factory for {@link RelayReservationInfo} record objects.
423
- */
424
- export const RelayReservationInfo = (() => {
425
- const defaults = () => ({});
426
- const create = (() => {
427
- return uniffiCreateRecord(defaults);
428
- })();
429
- return Object.freeze({
430
- create,
431
- new: create,
432
- defaults: () => Object.freeze(defaults())
433
- });
434
- })();
435
- const FfiConverterTypeRelayReservationInfo = (() => {
436
- class FFIConverter extends AbstractFfiConverterByteArray {
437
- readFromCursor(c) {
438
- return {
439
- relayPeerId: FfiConverterString.readFromCursor(c),
440
- expiresUnixSecs: FfiConverterOptionalUInt64.readFromCursor(c)
441
- };
442
- }
443
- writeIntoCursor(value, c) {
444
- FfiConverterString.writeIntoCursor(value.relayPeerId, c);
445
- FfiConverterOptionalUInt64.writeIntoCursor(value.expiresUnixSecs, c);
446
- }
447
- allocationSize(value) {
448
- return FfiConverterString.allocationSize(value.relayPeerId) + FfiConverterOptionalUInt64.allocationSize(value.expiresUnixSecs);
449
- }
450
- }
451
- ;
452
- return new FFIConverter();
453
- })();
454
-
455
- // Enum: ConnectTarget
456
- export let ConnectTarget_Tags = /*#__PURE__*/function (ConnectTarget_Tags) {
457
- ConnectTarget_Tags["Peer"] = "Peer";
458
- ConnectTarget_Tags["Addresses"] = "Addresses";
459
- return ConnectTarget_Tags;
460
- }({});
461
- /**
462
- * What a foreign runtime supplies to start one Connection attempt.
463
- *
464
- * Validation lives in `minip2p-ffi-core`; this mirror only declares the shape.
465
- */
466
- export const ConnectTarget = (() => {
467
- /**
468
- * Peer ID only: the endpoint applies its discovery-book and relay
469
- * policy.
470
- */
471
- class Peer_ extends UniffiEnum {
472
- /**
473
- * @private
474
- * This field is private and should not be used, use `tag` instead.
475
- */
476
- [uniffiTypeNameSymbol] = "ConnectTarget";
477
- tag = ConnectTarget_Tags.Peer;
478
- constructor(inner) {
479
- super("ConnectTarget", "Peer");
480
- this.inner = Object.freeze(inner);
481
- }
482
- static new(inner) {
483
- return new Peer_(inner);
484
- }
485
- static instanceOf(obj) {
486
- return obj.tag === ConnectTarget_Tags.Peer;
487
- }
488
- }
489
- /**
490
- * One or more complete direct peer addresses that all name the same
491
- * peer. One address is the single-address form.
492
- */
493
- class Addresses_ extends UniffiEnum {
494
- /**
495
- * @private
496
- * This field is private and should not be used, use `tag` instead.
497
- */
498
- [uniffiTypeNameSymbol] = "ConnectTarget";
499
- tag = ConnectTarget_Tags.Addresses;
500
- constructor(inner) {
501
- super("ConnectTarget", "Addresses");
502
- this.inner = Object.freeze(inner);
503
- }
504
- static new(inner) {
505
- return new Addresses_(inner);
506
- }
507
- static instanceOf(obj) {
508
- return obj.tag === ConnectTarget_Tags.Addresses;
509
- }
510
- }
511
- function instanceOf(obj) {
512
- return obj[uniffiTypeNameSymbol] === "ConnectTarget";
513
- }
514
- return Object.freeze({
515
- instanceOf,
516
- Peer: Peer_,
517
- Addresses: Addresses_
518
- });
519
- })();
520
- /**
521
- * What a foreign runtime supplies to start one Connection attempt.
522
- *
523
- * Validation lives in `minip2p-ffi-core`; this mirror only declares the shape.
524
- */
525
-
526
- // FfiConverter for enum ConnectTarget
527
- const FfiConverterTypeConnectTarget = (() => {
528
- class FFIConverter extends AbstractFfiConverterByteArray {
529
- readFromCursor(c) {
530
- switch (c.readI32()) {
531
- case 1:
532
- return new ConnectTarget.Peer({
533
- peerId: FfiConverterString.readFromCursor(c)
534
- });
535
- case 2:
536
- return new ConnectTarget.Addresses({
537
- addresses: FfiConverterSequenceString.readFromCursor(c)
538
- });
539
- default:
540
- throw new UniffiInternalError.UnexpectedEnumCase();
541
- }
542
- }
543
- writeIntoCursor(value, c) {
544
- switch (value.tag) {
545
- case ConnectTarget_Tags.Peer:
546
- {
547
- c.writeI32(1);
548
- const inner = value.inner;
549
- FfiConverterString.writeIntoCursor(inner.peerId, c);
550
- return;
551
- }
552
- case ConnectTarget_Tags.Addresses:
553
- {
554
- c.writeI32(2);
555
- const inner = value.inner;
556
- FfiConverterSequenceString.writeIntoCursor(inner.addresses, c);
557
- return;
558
- }
559
- default:
560
- // Throwing from here means that ConnectTarget_Tags hasn't matched an ordinal.
561
- throw new UniffiInternalError.UnexpectedEnumCase();
562
- }
563
- }
564
- allocationSize(value) {
565
- switch (value.tag) {
566
- case ConnectTarget_Tags.Peer:
567
- {
568
- const inner = value.inner;
569
- let size = 4;
570
- size += FfiConverterString.allocationSize(inner.peerId);
571
- return size;
572
- }
573
- case ConnectTarget_Tags.Addresses:
574
- {
575
- const inner = value.inner;
576
- let size = 4;
577
- size += FfiConverterSequenceString.allocationSize(inner.addresses);
578
- return size;
579
- }
580
- default:
581
- throw new UniffiInternalError.UnexpectedEnumCase();
582
- }
583
- }
584
- }
585
- return new FFIConverter();
586
- })();
587
-
588
- /**
589
- * Source that contributed a discovery observation.
590
- */
591
- export let DiscoverySource = /*#__PURE__*/function (DiscoverySource) {
592
- /**
593
- * Public-key-authenticated signed beacon.
594
- */
595
- DiscoverySource[DiscoverySource["SignedBeacon"] = 0] = "SignedBeacon";
596
- /**
597
- * Unauthenticated local-link mDNS observation.
598
- */
599
- DiscoverySource[DiscoverySource["Mdns"] = 1] = "Mdns";
600
- return DiscoverySource;
601
- }({});
602
- const FfiConverterTypeDiscoverySource = (() => {
603
- class FFIConverter extends AbstractFfiConverterByteArray {
604
- readFromCursor(c) {
605
- switch (c.readI32()) {
606
- case 1:
607
- return DiscoverySource.SignedBeacon;
608
- case 2:
609
- return DiscoverySource.Mdns;
610
- default:
611
- throw new UniffiInternalError.UnexpectedEnumCase();
612
- }
613
- }
614
- writeIntoCursor(value, c) {
615
- switch (value) {
616
- case DiscoverySource.SignedBeacon:
617
- return c.writeI32(1);
618
- case DiscoverySource.Mdns:
619
- return c.writeI32(2);
620
- }
621
- }
622
- allocationSize(value) {
623
- return 4;
624
- }
625
- }
626
- return new FFIConverter();
627
- })();
628
-
629
- /**
630
- * Category of a fatal background-driver failure.
631
- */
632
- export let DriverFailureKind = /*#__PURE__*/function (DriverFailureKind) {
633
- /**
634
- * The transport driver failed.
635
- */
636
- DriverFailureKind[DriverFailureKind["Transport"] = 0] = "Transport";
637
- /**
638
- * The swarm driver failed.
639
- */
640
- DriverFailureKind[DriverFailureKind["Swarm"] = 1] = "Swarm";
641
- /**
642
- * An internal driver invariant failed.
643
- */
644
- DriverFailureKind[DriverFailureKind["Invariant"] = 2] = "Invariant";
645
- /**
646
- * The background pump panicked.
647
- */
648
- DriverFailureKind[DriverFailureKind["Panic"] = 3] = "Panic";
649
- return DriverFailureKind;
650
- }({});
651
- const FfiConverterTypeDriverFailureKind = (() => {
652
- class FFIConverter extends AbstractFfiConverterByteArray {
653
- readFromCursor(c) {
654
- switch (c.readI32()) {
655
- case 1:
656
- return DriverFailureKind.Transport;
657
- case 2:
658
- return DriverFailureKind.Swarm;
659
- case 3:
660
- return DriverFailureKind.Invariant;
661
- case 4:
662
- return DriverFailureKind.Panic;
663
- default:
664
- throw new UniffiInternalError.UnexpectedEnumCase();
665
- }
666
- }
667
- writeIntoCursor(value, c) {
668
- switch (value) {
669
- case DriverFailureKind.Transport:
670
- return c.writeI32(1);
671
- case DriverFailureKind.Swarm:
672
- return c.writeI32(2);
673
- case DriverFailureKind.Invariant:
674
- return c.writeI32(3);
675
- case DriverFailureKind.Panic:
676
- return c.writeI32(4);
677
- }
678
- }
679
- allocationSize(value) {
680
- return 4;
681
- }
682
- }
683
- return new FFIConverter();
684
- })();
685
-
686
- /**
687
- * Category of a non-fatal endpoint runtime error.
688
- */
689
- export let EndpointErrorKind = /*#__PURE__*/function (EndpointErrorKind) {
690
- /**
691
- * Underlying transport operation failed.
692
- */
693
- EndpointErrorKind[EndpointErrorKind["Transport"] = 0] = "Transport";
694
- /**
695
- * Multistream negotiation failed.
696
- */
697
- EndpointErrorKind[EndpointErrorKind["Multistream"] = 1] = "Multistream";
698
- /**
699
- * Identify protocol failed.
700
- */
701
- EndpointErrorKind[EndpointErrorKind["Identify"] = 2] = "Identify";
702
- /**
703
- * Ping protocol failed.
704
- */
705
- EndpointErrorKind[EndpointErrorKind["Ping"] = 3] = "Ping";
706
- /**
707
- * Identify stream setup was rejected.
708
- */
709
- EndpointErrorKind[EndpointErrorKind["IdentifyStreamRejected"] = 4] = "IdentifyStreamRejected";
710
- /**
711
- * Outbound stream opening failed.
712
- */
713
- EndpointErrorKind[EndpointErrorKind["OpenStreamFailed"] = 5] = "OpenStreamFailed";
714
- /**
715
- * The remote does not support a requested protocol.
716
- */
717
- EndpointErrorKind[EndpointErrorKind["UnsupportedProtocol"] = 6] = "UnsupportedProtocol";
718
- /**
719
- * The swarm driver contract failed.
720
- */
721
- EndpointErrorKind[EndpointErrorKind["Driver"] = 7] = "Driver";
722
- return EndpointErrorKind;
723
- }({});
724
- const FfiConverterTypeEndpointErrorKind = (() => {
725
- class FFIConverter extends AbstractFfiConverterByteArray {
726
- readFromCursor(c) {
727
- switch (c.readI32()) {
728
- case 1:
729
- return EndpointErrorKind.Transport;
730
- case 2:
731
- return EndpointErrorKind.Multistream;
732
- case 3:
733
- return EndpointErrorKind.Identify;
734
- case 4:
735
- return EndpointErrorKind.Ping;
736
- case 5:
737
- return EndpointErrorKind.IdentifyStreamRejected;
738
- case 6:
739
- return EndpointErrorKind.OpenStreamFailed;
740
- case 7:
741
- return EndpointErrorKind.UnsupportedProtocol;
742
- case 8:
743
- return EndpointErrorKind.Driver;
744
- default:
745
- throw new UniffiInternalError.UnexpectedEnumCase();
746
- }
747
- }
748
- writeIntoCursor(value, c) {
749
- switch (value) {
750
- case EndpointErrorKind.Transport:
751
- return c.writeI32(1);
752
- case EndpointErrorKind.Multistream:
753
- return c.writeI32(2);
754
- case EndpointErrorKind.Identify:
755
- return c.writeI32(3);
756
- case EndpointErrorKind.Ping:
757
- return c.writeI32(4);
758
- case EndpointErrorKind.IdentifyStreamRejected:
759
- return c.writeI32(5);
760
- case EndpointErrorKind.OpenStreamFailed:
761
- return c.writeI32(6);
762
- case EndpointErrorKind.UnsupportedProtocol:
763
- return c.writeI32(7);
764
- case EndpointErrorKind.Driver:
765
- return c.writeI32(8);
766
- }
767
- }
768
- allocationSize(value) {
769
- return 4;
770
- }
771
- }
772
- return new FFIConverter();
773
- })();
774
-
775
- // Error type: FfiError
776
- export let FfiError_Tags = /*#__PURE__*/function (FfiError_Tags) {
777
- FfiError_Tags["AlreadyStarted"] = "AlreadyStarted";
778
- FfiError_Tags["Stopped"] = "Stopped";
779
- FfiError_Tags["InvalidConfig"] = "InvalidConfig";
780
- FfiError_Tags["InvalidKey"] = "InvalidKey";
781
- FfiError_Tags["InvalidPeerId"] = "InvalidPeerId";
782
- FfiError_Tags["InvalidAddress"] = "InvalidAddress";
783
- FfiError_Tags["InvalidTopic"] = "InvalidTopic";
784
- FfiError_Tags["NotPermitted"] = "NotPermitted";
785
- FfiError_Tags["Backpressure"] = "Backpressure";
786
- FfiError_Tags["MessageTooLarge"] = "MessageTooLarge";
787
- FfiError_Tags["Transport"] = "Transport";
788
- FfiError_Tags["InvalidState"] = "InvalidState";
789
- FfiError_Tags["Internal"] = "Internal";
790
- return FfiError_Tags;
791
- }({});
792
- /**
793
- * An error returned by a synchronous FFI operation.
794
- */
795
- export const FfiError = (() => {
796
- /**
797
- * The endpoint's background driver was already started.
798
- */
799
- class AlreadyStarted_ extends UniffiError {
800
- /**
801
- * @private
802
- * This field is private and should not be used, use `tag` instead.
803
- */
804
- [uniffiTypeNameSymbol] = "FfiError";
805
- tag = FfiError_Tags.AlreadyStarted;
806
- constructor() {
807
- super("FfiError", "AlreadyStarted");
808
- }
809
- static new() {
810
- return new AlreadyStarted_();
811
- }
812
- static instanceOf(obj) {
813
- return obj.tag === FfiError_Tags.AlreadyStarted;
814
- }
815
- static hasInner(obj) {
816
- return false;
817
- }
818
- }
819
- /**
820
- * The endpoint has stopped and cannot be restarted.
821
- */
822
- class Stopped_ extends UniffiError {
823
- /**
824
- * @private
825
- * This field is private and should not be used, use `tag` instead.
826
- */
827
- [uniffiTypeNameSymbol] = "FfiError";
828
- tag = FfiError_Tags.Stopped;
829
- constructor() {
830
- super("FfiError", "Stopped");
831
- }
832
- static new() {
833
- return new Stopped_();
834
- }
835
- static instanceOf(obj) {
836
- return obj.tag === FfiError_Tags.Stopped;
837
- }
838
- static hasInner(obj) {
839
- return false;
840
- }
841
- }
842
- /**
843
- * Endpoint configuration was internally inconsistent.
844
- */
845
- class InvalidConfig_ extends UniffiError {
846
- /**
847
- * @private
848
- * This field is private and should not be used, use `tag` instead.
849
- */
850
- [uniffiTypeNameSymbol] = "FfiError";
851
- tag = FfiError_Tags.InvalidConfig;
852
- constructor(inner) {
853
- super("FfiError", "InvalidConfig");
854
- this.inner = Object.freeze(inner);
855
- }
856
- static new(inner) {
857
- return new InvalidConfig_(inner);
858
- }
859
- static instanceOf(obj) {
860
- return obj.tag === FfiError_Tags.InvalidConfig;
861
- }
862
- static hasInner(obj) {
863
- return InvalidConfig_.instanceOf(obj);
864
- }
865
- static getInner(obj) {
866
- return obj.inner;
867
- }
868
- }
869
- /**
870
- * Secret key material was not exactly 32 bytes.
871
- */
872
- class InvalidKey_ extends UniffiError {
873
- /**
874
- * @private
875
- * This field is private and should not be used, use `tag` instead.
876
- */
877
- [uniffiTypeNameSymbol] = "FfiError";
878
- tag = FfiError_Tags.InvalidKey;
879
- constructor(inner) {
880
- super("FfiError", "InvalidKey");
881
- this.inner = Object.freeze(inner);
882
- }
883
- static new(inner) {
884
- return new InvalidKey_(inner);
885
- }
886
- static instanceOf(obj) {
887
- return obj.tag === FfiError_Tags.InvalidKey;
888
- }
889
- static hasInner(obj) {
890
- return InvalidKey_.instanceOf(obj);
891
- }
892
- static getInner(obj) {
893
- return obj.inner;
894
- }
895
- }
896
- /**
897
- * A peer ID could not be parsed.
898
- */
899
- class InvalidPeerId_ extends UniffiError {
900
- /**
901
- * @private
902
- * This field is private and should not be used, use `tag` instead.
903
- */
904
- [uniffiTypeNameSymbol] = "FfiError";
905
- tag = FfiError_Tags.InvalidPeerId;
906
- constructor(inner) {
907
- super("FfiError", "InvalidPeerId");
908
- this.inner = Object.freeze(inner);
909
- }
910
- static new(inner) {
911
- return new InvalidPeerId_(inner);
912
- }
913
- static instanceOf(obj) {
914
- return obj.tag === FfiError_Tags.InvalidPeerId;
915
- }
916
- static hasInner(obj) {
917
- return InvalidPeerId_.instanceOf(obj);
918
- }
919
- static getInner(obj) {
920
- return obj.inner;
921
- }
922
- }
923
- /**
924
- * A multiaddress or peer address could not be parsed.
925
- */
926
- class InvalidAddress_ extends UniffiError {
927
- /**
928
- * @private
929
- * This field is private and should not be used, use `tag` instead.
930
- */
931
- [uniffiTypeNameSymbol] = "FfiError";
932
- tag = FfiError_Tags.InvalidAddress;
933
- constructor(inner) {
934
- super("FfiError", "InvalidAddress");
935
- this.inner = Object.freeze(inner);
936
- }
937
- static new(inner) {
938
- return new InvalidAddress_(inner);
939
- }
940
- static instanceOf(obj) {
941
- return obj.tag === FfiError_Tags.InvalidAddress;
942
- }
943
- static hasInner(obj) {
944
- return InvalidAddress_.instanceOf(obj);
945
- }
946
- static getInner(obj) {
947
- return obj.inner;
948
- }
949
- }
950
- /**
951
- * A pubsub topic failed validation.
952
- */
953
- class InvalidTopic_ extends UniffiError {
954
- /**
955
- * @private
956
- * This field is private and should not be used, use `tag` instead.
957
- */
958
- [uniffiTypeNameSymbol] = "FfiError";
959
- tag = FfiError_Tags.InvalidTopic;
960
- constructor(inner) {
961
- super("FfiError", "InvalidTopic");
962
- this.inner = Object.freeze(inner);
963
- }
964
- static new(inner) {
965
- return new InvalidTopic_(inner);
966
- }
967
- static instanceOf(obj) {
968
- return obj.tag === FfiError_Tags.InvalidTopic;
969
- }
970
- static hasInner(obj) {
971
- return InvalidTopic_.instanceOf(obj);
972
- }
973
- static getInner(obj) {
974
- return obj.inner;
975
- }
976
- }
977
- /**
978
- * The operation is valid but reserved by another endpoint subsystem.
979
- */
980
- class NotPermitted_ extends UniffiError {
981
- /**
982
- * @private
983
- * This field is private and should not be used, use `tag` instead.
984
- */
985
- [uniffiTypeNameSymbol] = "FfiError";
986
- tag = FfiError_Tags.NotPermitted;
987
- constructor(inner) {
988
- super("FfiError", "NotPermitted");
989
- this.inner = Object.freeze(inner);
990
- }
991
- static new(inner) {
992
- return new NotPermitted_(inner);
993
- }
994
- static instanceOf(obj) {
995
- return obj.tag === FfiError_Tags.NotPermitted;
996
- }
997
- static hasInner(obj) {
998
- return NotPermitted_.instanceOf(obj);
999
- }
1000
- static getInner(obj) {
1001
- return obj.inner;
1002
- }
1003
- }
1004
- /**
1005
- * A bounded outbound queue is full.
1006
- */
1007
- class Backpressure_ extends UniffiError {
1008
- /**
1009
- * @private
1010
- * This field is private and should not be used, use `tag` instead.
1011
- */
1012
- [uniffiTypeNameSymbol] = "FfiError";
1013
- tag = FfiError_Tags.Backpressure;
1014
- constructor() {
1015
- super("FfiError", "Backpressure");
1016
- }
1017
- static new() {
1018
- return new Backpressure_();
1019
- }
1020
- static instanceOf(obj) {
1021
- return obj.tag === FfiError_Tags.Backpressure;
1022
- }
1023
- static hasInner(obj) {
1024
- return false;
1025
- }
1026
- }
1027
- /**
1028
- * A pubsub message exceeds the protocol limit.
1029
- */
1030
- class MessageTooLarge_ extends UniffiError {
1031
- /**
1032
- * @private
1033
- * This field is private and should not be used, use `tag` instead.
1034
- */
1035
- [uniffiTypeNameSymbol] = "FfiError";
1036
- tag = FfiError_Tags.MessageTooLarge;
1037
- constructor() {
1038
- super("FfiError", "MessageTooLarge");
1039
- }
1040
- static new() {
1041
- return new MessageTooLarge_();
1042
- }
1043
- static instanceOf(obj) {
1044
- return obj.tag === FfiError_Tags.MessageTooLarge;
1045
- }
1046
- static hasInner(obj) {
1047
- return false;
1048
- }
1049
- }
1050
- /**
1051
- * A synchronous transport operation failed.
1052
- */
1053
- class Transport_ extends UniffiError {
1054
- /**
1055
- * @private
1056
- * This field is private and should not be used, use `tag` instead.
1057
- */
1058
- [uniffiTypeNameSymbol] = "FfiError";
1059
- tag = FfiError_Tags.Transport;
1060
- constructor(inner) {
1061
- super("FfiError", "Transport");
1062
- this.inner = Object.freeze(inner);
1063
- }
1064
- static new(inner) {
1065
- return new Transport_(inner);
1066
- }
1067
- static instanceOf(obj) {
1068
- return obj.tag === FfiError_Tags.Transport;
1069
- }
1070
- static hasInner(obj) {
1071
- return Transport_.instanceOf(obj);
1072
- }
1073
- static getInner(obj) {
1074
- return obj.inner;
1075
- }
1076
- }
1077
- /**
1078
- * The operation is unavailable in the endpoint's current lifecycle state.
1079
- */
1080
- class InvalidState_ extends UniffiError {
1081
- /**
1082
- * @private
1083
- * This field is private and should not be used, use `tag` instead.
1084
- */
1085
- [uniffiTypeNameSymbol] = "FfiError";
1086
- tag = FfiError_Tags.InvalidState;
1087
- constructor(inner) {
1088
- super("FfiError", "InvalidState");
1089
- this.inner = Object.freeze(inner);
1090
- }
1091
- static new(inner) {
1092
- return new InvalidState_(inner);
1093
- }
1094
- static instanceOf(obj) {
1095
- return obj.tag === FfiError_Tags.InvalidState;
1096
- }
1097
- static hasInner(obj) {
1098
- return InvalidState_.instanceOf(obj);
1099
- }
1100
- static getInner(obj) {
1101
- return obj.inner;
1102
- }
1103
- }
1104
- /**
1105
- * An internal invariant or unexpected construction path failed.
1106
- */
1107
- class Internal_ extends UniffiError {
1108
- /**
1109
- * @private
1110
- * This field is private and should not be used, use `tag` instead.
1111
- */
1112
- [uniffiTypeNameSymbol] = "FfiError";
1113
- tag = FfiError_Tags.Internal;
1114
- constructor(inner) {
1115
- super("FfiError", "Internal");
1116
- this.inner = Object.freeze(inner);
1117
- }
1118
- static new(inner) {
1119
- return new Internal_(inner);
1120
- }
1121
- static instanceOf(obj) {
1122
- return obj.tag === FfiError_Tags.Internal;
1123
- }
1124
- static hasInner(obj) {
1125
- return Internal_.instanceOf(obj);
1126
- }
1127
- static getInner(obj) {
1128
- return obj.inner;
1129
- }
1130
- }
1131
- function instanceOf(obj) {
1132
- return obj[uniffiTypeNameSymbol] === "FfiError";
1133
- }
1134
- return Object.freeze({
1135
- instanceOf,
1136
- AlreadyStarted: AlreadyStarted_,
1137
- Stopped: Stopped_,
1138
- InvalidConfig: InvalidConfig_,
1139
- InvalidKey: InvalidKey_,
1140
- InvalidPeerId: InvalidPeerId_,
1141
- InvalidAddress: InvalidAddress_,
1142
- InvalidTopic: InvalidTopic_,
1143
- NotPermitted: NotPermitted_,
1144
- Backpressure: Backpressure_,
1145
- MessageTooLarge: MessageTooLarge_,
1146
- Transport: Transport_,
1147
- InvalidState: InvalidState_,
1148
- Internal: Internal_
1149
- });
1150
- })();
1151
- /**
1152
- * An error returned by a synchronous FFI operation.
1153
- */
1154
-
1155
- // FfiConverter for enum FfiError
1156
- const FfiConverterTypeFfiError = (() => {
1157
- class FFIConverter extends AbstractFfiConverterByteArray {
1158
- readFromCursor(c) {
1159
- switch (c.readI32()) {
1160
- case 1:
1161
- return new FfiError.AlreadyStarted();
1162
- case 2:
1163
- return new FfiError.Stopped();
1164
- case 3:
1165
- return new FfiError.InvalidConfig({
1166
- detail: FfiConverterString.readFromCursor(c)
1167
- });
1168
- case 4:
1169
- return new FfiError.InvalidKey({
1170
- detail: FfiConverterString.readFromCursor(c)
1171
- });
1172
- case 5:
1173
- return new FfiError.InvalidPeerId({
1174
- detail: FfiConverterString.readFromCursor(c)
1175
- });
1176
- case 6:
1177
- return new FfiError.InvalidAddress({
1178
- detail: FfiConverterString.readFromCursor(c)
1179
- });
1180
- case 7:
1181
- return new FfiError.InvalidTopic({
1182
- detail: FfiConverterString.readFromCursor(c)
1183
- });
1184
- case 8:
1185
- return new FfiError.NotPermitted({
1186
- detail: FfiConverterString.readFromCursor(c)
1187
- });
1188
- case 9:
1189
- return new FfiError.Backpressure();
1190
- case 10:
1191
- return new FfiError.MessageTooLarge();
1192
- case 11:
1193
- return new FfiError.Transport({
1194
- detail: FfiConverterString.readFromCursor(c)
1195
- });
1196
- case 12:
1197
- return new FfiError.InvalidState({
1198
- detail: FfiConverterString.readFromCursor(c)
1199
- });
1200
- case 13:
1201
- return new FfiError.Internal({
1202
- detail: FfiConverterString.readFromCursor(c)
1203
- });
1204
- default:
1205
- throw new UniffiInternalError.UnexpectedEnumCase();
1206
- }
1207
- }
1208
- writeIntoCursor(value, c) {
1209
- switch (value.tag) {
1210
- case FfiError_Tags.AlreadyStarted:
1211
- {
1212
- c.writeI32(1);
1213
- return;
1214
- }
1215
- case FfiError_Tags.Stopped:
1216
- {
1217
- c.writeI32(2);
1218
- return;
1219
- }
1220
- case FfiError_Tags.InvalidConfig:
1221
- {
1222
- c.writeI32(3);
1223
- const inner = value.inner;
1224
- FfiConverterString.writeIntoCursor(inner.detail, c);
1225
- return;
1226
- }
1227
- case FfiError_Tags.InvalidKey:
1228
- {
1229
- c.writeI32(4);
1230
- const inner = value.inner;
1231
- FfiConverterString.writeIntoCursor(inner.detail, c);
1232
- return;
1233
- }
1234
- case FfiError_Tags.InvalidPeerId:
1235
- {
1236
- c.writeI32(5);
1237
- const inner = value.inner;
1238
- FfiConverterString.writeIntoCursor(inner.detail, c);
1239
- return;
1240
- }
1241
- case FfiError_Tags.InvalidAddress:
1242
- {
1243
- c.writeI32(6);
1244
- const inner = value.inner;
1245
- FfiConverterString.writeIntoCursor(inner.detail, c);
1246
- return;
1247
- }
1248
- case FfiError_Tags.InvalidTopic:
1249
- {
1250
- c.writeI32(7);
1251
- const inner = value.inner;
1252
- FfiConverterString.writeIntoCursor(inner.detail, c);
1253
- return;
1254
- }
1255
- case FfiError_Tags.NotPermitted:
1256
- {
1257
- c.writeI32(8);
1258
- const inner = value.inner;
1259
- FfiConverterString.writeIntoCursor(inner.detail, c);
1260
- return;
1261
- }
1262
- case FfiError_Tags.Backpressure:
1263
- {
1264
- c.writeI32(9);
1265
- return;
1266
- }
1267
- case FfiError_Tags.MessageTooLarge:
1268
- {
1269
- c.writeI32(10);
1270
- return;
1271
- }
1272
- case FfiError_Tags.Transport:
1273
- {
1274
- c.writeI32(11);
1275
- const inner = value.inner;
1276
- FfiConverterString.writeIntoCursor(inner.detail, c);
1277
- return;
1278
- }
1279
- case FfiError_Tags.InvalidState:
1280
- {
1281
- c.writeI32(12);
1282
- const inner = value.inner;
1283
- FfiConverterString.writeIntoCursor(inner.detail, c);
1284
- return;
1285
- }
1286
- case FfiError_Tags.Internal:
1287
- {
1288
- c.writeI32(13);
1289
- const inner = value.inner;
1290
- FfiConverterString.writeIntoCursor(inner.detail, c);
1291
- return;
1292
- }
1293
- default:
1294
- // Throwing from here means that FfiError_Tags hasn't matched an ordinal.
1295
- throw new UniffiInternalError.UnexpectedEnumCase();
1296
- }
1297
- }
1298
- allocationSize(value) {
1299
- switch (value.tag) {
1300
- case FfiError_Tags.AlreadyStarted:
1301
- {
1302
- return 4;
1303
- }
1304
- case FfiError_Tags.Stopped:
1305
- {
1306
- return 4;
1307
- }
1308
- case FfiError_Tags.InvalidConfig:
1309
- {
1310
- const inner = value.inner;
1311
- let size = 4;
1312
- size += FfiConverterString.allocationSize(inner.detail);
1313
- return size;
1314
- }
1315
- case FfiError_Tags.InvalidKey:
1316
- {
1317
- const inner = value.inner;
1318
- let size = 4;
1319
- size += FfiConverterString.allocationSize(inner.detail);
1320
- return size;
1321
- }
1322
- case FfiError_Tags.InvalidPeerId:
1323
- {
1324
- const inner = value.inner;
1325
- let size = 4;
1326
- size += FfiConverterString.allocationSize(inner.detail);
1327
- return size;
1328
- }
1329
- case FfiError_Tags.InvalidAddress:
1330
- {
1331
- const inner = value.inner;
1332
- let size = 4;
1333
- size += FfiConverterString.allocationSize(inner.detail);
1334
- return size;
1335
- }
1336
- case FfiError_Tags.InvalidTopic:
1337
- {
1338
- const inner = value.inner;
1339
- let size = 4;
1340
- size += FfiConverterString.allocationSize(inner.detail);
1341
- return size;
1342
- }
1343
- case FfiError_Tags.NotPermitted:
1344
- {
1345
- const inner = value.inner;
1346
- let size = 4;
1347
- size += FfiConverterString.allocationSize(inner.detail);
1348
- return size;
1349
- }
1350
- case FfiError_Tags.Backpressure:
1351
- {
1352
- return 4;
1353
- }
1354
- case FfiError_Tags.MessageTooLarge:
1355
- {
1356
- return 4;
1357
- }
1358
- case FfiError_Tags.Transport:
1359
- {
1360
- const inner = value.inner;
1361
- let size = 4;
1362
- size += FfiConverterString.allocationSize(inner.detail);
1363
- return size;
1364
- }
1365
- case FfiError_Tags.InvalidState:
1366
- {
1367
- const inner = value.inner;
1368
- let size = 4;
1369
- size += FfiConverterString.allocationSize(inner.detail);
1370
- return size;
1371
- }
1372
- case FfiError_Tags.Internal:
1373
- {
1374
- const inner = value.inner;
1375
- let size = 4;
1376
- size += FfiConverterString.allocationSize(inner.detail);
1377
- return size;
1378
- }
1379
- default:
1380
- throw new UniffiInternalError.UnexpectedEnumCase();
1381
- }
1382
- }
1383
- }
1384
- return new FFIConverter();
1385
- })();
1386
-
1387
- /**
1388
- * Category of a failed NAT connection attempt.
1389
- */
1390
- export let NatErrorKind = /*#__PURE__*/function (NatErrorKind) {
1391
- /**
1392
- * No usable direct or relayed path exists.
1393
- */
1394
- NatErrorKind[NatErrorKind["NoPathAvailable"] = 0] = "NoPathAvailable";
1395
- /**
1396
- * The connection attempt timed out.
1397
- */
1398
- NatErrorKind[NatErrorKind["Timeout"] = 1] = "Timeout";
1399
- /**
1400
- * A transport dial failed.
1401
- */
1402
- NatErrorKind[NatErrorKind["DialFailed"] = 2] = "DialFailed";
1403
- /**
1404
- * A traversal protocol exchange failed.
1405
- */
1406
- NatErrorKind[NatErrorKind["Protocol"] = 3] = "Protocol";
1407
- /**
1408
- * A relay refused the circuit.
1409
- */
1410
- NatErrorKind[NatErrorKind["RelayRefused"] = 4] = "RelayRefused";
1411
- return NatErrorKind;
1412
- }({});
1413
- const FfiConverterTypeNatErrorKind = (() => {
1414
- class FFIConverter extends AbstractFfiConverterByteArray {
1415
- readFromCursor(c) {
1416
- switch (c.readI32()) {
1417
- case 1:
1418
- return NatErrorKind.NoPathAvailable;
1419
- case 2:
1420
- return NatErrorKind.Timeout;
1421
- case 3:
1422
- return NatErrorKind.DialFailed;
1423
- case 4:
1424
- return NatErrorKind.Protocol;
1425
- case 5:
1426
- return NatErrorKind.RelayRefused;
1427
- default:
1428
- throw new UniffiInternalError.UnexpectedEnumCase();
1429
- }
1430
- }
1431
- writeIntoCursor(value, c) {
1432
- switch (value) {
1433
- case NatErrorKind.NoPathAvailable:
1434
- return c.writeI32(1);
1435
- case NatErrorKind.Timeout:
1436
- return c.writeI32(2);
1437
- case NatErrorKind.DialFailed:
1438
- return c.writeI32(3);
1439
- case NatErrorKind.Protocol:
1440
- return c.writeI32(4);
1441
- case NatErrorKind.RelayRefused:
1442
- return c.writeI32(5);
1443
- }
1444
- }
1445
- allocationSize(value) {
1446
- return 4;
1447
- }
1448
- }
1449
- return new FFIConverter();
1450
- })();
1451
-
1452
- /**
1453
- * Coarse local reachability state.
1454
- */
1455
- export let Reachability = /*#__PURE__*/function (Reachability) {
1456
- /**
1457
- * Not enough evidence is available.
1458
- */
1459
- Reachability[Reachability["Unknown"] = 0] = "Unknown";
1460
- /**
1461
- * The endpoint is directly reachable.
1462
- */
1463
- Reachability[Reachability["Public"] = 1] = "Public";
1464
- /**
1465
- * The endpoint needs traversal or relay assistance.
1466
- */
1467
- Reachability[Reachability["Private"] = 2] = "Private";
1468
- return Reachability;
1469
- }({});
1470
- const FfiConverterTypeReachability = (() => {
1471
- class FFIConverter extends AbstractFfiConverterByteArray {
1472
- readFromCursor(c) {
1473
- switch (c.readI32()) {
1474
- case 1:
1475
- return Reachability.Unknown;
1476
- case 2:
1477
- return Reachability.Public;
1478
- case 3:
1479
- return Reachability.Private;
1480
- default:
1481
- throw new UniffiInternalError.UnexpectedEnumCase();
1482
- }
1483
- }
1484
- writeIntoCursor(value, c) {
1485
- switch (value) {
1486
- case Reachability.Unknown:
1487
- return c.writeI32(1);
1488
- case Reachability.Public:
1489
- return c.writeI32(2);
1490
- case Reachability.Private:
1491
- return c.writeI32(3);
1492
- }
1493
- }
1494
- allocationSize(value) {
1495
- return 4;
1496
- }
1497
- }
1498
- return new FFIConverter();
1499
- })();
1500
-
1501
- // Enum: PathKind
1502
- export let PathKind_Tags = /*#__PURE__*/function (PathKind_Tags) {
1503
- PathKind_Tags["DirectDialed"] = "DirectDialed";
1504
- PathKind_Tags["DirectPunched"] = "DirectPunched";
1505
- PathKind_Tags["Relayed"] = "Relayed";
1506
- return PathKind_Tags;
1507
- }({});
1508
- /**
1509
- * Kind of usable connection path.
1510
- */
1511
- export const PathKind = (() => {
1512
- /**
1513
- * A known address was dialed directly.
1514
- */
1515
- class DirectDialed_ extends UniffiEnum {
1516
- /**
1517
- * @private
1518
- * This field is private and should not be used, use `tag` instead.
1519
- */
1520
- [uniffiTypeNameSymbol] = "PathKind";
1521
- tag = PathKind_Tags.DirectDialed;
1522
- constructor() {
1523
- super("PathKind", "DirectDialed");
1524
- }
1525
- static new() {
1526
- return new DirectDialed_();
1527
- }
1528
- static instanceOf(obj) {
1529
- return obj.tag === PathKind_Tags.DirectDialed;
1530
- }
1531
- }
1532
- /**
1533
- * A direct path was established by hole punching.
1534
- */
1535
- class DirectPunched_ extends UniffiEnum {
1536
- /**
1537
- * @private
1538
- * This field is private and should not be used, use `tag` instead.
1539
- */
1540
- [uniffiTypeNameSymbol] = "PathKind";
1541
- tag = PathKind_Tags.DirectPunched;
1542
- constructor() {
1543
- super("PathKind", "DirectPunched");
1544
- }
1545
- static new() {
1546
- return new DirectPunched_();
1547
- }
1548
- static instanceOf(obj) {
1549
- return obj.tag === PathKind_Tags.DirectPunched;
1550
- }
1551
- }
1552
- /**
1553
- * Traffic is carried through a relay.
1554
- */
1555
- class Relayed_ extends UniffiEnum {
1556
- /**
1557
- * @private
1558
- * This field is private and should not be used, use `tag` instead.
1559
- */
1560
- [uniffiTypeNameSymbol] = "PathKind";
1561
- tag = PathKind_Tags.Relayed;
1562
- constructor(inner) {
1563
- super("PathKind", "Relayed");
1564
- this.inner = Object.freeze(inner);
1565
- }
1566
- static new(inner) {
1567
- return new Relayed_(inner);
1568
- }
1569
- static instanceOf(obj) {
1570
- return obj.tag === PathKind_Tags.Relayed;
1571
- }
1572
- }
1573
- function instanceOf(obj) {
1574
- return obj[uniffiTypeNameSymbol] === "PathKind";
1575
- }
1576
- return Object.freeze({
1577
- instanceOf,
1578
- DirectDialed: DirectDialed_,
1579
- DirectPunched: DirectPunched_,
1580
- Relayed: Relayed_
1581
- });
1582
- })();
1583
- /**
1584
- * Kind of usable connection path.
1585
- */
1586
-
1587
- // FfiConverter for enum PathKind
1588
- const FfiConverterTypePathKind = (() => {
1589
- class FFIConverter extends AbstractFfiConverterByteArray {
1590
- readFromCursor(c) {
1591
- switch (c.readI32()) {
1592
- case 1:
1593
- return new PathKind.DirectDialed();
1594
- case 2:
1595
- return new PathKind.DirectPunched();
1596
- case 3:
1597
- return new PathKind.Relayed({
1598
- relayPeerId: FfiConverterString.readFromCursor(c)
1599
- });
1600
- default:
1601
- throw new UniffiInternalError.UnexpectedEnumCase();
1602
- }
1603
- }
1604
- writeIntoCursor(value, c) {
1605
- switch (value.tag) {
1606
- case PathKind_Tags.DirectDialed:
1607
- {
1608
- c.writeI32(1);
1609
- return;
1610
- }
1611
- case PathKind_Tags.DirectPunched:
1612
- {
1613
- c.writeI32(2);
1614
- return;
1615
- }
1616
- case PathKind_Tags.Relayed:
1617
- {
1618
- c.writeI32(3);
1619
- const inner = value.inner;
1620
- FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
1621
- return;
1622
- }
1623
- default:
1624
- // Throwing from here means that PathKind_Tags hasn't matched an ordinal.
1625
- throw new UniffiInternalError.UnexpectedEnumCase();
1626
- }
1627
- }
1628
- allocationSize(value) {
1629
- switch (value.tag) {
1630
- case PathKind_Tags.DirectDialed:
1631
- {
1632
- return 4;
1633
- }
1634
- case PathKind_Tags.DirectPunched:
1635
- {
1636
- return 4;
1637
- }
1638
- case PathKind_Tags.Relayed:
1639
- {
1640
- const inner = value.inner;
1641
- let size = 4;
1642
- size += FfiConverterString.allocationSize(inner.relayPeerId);
1643
- return size;
1644
- }
1645
- default:
1646
- throw new UniffiInternalError.UnexpectedEnumCase();
1647
- }
1648
- }
1649
- }
1650
- return new FFIConverter();
1651
- })();
1652
-
1653
- // Enum: P2pEvent
1654
- export let P2pEvent_Tags = /*#__PURE__*/function (P2pEvent_Tags) {
1655
- P2pEvent_Tags["EventsDropped"] = "EventsDropped";
1656
- P2pEvent_Tags["DriverFailed"] = "DriverFailed";
1657
- P2pEvent_Tags["ConnectionEstablished"] = "ConnectionEstablished";
1658
- P2pEvent_Tags["ConnectionClosed"] = "ConnectionClosed";
1659
- P2pEvent_Tags["ConnectionReplaced"] = "ConnectionReplaced";
1660
- P2pEvent_Tags["PeerReady"] = "PeerReady";
1661
- P2pEvent_Tags["IdentifyReceived"] = "IdentifyReceived";
1662
- P2pEvent_Tags["PingRttMeasured"] = "PingRttMeasured";
1663
- P2pEvent_Tags["PingTimeout"] = "PingTimeout";
1664
- P2pEvent_Tags["StreamReady"] = "StreamReady";
1665
- P2pEvent_Tags["StreamData"] = "StreamData";
1666
- P2pEvent_Tags["StreamRemoteWriteClosed"] = "StreamRemoteWriteClosed";
1667
- P2pEvent_Tags["StreamClosed"] = "StreamClosed";
1668
- P2pEvent_Tags["EndpointError"] = "EndpointError";
1669
- P2pEvent_Tags["ReachabilityChanged"] = "ReachabilityChanged";
1670
- P2pEvent_Tags["PublicAddressesChanged"] = "PublicAddressesChanged";
1671
- P2pEvent_Tags["RelayReserved"] = "RelayReserved";
1672
- P2pEvent_Tags["RelayReservationLost"] = "RelayReservationLost";
1673
- P2pEvent_Tags["PathEstablished"] = "PathEstablished";
1674
- P2pEvent_Tags["InboundPathEstablished"] = "InboundPathEstablished";
1675
- P2pEvent_Tags["PathUpgraded"] = "PathUpgraded";
1676
- P2pEvent_Tags["HolePunchFailed"] = "HolePunchFailed";
1677
- P2pEvent_Tags["ConnectFailed"] = "ConnectFailed";
1678
- P2pEvent_Tags["ConnectCancelled"] = "ConnectCancelled";
1679
- P2pEvent_Tags["InboundDirectUpgrade"] = "InboundDirectUpgrade";
1680
- P2pEvent_Tags["Message"] = "Message";
1681
- P2pEvent_Tags["PeerSubscribed"] = "PeerSubscribed";
1682
- P2pEvent_Tags["PeerUnsubscribed"] = "PeerUnsubscribed";
1683
- P2pEvent_Tags["GossipsubOutboundFailure"] = "GossipsubOutboundFailure";
1684
- P2pEvent_Tags["GossipsubProtocolViolation"] = "GossipsubProtocolViolation";
1685
- P2pEvent_Tags["PeerDiscovered"] = "PeerDiscovered";
1686
- P2pEvent_Tags["PeerUpdated"] = "PeerUpdated";
1687
- P2pEvent_Tags["PeerExpired"] = "PeerExpired";
1688
- P2pEvent_Tags["DiscoveryDialFailed"] = "DiscoveryDialFailed";
1689
- P2pEvent_Tags["DiscoveryProtocolViolation"] = "DiscoveryProtocolViolation";
1690
- return P2pEvent_Tags;
1691
- }({});
1692
- /**
1693
- * Event delivered by the native endpoint driver.
1694
- */
1695
- export const P2pEvent = (() => {
1696
- /**
1697
- * Native event carry overflow discarded source events.
1698
- */
1699
- class EventsDropped_ extends UniffiEnum {
1700
- /**
1701
- * @private
1702
- * This field is private and should not be used, use `tag` instead.
1703
- */
1704
- [uniffiTypeNameSymbol] = "P2pEvent";
1705
- tag = P2pEvent_Tags.EventsDropped;
1706
- constructor(inner) {
1707
- super("P2pEvent", "EventsDropped");
1708
- this.inner = Object.freeze(inner);
1709
- }
1710
- static new(inner) {
1711
- return new EventsDropped_(inner);
1712
- }
1713
- static instanceOf(obj) {
1714
- return obj.tag === P2pEvent_Tags.EventsDropped;
1715
- }
1716
- }
1717
- /**
1718
- * The background driver terminated after a fatal failure.
1719
- */
1720
- class DriverFailed_ extends UniffiEnum {
1721
- /**
1722
- * @private
1723
- * This field is private and should not be used, use `tag` instead.
1724
- */
1725
- [uniffiTypeNameSymbol] = "P2pEvent";
1726
- tag = P2pEvent_Tags.DriverFailed;
1727
- constructor(inner) {
1728
- super("P2pEvent", "DriverFailed");
1729
- this.inner = Object.freeze(inner);
1730
- }
1731
- static new(inner) {
1732
- return new DriverFailed_(inner);
1733
- }
1734
- static instanceOf(obj) {
1735
- return obj.tag === P2pEvent_Tags.DriverFailed;
1736
- }
1737
- }
1738
- /**
1739
- * A peer went from disconnected to connected over a verified connection.
1740
- */
1741
- class ConnectionEstablished_ extends UniffiEnum {
1742
- /**
1743
- * @private
1744
- * This field is private and should not be used, use `tag` instead.
1745
- */
1746
- [uniffiTypeNameSymbol] = "P2pEvent";
1747
- tag = P2pEvent_Tags.ConnectionEstablished;
1748
- constructor(inner) {
1749
- super("P2pEvent", "ConnectionEstablished");
1750
- this.inner = Object.freeze(inner);
1751
- }
1752
- static new(inner) {
1753
- return new ConnectionEstablished_(inner);
1754
- }
1755
- static instanceOf(obj) {
1756
- return obj.tag === P2pEvent_Tags.ConnectionEstablished;
1757
- }
1758
- }
1759
- /**
1760
- * The peer's last connection closed; the peer is now disconnected.
1761
- */
1762
- class ConnectionClosed_ extends UniffiEnum {
1763
- /**
1764
- * @private
1765
- * This field is private and should not be used, use `tag` instead.
1766
- */
1767
- [uniffiTypeNameSymbol] = "P2pEvent";
1768
- tag = P2pEvent_Tags.ConnectionClosed;
1769
- constructor(inner) {
1770
- super("P2pEvent", "ConnectionClosed");
1771
- this.inner = Object.freeze(inner);
1772
- }
1773
- static new(inner) {
1774
- return new ConnectionClosed_(inner);
1775
- }
1776
- static instanceOf(obj) {
1777
- return obj.tag === P2pEvent_Tags.ConnectionClosed;
1778
- }
1779
- }
1780
- /**
1781
- * A newer connection took the peer's single connection slot from
1782
- * `old_conn_id`.
1783
- * The peer stays connected; every stream on `old_conn_id` ended with
1784
- * it, and a fresh `PeerReady` follows for `new_conn_id`.
1785
- */
1786
- class ConnectionReplaced_ extends UniffiEnum {
1787
- /**
1788
- * @private
1789
- * This field is private and should not be used, use `tag` instead.
1790
- */
1791
- [uniffiTypeNameSymbol] = "P2pEvent";
1792
- tag = P2pEvent_Tags.ConnectionReplaced;
1793
- constructor(inner) {
1794
- super("P2pEvent", "ConnectionReplaced");
1795
- this.inner = Object.freeze(inner);
1796
- }
1797
- static new(inner) {
1798
- return new ConnectionReplaced_(inner);
1799
- }
1800
- static instanceOf(obj) {
1801
- return obj.tag === P2pEvent_Tags.ConnectionReplaced;
1802
- }
1803
- }
1804
- /**
1805
- * A peer's connection completed Identify and is ready for application
1806
- * protocols. Fires once per connection; one whose `conn_id` is no longer
1807
- * the peer's current connection is stale.
1808
- */
1809
- class PeerReady_ extends UniffiEnum {
1810
- /**
1811
- * @private
1812
- * This field is private and should not be used, use `tag` instead.
1813
- */
1814
- [uniffiTypeNameSymbol] = "P2pEvent";
1815
- tag = P2pEvent_Tags.PeerReady;
1816
- constructor(inner) {
1817
- super("P2pEvent", "PeerReady");
1818
- this.inner = Object.freeze(inner);
1819
- }
1820
- static new(inner) {
1821
- return new PeerReady_(inner);
1822
- }
1823
- static instanceOf(obj) {
1824
- return obj.tag === P2pEvent_Tags.PeerReady;
1825
- }
1826
- }
1827
- /**
1828
- * A peer supplied a new Identify snapshot.
1829
- */
1830
- class IdentifyReceived_ extends UniffiEnum {
1831
- /**
1832
- * @private
1833
- * This field is private and should not be used, use `tag` instead.
1834
- */
1835
- [uniffiTypeNameSymbol] = "P2pEvent";
1836
- tag = P2pEvent_Tags.IdentifyReceived;
1837
- constructor(inner) {
1838
- super("P2pEvent", "IdentifyReceived");
1839
- this.inner = Object.freeze(inner);
1840
- }
1841
- static new(inner) {
1842
- return new IdentifyReceived_(inner);
1843
- }
1844
- static instanceOf(obj) {
1845
- return obj.tag === P2pEvent_Tags.IdentifyReceived;
1846
- }
1847
- }
1848
- /**
1849
- * A ping round-trip measurement completed.
1850
- */
1851
- class PingRttMeasured_ extends UniffiEnum {
1852
- /**
1853
- * @private
1854
- * This field is private and should not be used, use `tag` instead.
1855
- */
1856
- [uniffiTypeNameSymbol] = "P2pEvent";
1857
- tag = P2pEvent_Tags.PingRttMeasured;
1858
- constructor(inner) {
1859
- super("P2pEvent", "PingRttMeasured");
1860
- this.inner = Object.freeze(inner);
1861
- }
1862
- static new(inner) {
1863
- return new PingRttMeasured_(inner);
1864
- }
1865
- static instanceOf(obj) {
1866
- return obj.tag === P2pEvent_Tags.PingRttMeasured;
1867
- }
1868
- }
1869
- /**
1870
- * A ping timed out.
1871
- */
1872
- class PingTimeout_ extends UniffiEnum {
1873
- /**
1874
- * @private
1875
- * This field is private and should not be used, use `tag` instead.
1876
- */
1877
- [uniffiTypeNameSymbol] = "P2pEvent";
1878
- tag = P2pEvent_Tags.PingTimeout;
1879
- constructor(inner) {
1880
- super("P2pEvent", "PingTimeout");
1881
- this.inner = Object.freeze(inner);
1882
- }
1883
- static new(inner) {
1884
- return new PingTimeout_(inner);
1885
- }
1886
- static instanceOf(obj) {
1887
- return obj.tag === P2pEvent_Tags.PingTimeout;
1888
- }
1889
- }
1890
- /**
1891
- * A custom application stream completed protocol negotiation.
1892
- */
1893
- class StreamReady_ extends UniffiEnum {
1894
- /**
1895
- * @private
1896
- * This field is private and should not be used, use `tag` instead.
1897
- */
1898
- [uniffiTypeNameSymbol] = "P2pEvent";
1899
- tag = P2pEvent_Tags.StreamReady;
1900
- constructor(inner) {
1901
- super("P2pEvent", "StreamReady");
1902
- this.inner = Object.freeze(inner);
1903
- }
1904
- static new(inner) {
1905
- return new StreamReady_(inner);
1906
- }
1907
- static instanceOf(obj) {
1908
- return obj.tag === P2pEvent_Tags.StreamReady;
1909
- }
1910
- }
1911
- /**
1912
- * Bytes arrived on a custom application stream.
1913
- */
1914
- class StreamData_ extends UniffiEnum {
1915
- /**
1916
- * @private
1917
- * This field is private and should not be used, use `tag` instead.
1918
- */
1919
- [uniffiTypeNameSymbol] = "P2pEvent";
1920
- tag = P2pEvent_Tags.StreamData;
1921
- constructor(inner) {
1922
- super("P2pEvent", "StreamData");
1923
- this.inner = Object.freeze(inner);
1924
- }
1925
- static new(inner) {
1926
- return new StreamData_(inner);
1927
- }
1928
- static instanceOf(obj) {
1929
- return obj.tag === P2pEvent_Tags.StreamData;
1930
- }
1931
- }
1932
- /**
1933
- * The remote peer half-closed its stream write side.
1934
- */
1935
- class StreamRemoteWriteClosed_ extends UniffiEnum {
1936
- /**
1937
- * @private
1938
- * This field is private and should not be used, use `tag` instead.
1939
- */
1940
- [uniffiTypeNameSymbol] = "P2pEvent";
1941
- tag = P2pEvent_Tags.StreamRemoteWriteClosed;
1942
- constructor(inner) {
1943
- super("P2pEvent", "StreamRemoteWriteClosed");
1944
- this.inner = Object.freeze(inner);
1945
- }
1946
- static new(inner) {
1947
- return new StreamRemoteWriteClosed_(inner);
1948
- }
1949
- static instanceOf(obj) {
1950
- return obj.tag === P2pEvent_Tags.StreamRemoteWriteClosed;
1951
- }
1952
- }
1953
- /**
1954
- * A custom application stream fully closed.
1955
- */
1956
- class StreamClosed_ extends UniffiEnum {
1957
- /**
1958
- * @private
1959
- * This field is private and should not be used, use `tag` instead.
1960
- */
1961
- [uniffiTypeNameSymbol] = "P2pEvent";
1962
- tag = P2pEvent_Tags.StreamClosed;
1963
- constructor(inner) {
1964
- super("P2pEvent", "StreamClosed");
1965
- this.inner = Object.freeze(inner);
1966
- }
1967
- static new(inner) {
1968
- return new StreamClosed_(inner);
1969
- }
1970
- static instanceOf(obj) {
1971
- return obj.tag === P2pEvent_Tags.StreamClosed;
1972
- }
1973
- }
1974
- /**
1975
- * A non-fatal endpoint error occurred.
1976
- */
1977
- class EndpointError_ extends UniffiEnum {
1978
- /**
1979
- * @private
1980
- * This field is private and should not be used, use `tag` instead.
1981
- */
1982
- [uniffiTypeNameSymbol] = "P2pEvent";
1983
- tag = P2pEvent_Tags.EndpointError;
1984
- constructor(inner) {
1985
- super("P2pEvent", "EndpointError");
1986
- this.inner = Object.freeze(inner);
1987
- }
1988
- static new(inner) {
1989
- return new EndpointError_(inner);
1990
- }
1991
- static instanceOf(obj) {
1992
- return obj.tag === P2pEvent_Tags.EndpointError;
1993
- }
1994
- }
1995
- /**
1996
- * The local reachability verdict changed.
1997
- */
1998
- class ReachabilityChanged_ extends UniffiEnum {
1999
- /**
2000
- * @private
2001
- * This field is private and should not be used, use `tag` instead.
2002
- */
2003
- [uniffiTypeNameSymbol] = "P2pEvent";
2004
- tag = P2pEvent_Tags.ReachabilityChanged;
2005
- constructor(inner) {
2006
- super("P2pEvent", "ReachabilityChanged");
2007
- this.inner = Object.freeze(inner);
2008
- }
2009
- static new(inner) {
2010
- return new ReachabilityChanged_(inner);
2011
- }
2012
- static instanceOf(obj) {
2013
- return obj.tag === P2pEvent_Tags.ReachabilityChanged;
2014
- }
2015
- }
2016
- /**
2017
- * AutoNAT confirmed a changed public address set.
2018
- */
2019
- class PublicAddressesChanged_ extends UniffiEnum {
2020
- /**
2021
- * @private
2022
- * This field is private and should not be used, use `tag` instead.
2023
- */
2024
- [uniffiTypeNameSymbol] = "P2pEvent";
2025
- tag = P2pEvent_Tags.PublicAddressesChanged;
2026
- constructor(inner) {
2027
- super("P2pEvent", "PublicAddressesChanged");
2028
- this.inner = Object.freeze(inner);
2029
- }
2030
- static new(inner) {
2031
- return new PublicAddressesChanged_(inner);
2032
- }
2033
- static instanceOf(obj) {
2034
- return obj.tag === P2pEvent_Tags.PublicAddressesChanged;
2035
- }
2036
- }
2037
- /**
2038
- * A relay reservation was acquired or renewed.
2039
- */
2040
- class RelayReserved_ extends UniffiEnum {
2041
- /**
2042
- * @private
2043
- * This field is private and should not be used, use `tag` instead.
2044
- */
2045
- [uniffiTypeNameSymbol] = "P2pEvent";
2046
- tag = P2pEvent_Tags.RelayReserved;
2047
- constructor(inner) {
2048
- super("P2pEvent", "RelayReserved");
2049
- this.inner = Object.freeze(inner);
2050
- }
2051
- static new(inner) {
2052
- return new RelayReserved_(inner);
2053
- }
2054
- static instanceOf(obj) {
2055
- return obj.tag === P2pEvent_Tags.RelayReserved;
2056
- }
2057
- }
2058
- /**
2059
- * A relay reservation was lost.
2060
- */
2061
- class RelayReservationLost_ extends UniffiEnum {
2062
- /**
2063
- * @private
2064
- * This field is private and should not be used, use `tag` instead.
2065
- */
2066
- [uniffiTypeNameSymbol] = "P2pEvent";
2067
- tag = P2pEvent_Tags.RelayReservationLost;
2068
- constructor(inner) {
2069
- super("P2pEvent", "RelayReservationLost");
2070
- this.inner = Object.freeze(inner);
2071
- }
2072
- static new(inner) {
2073
- return new RelayReservationLost_(inner);
2074
- }
2075
- static instanceOf(obj) {
2076
- return obj.tag === P2pEvent_Tags.RelayReservationLost;
2077
- }
2078
- }
2079
- /**
2080
- * The first usable path for an attempt became available.
2081
- */
2082
- class PathEstablished_ extends UniffiEnum {
2083
- /**
2084
- * @private
2085
- * This field is private and should not be used, use `tag` instead.
2086
- */
2087
- [uniffiTypeNameSymbol] = "P2pEvent";
2088
- tag = P2pEvent_Tags.PathEstablished;
2089
- constructor(inner) {
2090
- super("P2pEvent", "PathEstablished");
2091
- this.inner = Object.freeze(inner);
2092
- }
2093
- static new(inner) {
2094
- return new PathEstablished_(inner);
2095
- }
2096
- static instanceOf(obj) {
2097
- return obj.tag === P2pEvent_Tags.PathEstablished;
2098
- }
2099
- }
2100
- /**
2101
- * An inbound relay circuit became a usable path.
2102
- */
2103
- class InboundPathEstablished_ extends UniffiEnum {
2104
- /**
2105
- * @private
2106
- * This field is private and should not be used, use `tag` instead.
2107
- */
2108
- [uniffiTypeNameSymbol] = "P2pEvent";
2109
- tag = P2pEvent_Tags.InboundPathEstablished;
2110
- constructor(inner) {
2111
- super("P2pEvent", "InboundPathEstablished");
2112
- this.inner = Object.freeze(inner);
2113
- }
2114
- static new(inner) {
2115
- return new InboundPathEstablished_(inner);
2116
- }
2117
- static instanceOf(obj) {
2118
- return obj.tag === P2pEvent_Tags.InboundPathEstablished;
2119
- }
2120
- }
2121
- /**
2122
- * A better path replaced an earlier path.
2123
- */
2124
- class PathUpgraded_ extends UniffiEnum {
2125
- /**
2126
- * @private
2127
- * This field is private and should not be used, use `tag` instead.
2128
- */
2129
- [uniffiTypeNameSymbol] = "P2pEvent";
2130
- tag = P2pEvent_Tags.PathUpgraded;
2131
- constructor(inner) {
2132
- super("P2pEvent", "PathUpgraded");
2133
- this.inner = Object.freeze(inner);
2134
- }
2135
- static new(inner) {
2136
- return new PathUpgraded_(inner);
2137
- }
2138
- static instanceOf(obj) {
2139
- return obj.tag === P2pEvent_Tags.PathUpgraded;
2140
- }
2141
- }
2142
- /**
2143
- * One hole-punch window failed.
2144
- */
2145
- class HolePunchFailed_ extends UniffiEnum {
2146
- /**
2147
- * @private
2148
- * This field is private and should not be used, use `tag` instead.
2149
- */
2150
- [uniffiTypeNameSymbol] = "P2pEvent";
2151
- tag = P2pEvent_Tags.HolePunchFailed;
2152
- constructor(inner) {
2153
- super("P2pEvent", "HolePunchFailed");
2154
- this.inner = Object.freeze(inner);
2155
- }
2156
- static new(inner) {
2157
- return new HolePunchFailed_(inner);
2158
- }
2159
- static instanceOf(obj) {
2160
- return obj.tag === P2pEvent_Tags.HolePunchFailed;
2161
- }
2162
- }
2163
- /**
2164
- * A connection attempt ended without a usable path.
2165
- */
2166
- class ConnectFailed_ extends UniffiEnum {
2167
- /**
2168
- * @private
2169
- * This field is private and should not be used, use `tag` instead.
2170
- */
2171
- [uniffiTypeNameSymbol] = "P2pEvent";
2172
- tag = P2pEvent_Tags.ConnectFailed;
2173
- constructor(inner) {
2174
- super("P2pEvent", "ConnectFailed");
2175
- this.inner = Object.freeze(inner);
2176
- }
2177
- static new(inner) {
2178
- return new ConnectFailed_(inner);
2179
- }
2180
- static instanceOf(obj) {
2181
- return obj.tag === P2pEvent_Tags.ConnectFailed;
2182
- }
2183
- }
2184
- /**
2185
- * A Connection attempt was cancelled by `cancel_connect` before it
2186
- * settled. Terminal for that Connect ID.
2187
- */
2188
- class ConnectCancelled_ extends UniffiEnum {
2189
- /**
2190
- * @private
2191
- * This field is private and should not be used, use `tag` instead.
2192
- */
2193
- [uniffiTypeNameSymbol] = "P2pEvent";
2194
- tag = P2pEvent_Tags.ConnectCancelled;
2195
- constructor(inner) {
2196
- super("P2pEvent", "ConnectCancelled");
2197
- this.inner = Object.freeze(inner);
2198
- }
2199
- static new(inner) {
2200
- return new ConnectCancelled_(inner);
2201
- }
2202
- static instanceOf(obj) {
2203
- return obj.tag === P2pEvent_Tags.ConnectCancelled;
2204
- }
2205
- }
2206
- /**
2207
- * An inbound circuit upgraded to a direct connection.
2208
- */
2209
- class InboundDirectUpgrade_ extends UniffiEnum {
2210
- /**
2211
- * @private
2212
- * This field is private and should not be used, use `tag` instead.
2213
- */
2214
- [uniffiTypeNameSymbol] = "P2pEvent";
2215
- tag = P2pEvent_Tags.InboundDirectUpgrade;
2216
- constructor(inner) {
2217
- super("P2pEvent", "InboundDirectUpgrade");
2218
- this.inner = Object.freeze(inner);
2219
- }
2220
- static new(inner) {
2221
- return new InboundDirectUpgrade_(inner);
2222
- }
2223
- static instanceOf(obj) {
2224
- return obj.tag === P2pEvent_Tags.InboundDirectUpgrade;
2225
- }
2226
- }
2227
- /**
2228
- * An accepted pubsub message arrived.
2229
- *
2230
- * When unsigned messages are enabled, `signed` can be `false`; hosts
2231
- * must treat both `from_peer_id` and `data` as unauthenticated unless
2232
- * `signed` is `true`.
2233
- */
2234
- class Message_ extends UniffiEnum {
2235
- /**
2236
- * @private
2237
- * This field is private and should not be used, use `tag` instead.
2238
- */
2239
- [uniffiTypeNameSymbol] = "P2pEvent";
2240
- tag = P2pEvent_Tags.Message;
2241
- constructor(inner) {
2242
- super("P2pEvent", "Message");
2243
- this.inner = Object.freeze(inner);
2244
- }
2245
- static new(inner) {
2246
- return new Message_(inner);
2247
- }
2248
- static instanceOf(obj) {
2249
- return obj.tag === P2pEvent_Tags.Message;
2250
- }
2251
- }
2252
- /**
2253
- * A peer announced a subscription.
2254
- */
2255
- class PeerSubscribed_ extends UniffiEnum {
2256
- /**
2257
- * @private
2258
- * This field is private and should not be used, use `tag` instead.
2259
- */
2260
- [uniffiTypeNameSymbol] = "P2pEvent";
2261
- tag = P2pEvent_Tags.PeerSubscribed;
2262
- constructor(inner) {
2263
- super("P2pEvent", "PeerSubscribed");
2264
- this.inner = Object.freeze(inner);
2265
- }
2266
- static new(inner) {
2267
- return new PeerSubscribed_(inner);
2268
- }
2269
- static instanceOf(obj) {
2270
- return obj.tag === P2pEvent_Tags.PeerSubscribed;
2271
- }
2272
- }
2273
- /**
2274
- * A peer's subscription ended: withdrawn, or its connection closed or was replaced.
2275
- */
2276
- class PeerUnsubscribed_ extends UniffiEnum {
2277
- /**
2278
- * @private
2279
- * This field is private and should not be used, use `tag` instead.
2280
- */
2281
- [uniffiTypeNameSymbol] = "P2pEvent";
2282
- tag = P2pEvent_Tags.PeerUnsubscribed;
2283
- constructor(inner) {
2284
- super("P2pEvent", "PeerUnsubscribed");
2285
- this.inner = Object.freeze(inner);
2286
- }
2287
- static new(inner) {
2288
- return new PeerUnsubscribed_(inner);
2289
- }
2290
- static instanceOf(obj) {
2291
- return obj.tag === P2pEvent_Tags.PeerUnsubscribed;
2292
- }
2293
- }
2294
- /**
2295
- * Gossipsub outbound work was discarded.
2296
- */
2297
- class GossipsubOutboundFailure_ extends UniffiEnum {
2298
- /**
2299
- * @private
2300
- * This field is private and should not be used, use `tag` instead.
2301
- */
2302
- [uniffiTypeNameSymbol] = "P2pEvent";
2303
- tag = P2pEvent_Tags.GossipsubOutboundFailure;
2304
- constructor(inner) {
2305
- super("P2pEvent", "GossipsubOutboundFailure");
2306
- this.inner = Object.freeze(inner);
2307
- }
2308
- static new(inner) {
2309
- return new GossipsubOutboundFailure_(inner);
2310
- }
2311
- static instanceOf(obj) {
2312
- return obj.tag === P2pEvent_Tags.GossipsubOutboundFailure;
2313
- }
2314
- }
2315
- /**
2316
- * A peer violated the gossipsub protocol.
2317
- */
2318
- class GossipsubProtocolViolation_ extends UniffiEnum {
2319
- /**
2320
- * @private
2321
- * This field is private and should not be used, use `tag` instead.
2322
- */
2323
- [uniffiTypeNameSymbol] = "P2pEvent";
2324
- tag = P2pEvent_Tags.GossipsubProtocolViolation;
2325
- constructor(inner) {
2326
- super("P2pEvent", "GossipsubProtocolViolation");
2327
- this.inner = Object.freeze(inner);
2328
- }
2329
- static new(inner) {
2330
- return new GossipsubProtocolViolation_(inner);
2331
- }
2332
- static instanceOf(obj) {
2333
- return obj.tag === P2pEvent_Tags.GossipsubProtocolViolation;
2334
- }
2335
- }
2336
- /**
2337
- * Discovery introduced a peer.
2338
- */
2339
- class PeerDiscovered_ extends UniffiEnum {
2340
- /**
2341
- * @private
2342
- * This field is private and should not be used, use `tag` instead.
2343
- */
2344
- [uniffiTypeNameSymbol] = "P2pEvent";
2345
- tag = P2pEvent_Tags.PeerDiscovered;
2346
- constructor(inner) {
2347
- super("P2pEvent", "PeerDiscovered");
2348
- this.inner = Object.freeze(inner);
2349
- }
2350
- static new(inner) {
2351
- return new PeerDiscovered_(inner);
2352
- }
2353
- static instanceOf(obj) {
2354
- return obj.tag === P2pEvent_Tags.PeerDiscovered;
2355
- }
2356
- }
2357
- /**
2358
- * Discovery updated a peer.
2359
- */
2360
- class PeerUpdated_ extends UniffiEnum {
2361
- /**
2362
- * @private
2363
- * This field is private and should not be used, use `tag` instead.
2364
- */
2365
- [uniffiTypeNameSymbol] = "P2pEvent";
2366
- tag = P2pEvent_Tags.PeerUpdated;
2367
- constructor(inner) {
2368
- super("P2pEvent", "PeerUpdated");
2369
- this.inner = Object.freeze(inner);
2370
- }
2371
- static new(inner) {
2372
- return new PeerUpdated_(inner);
2373
- }
2374
- static instanceOf(obj) {
2375
- return obj.tag === P2pEvent_Tags.PeerUpdated;
2376
- }
2377
- }
2378
- /**
2379
- * A discovered peer expired or was evicted.
2380
- */
2381
- class PeerExpired_ extends UniffiEnum {
2382
- /**
2383
- * @private
2384
- * This field is private and should not be used, use `tag` instead.
2385
- */
2386
- [uniffiTypeNameSymbol] = "P2pEvent";
2387
- tag = P2pEvent_Tags.PeerExpired;
2388
- constructor(inner) {
2389
- super("P2pEvent", "PeerExpired");
2390
- this.inner = Object.freeze(inner);
2391
- }
2392
- static new(inner) {
2393
- return new PeerExpired_(inner);
2394
- }
2395
- static instanceOf(obj) {
2396
- return obj.tag === P2pEvent_Tags.PeerExpired;
2397
- }
2398
- }
2399
- /**
2400
- * An automatic discovery dial failed.
2401
- */
2402
- class DiscoveryDialFailed_ extends UniffiEnum {
2403
- /**
2404
- * @private
2405
- * This field is private and should not be used, use `tag` instead.
2406
- */
2407
- [uniffiTypeNameSymbol] = "P2pEvent";
2408
- tag = P2pEvent_Tags.DiscoveryDialFailed;
2409
- constructor(inner) {
2410
- super("P2pEvent", "DiscoveryDialFailed");
2411
- this.inner = Object.freeze(inner);
2412
- }
2413
- static new(inner) {
2414
- return new DiscoveryDialFailed_(inner);
2415
- }
2416
- static instanceOf(obj) {
2417
- return obj.tag === P2pEvent_Tags.DiscoveryDialFailed;
2418
- }
2419
- }
2420
- /**
2421
- * A discovery source supplied an invalid claim.
2422
- */
2423
- class DiscoveryProtocolViolation_ extends UniffiEnum {
2424
- /**
2425
- * @private
2426
- * This field is private and should not be used, use `tag` instead.
2427
- */
2428
- [uniffiTypeNameSymbol] = "P2pEvent";
2429
- tag = P2pEvent_Tags.DiscoveryProtocolViolation;
2430
- constructor(inner) {
2431
- super("P2pEvent", "DiscoveryProtocolViolation");
2432
- this.inner = Object.freeze(inner);
2433
- }
2434
- static new(inner) {
2435
- return new DiscoveryProtocolViolation_(inner);
2436
- }
2437
- static instanceOf(obj) {
2438
- return obj.tag === P2pEvent_Tags.DiscoveryProtocolViolation;
2439
- }
2440
- }
2441
- function instanceOf(obj) {
2442
- return obj[uniffiTypeNameSymbol] === "P2pEvent";
2443
- }
2444
- return Object.freeze({
2445
- instanceOf,
2446
- EventsDropped: EventsDropped_,
2447
- DriverFailed: DriverFailed_,
2448
- ConnectionEstablished: ConnectionEstablished_,
2449
- ConnectionClosed: ConnectionClosed_,
2450
- ConnectionReplaced: ConnectionReplaced_,
2451
- PeerReady: PeerReady_,
2452
- IdentifyReceived: IdentifyReceived_,
2453
- PingRttMeasured: PingRttMeasured_,
2454
- PingTimeout: PingTimeout_,
2455
- StreamReady: StreamReady_,
2456
- StreamData: StreamData_,
2457
- StreamRemoteWriteClosed: StreamRemoteWriteClosed_,
2458
- StreamClosed: StreamClosed_,
2459
- EndpointError: EndpointError_,
2460
- ReachabilityChanged: ReachabilityChanged_,
2461
- PublicAddressesChanged: PublicAddressesChanged_,
2462
- RelayReserved: RelayReserved_,
2463
- RelayReservationLost: RelayReservationLost_,
2464
- PathEstablished: PathEstablished_,
2465
- InboundPathEstablished: InboundPathEstablished_,
2466
- PathUpgraded: PathUpgraded_,
2467
- HolePunchFailed: HolePunchFailed_,
2468
- ConnectFailed: ConnectFailed_,
2469
- ConnectCancelled: ConnectCancelled_,
2470
- InboundDirectUpgrade: InboundDirectUpgrade_,
2471
- Message: Message_,
2472
- PeerSubscribed: PeerSubscribed_,
2473
- PeerUnsubscribed: PeerUnsubscribed_,
2474
- GossipsubOutboundFailure: GossipsubOutboundFailure_,
2475
- GossipsubProtocolViolation: GossipsubProtocolViolation_,
2476
- PeerDiscovered: PeerDiscovered_,
2477
- PeerUpdated: PeerUpdated_,
2478
- PeerExpired: PeerExpired_,
2479
- DiscoveryDialFailed: DiscoveryDialFailed_,
2480
- DiscoveryProtocolViolation: DiscoveryProtocolViolation_
2481
- });
2482
- })();
2483
- /**
2484
- * Event delivered by the native endpoint driver.
2485
- */
2486
-
2487
- // FfiConverter for enum P2pEvent
2488
- const FfiConverterTypeP2pEvent = (() => {
2489
- class FFIConverter extends AbstractFfiConverterByteArray {
2490
- readFromCursor(c) {
2491
- switch (c.readI32()) {
2492
- case 1:
2493
- return new P2pEvent.EventsDropped({
2494
- dropped: FfiConverterUInt64.readFromCursor(c),
2495
- totalDropped: FfiConverterUInt64.readFromCursor(c),
2496
- terminalConnectIds: FfiConverterSequenceUInt64.readFromCursor(c)
2497
- });
2498
- case 2:
2499
- return new P2pEvent.DriverFailed({
2500
- kind: FfiConverterTypeDriverFailureKind.readFromCursor(c),
2501
- detail: FfiConverterString.readFromCursor(c)
2502
- });
2503
- case 3:
2504
- return new P2pEvent.ConnectionEstablished({
2505
- peerId: FfiConverterString.readFromCursor(c),
2506
- connId: FfiConverterUInt64.readFromCursor(c)
2507
- });
2508
- case 4:
2509
- return new P2pEvent.ConnectionClosed({
2510
- peerId: FfiConverterString.readFromCursor(c),
2511
- connId: FfiConverterUInt64.readFromCursor(c)
2512
- });
2513
- case 5:
2514
- return new P2pEvent.ConnectionReplaced({
2515
- peerId: FfiConverterString.readFromCursor(c),
2516
- oldConnId: FfiConverterUInt64.readFromCursor(c),
2517
- newConnId: FfiConverterUInt64.readFromCursor(c)
2518
- });
2519
- case 6:
2520
- return new P2pEvent.PeerReady({
2521
- peerId: FfiConverterString.readFromCursor(c),
2522
- connId: FfiConverterUInt64.readFromCursor(c),
2523
- protocols: FfiConverterSequenceString.readFromCursor(c)
2524
- });
2525
- case 7:
2526
- return new P2pEvent.IdentifyReceived({
2527
- peerId: FfiConverterString.readFromCursor(c),
2528
- info: FfiConverterTypeIdentifyInfo.readFromCursor(c)
2529
- });
2530
- case 8:
2531
- return new P2pEvent.PingRttMeasured({
2532
- peerId: FfiConverterString.readFromCursor(c),
2533
- rttMs: FfiConverterUInt64.readFromCursor(c)
2534
- });
2535
- case 9:
2536
- return new P2pEvent.PingTimeout({
2537
- peerId: FfiConverterString.readFromCursor(c)
2538
- });
2539
- case 10:
2540
- return new P2pEvent.StreamReady({
2541
- peerId: FfiConverterString.readFromCursor(c),
2542
- connId: FfiConverterUInt64.readFromCursor(c),
2543
- streamId: FfiConverterUInt64.readFromCursor(c),
2544
- protocolId: FfiConverterString.readFromCursor(c),
2545
- initiatedLocally: FfiConverterBool.readFromCursor(c)
2546
- });
2547
- case 11:
2548
- return new P2pEvent.StreamData({
2549
- peerId: FfiConverterString.readFromCursor(c),
2550
- connId: FfiConverterUInt64.readFromCursor(c),
2551
- streamId: FfiConverterUInt64.readFromCursor(c),
2552
- data: FfiConverterArrayBuffer.readFromCursor(c)
2553
- });
2554
- case 12:
2555
- return new P2pEvent.StreamRemoteWriteClosed({
2556
- peerId: FfiConverterString.readFromCursor(c),
2557
- connId: FfiConverterUInt64.readFromCursor(c),
2558
- streamId: FfiConverterUInt64.readFromCursor(c)
2559
- });
2560
- case 13:
2561
- return new P2pEvent.StreamClosed({
2562
- peerId: FfiConverterString.readFromCursor(c),
2563
- connId: FfiConverterUInt64.readFromCursor(c),
2564
- streamId: FfiConverterUInt64.readFromCursor(c)
2565
- });
2566
- case 14:
2567
- return new P2pEvent.EndpointError({
2568
- kind: FfiConverterTypeEndpointErrorKind.readFromCursor(c),
2569
- peerId: FfiConverterOptionalString.readFromCursor(c),
2570
- connId: FfiConverterOptionalUInt64.readFromCursor(c),
2571
- streamId: FfiConverterOptionalUInt64.readFromCursor(c),
2572
- detail: FfiConverterString.readFromCursor(c)
2573
- });
2574
- case 15:
2575
- return new P2pEvent.ReachabilityChanged({
2576
- previous: FfiConverterTypeReachability.readFromCursor(c),
2577
- current: FfiConverterTypeReachability.readFromCursor(c),
2578
- confirmedAddrs: FfiConverterSequenceString.readFromCursor(c)
2579
- });
2580
- case 16:
2581
- return new P2pEvent.PublicAddressesChanged({
2582
- addrs: FfiConverterSequenceString.readFromCursor(c)
2583
- });
2584
- case 17:
2585
- return new P2pEvent.RelayReserved({
2586
- relayPeerId: FfiConverterString.readFromCursor(c),
2587
- expiresUnixSecs: FfiConverterOptionalUInt64.readFromCursor(c)
2588
- });
2589
- case 18:
2590
- return new P2pEvent.RelayReservationLost({
2591
- relayPeerId: FfiConverterString.readFromCursor(c)
2592
- });
2593
- case 19:
2594
- return new P2pEvent.PathEstablished({
2595
- connectId: FfiConverterUInt64.readFromCursor(c),
2596
- peerId: FfiConverterString.readFromCursor(c),
2597
- connId: FfiConverterUInt64.readFromCursor(c),
2598
- path: FfiConverterTypePathKind.readFromCursor(c)
2599
- });
2600
- case 20:
2601
- return new P2pEvent.InboundPathEstablished({
2602
- peerId: FfiConverterString.readFromCursor(c),
2603
- path: FfiConverterTypePathKind.readFromCursor(c)
2604
- });
2605
- case 21:
2606
- return new P2pEvent.PathUpgraded({
2607
- connectId: FfiConverterUInt64.readFromCursor(c),
2608
- peerId: FfiConverterString.readFromCursor(c),
2609
- from: FfiConverterTypePathKind.readFromCursor(c),
2610
- to: FfiConverterTypePathKind.readFromCursor(c)
2611
- });
2612
- case 22:
2613
- return new P2pEvent.HolePunchFailed({
2614
- connectId: FfiConverterUInt64.readFromCursor(c),
2615
- attempt: FfiConverterUInt32.readFromCursor(c),
2616
- reason: FfiConverterString.readFromCursor(c)
2617
- });
2618
- case 23:
2619
- return new P2pEvent.ConnectFailed({
2620
- connectId: FfiConverterUInt64.readFromCursor(c),
2621
- peerId: FfiConverterString.readFromCursor(c),
2622
- kind: FfiConverterTypeNatErrorKind.readFromCursor(c),
2623
- detail: FfiConverterString.readFromCursor(c)
2624
- });
2625
- case 24:
2626
- return new P2pEvent.ConnectCancelled({
2627
- connectId: FfiConverterUInt64.readFromCursor(c),
2628
- peerId: FfiConverterString.readFromCursor(c)
2629
- });
2630
- case 25:
2631
- return new P2pEvent.InboundDirectUpgrade({
2632
- peerId: FfiConverterString.readFromCursor(c)
2633
- });
2634
- case 26:
2635
- return new P2pEvent.Message({
2636
- fromPeerId: FfiConverterString.readFromCursor(c),
2637
- topics: FfiConverterSequenceString.readFromCursor(c),
2638
- data: FfiConverterArrayBuffer.readFromCursor(c),
2639
- seqno: FfiConverterArrayBuffer.readFromCursor(c),
2640
- signed: FfiConverterBool.readFromCursor(c)
2641
- });
2642
- case 27:
2643
- return new P2pEvent.PeerSubscribed({
2644
- peerId: FfiConverterString.readFromCursor(c),
2645
- topic: FfiConverterString.readFromCursor(c)
2646
- });
2647
- case 28:
2648
- return new P2pEvent.PeerUnsubscribed({
2649
- peerId: FfiConverterString.readFromCursor(c),
2650
- topic: FfiConverterString.readFromCursor(c)
2651
- });
2652
- case 29:
2653
- return new P2pEvent.GossipsubOutboundFailure({
2654
- peerId: FfiConverterString.readFromCursor(c),
2655
- reason: FfiConverterString.readFromCursor(c)
2656
- });
2657
- case 30:
2658
- return new P2pEvent.GossipsubProtocolViolation({
2659
- peerId: FfiConverterString.readFromCursor(c),
2660
- reason: FfiConverterString.readFromCursor(c)
2661
- });
2662
- case 31:
2663
- return new P2pEvent.PeerDiscovered({
2664
- peerId: FfiConverterString.readFromCursor(c),
2665
- addrs: FfiConverterSequenceString.readFromCursor(c),
2666
- source: FfiConverterTypeDiscoverySource.readFromCursor(c)
2667
- });
2668
- case 32:
2669
- return new P2pEvent.PeerUpdated({
2670
- peerId: FfiConverterString.readFromCursor(c),
2671
- addrs: FfiConverterSequenceString.readFromCursor(c),
2672
- source: FfiConverterTypeDiscoverySource.readFromCursor(c)
2673
- });
2674
- case 33:
2675
- return new P2pEvent.PeerExpired({
2676
- peerId: FfiConverterString.readFromCursor(c)
2677
- });
2678
- case 34:
2679
- return new P2pEvent.DiscoveryDialFailed({
2680
- peerId: FfiConverterString.readFromCursor(c),
2681
- reason: FfiConverterString.readFromCursor(c)
2682
- });
2683
- case 35:
2684
- return new P2pEvent.DiscoveryProtocolViolation({
2685
- peerId: FfiConverterOptionalString.readFromCursor(c),
2686
- source: FfiConverterTypeDiscoverySource.readFromCursor(c),
2687
- reason: FfiConverterString.readFromCursor(c),
2688
- suppressed: FfiConverterUInt32.readFromCursor(c)
2689
- });
2690
- default:
2691
- throw new UniffiInternalError.UnexpectedEnumCase();
2692
- }
2693
- }
2694
- writeIntoCursor(value, c) {
2695
- switch (value.tag) {
2696
- case P2pEvent_Tags.EventsDropped:
2697
- {
2698
- c.writeI32(1);
2699
- const inner = value.inner;
2700
- FfiConverterUInt64.writeIntoCursor(inner.dropped, c);
2701
- FfiConverterUInt64.writeIntoCursor(inner.totalDropped, c);
2702
- FfiConverterSequenceUInt64.writeIntoCursor(inner.terminalConnectIds, c);
2703
- return;
2704
- }
2705
- case P2pEvent_Tags.DriverFailed:
2706
- {
2707
- c.writeI32(2);
2708
- const inner = value.inner;
2709
- FfiConverterTypeDriverFailureKind.writeIntoCursor(inner.kind, c);
2710
- FfiConverterString.writeIntoCursor(inner.detail, c);
2711
- return;
2712
- }
2713
- case P2pEvent_Tags.ConnectionEstablished:
2714
- {
2715
- c.writeI32(3);
2716
- const inner = value.inner;
2717
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2718
- FfiConverterUInt64.writeIntoCursor(inner.connId, c);
2719
- return;
2720
- }
2721
- case P2pEvent_Tags.ConnectionClosed:
2722
- {
2723
- c.writeI32(4);
2724
- const inner = value.inner;
2725
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2726
- FfiConverterUInt64.writeIntoCursor(inner.connId, c);
2727
- return;
2728
- }
2729
- case P2pEvent_Tags.ConnectionReplaced:
2730
- {
2731
- c.writeI32(5);
2732
- const inner = value.inner;
2733
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2734
- FfiConverterUInt64.writeIntoCursor(inner.oldConnId, c);
2735
- FfiConverterUInt64.writeIntoCursor(inner.newConnId, c);
2736
- return;
2737
- }
2738
- case P2pEvent_Tags.PeerReady:
2739
- {
2740
- c.writeI32(6);
2741
- const inner = value.inner;
2742
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2743
- FfiConverterUInt64.writeIntoCursor(inner.connId, c);
2744
- FfiConverterSequenceString.writeIntoCursor(inner.protocols, c);
2745
- return;
2746
- }
2747
- case P2pEvent_Tags.IdentifyReceived:
2748
- {
2749
- c.writeI32(7);
2750
- const inner = value.inner;
2751
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2752
- FfiConverterTypeIdentifyInfo.writeIntoCursor(inner.info, c);
2753
- return;
2754
- }
2755
- case P2pEvent_Tags.PingRttMeasured:
2756
- {
2757
- c.writeI32(8);
2758
- const inner = value.inner;
2759
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2760
- FfiConverterUInt64.writeIntoCursor(inner.rttMs, c);
2761
- return;
2762
- }
2763
- case P2pEvent_Tags.PingTimeout:
2764
- {
2765
- c.writeI32(9);
2766
- const inner = value.inner;
2767
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2768
- return;
2769
- }
2770
- case P2pEvent_Tags.StreamReady:
2771
- {
2772
- c.writeI32(10);
2773
- const inner = value.inner;
2774
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2775
- FfiConverterUInt64.writeIntoCursor(inner.connId, c);
2776
- FfiConverterUInt64.writeIntoCursor(inner.streamId, c);
2777
- FfiConverterString.writeIntoCursor(inner.protocolId, c);
2778
- FfiConverterBool.writeIntoCursor(inner.initiatedLocally, c);
2779
- return;
2780
- }
2781
- case P2pEvent_Tags.StreamData:
2782
- {
2783
- c.writeI32(11);
2784
- const inner = value.inner;
2785
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2786
- FfiConverterUInt64.writeIntoCursor(inner.connId, c);
2787
- FfiConverterUInt64.writeIntoCursor(inner.streamId, c);
2788
- FfiConverterArrayBuffer.writeIntoCursor(inner.data, c);
2789
- return;
2790
- }
2791
- case P2pEvent_Tags.StreamRemoteWriteClosed:
2792
- {
2793
- c.writeI32(12);
2794
- const inner = value.inner;
2795
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2796
- FfiConverterUInt64.writeIntoCursor(inner.connId, c);
2797
- FfiConverterUInt64.writeIntoCursor(inner.streamId, c);
2798
- return;
2799
- }
2800
- case P2pEvent_Tags.StreamClosed:
2801
- {
2802
- c.writeI32(13);
2803
- const inner = value.inner;
2804
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2805
- FfiConverterUInt64.writeIntoCursor(inner.connId, c);
2806
- FfiConverterUInt64.writeIntoCursor(inner.streamId, c);
2807
- return;
2808
- }
2809
- case P2pEvent_Tags.EndpointError:
2810
- {
2811
- c.writeI32(14);
2812
- const inner = value.inner;
2813
- FfiConverterTypeEndpointErrorKind.writeIntoCursor(inner.kind, c);
2814
- FfiConverterOptionalString.writeIntoCursor(inner.peerId, c);
2815
- FfiConverterOptionalUInt64.writeIntoCursor(inner.connId, c);
2816
- FfiConverterOptionalUInt64.writeIntoCursor(inner.streamId, c);
2817
- FfiConverterString.writeIntoCursor(inner.detail, c);
2818
- return;
2819
- }
2820
- case P2pEvent_Tags.ReachabilityChanged:
2821
- {
2822
- c.writeI32(15);
2823
- const inner = value.inner;
2824
- FfiConverterTypeReachability.writeIntoCursor(inner.previous, c);
2825
- FfiConverterTypeReachability.writeIntoCursor(inner.current, c);
2826
- FfiConverterSequenceString.writeIntoCursor(inner.confirmedAddrs, c);
2827
- return;
2828
- }
2829
- case P2pEvent_Tags.PublicAddressesChanged:
2830
- {
2831
- c.writeI32(16);
2832
- const inner = value.inner;
2833
- FfiConverterSequenceString.writeIntoCursor(inner.addrs, c);
2834
- return;
2835
- }
2836
- case P2pEvent_Tags.RelayReserved:
2837
- {
2838
- c.writeI32(17);
2839
- const inner = value.inner;
2840
- FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
2841
- FfiConverterOptionalUInt64.writeIntoCursor(inner.expiresUnixSecs, c);
2842
- return;
2843
- }
2844
- case P2pEvent_Tags.RelayReservationLost:
2845
- {
2846
- c.writeI32(18);
2847
- const inner = value.inner;
2848
- FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
2849
- return;
2850
- }
2851
- case P2pEvent_Tags.PathEstablished:
2852
- {
2853
- c.writeI32(19);
2854
- const inner = value.inner;
2855
- FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
2856
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2857
- FfiConverterUInt64.writeIntoCursor(inner.connId, c);
2858
- FfiConverterTypePathKind.writeIntoCursor(inner.path, c);
2859
- return;
2860
- }
2861
- case P2pEvent_Tags.InboundPathEstablished:
2862
- {
2863
- c.writeI32(20);
2864
- const inner = value.inner;
2865
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2866
- FfiConverterTypePathKind.writeIntoCursor(inner.path, c);
2867
- return;
2868
- }
2869
- case P2pEvent_Tags.PathUpgraded:
2870
- {
2871
- c.writeI32(21);
2872
- const inner = value.inner;
2873
- FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
2874
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2875
- FfiConverterTypePathKind.writeIntoCursor(inner.from, c);
2876
- FfiConverterTypePathKind.writeIntoCursor(inner.to, c);
2877
- return;
2878
- }
2879
- case P2pEvent_Tags.HolePunchFailed:
2880
- {
2881
- c.writeI32(22);
2882
- const inner = value.inner;
2883
- FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
2884
- FfiConverterUInt32.writeIntoCursor(inner.attempt, c);
2885
- FfiConverterString.writeIntoCursor(inner.reason, c);
2886
- return;
2887
- }
2888
- case P2pEvent_Tags.ConnectFailed:
2889
- {
2890
- c.writeI32(23);
2891
- const inner = value.inner;
2892
- FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
2893
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2894
- FfiConverterTypeNatErrorKind.writeIntoCursor(inner.kind, c);
2895
- FfiConverterString.writeIntoCursor(inner.detail, c);
2896
- return;
2897
- }
2898
- case P2pEvent_Tags.ConnectCancelled:
2899
- {
2900
- c.writeI32(24);
2901
- const inner = value.inner;
2902
- FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
2903
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2904
- return;
2905
- }
2906
- case P2pEvent_Tags.InboundDirectUpgrade:
2907
- {
2908
- c.writeI32(25);
2909
- const inner = value.inner;
2910
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2911
- return;
2912
- }
2913
- case P2pEvent_Tags.Message:
2914
- {
2915
- c.writeI32(26);
2916
- const inner = value.inner;
2917
- FfiConverterString.writeIntoCursor(inner.fromPeerId, c);
2918
- FfiConverterSequenceString.writeIntoCursor(inner.topics, c);
2919
- FfiConverterArrayBuffer.writeIntoCursor(inner.data, c);
2920
- FfiConverterArrayBuffer.writeIntoCursor(inner.seqno, c);
2921
- FfiConverterBool.writeIntoCursor(inner.signed, c);
2922
- return;
2923
- }
2924
- case P2pEvent_Tags.PeerSubscribed:
2925
- {
2926
- c.writeI32(27);
2927
- const inner = value.inner;
2928
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2929
- FfiConverterString.writeIntoCursor(inner.topic, c);
2930
- return;
2931
- }
2932
- case P2pEvent_Tags.PeerUnsubscribed:
2933
- {
2934
- c.writeI32(28);
2935
- const inner = value.inner;
2936
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2937
- FfiConverterString.writeIntoCursor(inner.topic, c);
2938
- return;
2939
- }
2940
- case P2pEvent_Tags.GossipsubOutboundFailure:
2941
- {
2942
- c.writeI32(29);
2943
- const inner = value.inner;
2944
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2945
- FfiConverterString.writeIntoCursor(inner.reason, c);
2946
- return;
2947
- }
2948
- case P2pEvent_Tags.GossipsubProtocolViolation:
2949
- {
2950
- c.writeI32(30);
2951
- const inner = value.inner;
2952
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2953
- FfiConverterString.writeIntoCursor(inner.reason, c);
2954
- return;
2955
- }
2956
- case P2pEvent_Tags.PeerDiscovered:
2957
- {
2958
- c.writeI32(31);
2959
- const inner = value.inner;
2960
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2961
- FfiConverterSequenceString.writeIntoCursor(inner.addrs, c);
2962
- FfiConverterTypeDiscoverySource.writeIntoCursor(inner.source, c);
2963
- return;
2964
- }
2965
- case P2pEvent_Tags.PeerUpdated:
2966
- {
2967
- c.writeI32(32);
2968
- const inner = value.inner;
2969
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2970
- FfiConverterSequenceString.writeIntoCursor(inner.addrs, c);
2971
- FfiConverterTypeDiscoverySource.writeIntoCursor(inner.source, c);
2972
- return;
2973
- }
2974
- case P2pEvent_Tags.PeerExpired:
2975
- {
2976
- c.writeI32(33);
2977
- const inner = value.inner;
2978
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2979
- return;
2980
- }
2981
- case P2pEvent_Tags.DiscoveryDialFailed:
2982
- {
2983
- c.writeI32(34);
2984
- const inner = value.inner;
2985
- FfiConverterString.writeIntoCursor(inner.peerId, c);
2986
- FfiConverterString.writeIntoCursor(inner.reason, c);
2987
- return;
2988
- }
2989
- case P2pEvent_Tags.DiscoveryProtocolViolation:
2990
- {
2991
- c.writeI32(35);
2992
- const inner = value.inner;
2993
- FfiConverterOptionalString.writeIntoCursor(inner.peerId, c);
2994
- FfiConverterTypeDiscoverySource.writeIntoCursor(inner.source, c);
2995
- FfiConverterString.writeIntoCursor(inner.reason, c);
2996
- FfiConverterUInt32.writeIntoCursor(inner.suppressed, c);
2997
- return;
2998
- }
2999
- default:
3000
- // Throwing from here means that P2pEvent_Tags hasn't matched an ordinal.
3001
- throw new UniffiInternalError.UnexpectedEnumCase();
3002
- }
3003
- }
3004
- allocationSize(value) {
3005
- switch (value.tag) {
3006
- case P2pEvent_Tags.EventsDropped:
3007
- {
3008
- const inner = value.inner;
3009
- let size = 4;
3010
- size += FfiConverterUInt64.allocationSize(inner.dropped);
3011
- size += FfiConverterUInt64.allocationSize(inner.totalDropped);
3012
- size += FfiConverterSequenceUInt64.allocationSize(inner.terminalConnectIds);
3013
- return size;
3014
- }
3015
- case P2pEvent_Tags.DriverFailed:
3016
- {
3017
- const inner = value.inner;
3018
- let size = 4;
3019
- size += FfiConverterTypeDriverFailureKind.allocationSize(inner.kind);
3020
- size += FfiConverterString.allocationSize(inner.detail);
3021
- return size;
3022
- }
3023
- case P2pEvent_Tags.ConnectionEstablished:
3024
- {
3025
- const inner = value.inner;
3026
- let size = 4;
3027
- size += FfiConverterString.allocationSize(inner.peerId);
3028
- size += FfiConverterUInt64.allocationSize(inner.connId);
3029
- return size;
3030
- }
3031
- case P2pEvent_Tags.ConnectionClosed:
3032
- {
3033
- const inner = value.inner;
3034
- let size = 4;
3035
- size += FfiConverterString.allocationSize(inner.peerId);
3036
- size += FfiConverterUInt64.allocationSize(inner.connId);
3037
- return size;
3038
- }
3039
- case P2pEvent_Tags.ConnectionReplaced:
3040
- {
3041
- const inner = value.inner;
3042
- let size = 4;
3043
- size += FfiConverterString.allocationSize(inner.peerId);
3044
- size += FfiConverterUInt64.allocationSize(inner.oldConnId);
3045
- size += FfiConverterUInt64.allocationSize(inner.newConnId);
3046
- return size;
3047
- }
3048
- case P2pEvent_Tags.PeerReady:
3049
- {
3050
- const inner = value.inner;
3051
- let size = 4;
3052
- size += FfiConverterString.allocationSize(inner.peerId);
3053
- size += FfiConverterUInt64.allocationSize(inner.connId);
3054
- size += FfiConverterSequenceString.allocationSize(inner.protocols);
3055
- return size;
3056
- }
3057
- case P2pEvent_Tags.IdentifyReceived:
3058
- {
3059
- const inner = value.inner;
3060
- let size = 4;
3061
- size += FfiConverterString.allocationSize(inner.peerId);
3062
- size += FfiConverterTypeIdentifyInfo.allocationSize(inner.info);
3063
- return size;
3064
- }
3065
- case P2pEvent_Tags.PingRttMeasured:
3066
- {
3067
- const inner = value.inner;
3068
- let size = 4;
3069
- size += FfiConverterString.allocationSize(inner.peerId);
3070
- size += FfiConverterUInt64.allocationSize(inner.rttMs);
3071
- return size;
3072
- }
3073
- case P2pEvent_Tags.PingTimeout:
3074
- {
3075
- const inner = value.inner;
3076
- let size = 4;
3077
- size += FfiConverterString.allocationSize(inner.peerId);
3078
- return size;
3079
- }
3080
- case P2pEvent_Tags.StreamReady:
3081
- {
3082
- const inner = value.inner;
3083
- let size = 4;
3084
- size += FfiConverterString.allocationSize(inner.peerId);
3085
- size += FfiConverterUInt64.allocationSize(inner.connId);
3086
- size += FfiConverterUInt64.allocationSize(inner.streamId);
3087
- size += FfiConverterString.allocationSize(inner.protocolId);
3088
- size += FfiConverterBool.allocationSize(inner.initiatedLocally);
3089
- return size;
3090
- }
3091
- case P2pEvent_Tags.StreamData:
3092
- {
3093
- const inner = value.inner;
3094
- let size = 4;
3095
- size += FfiConverterString.allocationSize(inner.peerId);
3096
- size += FfiConverterUInt64.allocationSize(inner.connId);
3097
- size += FfiConverterUInt64.allocationSize(inner.streamId);
3098
- size += FfiConverterArrayBuffer.allocationSize(inner.data);
3099
- return size;
3100
- }
3101
- case P2pEvent_Tags.StreamRemoteWriteClosed:
3102
- {
3103
- const inner = value.inner;
3104
- let size = 4;
3105
- size += FfiConverterString.allocationSize(inner.peerId);
3106
- size += FfiConverterUInt64.allocationSize(inner.connId);
3107
- size += FfiConverterUInt64.allocationSize(inner.streamId);
3108
- return size;
3109
- }
3110
- case P2pEvent_Tags.StreamClosed:
3111
- {
3112
- const inner = value.inner;
3113
- let size = 4;
3114
- size += FfiConverterString.allocationSize(inner.peerId);
3115
- size += FfiConverterUInt64.allocationSize(inner.connId);
3116
- size += FfiConverterUInt64.allocationSize(inner.streamId);
3117
- return size;
3118
- }
3119
- case P2pEvent_Tags.EndpointError:
3120
- {
3121
- const inner = value.inner;
3122
- let size = 4;
3123
- size += FfiConverterTypeEndpointErrorKind.allocationSize(inner.kind);
3124
- size += FfiConverterOptionalString.allocationSize(inner.peerId);
3125
- size += FfiConverterOptionalUInt64.allocationSize(inner.connId);
3126
- size += FfiConverterOptionalUInt64.allocationSize(inner.streamId);
3127
- size += FfiConverterString.allocationSize(inner.detail);
3128
- return size;
3129
- }
3130
- case P2pEvent_Tags.ReachabilityChanged:
3131
- {
3132
- const inner = value.inner;
3133
- let size = 4;
3134
- size += FfiConverterTypeReachability.allocationSize(inner.previous);
3135
- size += FfiConverterTypeReachability.allocationSize(inner.current);
3136
- size += FfiConverterSequenceString.allocationSize(inner.confirmedAddrs);
3137
- return size;
3138
- }
3139
- case P2pEvent_Tags.PublicAddressesChanged:
3140
- {
3141
- const inner = value.inner;
3142
- let size = 4;
3143
- size += FfiConverterSequenceString.allocationSize(inner.addrs);
3144
- return size;
3145
- }
3146
- case P2pEvent_Tags.RelayReserved:
3147
- {
3148
- const inner = value.inner;
3149
- let size = 4;
3150
- size += FfiConverterString.allocationSize(inner.relayPeerId);
3151
- size += FfiConverterOptionalUInt64.allocationSize(inner.expiresUnixSecs);
3152
- return size;
3153
- }
3154
- case P2pEvent_Tags.RelayReservationLost:
3155
- {
3156
- const inner = value.inner;
3157
- let size = 4;
3158
- size += FfiConverterString.allocationSize(inner.relayPeerId);
3159
- return size;
3160
- }
3161
- case P2pEvent_Tags.PathEstablished:
3162
- {
3163
- const inner = value.inner;
3164
- let size = 4;
3165
- size += FfiConverterUInt64.allocationSize(inner.connectId);
3166
- size += FfiConverterString.allocationSize(inner.peerId);
3167
- size += FfiConverterUInt64.allocationSize(inner.connId);
3168
- size += FfiConverterTypePathKind.allocationSize(inner.path);
3169
- return size;
3170
- }
3171
- case P2pEvent_Tags.InboundPathEstablished:
3172
- {
3173
- const inner = value.inner;
3174
- let size = 4;
3175
- size += FfiConverterString.allocationSize(inner.peerId);
3176
- size += FfiConverterTypePathKind.allocationSize(inner.path);
3177
- return size;
3178
- }
3179
- case P2pEvent_Tags.PathUpgraded:
3180
- {
3181
- const inner = value.inner;
3182
- let size = 4;
3183
- size += FfiConverterUInt64.allocationSize(inner.connectId);
3184
- size += FfiConverterString.allocationSize(inner.peerId);
3185
- size += FfiConverterTypePathKind.allocationSize(inner.from);
3186
- size += FfiConverterTypePathKind.allocationSize(inner.to);
3187
- return size;
3188
- }
3189
- case P2pEvent_Tags.HolePunchFailed:
3190
- {
3191
- const inner = value.inner;
3192
- let size = 4;
3193
- size += FfiConverterUInt64.allocationSize(inner.connectId);
3194
- size += FfiConverterUInt32.allocationSize(inner.attempt);
3195
- size += FfiConverterString.allocationSize(inner.reason);
3196
- return size;
3197
- }
3198
- case P2pEvent_Tags.ConnectFailed:
3199
- {
3200
- const inner = value.inner;
3201
- let size = 4;
3202
- size += FfiConverterUInt64.allocationSize(inner.connectId);
3203
- size += FfiConverterString.allocationSize(inner.peerId);
3204
- size += FfiConverterTypeNatErrorKind.allocationSize(inner.kind);
3205
- size += FfiConverterString.allocationSize(inner.detail);
3206
- return size;
3207
- }
3208
- case P2pEvent_Tags.ConnectCancelled:
3209
- {
3210
- const inner = value.inner;
3211
- let size = 4;
3212
- size += FfiConverterUInt64.allocationSize(inner.connectId);
3213
- size += FfiConverterString.allocationSize(inner.peerId);
3214
- return size;
3215
- }
3216
- case P2pEvent_Tags.InboundDirectUpgrade:
3217
- {
3218
- const inner = value.inner;
3219
- let size = 4;
3220
- size += FfiConverterString.allocationSize(inner.peerId);
3221
- return size;
3222
- }
3223
- case P2pEvent_Tags.Message:
3224
- {
3225
- const inner = value.inner;
3226
- let size = 4;
3227
- size += FfiConverterString.allocationSize(inner.fromPeerId);
3228
- size += FfiConverterSequenceString.allocationSize(inner.topics);
3229
- size += FfiConverterArrayBuffer.allocationSize(inner.data);
3230
- size += FfiConverterArrayBuffer.allocationSize(inner.seqno);
3231
- size += FfiConverterBool.allocationSize(inner.signed);
3232
- return size;
3233
- }
3234
- case P2pEvent_Tags.PeerSubscribed:
3235
- {
3236
- const inner = value.inner;
3237
- let size = 4;
3238
- size += FfiConverterString.allocationSize(inner.peerId);
3239
- size += FfiConverterString.allocationSize(inner.topic);
3240
- return size;
3241
- }
3242
- case P2pEvent_Tags.PeerUnsubscribed:
3243
- {
3244
- const inner = value.inner;
3245
- let size = 4;
3246
- size += FfiConverterString.allocationSize(inner.peerId);
3247
- size += FfiConverterString.allocationSize(inner.topic);
3248
- return size;
3249
- }
3250
- case P2pEvent_Tags.GossipsubOutboundFailure:
3251
- {
3252
- const inner = value.inner;
3253
- let size = 4;
3254
- size += FfiConverterString.allocationSize(inner.peerId);
3255
- size += FfiConverterString.allocationSize(inner.reason);
3256
- return size;
3257
- }
3258
- case P2pEvent_Tags.GossipsubProtocolViolation:
3259
- {
3260
- const inner = value.inner;
3261
- let size = 4;
3262
- size += FfiConverterString.allocationSize(inner.peerId);
3263
- size += FfiConverterString.allocationSize(inner.reason);
3264
- return size;
3265
- }
3266
- case P2pEvent_Tags.PeerDiscovered:
3267
- {
3268
- const inner = value.inner;
3269
- let size = 4;
3270
- size += FfiConverterString.allocationSize(inner.peerId);
3271
- size += FfiConverterSequenceString.allocationSize(inner.addrs);
3272
- size += FfiConverterTypeDiscoverySource.allocationSize(inner.source);
3273
- return size;
3274
- }
3275
- case P2pEvent_Tags.PeerUpdated:
3276
- {
3277
- const inner = value.inner;
3278
- let size = 4;
3279
- size += FfiConverterString.allocationSize(inner.peerId);
3280
- size += FfiConverterSequenceString.allocationSize(inner.addrs);
3281
- size += FfiConverterTypeDiscoverySource.allocationSize(inner.source);
3282
- return size;
3283
- }
3284
- case P2pEvent_Tags.PeerExpired:
3285
- {
3286
- const inner = value.inner;
3287
- let size = 4;
3288
- size += FfiConverterString.allocationSize(inner.peerId);
3289
- return size;
3290
- }
3291
- case P2pEvent_Tags.DiscoveryDialFailed:
3292
- {
3293
- const inner = value.inner;
3294
- let size = 4;
3295
- size += FfiConverterString.allocationSize(inner.peerId);
3296
- size += FfiConverterString.allocationSize(inner.reason);
3297
- return size;
3298
- }
3299
- case P2pEvent_Tags.DiscoveryProtocolViolation:
3300
- {
3301
- const inner = value.inner;
3302
- let size = 4;
3303
- size += FfiConverterOptionalString.allocationSize(inner.peerId);
3304
- size += FfiConverterTypeDiscoverySource.allocationSize(inner.source);
3305
- size += FfiConverterString.allocationSize(inner.reason);
3306
- size += FfiConverterUInt32.allocationSize(inner.suppressed);
3307
- return size;
3308
- }
3309
- default:
3310
- throw new UniffiInternalError.UnexpectedEnumCase();
3311
- }
3312
- }
3313
- }
3314
- return new FFIConverter();
3315
- })();
3316
-
3317
115
  /**
3318
116
  * Doorbell implemented by the embedding runtime.
3319
117
  */
@@ -3713,11 +511,16 @@ export class P2pEndpoint extends UniffiAbstractObject {
3713
511
 
3714
512
  /**
3715
513
  * Sends bytes on a stream, named by its connection and stream ids.
514
+ *
515
+ * Returns `true` once every byte is accepted, or `false` when the rest is
516
+ * held: `StreamWriteAccepted` follows once it is accepted, unless the
517
+ * write side ends first (`StreamWriteStopped`, `StreamClosed`, a reset,
518
+ * or the connection closing or being replaced), which drops the tail.
3716
519
  */
3717
520
  sendStream(peerId, connId, streamId, data) /*throws*/{
3718
- uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3719
- nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_send_stream(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc), FfiConverterUInt64.lower(connId, nativeModule().rustbuffer_alloc), FfiConverterUInt64.lower(streamId, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc), callStatus);
3720
- }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString));
521
+ return FfiConverterBool.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
522
+ return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_send_stream(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc), FfiConverterUInt64.lower(connId, nativeModule().rustbuffer_alloc), FfiConverterUInt64.lower(streamId, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc), callStatus);
523
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3721
524
  }
3722
525
 
3723
526
  /**
@@ -3747,6 +550,16 @@ export class P2pEndpoint extends UniffiAbstractObject {
3747
550
  }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString));
3748
551
  }
3749
552
 
553
+ /**
554
+ * Acknowledges `bytes` of a stream's received data as consumed,
555
+ * letting its sender continue. Every registered protocol needs this.
556
+ */
557
+ streamConsumed(connId, streamId, bytes) /*throws*/{
558
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
559
+ nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_stream_consumed(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterUInt64.lower(connId, nativeModule().rustbuffer_alloc), FfiConverterUInt64.lower(streamId, nativeModule().rustbuffer_alloc), FfiConverterUInt64.lower(bytes, nativeModule().rustbuffer_alloc), callStatus);
560
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString));
561
+ }
562
+
3750
563
  /**
3751
564
  * Subscribes to a pubsub topic.
3752
565
  */
@@ -3821,36 +634,18 @@ const uniffiTypeP2pEndpointObjectFactory = (() => {
3821
634
  })();
3822
635
  const FfiConverterTypeP2pEndpoint = new FfiConverterObject(uniffiTypeP2pEndpointObjectFactory);
3823
636
 
3824
- // FfiConverter for string | undefined
3825
- const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
637
+ // FfiConverter for RelayReservationInfo | undefined
638
+ const FfiConverterOptionalTypeRelayReservationInfo = new FfiConverterOptional(FfiConverterTypeRelayReservationInfo);
3826
639
 
3827
640
  // FfiConverter for Array<string>
3828
641
  const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
3829
642
 
3830
- // FfiConverter for Array<string> | undefined
3831
- const FfiConverterOptionalSequenceString = new FfiConverterOptional(FfiConverterSequenceString);
3832
-
3833
- // FfiConverter for DiscoveryOptions | undefined
3834
- const FfiConverterOptionalTypeDiscoveryOptions = new FfiConverterOptional(FfiConverterTypeDiscoveryOptions);
3835
-
3836
- // FfiConverter for MdnsOptions | undefined
3837
- const FfiConverterOptionalTypeMdnsOptions = new FfiConverterOptional(FfiConverterTypeMdnsOptions);
3838
-
3839
- // FfiConverter for ArrayBuffer | undefined
3840
- const FfiConverterOptionalBytes = new FfiConverterOptional(FfiConverterArrayBuffer);
643
+ // FfiConverter for ConnectionInfo | undefined
644
+ const FfiConverterOptionalTypeConnectionInfo = new FfiConverterOptional(FfiConverterTypeConnectionInfo);
3841
645
 
3842
646
  // FfiConverter for bigint | undefined
3843
647
  const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
3844
648
 
3845
- // FfiConverter for Array<bigint>
3846
- const FfiConverterSequenceUInt64 = new FfiConverterArray(FfiConverterUInt64);
3847
-
3848
- // FfiConverter for RelayReservationInfo | undefined
3849
- const FfiConverterOptionalTypeRelayReservationInfo = new FfiConverterOptional(FfiConverterTypeRelayReservationInfo);
3850
-
3851
- // FfiConverter for ConnectionInfo | undefined
3852
- const FfiConverterOptionalTypeConnectionInfo = new FfiConverterOptional(FfiConverterTypeConnectionInfo);
3853
-
3854
649
  // FfiConverter for Array<P2pEvent>
3855
650
  const FfiConverterSequenceTypeP2pEvent = new FfiConverterArray(FfiConverterTypeP2pEvent);
3856
651
 
@@ -3881,103 +676,106 @@ function uniffiEnsureInitialized() {
3881
676
  if (bindingsContractVersion !== scaffoldingContractVersion) {
3882
677
  throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
3883
678
  }
3884
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_func_circuit_address() !== 35260) {
679
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_func_circuit_address() !== 6026) {
3885
680
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_func_circuit_address");
3886
681
  }
3887
682
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_func_generate_secret_key() !== 44400) {
3888
683
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_func_generate_secret_key");
3889
684
  }
3890
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_func_peer_id_from_secret_key() !== 8962) {
685
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_func_peer_id_from_secret_key() !== 13265) {
3891
686
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_func_peer_id_from_secret_key");
3892
687
  }
3893
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_constructor_p2pendpoint_new() !== 8152) {
688
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_constructor_p2pendpoint_new() !== 40346) {
3894
689
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_constructor_p2pendpoint_new");
3895
690
  }
3896
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_abandon_stream() !== 17669) {
691
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_abandon_stream() !== 39078) {
3897
692
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_abandon_stream");
3898
693
  }
3899
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_active_reservation() !== 6405) {
694
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_active_reservation() !== 7490) {
3900
695
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_active_reservation");
3901
696
  }
3902
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_add_protocol() !== 12280) {
697
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_add_protocol() !== 28928) {
3903
698
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_add_protocol");
3904
699
  }
3905
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_cancel_connect() !== 24195) {
700
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_cancel_connect() !== 21146) {
3906
701
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_cancel_connect");
3907
702
  }
3908
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write() !== 58591) {
703
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write() !== 32688) {
3909
704
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write");
3910
705
  }
3911
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !== 53603) {
706
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !== 21790) {
3912
707
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect");
3913
708
  }
3914
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers() !== 64148) {
709
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers() !== 23362) {
3915
710
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers");
3916
711
  }
3917
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info() !== 24337) {
712
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info() !== 13610) {
3918
713
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info");
3919
714
  }
3920
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect() !== 23975) {
715
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect() !== 7330) {
3921
716
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect");
3922
717
  }
3923
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_discovery_now_ms() !== 14313) {
718
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_discovery_now_ms() !== 15299) {
3924
719
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_discovery_now_ms");
3925
720
  }
3926
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_drain_events() !== 30807) {
721
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_drain_events() !== 61732) {
3927
722
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_drain_events");
3928
723
  }
3929
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_is_peer_ready() !== 30114) {
724
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_is_peer_ready() !== 19426) {
3930
725
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_is_peer_ready");
3931
726
  }
3932
727
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_is_running() !== 42027) {
3933
728
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_is_running");
3934
729
  }
3935
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_known_peers() !== 8123) {
730
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_known_peers() !== 43012) {
3936
731
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_known_peers");
3937
732
  }
3938
733
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_listen_addrs() !== 43494) {
3939
734
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_listen_addrs");
3940
735
  }
3941
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_open_stream() !== 49419) {
736
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_open_stream() !== 35730) {
3942
737
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_open_stream");
3943
738
  }
3944
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_path() !== 6891) {
739
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_path() !== 4892) {
3945
740
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_path");
3946
741
  }
3947
742
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_peer_id() !== 42474) {
3948
743
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_peer_id");
3949
744
  }
3950
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_peer_info() !== 57911) {
745
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_peer_info() !== 62537) {
3951
746
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_peer_info");
3952
747
  }
3953
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_ping() !== 62457) {
748
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_ping() !== 50912) {
3954
749
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_ping");
3955
750
  }
3956
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_publish() !== 19337) {
751
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_publish() !== 9056) {
3957
752
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_publish");
3958
753
  }
3959
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_reachability() !== 22554) {
754
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_reachability() !== 4853) {
3960
755
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_reachability");
3961
756
  }
3962
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_reset_stream() !== 24179) {
757
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_reset_stream() !== 50205) {
3963
758
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_reset_stream");
3964
759
  }
3965
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_send_stream() !== 40818) {
760
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_send_stream() !== 41451) {
3966
761
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_send_stream");
3967
762
  }
3968
763
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_set_active() !== 10522) {
3969
764
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_set_active");
3970
765
  }
3971
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_start() !== 31285) {
766
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_start() !== 43725) {
3972
767
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_start");
3973
768
  }
3974
769
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_stop() !== 11062) {
3975
770
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_stop");
3976
771
  }
3977
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_subscribe() !== 55119) {
772
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_stream_consumed() !== 61579) {
773
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_stream_consumed");
774
+ }
775
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_subscribe() !== 41051) {
3978
776
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_subscribe");
3979
777
  }
3980
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_unsubscribe() !== 32264) {
778
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_unsubscribe() !== 10954) {
3981
779
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_unsubscribe");
3982
780
  }
3983
781
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_wait_stopped() !== 14108) {
@@ -3991,25 +789,8 @@ function uniffiEnsureInitialized() {
3991
789
  export default Object.freeze({
3992
790
  initialize: uniffiEnsureInitialized,
3993
791
  converters: {
3994
- FfiConverterTypeConnectTarget,
3995
- FfiConverterTypeConnectionInfo,
3996
- FfiConverterTypeDiscoveryOptions,
3997
- FfiConverterTypeDiscoverySource,
3998
- FfiConverterTypeDriverFailureKind,
3999
- FfiConverterTypeEndpointConfig,
4000
- FfiConverterTypeEndpointErrorKind,
4001
- FfiConverterTypeFfiError,
4002
- FfiConverterTypeIdentifyInfo,
4003
- FfiConverterTypeKnownPeerInfo,
4004
- FfiConverterTypeMdnsOptions,
4005
- FfiConverterTypeNatErrorKind,
4006
- FfiConverterTypeOpenStreamResult,
4007
792
  FfiConverterTypeP2pEndpoint,
4008
- FfiConverterTypeP2pEvent,
4009
- FfiConverterTypeP2pEventDoorbell,
4010
- FfiConverterTypePathKind,
4011
- FfiConverterTypeReachability,
4012
- FfiConverterTypeRelayReservationInfo
793
+ FfiConverterTypeP2pEventDoorbell
4013
794
  }
4014
795
  });
4015
796
  //# sourceMappingURL=minip2p_ffi.js.map