Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
fix: update to latest interfaces (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored Feb 12, 2022
1 parent 3b14885 commit 4322c1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/compat/querier.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { EventEmitter } from '@libp2p/interfaces'
import MDNS from 'multicast-dns'
import { Multiaddr } from '@multiformats/multiaddr'
import { PeerId } from '@libp2p/peer-id'
import type { PeerId } from '@libp2p/interfaces/peer-id'
import { logger } from '@libp2p/logger'
import { SERVICE_TAG_LOCAL, MULTICAST_IP, MULTICAST_PORT } from './constants.js'
import { base58btc } from 'multiformats/bases/base58'
import { peerIdFromString } from '@libp2p/peer-id'
import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interfaces/peer-discovery'
import type { ResponsePacket } from 'multicast-dns'
import type { RemoteInfo } from 'dgram'
Expand Down Expand Up @@ -114,7 +115,7 @@ export class Querier extends EventEmitter<PeerDiscoveryEvents> implements PeerDi

let peerId
try {
peerId = PeerId.fromString(peerIdStr)
peerId = peerIdFromString(peerIdStr)
} catch (err) {
return log('failed to create peer ID from TXT record data', peerIdStr, err)
}
Expand Down
5 changes: 3 additions & 2 deletions src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import os from 'os'
import { logger } from '@libp2p/logger'
import { Multiaddr, MultiaddrObject } from '@multiformats/multiaddr'
import { base58btc } from 'multiformats/bases/base58'
import { PeerId } from '@libp2p/peer-id'
import { peerIdFromString } from '@libp2p/peer-id'
import type { PeerId } from '@libp2p/interfaces/peer-id'
import type { PeerData } from '@libp2p/interfaces/peer-data'
import type { MulticastDNS, ResponsePacket, QueryPacket } from 'multicast-dns'
import type { SrvAnswer, StringAnswer, TxtAnswer, Answer } from 'dns-packet'
Expand Down Expand Up @@ -88,7 +89,7 @@ export function gotResponse (rsp: ResponsePacket, localPeerId: PeerId, serviceTa
log('peer found -', b58Id)

return {
id: PeerId.fromString(b58Id),
id: peerIdFromString(b58Id),
multiaddrs,
protocols: []
}
Expand Down

0 comments on commit 4322c1e

Please sign in to comment.