@minip2p/react-native 0.4.6 → 0.4.7

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 (38) hide show
  1. package/Minip2p.podspec +1 -1
  2. package/android/src/main/java/com/minip2p/Minip2pPackage.kt +2 -2
  3. package/android/src/main/jniLibs/arm64-v8a/libminip2p_ffi.so +0 -0
  4. package/android/src/main/jniLibs/x86_64/libminip2p_ffi.so +0 -0
  5. package/build/Minip2pFfi.xcframework/Info.plist +4 -4
  6. package/build/Minip2pFfi.xcframework/ios-arm64/libminip2p_ffi.a +0 -0
  7. package/build/Minip2pFfi.xcframework/ios-arm64-simulator/libminip2p_ffi.a +0 -0
  8. package/cpp/generated/minip2p_ffi.cpp +263 -205
  9. package/cpp/generated/minip2p_ffi.hpp +8 -6
  10. package/lib/module/adapter.js +11 -10
  11. package/lib/module/adapter.js.map +1 -1
  12. package/lib/module/event-drain.js +71 -0
  13. package/lib/module/event-drain.js.map +1 -0
  14. package/lib/module/generated/minip2p_ffi-ffi.js.map +1 -1
  15. package/lib/module/generated/minip2p_ffi.js +665 -693
  16. package/lib/module/generated/minip2p_ffi.js.map +1 -1
  17. package/lib/typescript/src/NativeMinip2p.d.ts.map +1 -1
  18. package/lib/typescript/src/adapter.d.ts.map +1 -1
  19. package/lib/typescript/src/event-drain.d.ts +10 -0
  20. package/lib/typescript/src/event-drain.d.ts.map +1 -0
  21. package/lib/typescript/src/generated/minip2p_ffi-ffi.d.ts +16 -14
  22. package/lib/typescript/src/generated/minip2p_ffi-ffi.d.ts.map +1 -1
  23. package/lib/typescript/src/generated/minip2p_ffi.d.ts +785 -782
  24. package/lib/typescript/src/generated/minip2p_ffi.d.ts.map +1 -1
  25. package/lib/typescript/src/hook-lifecycle.d.ts.map +1 -1
  26. package/lib/typescript/src/hooks.d.ts.map +1 -1
  27. package/lib/typescript/src/native.d.ts.map +1 -1
  28. package/lib/typescript/tests/adapter-event-drain.test.d.ts +2 -0
  29. package/lib/typescript/tests/adapter-event-drain.test.d.ts.map +1 -0
  30. package/lib/typescript/tests/event-drain.test.d.ts +2 -0
  31. package/lib/typescript/tests/event-drain.test.d.ts.map +1 -0
  32. package/lib/typescript/vitest.built.config.d.ts +3 -0
  33. package/lib/typescript/vitest.built.config.d.ts.map +1 -0
  34. package/package.json +18 -18
  35. package/src/adapter.ts +15 -11
  36. package/src/event-drain.ts +80 -0
  37. package/src/generated/minip2p_ffi-ffi.ts +16 -14
  38. package/src/generated/minip2p_ffi.ts +665 -705
@@ -4,9 +4,9 @@
4
4
  /* eslint-disable */
5
5
  // @ts-nocheck
6
6
  import nativeModule from "./minip2p_ffi-ffi";
7
- import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct, type UniffiVTableCallbackInterfaceMinip2pFfiP2pEventListener,
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, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterInt32, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiTraitInterfaceCall, uniffiTypeNameSymbol, variantOrdinalSymbol,
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,
10
10
  } from "@ubjs/core";
11
11
  const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
12
12
 
@@ -21,17 +21,9 @@ const uniffiIsDebug =
21
21
 
22
22
  /**
23
23
  * Builds a circuit multiaddress for `peer_id` through `relay_addr`.
24
- *
25
- * `relay_addr` is any direct `/quic-v1` or `/tcp` peer address.
26
24
  */
