From f9bc251cd3d5a86a7ee97e5e3300f793018f2b70 Mon Sep 17 00:00:00 2001 From: Andrei Date: Fri, 5 Jan 2024 15:42:54 +0200 Subject: [PATCH 1/6] add custom request option for WC button --- .../WalletConnectLoginButton/WalletConnectLoginButton.tsx | 4 +++- src/UI/walletConnect/WalletConnectLoginButton/types.ts | 1 + .../WalletConnectLoginContainer.tsx | 6 ++++-- .../WalletConnectLoginContent.tsx | 6 ++++-- src/UI/walletConnect/WalletConnectLoginContainer/types.ts | 1 + src/hooks/login/useWalletConnectV2Login.ts | 7 +++++-- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/UI/walletConnect/WalletConnectLoginButton/WalletConnectLoginButton.tsx b/src/UI/walletConnect/WalletConnectLoginButton/WalletConnectLoginButton.tsx index ff84df1c1..1f9c53c66 100644 --- a/src/UI/walletConnect/WalletConnectLoginButton/WalletConnectLoginButton.tsx +++ b/src/UI/walletConnect/WalletConnectLoginButton/WalletConnectLoginButton.tsx @@ -30,7 +30,8 @@ export const WalletConnectLoginButton = ({ showScamPhishingAlert, title = 'Login with the xPortal App', token, - wrapContentInsideModal = true + wrapContentInsideModal = true, + customRequestMethods = [] }: WalletConnectLoginButtonPropsType) => { const { disabledConnectButton, @@ -84,6 +85,7 @@ export const WalletConnectLoginButton = ({ title={title} token={token} wrapContentInsideModal={wrapContentInsideModal} + customRequestMethods={customRequestMethods} /> ); diff --git a/src/UI/walletConnect/WalletConnectLoginButton/types.ts b/src/UI/walletConnect/WalletConnectLoginButton/types.ts index edaaa049f..f151aa415 100644 --- a/src/UI/walletConnect/WalletConnectLoginButton/types.ts +++ b/src/UI/walletConnect/WalletConnectLoginButton/types.ts @@ -25,4 +25,5 @@ export interface WalletConnectLoginButtonPropsType showScamPhishingAlert?: boolean; title?: string; wrapContentInsideModal?: boolean; + customRequestMethods?: Array; } diff --git a/src/UI/walletConnect/WalletConnectLoginContainer/WalletConnectLoginContainer.tsx b/src/UI/walletConnect/WalletConnectLoginContainer/WalletConnectLoginContainer.tsx index db774016a..b91dfa85b 100644 --- a/src/UI/walletConnect/WalletConnectLoginContainer/WalletConnectLoginContainer.tsx +++ b/src/UI/walletConnect/WalletConnectLoginContainer/WalletConnectLoginContainer.tsx @@ -19,7 +19,8 @@ const WalletConnectLoginContainerComponent = ( showLoginModal, token, wrapContentInsideModal, - styles + styles, + customRequestMethods } = props; const canLoginRef = useRef(true); @@ -30,7 +31,8 @@ const WalletConnectLoginContainerComponent = ( nativeAuth, onLoginRedirect, logoutRoute, - canLoginRef + canLoginRef, + customRequestMethods }); const onCloseModal = async () => { diff --git a/src/UI/walletConnect/WalletConnectLoginContainer/WalletConnectLoginContent/WalletConnectLoginContent.tsx b/src/UI/walletConnect/WalletConnectLoginContainer/WalletConnectLoginContent/WalletConnectLoginContent.tsx index d2e8db6b3..4671fb99b 100644 --- a/src/UI/walletConnect/WalletConnectLoginContainer/WalletConnectLoginContent/WalletConnectLoginContent.tsx +++ b/src/UI/walletConnect/WalletConnectLoginContainer/WalletConnectLoginContent/WalletConnectLoginContent.tsx @@ -29,7 +29,8 @@ const WalletConnectLoginContentComponent = ({ token, canLoginRef, globalStyles, - styles + styles, + customRequestMethods = [] }: WalletConnectLoginModalPropsType & WithStylesImportType) => { const [ initLoginWithWalletConnectV2, @@ -47,7 +48,8 @@ const WalletConnectLoginContentComponent = ({ nativeAuth, onLoginRedirect, logoutRoute, - canLoginRef + canLoginRef, + customRequestMethods }); const [qrCodeSvg, setQrCodeSvg] = useState(''); diff --git a/src/UI/walletConnect/WalletConnectLoginContainer/types.ts b/src/UI/walletConnect/WalletConnectLoginContainer/types.ts index 4cd1ab8fb..8b68c11f0 100644 --- a/src/UI/walletConnect/WalletConnectLoginContainer/types.ts +++ b/src/UI/walletConnect/WalletConnectLoginContainer/types.ts @@ -21,4 +21,5 @@ export interface WalletConnectLoginModalPropsType title?: string; wrapContentInsideModal?: boolean; canLoginRef?: MutableRefObject; + customRequestMethods?: Array; } diff --git a/src/hooks/login/useWalletConnectV2Login.ts b/src/hooks/login/useWalletConnectV2Login.ts index ed6863507..7a1939d89 100644 --- a/src/hooks/login/useWalletConnectV2Login.ts +++ b/src/hooks/login/useWalletConnectV2Login.ts @@ -45,6 +45,7 @@ export enum WalletConnectV2Error { export interface InitWalletConnectV2Type extends OnProviderLoginType { logoutRoute?: string; canLoginRef?: MutableRefObject; + customRequestMethods?: Array; } export interface WalletConnectV2LoginHookCustomStateType { @@ -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; @@ -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); From 8e51c9c6cff92857e8224a63b11565b14a1a1292 Mon Sep 17 00:00:00 2001 From: Andrei Date: Fri, 5 Jan 2024 15:45:16 +0200 Subject: [PATCH 2/6] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc908c382..f9eb180a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,10 @@ All notable changes will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +@andreigiura ## [Unreleased] +- [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) From c4fd4e17638a726073afbd5f6ca64be797cbff1f Mon Sep 17 00:00:00 2001 From: Andrei Date: Fri, 5 Jan 2024 15:48:23 +0200 Subject: [PATCH 3/6] changelog --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9eb180a6..8309da618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,6 @@ All notable changes will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -@andreigiura ## [Unreleased] - [Add custom request option for WC button](https://github.com/multiversx/mx-sdk-dapp/pull/1010) From 5c2690079e79bdfeb64a3aebb10ea8dbda257f9b Mon Sep 17 00:00:00 2001 From: Andrei Date: Fri, 5 Jan 2024 15:58:10 +0200 Subject: [PATCH 4/6] changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8309da618..260249789 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] -- [Add custom request option for WC button](https://github.com/multiversx/mx-sdk-dapp/pull/1010) + + +## [[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) From 6ab8ccec8b47fcdded641b53a08228d0dea14f6d Mon Sep 17 00:00:00 2001 From: Andrei Date: Fri, 5 Jan 2024 15:58:59 +0200 Subject: [PATCH 5/6] changelog typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 260249789..bf3a61c09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [[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) +- [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) From c930ac12f10ec79ad0a8569fce237292c9baa39c Mon Sep 17 00:00:00 2001 From: Andrei Date: Fri, 5 Jan 2024 15:59:09 +0200 Subject: [PATCH 6/6] 2.26.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 14aab118c..d00082ed4 100644 --- a/package.json +++ b/package.json @@ -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",