@minip2p/react-native 0.7.3 → 0.7.4

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