edge-currency-plugins 2.0.2 → 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.
|
|
73
|
+
config.storage,
|
|
73
74
|
_baselet3.addressByScriptPubkeyOptions
|
|
74
75
|
),
|
|
75
76
|
scriptPubkeyByPath: await _baselet.createOrOpenCountBase.call(void 0,
|
|
76
|
-
config.
|
|
77
|
+
config.storage,
|
|
77
78
|
_baselet3.scriptPubkeyByPathOptions
|
|
78
79
|
),
|
|
79
80
|
lastUsedByFormatPath: await _baselet.createOrOpenHashBase.call(void 0,
|
|
80
|
-
config.
|
|
81
|
+
config.storage,
|
|
81
82
|
_baselet3.lastUsedByFormatPathOptions
|
|
82
83
|
)
|
|
83
84
|
}
|
|
84
85
|
const txBases = {
|
|
85
|
-
txById: await _baselet.createOrOpenHashBase.call(void 0, config.
|
|
86
|
+
txById: await _baselet.createOrOpenHashBase.call(void 0, config.storage, _baselet3.txByIdOptions),
|
|
86
87
|
txIdsByBlockHeight: await _baselet.createOrOpenRangeBase.call(void 0,
|
|
87
|
-
config.
|
|
88
|
+
config.storage,
|
|
88
89
|
_baselet3.txIdsByBlockHeightOptions
|
|
89
90
|
),
|
|
90
|
-
txIdsByDate: await _baselet.createOrOpenRangeBase.call(void 0, config.
|
|
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.
|
|
94
|
+
utxoById: await _baselet.createOrOpenHashBase.call(void 0, config.storage, _baselet3.utxoByIdOptions),
|
|
94
95
|
utxoIdsByScriptPubkey: await _baselet.createOrOpenHashBase.call(void 0,
|
|
95
|
-
config.
|
|
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
|
|
115
|
-
|
|
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
|
-
|
|
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() {
|
|
@@ -15,6 +15,7 @@ var _disklet = require('disklet');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
|
|
18
19
|
var _edgecorejs = require('edge-core-js');
|
|
19
20
|
|
|
20
21
|
var _filterUndefined = require('../../../util/filterUndefined');
|
|
@@ -178,7 +179,12 @@ var _utils = require('./utils');
|
|
|
178
179
|
)
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
|
-
const id = await engineState.broadcastTx(transaction)
|
|
182
|
+
const id = await engineState.broadcastTx(transaction).catch(err => {
|
|
183
|
+
if (String(err).includes('Error: Blockbook Error: -26: dust')) {
|
|
184
|
+
throw new (0, _edgecorejs.DustSpendError)()
|
|
185
|
+
}
|
|
186
|
+
throw err
|
|
187
|
+
})
|
|
182
188
|
if (id !== transaction.txid) {
|
|
183
189
|
throw new Error('broadcast response txid does not match original')
|
|
184
190
|
}
|
|
@@ -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
|
-
|
|
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
|
+
"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.
|
|
38
|
+
"baselet": "^0.2.4",
|
|
39
39
|
"biggystring": "^4.0.0",
|
|
40
40
|
"bip32": "^2.0.5",
|
|
41
41
|
"bip32grs": "^2.0.5",
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"bs58smartcheck": "^2.0.4",
|
|
49
49
|
"cleaners": "^0.3.12",
|
|
50
50
|
"disklet": "^0.4.5",
|
|
51
|
-
"edge-core-js": "^0.19.48",
|
|
52
51
|
"edge-sync-client": "^0.2.7",
|
|
53
52
|
"memlet": "^0.1.7",
|
|
54
53
|
"uri-js": "^4.4.0",
|
|
@@ -73,6 +72,7 @@
|
|
|
73
72
|
"@typescript-eslint/parser": "^4.8.2",
|
|
74
73
|
"chai": "^4.2.0",
|
|
75
74
|
"chai-as-promised": "^7.1.1",
|
|
75
|
+
"edge-core-js": "^0.19.48",
|
|
76
76
|
"eslint": "^7.14.0",
|
|
77
77
|
"eslint-config-standard-kit": "0.15.1",
|
|
78
78
|
"eslint-plugin-import": "^2.22.1",
|