@exodus/bitcoin-api 2.6.5 → 2.6.7

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.5",
3
+ "version": "2.6.7",
4
4
  "description": "Exodus bitcoin-api",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -43,5 +43,5 @@
43
43
  "@scure/btc-signer": "^1.1.0",
44
44
  "jest-when": "^3.5.1"
45
45
  },
46
- "gitHead": "c8877a87f29d0c4c27b18937a9ec57c81be223dd"
46
+ "gitHead": "04954f04a1246db5d0cc3fd848ef23a91df2b623"
47
47
  }
@@ -57,12 +57,11 @@ export default class InsightAPIClient {
57
57
  return !!peerStatus.connected
58
58
  }
59
59
 
60
- /*
61
- async fetchBalance (address) {
62
- const addrData = await this.fetchAddress(address)
63
- return (addrData.balanceSat + addrData.unconfirmedBalanceSat) | 0
60
+ async fetchBalance(address) {
61
+ const encodedAddress = encodeURIComponent(address)
62
+ const url = urlJoin(this._baseURL, `/balance/${encodedAddress}`)
63
+ return fetchJson(url)
64
64
  }
65
- */
66
65
 
67
66
  async fetchBlockHeight() {
68
67
  const url = urlJoin(this._baseURL, '/status')
@@ -505,8 +505,8 @@ export class BitcoinMonitorScanner {
505
505
  let utxoCol = UtxoCollection.fromArray(utxos, { currency })
506
506
 
507
507
  const utxosToRemoveCol = UtxoCollection.fromArray(utxosToRemove, { currency })
508
- // if something else can update currentStoredUtxos in the meantime, we probably need to grab it from state again
509
- utxoCol = currentStoredUtxos.union(utxoCol).difference(utxosToRemoveCol)
508
+ // Keep new utxos when they intersect with the stored utxos.
509
+ utxoCol = utxoCol.union(currentStoredUtxos).difference(utxosToRemoveCol)
510
510
 
511
511
  for (let tx of Object.values(unconfirmedTxsToCheck)) {
512
512
  existingTxs.push({ ...tx, dropped: true }) // TODO: this will decrease the chain index, it shouldn't be an issue considering the gap limit
@@ -293,6 +293,7 @@ export const createAndBroadcastTXFactory = ({
293
293
  UtxoCollection.fromJSON(replaceTx.data.inputs, { currency: asset.currency })
294
294
  )
295
295
  }
296
+ const addressPathsMap = selectedUtxos.getAddressPathsMap()
296
297
 
297
298
  // transform UTXO object to raw
298
299
  const inputs = shuffle(createInputs(assetName, selectedUtxos.toArray(), rbfEnabled))
@@ -341,6 +342,9 @@ export const createAndBroadcastTXFactory = ({
341
342
  ourAddress.address ? ourAddress.address : ourAddress.toString(),
342
343
  change
343
344
  )
345
+ // Add the keypath of change address to support Trezor detect the change output.
346
+ // Output is change and does not need approval from user which shows the strange address that user never seen.
347
+ addressPathsMap[changeAddress] = ourAddress.meta.path
344
348
  outputs.push(changeOutput)
345
349
  } else {
346
350
  // If we don't have enough for a change output, then all remaining dust is just added to fee
@@ -360,7 +364,7 @@ export const createAndBroadcastTXFactory = ({
360
364
  },
361
365
  txMeta: {
362
366
  useCashAddress, // for trezor to show the receiver cash address
363
- addressPathsMap: selectedUtxos.getAddressPathsMap(),
367
+ addressPathsMap,
364
368
  blockHeight,
365
369
  },
366
370
  }