27
25
  export function circuitAddress(relayAddr: string, peerId: string): string /*throws*/ {
28
- return ((__rb: Uint8Array) => {
29
- try {
30
- return FfiConverterString.lift(__rb);
31
- } finally {
32
- nativeModule().rustbuffer_free(__rb);
33
- }
34
- })(uniffiCaller.rustCallWithError(
26
+ const __rb: Uint8Array = uniffiCaller.rustCallWithError(
35
27
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
36
28
  /*caller:*/ (callStatus) => {
37
29
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_func_circuit_address(
@@ -40,39 +32,37 @@ export function circuitAddress(relayAddr: string, peerId: string): string /*thro
40
32
  callStatus);
41
33
  },
42
34
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
43
- ));
35
+ );
36
+ try {
37
+ return FfiConverterString.lift(__rb);
38
+ } finally {
39
+ nativeModule().rustbuffer_free(__rb);
40
+ }
44
41
  }
45
42
 
46
43
  /**
47
44
  * Generates raw Ed25519 secret key material.
48
45
  */
49
46
  export function generateSecretKey(): ArrayBuffer {
50
- return ((__rb: Uint8Array) => {
51
- try {
52
- return FfiConverterArrayBuffer.lift(__rb);
53
- } finally {
54
- nativeModule().rustbuffer_free(__rb);
55
- }
56
- })(uniffiCaller.rustCall(
47
+ const __rb: Uint8Array = uniffiCaller.rustCall(
57
48
  /*caller:*/ (callStatus) => {
58
49
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_func_generate_secret_key(
59
50
  callStatus);
60
51
  },
61
52
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
62
- ));
53
+ );
54
+ try {
55
+ return FfiConverterArrayBuffer.lift(__rb);
56
+ } finally {
57
+ nativeModule().rustbuffer_free(__rb);
58
+ }
63
59
  }
64
60
 
65
61
  /**
66
62
  * Derives a base58 peer ID from raw Ed25519 secret key material.
67
63
  */
68
64
  export function peerIdFromSecretKey(secretKey: ArrayBuffer): string /*throws*/ {
69
- return ((__rb: Uint8Array) => {
70
- try {
71
- return FfiConverterString.lift(__rb);
72
- } finally {
73
- nativeModule().rustbuffer_free(__rb);
74
- }
75
- })(uniffiCaller.rustCallWithError(
65
+ const __rb: Uint8Array = uniffiCaller.rustCallWithError(
76
66
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
77
67
  /*caller:*/ (callStatus) => {
78
68
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_func_peer_id_from_secret_key(
@@ -80,7 +70,12 @@ export function peerIdFromSecretKey(secretKey: ArrayBuffer): string /*throws*/ {
80
70
  callStatus);
81
71
  },
82
72
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
83
- ));
73
+ );
74
+ try {
75
+ return FfiConverterString.lift(__rb);
76
+ } finally {
77
+ nativeModule().rustbuffer_free(__rb);
78
+ }
84
79
  }
85
80
 
86
81
  // Hermes (React Native ≥ 0.74) ships TextEncoder and encodeInto, but not
@@ -176,19 +171,19 @@ export const DiscoveryOptions = (() => {
176
171
  const FfiConverterTypeDiscoveryOptions = (() => {
177
172
  type TypeName = DiscoveryOptions;
178
173
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
179
- read(from: RustBuffer): TypeName {
174
+ readFromCursor(c: Cursor): TypeName {
180
175
  return {
181
- topic: FfiConverterString.read(from),
182
- beaconIntervalMs: FfiConverterUInt64.read(from),
183
- peerTtlMs: FfiConverterUInt64.read(from),
184
- autoDial: FfiConverterBool.read(from)
176
+ topic: FfiConverterString.readFromCursor(c),
177
+ beaconIntervalMs: FfiConverterUInt64.readFromCursor(c),
178
+ peerTtlMs: FfiConverterUInt64.readFromCursor(c),
179
+ autoDial: FfiConverterBool.readFromCursor(c)
185
180
  };
186
181
  }
187
- write(value: TypeName, into: RustBuffer): void {
188
- FfiConverterString.write(value.topic, into);
189
- FfiConverterUInt64.write(value.beaconIntervalMs, into);
190
- FfiConverterUInt64.write(value.peerTtlMs, into);
191
- FfiConverterBool.write(value.autoDial, into);
182
+ writeIntoCursor(value: TypeName, c: Cursor): void {
183
+ FfiConverterString.writeIntoCursor(value.topic, c);
184
+ FfiConverterUInt64.writeIntoCursor(value.beaconIntervalMs, c);
185
+ FfiConverterUInt64.writeIntoCursor(value.peerTtlMs, c);
186
+ FfiConverterBool.writeIntoCursor(value.autoDial, c);
192
187
  }
193
188
  allocationSize(value: TypeName): number {
194
189
  return FfiConverterString.allocationSize(value.topic) +
@@ -233,13 +228,13 @@ export const TransportOptions = (() => {
233
228
  const FfiConverterTypeTransportOptions = (() => {
234
229
  type TypeName = TransportOptions;
235
230
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
236
- read(from: RustBuffer): TypeName {
231
+ readFromCursor(c: Cursor): TypeName {
237
232
  return {
238
- listenAddrs: FfiConverterOptionalSequenceString.read(from)
233
+ listenAddrs: FfiConverterOptionalSequenceString.readFromCursor(c)
239
234
  };
240
235
  }
241
- write(value: TypeName, into: RustBuffer): void {
242
- FfiConverterOptionalSequenceString.write(value.listenAddrs, into);
236
+ writeIntoCursor(value: TypeName, c: Cursor): void {
237
+ FfiConverterOptionalSequenceString.writeIntoCursor(value.listenAddrs, c);
243
238
  }
244
239
  allocationSize(value: TypeName): number {
245
240
  return FfiConverterOptionalSequenceString.allocationSize(value.listenAddrs);
@@ -264,24 +259,23 @@ export enum PubsubRouter {
264
259
  }
265
260
 
266
261
  const FfiConverterTypePubsubRouter = (() => {
267
- const ordinalConverter = FfiConverterInt32;
268
262
  type TypeName = PubsubRouter;
269
263
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
270
- read(from: RustBuffer): TypeName {
271
- switch (ordinalConverter.read(from)) {
264
+ readFromCursor(c: Cursor): TypeName {
265
+ switch (c.readI32()) {
272
266
  case 1: return PubsubRouter.Gossipsub;
273
267
  case 2: return PubsubRouter.Floodsub;
274
268
  default: throw new UniffiInternalError.UnexpectedEnumCase();
275
269
  }
276
270
  }
277
- write(value: TypeName, into: RustBuffer): void {
271
+ writeIntoCursor(value: TypeName, c: Cursor): void {
278
272
  switch (value) {
279
- case PubsubRouter.Gossipsub: return ordinalConverter.write(1, into);
280
- case PubsubRouter.Floodsub: return ordinalConverter.write(2, into);
273
+ case PubsubRouter.Gossipsub: return c.writeI32(1);
274
+ case PubsubRouter.Floodsub: return c.writeI32(2);
281
275
  }
282
276
  }
283
277
  allocationSize(value: TypeName): number {
284
- return ordinalConverter.allocationSize(0);
278
+ return 4;
285
279
  }
286
280
  }
287
281
  return new FFIConverter();
@@ -344,27 +338,27 @@ export const MdnsOptions = (() => {
344
338
  const FfiConverterTypeMdnsOptions = (() => {
345
339
  type TypeName = MdnsOptions;
346
340
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
347
- read(from: RustBuffer): TypeName {
341
+ readFromCursor(c: Cursor): TypeName {
348
342
  return {
349
- enableIpv6: FfiConverterBool.read(from),
350
- ttlMs: FfiConverterUInt64.read(from),
351
- queryIntervalMs: FfiConverterUInt64.read(from),
352
- maxPacketBytes: FfiConverterUInt32.read(from),
353
- maxAnnouncedAddrs: FfiConverterUInt32.read(from),
354
- interfaceRefreshMs: FfiConverterUInt64.read(from),
355
- socketPollIntervalMs: FfiConverterUInt64.read(from),
356
- autoDial: FfiConverterBool.read(from)
343
+ enableIpv6: FfiConverterBool.readFromCursor(c),
344
+ ttlMs: FfiConverterUInt64.readFromCursor(c),
345
+ queryIntervalMs: FfiConverterUInt64.readFromCursor(c),
346
+ maxPacketBytes: FfiConverterUInt32.readFromCursor(c),
347
+ maxAnnouncedAddrs: FfiConverterUInt32.readFromCursor(c),
348
+ interfaceRefreshMs: FfiConverterUInt64.readFromCursor(c),
349
+ socketPollIntervalMs: FfiConverterUInt64.readFromCursor(c),
350
+ autoDial: FfiConverterBool.readFromCursor(c)
357
351
  };
358
352
  }
359
- write(value: TypeName, into: RustBuffer): void {
360
- FfiConverterBool.write(value.enableIpv6, into);
361
- FfiConverterUInt64.write(value.ttlMs, into);
362
- FfiConverterUInt64.write(value.queryIntervalMs, into);
363
- FfiConverterUInt32.write(value.maxPacketBytes, into);
364
- FfiConverterUInt32.write(value.maxAnnouncedAddrs, into);
365
- FfiConverterUInt64.write(value.interfaceRefreshMs, into);
366
- FfiConverterUInt64.write(value.socketPollIntervalMs, into);
367
- FfiConverterBool.write(value.autoDial, into);
353
+ writeIntoCursor(value: TypeName, c: Cursor): void {
354
+ FfiConverterBool.writeIntoCursor(value.enableIpv6, c);
355
+ FfiConverterUInt64.writeIntoCursor(value.ttlMs, c);
356
+ FfiConverterUInt64.writeIntoCursor(value.queryIntervalMs, c);
357
+ FfiConverterUInt32.writeIntoCursor(value.maxPacketBytes, c);
358
+ FfiConverterUInt32.writeIntoCursor(value.maxAnnouncedAddrs, c);
359
+ FfiConverterUInt64.writeIntoCursor(value.interfaceRefreshMs, c);
360
+ FfiConverterUInt64.writeIntoCursor(value.socketPollIntervalMs, c);
361
+ FfiConverterBool.writeIntoCursor(value.autoDial, c);
368
362
  }
369
363
  allocationSize(value: TypeName): number {
370
364
  return FfiConverterBool.allocationSize(value.enableIpv6) +
@@ -450,33 +444,33 @@ export const EndpointConfig = (() => {
450
444
  const FfiConverterTypeEndpointConfig = (() => {
451
445
  type TypeName = EndpointConfig;
452
446
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
453
- read(from: RustBuffer): TypeName {
447
+ readFromCursor(c: Cursor): TypeName {
454
448
  return {
455
- agentVersion: FfiConverterOptionalString.read(from),
456
- relays: FfiConverterSequenceString.read(from),
457
- autonatServers: FfiConverterSequenceString.read(from),
458
- quic: FfiConverterOptionalTypeTransportOptions.read(from),
459
- tcp: FfiConverterOptionalTypeTransportOptions.read(from),
460
- forceRelay: FfiConverterBool.read(from),
461
- allowUnsigned: FfiConverterBool.read(from),
462
- pubsubRouter: FfiConverterTypePubsubRouter.read(from),
463
- protocols: FfiConverterSequenceString.read(from),
464
- discovery: FfiConverterOptionalTypeDiscoveryOptions.read(from),
465
- mdns: FfiConverterOptionalTypeMdnsOptions.read(from)
449
+ agentVersion: FfiConverterOptionalString.readFromCursor(c),
450
+ relays: FfiConverterSequenceString.readFromCursor(c),
451
+ autonatServers: FfiConverterSequenceString.readFromCursor(c),
452
+ quic: FfiConverterOptionalTypeTransportOptions.readFromCursor(c),
453
+ tcp: FfiConverterOptionalTypeTransportOptions.readFromCursor(c),
454
+ forceRelay: FfiConverterBool.readFromCursor(c),
455
+ allowUnsigned: FfiConverterBool.readFromCursor(c),
456
+ pubsubRouter: FfiConverterTypePubsubRouter.readFromCursor(c),
457
+ protocols: FfiConverterSequenceString.readFromCursor(c),
458
+ discovery: FfiConverterOptionalTypeDiscoveryOptions.readFromCursor(c),
459
+ mdns: FfiConverterOptionalTypeMdnsOptions.readFromCursor(c)
466
460
  };
467
461
  }
468
- write(value: TypeName, into: RustBuffer): void {
469
- FfiConverterOptionalString.write(value.agentVersion, into);
470
- FfiConverterSequenceString.write(value.relays, into);
471
- FfiConverterSequenceString.write(value.autonatServers, into);
472
- FfiConverterOptionalTypeTransportOptions.write(value.quic, into);
473
- FfiConverterOptionalTypeTransportOptions.write(value.tcp, into);
474
- FfiConverterBool.write(value.forceRelay, into);
475
- FfiConverterBool.write(value.allowUnsigned, into);
476
- FfiConverterTypePubsubRouter.write(value.pubsubRouter, into);
477
- FfiConverterSequenceString.write(value.protocols, into);
478
- FfiConverterOptionalTypeDiscoveryOptions.write(value.discovery, into);
479
- FfiConverterOptionalTypeMdnsOptions.write(value.mdns, into);
462
+ writeIntoCursor(value: TypeName, c: Cursor): void {
463
+ FfiConverterOptionalString.writeIntoCursor(value.agentVersion, c);
464
+ FfiConverterSequenceString.writeIntoCursor(value.relays, c);
465
+ FfiConverterSequenceString.writeIntoCursor(value.autonatServers, c);
466
+ FfiConverterOptionalTypeTransportOptions.writeIntoCursor(value.quic, c);
467
+ FfiConverterOptionalTypeTransportOptions.writeIntoCursor(value.tcp, c);
468
+ FfiConverterBool.writeIntoCursor(value.forceRelay, c);
469
+ FfiConverterBool.writeIntoCursor(value.allowUnsigned, c);
470
+ FfiConverterTypePubsubRouter.writeIntoCursor(value.pubsubRouter, c);
471
+ FfiConverterSequenceString.writeIntoCursor(value.protocols, c);
472
+ FfiConverterOptionalTypeDiscoveryOptions.writeIntoCursor(value.discovery, c);
473
+ FfiConverterOptionalTypeMdnsOptions.writeIntoCursor(value.mdns, c);
480
474
  }
481
475
  allocationSize(value: TypeName): number {
482
476
  return FfiConverterOptionalString.allocationSize(value.agentVersion) +
@@ -545,23 +539,23 @@ export const IdentifyInfo = (() => {
545
539
  const FfiConverterTypeIdentifyInfo = (() => {
546
540
  type TypeName = IdentifyInfo;
547
541
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
548
- read(from: RustBuffer): TypeName {
542
+ readFromCursor(c: Cursor): TypeName {
549
543
  return {
550
- publicKey: FfiConverterOptionalBytes.read(from),
551
- listenAddrs: FfiConverterSequenceString.read(from),
552
- protocols: FfiConverterSequenceString.read(from),
553
- observedAddr: FfiConverterOptionalString.read(from),
554
- protocolVersion: FfiConverterOptionalString.read(from),
555
- agentVersion: FfiConverterOptionalString.read(from)
544
+ publicKey: FfiConverterOptionalBytes.readFromCursor(c),
545
+ listenAddrs: FfiConverterSequenceString.readFromCursor(c),
546
+ protocols: FfiConverterSequenceString.readFromCursor(c),
547
+ observedAddr: FfiConverterOptionalString.readFromCursor(c),
548
+ protocolVersion: FfiConverterOptionalString.readFromCursor(c),
549
+ agentVersion: FfiConverterOptionalString.readFromCursor(c)
556
550
  };
557
551
  }
558
- write(value: TypeName, into: RustBuffer): void {
559
- FfiConverterOptionalBytes.write(value.publicKey, into);
560
- FfiConverterSequenceString.write(value.listenAddrs, into);
561
- FfiConverterSequenceString.write(value.protocols, into);
562
- FfiConverterOptionalString.write(value.observedAddr, into);
563
- FfiConverterOptionalString.write(value.protocolVersion, into);
564
- FfiConverterOptionalString.write(value.agentVersion, into);
552
+ writeIntoCursor(value: TypeName, c: Cursor): void {
553
+ FfiConverterOptionalBytes.writeIntoCursor(value.publicKey, c);
554
+ FfiConverterSequenceString.writeIntoCursor(value.listenAddrs, c);
555
+ FfiConverterSequenceString.writeIntoCursor(value.protocols, c);
556
+ FfiConverterOptionalString.writeIntoCursor(value.observedAddr, c);
557
+ FfiConverterOptionalString.writeIntoCursor(value.protocolVersion, c);
558
+ FfiConverterOptionalString.writeIntoCursor(value.agentVersion, c);
565
559
  }
566
560
  allocationSize(value: TypeName): number {
567
561
  return FfiConverterOptionalBytes.allocationSize(value.publicKey) +
@@ -629,25 +623,25 @@ export const KnownPeerInfo = (() => {
629
623
  const FfiConverterTypeKnownPeerInfo = (() => {
630
624
  type TypeName = KnownPeerInfo;
631
625
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
632
- read(from: RustBuffer): TypeName {
626
+ readFromCursor(c: Cursor): TypeName {
633
627
  return {
634
- peerId: FfiConverterString.read(from),
635
- addrs: FfiConverterSequenceString.read(from),
636
- beaconAddrs: FfiConverterSequenceString.read(from),
637
- mdnsAddrs: FfiConverterSequenceString.read(from),
638
- beaconLastSeenAgeMs: FfiConverterOptionalUInt64.read(from),
639
- mdnsLastSeenAgeMs: FfiConverterOptionalUInt64.read(from),
640
- connected: FfiConverterBool.read(from)
628
+ peerId: FfiConverterString.readFromCursor(c),
629
+ addrs: FfiConverterSequenceString.readFromCursor(c),
630
+ beaconAddrs: FfiConverterSequenceString.readFromCursor(c),
631
+ mdnsAddrs: FfiConverterSequenceString.readFromCursor(c),
632
+ beaconLastSeenAgeMs: FfiConverterOptionalUInt64.readFromCursor(c),
633
+ mdnsLastSeenAgeMs: FfiConverterOptionalUInt64.readFromCursor(c),
634
+ connected: FfiConverterBool.readFromCursor(c)
641
635
  };
642
636
  }
643
- write(value: TypeName, into: RustBuffer): void {
644
- FfiConverterString.write(value.peerId, into);
645
- FfiConverterSequenceString.write(value.addrs, into);
646
- FfiConverterSequenceString.write(value.beaconAddrs, into);
647
- FfiConverterSequenceString.write(value.mdnsAddrs, into);
648
- FfiConverterOptionalUInt64.write(value.beaconLastSeenAgeMs, into);
649
- FfiConverterOptionalUInt64.write(value.mdnsLastSeenAgeMs, into);
650
- FfiConverterBool.write(value.connected, into);
637
+ writeIntoCursor(value: TypeName, c: Cursor): void {
638
+ FfiConverterString.writeIntoCursor(value.peerId, c);
639
+ FfiConverterSequenceString.writeIntoCursor(value.addrs, c);
640
+ FfiConverterSequenceString.writeIntoCursor(value.beaconAddrs, c);
641
+ FfiConverterSequenceString.writeIntoCursor(value.mdnsAddrs, c);
642
+ FfiConverterOptionalUInt64.writeIntoCursor(value.beaconLastSeenAgeMs, c);
643
+ FfiConverterOptionalUInt64.writeIntoCursor(value.mdnsLastSeenAgeMs, c);
644
+ FfiConverterBool.writeIntoCursor(value.connected, c);
651
645
  }
652
646
  allocationSize(value: TypeName): number {
653
647
  return FfiConverterString.allocationSize(value.peerId) +
@@ -696,15 +690,15 @@ export const OpenStreamResult = (() => {
696
690
  const FfiConverterTypeOpenStreamResult = (() => {
697
691
  type TypeName = OpenStreamResult;
698
692
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
699
- read(from: RustBuffer): TypeName {
693
+ readFromCursor(c: Cursor): TypeName {
700
694
  return {
701
- connId: FfiConverterUInt64.read(from),
702
- streamId: FfiConverterUInt64.read(from)
695
+ connId: FfiConverterUInt64.readFromCursor(c),
696
+ streamId: FfiConverterUInt64.readFromCursor(c)
703
697
  };
704
698
  }
705
- write(value: TypeName, into: RustBuffer): void {
706
- FfiConverterUInt64.write(value.connId, into);
707
- FfiConverterUInt64.write(value.streamId, into);
699
+ writeIntoCursor(value: TypeName, c: Cursor): void {
700
+ FfiConverterUInt64.writeIntoCursor(value.connId, c);
701
+ FfiConverterUInt64.writeIntoCursor(value.streamId, c);
708
702
  }
709
703
  allocationSize(value: TypeName): number {
710
704
  return FfiConverterUInt64.allocationSize(value.connId) +
@@ -748,15 +742,15 @@ export const RelayReservationInfo = (() => {
748
742
  const FfiConverterTypeRelayReservationInfo = (() => {
749
743
  type TypeName = RelayReservationInfo;
750
744
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
751
- read(from: RustBuffer): TypeName {
745
+ readFromCursor(c: Cursor): TypeName {
752
746
  return {
753
- relayPeerId: FfiConverterString.read(from),
754
- expiresUnixSecs: FfiConverterOptionalUInt64.read(from)
747
+ relayPeerId: FfiConverterString.readFromCursor(c),
748
+ expiresUnixSecs: FfiConverterOptionalUInt64.readFromCursor(c)
755
749
  };
756
750
  }
757
- write(value: TypeName, into: RustBuffer): void {
758
- FfiConverterString.write(value.relayPeerId, into);
759
- FfiConverterOptionalUInt64.write(value.expiresUnixSecs, into);
751
+ writeIntoCursor(value: TypeName, c: Cursor): void {
752
+ FfiConverterString.writeIntoCursor(value.relayPeerId, c);
753
+ FfiConverterOptionalUInt64.writeIntoCursor(value.expiresUnixSecs, c);
760
754
  }
761
755
  allocationSize(value: TypeName): number {
762
756
  return FfiConverterString.allocationSize(value.relayPeerId) +
@@ -782,24 +776,23 @@ export enum DiscoverySource {
782
776
  }
783
777
 
784
778
  const FfiConverterTypeDiscoverySource = (() => {
785
- const ordinalConverter = FfiConverterInt32;
786
779
  type TypeName = DiscoverySource;
787
780
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
788
- read(from: RustBuffer): TypeName {
789
- switch (ordinalConverter.read(from)) {
781
+ readFromCursor(c: Cursor): TypeName {
782
+ switch (c.readI32()) {
790
783
  case 1: return DiscoverySource.SignedBeacon;
791
784
  case 2: return DiscoverySource.Mdns;
792
785
  default: throw new UniffiInternalError.UnexpectedEnumCase();
793
786
  }
794
787
  }
795
- write(value: TypeName, into: RustBuffer): void {
788
+ writeIntoCursor(value: TypeName, c: Cursor): void {
796
789
  switch (value) {
797
- case DiscoverySource.SignedBeacon: return ordinalConverter.write(1, into);
798
- case DiscoverySource.Mdns: return ordinalConverter.write(2, into);
790
+ case DiscoverySource.SignedBeacon: return c.writeI32(1);
791
+ case DiscoverySource.Mdns: return c.writeI32(2);
799
792
  }
800
793
  }
801
794
  allocationSize(value: TypeName): number {
802
- return ordinalConverter.allocationSize(0);
795
+ return 4;
803
796
  }
804
797
  }
805
798
  return new FFIConverter();
@@ -828,11 +821,10 @@ export enum DriverFailureKind {
828
821
  }
829
822
 
830
823
  const FfiConverterTypeDriverFailureKind = (() => {
831
- const ordinalConverter = FfiConverterInt32;
832
824
  type TypeName = DriverFailureKind;
833
825
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
834
- read(from: RustBuffer): TypeName {
835
- switch (ordinalConverter.read(from)) {
826
+ readFromCursor(c: Cursor): TypeName {
827
+ switch (c.readI32()) {
836
828
  case 1: return DriverFailureKind.Transport;
837
829
  case 2: return DriverFailureKind.Swarm;
838
830
  case 3: return DriverFailureKind.Invariant;
@@ -840,16 +832,16 @@ const FfiConverterTypeDriverFailureKind = (() => {
840
832
  default: throw new UniffiInternalError.UnexpectedEnumCase();
841
833
  }
842
834
  }
843
- write(value: TypeName, into: RustBuffer): void {
835
+ writeIntoCursor(value: TypeName, c: Cursor): void {
844
836
  switch (value) {
845
- case DriverFailureKind.Transport: return ordinalConverter.write(1, into);
846
- case DriverFailureKind.Swarm: return ordinalConverter.write(2, into);
847
- case DriverFailureKind.Invariant: return ordinalConverter.write(3, into);
848
- case DriverFailureKind.Panic: return ordinalConverter.write(4, into);
837
+ case DriverFailureKind.Transport: return c.writeI32(1);
838
+ case DriverFailureKind.Swarm: return c.writeI32(2);
839
+ case DriverFailureKind.Invariant: return c.writeI32(3);
840
+ case DriverFailureKind.Panic: return c.writeI32(4);
849
841
  }
850
842
  }
851
843
  allocationSize(value: TypeName): number {
852
- return ordinalConverter.allocationSize(0);
844
+ return 4;
853
845
  }
854
846
  }
855
847
  return new FFIConverter();
@@ -894,11 +886,10 @@ export enum EndpointErrorKind {
894
886
  }
895
887
 
896
888
  const FfiConverterTypeEndpointErrorKind = (() => {
897
- const ordinalConverter = FfiConverterInt32;
898
889
  type TypeName = EndpointErrorKind;
899
890
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
900
- read(from: RustBuffer): TypeName {
901
- switch (ordinalConverter.read(from)) {
891
+ readFromCursor(c: Cursor): TypeName {
892
+ switch (c.readI32()) {
902
893
  case 1: return EndpointErrorKind.Transport;
903
894
  case 2: return EndpointErrorKind.Multistream;
904
895
  case 3: return EndpointErrorKind.Identify;
@@ -910,20 +901,20 @@ const FfiConverterTypeEndpointErrorKind = (() => {
910
901
  default: throw new UniffiInternalError.UnexpectedEnumCase();
911
902
  }
912
903
  }
913
- write(value: TypeName, into: RustBuffer): void {
904
+ writeIntoCursor(value: TypeName, c: Cursor): void {
914
905
  switch (value) {
915
- case EndpointErrorKind.Transport: return ordinalConverter.write(1, into);
916
- case EndpointErrorKind.Multistream: return ordinalConverter.write(2, into);
917
- case EndpointErrorKind.Identify: return ordinalConverter.write(3, into);
918
- case EndpointErrorKind.Ping: return ordinalConverter.write(4, into);
919
- case EndpointErrorKind.IdentifyStreamRejected: return ordinalConverter.write(5, into);
920
- case EndpointErrorKind.OpenStreamFailed: return ordinalConverter.write(6, into);
921
- case EndpointErrorKind.UnsupportedProtocol: return ordinalConverter.write(7, into);
922
- case EndpointErrorKind.Driver: return ordinalConverter.write(8, into);
906
+ case EndpointErrorKind.Transport: return c.writeI32(1);
907
+ case EndpointErrorKind.Multistream: return c.writeI32(2);
908
+ case EndpointErrorKind.Identify: return c.writeI32(3);
909
+ case EndpointErrorKind.Ping: return c.writeI32(4);
910
+ case EndpointErrorKind.IdentifyStreamRejected: return c.writeI32(5);
911
+ case EndpointErrorKind.OpenStreamFailed: return c.writeI32(6);
912
+ case EndpointErrorKind.UnsupportedProtocol: return c.writeI32(7);
913
+ case EndpointErrorKind.Driver: return c.writeI32(8);
923
914
  }
924
915
  }
925
916
  allocationSize(value: TypeName): number {
926
- return ordinalConverter.allocationSize(0);
917
+ return 4;
927
918
  }
928
919
  }
929
920
  return new FFIConverter();
@@ -1480,97 +1471,96 @@ export type FfiError = InstanceType<
1480
1471
 
1481
1472
  // FfiConverter for enum FfiError
1482
1473
  const FfiConverterTypeFfiError = (() => {
1483
- const ordinalConverter = FfiConverterInt32;
1484
1474
  type TypeName = FfiError;
1485
1475
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1486
- read(from: RustBuffer): TypeName {
1487
- switch (ordinalConverter.read(from)) {
1476
+ readFromCursor(c: Cursor): TypeName {
1477
+ switch (c.readI32()) {
1488
1478
  case 1: return new FfiError.AlreadyStarted();
1489
1479
  case 2: return new FfiError.Stopped();
1490
- case 3: return new FfiError.InvalidConfig({detail: FfiConverterString.read(from) });
1491
- case 4: return new FfiError.InvalidKey({detail: FfiConverterString.read(from) });
1492
- case 5: return new FfiError.InvalidPeerId({detail: FfiConverterString.read(from) });
1493
- case 6: return new FfiError.InvalidAddress({detail: FfiConverterString.read(from) });
1494
- case 7: return new FfiError.InvalidTopic({detail: FfiConverterString.read(from) });
1495
- case 8: return new FfiError.NotPermitted({detail: FfiConverterString.read(from) });
1480
+ case 3: return new FfiError.InvalidConfig({detail: FfiConverterString.readFromCursor(c) });
1481
+ case 4: return new FfiError.InvalidKey({detail: FfiConverterString.readFromCursor(c) });
1482
+ case 5: return new FfiError.InvalidPeerId({detail: FfiConverterString.readFromCursor(c) });
1483
+ case 6: return new FfiError.InvalidAddress({detail: FfiConverterString.readFromCursor(c) });
1484
+ case 7: return new FfiError.InvalidTopic({detail: FfiConverterString.readFromCursor(c) });
1485
+ case 8: return new FfiError.NotPermitted({detail: FfiConverterString.readFromCursor(c) });
1496
1486
  case 9: return new FfiError.Backpressure();
1497
1487
  case 10: return new FfiError.MessageTooLarge();
1498
- case 11: return new FfiError.Transport({detail: FfiConverterString.read(from) });
1499
- case 12: return new FfiError.InvalidState({detail: FfiConverterString.read(from) });
1500
- case 13: return new FfiError.Internal({detail: FfiConverterString.read(from) });
1488
+ case 11: return new FfiError.Transport({detail: FfiConverterString.readFromCursor(c) });
1489
+ case 12: return new FfiError.InvalidState({detail: FfiConverterString.readFromCursor(c) });
1490
+ case 13: return new FfiError.Internal({detail: FfiConverterString.readFromCursor(c) });
1501
1491
  default: throw new UniffiInternalError.UnexpectedEnumCase();
1502
1492
  }
1503
1493
  }
1504
- write(value: TypeName, into: RustBuffer): void {
1494
+ writeIntoCursor(value: TypeName, c: Cursor): void {
1505
1495
  switch (value.tag) {
1506
1496
  case FfiError_Tags.AlreadyStarted: {
1507
- ordinalConverter.write(1, into);
1497
+ c.writeI32(1);
1508
1498
  return;
1509
1499
  }
1510
1500
  case FfiError_Tags.Stopped: {
1511
- ordinalConverter.write(2, into);
1501
+ c.writeI32(2);
1512
1502
  return;
1513
1503
  }
1514
1504
  case FfiError_Tags.InvalidConfig: {
1515
- ordinalConverter.write(3, into);
1505
+ c.writeI32(3);
1516
1506
  const inner = value.inner;
1517
- FfiConverterString.write(inner.detail, into);
1507
+ FfiConverterString.writeIntoCursor(inner.detail, c);
1518
1508
  return;
1519
1509
  }
1520
1510
  case FfiError_Tags.InvalidKey: {
1521
- ordinalConverter.write(4, into);
1511
+ c.writeI32(4);
1522
1512
  const inner = value.inner;
1523
- FfiConverterString.write(inner.detail, into);
1513
+ FfiConverterString.writeIntoCursor(inner.detail, c);
1524
1514
  return;
1525
1515
  }
1526
1516
  case FfiError_Tags.InvalidPeerId: {
1527
- ordinalConverter.write(5, into);
1517
+ c.writeI32(5);
1528
1518
  const inner = value.inner;
1529
- FfiConverterString.write(inner.detail, into);
1519
+ FfiConverterString.writeIntoCursor(inner.detail, c);
1530
1520
  return;
1531
1521
  }
1532
1522
  case FfiError_Tags.InvalidAddress: {
1533
- ordinalConverter.write(6, into);
1523
+ c.writeI32(6);
1534
1524
  const inner = value.inner;
1535
- FfiConverterString.write(inner.detail, into);
1525
+ FfiConverterString.writeIntoCursor(inner.detail, c);
1536
1526
  return;
1537
1527
  }
1538
1528
  case FfiError_Tags.InvalidTopic: {
1539
- ordinalConverter.write(7, into);
1529
+ c.writeI32(7);
1540
1530
  const inner = value.inner;
1541
- FfiConverterString.write(inner.detail, into);
1531
+ FfiConverterString.writeIntoCursor(inner.detail, c);
1542
1532
  return;
1543
1533
  }
1544
1534
  case FfiError_Tags.NotPermitted: {
1545
- ordinalConverter.write(8, into);
1535
+ c.writeI32(8);
1546
1536
  const inner = value.inner;
1547
- FfiConverterString.write(inner.detail, into);
1537
+ FfiConverterString.writeIntoCursor(inner.detail, c);
1548
1538
  return;
1549
1539
  }
1550
1540
  case FfiError_Tags.Backpressure: {
1551
- ordinalConverter.write(9, into);
1541
+ c.writeI32(9);
1552
1542
  return;
1553
1543
  }
1554
1544
  case FfiError_Tags.MessageTooLarge: {
1555
- ordinalConverter.write(10, into);
1545
+ c.writeI32(10);
1556
1546
  return;
1557
1547
  }
1558
1548
  case FfiError_Tags.Transport: {
1559
- ordinalConverter.write(11, into);
1549
+ c.writeI32(11);
1560
1550
  const inner = value.inner;
1561
- FfiConverterString.write(inner.detail, into);
1551
+ FfiConverterString.writeIntoCursor(inner.detail, c);
1562
1552
  return;
1563
1553
  }
1564
1554
  case FfiError_Tags.InvalidState: {
1565
- ordinalConverter.write(12, into);
1555
+ c.writeI32(12);
1566
1556
  const inner = value.inner;
1567
- FfiConverterString.write(inner.detail, into);
1557
+ FfiConverterString.writeIntoCursor(inner.detail, c);
1568
1558
  return;
1569
1559
  }
1570
1560
  case FfiError_Tags.Internal: {
1571
- ordinalConverter.write(13, into);
1561
+ c.writeI32(13);
1572
1562
  const inner = value.inner;
1573
- FfiConverterString.write(inner.detail, into);
1563
+ FfiConverterString.writeIntoCursor(inner.detail, c);
1574
1564
  return;
1575
1565
  }
1576
1566
  default:
@@ -1581,68 +1571,68 @@ const FfiConverterTypeFfiError = (() => {
1581
1571
  allocationSize(value: TypeName): number {
1582
1572
  switch (value.tag) {
1583
1573
  case FfiError_Tags.AlreadyStarted: {
1584
- return ordinalConverter.allocationSize(1);
1574
+ return 4;
1585
1575
  }
1586
1576
  case FfiError_Tags.Stopped: {
1587
- return ordinalConverter.allocationSize(2);
1577
+ return 4;
1588
1578
  }
1589
1579
  case FfiError_Tags.InvalidConfig: {
1590
1580
  const inner = value.inner;
1591
- let size = ordinalConverter.allocationSize(3);
1581
+ let size = 4;
1592
1582
  size += FfiConverterString.allocationSize(inner.detail);
1593
1583
  return size;
1594
1584
  }
1595
1585
  case FfiError_Tags.InvalidKey: {
1596
1586
  const inner = value.inner;
1597
- let size = ordinalConverter.allocationSize(4);
1587
+ let size = 4;
1598
1588
  size += FfiConverterString.allocationSize(inner.detail);
1599
1589
  return size;
1600
1590
  }
1601
1591
  case FfiError_Tags.InvalidPeerId: {
1602
1592
  const inner = value.inner;
1603
- let size = ordinalConverter.allocationSize(5);
1593
+ let size = 4;
1604
1594
  size += FfiConverterString.allocationSize(inner.detail);
1605
1595
  return size;
1606
1596
  }
1607
1597
  case FfiError_Tags.InvalidAddress: {
1608
1598
  const inner = value.inner;
1609
- let size = ordinalConverter.allocationSize(6);
1599
+ let size = 4;
1610
1600
  size += FfiConverterString.allocationSize(inner.detail);
1611
1601
  return size;
1612
1602
  }
1613
1603
  case FfiError_Tags.InvalidTopic: {
1614
1604
  const inner = value.inner;
1615
- let size = ordinalConverter.allocationSize(7);
1605
+ let size = 4;
1616
1606
  size += FfiConverterString.allocationSize(inner.detail);
1617
1607
  return size;
1618
1608
  }
1619
1609
  case FfiError_Tags.NotPermitted: {
1620
1610
  const inner = value.inner;
1621
- let size = ordinalConverter.allocationSize(8);
1611
+ let size = 4;
1622
1612
  size += FfiConverterString.allocationSize(inner.detail);
1623
1613
  return size;
1624
1614
  }
1625
1615
  case FfiError_Tags.Backpressure: {
1626
- return ordinalConverter.allocationSize(9);
1616
+ return 4;
1627
1617
  }
1628
1618
  case FfiError_Tags.MessageTooLarge: {
1629
- return ordinalConverter.allocationSize(10);
1619
+ return 4;
1630
1620
  }
1631
1621
  case FfiError_Tags.Transport: {
1632
1622
  const inner = value.inner;
1633
- let size = ordinalConverter.allocationSize(11);
1623
+ let size = 4;
1634
1624
  size += FfiConverterString.allocationSize(inner.detail);
1635
1625
  return size;
1636
1626
  }
1637
1627
  case FfiError_Tags.InvalidState: {
1638
1628
  const inner = value.inner;
1639
- let size = ordinalConverter.allocationSize(12);
1629
+ let size = 4;
1640
1630
  size += FfiConverterString.allocationSize(inner.detail);
1641
1631
  return size;
1642
1632
  }
1643
1633
  case FfiError_Tags.Internal: {
1644
1634
  const inner = value.inner;
1645
- let size = ordinalConverter.allocationSize(13);
1635
+ let size = 4;
1646
1636
  size += FfiConverterString.allocationSize(inner.detail);
1647
1637
  return size;
1648
1638
  }
@@ -1680,11 +1670,10 @@ export enum NatErrorKind {
1680
1670
  }
1681
1671
 
1682
1672
  const FfiConverterTypeNatErrorKind = (() => {
1683
- const ordinalConverter = FfiConverterInt32;
1684
1673
  type TypeName = NatErrorKind;
1685
1674
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1686
- read(from: RustBuffer): TypeName {
1687
- switch (ordinalConverter.read(from)) {
1675
+ readFromCursor(c: Cursor): TypeName {
1676
+ switch (c.readI32()) {
1688
1677
  case 1: return NatErrorKind.NoPathAvailable;
1689
1678
  case 2: return NatErrorKind.Timeout;
1690
1679
  case 3: return NatErrorKind.DialFailed;
@@ -1693,17 +1682,17 @@ const FfiConverterTypeNatErrorKind = (() => {
1693
1682
  default: throw new UniffiInternalError.UnexpectedEnumCase();
1694
1683
  }
1695
1684
  }
1696
- write(value: TypeName, into: RustBuffer): void {
1685
+ writeIntoCursor(value: TypeName, c: Cursor): void {
1697
1686
  switch (value) {
1698
- case NatErrorKind.NoPathAvailable: return ordinalConverter.write(1, into);
1699
- case NatErrorKind.Timeout: return ordinalConverter.write(2, into);
1700
- case NatErrorKind.DialFailed: return ordinalConverter.write(3, into);
1701
- case NatErrorKind.Protocol: return ordinalConverter.write(4, into);
1702
- case NatErrorKind.RelayRefused: return ordinalConverter.write(5, into);
1687
+ case NatErrorKind.NoPathAvailable: return c.writeI32(1);
1688
+ case NatErrorKind.Timeout: return c.writeI32(2);
1689
+ case NatErrorKind.DialFailed: return c.writeI32(3);
1690
+ case NatErrorKind.Protocol: return c.writeI32(4);
1691
+ case NatErrorKind.RelayRefused: return c.writeI32(5);
1703
1692
  }
1704
1693
  }
1705
1694
  allocationSize(value: TypeName): number {
1706
- return ordinalConverter.allocationSize(0);
1695
+ return 4;
1707
1696
  }
1708
1697
  }
1709
1698
  return new FFIConverter();
@@ -1728,26 +1717,25 @@ export enum Reachability {
1728
1717
  }
1729
1718
 
1730
1719
  const FfiConverterTypeReachability = (() => {
1731
- const ordinalConverter = FfiConverterInt32;
1732
1720
  type TypeName = Reachability;
1733
1721
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1734
- read(from: RustBuffer): TypeName {
1735
- switch (ordinalConverter.read(from)) {
1722
+ readFromCursor(c: Cursor): TypeName {
1723
+ switch (c.readI32()) {
1736
1724
  case 1: return Reachability.Unknown;
1737
1725
  case 2: return Reachability.Public;
1738
1726
  case 3: return Reachability.Private;
1739
1727
  default: throw new UniffiInternalError.UnexpectedEnumCase();
1740
1728
  }
1741
1729
  }
1742
- write(value: TypeName, into: RustBuffer): void {
1730
+ writeIntoCursor(value: TypeName, c: Cursor): void {
1743
1731
  switch (value) {
1744
- case Reachability.Unknown: return ordinalConverter.write(1, into);
1745
- case Reachability.Public: return ordinalConverter.write(2, into);
1746
- case Reachability.Private: return ordinalConverter.write(3, into);
1732
+ case Reachability.Unknown: return c.writeI32(1);
1733
+ case Reachability.Public: return c.writeI32(2);
1734
+ case Reachability.Private: return c.writeI32(3);
1747
1735
  }
1748
1736
  }
1749
1737
  allocationSize(value: TypeName): number {
1750
- return ordinalConverter.allocationSize(0);
1738
+ return 4;
1751
1739
  }
1752
1740
  }
1753
1741
  return new FFIConverter();
@@ -1874,31 +1862,30 @@ export type PathKind = InstanceType<
1874
1862
 
1875
1863
  // FfiConverter for enum PathKind
1876
1864
  const FfiConverterTypePathKind = (() => {
1877
- const ordinalConverter = FfiConverterInt32;
1878
1865
  type TypeName = PathKind;
1879
1866
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1880
- read(from: RustBuffer): TypeName {
1881
- switch (ordinalConverter.read(from)) {
1867
+ readFromCursor(c: Cursor): TypeName {
1868
+ switch (c.readI32()) {
1882
1869
  case 1: return new PathKind.DirectDialed();
1883
1870
  case 2: return new PathKind.DirectPunched();
1884
- case 3: return new PathKind.Relayed({relayPeerId: FfiConverterString.read(from) });
1871
+ case 3: return new PathKind.Relayed({relayPeerId: FfiConverterString.readFromCursor(c) });
1885
1872
  default: throw new UniffiInternalError.UnexpectedEnumCase();
1886
1873
  }
1887
1874
  }
1888
- write(value: TypeName, into: RustBuffer): void {
1875
+ writeIntoCursor(value: TypeName, c: Cursor): void {
1889
1876
  switch (value.tag) {
1890
1877
  case PathKind_Tags.DirectDialed: {
1891
- ordinalConverter.write(1, into);
1878
+ c.writeI32(1);
1892
1879
  return;
1893
1880
  }
1894
1881
  case PathKind_Tags.DirectPunched: {
1895
- ordinalConverter.write(2, into);
1882
+ c.writeI32(2);
1896
1883
  return;
1897
1884
  }
1898
1885
  case PathKind_Tags.Relayed: {
1899
- ordinalConverter.write(3, into);
1886
+ c.writeI32(3);
1900
1887
  const inner = value.inner;
1901
- FfiConverterString.write(inner.relayPeerId, into);
1888
+ FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
1902
1889
  return;
1903
1890
  }
1904
1891
  default:
@@ -1909,14 +1896,14 @@ const FfiConverterTypePathKind = (() => {
1909
1896
  allocationSize(value: TypeName): number {
1910
1897
  switch (value.tag) {
1911
1898
  case PathKind_Tags.DirectDialed: {
1912
- return ordinalConverter.allocationSize(1);
1899
+ return 4;
1913
1900
  }
1914
1901
  case PathKind_Tags.DirectPunched: {
1915
- return ordinalConverter.allocationSize(2);
1902
+ return 4;
1916
1903
  }
1917
1904
  case PathKind_Tags.Relayed: {
1918
1905
  const inner = value.inner;
1919
- let size = ordinalConverter.allocationSize(3);
1906
+ let size = 4;
1920
1907
  size += FfiConverterString.allocationSize(inner.relayPeerId);
1921
1908
  return size;
1922
1909
  }
@@ -3182,305 +3169,304 @@ export type P2pEvent = InstanceType<
3182
3169
 
3183
3170
  // FfiConverter for enum P2pEvent
3184
3171
  const FfiConverterTypeP2pEvent = (() => {
3185
- const ordinalConverter = FfiConverterInt32;
3186
3172
  type TypeName = P2pEvent;
3187
3173
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
3188
- read(from: RustBuffer): TypeName {
3189
- switch (ordinalConverter.read(from)) {
3190
- case 1: return new P2pEvent.EventsDropped({dropped: FfiConverterUInt64.read(from), totalDropped: FfiConverterUInt64.read(from) });
3191
- case 2: return new P2pEvent.DriverFailed({kind: FfiConverterTypeDriverFailureKind.read(from), detail: FfiConverterString.read(from) });
3192
- case 3: return new P2pEvent.ConnectionEstablished({peerId: FfiConverterString.read(from), connId: FfiConverterUInt64.read(from) });
3193
- case 4: return new P2pEvent.ConnectionClosed({peerId: FfiConverterString.read(from), connId: FfiConverterUInt64.read(from) });
3194
- case 5: return new P2pEvent.PeerReady({peerId: FfiConverterString.read(from), protocols: FfiConverterSequenceString.read(from) });
3195
- case 6: return new P2pEvent.IdentifyReceived({peerId: FfiConverterString.read(from), info: FfiConverterTypeIdentifyInfo.read(from) });
3196
- case 7: return new P2pEvent.PingRttMeasured({peerId: FfiConverterString.read(from), rttMs: FfiConverterUInt64.read(from) });
3197
- case 8: return new P2pEvent.PingTimeout({peerId: FfiConverterString.read(from) });
3198
- case 9: return new P2pEvent.StreamReady({peerId: FfiConverterString.read(from), connId: FfiConverterUInt64.read(from), streamId: FfiConverterUInt64.read(from), protocolId: FfiConverterString.read(from), initiatedLocally: FfiConverterBool.read(from) });
3199
- case 10: return new P2pEvent.StreamData({peerId: FfiConverterString.read(from), connId: FfiConverterUInt64.read(from), streamId: FfiConverterUInt64.read(from), data: FfiConverterArrayBuffer.read(from) });
3200
- case 11: return new P2pEvent.StreamRemoteWriteClosed({peerId: FfiConverterString.read(from), connId: FfiConverterUInt64.read(from), streamId: FfiConverterUInt64.read(from) });
3201
- case 12: return new P2pEvent.StreamClosed({peerId: FfiConverterString.read(from), connId: FfiConverterUInt64.read(from), streamId: FfiConverterUInt64.read(from) });
3202
- case 13: return new P2pEvent.EndpointError({kind: FfiConverterTypeEndpointErrorKind.read(from), peerId: FfiConverterOptionalString.read(from), connId: FfiConverterOptionalUInt64.read(from), streamId: FfiConverterOptionalUInt64.read(from), detail: FfiConverterString.read(from) });
3203
- case 14: return new P2pEvent.ReachabilityChanged({previous: FfiConverterTypeReachability.read(from), current: FfiConverterTypeReachability.read(from), confirmedAddrs: FfiConverterSequenceString.read(from) });
3204
- case 15: return new P2pEvent.PublicAddressesChanged({addrs: FfiConverterSequenceString.read(from) });
3205
- case 16: return new P2pEvent.RelayReserved({relayPeerId: FfiConverterString.read(from), expiresUnixSecs: FfiConverterOptionalUInt64.read(from) });
3206
- case 17: return new P2pEvent.RelayReservationLost({relayPeerId: FfiConverterString.read(from) });
3207
- case 18: return new P2pEvent.PathEstablished({connectId: FfiConverterUInt64.read(from), peerId: FfiConverterString.read(from), path: FfiConverterTypePathKind.read(from) });
3208
- case 19: return new P2pEvent.InboundPathEstablished({peerId: FfiConverterString.read(from), path: FfiConverterTypePathKind.read(from) });
3209
- case 20: return new P2pEvent.PathUpgraded({connectId: FfiConverterUInt64.read(from), peerId: FfiConverterString.read(from), from: FfiConverterTypePathKind.read(from), to: FfiConverterTypePathKind.read(from) });
3210
- case 21: return new P2pEvent.HolePunchFailed({connectId: FfiConverterUInt64.read(from), attempt: FfiConverterUInt32.read(from), reason: FfiConverterString.read(from) });
3211
- case 22: return new P2pEvent.FellBackToRelay({connectId: FfiConverterUInt64.read(from), peerId: FfiConverterString.read(from) });
3212
- case 23: return new P2pEvent.ConnectFailed({connectId: FfiConverterUInt64.read(from), peerId: FfiConverterString.read(from), kind: FfiConverterTypeNatErrorKind.read(from), detail: FfiConverterString.read(from) });
3213
- case 24: return new P2pEvent.InboundDirectUpgrade({peerId: FfiConverterString.read(from) });
3214
- case 25: return new P2pEvent.Message({fromPeerId: FfiConverterString.read(from), topics: FfiConverterSequenceString.read(from), data: FfiConverterArrayBuffer.read(from), seqno: FfiConverterArrayBuffer.read(from), signed: FfiConverterBool.read(from) });
3215
- case 26: return new P2pEvent.PeerSubscribed({peerId: FfiConverterString.read(from), topic: FfiConverterString.read(from) });
3216
- case 27: return new P2pEvent.PeerUnsubscribed({peerId: FfiConverterString.read(from), topic: FfiConverterString.read(from) });
3217
- case 28: return new P2pEvent.PubsubOutboundFailure({peerId: FfiConverterString.read(from), reason: FfiConverterString.read(from) });
3218
- case 29: return new P2pEvent.PubsubProtocolViolation({peerId: FfiConverterString.read(from), reason: FfiConverterString.read(from) });
3219
- case 30: return new P2pEvent.PeerDiscovered({peerId: FfiConverterString.read(from), addrs: FfiConverterSequenceString.read(from), source: FfiConverterTypeDiscoverySource.read(from) });
3220
- case 31: return new P2pEvent.PeerUpdated({peerId: FfiConverterString.read(from), addrs: FfiConverterSequenceString.read(from), source: FfiConverterTypeDiscoverySource.read(from) });
3221
- case 32: return new P2pEvent.PeerExpired({peerId: FfiConverterString.read(from) });
3222
- case 33: return new P2pEvent.DiscoveryDialFailed({peerId: FfiConverterString.read(from), reason: FfiConverterString.read(from) });
3223
- case 34: return new P2pEvent.DiscoveryProtocolViolation({peerId: FfiConverterOptionalString.read(from), source: FfiConverterTypeDiscoverySource.read(from), reason: FfiConverterString.read(from), suppressed: FfiConverterUInt32.read(from) });
3174
+ readFromCursor(c: Cursor): TypeName {
3175
+ switch (c.readI32()) {
3176
+ case 1: return new P2pEvent.EventsDropped({dropped: FfiConverterUInt64.readFromCursor(c), totalDropped: FfiConverterUInt64.readFromCursor(c) });
3177
+ case 2: return new P2pEvent.DriverFailed({kind: FfiConverterTypeDriverFailureKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3178
+ case 3: return new P2pEvent.ConnectionEstablished({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3179
+ case 4: return new P2pEvent.ConnectionClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3180
+ case 5: return new P2pEvent.PeerReady({peerId: FfiConverterString.readFromCursor(c), protocols: FfiConverterSequenceString.readFromCursor(c) });
3181
+ case 6: return new P2pEvent.IdentifyReceived({peerId: FfiConverterString.readFromCursor(c), info: FfiConverterTypeIdentifyInfo.readFromCursor(c) });
3182
+ case 7: return new P2pEvent.PingRttMeasured({peerId: FfiConverterString.readFromCursor(c), rttMs: FfiConverterUInt64.readFromCursor(c) });
3183
+ case 8: return new P2pEvent.PingTimeout({peerId: FfiConverterString.readFromCursor(c) });
3184
+ case 9: return new P2pEvent.StreamReady({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c), protocolId: FfiConverterString.readFromCursor(c), initiatedLocally: FfiConverterBool.readFromCursor(c) });
3185
+ case 10: return new P2pEvent.StreamData({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c), data: FfiConverterArrayBuffer.readFromCursor(c) });
3186
+ case 11: return new P2pEvent.StreamRemoteWriteClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c) });
3187
+ case 12: return new P2pEvent.StreamClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c) });
3188
+ case 13: return new P2pEvent.EndpointError({kind: FfiConverterTypeEndpointErrorKind.readFromCursor(c), peerId: FfiConverterOptionalString.readFromCursor(c), connId: FfiConverterOptionalUInt64.readFromCursor(c), streamId: FfiConverterOptionalUInt64.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3189
+ case 14: return new P2pEvent.ReachabilityChanged({previous: FfiConverterTypeReachability.readFromCursor(c), current: FfiConverterTypeReachability.readFromCursor(c), confirmedAddrs: FfiConverterSequenceString.readFromCursor(c) });
3190
+ case 15: return new P2pEvent.PublicAddressesChanged({addrs: FfiConverterSequenceString.readFromCursor(c) });
3191
+ case 16: return new P2pEvent.RelayReserved({relayPeerId: FfiConverterString.readFromCursor(c), expiresUnixSecs: FfiConverterOptionalUInt64.readFromCursor(c) });
3192
+ case 17: return new P2pEvent.RelayReservationLost({relayPeerId: FfiConverterString.readFromCursor(c) });
3193
+ case 18: return new P2pEvent.PathEstablished({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
3194
+ case 19: return new P2pEvent.InboundPathEstablished({peerId: FfiConverterString.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
3195
+ case 20: return new P2pEvent.PathUpgraded({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), from: FfiConverterTypePathKind.readFromCursor(c), to: FfiConverterTypePathKind.readFromCursor(c) });
3196
+ case 21: return new P2pEvent.HolePunchFailed({connectId: FfiConverterUInt64.readFromCursor(c), attempt: FfiConverterUInt32.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3197
+ case 22: return new P2pEvent.FellBackToRelay({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c) });
3198
+ case 23: return new P2pEvent.ConnectFailed({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), kind: FfiConverterTypeNatErrorKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3199
+ case 24: return new P2pEvent.InboundDirectUpgrade({peerId: FfiConverterString.readFromCursor(c) });
3200
+ case 25: return new P2pEvent.Message({fromPeerId: FfiConverterString.readFromCursor(c), topics: FfiConverterSequenceString.readFromCursor(c), data: FfiConverterArrayBuffer.readFromCursor(c), seqno: FfiConverterArrayBuffer.readFromCursor(c), signed: FfiConverterBool.readFromCursor(c) });
3201
+ case 26: return new P2pEvent.PeerSubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
3202
+ case 27: return new P2pEvent.PeerUnsubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
3203
+ case 28: return new P2pEvent.PubsubOutboundFailure({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3204
+ case 29: return new P2pEvent.PubsubProtocolViolation({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3205
+ case 30: return new P2pEvent.PeerDiscovered({peerId: FfiConverterString.readFromCursor(c), addrs: FfiConverterSequenceString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c) });
3206
+ case 31: return new P2pEvent.PeerUpdated({peerId: FfiConverterString.readFromCursor(c), addrs: FfiConverterSequenceString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c) });
3207
+ case 32: return new P2pEvent.PeerExpired({peerId: FfiConverterString.readFromCursor(c) });
3208
+ case 33: return new P2pEvent.DiscoveryDialFailed({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3209
+ case 34: return new P2pEvent.DiscoveryProtocolViolation({peerId: FfiConverterOptionalString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c), reason: FfiConverterString.readFromCursor(c), suppressed: FfiConverterUInt32.readFromCursor(c) });
3224
3210
  default: throw new UniffiInternalError.UnexpectedEnumCase();
3225
3211
  }
3226
3212
  }
3227
- write(value: TypeName, into: RustBuffer): void {
3213
+ writeIntoCursor(value: TypeName, c: Cursor): void {
3228
3214
  switch (value.tag) {
3229
3215
  case P2pEvent_Tags.EventsDropped: {
3230
- ordinalConverter.write(1, into);
3216
+ c.writeI32(1);
3231
3217
  const inner = value.inner;
3232
- FfiConverterUInt64.write(inner.dropped, into);
3233
- FfiConverterUInt64.write(inner.totalDropped, into);
3218
+ FfiConverterUInt64.writeIntoCursor(inner.dropped, c);
3219
+ FfiConverterUInt64.writeIntoCursor(inner.totalDropped, c);
3234
3220
  return;
3235
3221
  }
3236
3222
  case P2pEvent_Tags.DriverFailed: {
3237
- ordinalConverter.write(2, into);
3223
+ c.writeI32(2);
3238
3224
  const inner = value.inner;
3239
- FfiConverterTypeDriverFailureKind.write(inner.kind, into);
3240
- FfiConverterString.write(inner.detail, into);
3225
+ FfiConverterTypeDriverFailureKind.writeIntoCursor(inner.kind, c);
3226
+ FfiConverterString.writeIntoCursor(inner.detail, c);
3241
3227
  return;
3242
3228
  }
3243
3229
  case P2pEvent_Tags.ConnectionEstablished: {
3244
- ordinalConverter.write(3, into);
3230
+ c.writeI32(3);
3245
3231
  const inner = value.inner;
3246
- FfiConverterString.write(inner.peerId, into);
3247
- FfiConverterUInt64.write(inner.connId, into);
3232
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3233
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3248
3234
  return;
3249
3235
  }
3250
3236
  case P2pEvent_Tags.ConnectionClosed: {
3251
- ordinalConverter.write(4, into);
3237
+ c.writeI32(4);
3252
3238
  const inner = value.inner;
3253
- FfiConverterString.write(inner.peerId, into);
3254
- FfiConverterUInt64.write(inner.connId, into);
3239
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3240
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3255
3241
  return;
3256
3242
  }
3257
3243
  case P2pEvent_Tags.PeerReady: {
3258
- ordinalConverter.write(5, into);
3244
+ c.writeI32(5);
3259
3245
  const inner = value.inner;
3260
- FfiConverterString.write(inner.peerId, into);
3261
- FfiConverterSequenceString.write(inner.protocols, into);
3246
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3247
+ FfiConverterSequenceString.writeIntoCursor(inner.protocols, c);
3262
3248
  return;
3263
3249
  }
3264
3250
  case P2pEvent_Tags.IdentifyReceived: {
3265
- ordinalConverter.write(6, into);
3251
+ c.writeI32(6);
3266
3252
  const inner = value.inner;
3267
- FfiConverterString.write(inner.peerId, into);
3268
- FfiConverterTypeIdentifyInfo.write(inner.info, into);
3253
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3254
+ FfiConverterTypeIdentifyInfo.writeIntoCursor(inner.info, c);
3269
3255
  return;
3270
3256
  }
3271
3257
  case P2pEvent_Tags.PingRttMeasured: {
3272
- ordinalConverter.write(7, into);
3258
+ c.writeI32(7);
3273
3259
  const inner = value.inner;
3274
- FfiConverterString.write(inner.peerId, into);
3275
- FfiConverterUInt64.write(inner.rttMs, into);
3260
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3261
+ FfiConverterUInt64.writeIntoCursor(inner.rttMs, c);
3276
3262
  return;
3277
3263
  }
3278
3264
  case P2pEvent_Tags.PingTimeout: {
3279
- ordinalConverter.write(8, into);
3265
+ c.writeI32(8);
3280
3266
  const inner = value.inner;
3281
- FfiConverterString.write(inner.peerId, into);
3267
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3282
3268
  return;
3283
3269
  }
3284
3270
  case P2pEvent_Tags.StreamReady: {
3285
- ordinalConverter.write(9, into);
3271
+ c.writeI32(9);
3286
3272
  const inner = value.inner;
3287
- FfiConverterString.write(inner.peerId, into);
3288
- FfiConverterUInt64.write(inner.connId, into);
3289
- FfiConverterUInt64.write(inner.streamId, into);
3290
- FfiConverterString.write(inner.protocolId, into);
3291
- FfiConverterBool.write(inner.initiatedLocally, into);
3273
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3274
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3275
+ FfiConverterUInt64.writeIntoCursor(inner.streamId, c);
3276
+ FfiConverterString.writeIntoCursor(inner.protocolId, c);
3277
+ FfiConverterBool.writeIntoCursor(inner.initiatedLocally, c);
3292
3278
  return;
3293
3279
  }
3294
3280
  case P2pEvent_Tags.StreamData: {
3295
- ordinalConverter.write(10, into);
3281
+ c.writeI32(10);
3296
3282
  const inner = value.inner;
3297
- FfiConverterString.write(inner.peerId, into);
3298
- FfiConverterUInt64.write(inner.connId, into);
3299
- FfiConverterUInt64.write(inner.streamId, into);
3300
- FfiConverterArrayBuffer.write(inner.data, into);
3283
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3284
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3285
+ FfiConverterUInt64.writeIntoCursor(inner.streamId, c);
3286
+ FfiConverterArrayBuffer.writeIntoCursor(inner.data, c);
3301
3287
  return;
3302
3288
  }
3303
3289
  case P2pEvent_Tags.StreamRemoteWriteClosed: {
3304
- ordinalConverter.write(11, into);
3290
+ c.writeI32(11);
3305
3291
  const inner = value.inner;
3306
- FfiConverterString.write(inner.peerId, into);
3307
- FfiConverterUInt64.write(inner.connId, into);
3308
- FfiConverterUInt64.write(inner.streamId, into);
3292
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3293
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3294
+ FfiConverterUInt64.writeIntoCursor(inner.streamId, c);
3309
3295
  return;
3310
3296
  }
3311
3297
  case P2pEvent_Tags.StreamClosed: {
3312
- ordinalConverter.write(12, into);
3298
+ c.writeI32(12);
3313
3299
  const inner = value.inner;
3314
- FfiConverterString.write(inner.peerId, into);
3315
- FfiConverterUInt64.write(inner.connId, into);
3316
- FfiConverterUInt64.write(inner.streamId, into);
3300
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3301
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3302
+ FfiConverterUInt64.writeIntoCursor(inner.streamId, c);
3317
3303
  return;
3318
3304
  }
3319
3305
  case P2pEvent_Tags.EndpointError: {
3320
- ordinalConverter.write(13, into);
3306
+ c.writeI32(13);
3321
3307
  const inner = value.inner;
3322
- FfiConverterTypeEndpointErrorKind.write(inner.kind, into);
3323
- FfiConverterOptionalString.write(inner.peerId, into);
3324
- FfiConverterOptionalUInt64.write(inner.connId, into);
3325
- FfiConverterOptionalUInt64.write(inner.streamId, into);
3326
- FfiConverterString.write(inner.detail, into);
3308
+ FfiConverterTypeEndpointErrorKind.writeIntoCursor(inner.kind, c);
3309
+ FfiConverterOptionalString.writeIntoCursor(inner.peerId, c);
3310
+ FfiConverterOptionalUInt64.writeIntoCursor(inner.connId, c);
3311
+ FfiConverterOptionalUInt64.writeIntoCursor(inner.streamId, c);
3312
+ FfiConverterString.writeIntoCursor(inner.detail, c);
3327
3313
  return;
3328
3314
  }
3329
3315
  case P2pEvent_Tags.ReachabilityChanged: {
3330
- ordinalConverter.write(14, into);
3316
+ c.writeI32(14);
3331
3317
  const inner = value.inner;
3332
- FfiConverterTypeReachability.write(inner.previous, into);
3333
- FfiConverterTypeReachability.write(inner.current, into);
3334
- FfiConverterSequenceString.write(inner.confirmedAddrs, into);
3318
+ FfiConverterTypeReachability.writeIntoCursor(inner.previous, c);
3319
+ FfiConverterTypeReachability.writeIntoCursor(inner.current, c);
3320
+ FfiConverterSequenceString.writeIntoCursor(inner.confirmedAddrs, c);
3335
3321
  return;
3336
3322
  }
3337
3323
  case P2pEvent_Tags.PublicAddressesChanged: {
3338
- ordinalConverter.write(15, into);
3324
+ c.writeI32(15);
3339
3325
  const inner = value.inner;
3340
- FfiConverterSequenceString.write(inner.addrs, into);
3326
+ FfiConverterSequenceString.writeIntoCursor(inner.addrs, c);
3341
3327
  return;
3342
3328
  }
3343
3329
  case P2pEvent_Tags.RelayReserved: {
3344
- ordinalConverter.write(16, into);
3330
+ c.writeI32(16);
3345
3331
  const inner = value.inner;
3346
- FfiConverterString.write(inner.relayPeerId, into);
3347
- FfiConverterOptionalUInt64.write(inner.expiresUnixSecs, into);
3332
+ FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
3333
+ FfiConverterOptionalUInt64.writeIntoCursor(inner.expiresUnixSecs, c);
3348
3334
  return;
3349
3335
  }
3350
3336
  case P2pEvent_Tags.RelayReservationLost: {
3351
- ordinalConverter.write(17, into);
3337
+ c.writeI32(17);
3352
3338
  const inner = value.inner;
3353
- FfiConverterString.write(inner.relayPeerId, into);
3339
+ FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
3354
3340
  return;
3355
3341
  }
3356
3342
  case P2pEvent_Tags.PathEstablished: {
3357
- ordinalConverter.write(18, into);
3343
+ c.writeI32(18);
3358
3344
  const inner = value.inner;
3359
- FfiConverterUInt64.write(inner.connectId, into);
3360
- FfiConverterString.write(inner.peerId, into);
3361
- FfiConverterTypePathKind.write(inner.path, into);
3345
+ FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3346
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3347
+ FfiConverterTypePathKind.writeIntoCursor(inner.path, c);
3362
3348
  return;
3363
3349
  }
3364
3350
  case P2pEvent_Tags.InboundPathEstablished: {
3365
- ordinalConverter.write(19, into);
3351
+ c.writeI32(19);
3366
3352
  const inner = value.inner;
3367
- FfiConverterString.write(inner.peerId, into);
3368
- FfiConverterTypePathKind.write(inner.path, into);
3353
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3354
+ FfiConverterTypePathKind.writeIntoCursor(inner.path, c);
3369
3355
  return;
3370
3356
  }
3371
3357
  case P2pEvent_Tags.PathUpgraded: {
3372
- ordinalConverter.write(20, into);
3358
+ c.writeI32(20);
3373
3359
  const inner = value.inner;
3374
- FfiConverterUInt64.write(inner.connectId, into);
3375
- FfiConverterString.write(inner.peerId, into);
3376
- FfiConverterTypePathKind.write(inner.from, into);
3377
- FfiConverterTypePathKind.write(inner.to, into);
3360
+ FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3361
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3362
+ FfiConverterTypePathKind.writeIntoCursor(inner.from, c);
3363
+ FfiConverterTypePathKind.writeIntoCursor(inner.to, c);
3378
3364
  return;
3379
3365
  }
3380
3366
  case P2pEvent_Tags.HolePunchFailed: {
3381
- ordinalConverter.write(21, into);
3367
+ c.writeI32(21);
3382
3368
  const inner = value.inner;
3383
- FfiConverterUInt64.write(inner.connectId, into);
3384
- FfiConverterUInt32.write(inner.attempt, into);
3385
- FfiConverterString.write(inner.reason, into);
3369
+ FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3370
+ FfiConverterUInt32.writeIntoCursor(inner.attempt, c);
3371
+ FfiConverterString.writeIntoCursor(inner.reason, c);
3386
3372
  return;
3387
3373
  }
3388
3374
  case P2pEvent_Tags.FellBackToRelay: {
3389
- ordinalConverter.write(22, into);
3375
+ c.writeI32(22);
3390
3376
  const inner = value.inner;
3391
- FfiConverterUInt64.write(inner.connectId, into);
3392
- FfiConverterString.write(inner.peerId, into);
3377
+ FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3378
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3393
3379
  return;
3394
3380
  }
3395
3381
  case P2pEvent_Tags.ConnectFailed: {
3396
- ordinalConverter.write(23, into);
3382
+ c.writeI32(23);
3397
3383
  const inner = value.inner;
3398
- FfiConverterUInt64.write(inner.connectId, into);
3399
- FfiConverterString.write(inner.peerId, into);
3400
- FfiConverterTypeNatErrorKind.write(inner.kind, into);
3401
- FfiConverterString.write(inner.detail, into);
3384
+ FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3385
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3386
+ FfiConverterTypeNatErrorKind.writeIntoCursor(inner.kind, c);
3387
+ FfiConverterString.writeIntoCursor(inner.detail, c);
3402
3388
  return;
3403
3389
  }
3404
3390
  case P2pEvent_Tags.InboundDirectUpgrade: {
3405
- ordinalConverter.write(24, into);
3391
+ c.writeI32(24);
3406
3392
  const inner = value.inner;
3407
- FfiConverterString.write(inner.peerId, into);
3393
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3408
3394
  return;
3409
3395
  }
3410
3396
  case P2pEvent_Tags.Message: {
3411
- ordinalConverter.write(25, into);
3397
+ c.writeI32(25);
3412
3398
  const inner = value.inner;
3413
- FfiConverterString.write(inner.fromPeerId, into);
3414
- FfiConverterSequenceString.write(inner.topics, into);
3415
- FfiConverterArrayBuffer.write(inner.data, into);
3416
- FfiConverterArrayBuffer.write(inner.seqno, into);
3417
- FfiConverterBool.write(inner.signed, into);
3399
+ FfiConverterString.writeIntoCursor(inner.fromPeerId, c);
3400
+ FfiConverterSequenceString.writeIntoCursor(inner.topics, c);
3401
+ FfiConverterArrayBuffer.writeIntoCursor(inner.data, c);
3402
+ FfiConverterArrayBuffer.writeIntoCursor(inner.seqno, c);
3403
+ FfiConverterBool.writeIntoCursor(inner.signed, c);
3418
3404
  return;
3419
3405
  }
3420
3406
  case P2pEvent_Tags.PeerSubscribed: {
3421
- ordinalConverter.write(26, into);
3407
+ c.writeI32(26);
3422
3408
  const inner = value.inner;
3423
- FfiConverterString.write(inner.peerId, into);
3424
- FfiConverterString.write(inner.topic, into);
3409
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3410
+ FfiConverterString.writeIntoCursor(inner.topic, c);
3425
3411
  return;
3426
3412
  }
3427
3413
  case P2pEvent_Tags.PeerUnsubscribed: {
3428
- ordinalConverter.write(27, into);
3414
+ c.writeI32(27);
3429
3415
  const inner = value.inner;
3430
- FfiConverterString.write(inner.peerId, into);
3431
- FfiConverterString.write(inner.topic, into);
3416
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3417
+ FfiConverterString.writeIntoCursor(inner.topic, c);
3432
3418
  return;
3433
3419
  }
3434
3420
  case P2pEvent_Tags.PubsubOutboundFailure: {
3435
- ordinalConverter.write(28, into);
3421
+ c.writeI32(28);
3436
3422
  const inner = value.inner;
3437
- FfiConverterString.write(inner.peerId, into);
3438
- FfiConverterString.write(inner.reason, into);
3423
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3424
+ FfiConverterString.writeIntoCursor(inner.reason, c);
3439
3425
  return;
3440
3426
  }
3441
3427
  case P2pEvent_Tags.PubsubProtocolViolation: {
3442
- ordinalConverter.write(29, into);
3428
+ c.writeI32(29);
3443
3429
  const inner = value.inner;
3444
- FfiConverterString.write(inner.peerId, into);
3445
- FfiConverterString.write(inner.reason, into);
3430
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3431
+ FfiConverterString.writeIntoCursor(inner.reason, c);
3446
3432
  return;
3447
3433
  }
3448
3434
  case P2pEvent_Tags.PeerDiscovered: {
3449
- ordinalConverter.write(30, into);
3435
+ c.writeI32(30);
3450
3436
  const inner = value.inner;
3451
- FfiConverterString.write(inner.peerId, into);
3452
- FfiConverterSequenceString.write(inner.addrs, into);
3453
- FfiConverterTypeDiscoverySource.write(inner.source, into);
3437
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3438
+ FfiConverterSequenceString.writeIntoCursor(inner.addrs, c);
3439
+ FfiConverterTypeDiscoverySource.writeIntoCursor(inner.source, c);
3454
3440
  return;
3455
3441
  }
3456
3442
  case P2pEvent_Tags.PeerUpdated: {
3457
- ordinalConverter.write(31, into);
3443
+ c.writeI32(31);
3458
3444
  const inner = value.inner;
3459
- FfiConverterString.write(inner.peerId, into);
3460
- FfiConverterSequenceString.write(inner.addrs, into);
3461
- FfiConverterTypeDiscoverySource.write(inner.source, into);
3445
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3446
+ FfiConverterSequenceString.writeIntoCursor(inner.addrs, c);
3447
+ FfiConverterTypeDiscoverySource.writeIntoCursor(inner.source, c);
3462
3448
  return;
3463
3449
  }
3464
3450
  case P2pEvent_Tags.PeerExpired: {
3465
- ordinalConverter.write(32, into);
3451
+ c.writeI32(32);
3466
3452
  const inner = value.inner;
3467
- FfiConverterString.write(inner.peerId, into);
3453
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3468
3454
  return;
3469
3455
  }
3470
3456
  case P2pEvent_Tags.DiscoveryDialFailed: {
3471
- ordinalConverter.write(33, into);
3457
+ c.writeI32(33);
3472
3458
  const inner = value.inner;
3473
- FfiConverterString.write(inner.peerId, into);
3474
- FfiConverterString.write(inner.reason, into);
3459
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
3460
+ FfiConverterString.writeIntoCursor(inner.reason, c);
3475
3461
  return;
3476
3462
  }
3477
3463
  case P2pEvent_Tags.DiscoveryProtocolViolation: {
3478
- ordinalConverter.write(34, into);
3464
+ c.writeI32(34);
3479
3465
  const inner = value.inner;
3480
- FfiConverterOptionalString.write(inner.peerId, into);
3481
- FfiConverterTypeDiscoverySource.write(inner.source, into);
3482
- FfiConverterString.write(inner.reason, into);
3483
- FfiConverterUInt32.write(inner.suppressed, into);
3466
+ FfiConverterOptionalString.writeIntoCursor(inner.peerId, c);
3467
+ FfiConverterTypeDiscoverySource.writeIntoCursor(inner.source, c);
3468
+ FfiConverterString.writeIntoCursor(inner.reason, c);
3469
+ FfiConverterUInt32.writeIntoCursor(inner.suppressed, c);
3484
3470
  return;
3485
3471
  }
3486
3472
  default:
@@ -3492,62 +3478,62 @@ const FfiConverterTypeP2pEvent = (() => {
3492
3478
  switch (value.tag) {
3493
3479
  case P2pEvent_Tags.EventsDropped: {
3494
3480
  const inner = value.inner;
3495
- let size = ordinalConverter.allocationSize(1);
3481
+ let size = 4;
3496
3482
  size += FfiConverterUInt64.allocationSize(inner.dropped);
3497
3483
  size += FfiConverterUInt64.allocationSize(inner.totalDropped);
3498
3484
  return size;
3499
3485
  }
3500
3486
  case P2pEvent_Tags.DriverFailed: {
3501
3487
  const inner = value.inner;
3502
- let size = ordinalConverter.allocationSize(2);
3488
+ let size = 4;
3503
3489
  size += FfiConverterTypeDriverFailureKind.allocationSize(inner.kind);
3504
3490
  size += FfiConverterString.allocationSize(inner.detail);
3505
3491
  return size;
3506
3492
  }
3507
3493
  case P2pEvent_Tags.ConnectionEstablished: {
3508
3494
  const inner = value.inner;
3509
- let size = ordinalConverter.allocationSize(3);
3495
+ let size = 4;
3510
3496
  size += FfiConverterString.allocationSize(inner.peerId);
3511
3497
  size += FfiConverterUInt64.allocationSize(inner.connId);
3512
3498
  return size;
3513
3499
  }
3514
3500
  case P2pEvent_Tags.ConnectionClosed: {
3515
3501
  const inner = value.inner;
3516
- let size = ordinalConverter.allocationSize(4);
3502
+ let size = 4;
3517
3503
  size += FfiConverterString.allocationSize(inner.peerId);
3518
3504
  size += FfiConverterUInt64.allocationSize(inner.connId);
3519
3505
  return size;
3520
3506
  }
3521
3507
  case P2pEvent_Tags.PeerReady: {
3522
3508
  const inner = value.inner;
3523
- let size = ordinalConverter.allocationSize(5);
3509
+ let size = 4;
3524
3510
  size += FfiConverterString.allocationSize(inner.peerId);
3525
3511
  size += FfiConverterSequenceString.allocationSize(inner.protocols);
3526
3512
  return size;
3527
3513
  }
3528
3514
  case P2pEvent_Tags.IdentifyReceived: {
3529
3515
  const inner = value.inner;
3530
- let size = ordinalConverter.allocationSize(6);
3516
+ let size = 4;
3531
3517
  size += FfiConverterString.allocationSize(inner.peerId);
3532
3518
  size += FfiConverterTypeIdentifyInfo.allocationSize(inner.info);
3533
3519
  return size;
3534
3520
  }
3535
3521
  case P2pEvent_Tags.PingRttMeasured: {
3536
3522
  const inner = value.inner;
3537
- let size = ordinalConverter.allocationSize(7);
3523
+ let size = 4;
3538
3524
  size += FfiConverterString.allocationSize(inner.peerId);
3539
3525
  size += FfiConverterUInt64.allocationSize(inner.rttMs);
3540
3526
  return size;
3541
3527
  }
3542
3528
  case P2pEvent_Tags.PingTimeout: {
3543
3529
  const inner = value.inner;
3544
- let size = ordinalConverter.allocationSize(8);
3530
+ let size = 4;
3545
3531
  size += FfiConverterString.allocationSize(inner.peerId);
3546
3532
  return size;
3547
3533
  }
3548
3534
  case P2pEvent_Tags.StreamReady: {
3549
3535
  const inner = value.inner;
3550
- let size = ordinalConverter.allocationSize(9);
3536
+ let size = 4;
3551
3537
  size += FfiConverterString.allocationSize(inner.peerId);
3552
3538
  size += FfiConverterUInt64.allocationSize(inner.connId);
3553
3539
  size += FfiConverterUInt64.allocationSize(inner.streamId);
@@ -3557,7 +3543,7 @@ const FfiConverterTypeP2pEvent = (() => {
3557
3543
  }
3558
3544
  case P2pEvent_Tags.StreamData: {
3559
3545
  const inner = value.inner;
3560
- let size = ordinalConverter.allocationSize(10);
3546
+ let size = 4;
3561
3547
  size += FfiConverterString.allocationSize(inner.peerId);
3562
3548
  size += FfiConverterUInt64.allocationSize(inner.connId);
3563
3549
  size += FfiConverterUInt64.allocationSize(inner.streamId);
@@ -3566,7 +3552,7 @@ const FfiConverterTypeP2pEvent = (() => {
3566
3552
  }
3567
3553
  case P2pEvent_Tags.StreamRemoteWriteClosed: {
3568
3554
  const inner = value.inner;
3569
- let size = ordinalConverter.allocationSize(11);
3555
+ let size = 4;
3570
3556
  size += FfiConverterString.allocationSize(inner.peerId);
3571
3557
  size += FfiConverterUInt64.allocationSize(inner.connId);
3572
3558
  size += FfiConverterUInt64.allocationSize(inner.streamId);
@@ -3574,7 +3560,7 @@ const FfiConverterTypeP2pEvent = (() => {
3574
3560
  }
3575
3561
  case P2pEvent_Tags.StreamClosed: {
3576
3562
  const inner = value.inner;
3577
- let size = ordinalConverter.allocationSize(12);
3563
+ let size = 4;
3578
3564
  size += FfiConverterString.allocationSize(inner.peerId);
3579
3565
  size += FfiConverterUInt64.allocationSize(inner.connId);
3580
3566
  size += FfiConverterUInt64.allocationSize(inner.streamId);
@@ -3582,7 +3568,7 @@ const FfiConverterTypeP2pEvent = (() => {
3582
3568
  }
3583
3569
  case P2pEvent_Tags.EndpointError: {
3584
3570
  const inner = value.inner;
3585
- let size = ordinalConverter.allocationSize(13);
3571
+ let size = 4;
3586
3572
  size += FfiConverterTypeEndpointErrorKind.allocationSize(inner.kind);
3587
3573
  size += FfiConverterOptionalString.allocationSize(inner.peerId);
3588
3574
  size += FfiConverterOptionalUInt64.allocationSize(inner.connId);
@@ -3592,7 +3578,7 @@ const FfiConverterTypeP2pEvent = (() => {
3592
3578
  }
3593
3579
  case P2pEvent_Tags.ReachabilityChanged: {
3594
3580
  const inner = value.inner;
3595
- let size = ordinalConverter.allocationSize(14);
3581
+ let size = 4;
3596
3582
  size += FfiConverterTypeReachability.allocationSize(inner.previous);
3597
3583
  size += FfiConverterTypeReachability.allocationSize(inner.current);
3598
3584
  size += FfiConverterSequenceString.allocationSize(inner.confirmedAddrs);
@@ -3600,26 +3586,26 @@ const FfiConverterTypeP2pEvent = (() => {
3600
3586
  }
3601
3587
  case P2pEvent_Tags.PublicAddressesChanged: {
3602
3588
  const inner = value.inner;
3603
- let size = ordinalConverter.allocationSize(15);
3589
+ let size = 4;
3604
3590
  size += FfiConverterSequenceString.allocationSize(inner.addrs);
3605
3591
  return size;
3606
3592
  }
3607
3593
  case P2pEvent_Tags.RelayReserved: {
3608
3594
  const inner = value.inner;
3609
- let size = ordinalConverter.allocationSize(16);
3595
+ let size = 4;
3610
3596
  size += FfiConverterString.allocationSize(inner.relayPeerId);
3611
3597
  size += FfiConverterOptionalUInt64.allocationSize(inner.expiresUnixSecs);
3612
3598
  return size;
3613
3599
  }
3614
3600
  case P2pEvent_Tags.RelayReservationLost: {
3615
3601
  const inner = value.inner;
3616
- let size = ordinalConverter.allocationSize(17);
3602
+ let size = 4;
3617
3603
  size += FfiConverterString.allocationSize(inner.relayPeerId);
3618
3604
  return size;
3619
3605
  }
3620
3606
  case P2pEvent_Tags.PathEstablished: {
3621
3607
  const inner = value.inner;
3622
- let size = ordinalConverter.allocationSize(18);
3608
+ let size = 4;
3623
3609
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3624
3610
  size += FfiConverterString.allocationSize(inner.peerId);
3625
3611
  size += FfiConverterTypePathKind.allocationSize(inner.path);
@@ -3627,14 +3613,14 @@ const FfiConverterTypeP2pEvent = (() => {
3627
3613
  }
3628
3614
  case P2pEvent_Tags.InboundPathEstablished: {
3629
3615
  const inner = value.inner;
3630
- let size = ordinalConverter.allocationSize(19);
3616
+ let size = 4;
3631
3617
  size += FfiConverterString.allocationSize(inner.peerId);
3632
3618
  size += FfiConverterTypePathKind.allocationSize(inner.path);
3633
3619
  return size;
3634
3620
  }
3635
3621
  case P2pEvent_Tags.PathUpgraded: {
3636
3622
  const inner = value.inner;
3637
- let size = ordinalConverter.allocationSize(20);
3623
+ let size = 4;
3638
3624
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3639
3625
  size += FfiConverterString.allocationSize(inner.peerId);
3640
3626
  size += FfiConverterTypePathKind.allocationSize(inner.from);
@@ -3643,7 +3629,7 @@ const FfiConverterTypeP2pEvent = (() => {
3643
3629
  }
3644
3630
  case P2pEvent_Tags.HolePunchFailed: {
3645
3631
  const inner = value.inner;
3646
- let size = ordinalConverter.allocationSize(21);
3632
+ let size = 4;
3647
3633
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3648
3634
  size += FfiConverterUInt32.allocationSize(inner.attempt);
3649
3635
  size += FfiConverterString.allocationSize(inner.reason);
@@ -3651,14 +3637,14 @@ const FfiConverterTypeP2pEvent = (() => {
3651
3637
  }
3652
3638
  case P2pEvent_Tags.FellBackToRelay: {
3653
3639
  const inner = value.inner;
3654
- let size = ordinalConverter.allocationSize(22);
3640
+ let size = 4;
3655
3641
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3656
3642
  size += FfiConverterString.allocationSize(inner.peerId);
3657
3643
  return size;
3658
3644
  }
3659
3645
  case P2pEvent_Tags.ConnectFailed: {
3660
3646
  const inner = value.inner;
3661
- let size = ordinalConverter.allocationSize(23);
3647
+ let size = 4;
3662
3648
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3663
3649
  size += FfiConverterString.allocationSize(inner.peerId);
3664
3650
  size += FfiConverterTypeNatErrorKind.allocationSize(inner.kind);
@@ -3667,13 +3653,13 @@ const FfiConverterTypeP2pEvent = (() => {
3667
3653
  }
3668
3654
  case P2pEvent_Tags.InboundDirectUpgrade: {
3669
3655
  const inner = value.inner;
3670
- let size = ordinalConverter.allocationSize(24);
3656
+ let size = 4;
3671
3657
  size += FfiConverterString.allocationSize(inner.peerId);
3672
3658
  return size;
3673
3659
  }
3674
3660
  case P2pEvent_Tags.Message: {
3675
3661
  const inner = value.inner;
3676
- let size = ordinalConverter.allocationSize(25);
3662
+ let size = 4;
3677
3663
  size += FfiConverterString.allocationSize(inner.fromPeerId);
3678
3664
  size += FfiConverterSequenceString.allocationSize(inner.topics);
3679
3665
  size += FfiConverterArrayBuffer.allocationSize(inner.data);
@@ -3683,35 +3669,35 @@ const FfiConverterTypeP2pEvent = (() => {
3683
3669
  }
3684
3670
  case P2pEvent_Tags.PeerSubscribed: {
3685
3671
  const inner = value.inner;
3686
- let size = ordinalConverter.allocationSize(26);
3672
+ let size = 4;
3687
3673
  size += FfiConverterString.allocationSize(inner.peerId);
3688
3674
  size += FfiConverterString.allocationSize(inner.topic);
3689
3675
  return size;
3690
3676
  }
3691
3677
  case P2pEvent_Tags.PeerUnsubscribed: {
3692
3678
  const inner = value.inner;
3693
- let size = ordinalConverter.allocationSize(27);
3679
+ let size = 4;
3694
3680
  size += FfiConverterString.allocationSize(inner.peerId);
3695
3681
  size += FfiConverterString.allocationSize(inner.topic);
3696
3682
  return size;
3697
3683
  }
3698
3684
  case P2pEvent_Tags.PubsubOutboundFailure: {
3699
3685
  const inner = value.inner;
3700
- let size = ordinalConverter.allocationSize(28);
3686
+ let size = 4;
3701
3687
  size += FfiConverterString.allocationSize(inner.peerId);
3702
3688
  size += FfiConverterString.allocationSize(inner.reason);
3703
3689
  return size;
3704
3690
  }
3705
3691
  case P2pEvent_Tags.PubsubProtocolViolation: {
3706
3692
  const inner = value.inner;
3707
- let size = ordinalConverter.allocationSize(29);
3693
+ let size = 4;
3708
3694
  size += FfiConverterString.allocationSize(inner.peerId);
3709
3695
  size += FfiConverterString.allocationSize(inner.reason);
3710
3696
  return size;
3711
3697
  }
3712
3698
  case P2pEvent_Tags.PeerDiscovered: {
3713
3699
  const inner = value.inner;
3714
- let size = ordinalConverter.allocationSize(30);
3700
+ let size = 4;
3715
3701
  size += FfiConverterString.allocationSize(inner.peerId);
3716
3702
  size += FfiConverterSequenceString.allocationSize(inner.addrs);
3717
3703
  size += FfiConverterTypeDiscoverySource.allocationSize(inner.source);
@@ -3719,7 +3705,7 @@ const FfiConverterTypeP2pEvent = (() => {
3719
3705
  }
3720
3706
  case P2pEvent_Tags.PeerUpdated: {
3721
3707
  const inner = value.inner;
3722
- let size = ordinalConverter.allocationSize(31);
3708
+ let size = 4;
3723
3709
  size += FfiConverterString.allocationSize(inner.peerId);
3724
3710
  size += FfiConverterSequenceString.allocationSize(inner.addrs);
3725
3711
  size += FfiConverterTypeDiscoverySource.allocationSize(inner.source);
@@ -3727,20 +3713,20 @@ const FfiConverterTypeP2pEvent = (() => {
3727
3713
  }
3728
3714
  case P2pEvent_Tags.PeerExpired: {
3729
3715
  const inner = value.inner;
3730
- let size = ordinalConverter.allocationSize(32);
3716
+ let size = 4;
3731
3717
  size += FfiConverterString.allocationSize(inner.peerId);
3732
3718
  return size;
3733
3719
  }
3734
3720
  case P2pEvent_Tags.DiscoveryDialFailed: {
3735
3721
  const inner = value.inner;
3736
- let size = ordinalConverter.allocationSize(33);
3722
+ let size = 4;
3737
3723
  size += FfiConverterString.allocationSize(inner.peerId);
3738
3724
  size += FfiConverterString.allocationSize(inner.reason);
3739
3725
  return size;
3740
3726
  }
3741
3727
  case P2pEvent_Tags.DiscoveryProtocolViolation: {
3742
3728
  const inner = value.inner;
3743
- let size = ordinalConverter.allocationSize(34);
3729
+ let size = 4;
3744
3730
  size += FfiConverterOptionalString.allocationSize(inner.peerId);
3745
3731
  size += FfiConverterTypeDiscoverySource.allocationSize(inner.source);
3746
3732
  size += FfiConverterString.allocationSize(inner.reason);
@@ -3755,42 +3741,41 @@ const FfiConverterTypeP2pEvent = (() => {
3755
3741
  })();
3756
3742
 
3757
3743
  /**
3758
- * Listener implemented by the embedding runtime.
3744
+ * Doorbell implemented by the embedding runtime.
3759
3745
  */
3760
- export interface P2pEventListener {
3746
+ export interface P2pEventDoorbell {
3761
3747
 
3762
3748
  /**
3763
- * Receives one converted native event.
3749
+ * Reports that synchronous event draining can make progress.
3764
3750
  */
3765
- onEvent(event: P2pEvent): void;
3751
+ onEventsReady(): void;
3766
3752
  }
3767
3753
 
3768
3754
 
3769
3755
  /**
3770
- * Listener implemented by the embedding runtime.
3756
+ * Doorbell implemented by the embedding runtime.
3771
3757
  */
3772
- export class P2pEventListenerImpl extends UniffiAbstractObject implements P2pEventListener {
3758
+ export class P2pEventDoorbellImpl extends UniffiAbstractObject implements P2pEventDoorbell {
3773
3759
 
3774
- readonly [uniffiTypeNameSymbol] = "P2pEventListenerImpl";
3760
+ readonly [uniffiTypeNameSymbol] = "P2pEventDoorbellImpl";
3775
3761
  readonly [destructorGuardSymbol]: UniffiGcObject;
3776
3762
  readonly [pointerLiteralSymbol]: UniffiHandle;
3777
3763
  // No primary constructor declared for this class.
3778
3764
  private constructor(pointer: UniffiHandle) {
3779
3765
  super();
3780
3766
  this[pointerLiteralSymbol] = pointer;
3781
- this[destructorGuardSymbol] = uniffiTypeP2pEventListenerImplObjectFactory.bless(pointer);
3767
+ this[destructorGuardSymbol] = uniffiTypeP2pEventDoorbellImplObjectFactory.bless(pointer);
3782
3768
  }
3783
3769
 
3784
3770
 
3785
3771
 
3786
3772
 
3787
3773
  /**
3788
- * Receives one converted native event.
3774
+ * Reports that synchronous event draining can make progress.
3789
3775
  */
3790
- onEvent(event: P2pEvent): void {uniffiCaller.rustCall(
3791
- /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2peventlistener_on_event(
3792
- uniffiTypeP2pEventListenerImplObjectFactory.clonePointer(this),
3793
- FfiConverterTypeP2pEvent.lower(event, nativeModule().rustbuffer_alloc),
3776
+ onEventsReady(): void {uniffiCaller.rustCall(
3777
+ /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2peventdoorbell_on_events_ready(
3778
+ uniffiTypeP2pEventDoorbellImplObjectFactory.clonePointer(this),
3794
3779
  callStatus);
3795
3780
  },
3796
3781
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
@@ -3801,28 +3786,28 @@ private constructor(pointer: UniffiHandle) {
3801
3786
  uniffiDestroy(): void {
3802
3787
  const ptr = (this as any)[destructorGuardSymbol];
3803
3788
  if (ptr !== undefined) {
3804
- const pointer = uniffiTypeP2pEventListenerImplObjectFactory.pointer(this);
3805
- uniffiTypeP2pEventListenerImplObjectFactory.freePointer(pointer);
3806
- uniffiTypeP2pEventListenerImplObjectFactory.unbless(ptr);
3789
+ const pointer = uniffiTypeP2pEventDoorbellImplObjectFactory.pointer(this);
3790
+ uniffiTypeP2pEventDoorbellImplObjectFactory.freePointer(pointer);
3791
+ uniffiTypeP2pEventDoorbellImplObjectFactory.unbless(ptr);
3807
3792
  delete (this as any)[destructorGuardSymbol];
3808
3793
  }
3809
3794
  }
3810
3795
 
3811
- static instanceOf(obj_: any): obj_ is P2pEventListenerImpl {
3812
- return uniffiTypeP2pEventListenerImplObjectFactory.isConcreteType(obj_);
3796
+ static instanceOf(obj_: any): obj_ is P2pEventDoorbellImpl {
3797
+ return uniffiTypeP2pEventDoorbellImplObjectFactory.isConcreteType(obj_);
3813
3798
  }
3814
3799
 
3815
3800
 
3816
3801
  }
3817
3802
 
3818
- const uniffiTypeP2pEventListenerImplObjectFactory: UniffiObjectFactory<P2pEventListener> = (() => {
3803
+ const uniffiTypeP2pEventDoorbellImplObjectFactory: UniffiObjectFactory<P2pEventDoorbell> = (() => {
3819
3804
 
3820
3805
  return {
3821
- create(pointer: UniffiHandle): P2pEventListener {
3822
- const instance = Object.create(P2pEventListenerImpl.prototype);
3806
+ create(pointer: UniffiHandle): P2pEventDoorbell {
3807
+ const instance = Object.create(P2pEventDoorbellImpl.prototype);
3823
3808
  instance[pointerLiteralSymbol] = pointer;
3824
3809
  instance[destructorGuardSymbol] = this.bless(pointer);
3825
- instance[uniffiTypeNameSymbol] = "P2pEventListenerImpl";
3810
+ instance[uniffiTypeNameSymbol] = "P2pEventDoorbellImpl";
3826
3811
  return instance;
3827
3812
  },
3828
3813
 
@@ -3830,7 +3815,7 @@ const uniffiTypeP2pEventListenerImplObjectFactory: UniffiObjectFactory<P2pEventL
3830
3815
  bless(p: UniffiHandle): UniffiGcObject {
3831
3816
  return uniffiCaller.rustCall(
3832
3817
  /*caller:*/ (status) =>
3833
- nativeModule().ubrn_uniffi_internal_fn_method_p2peventlistener_ffi__bless_pointer(p, status),
3818
+ nativeModule().ubrn_uniffi_internal_fn_method_p2peventdoorbell_ffi__bless_pointer(p, status),
3834
3819
  /*liftString:*/ FfiConverterString.lift
3835
3820
  );
3836
3821
  },
@@ -3839,50 +3824,48 @@ const uniffiTypeP2pEventListenerImplObjectFactory: UniffiObjectFactory<P2pEventL
3839
3824
  ptr_.markDestroyed();
3840
3825
  },
3841
3826
 
3842
- pointer(obj_: P2pEventListener): UniffiHandle {
3827
+ pointer(obj_: P2pEventDoorbell): UniffiHandle {
3843
3828
  if ((obj_ as any)[destructorGuardSymbol] === undefined) {
3844
3829
  throw new UniffiInternalError.UnexpectedNullPointer();
3845
3830
  }
3846
3831
  return (obj_ as any)[pointerLiteralSymbol];
3847
3832
  },
3848
3833
 
3849
- clonePointer(obj_: P2pEventListener): UniffiHandle {
3834
+ clonePointer(obj_: P2pEventDoorbell): UniffiHandle {
3850
3835
  const pointer = this.pointer(obj_);
3851
3836
  return uniffiCaller.rustCall(
3852
- /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_minip2p_ffi_fn_clone_p2peventlistener(pointer, callStatus),
3837
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_minip2p_ffi_fn_clone_p2peventdoorbell(pointer, callStatus),
3853
3838
  /*liftString:*/ FfiConverterString.lift
3854
3839
  );
3855
3840
  },
3856
3841
 
3857
3842
  freePointer(pointer: UniffiHandle): void {
3858
3843
  uniffiCaller.rustCall(
3859
- /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_minip2p_ffi_fn_free_p2peventlistener(pointer, callStatus),
3844
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_minip2p_ffi_fn_free_p2peventdoorbell(pointer, callStatus),
3860
3845
  /*liftString:*/ FfiConverterString.lift
3861
3846
  );
3862
3847
  },
3863
3848
 
3864
- isConcreteType(obj_: any): obj_ is P2pEventListener {
3865
- return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "P2pEventListenerImpl";
3849
+ isConcreteType(obj_: any): obj_ is P2pEventDoorbell {
3850
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "P2pEventDoorbellImpl";
3866
3851
  },
3867
3852
  }})();
3868
- const FfiConverterTypeP2pEventListener = new FfiConverterObjectWithCallbacks(uniffiTypeP2pEventListenerImplObjectFactory);
3853
+ const FfiConverterTypeP2pEventDoorbell = new FfiConverterObjectWithCallbacks(uniffiTypeP2pEventDoorbellImplObjectFactory);
3869
3854
 
3870
- // Add a vtable for the callbacks that go in P2pEventListener.
3855
+ // Add a vtable for the callbacks that go in P2pEventDoorbell.
3871
3856
 
3872
3857
  // Put the implementation in a struct so we don't pollute the top-level namespace
3873
- const uniffiCallbackInterfaceP2pEventListener: { vtable: any; register: () => void; } = {
3858
+ const uniffiCallbackInterfaceP2pEventDoorbell: { vtable: any; register: () => void; } = {
3874
3859
  // Create the VTable using a series of closures.
3875
3860
  // ts automatically converts these into C callback functions.
3876
3861
  vtable: {
3877
- on_event: (
3878
- uniffiHandle: bigint,
3879
- event: Uint8Array,) => {
3862
+ on_events_ready: (
3863
+ uniffiHandle: bigint,) => {
3880
3864
  const uniffiMakeCall =
3881
3865
  ()
3882
3866
  : void => {
3883
- const jsCallback = FfiConverterTypeP2pEventListener.lift(uniffiHandle);
3884
- return jsCallback.onEvent(
3885
- FfiConverterTypeP2pEvent.lift(event)
3867
+ const jsCallback = FfiConverterTypeP2pEventDoorbell.lift(uniffiHandle);
3868
+ return jsCallback.onEventsReady(
3886
3869
  )
3887
3870
  };
3888
3871
  const uniffiResult = UniffiResult.ready<void>();
@@ -3901,14 +3884,14 @@ const uniffiCallbackInterfaceP2pEventListener: { vtable: any; register: () => vo
3901
3884
  },
3902
3885
  uniffi_free: (uniffiHandle: UniffiHandle): void => {
3903
3886
  // this will throw a stale handle error if the handle isn't found.
3904
- FfiConverterTypeP2pEventListener.drop(uniffiHandle);
3887
+ FfiConverterTypeP2pEventDoorbell.drop(uniffiHandle);
3905
3888
  },
3906
3889
  uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => {
3907
- return FfiConverterTypeP2pEventListener.clone(uniffiHandle);
3890
+ return FfiConverterTypeP2pEventDoorbell.clone(uniffiHandle);
3908
3891
  }
3909
3892
  },
3910
- register: () => {nativeModule().ubrn_uniffi_minip2p_ffi_fn_init_callback_vtable_p2peventlistener(
3911
- uniffiCallbackInterfaceP2pEventListener.vtable
3893
+ register: () => {nativeModule().ubrn_uniffi_minip2p_ffi_fn_init_callback_vtable_p2peventdoorbell(
3894
+ uniffiCallbackInterfaceP2pEventDoorbell.vtable
3912
3895
  );
3913
3896
  },
3914
3897
  };
@@ -3919,11 +3902,11 @@ const uniffiCallbackInterfaceP2pEventListener: { vtable: any; register: () => vo
3919
3902
  export interface P2pEndpointLike {
3920
3903
 
3921
3904
  /**
3922
- * Resets and forgets an application stream.
3905
+ * Forgets a stream.
3923
3906
  */
3924
3907
  abandonStream(peerId: string, streamId: bigint) /*throws*/: void;
3925
3908
  /**
3926
- * Returns the active inbound relay reservation.
3909
+ * Returns the active relay reservation.
3927
3910
  */
3928
3911
  activeReservation() /*throws*/: RelayReservationInfo | undefined;
3929
3912
  /**
@@ -3931,123 +3914,115 @@ export interface P2pEndpointLike {
3931
3914
  */
3932
3915
  addProtocol(protocolId: string) /*throws*/: void;
3933
3916
  /**
3934
- * Cancels a known connection attempt; unknown ids are an idempotent no-op.
3935
- *
3936
- * Queued connection events are suppressed when possible. A listener
3937
- * callback that already won the dispatch race may still arrive.
3917
+ * Cancels a connection attempt.
3938
3918
  */
3939
3919
  cancelConnect(id: bigint) /*throws*/: void;
3940
3920
  /**
3941
- * Half-closes the local write side of an application stream.
3921
+ * Half-closes a stream's write side.
3942
3922
  */
3943
3923
  closeStreamWrite(peerId: string, streamId: bigint) /*throws*/: void;
3944
3924
  /**
3945
- * Starts a connection attempt toward a peer without known direct addresses.
3925
+ * Starts a connection attempt.
3946
3926
  */
3947
3927
  connect(peerId: string) /*throws*/: bigint;
3948
3928
  /**
3949
- * Starts a connection attempt toward a direct `/quic-v1` or `/tcp` peer
3950
- * address.
3929
+ * Starts a direct-address connection attempt.
3951
3930
  */
3952
3931
  connectAddr(address: string) /*throws*/: bigint;
3953
3932
  /**
3954
- * Starts a NAT connection attempt using an explicit ordered address set.
3933
+ * Starts a connection attempt with explicit addresses.
3955
3934
  */
3956
3935
  connectWithAddrs(peerId: string, addresses: Array<string>) /*throws*/: bigint;
3957
3936
  /**
3958
- * Returns peers with an established QUIC, TCP, or circuit connection.
3937
+ * Returns connected peers.
3959
3938
  */
3960
3939
  connectedPeers() /*throws*/: Array<string>;
3961
3940
  /**
3962
- * Dials a direct peer address on every applicable local address family.
3941
+ * Dials on all applicable address families.
3963
3942
  */
3964
3943
  dial(address: string) /*throws*/: Array<bigint>;
3965
3944
  /**
3966
- * Dials a direct peer address using IPv4.
3945
+ * Dials using IPv4.
3967
3946
  */
3968
3947
  dialIp4(address: string) /*throws*/: bigint;
3969
3948
  /**
3970
- * Dials a direct peer address using IPv6.
3949
+ * Dials using IPv6.
3971
3950
  */
3972
3951
  dialIp6(address: string) /*throws*/: bigint;
3973
3952
  /**
3974
- * Closes the active connection to `peer_id`.
3975
- *
3976
- * Cancelling a connection attempt suppresses that attempt's progress
3977
- * events, but cannot retract a transport connection that has already
3978
- * completed. Call this method when cancellation must also close an
3979
- * established connection.
3953
+ * Disconnects a peer.
3980
3954
  */
3981
3955
  disconnect(peerId: string) /*throws*/: void;
3982
3956
  /**
3983
- * Returns the discovery driver's monotonic clock in milliseconds.
3957
+ * Returns the discovery clock.
3984
3958
  */
3985
3959
  discoveryNowMs() /*throws*/: bigint | undefined;
3986
3960
  /**
3987
- * Returns whether Identify has completed for `peer_id`.
3961
+ * Pulls at most `limit` queued events in order.
3962
+ */
3963
+ drainEvents(limit: number): Array<P2pEvent>;
3964
+ /**
3965
+ * Returns whether Identify completed for a peer.
3988
3966
  */
3989
3967
  isPeerReady(peerId: string) /*throws*/: boolean;
3990
3968
  /**
3991
- * Returns whether the background driver is accepting work.
3992
- *
3993
- * This becomes `false` when shutdown is requested. Use
3994
- * [`P2pEndpoint::wait_stopped`] to observe complete driver exit.
3969
+ * Returns whether the driver accepts work.
3995
3970
  */
3996
3971
  isRunning(): boolean;
3997
3972
  /**
3998
- * Returns the shared discovery address-book snapshot.
3973
+ * Returns the discovery address book.
3999
3974
  */
4000
3975
  knownPeers() /*throws*/: Array<KnownPeerInfo>;
4001
3976
  /**
4002
- * Returns the bound QUIC or TCP peer addresses.
3977
+ * Returns bound peer addresses.
4003
3978
  */
4004
3979
  listenAddrs(): Array<string>;
4005
3980
  /**
4006
- * Opens a negotiated application stream and returns its opaque id.
3981
+ * Opens an application stream.
4007
3982
  */
4008
3983
  openStream(peerId: string, protocolId: string) /*throws*/: OpenStreamResult;
4009
3984
  /**
4010
- * Returns the current usable NAT-orchestrated path to `peer_id`.
3985
+ * Returns the current path to a peer.
4011
3986
  */
4012
3987
  path(peerId: string) /*throws*/: PathKind | undefined;
4013
3988
  /**
4014
- * Returns the local peer ID as legacy base58 text.
3989
+ * Returns the local peer ID.
4015
3990
  */
4016
3991
  peerId(): string;
4017
3992
  /**
4018
- * Returns the latest Identify snapshot for `peer_id`.
3993
+ * Returns the latest Identify snapshot.
4019
3994
  */
4020
3995
  peerInfo(peerId: string) /*throws*/: IdentifyInfo | undefined;
4021
3996
  /**
4022
- * Sends an explicit ping; completion arrives as a ping event.
3997
+ * Sends an explicit ping.
4023
3998
  */
4024
3999
  ping(peerId: string) /*throws*/: void;
4025
4000
  /**
4026
- * Publishes one application payload.
4001
+ * Publishes one payload.
4027
4002
  */
4028
4003
  publish(topic: string, data: ArrayBuffer) /*throws*/: void;
4029
4004
  /**
4030
- * Returns the current AutoNAT reachability verdict.
4005
+ * Returns the current reachability verdict.
4031
4006
  */
4032
4007
  reachability() /*throws*/: Reachability;
4033
4008
  /**
4034
- * Resets an application stream while retaining later close events.
4009
+ * Resets a stream.
4035
4010
  */
4036
4011
  resetStream(peerId: string, streamId: bigint) /*throws*/: void;
4037
4012
  /**
4038
- * Sends one byte chunk on an application stream.
4013
+ * Sends bytes on a stream.
4039
4014
  */
4040
4015
  sendStream(peerId: string, streamId: bigint, data: ArrayBuffer) /*throws*/: void;
4041
4016
  /**
4042
- * Selects active or idle driver polling without changing delivery semantics.
4017
+ * Selects active or idle polling.
4043
4018
  */
4044
4019
  setActive(active: boolean): void;
4045
4020
  /**
4046
- * Starts the detached background endpoint driver.
4021
+ * Starts the detached driver and registers its doorbell.
4047
4022
  */
4048
- start(listener: P2pEventListener) /*throws*/: void;
4023
+ start(doorbell: P2pEventDoorbell) /*throws*/: void;
4049
4024
  /**
4050
- * Requests shutdown without waiting for an in-flight callback.
4025
+ * Requests shutdown.
4051
4026
  */
4052
4027
  stop(): void;
4053
4028
  /**
@@ -4059,14 +4034,7 @@ export interface P2pEndpointLike {
4059
4034
  */
4060
4035
  unsubscribe(topic: string) /*throws*/: boolean;
4061
4036
  /**
4062
- * Waits up to `timeout_ms` for the endpoint to reach the stopped state.
4063
- *
4064
- * A newly created endpoint still owns bound sockets, so this returns
4065
- * `false` until `stop` releases it. For a running endpoint, `stop` only
4066
- * requests shutdown and this waits for the driver exit cleanup.
4067
- *
4068
- * Calling this from a listener callback would wait on the callback's own
4069
- * driver thread, so that case returns `false` immediately.
4037
+ * Waits for complete driver shutdown.
4070
4038
  */
4071
4039
  waitStopped(timeoutMs: bigint): boolean;
4072
4040
  }
@@ -4085,11 +4053,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4085
4053
  readonly [destructorGuardSymbol]: UniffiGcObject;
4086
4054
  readonly [pointerLiteralSymbol]: UniffiHandle;
4087
4055
  /**
4088
- * Validates the secret key and `config`, binds its transports, and creates
4089
- * an endpoint.
4090
- *
4091
- * The endpoint begins in the created state and owns its bound sockets,
4092
- * but does not run a background driver until explicitly started.
4056
+ * Creates an endpoint after validating configuration and binding sockets.
4093
4057
  */
4094
4058
  constructor(secretKey: ArrayBuffer, config: EndpointConfig) /*throws*/ {
4095
4059
  super();
@@ -4112,7 +4076,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4112
4076
 
4113
4077
 
4114
4078
  /**
4115
- * Resets and forgets an application stream.
4079
+ * Forgets a stream.
4116
4080
  */
4117
4081
  abandonStream(peerId: string, streamId: bigint): void /*throws*/ {uniffiCaller.rustCallWithError(
4118
4082
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
@@ -4127,16 +4091,10 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4127
4091
  }
4128
4092
 
4129
4093
  /**
4130
- * Returns the active inbound relay reservation.
4094
+ * Returns the active relay reservation.
4131
4095
  */
4132
4096
  activeReservation(): RelayReservationInfo | undefined /*throws*/ {
4133
- return ((__rb: Uint8Array) => {
4134
- try {
4135
- return FfiConverterOptionalTypeRelayReservationInfo.lift(__rb);
4136
- } finally {
4137
- nativeModule().rustbuffer_free(__rb);
4138
- }
4139
- })(uniffiCaller.rustCallWithError(
4097
+ const __rb: Uint8Array = uniffiCaller.rustCallWithError(
4140
4098
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4141
4099
  /*caller:*/ (callStatus) => {
4142
4100
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_active_reservation(
@@ -4144,7 +4102,12 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4144
4102
  callStatus);
4145
4103
  },
4146
4104
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4147
- ));
4105
+ );
4106
+ try {
4107
+ return FfiConverterOptionalTypeRelayReservationInfo.lift(__rb);
4108
+ } finally {
4109
+ nativeModule().rustbuffer_free(__rb);
4110
+ }
4148
4111
  }
4149
4112
 
4150
4113
  /**
@@ -4162,10 +4125,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4162
4125
  }
4163
4126
 
4164
4127
  /**
4165
- * Cancels a known connection attempt; unknown ids are an idempotent no-op.
4166
- *
4167
- * Queued connection events are suppressed when possible. A listener
4168
- * callback that already won the dispatch race may still arrive.
4128
+ * Cancels a connection attempt.
4169
4129
  */
4170
4130
  cancelConnect(id: bigint): void /*throws*/ {uniffiCaller.rustCallWithError(
4171
4131
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
@@ -4179,7 +4139,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4179
4139
  }
4180
4140
 
4181
4141
  /**
4182
- * Half-closes the local write side of an application stream.
4142
+ * Half-closes a stream's write side.
4183
4143
  */
4184
4144
  closeStreamWrite(peerId: string, streamId: bigint): void /*throws*/ {uniffiCaller.rustCallWithError(
4185
4145
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
@@ -4194,7 +4154,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4194
4154
  }
4195
4155
 
4196
4156
  /**
4197
- * Starts a connection attempt toward a peer without known direct addresses.
4157
+ * Starts a connection attempt.
4198
4158
  */
4199
4159
  connect(peerId: string): bigint /*throws*/ {
4200
4160
  return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
@@ -4210,8 +4170,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4210
4170
  }
4211
4171
 
4212
4172
  /**
4213
- * Starts a connection attempt toward a direct `/quic-v1` or `/tcp` peer
4214
- * address.
4173
+ * Starts a direct-address connection attempt.
4215
4174
  */
4216
4175
  connectAddr(address: string): bigint /*throws*/ {
4217
4176
  return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
@@ -4227,7 +4186,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4227
4186
  }
4228
4187
 
4229
4188
  /**
4230
- * Starts a NAT connection attempt using an explicit ordered address set.
4189
+ * Starts a connection attempt with explicit addresses.
4231
4190
  */
4232
4191
  connectWithAddrs(peerId: string, addresses: Array<string>): bigint /*throws*/ {
4233
4192
  return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
@@ -4244,16 +4203,10 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4244
4203
  }
4245
4204
 
4246
4205
  /**
4247
- * Returns peers with an established QUIC, TCP, or circuit connection.
4206
+ * Returns connected peers.
4248
4207
  */
4249
4208
  connectedPeers(): Array<string> /*throws*/ {
4250
- return ((__rb: Uint8Array) => {
4251
- try {
4252
- return FfiConverterSequenceString.lift(__rb);
4253
- } finally {
4254
- nativeModule().rustbuffer_free(__rb);
4255
- }
4256
- })(uniffiCaller.rustCallWithError(
4209
+ const __rb: Uint8Array = uniffiCaller.rustCallWithError(
4257
4210
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4258
4211
  /*caller:*/ (callStatus) => {
4259
4212
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connected_peers(
@@ -4261,20 +4214,19 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4261
4214
  callStatus);
4262
4215
  },
4263
4216
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4264
- ));
4217
+ );
4218
+ try {
4219
+ return FfiConverterSequenceString.lift(__rb);
4220
+ } finally {
4221
+ nativeModule().rustbuffer_free(__rb);
4222
+ }
4265
4223
  }
4266
4224
 
4267
4225
  /**
4268
- * Dials a direct peer address on every applicable local address family.
4226
+ * Dials on all applicable address families.
4269
4227
  */
4270
4228
  dial(address: string): Array<bigint> /*throws*/ {
4271
- return ((__rb: Uint8Array) => {
4272
- try {
4273
- return FfiConverterSequenceUInt64.lift(__rb);
4274
- } finally {
4275
- nativeModule().rustbuffer_free(__rb);
4276
- }
4277
- })(uniffiCaller.rustCallWithError(
4229
+ const __rb: Uint8Array = uniffiCaller.rustCallWithError(
4278
4230
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4279
4231
  /*caller:*/ (callStatus) => {
4280
4232
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_dial(
@@ -4283,11 +4235,16 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4283
4235
  callStatus);
4284
4236
  },
4285
4237
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4286
- ));
4238
+ );
4239
+ try {
4240
+ return FfiConverterSequenceUInt64.lift(__rb);
4241
+ } finally {
4242
+ nativeModule().rustbuffer_free(__rb);
4243
+ }
4287
4244
  }
4288
4245
 
4289
4246
  /**
4290
- * Dials a direct peer address using IPv4.
4247
+ * Dials using IPv4.
4291
4248
  */
4292
4249
  dialIp4(address: string): bigint /*throws*/ {
4293
4250
  return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
@@ -4303,7 +4260,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4303
4260
  }
4304
4261
 
4305
4262
  /**
4306
- * Dials a direct peer address using IPv6.
4263
+ * Dials using IPv6.
4307
4264
  */
4308
4265
  dialIp6(address: string): bigint /*throws*/ {
4309
4266
  return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
@@ -4319,12 +4276,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4319
4276
  }
4320
4277
 
4321
4278
  /**
4322
- * Closes the active connection to `peer_id`.
4323
- *
4324
- * Cancelling a connection attempt suppresses that attempt's progress
4325
- * events, but cannot retract a transport connection that has already
4326
- * completed. Call this method when cancellation must also close an
4327
- * established connection.
4279
+ * Disconnects a peer.
4328
4280
  */
4329
4281
  disconnect(peerId: string): void /*throws*/ {uniffiCaller.rustCallWithError(
4330
4282
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
@@ -4338,16 +4290,10 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4338
4290
  }
4339
4291
 
4340
4292
  /**
4341
- * Returns the discovery driver's monotonic clock in milliseconds.
4293
+ * Returns the discovery clock.
4342
4294
  */
4343
4295
  discoveryNowMs(): bigint | undefined /*throws*/ {
4344
- return ((__rb: Uint8Array) => {
4345
- try {
4346
- return FfiConverterOptionalUInt64.lift(__rb);
4347
- } finally {
4348
- nativeModule().rustbuffer_free(__rb);
4349
- }
4350
- })(uniffiCaller.rustCallWithError(
4296
+ const __rb: Uint8Array = uniffiCaller.rustCallWithError(
4351
4297
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4352
4298
  /*caller:*/ (callStatus) => {
4353
4299
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_discovery_now_ms(
@@ -4355,11 +4301,36 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4355
4301
  callStatus);
4356
4302
  },
4357
4303
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4358
- ));
4304
+ );
4305
+ try {
4306
+ return FfiConverterOptionalUInt64.lift(__rb);
4307
+ } finally {
4308
+ nativeModule().rustbuffer_free(__rb);
4309
+ }
4359
4310
  }
4360
4311
 
4361
4312
  /**
4362
- * Returns whether Identify has completed for `peer_id`.
4313
+ * Pulls at most `limit` queued events in order.
4314
+ */
4315
+ drainEvents(limit: number): Array<P2pEvent> {
4316
+ const __rb: Uint8Array = uniffiCaller.rustCall(
4317
+ /*caller:*/ (callStatus) => {
4318
+ return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_drain_events(
4319
+ uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
4320
+ FfiConverterUInt32.lower(limit, nativeModule().rustbuffer_alloc),
4321
+ callStatus);
4322
+ },
4323
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4324
+ );
4325
+ try {
4326
+ return FfiConverterSequenceTypeP2pEvent.lift(__rb);
4327
+ } finally {
4328
+ nativeModule().rustbuffer_free(__rb);
4329
+ }
4330
+ }
4331
+
4332
+ /**
4333
+ * Returns whether Identify completed for a peer.
4363
4334
  */
4364
4335
  isPeerReady(peerId: string): boolean /*throws*/ {
4365
4336
  return FfiConverterBool.lift(uniffiCaller.rustCallWithError(
@@ -4375,10 +4346,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4375
4346
  }
4376
4347
 
4377
4348
  /**
4378
- * Returns whether the background driver is accepting work.
4379
- *
4380
- * This becomes `false` when shutdown is requested. Use
4381
- * [`P2pEndpoint::wait_stopped`] to observe complete driver exit.
4349
+ * Returns whether the driver accepts work.
4382
4350
  */
4383
4351
  isRunning(): boolean {
4384
4352
  return FfiConverterBool.lift(uniffiCaller.rustCall(
@@ -4392,16 +4360,10 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4392
4360
  }
4393
4361
 
4394
4362
  /**
4395
- * Returns the shared discovery address-book snapshot.
4363
+ * Returns the discovery address book.
4396
4364
  */
4397
4365
  knownPeers(): Array<KnownPeerInfo> /*throws*/ {
4398
- return ((__rb: Uint8Array) => {
4399
- try {
4400
- return FfiConverterSequenceTypeKnownPeerInfo.lift(__rb);
4401
- } finally {
4402
- nativeModule().rustbuffer_free(__rb);
4403
- }
4404
- })(uniffiCaller.rustCallWithError(
4366
+ const __rb: Uint8Array = uniffiCaller.rustCallWithError(
4405
4367
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4406
4368
  /*caller:*/ (callStatus) => {
4407
4369
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_known_peers(
@@ -4409,40 +4371,38 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4409
4371
  callStatus);
4410
4372
  },
4411
4373
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4412
- ));
4374
+ );
4375
+ try {
4376
+ return FfiConverterSequenceTypeKnownPeerInfo.lift(__rb);
4377
+ } finally {
4378
+ nativeModule().rustbuffer_free(__rb);
4379
+ }
4413
4380
  }
4414
4381
 
4415
4382
  /**
4416
- * Returns the bound QUIC or TCP peer addresses.
4383
+ * Returns bound peer addresses.
4417
4384
  */
4418
4385
  listenAddrs(): Array<string> {
4419
- return ((__rb: Uint8Array) => {
4420
- try {
4421
- return FfiConverterSequenceString.lift(__rb);
4422
- } finally {
4423
- nativeModule().rustbuffer_free(__rb);
4424
- }
4425
- })(uniffiCaller.rustCall(
4386
+ const __rb: Uint8Array = uniffiCaller.rustCall(
4426
4387
  /*caller:*/ (callStatus) => {
4427
4388
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_listen_addrs(
4428
4389
  uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
4429
4390
  callStatus);
4430
4391
  },
4431
4392
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4432
- ));
4393
+ );
4394
+ try {
4395
+ return FfiConverterSequenceString.lift(__rb);
4396
+ } finally {
4397
+ nativeModule().rustbuffer_free(__rb);
4398
+ }
4433
4399
  }
4434
4400
 
4435
4401
  /**
4436
- * Opens a negotiated application stream and returns its opaque id.
4402
+ * Opens an application stream.
4437
4403
  */
4438
4404
  openStream(peerId: string, protocolId: string): OpenStreamResult /*throws*/ {
4439
- return ((__rb: Uint8Array) => {
4440
- try {
4441
- return FfiConverterTypeOpenStreamResult.lift(__rb);
4442
- } finally {
4443
- nativeModule().rustbuffer_free(__rb);
4444
- }
4445
- })(uniffiCaller.rustCallWithError(
4405
+ const __rb: Uint8Array = uniffiCaller.rustCallWithError(
4446
4406
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4447
4407
  /*caller:*/ (callStatus) => {
4448
4408
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_open_stream(
@@ -4452,20 +4412,19 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4452
4412
  callStatus);
4453
4413
  },
4454
4414
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4455
- ));
4415
+ );
4416
+ try {
4417
+ return FfiConverterTypeOpenStreamResult.lift(__rb);
4418
+ } finally {
4419
+ nativeModule().rustbuffer_free(__rb);
4420
+ }
4456
4421
  }
4457
4422
 
4458
4423
  /**
4459
- * Returns the current usable NAT-orchestrated path to `peer_id`.
4424
+ * Returns the current path to a peer.
4460
4425
  */
4461
4426
  path(peerId: string): PathKind | undefined /*throws*/ {
4462
- return ((__rb: Uint8Array) => {
4463
- try {
4464
- return FfiConverterOptionalTypePathKind.lift(__rb);
4465
- } finally {
4466
- nativeModule().rustbuffer_free(__rb);
4467
- }
4468
- })(uniffiCaller.rustCallWithError(
4427
+ const __rb: Uint8Array = uniffiCaller.rustCallWithError(
4469
4428
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4470
4429
  /*caller:*/ (callStatus) => {
4471
4430
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_path(
@@ -4474,40 +4433,38 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4474
4433
  callStatus);
4475
4434
  },
4476
4435
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4477
- ));
4436
+ );
4437
+ try {
4438
+ return FfiConverterOptionalTypePathKind.lift(__rb);
4439
+ } finally {
4440
+ nativeModule().rustbuffer_free(__rb);
4441
+ }
4478
4442
  }
4479
4443
 
4480
4444
  /**
4481
- * Returns the local peer ID as legacy base58 text.
4445
+ * Returns the local peer ID.
4482
4446
  */
4483
4447
  peerId(): string {
4484
- return ((__rb: Uint8Array) => {
4485
- try {
4486
- return FfiConverterString.lift(__rb);
4487
- } finally {
4488
- nativeModule().rustbuffer_free(__rb);
4489
- }
4490
- })(uniffiCaller.rustCall(
4448
+ const __rb: Uint8Array = uniffiCaller.rustCall(
4491
4449
  /*caller:*/ (callStatus) => {
4492
4450
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_peer_id(
4493
4451
  uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
4494
4452
  callStatus);
4495
4453
  },
4496
4454
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4497
- ));
4455
+ );
4456
+ try {
4457
+ return FfiConverterString.lift(__rb);
4458
+ } finally {
4459
+ nativeModule().rustbuffer_free(__rb);
4460
+ }
4498
4461
  }
4499
4462
 
4500
4463
  /**
4501
- * Returns the latest Identify snapshot for `peer_id`.
4464
+ * Returns the latest Identify snapshot.
4502
4465
  */
4503
4466
  peerInfo(peerId: string): IdentifyInfo | undefined /*throws*/ {
4504
- return ((__rb: Uint8Array) => {
4505
- try {
4506
- return FfiConverterOptionalTypeIdentifyInfo.lift(__rb);
4507
- } finally {
4508
- nativeModule().rustbuffer_free(__rb);
4509
- }
4510
- })(uniffiCaller.rustCallWithError(
4467
+ const __rb: Uint8Array = uniffiCaller.rustCallWithError(
4511
4468
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4512
4469
  /*caller:*/ (callStatus) => {
4513
4470
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_peer_info(
@@ -4516,11 +4473,16 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4516
4473
  callStatus);
4517
4474
  },
4518
4475
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4519
- ));
4476
+ );
4477
+ try {
4478
+ return FfiConverterOptionalTypeIdentifyInfo.lift(__rb);
4479
+ } finally {
4480
+ nativeModule().rustbuffer_free(__rb);
4481
+ }
4520
4482
  }
4521
4483
 
4522
4484
  /**
4523
- * Sends an explicit ping; completion arrives as a ping event.
4485
+ * Sends an explicit ping.
4524
4486
  */
4525
4487
  ping(peerId: string): void /*throws*/ {uniffiCaller.rustCallWithError(
4526
4488
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
@@ -4534,7 +4496,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4534
4496
  }
4535
4497
 
4536
4498
  /**
4537
- * Publishes one application payload.
4499
+ * Publishes one payload.
4538
4500
  */
4539
4501
  publish(topic: string, data: ArrayBuffer): void /*throws*/ {uniffiCaller.rustCallWithError(
4540
4502
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
@@ -4549,16 +4511,10 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4549
4511
  }
4550
4512
 
4551
4513
  /**
4552
- * Returns the current AutoNAT reachability verdict.
4514
+ * Returns the current reachability verdict.
4553
4515
  */
4554
4516
  reachability(): Reachability /*throws*/ {
4555
- return ((__rb: Uint8Array) => {
4556
- try {
4557
- return FfiConverterTypeReachability.lift(__rb);
4558
- } finally {
4559
- nativeModule().rustbuffer_free(__rb);
4560
- }
4561
- })(uniffiCaller.rustCallWithError(
4517
+ const __rb: Uint8Array = uniffiCaller.rustCallWithError(
4562
4518
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4563
4519
  /*caller:*/ (callStatus) => {
4564
4520
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_reachability(
@@ -4566,11 +4522,16 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4566
4522
  callStatus);
4567
4523
  },
4568
4524
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4569
- ));
4525
+ );
4526
+ try {
4527
+ return FfiConverterTypeReachability.lift(__rb);
4528
+ } finally {
4529
+ nativeModule().rustbuffer_free(__rb);
4530
+ }
4570
4531
  }
4571
4532
 
4572
4533
  /**
4573
- * Resets an application stream while retaining later close events.
4534
+ * Resets a stream.
4574
4535
  */
4575
4536
  resetStream(peerId: string, streamId: bigint): void /*throws*/ {uniffiCaller.rustCallWithError(
4576
4537
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
@@ -4585,7 +4546,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4585
4546
  }
4586
4547
 
4587
4548
  /**
4588
- * Sends one byte chunk on an application stream.
4549
+ * Sends bytes on a stream.
4589
4550
  */
4590
4551
  sendStream(peerId: string, streamId: bigint, data: ArrayBuffer): void /*throws*/ {uniffiCaller.rustCallWithError(
4591
4552
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
@@ -4601,7 +4562,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4601
4562
  }
4602
4563
 
4603
4564
  /**
4604
- * Selects active or idle driver polling without changing delivery semantics.
4565
+ * Selects active or idle polling.
4605
4566
  */
4606
4567
  setActive(active: boolean): void {uniffiCaller.rustCall(
4607
4568
  /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_set_active(
@@ -4614,13 +4575,13 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4614
4575
  }
4615
4576
 
4616
4577
  /**
4617
- * Starts the detached background endpoint driver.
4578
+ * Starts the detached driver and registers its doorbell.
4618
4579
  */
4619
- start(listener: P2pEventListener): void /*throws*/ {uniffiCaller.rustCallWithError(
4580
+ start(doorbell: P2pEventDoorbell): void /*throws*/ {uniffiCaller.rustCallWithError(
4620
4581
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4621
4582
  /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_start(
4622
4583
  uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
4623
- FfiConverterTypeP2pEventListener.lower(listener, nativeModule().rustbuffer_alloc),
4584
+ FfiConverterTypeP2pEventDoorbell.lower(doorbell, nativeModule().rustbuffer_alloc),
4624
4585
  callStatus);
4625
4586
  },
4626
4587
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
@@ -4628,7 +4589,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4628
4589
  }
4629
4590
 
4630
4591
  /**
4631
- * Requests shutdown without waiting for an in-flight callback.
4592
+ * Requests shutdown.
4632
4593
  */
4633
4594
  stop(): void {uniffiCaller.rustCall(
4634
4595
  /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_stop(
@@ -4672,14 +4633,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4672
4633
  }
4673
4634
 
4674
4635
  /**
4675
- * Waits up to `timeout_ms` for the endpoint to reach the stopped state.
4676
- *
4677
- * A newly created endpoint still owns bound sockets, so this returns
4678
- * `false` until `stop` releases it. For a running endpoint, `stop` only
4679
- * requests shutdown and this waits for the driver exit cleanup.
4680
- *
4681
- * Calling this from a listener callback would wait on the callback's own
4682
- * driver thread, so that case returns `false` immediately.
4636
+ * Waits for complete driver shutdown.
4683
4637
  */
4684
4638
  waitStopped(timeoutMs: bigint): boolean {
4685
4639
  return FfiConverterBool.lift(uniffiCaller.rustCall(
@@ -4793,6 +4747,9 @@ const FfiConverterOptionalTypeRelayReservationInfo = new FfiConverterOptional(Ff
4793
4747
  // FfiConverter for Array<bigint>
4794
4748
  const FfiConverterSequenceUInt64 = new FfiConverterArray(FfiConverterUInt64);
4795
4749
 
4750
+ // FfiConverter for Array<P2pEvent>
4751
+ const FfiConverterSequenceTypeP2pEvent = new FfiConverterArray(FfiConverterTypeP2pEvent);
4752
+
4796
4753
  // FfiConverter for Array<KnownPeerInfo>
4797
4754
  const FfiConverterSequenceTypeKnownPeerInfo = new FfiConverterArray(FfiConverterTypeKnownPeerInfo);
4798
4755
 
@@ -4821,7 +4778,7 @@ function uniffiEnsureInitialized() {
4821
4778
  if (bindingsContractVersion !== scaffoldingContractVersion) {
4822
4779
  throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
4823
4780
  }
4824
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_func_circuit_address() !== 35059) {
4781
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_func_circuit_address() !== 35260) {
4825
4782
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_func_circuit_address");
4826
4783
  }
4827
4784
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_func_generate_secret_key() !== 44400) {
@@ -4830,97 +4787,100 @@ function uniffiEnsureInitialized() {
4830
4787
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_func_peer_id_from_secret_key() !== 8962) {
4831
4788
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_func_peer_id_from_secret_key");
4832
4789
  }
4833
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_constructor_p2pendpoint_new() !== 64534) {
4790
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_constructor_p2pendpoint_new() !== 8152) {
4834
4791
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_constructor_p2pendpoint_new");
4835
4792
  }
4836
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_abandon_stream() !== 60482) {
4793
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_abandon_stream() !== 2693) {
4837
4794
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_abandon_stream");
4838
4795
  }
4839
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_active_reservation() !== 46981) {
4796
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_active_reservation() !== 6405) {
4840
4797
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_active_reservation");
4841
4798
  }
4842
4799
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_add_protocol() !== 12280) {
4843
4800
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_add_protocol");
4844
4801
  }
4845
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_cancel_connect() !== 62501) {
4802
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_cancel_connect() !== 24195) {
4846
4803
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_cancel_connect");
4847
4804
  }
4848
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write() !== 26147) {
4805
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write() !== 17994) {
4849
4806
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write");
4850
4807
  }
4851
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !== 60427) {
4808
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !== 42064) {
4852
4809
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect");
4853
4810
  }
4854
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_addr() !== 27341) {
4811
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_addr() !== 56611) {
4855
4812
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_addr");
4856
4813
  }
4857
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_with_addrs() !== 44153) {
4814
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_with_addrs() !== 2062) {
4858
4815
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_with_addrs");
4859
4816
  }
4860
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers() !== 49290) {
4817
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers() !== 64148) {
4861
4818
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers");
4862
4819
  }
4863
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial() !== 47576) {
4820
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial() !== 35216) {
4864
4821
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial");
4865
4822
  }
4866
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip4() !== 48021) {
4823
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip4() !== 54241) {
4867
4824
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip4");
4868
4825
  }
4869
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip6() !== 24748) {
4826
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip6() !== 3676) {
4870
4827
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip6");
4871
4828
  }
4872
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect() !== 59922) {
4829
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect() !== 23975) {
4873
4830
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect");
4874
4831
  }
4875
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_discovery_now_ms() !== 8975) {
4832
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_discovery_now_ms() !== 14313) {
4876
4833
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_discovery_now_ms");
4877
4834
  }
4878
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_is_peer_ready() !== 1184) {
4835
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_drain_events() !== 30807) {
4836
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_drain_events");
4837
+ }
4838
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_is_peer_ready() !== 30114) {
4879
4839
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_is_peer_ready");
4880
4840
  }
4881
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_is_running() !== 42546) {
4841
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_is_running() !== 42027) {
4882
4842
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_is_running");
4883
4843
  }
4884
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_known_peers() !== 27328) {
4844
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_known_peers() !== 8123) {
4885
4845
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_known_peers");
4886
4846
  }
4887
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_listen_addrs() !== 645) {
4847
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_listen_addrs() !== 43494) {
4888
4848
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_listen_addrs");
4889
4849
  }
4890
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_open_stream() !== 18245) {
4850
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_open_stream() !== 49419) {
4891
4851
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_open_stream");
4892
4852
  }
4893
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_path() !== 58210) {
4853
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_path() !== 6891) {
4894
4854
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_path");
4895
4855
  }
4896
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_peer_id() !== 34289) {
4856
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_peer_id() !== 42474) {
4897
4857
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_peer_id");
4898
4858
  }
4899
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_peer_info() !== 2761) {
4859
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_peer_info() !== 57911) {
4900
4860
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_peer_info");
4901
4861
  }
4902
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_ping() !== 64674) {
4862
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_ping() !== 62457) {
4903
4863
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_ping");
4904
4864
  }
4905
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_publish() !== 42508) {
4865
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_publish() !== 19337) {
4906
4866
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_publish");
4907
4867
  }
4908
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_reachability() !== 24757) {
4868
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_reachability() !== 22554) {
4909
4869
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_reachability");
4910
4870
  }
4911
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_reset_stream() !== 52801) {
4871
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_reset_stream() !== 10950) {
4912
4872
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_reset_stream");
4913
4873
  }
4914
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_send_stream() !== 28787) {
4874
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_send_stream() !== 64427) {
4915
4875
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_send_stream");
4916
4876
  }
4917
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_set_active() !== 14047) {
4877
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_set_active() !== 95) {
4918
4878
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_set_active");
4919
4879
  }
4920
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_start() !== 28557) {
4880
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_start() !== 31285) {
4921
4881
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_start");
4922
4882
  }
4923
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_stop() !== 61952) {
4883
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_stop() !== 11062) {
4924
4884
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_stop");
4925
4885
  }
4926
4886
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_subscribe() !== 55119) {
@@ -4929,14 +4889,14 @@ function uniffiEnsureInitialized() {
4929
4889
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_unsubscribe() !== 32264) {
4930
4890
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_unsubscribe");
4931
4891
  }
4932
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_wait_stopped() !== 3101) {
4892
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_wait_stopped() !== 14108) {
4933
4893
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_wait_stopped");
4934
4894
  }
4935
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2peventlistener_on_event() !== 45831) {
4936
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2peventlistener_on_event");
4895
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2peventdoorbell_on_events_ready() !== 57338) {
4896
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2peventdoorbell_on_events_ready");
4937
4897
  }
4938
4898
 
4939
- uniffiCallbackInterfaceP2pEventListener.register();
4899
+ uniffiCallbackInterfaceP2pEventDoorbell.register();
4940
4900
  }
4941
4901
 
4942
4902
  export default Object.freeze({
@@ -4955,7 +4915,7 @@ export default Object.freeze({
4955
4915
  FfiConverterTypeOpenStreamResult,
4956
4916
  FfiConverterTypeP2pEndpoint,
4957
4917
  FfiConverterTypeP2pEvent,
4958
- FfiConverterTypeP2pEventListener,
4918
+ FfiConverterTypeP2pEventDoorbell,
4959
4919
  FfiConverterTypePathKind,
4960
4920
  FfiConverterTypePubsubRouter,
4961
4921
  FfiConverterTypeReachability,