From cc2559cb93a218d3497a7dc7a7e18146ca659c9d Mon Sep 17 00:00:00 2001 From: Edouard Bougon <15703023+EdouardBougon@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:27:42 +0100 Subject: [PATCH 1/2] fix: fix metadata handling for empty URL --- .changeset/nasty-planets-play.md | 5 +++++ packages/connectors/src/metaMask.ts | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 .changeset/nasty-planets-play.md diff --git a/.changeset/nasty-planets-play.md b/.changeset/nasty-planets-play.md new file mode 100644 index 0000000000..cb9efb638e --- /dev/null +++ b/.changeset/nasty-planets-play.md @@ -0,0 +1,5 @@ +--- +"@wagmi/connectors": patch +--- + +Fixed metamask internal metadata handling. diff --git a/packages/connectors/src/metaMask.ts b/packages/connectors/src/metaMask.ts index 5b7bce15e7..e2214b6494 100644 --- a/packages/connectors/src/metaMask.ts +++ b/packages/connectors/src/metaMask.ts @@ -262,12 +262,15 @@ export function metaMask(parameters: MetaMaskParameters = {}) { readonlyRPCMap, dappMetadata: { ...parameters.dappMetadata, - name: parameters.dappMetadata?.name ?? 'wagmi', - url: - parameters.dappMetadata?.url ?? - (typeof window !== 'undefined' + // Test if name and url are set AND not empty + name: parameters.dappMetadata?.name + ? parameters.dappMetadata?.name + : 'wagmi', + url: parameters.dappMetadata?.url + ? parameters.dappMetadata?.url + : typeof window !== 'undefined' ? window.location.origin - : 'https://wagmi.sh'), + : 'https://wagmi.sh', }, useDeeplink: parameters.useDeeplink ?? true, }) From 8c44de178e6fec3867f80fd3f0390024327fcd13 Mon Sep 17 00:00:00 2001 From: awkweb Date: Thu, 12 Dec 2024 09:31:48 -0500 Subject: [PATCH 2/2] Update nasty-planets-play.md --- .changeset/nasty-planets-play.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/nasty-planets-play.md b/.changeset/nasty-planets-play.md index cb9efb638e..8a71287e4e 100644 --- a/.changeset/nasty-planets-play.md +++ b/.changeset/nasty-planets-play.md @@ -2,4 +2,4 @@ "@wagmi/connectors": patch --- -Fixed metamask internal metadata handling. +Fixed MetaMask internal metadata handling.