holepunch-hop 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/bees.js +8 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "holepunch-hop",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "data interface to HOP",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/bees.js CHANGED
@@ -115,6 +115,12 @@ class HyperBee extends EventEmitter {
115
115
  })
116
116
  await this.dbBentocues.ready()
117
117
  beePubkeys.push({store:'bentocues', privacy: 'public', pubkey: b4a.toString(core7.key, 'hex')})
118
+ // open the cues library
119
+ const discoveryCues = this.swarm.join(this.dbBentocues.discoveryKey)
120
+ // Only display the key once the Hyperbee has been announced to the DHT
121
+ discoveryCues.flushed().then(() => {
122
+ console.log('cues library open')
123
+ })
118
124
 
119
125
  const core13 = this.store.get({ name: 'bentomodels' })
120
126
  this.dbBentomodels = new Hyperbee(core13, {
@@ -988,7 +994,7 @@ class HyperBee extends EventEmitter {
988
994
  saveRepliatePubLibary = async function (data) {
989
995
  // add board nxp
990
996
  let updatePubLib = this.repPublicHolder[data.discoverykey]
991
- if (data.library === 'publiclibrary') {
997
+ if (data.library === 'public') {
992
998
  await this.updatePublicLibrary(updatePubLib)
993
999
  } else if (data.library === 'cues') {
994
1000
  await this.updateCuesLibrary(updatePubLib)
@@ -1039,7 +1045,7 @@ class HyperBee extends EventEmitter {
1039
1045
  */
1040
1046
  updateCuesLibrary = async function (libContracts) {
1041
1047
  // save entries required
1042
- const batch = this.dbPublicLibrary.batch()
1048
+ const batch = this.dbBentocues.batch()
1043
1049
  for (const { key, value } of libContracts) {
1044
1050
  await batch.put(key, JSON.parse(value))
1045
1051
  }