@exodus/activity-txs 4.3.2 → 4.3.4

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
+ ## [4.3.4](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/activity-txs@4.3.3...@exodus/activity-txs@4.3.4) (2024-09-16)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **activity-txs:** make id to return orderId ([#9215](https://github.com/ExodusMovement/exodus-hydra/issues/9215)) ([a2f77b4](https://github.com/ExodusMovement/exodus-hydra/commit/a2f77b4e06c7302d3fda66a72d9a2b72025820c1))
11
+
12
+ ## [4.3.3](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/activity-txs@4.3.2...@exodus/activity-txs@4.3.3) (2024-09-09)
13
+
14
+ **Note:** Version bump only for package @exodus/activity-txs
15
+
6
16
  ## [4.3.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/activity-txs@4.3.1...@exodus/activity-txs@4.3.2) (2024-07-25)
7
17
 
8
18
  ### Bug Fixes
package/README.md CHANGED
@@ -1,18 +1,72 @@
1
1
  # @exodus/activity-txs
2
2
 
3
- Activity consists of a set of asset transactions that are transformed using `asset.api.getActivityTxs`
4
- which returns Array of Tx [models](https://github.com/ExodusMovement/exodus-core/blob/cdff25bb962b2301613588c615c5ac09b05f260a/packages/models/src/tx/index.js#L10): `[Tx, Tx, Tx]`
5
- Most of the assets don't have this api and simply return original txs.
6
- An example of this transformation is combining bitcoin batched transactions into a single activity item, instead of multiple Txs you get single Tx with adjusted `coinAmount`.
7
- These are utilized in the UI to display transaction history.
3
+ This feature generates user-friendly activity from transactions, orders, fiat orders, NFTs, and connections by grouping, batching, and formatting them.
8
4
 
9
- This feature introduces atoms with activity items generated from txLog and accountState.
10
- It provides an efficient way to store them by wallet accounts and to update this extensive object while avoiding unnecessary re-computations.
11
- Additionally, it offers extra redux selectors to retrieve activity limited by size or batched activity items.
5
+ ## How it works
6
+
7
+ Each asset’s activity consists of a set of transactions transformed using `asset.api.getActivityTxs`, which returns an array of Tx [models](https://github.com/ExodusMovement/exodus-core/blob/cdff25bb962b2301613588c615c5ac09b05f260a/packages/models/src/tx/index.js#L10): `[Tx, Tx, Tx]`.
8
+
9
+ **Most assets don't have this API and simply return the original transactions.**
10
+
11
+ For example, Bitcoin batched transactions are combined into a single activity item. Instead of multiple transactions (Txs), you get a single transaction with a summarized `coinAmount`.
12
+
13
+ This feature introduces atoms with activity items generated from `txLog` and `accountState`. It provides an efficient way to store these items by wallet accounts and update this extensive object while avoiding unnecessary re-computations.
14
+
15
+ Additionally, it offers extra Redux selectors to retrieve activity, limited by size or batched activity items. These selectors format activity depending on its type: NFTs (if the `nfts` module is integrated), fiat orders (if the fiat module is integrated), and swap orders (if the orders feature is integrated).
12
16
 
13
17
  ## Usage
14
18
 
15
- `ioc.use(activityTxs())`
19
+ This feature is designed to be used together with `@exodus/headless`. See [Using the SDK](../../docs/using-the-sdk.md) for more details.
20
+
21
+ ### API Side
22
+
23
+ The feature doesn't have a public API. Data is transformed automatically, stored in `activityTxsAtom`, and emitted to be stored in the Redux state.
24
+
25
+ ### Play with it
26
+
27
+ 1. Open the playground at https://exodus-hydra.pages.dev/features/activity-txs
28
+ 2. Run the following command in the Dev Tools Console to see activity for Bitcoin:
29
+
30
+ ```js
31
+ selectors.activityTxs.createFullActivity({
32
+ nftsNetworkNameToAssetName: { fantom: 'fantommainnet' },
33
+ })({ assetName: 'bitcoin', walletAccount: 'exodus_0' })(store.getState())
34
+ ```
35
+
36
+ 3. run the following command in the Dev Tools Console to see activity for Bitcoin and Ethereum together:
37
+
38
+ ```js
39
+ selectors.activityTxs.createMultiActivity({
40
+ createAssetSourceActivitySelector: selectors.activityTxs.createFullActivity({
41
+ nftsNetworkNameToAssetName: { fantom: 'fantommainnet' },
42
+ }),
43
+ })({ assetNames: ['bitcoin', 'ethereum'], walletAccounts: ['exodus_0', 'exodus_1'] })(
44
+ store.getState()
45
+ )
46
+ ```
47
+
48
+ 4. Try out some other selectors from `selectors.activityTxs`. See example usage in [tests](./redux/__tests__/selectors/).
49
+
50
+ ### UI Side
51
+
52
+ See [using the sdk](../../docs/using-the-sdk.md#events) for more details on basic UI-side setup.
53
+
54
+ ```js
55
+ import selectors from '~/ui/flux/selectors'
56
+
57
+ const fullAssetSourceActivitySelector = selectors.activityTxs.createFullActivity({
58
+ nftsNetworkNameToAssetName: { fantom: 'fantommainnet' },
59
+ })
60
+
61
+ const MyComponent = () => {
62
+ const bitcoinActivity = useSelector(
63
+ fullAssetSourceActivitySelector({ assetName: 'bitcoin', walletAccount: 'exodus_0' })
64
+ )
16
65
 
17
- selector example to get batched activity for specific asset from specific account:
18
- `selectors.activityTxs.createBatchedAssetSourceSelector({ assetName, walletAccount })` return array of txs `[Tx, Tx, ...]`
66
+ return bitcoinActivity.map((activityItem) => (
67
+ <Text>
68
+ {activityItem.assetName} : {activityItem.displayAmount}
69
+ </Text>
70
+ ))
71
+ }
72
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/activity-txs",
3
- "version": "4.3.2",
3
+ "version": "4.3.4",
4
4
  "description": "The activity-txs feature",
5
5
  "author": "Exodus Movement, Inc.",
6
6
  "repository": {
@@ -25,15 +25,15 @@
25
25
  "!**/*.test.js"
26
26
  ],
27
27
  "scripts": {
28
- "lint": "run -T eslint . --ignore-path ../../.gitignore",
28
+ "lint": "run -T eslint -c ../../eslint.config.mjs",
29
29
  "lint:fix": "yarn lint --fix",
30
- "test": "run -T jest"
30
+ "test": "run -T exodus-test --jest --esbuild"
31
31
  },
32
32
  "dependencies": {
33
- "@exodus/atoms": "^8.0.0",
34
- "@exodus/basic-utils": "^2.3.0",
33
+ "@exodus/atoms": "^8.1.1",
34
+ "@exodus/basic-utils": "^3.0.1",
35
35
  "@exodus/core-selectors": "^1.5.0",
36
- "@exodus/models": "^10.1.0",
36
+ "@exodus/models": "^12.0.1",
37
37
  "@exodus/module": "^1.2.2",
38
38
  "@exodus/multi-account-redux": "^2.0.1",
39
39
  "@exodus/typeforce": "^1.19.0",
@@ -44,22 +44,22 @@
44
44
  "devDependencies": {
45
45
  "@exodus/assets": "^8.0.95",
46
46
  "@exodus/assets-base": "^8.1.10",
47
- "@exodus/assets-feature": "^5.8.2",
48
- "@exodus/available-assets": "^8.4.0",
47
+ "@exodus/assets-feature": "^5.11.3",
48
+ "@exodus/available-assets": "^8.5.0",
49
49
  "@exodus/bitcoin-plugin": "^1.4.2",
50
- "@exodus/blockchain-metadata": "^15.3.5",
51
- "@exodus/connected-origins": "^3.3.4",
52
- "@exodus/dependency-injection": "^2.3.2",
53
- "@exodus/dependency-preprocessors": "^6.0.2",
54
- "@exodus/fiat-ramp": "^10.9.2",
55
- "@exodus/nfts": "^9.3.3",
56
- "@exodus/orders": "^4.10.2",
57
- "@exodus/personal-notes": "^3.6.2",
58
- "@exodus/redux-dependency-injection": "^3.2.3",
59
- "@exodus/storage-memory": "^2.1.1",
60
- "@exodus/wallet-accounts": "^16.8.2",
50
+ "@exodus/blockchain-metadata": "^15.5.0",
51
+ "@exodus/connected-origins": "^3.4.0",
52
+ "@exodus/dependency-injection": "^3.0.0",
53
+ "@exodus/dependency-preprocessors": "^6.0.5",
54
+ "@exodus/fiat-ramp": "^10.12.1",
55
+ "@exodus/nfts": "^9.3.7",
56
+ "@exodus/orders": "^4.11.3",
57
+ "@exodus/personal-notes": "^3.6.3",
58
+ "@exodus/redux-dependency-injection": "^4.0.3",
59
+ "@exodus/storage-memory": "^2.2.0",
60
+ "@exodus/wallet-accounts": "^16.10.2",
61
61
  "@types/minimalistic-assert": "^1.0.1",
62
62
  "redux": "^4.2.1"
63
63
  },
64
- "gitHead": "3995391eb48639b2d60ced5224a6a8f4902a2466"
64
+ "gitHead": "258c9637436b53f8bb3e77836e2e3505c81a6969"
65
65
  }
@@ -43,7 +43,7 @@ const getSwapSharedProps = ({
43
43
  ...getSharedProps({
44
44
  txId,
45
45
  date,
46
- id: `swap.${assetName}.${txId}`,
46
+ id: `swap.${assetName}.${order?.id || txId}`,
47
47
  assetName,
48
48
  type: getOrderType({ tx, order }),
49
49
  pending,