mirror of https://github.com/waku-org/js-waku.git
parent
dbab0cc582
commit
6cb92dd4b9
|
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Changed
|
||||
- **Breaking**: Auto select peer if none provided for store and light push protocols.
|
||||
- Upgrade to `libp2p@0.31.7` and `libp2p-gossipsub@0.10.0` to avoid `TextEncoder` errors in ReactJS tests.
|
||||
|
||||
## [0.7.0] - 2021-06-15
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -59,8 +59,8 @@
|
|||
"debug": "^4.3.1",
|
||||
"it-concat": "^2.0.0",
|
||||
"it-length-prefixed": "^5.0.2",
|
||||
"libp2p": "^0.31.0",
|
||||
"libp2p-gossipsub": "^0.9.0",
|
||||
"libp2p": "^0.31.7",
|
||||
"libp2p-gossipsub": "^0.10.0",
|
||||
"libp2p-mplex": "^0.10.3",
|
||||
"libp2p-noise": "^3.0.0",
|
||||
"libp2p-tcp": "^0.15.4",
|
||||
|
|
|
@ -71,7 +71,7 @@ export class Waku {
|
|||
lightPush: WakuLightPush
|
||||
) {
|
||||
this.libp2p = libp2p;
|
||||
this.relay = (libp2p.pubsub as unknown) as WakuRelay;
|
||||
this.relay = libp2p.pubsub as unknown as WakuRelay;
|
||||
this.store = store;
|
||||
this.lightPush = lightPush;
|
||||
this.keepAliveTimers = {};
|
||||
|
@ -154,9 +154,7 @@ export class Waku {
|
|||
*
|
||||
* @param peer The peer to dial
|
||||
*/
|
||||
async dial(
|
||||
peer: PeerId | Multiaddr | string
|
||||
): Promise<{
|
||||
async dial(peer: PeerId | Multiaddr | string): Promise<{
|
||||
stream: import('libp2p-interfaces/src/stream-muxer/types').MuxedStream;
|
||||
protocol: string;
|
||||
}> {
|
||||
|
|
|
@ -58,12 +58,10 @@ describe('Waku Relay', () => {
|
|||
});
|
||||
|
||||
it('Subscribe', async function () {
|
||||
const subscribers1 = waku1.libp2p.pubsub.getSubscribers(
|
||||
DefaultPubsubTopic
|
||||
);
|
||||
const subscribers2 = waku2.libp2p.pubsub.getSubscribers(
|
||||
DefaultPubsubTopic
|
||||
);
|
||||
const subscribers1 =
|
||||
waku1.libp2p.pubsub.getSubscribers(DefaultPubsubTopic);
|
||||
const subscribers2 =
|
||||
waku2.libp2p.pubsub.getSubscribers(DefaultPubsubTopic);
|
||||
|
||||
expect(subscribers1).to.contain(waku2.libp2p.peerId.toB58String());
|
||||
expect(subscribers2).to.contain(waku1.libp2p.peerId.toB58String());
|
||||
|
@ -267,9 +265,8 @@ describe('Waku Relay', () => {
|
|||
|
||||
it('nim subscribes to js', async function () {
|
||||
const nimPeerId = await nimWaku.getPeerId();
|
||||
const subscribers = waku.libp2p.pubsub.getSubscribers(
|
||||
DefaultPubsubTopic
|
||||
);
|
||||
const subscribers =
|
||||
waku.libp2p.pubsub.getSubscribers(DefaultPubsubTopic);
|
||||
|
||||
expect(subscribers).to.contain(nimPeerId.toB58String());
|
||||
});
|
||||
|
|
|
@ -456,9 +456,8 @@ export class WakuRelay extends Gossipsub {
|
|||
const peerId = PeerId.createFromB58String(p);
|
||||
px.push({
|
||||
peerID: peerId.toBytes(),
|
||||
signedPeerRecord: this._libp2p.peerStore.addressBook.getRawEnvelope(
|
||||
peerId
|
||||
),
|
||||
signedPeerRecord:
|
||||
this._libp2p.peerStore.addressBook.getRawEnvelope(peerId),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -132,8 +132,8 @@ const btoa: (bin: string) => string =
|
|||
((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
const bin: string[] = [];
|
||||
for (let i = 0; i < arr.byteLength; ++i) {
|
||||
bin.push(String.fromCharCode(arr[i]));
|
||||
for (const byte of arr) {
|
||||
bin.push(String.fromCharCode(byte));
|
||||
}
|
||||
return btoa(bin.join(''));
|
||||
}
|
||||
|
|
|
@ -150,8 +150,8 @@ const btoa: (bin: string) => string =
|
|||
((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
const bin: string[] = [];
|
||||
for (let i = 0; i < arr.byteLength; ++i) {
|
||||
bin.push(String.fromCharCode(arr[i]));
|
||||
for (const byte of arr) {
|
||||
bin.push(String.fromCharCode(byte));
|
||||
}
|
||||
return btoa(bin.join(''));
|
||||
}
|
||||
|
|
|
@ -660,8 +660,8 @@ const btoa: (bin: string) => string =
|
|||
((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
const bin: string[] = [];
|
||||
for (let i = 0; i < arr.byteLength; ++i) {
|
||||
bin.push(String.fromCharCode(arr[i]));
|
||||
for (const byte of arr) {
|
||||
bin.push(String.fromCharCode(byte));
|
||||
}
|
||||
return btoa(bin.join(''));
|
||||
}
|
||||
|
|
|
@ -30,30 +30,8 @@ it('Convert utf-8 string to hex', function () {
|
|||
|
||||
it('Convert buffer to hex', function () {
|
||||
const buf = Uint8Array.from([
|
||||
0x54,
|
||||
0x68,
|
||||
0x69,
|
||||
0x73,
|
||||
0x20,
|
||||
0x69,
|
||||
0x73,
|
||||
0x20,
|
||||
0x61,
|
||||
0x6e,
|
||||
0x20,
|
||||
0x75,
|
||||
0x74,
|
||||
0x66,
|
||||
0x2d,
|
||||
0x38,
|
||||
0x20,
|
||||
0x73,
|
||||
0x74,
|
||||
0x72,
|
||||
0x69,
|
||||
0x6e,
|
||||
0x67,
|
||||
0x2e,
|
||||
0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x75,
|
||||
0x74, 0x66, 0x2d, 0x38, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e,
|
||||
]);
|
||||
const expected = '5468697320697320616e207574662d3820737472696e672e';
|
||||
|
||||
|
|
Loading…
Reference in New Issue