Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.1.3 #1347

Merged
merged 4 commits into from
Dec 13, 2024
Merged

v3.1.3 #1347

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]

## [[v3.1.3](https://github.com/multiversx/mx-sdk-dapp/pull/1347)] - 2024-12-13

- [Added session ID in the handshake payload to allow multiple DApp connections in parallel tabs](https://github.com/multiversx/mx-sdk-dapp/pull/1346)
- [Fixed cancel action in cross window does not close child window](https://github.com/multiversx/mx-sdk-dapp/pull/1345)

## [[v3.1.2](https://github.com/multiversx/mx-sdk-dapp/pull/1344)] - 2024-12-09

- [Add pagination item count support to "AddressTable"](https://github.com/multiversx/mx-sdk-dapp/pull/1343)
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": "3.1.2",
"version": "3.1.3",
"description": "A library to hold the main logic for a dapp on the MultiversX blockchain",
"author": "MultiversX",
"license": "GPL-3.0-or-later",
Expand Down Expand Up @@ -167,7 +167,7 @@
"@multiversx/sdk-opera-provider": "1.0.0-alpha.1",
"@multiversx/sdk-passkey-provider": "2.0.0",
"@multiversx/sdk-wallet-connect-provider": "5.0.0",
"@multiversx/sdk-web-wallet-cross-window-provider": "2.0.2",
"@multiversx/sdk-web-wallet-cross-window-provider": "2.0.3",
"@multiversx/sdk-web-wallet-iframe-provider": "2.0.1",
"@multiversx/sdk-web-wallet-provider": "4.0.0",
"@multiversx/sdk-webview-provider": "2.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import classNames from 'classnames';
import { DataTestIdsEnum } from 'constants/index';
import { withStyles, WithStylesImportType } from 'hocs/withStyles';
import { useClearTransactionsToSignWithWarning } from 'hooks/transactions/helpers/useClearTransactionsToSignWithWarning';
import { useCancelCrossWindowAction } from 'hooks/transactions/useCancelCrossWindowAction';
import { SignModalPropsType } from 'types';
import { ModalContainer } from 'UI/ModalContainer/ModalContainer';
import { PageState } from 'UI/PageState';
Expand All @@ -24,6 +25,8 @@ const SignWaitingScreenModalComponent = ({
globalStyles,
styles
}: SignWaitingScreenModalPropsType & WithStylesImportType) => {
const cancelAction = useCancelCrossWindowAction();

const clearTransactionsToSignWithWarning =
useClearTransactionsToSignWithWarning();

Expand All @@ -39,10 +42,11 @@ const SignWaitingScreenModalComponent = ({
)
};

const close = (event: MouseEvent) => {
const close = async (event: MouseEvent) => {
event.preventDefault();
handleClose();
clearTransactionsToSignWithWarning(sessionId);
await cancelAction();
handleClose();
};

return (
Expand Down
20 changes: 20 additions & 0 deletions src/hooks/transactions/useCancelCrossWindowAction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { CrossWindowProvider } from '@multiversx/sdk-web-wallet-cross-window-provider/out';
import { useGetAccountProvider } from 'hooks/account/useGetAccountProvider';
import { LoginMethodsEnum } from 'types';
import { getIsProviderEqualTo } from 'utils/account/getIsProviderEqualTo';

export function useCancelCrossWindowAction() {
const { provider } = useGetAccountProvider();

return async () => {
if (!provider) {
return;
}

if (getIsProviderEqualTo(LoginMethodsEnum.crossWindow)) {
const crossWindowProvider = provider as unknown as CrossWindowProvider;
await crossWindowProvider.cancelAction();
await crossWindowProvider.dispose();
}
};
}
Loading
Loading