diff --git a/packages/fcl-ethereum-provider/src/wc-provider.ts b/packages/fcl-ethereum-provider/src/wc-provider.ts index 9bbbad14f..745da5472 100644 --- a/packages/fcl-ethereum-provider/src/wc-provider.ts +++ b/packages/fcl-ethereum-provider/src/wc-provider.ts @@ -40,6 +40,7 @@ const BASE_WC_SERVICE = ( }, params: { externalProvider, + disableNotifications: true, }, }) as unknown as Service @@ -84,7 +85,10 @@ export class WalletConnectEthereumProvider extends EthereumProvider { (externalProviderTopic == null || externalProviderTopic === provider.signer.session.topic) ) { - await fclUser.authenticate({service: wcService, forceReauth: true}) + await fclUser.authenticate({ + service: wcService, + forceReauth: true, + }) } else if (!provider.signer.session) { // If no session is set but FCL is still authenticated, unauthenticate the user await fclUser.unauthenticate() diff --git a/packages/fcl-wc/src/service.ts b/packages/fcl-wc/src/service.ts index bd17777f1..7a42fc948 100644 --- a/packages/fcl-wc/src/service.ts +++ b/packages/fcl-wc/src/service.ts @@ -74,9 +74,12 @@ const makeExec = ( const { wcRequestHook, pairingModalOverride, - disableNotifications: appDisabledNotifications, + disableNotifications: _appDisabledNotifications, } = config + const appDisabledNotifications = + service.params?.disableNotifications ?? _appDisabledNotifications + const resolvedProvider = await resolveProvider({ provider: signerPromise, externalProviderOrTopic: service.params?.externalProvider, @@ -155,6 +158,7 @@ const makeExec = ( provider, abortSignal, isExternal, + disableNotifications: service.params?.disableNotifications, }).finally(() => notification?.dismiss()) function validateAppLink({uid}: {uid: string}) { @@ -282,7 +286,7 @@ function connectWc( onClose() throw error } finally { - // walletConnectModal?.closeModal() + walletConnectModal?.closeModal() } } } diff --git a/packages/fcl-wc/src/session.ts b/packages/fcl-wc/src/session.ts index 07673ca6b..c65c49ab7 100644 --- a/packages/fcl-wc/src/session.ts +++ b/packages/fcl-wc/src/session.ts @@ -61,6 +61,7 @@ export const request = async ({ provider, isExternal, abortSignal, + disableNotifications, }: { method: any body: any @@ -68,6 +69,7 @@ export const request = async ({ provider: InstanceType isExternal?: boolean abortSignal?: AbortSignal + disableNotifications?: boolean }) => { const [chainId, addr, address] = makeSessionData(session) const data = JSON.stringify({...body, addr, address}) @@ -95,13 +97,14 @@ export const request = async ({ switch (result.status) { case "APPROVED": - function normalizeService(service: Service) { + function addSessionInfo(service: Service) { if (service.method === "WC/RPC") { return { ...service, params: { ...service.params, ...(isExternal ? {externalProvider: session.topic} : {}), + ...(disableNotifications ? {disableNotifications} : {}), }, } } @@ -109,7 +112,7 @@ export const request = async ({ } if (method === FLOW_METHODS.FLOW_AUTHN) { - const services = (result?.data?.services ?? []).map(normalizeService) + const services = (result?.data?.services ?? []).map(addSessionInfo) return { ...(result.data ? result.data : {}), @@ -121,10 +124,10 @@ export const request = async ({ return { ...result.data, ...(result.data?.proposer - ? {proposer: normalizeService(result.data.proposer)} + ? {proposer: addSessionInfo(result.data.proposer)} : {}), - payer: [...result.data?.payer?.map(normalizeService)], - authorization: [...result.data?.authorization?.map(normalizeService)], + payer: [...result.data?.payer?.map(addSessionInfo)], + authorization: [...result.data?.authorization?.map(addSessionInfo)], } }