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

2.26.6 #1011

Merged
merged 8 commits into from
Jan 5, 2024
Merged

2.26.6 #1011

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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]


## [[v2.26.6]](https://github.com/multiversx/mx-sdk-dapp/pull/1011)] - 2024-01-05
- [Add custom request option for WC button](https://github.com/multiversx/mx-sdk-dapp/pull/1010)

## [[v2.26.5]](https://github.com/multiversx/mx-sdk-dapp/pull/1009)] - 2024-01-04
- [Fixed provider initialised check](https://github.com/multiversx/mx-sdk-dapp/pull/1008)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-dapp",
"version": "2.26.5",
"version": "2.26.6",
"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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export const WalletConnectLoginButton = ({
showScamPhishingAlert,
title = 'Login with the xPortal App',
token,
wrapContentInsideModal = true
wrapContentInsideModal = true,
customRequestMethods = []
}: WalletConnectLoginButtonPropsType) => {
const {
disabledConnectButton,
Expand Down Expand Up @@ -84,6 +85,7 @@ export const WalletConnectLoginButton = ({
title={title}
token={token}
wrapContentInsideModal={wrapContentInsideModal}
customRequestMethods={customRequestMethods}
/>
</>
);
Expand Down
1 change: 1 addition & 0 deletions src/UI/walletConnect/WalletConnectLoginButton/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ export interface WalletConnectLoginButtonPropsType
showScamPhishingAlert?: boolean;
title?: string;
wrapContentInsideModal?: boolean;
customRequestMethods?: Array<string>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const WalletConnectLoginContainerComponent = (
showLoginModal,
token,
wrapContentInsideModal,
styles
styles,
customRequestMethods
} = props;

const canLoginRef = useRef<boolean>(true);
Expand All @@ -30,7 +31,8 @@ const WalletConnectLoginContainerComponent = (
nativeAuth,
onLoginRedirect,
logoutRoute,
canLoginRef
canLoginRef,
customRequestMethods
});

const onCloseModal = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const WalletConnectLoginContentComponent = ({
token,
canLoginRef,
globalStyles,
styles
styles,
customRequestMethods = []
}: WalletConnectLoginModalPropsType & WithStylesImportType) => {
const [
initLoginWithWalletConnectV2,
Expand All @@ -47,7 +48,8 @@ const WalletConnectLoginContentComponent = ({
nativeAuth,
onLoginRedirect,
logoutRoute,
canLoginRef
canLoginRef,
customRequestMethods
});

const [qrCodeSvg, setQrCodeSvg] = useState<string>('');
Expand Down
1 change: 1 addition & 0 deletions src/UI/walletConnect/WalletConnectLoginContainer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ export interface WalletConnectLoginModalPropsType
title?: string;
wrapContentInsideModal?: boolean;
canLoginRef?: MutableRefObject<boolean>;
customRequestMethods?: Array<string>;
}
7 changes: 5 additions & 2 deletions src/hooks/login/useWalletConnectV2Login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export enum WalletConnectV2Error {
export interface InitWalletConnectV2Type extends OnProviderLoginType {
logoutRoute?: string;
canLoginRef?: MutableRefObject<boolean>;
customRequestMethods?: Array<string>;
}

export interface WalletConnectV2LoginHookCustomStateType {
Expand All @@ -68,7 +69,8 @@ export const useWalletConnectV2Login = ({
nativeAuth,
onLoginRedirect,
logoutRoute: providerLogoutRoute,
canLoginRef: parentCanLoginRef
canLoginRef: parentCanLoginRef,
customRequestMethods = []
}: InitWalletConnectV2Type): WalletConnectV2LoginHookReturnType => {
const dispatch = useDispatch();
const hasNativeAuth = nativeAuth != null;
Expand Down Expand Up @@ -97,7 +99,8 @@ export const useWalletConnectV2Login = ({

const logoutRoute = providerLogoutRoute ?? dappLogoutRoute ?? '/';
const dappMethods: string[] = [
WalletConnectOptionalMethodsEnum.CANCEL_ACTION
WalletConnectOptionalMethodsEnum.CANCEL_ACTION,
...customRequestMethods
];
if (tokenToSign) {
dappMethods.push(WalletConnectOptionalMethodsEnum.SIGN_LOGIN_TOKEN);
Expand Down