Skip to content
Merged

5.6.22 #1729

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [[5.6.22](https://github.com/multiversx/mx-sdk-dapp/pull/1729)] - 2026-03-17

- [Fixed account balance does not update in the UI after receiving an incoming transaction via WebSocket.
](https://github.com/multiversx/mx-sdk-dapp/pull/1729)
Comment thread
arhtudormorar marked this conversation as resolved.

## [[5.6.21](https://github.com/multiversx/mx-sdk-dapp/pull/1728)] - 2026-03-11

- [Use websocket transport as default on websocket init](https://github.com/multiversx/mx-sdk-dapp/pull/1727)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-dapp",
"version": "5.6.21",
"version": "5.6.22",
"description": "A library to hold the main logic for a dapp on the MultiversX blockchain",
"author": "MultiversX",
"license": "MIT",
Expand Down Expand Up @@ -85,7 +85,7 @@
"protobufjs": "^7.2.6"
},
"optionalDependencies": {
"@multiversx/sdk-dapp-ui": ">=0.1.23 <0.2.0"
"@multiversx/sdk-dapp-ui": ">=0.1.24 <0.2.0"
},
"resolutions": {
"strip-ansi": "6.0.1",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions src/methods/trackTransactions/tests/trackTransactions.test.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
import { subscriptions } from 'constants/storage.constants';
import { WebsocketConnectionStatusEnum } from 'constants/websocket.constants';
import { getIsLoggedIn } from 'methods/account/getIsLoggedIn';
import { pendingTransactionsSessionsSelector } from 'store/selectors/transactionsSelector';
import { websocketEventSelector } from 'store/selectors/accountSelectors';
import { getStore } from 'store/store';
import { SubscriptionsEnum } from 'types/subscriptions.type';
import { refreshAccount } from 'utils/account/refreshAccount';
import { checkTransactionStatus } from '../helpers/checkTransactionStatus';
import { getPollingInterval } from '../helpers/getPollingInterval';
import { trackTransactions } from '../trackTransactions';

// Mock all dependencies
jest.mock('store/store');
jest.mock('store/selectors/accountSelectors');
jest.mock('store/selectors/transactionsSelector');
jest.mock('methods/account/getIsLoggedIn');
jest.mock('utils/account/refreshAccount');
jest.mock('../helpers/checkTransactionStatus');
jest.mock('../helpers/getPollingInterval');

const mockGetStore = getStore as jest.MockedFunction<typeof getStore>;
const mockWebsocketEventSelector =
websocketEventSelector as jest.MockedFunction<typeof websocketEventSelector>;
const mockPendingTransactionsSessionsSelector =
pendingTransactionsSessionsSelector as jest.MockedFunction<
typeof pendingTransactionsSessionsSelector
>;
const mockGetIsLoggedIn = getIsLoggedIn as jest.MockedFunction<
typeof getIsLoggedIn
>;
const mockRefreshAccount = refreshAccount as jest.MockedFunction<
typeof refreshAccount
>;
const mockCheckTransactionStatus =
checkTransactionStatus as jest.MockedFunction<typeof checkTransactionStatus>;
const mockGetPollingInterval = getPollingInterval as jest.MockedFunction<
Expand Down Expand Up @@ -62,6 +78,9 @@ describe('trackTransactions', () => {
timestamp: 1234567890,
message: 'test-message'
});
mockPendingTransactionsSessionsSelector.mockReturnValue({});
mockGetIsLoggedIn.mockReturnValue(false);
mockRefreshAccount.mockResolvedValue(undefined);
mockCheckTransactionStatus.mockResolvedValue(undefined);
});

Expand Down
12 changes: 12 additions & 0 deletions src/methods/trackTransactions/trackTransactions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { subscriptions } from 'constants/storage.constants';
import { WebsocketConnectionStatusEnum } from 'constants/websocket.constants';
import { getIsLoggedIn } from 'methods/account/getIsLoggedIn';
import { pendingTransactionsSessionsSelector } from 'store/selectors/transactionsSelector';
import { websocketEventSelector } from 'store/selectors/accountSelectors';
import { getStore } from 'store/store';
import { SubscriptionsEnum } from 'types/subscriptions.type';
import { refreshAccount } from 'utils/account/refreshAccount';
import { checkTransactionStatus } from './helpers/checkTransactionStatus';
import { getPollingInterval } from './helpers/getPollingInterval';
Comment thread
arhtudormorar marked this conversation as resolved.

Expand Down Expand Up @@ -55,6 +58,15 @@ export async function trackTransactions(): Promise<{
) {
timestamp = websocketEvent.timestamp;
recheckStatus();

const hasPendingSessions =
Object.keys(
pendingTransactionsSessionsSelector(store.getState())
).length > 0;

if (!hasPendingSessions && getIsLoggedIn()) {
refreshAccount();
}
Comment thread
arhtudormorar marked this conversation as resolved.
}
}
);
Expand Down
Loading