Skip to content

Commit 199db38

Browse files
Merge pull request #1729 from multiversx/development
5.6.22
2 parents 0d512c1 + e9af74c commit 199db38

File tree

5 files changed

+43
-7
lines changed

5 files changed

+43
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [[5.6.22](https://github.com/multiversx/mx-sdk-dapp/pull/1729)] - 2026-03-17
11+
12+
- [Fixed account balance does not update in the UI after receiving an incoming transaction via WebSocket.
13+
](https://github.com/multiversx/mx-sdk-dapp/pull/1729)
14+
1015
## [[5.6.21](https://github.com/multiversx/mx-sdk-dapp/pull/1728)] - 2026-03-11
1116

1217
- [Use websocket transport as default on websocket init](https://github.com/multiversx/mx-sdk-dapp/pull/1727)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@multiversx/sdk-dapp",
3-
"version": "5.6.21",
3+
"version": "5.6.22",
44
"description": "A library to hold the main logic for a dapp on the MultiversX blockchain",
55
"author": "MultiversX",
66
"license": "MIT",
@@ -85,7 +85,7 @@
8585
"protobufjs": "^7.2.6"
8686
},
8787
"optionalDependencies": {
88-
"@multiversx/sdk-dapp-ui": ">=0.1.23 <0.2.0"
88+
"@multiversx/sdk-dapp-ui": ">=0.1.24 <0.2.0"
8989
},
9090
"resolutions": {
9191
"strip-ansi": "6.0.1",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/methods/trackTransactions/tests/trackTransactions.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,37 @@
11
import { subscriptions } from 'constants/storage.constants';
22
import { WebsocketConnectionStatusEnum } from 'constants/websocket.constants';
3+
import { getIsLoggedIn } from 'methods/account/getIsLoggedIn';
4+
import { pendingTransactionsSessionsSelector } from 'store/selectors/transactionsSelector';
35
import { websocketEventSelector } from 'store/selectors/accountSelectors';
46
import { getStore } from 'store/store';
57
import { SubscriptionsEnum } from 'types/subscriptions.type';
8+
import { refreshAccount } from 'utils/account/refreshAccount';
69
import { checkTransactionStatus } from '../helpers/checkTransactionStatus';
710
import { getPollingInterval } from '../helpers/getPollingInterval';
811
import { trackTransactions } from '../trackTransactions';
912

1013
// Mock all dependencies
1114
jest.mock('store/store');
1215
jest.mock('store/selectors/accountSelectors');
16+
jest.mock('store/selectors/transactionsSelector');
17+
jest.mock('methods/account/getIsLoggedIn');
18+
jest.mock('utils/account/refreshAccount');
1319
jest.mock('../helpers/checkTransactionStatus');
1420
jest.mock('../helpers/getPollingInterval');
1521

1622
const mockGetStore = getStore as jest.MockedFunction<typeof getStore>;
1723
const mockWebsocketEventSelector =
1824
websocketEventSelector as jest.MockedFunction<typeof websocketEventSelector>;
25+
const mockPendingTransactionsSessionsSelector =
26+
pendingTransactionsSessionsSelector as jest.MockedFunction<
27+
typeof pendingTransactionsSessionsSelector
28+
>;
29+
const mockGetIsLoggedIn = getIsLoggedIn as jest.MockedFunction<
30+
typeof getIsLoggedIn
31+
>;
32+
const mockRefreshAccount = refreshAccount as jest.MockedFunction<
33+
typeof refreshAccount
34+
>;
1935
const mockCheckTransactionStatus =
2036
checkTransactionStatus as jest.MockedFunction<typeof checkTransactionStatus>;
2137
const mockGetPollingInterval = getPollingInterval as jest.MockedFunction<
@@ -62,6 +78,9 @@ describe('trackTransactions', () => {
6278
timestamp: 1234567890,
6379
message: 'test-message'
6480
});
81+
mockPendingTransactionsSessionsSelector.mockReturnValue({});
82+
mockGetIsLoggedIn.mockReturnValue(false);
83+
mockRefreshAccount.mockResolvedValue(undefined);
6584
mockCheckTransactionStatus.mockResolvedValue(undefined);
6685
});
6786

src/methods/trackTransactions/trackTransactions.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { subscriptions } from 'constants/storage.constants';
22
import { WebsocketConnectionStatusEnum } from 'constants/websocket.constants';
3+
import { getIsLoggedIn } from 'methods/account/getIsLoggedIn';
4+
import { pendingTransactionsSessionsSelector } from 'store/selectors/transactionsSelector';
35
import { websocketEventSelector } from 'store/selectors/accountSelectors';
46
import { getStore } from 'store/store';
57
import { SubscriptionsEnum } from 'types/subscriptions.type';
8+
import { refreshAccount } from 'utils/account/refreshAccount';
69
import { checkTransactionStatus } from './helpers/checkTransactionStatus';
710
import { getPollingInterval } from './helpers/getPollingInterval';
811

@@ -55,6 +58,15 @@ export async function trackTransactions(): Promise<{
5558
) {
5659
timestamp = websocketEvent.timestamp;
5760
recheckStatus();
61+
62+
const hasPendingSessions =
63+
Object.keys(
64+
pendingTransactionsSessionsSelector(store.getState())
65+
).length > 0;
66+
67+
if (!hasPendingSessions && getIsLoggedIn()) {
68+
refreshAccount();
69+
}
5870
}
5971
}
6072
);

0 commit comments

Comments
 (0)