Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

fix: update libp2p interfaces #109

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ipns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@
},
"dependencies": {
"@libp2p/interface": "^0.1.2",
"@libp2p/kad-dht": "^10.0.11",
"@libp2p/logger": "^3.0.2",
"@libp2p/peer-id": "^3.0.2",
"@libp2p/record": "^3.0.0",
"hashlru": "^2.3.0",
"interface-datastore": "^8.0.0",
"ipns": "^7.0.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/ipns/src/routing/local-store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Libp2pRecord } from '@libp2p/record'
import { Record } from '@libp2p/kad-dht'
import { type Datastore, Key } from 'interface-datastore'
import { CustomProgressEvent, type ProgressEvent } from 'progress-events'
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
Expand Down Expand Up @@ -30,7 +30,7 @@ export function localStore (datastore: Datastore): LocalStore {
const key = dhtRoutingKey(routingKey)

// Marshal to libp2p record as the DHT does
const record = new Libp2pRecord(routingKey, marshalledRecord, new Date())
const record = new Record(routingKey, marshalledRecord, new Date())

options.onProgress?.(new CustomProgressEvent('ipns:routing:datastore:put'))
await datastore.put(key, record.serialize(), options)
Expand All @@ -47,7 +47,7 @@ export function localStore (datastore: Datastore): LocalStore {
const buf = await datastore.get(key, options)

// Unmarshal libp2p record as the DHT does
const record = Libp2pRecord.deserialize(buf)
const record = Record.deserialize(buf)

return record.value
} catch (err: any) {
Expand Down
4 changes: 2 additions & 2 deletions packages/ipns/test/resolve.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */

import { Record } from '@libp2p/kad-dht'
import { createEd25519PeerId } from '@libp2p/peer-id-factory'
import { Libp2pRecord } from '@libp2p/record'
import { expect } from 'aegir/chai'
import { MemoryDatastore } from 'datastore-core'
import { type Datastore, Key } from 'interface-datastore'
Expand Down Expand Up @@ -141,7 +141,7 @@ describe('resolve', () => {
expect(result.toString()).to.equal(cid.toV1().toString(), 'incorrect record resolved')

const cached = await datastore.get(dhtKey)
const record = Libp2pRecord.deserialize(cached)
const record = Record.deserialize(cached)

// should have cached the updated record
expect(record.value).to.equalBytes(marshalledRecordB)
Expand Down