edge-currency-plugins 2.0.3 → 2.0.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.
@@ -23,6 +23,7 @@ var _baselet = require('baselet');
23
23
 
24
24
 
25
25
 
26
+
26
27
  var _baselet3 = require('./Models/baselet');
27
28
 
28
29
 
@@ -69,30 +70,30 @@ var _baselet3 = require('./Models/baselet');
69
70
  /* Tables */
70
71
  const addressBases = {
71
72
  addressByScriptPubkey: await _baselet.createOrOpenHashBase.call(void 0,
72
- config.disklet,
73
+ config.storage,
73
74
  _baselet3.addressByScriptPubkeyOptions
74
75
  ),
75
76
  scriptPubkeyByPath: await _baselet.createOrOpenCountBase.call(void 0,
76
- config.disklet,
77
+ config.storage,
77
78
  _baselet3.scriptPubkeyByPathOptions
78
79
  ),
79
80
  lastUsedByFormatPath: await _baselet.createOrOpenHashBase.call(void 0,
80
- config.disklet,
81
+ config.storage,
81
82
  _baselet3.lastUsedByFormatPathOptions
82
83
  )
83
84
  }
84
85
  const txBases = {
85
- txById: await _baselet.createOrOpenHashBase.call(void 0, config.disklet, _baselet3.txByIdOptions),
86
+ txById: await _baselet.createOrOpenHashBase.call(void 0, config.storage, _baselet3.txByIdOptions),
86
87
  txIdsByBlockHeight: await _baselet.createOrOpenRangeBase.call(void 0,
87
- config.disklet,
88
+ config.storage,
88
89
  _baselet3.txIdsByBlockHeightOptions
89
90
  ),
90
- txIdsByDate: await _baselet.createOrOpenRangeBase.call(void 0, config.disklet, _baselet3.txIdsByDateOptions)
91
+ txIdsByDate: await _baselet.createOrOpenRangeBase.call(void 0, config.storage, _baselet3.txIdsByDateOptions)
91
92
  }
92
93
  const utxoBases = {
93
- utxoById: await _baselet.createOrOpenHashBase.call(void 0, config.disklet, _baselet3.utxoByIdOptions),
94
+ utxoById: await _baselet.createOrOpenHashBase.call(void 0, config.storage, _baselet3.utxoByIdOptions),
94
95
  utxoIdsByScriptPubkey: await _baselet.createOrOpenHashBase.call(void 0,
95
- config.disklet,
96
+ config.storage,
96
97
  _baselet3.utxoIdsByScriptPubkeyOptions
97
98
  )
98
99
  }
@@ -2,6 +2,7 @@
2
2
  var _biggystring = require('biggystring'); var bs = _interopRequireWildcard(_biggystring);
3
3
  var _disklet = require('disklet');
4
4
 
5
+ var _memlet = require('memlet');
5
6
 
6
7
  var _unixTime = require('../../../util/unixTime');
7
8
 
@@ -111,8 +112,9 @@ const BASELET_DIR = 'tables'
111
112
  config
112
113
  ) {
113
114
  const disklet = _disklet.navigateDisklet.call(void 0, config.disklet, BASELET_DIR)
114
- let baselets = await _makeBaselets.makeBaselets.call(void 0, { disklet }).catch(async error => {
115
- await disklet.delete('.')
115
+ let memlet = _memlet.makeMemlet.call(void 0, disklet)
116
+ let baselets = await _makeBaselets.makeBaselets.call(void 0, { storage: memlet }).catch(async error => {
117
+ await memlet.delete('.')
116
118
  throw error
117
119
  })
118
120
 
@@ -147,11 +149,11 @@ const BASELET_DIR = 'tables'
147
149
 
148
150
  const processor = {
149
151
  async clearAll() {
152
+ await memlet.onFlush.next().value
150
153
  await _baselet.clearMemletCache.call(void 0, )
151
- // why is this delay needed?
152
- await new Promise(resolve => setTimeout(resolve, 0))
153
154
  await disklet.delete('.')
154
- baselets = await _makeBaselets.makeBaselets.call(void 0, { disklet })
155
+ memlet = _memlet.makeMemlet.call(void 0, disklet)
156
+ baselets = await _makeBaselets.makeBaselets.call(void 0, { storage: memlet })
155
157
  },
156
158
 
157
159
  async dumpData() {
@@ -1,7 +1,8 @@
1
1
  import { Disklet } from 'disklet';
2
+ import { Memlet } from 'memlet';
2
3
  import { AddressByScriptPubkeyBaselet, LastUsedByFormatPathBaselet, ScriptPubkeyByPathBaselet, TxByIdBaselet, TxIdByBlockHeightBaselet, TxIdByDateBaselet, UtxoByIdBaselet, UtxoIdsByScriptPubkeyBaselet } from './Models/baselet';
3
4
  interface MakeBaseletsConfig {
4
- disklet: Disklet;
5
+ storage: Disklet | Memlet;
5
6
  }
6
7
  declare type Executor<BaseletName extends keyof AllBaselets, T> = (tables: AllBaselets[BaseletName]) => Promise<T>;
7
8
  interface AllBaselets {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-currency-plugins",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Edge currency plugins to fetch and process wallet accounts, balances and transactions.",
5
5
  "repository": "https://github.com/EdgeApp/edge-currency-plugins",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "altcoin-js": "https://github.com/EdgeApp/altcoin-js.git#master",
37
37
  "async-mutex": "^0.2.6",
38
- "baselet": "^0.2.3",
38
+ "baselet": "^0.2.4",
39
39
  "biggystring": "^4.0.0",
40
40
  "bip32": "^2.0.5",
41
41
  "bip32grs": "^2.0.5",