@exodus/activity-txs 2.0.0 → 3.0.0
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/activity-txs@2.0.0...@exodus/activity-txs@3.0.0) (2023-10-06)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
- return array from activity txs (#4370)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- return array from activity txs ([#4370](https://github.com/ExodusMovement/exodus-hydra/issues/4370)) ([ba00cff](https://github.com/ExodusMovement/exodus-hydra/commit/ba00cfffa72a4264e311a13d609ec865174a54c0))
|
|
15
|
+
|
|
6
16
|
## [2.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/activity-txs@1.1.0...@exodus/activity-txs@2.0.0) (2023-09-28)
|
|
7
17
|
|
|
8
18
|
### ⚠ BREAKING CHANGES
|
package/atoms/activity-txs.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { combine, compute } from '@exodus/atoms'
|
|
2
|
+
import { createSelector } from 'reselect'
|
|
2
3
|
import { memoize } from 'lodash'
|
|
3
4
|
import { mapValues } from '@exodus/basic-utils'
|
|
4
5
|
import { createDeepEqualOutputSelector } from '@exodus/core-selectors/utils/deep-equal'
|
|
5
|
-
import { TxSet } from '@exodus/models'
|
|
6
|
-
import { createSelector } from 'reselect'
|
|
7
6
|
|
|
8
|
-
const
|
|
7
|
+
const createAssetSourceActivityTxsSelector = memoize(
|
|
9
8
|
({ assetName, walletAccount }) =>
|
|
10
9
|
createDeepEqualOutputSelector(
|
|
11
10
|
(args) => args.txSet,
|
|
@@ -21,10 +20,13 @@ const _createAssetSourceActivityTxsSelector = memoize(
|
|
|
21
20
|
({ assetName, walletAccount }) => `${assetName}_${walletAccount}`
|
|
22
21
|
)
|
|
23
22
|
|
|
24
|
-
const
|
|
23
|
+
const createAssetSourceTxsSelector = memoize(
|
|
25
24
|
({ assetName, walletAccount }) =>
|
|
26
|
-
createSelector(
|
|
27
|
-
|
|
25
|
+
createSelector(
|
|
26
|
+
(args) => args.txSet,
|
|
27
|
+
(txSet) => {
|
|
28
|
+
return [...txSet]
|
|
29
|
+
}
|
|
28
30
|
),
|
|
29
31
|
({ assetName, walletAccount }) => `${assetName}_${walletAccount}`
|
|
30
32
|
)
|
|
@@ -71,6 +73,8 @@ const areActivitiesEqual = (obj1 = {}, obj2 = {}) => {
|
|
|
71
73
|
return true
|
|
72
74
|
}
|
|
73
75
|
|
|
76
|
+
const EMPTY = []
|
|
77
|
+
|
|
74
78
|
const createActivityTxsAtom = ({ txLogsAtom, accountStatesAtom, assetsModule }) => {
|
|
75
79
|
const inputAtom = combine({
|
|
76
80
|
txLogs: txLogsAtom,
|
|
@@ -87,17 +91,19 @@ const createActivityTxsAtom = ({ txLogsAtom, accountStatesAtom, assetsModule })
|
|
|
87
91
|
const asset = assetsModule.getAsset(assetName)
|
|
88
92
|
const baseAssetName = asset.baseAsset.name
|
|
89
93
|
if (asset?.baseAsset?.api?.features?.noHistory) {
|
|
90
|
-
return
|
|
94
|
+
return EMPTY
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
if (asset?.api?.getActivityTxs) {
|
|
94
|
-
return createAssetSourceActivityTxsSelector(assetName)({
|
|
98
|
+
return createAssetSourceActivityTxsSelector({ assetName, walletAccount })({
|
|
95
99
|
asset,
|
|
96
100
|
txSet: assetTxSet,
|
|
97
101
|
baseAssetAccountState: accountStatesValue?.[walletAccount]?.[baseAssetName],
|
|
98
102
|
})
|
|
99
103
|
} else {
|
|
100
|
-
return
|
|
104
|
+
return createAssetSourceTxsSelector({ assetName, walletAccount })({
|
|
105
|
+
txSet: assetTxSet,
|
|
106
|
+
})
|
|
101
107
|
}
|
|
102
108
|
})
|
|
103
109
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/activity-txs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "The activity-txs feature",
|
|
5
5
|
"author": "Exodus Movement Inc.",
|
|
6
6
|
"repository": {
|
|
@@ -41,8 +41,9 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@exodus/assets": "^8.0.95",
|
|
43
43
|
"@exodus/assets-base": "^8.1.10",
|
|
44
|
-
"@exodus/assets-feature": "^3.
|
|
45
|
-
"@exodus/
|
|
44
|
+
"@exodus/assets-feature": "^3.4.0",
|
|
45
|
+
"@exodus/bitcoin-plugin": "^1.4.2",
|
|
46
|
+
"@exodus/blockchain-metadata": "^14.1.0",
|
|
46
47
|
"@exodus/dependency-injection": "^2.0.1",
|
|
47
48
|
"@exodus/dependency-preprocessors": "^3.1.1",
|
|
48
49
|
"@exodus/models": "^10.1.0",
|
|
@@ -54,5 +55,5 @@
|
|
|
54
55
|
"jest": "^29.1.2",
|
|
55
56
|
"redux": "^4.2.1"
|
|
56
57
|
},
|
|
57
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "ba03dcc3b373d079c9d7f5c55e0845a38badfcab"
|
|
58
59
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { memoize } from 'lodash'
|
|
2
|
+
import { createSelector } from 'reselect'
|
|
3
|
+
|
|
4
|
+
const createBatchedAssetSourceActivityByIdSelector = {
|
|
5
|
+
id: 'createBatchedAssetSourceActivityById',
|
|
6
|
+
dependencies: [{ selector: 'createBatchedAssetSourceSelector' }],
|
|
7
|
+
selectorFactory: (createBatchedAssetSourceSelector) =>
|
|
8
|
+
memoize(({ assetName, walletAccount, limit }) =>
|
|
9
|
+
createSelector(
|
|
10
|
+
createBatchedAssetSourceSelector({ assetName, walletAccount, limit }),
|
|
11
|
+
(transformedTxs) =>
|
|
12
|
+
transformedTxs.reduce((acc, tx) => {
|
|
13
|
+
;(acc[tx.txId] || (acc[tx.txId] = [])).push(tx)
|
|
14
|
+
return acc
|
|
15
|
+
}, Object.create(null))
|
|
16
|
+
)
|
|
17
|
+
),
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default createBatchedAssetSourceActivityByIdSelector
|
|
@@ -6,8 +6,8 @@ const createLimitedAssetSourceSelectorDefinition = {
|
|
|
6
6
|
dependencies: [{ selector: 'createAssetSourceSelector' }],
|
|
7
7
|
selectorFactory: (createAssetSourceSelector) =>
|
|
8
8
|
memoize(({ assetName, walletAccount, limit }) =>
|
|
9
|
-
createSelector(createAssetSourceSelector({ assetName, walletAccount }), (
|
|
10
|
-
limit ?
|
|
9
|
+
createSelector(createAssetSourceSelector({ assetName, walletAccount }), (txs) =>
|
|
10
|
+
limit ? txs.slice(-limit) : txs
|
|
11
11
|
)
|
|
12
12
|
),
|
|
13
13
|
}
|
package/redux/selectors/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import createLimitedAssetSourceSelectorDefinition from './create-limited-asset-source'
|
|
2
2
|
import createBatchedAssetSourceSelector from './create-batched-asset-source'
|
|
3
|
+
import createBatchedAssetSourceActivityByIdSelector from './create-batched-asset-source-by-id'
|
|
3
4
|
|
|
4
|
-
export default [
|
|
5
|
+
export default [
|
|
6
|
+
createLimitedAssetSourceSelectorDefinition,
|
|
7
|
+
createBatchedAssetSourceSelector,
|
|
8
|
+
createBatchedAssetSourceActivityByIdSelector,
|
|
9
|
+
]
|