@exodus/bitcoin-plugin 1.4.0 → 1.4.1

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-plugin",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Exodus bitcoin-plugin",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import { createAsset } from '../index'
2
3
  import { getSizeFactory } from '@exodus/bitcoin-api/src/fee/fee-estimator'
3
4
  import { eccFactory } from '@exodus/bitcoin-api'
@@ -29,6 +29,7 @@ import { createTokenFactory } from './ordinals/create-token-factory'
29
29
  import { brc20ApiClientFactory } from './ordinals/brc-20-client'
30
30
  import { nftsApiFactory } from './ordinals/nfts'
31
31
  import { brc20BalancesAndFeeAdapterFactory } from './ordinals/brc-20-balances-and-fee-adapter'
32
+ import { parseCurrency } from '@exodus/bitcoin-api/src/fee/fee-utils'
32
33
 
33
34
  export const createBitcoinAssetFactory = ({ asset, apiUrl, coinInfoNetwork }) => ({
34
35
  allowUnconfirmedRbfEnabledUtxos = false,
@@ -176,12 +177,28 @@ export const createBitcoinAssetFactory = ({ asset, apiUrl, coinInfoNetwork }) =>
176
177
  return !isDroppedBitcoinTx && !isWaitingRbf
177
178
  }
178
179
 
179
- const getTxLogFilter = () => {
180
- return txLogFilter
180
+ const getActivityTxs = ({ txs, asset }) => {
181
+ return txs
182
+ .flatMap((tx) => {
183
+ if (tx.sent && Array.isArray(tx.data.sent) && tx.data.sent.length > 0) {
184
+ const feeAmount = tx.feeAmount.div(tx.data.sent.length)
185
+ return tx.data.sent
186
+ .map((to) =>
187
+ tx.update({
188
+ to: to.address,
189
+ coinAmount: parseCurrency(to.amount, asset.currency).negate(),
190
+ feeAmount,
191
+ })
192
+ )
193
+ .reverse()
194
+ }
195
+ return tx
196
+ })
197
+ .filter(txLogFilter)
181
198
  }
182
199
 
183
200
  const api = {
184
- getTxLogFilter,
201
+ getActivityTxs,
185
202
  addressHasHistory,
186
203
  defaultAddressPath: 'm/0/0',
187
204
  broadcastTx: (...args) => insightClient.broadcastTx(...args),