Skip to content

Latest commit

 

History

History
42 lines (27 loc) · 1.01 KB

v0.38-v0.39.md

File metadata and controls

42 lines (27 loc) · 1.01 KB

Migrating to libp2p@39

A migration guide for refactoring your application code from libp2p v0.38.x to v0.39.0.

Table of Contents

LoadKeychain

Libp2p had a loadKeychain method that should be invoked after the node has been created which reads keychain config from the configured datastore. The default datastore is in-memory and is transient in nature so it's possible you've never had to use this.

It was necessary to have this be a separate method as it it async which means it cannot be invoked in a constructor.

Since libp2p uses an async factory function, the keychain can be loaded in the factory so the extra method is redundant.

Before

import { createLibp2p } from 'libp2p'

const node = await createLibp2p({
  // ... config
})

await node.loadKeychain()
await node.start()
// ...

After

import { createLibp2p } from 'libp2p'

const node = await createLibp2p({
  // ... config
})

await node.start()
// ...