@exodus/bitcoin-api 2.6.1 → 2.6.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-api",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
4
4
|
"description": "Exodus bitcoin-api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@exodus/asset-lib": "^3.7.2",
|
|
22
|
-
"@exodus/basic-utils": "^2.0
|
|
22
|
+
"@exodus/basic-utils": "^2.1.0",
|
|
23
23
|
"@exodus/bip-schnorr": "0.6.6-fork-1",
|
|
24
24
|
"@exodus/bip44-constants": "^195.0.0",
|
|
25
|
-
"@exodus/models": "^
|
|
25
|
+
"@exodus/models": "^10.1.0",
|
|
26
26
|
"@exodus/secp256k1": "4.0.2-exodus.0",
|
|
27
27
|
"@exodus/simple-retry": "0.0.6",
|
|
28
28
|
"@exodus/timer": "^1.0.0",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"@scure/btc-signer": "^1.1.0",
|
|
44
44
|
"jest-when": "^3.5.1"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "49877e9351bd709a6bc5ea69cb609dff70777e4c"
|
|
47
47
|
}
|
|
@@ -61,6 +61,7 @@ export class BitcoinMonitorScanner {
|
|
|
61
61
|
|
|
62
62
|
const storedUtxos = getUtxos({ asset, accountState })
|
|
63
63
|
const storedOrdinalUtxos = getOrdinalsUtxos({ asset, accountState })
|
|
64
|
+
const ordinalAddress = await this.getOrdinalAddress({ walletAccount })
|
|
64
65
|
|
|
65
66
|
const currentStoredUtxos = storedUtxos.union(storedOrdinalUtxos)
|
|
66
67
|
|
|
@@ -236,6 +237,18 @@ export class BitcoinMonitorScanner {
|
|
|
236
237
|
|
|
237
238
|
const addresses = await aggregateAddresses(chainObjects)
|
|
238
239
|
|
|
240
|
+
if (fetchCount === 0) {
|
|
241
|
+
// in compatibility mode, the receive address could be different
|
|
242
|
+
const receiveAddress = await this.#assetClientInterface.getReceiveAddressObject({
|
|
243
|
+
assetName,
|
|
244
|
+
walletAccount,
|
|
245
|
+
})
|
|
246
|
+
if (!addresses.includes(receiveAddress.toString())) {
|
|
247
|
+
addresses.push(receiveAddress.toString())
|
|
248
|
+
addrMap[receiveAddress.toString()] = receiveAddress
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
239
252
|
const txs = await fetchAllTxs(addresses)
|
|
240
253
|
if (txs.length === 0) break
|
|
241
254
|
allTxs = allTxs.concat(txs)
|
|
@@ -253,11 +266,14 @@ export class BitcoinMonitorScanner {
|
|
|
253
266
|
// this is a used address, we need to update the chain
|
|
254
267
|
const pd = address.meta.path.split('/')
|
|
255
268
|
const metaChainIndex = parseInt(pd[1])
|
|
256
|
-
const metaAddressIndex = parseInt(pd[2])
|
|
269
|
+
const metaAddressIndex = pd[2] ? parseInt(pd[2]) : undefined // compatibility, it could shorter eg. m/0, not m/0/0
|
|
257
270
|
const addressString = String(address)
|
|
258
271
|
const purposeToUpdate = purposeMap[addressString]
|
|
259
272
|
|
|
260
|
-
if (
|
|
273
|
+
if (
|
|
274
|
+
metaAddressIndex === undefined ||
|
|
275
|
+
(metaChainIndex === this.#ordinalChainIndex && this.#ordinalChainIndex > 1)
|
|
276
|
+
) {
|
|
261
277
|
return
|
|
262
278
|
}
|
|
263
279
|
|
|
@@ -342,15 +358,19 @@ export class BitcoinMonitorScanner {
|
|
|
342
358
|
vinTxids[`${vin.txid}-${vin.vout}`] = true
|
|
343
359
|
from.push(vin.addr)
|
|
344
360
|
|
|
345
|
-
|
|
361
|
+
const address = addrMap[vin.addr]
|
|
362
|
+
if (!address) return
|
|
346
363
|
// it came from us...
|
|
347
364
|
txLogItem.coinAmount = txLogItem.coinAmount.sub(currency.defaultUnit(vin.value))
|
|
348
365
|
isSent = true
|
|
349
366
|
txLogItem.data.sent = []
|
|
367
|
+
if (ordinalAddress && address.toString() === ordinalAddress.toString()) {
|
|
368
|
+
txLogItem.data.isInscriptionSent = true
|
|
369
|
+
}
|
|
350
370
|
|
|
351
371
|
// this is only used to exclude the utxos in the reducer which is why we don't care about the other fields
|
|
352
372
|
utxosToRemove.push({
|
|
353
|
-
address:
|
|
373
|
+
address: address,
|
|
354
374
|
txId: vin.txid,
|
|
355
375
|
vout: vin.vout,
|
|
356
376
|
value: currency.defaultUnit(vin.value || 0),
|
|
@@ -415,6 +435,10 @@ export class BitcoinMonitorScanner {
|
|
|
415
435
|
txLogItem.data.changeAddress = address
|
|
416
436
|
}
|
|
417
437
|
|
|
438
|
+
if (ordinalAddress && address.toString() === ordinalAddress.toString()) {
|
|
439
|
+
txLogItem.data.isInscriptionReceived = true
|
|
440
|
+
}
|
|
441
|
+
|
|
418
442
|
// it was sent to us...
|
|
419
443
|
let val = currency.defaultUnit(vout.value)
|
|
420
444
|
txLogItem.coinAmount = txLogItem.coinAmount.add(val)
|
|
@@ -522,7 +546,7 @@ export class BitcoinMonitorScanner {
|
|
|
522
546
|
const utxosData = utxoCol
|
|
523
547
|
? partitionUtxos({
|
|
524
548
|
allUtxos: utxoCol,
|
|
525
|
-
ordinalAddress
|
|
549
|
+
ordinalAddress,
|
|
526
550
|
})
|
|
527
551
|
: {}
|
|
528
552
|
|
|
@@ -143,7 +143,7 @@ export const signTxFactory = ({ assetName, resolvePurpose, keys, coinInfo, netwo
|
|
|
143
143
|
// dApps request to sign only specific transaction inputs.
|
|
144
144
|
if (!inputInfo) continue
|
|
145
145
|
const { address, sigHash } = inputInfo
|
|
146
|
-
const sigHashTypes = sigHash ? [sigHash] : undefined
|
|
146
|
+
const sigHashTypes = sigHash !== undefined ? [sigHash || Transaction.SIGHASH_ALL] : undefined
|
|
147
147
|
const { key, purpose, publicKey } = getKeyAndPurpose(address)
|
|
148
148
|
|
|
149
149
|
if (purpose === 49) {
|