edge-currency-plugins 1.3.1 → 1.3.3
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.
- package/lib/common/utxobased/db/makeProcessor.js +6 -3
- package/lib/common/utxobased/db/types.js +0 -1
- package/lib/common/utxobased/engine/makeUtxoEngineState.js +8 -13
- package/lib/src/common/utxobased/db/makeBaselets.d.ts +4 -4
- package/lib/src/common/utxobased/db/types.d.ts +1 -1
- package/package.json +3 -3
|
@@ -111,7 +111,10 @@ const BASELET_DIR = 'tables'
|
|
|
111
111
|
config
|
|
112
112
|
) {
|
|
113
113
|
const disklet = _disklet.navigateDisklet.call(void 0, config.disklet, BASELET_DIR)
|
|
114
|
-
let baselets = await _makeBaselets.makeBaselets.call(void 0, { disklet })
|
|
114
|
+
let baselets = await _makeBaselets.makeBaselets.call(void 0, { disklet }).catch(async error => {
|
|
115
|
+
await disklet.delete('.')
|
|
116
|
+
throw error
|
|
117
|
+
})
|
|
115
118
|
|
|
116
119
|
/**
|
|
117
120
|
* Calculates the transaction value supplied (negative) or received (positive). In order to calculate
|
|
@@ -453,8 +456,8 @@ const BASELET_DIR = 'tables'
|
|
|
453
456
|
existingAddress.lastTouched = address.lastTouched
|
|
454
457
|
}
|
|
455
458
|
|
|
456
|
-
// Only update the balance field if
|
|
457
|
-
if (address.balance
|
|
459
|
+
// Only update the balance field if we have a value here
|
|
460
|
+
if (address.balance != null) {
|
|
458
461
|
existingAddress.balance = address.balance
|
|
459
462
|
}
|
|
460
463
|
|
|
@@ -301,10 +301,12 @@ var _utils3 = require('./utils');
|
|
|
301
301
|
scriptPubkey: processorAddress.scriptPubkey
|
|
302
302
|
})
|
|
303
303
|
addressesToSubscribe.add(address)
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
304
|
+
if (processorAddress.balance != null) {
|
|
305
|
+
addressBalanceChanges.push({
|
|
306
|
+
scriptPubkey: processorAddress.scriptPubkey,
|
|
307
|
+
balance: processorAddress.balance
|
|
308
|
+
})
|
|
309
|
+
}
|
|
308
310
|
}
|
|
309
311
|
addToAddressSubscribeCache(commonArgs.taskCache, addressesToSubscribe, {
|
|
310
312
|
format,
|
|
@@ -1186,16 +1188,9 @@ const internalGetFreshAddress = async (
|
|
|
1186
1188
|
path.addressIndex = forceIndex
|
|
1187
1189
|
}
|
|
1188
1190
|
|
|
1189
|
-
let nativeBalance = '0'
|
|
1190
|
-
let scriptPubkey
|
|
1191
1191
|
const iAddress = await processor.fetchAddress(path)
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
scriptPubkey = iAddress.scriptPubkey
|
|
1195
|
-
} else {
|
|
1196
|
-
const scriptPubKeyRet = await walletTools.getScriptPubkey(path)
|
|
1197
|
-
scriptPubkey = scriptPubKeyRet.scriptPubkey
|
|
1198
|
-
}
|
|
1192
|
+
const nativeBalance = _nullishCoalesce(_optionalChain([iAddress, 'optionalAccess', _2 => _2.balance]), () => ( '0'))
|
|
1193
|
+
const { scriptPubkey } = await _asyncNullishCoalesce(iAddress, async () => ( (await walletTools.getScriptPubkey(path))))
|
|
1199
1194
|
|
|
1200
1195
|
if (scriptPubkey == null) {
|
|
1201
1196
|
throw new Error('Unknown address path')
|
|
@@ -3,7 +3,7 @@ import { AddressByScriptPubkeyBaselet, LastUsedByFormatPathBaselet, ScriptPubkey
|
|
|
3
3
|
interface MakeBaseletsConfig {
|
|
4
4
|
disklet: Disklet;
|
|
5
5
|
}
|
|
6
|
-
declare type Executor<BaseletName extends keyof AllBaselets> = (tables: AllBaselets[BaseletName]) => Promise<
|
|
6
|
+
declare type Executor<BaseletName extends keyof AllBaselets, T> = (tables: AllBaselets[BaseletName]) => Promise<T>;
|
|
7
7
|
interface AllBaselets {
|
|
8
8
|
address: AddressBaselets;
|
|
9
9
|
tx: TransactionBaselets;
|
|
@@ -24,9 +24,9 @@ interface UtxoBaselets {
|
|
|
24
24
|
utxoIdsByScriptPubkey: UtxoIdsByScriptPubkeyBaselet;
|
|
25
25
|
}
|
|
26
26
|
export interface Baselets {
|
|
27
|
-
address: <
|
|
28
|
-
tx: <
|
|
29
|
-
utxo: <
|
|
27
|
+
address: <T>(fn: Executor<'address', T>) => Promise<T>;
|
|
28
|
+
tx: <T>(fn: Executor<'tx', T>) => Promise<T>;
|
|
29
|
+
utxo: <T>(fn: Executor<'utxo', T>) => Promise<T>;
|
|
30
30
|
all: AddressBaselets & TransactionBaselets & UtxoBaselets;
|
|
31
31
|
}
|
|
32
32
|
export declare const makeBaselets: (config: MakeBaseletsConfig) => Promise<Baselets>;
|
|
@@ -9,7 +9,7 @@ export interface IAddress {
|
|
|
9
9
|
lastQuery: number;
|
|
10
10
|
lastTouched: number;
|
|
11
11
|
used: boolean;
|
|
12
|
-
balance
|
|
12
|
+
balance?: string;
|
|
13
13
|
}
|
|
14
14
|
export declare const makeIAddress: (addressFields: SoftPick<IAddress, 'scriptPubkey'>) => IAddress;
|
|
15
15
|
export interface IUTXO {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edge-currency-plugins",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
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.3",
|
|
39
39
|
"biggystring": "^4.0.0",
|
|
40
40
|
"bip32": "^2.0.5",
|
|
41
41
|
"bip32grs": "^2.0.5",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"disklet": "^0.4.5",
|
|
51
51
|
"edge-core-js": "^0.19.33",
|
|
52
52
|
"edge-sync-client": "^0.2.7",
|
|
53
|
-
"memlet": "^0.1.
|
|
53
|
+
"memlet": "^0.1.7",
|
|
54
54
|
"uri-js": "^4.4.0",
|
|
55
55
|
"url-parse": "^1.5.2",
|
|
56
56
|
"wif-smart": "^2.0.0",
|