mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-26 23:41:34 +00:00
deps: update it-length-prefix, uint8arraylist etc (#1317)
In order to support no-copy operations in streams, update all deps to support streaming Uint8ArrayLists.
This commit is contained in:
@ -10,6 +10,7 @@ import type { Libp2pInit, Libp2pOptions } from '../../src/index.js'
|
||||
import type { PeerId } from '@libp2p/interface-peer-id'
|
||||
import * as cborg from 'cborg'
|
||||
import { peerIdFromString } from '@libp2p/peer-id'
|
||||
import { Uint8ArrayList } from 'uint8arraylist'
|
||||
|
||||
const relayAddr = MULTIADDRS_WEBSOCKETS[0]
|
||||
|
||||
@ -32,16 +33,16 @@ class MockPubSub extends PubSubBaseProtocol {
|
||||
return cborg.decode(bytes)
|
||||
}
|
||||
|
||||
encodeRpc (rpc: PubSubRPC): Uint8Array {
|
||||
return cborg.encode(rpc)
|
||||
encodeRpc (rpc: PubSubRPC): Uint8ArrayList {
|
||||
return new Uint8ArrayList(cborg.encode(rpc))
|
||||
}
|
||||
|
||||
decodeMessage (bytes: Uint8Array): PubSubRPCMessage {
|
||||
return cborg.decode(bytes)
|
||||
}
|
||||
|
||||
encodeMessage (rpc: PubSubRPCMessage): Uint8Array {
|
||||
return cborg.encode(rpc)
|
||||
encodeMessage (rpc: PubSubRPCMessage): Uint8ArrayList {
|
||||
return new Uint8ArrayList(cborg.encode(rpc))
|
||||
}
|
||||
|
||||
async publishMessage (from: PeerId, message: Message): Promise<PublishResult> {
|
||||
|
@ -16,7 +16,7 @@ import type Sinon from 'sinon'
|
||||
import { createRelayOptions, createNodeOptions } from './utils.js'
|
||||
import { protocols } from '@multiformats/multiaddr'
|
||||
|
||||
async function usingAsRelay (node: Libp2pNode, relay: Libp2pNode, opts?: PWaitForOptions) {
|
||||
async function usingAsRelay (node: Libp2pNode, relay: Libp2pNode, opts?: PWaitForOptions<boolean>) {
|
||||
// Wait for peer to be used as a relay
|
||||
await pWaitFor(() => {
|
||||
for (const addr of node.getMultiaddrs()) {
|
||||
|
Reference in New Issue
Block a user