From 25c6f289d63447bbe23ed8ebe74337ae4a88490c Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Thu, 29 Aug 2024 13:01:18 -0300 Subject: [PATCH 01/17] chore: version bump for 5.1.4 (#2767) --- apps/demo/CHANGELOG.md | 16 ++++++++++++++ apps/demo/package.json | 2 +- apps/gallery/CHANGELOG.md | 17 +++++++++++++++ apps/gallery/package.json | 2 +- apps/laboratory/CHANGELOG.md | 22 +++++++++++++++++++ apps/laboratory/package.json | 2 +- examples/html-ethers5/CHANGELOG.md | 16 ++++++++++++++ examples/html-ethers5/package.json | 2 +- examples/html-wagmi/CHANGELOG.md | 16 ++++++++++++++ examples/html-wagmi/package.json | 2 +- examples/next-wagmi/CHANGELOG.md | 16 ++++++++++++++ examples/next-wagmi/package.json | 2 +- examples/react-ethers/CHANGELOG.md | 16 ++++++++++++++ examples/react-ethers/package.json | 2 +- examples/react-ethers5/CHANGELOG.md | 16 ++++++++++++++ examples/react-ethers5/package.json | 2 +- examples/react-solana/CHANGELOG.md | 16 ++++++++++++++ examples/react-solana/package.json | 2 +- examples/react-wagmi/CHANGELOG.md | 16 ++++++++++++++ examples/react-wagmi/package.json | 2 +- examples/vue-ethers5/CHANGELOG.md | 16 ++++++++++++++ examples/vue-ethers5/package.json | 2 +- examples/vue-solana/CHANGELOG.md | 16 ++++++++++++++ examples/vue-solana/package.json | 2 +- examples/vue-wagmi/CHANGELOG.md | 16 ++++++++++++++ examples/vue-wagmi/package.json | 2 +- packages/base/CHANGELOG.md | 23 ++++++++++++++++++++ packages/base/package.json | 2 +- packages/cdn/CHANGELOG.md | 18 +++++++++++++++ packages/cdn/package.json | 2 +- packages/common/CHANGELOG.md | 14 ++++++++++++ packages/common/package.json | 2 +- packages/core/CHANGELOG.md | 17 +++++++++++++++ packages/core/package.json | 2 +- packages/ethers/CHANGELOG.md | 21 ++++++++++++++++++ packages/ethers/package.json | 2 +- packages/ethers5/CHANGELOG.md | 20 +++++++++++++++++ packages/ethers5/package.json | 2 +- packages/polyfills/CHANGELOG.md | 14 ++++++++++++ packages/polyfills/package.json | 2 +- packages/scaffold-ui/CHANGELOG.md | 21 ++++++++++++++++++ packages/scaffold-ui/package.json | 2 +- packages/scaffold-utils/CHANGELOG.md | 19 ++++++++++++++++ packages/scaffold-utils/package.json | 2 +- packages/scaffold-utils/src/ConstantsUtil.ts | 2 +- packages/siwe/CHANGELOG.md | 20 +++++++++++++++++ packages/siwe/package.json | 2 +- packages/solana/CHANGELOG.md | 21 ++++++++++++++++++ packages/solana/package.json | 2 +- packages/ui/CHANGELOG.md | 14 ++++++++++++ packages/ui/package.json | 2 +- packages/wagmi/CHANGELOG.md | 21 ++++++++++++++++++ packages/wagmi/package.json | 2 +- packages/wallet/CHANGELOG.md | 17 +++++++++++++++ packages/wallet/package.json | 2 +- 55 files changed, 503 insertions(+), 28 deletions(-) diff --git a/apps/demo/CHANGELOG.md b/apps/demo/CHANGELOG.md index 1854d0ebbf..97181f13b7 100644 --- a/apps/demo/CHANGELOG.md +++ b/apps/demo/CHANGELOG.md @@ -1,5 +1,21 @@ # @apps/demo +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/wagmi@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/apps/demo/package.json b/apps/demo/package.json index f84b37fdb1..6c555a338d 100644 --- a/apps/demo/package.json +++ b/apps/demo/package.json @@ -1,6 +1,6 @@ { "name": "@apps/demo", - "version": "5.1.3", + "version": "5.1.4", "private": true, "scripts": { "dev": "next dev", diff --git a/apps/gallery/CHANGELOG.md b/apps/gallery/CHANGELOG.md index af2028e084..77e14d1648 100644 --- a/apps/gallery/CHANGELOG.md +++ b/apps/gallery/CHANGELOG.md @@ -1,5 +1,22 @@ # @apps/gallery +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/common@5.1.4 + - @web3modal/ui@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/apps/gallery/package.json b/apps/gallery/package.json index 873f54876e..0e10701af9 100644 --- a/apps/gallery/package.json +++ b/apps/gallery/package.json @@ -1,6 +1,6 @@ { "name": "@apps/gallery", - "version": "5.1.3", + "version": "5.1.4", "private": true, "main": "index.js", "scripts": { diff --git a/apps/laboratory/CHANGELOG.md b/apps/laboratory/CHANGELOG.md index 147e2c326a..572747c322 100644 --- a/apps/laboratory/CHANGELOG.md +++ b/apps/laboratory/CHANGELOG.md @@ -1,5 +1,27 @@ # @apps/laboratory +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/base@5.1.4 + - @web3modal/ethers@5.1.4 + - @web3modal/ethers5@5.1.4 + - @web3modal/siwe@5.1.4 + - @web3modal/solana@5.1.4 + - @web3modal/wagmi@5.1.4 + - @web3modal/wallet@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/apps/laboratory/package.json b/apps/laboratory/package.json index b43062e993..ab0ca499b6 100644 --- a/apps/laboratory/package.json +++ b/apps/laboratory/package.json @@ -1,7 +1,7 @@ { "name": "@apps/laboratory", "type": "module", - "version": "5.1.3", + "version": "5.1.4", "private": true, "scripts": { "dev": "next dev", diff --git a/examples/html-ethers5/CHANGELOG.md b/examples/html-ethers5/CHANGELOG.md index 0100df09aa..2534039b8f 100644 --- a/examples/html-ethers5/CHANGELOG.md +++ b/examples/html-ethers5/CHANGELOG.md @@ -1,5 +1,21 @@ # @examples/html-ethers5 +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/ethers5@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/examples/html-ethers5/package.json b/examples/html-ethers5/package.json index 94f7dee997..febdfe0f37 100644 --- a/examples/html-ethers5/package.json +++ b/examples/html-ethers5/package.json @@ -1,7 +1,7 @@ { "name": "@examples/html-ethers5", "private": true, - "version": "5.1.3", + "version": "5.1.4", "scripts": { "dev": "vite --port 3011", "build": "vite build" diff --git a/examples/html-wagmi/CHANGELOG.md b/examples/html-wagmi/CHANGELOG.md index 3b70fe3973..76d090eda0 100644 --- a/examples/html-wagmi/CHANGELOG.md +++ b/examples/html-wagmi/CHANGELOG.md @@ -1,5 +1,21 @@ # @examples/html-wagmi +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/wagmi@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/examples/html-wagmi/package.json b/examples/html-wagmi/package.json index aba0b710c1..4bf9c5aa49 100644 --- a/examples/html-wagmi/package.json +++ b/examples/html-wagmi/package.json @@ -1,7 +1,7 @@ { "name": "@examples/html-wagmi", "private": true, - "version": "5.1.3", + "version": "5.1.4", "scripts": { "dev": "vite --port 3001", "build": "vite build" diff --git a/examples/next-wagmi/CHANGELOG.md b/examples/next-wagmi/CHANGELOG.md index 4e0d7fff34..4e792be61a 100644 --- a/examples/next-wagmi/CHANGELOG.md +++ b/examples/next-wagmi/CHANGELOG.md @@ -1,5 +1,21 @@ # @examples/next-wagmi +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/wagmi@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/examples/next-wagmi/package.json b/examples/next-wagmi/package.json index 7b6d591558..798f6de06d 100644 --- a/examples/next-wagmi/package.json +++ b/examples/next-wagmi/package.json @@ -1,6 +1,6 @@ { "name": "@examples/next-wagmi", - "version": "5.1.3", + "version": "5.1.4", "private": true, "scripts": { "dev": "next dev", diff --git a/examples/react-ethers/CHANGELOG.md b/examples/react-ethers/CHANGELOG.md index f922207f67..16d3e9b995 100644 --- a/examples/react-ethers/CHANGELOG.md +++ b/examples/react-ethers/CHANGELOG.md @@ -1,5 +1,21 @@ # @examples/react-ethers5 +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/ethers@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/examples/react-ethers/package.json b/examples/react-ethers/package.json index 30f3defed2..872a7db612 100644 --- a/examples/react-ethers/package.json +++ b/examples/react-ethers/package.json @@ -1,7 +1,7 @@ { "name": "@examples/react-ethers", "private": true, - "version": "5.1.3", + "version": "5.1.4", "scripts": { "dev": "vite --port 3012", "build": "vite build" diff --git a/examples/react-ethers5/CHANGELOG.md b/examples/react-ethers5/CHANGELOG.md index 968a97713c..1990c34053 100644 --- a/examples/react-ethers5/CHANGELOG.md +++ b/examples/react-ethers5/CHANGELOG.md @@ -1,5 +1,21 @@ # @examples/react-ethers5 +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/ethers5@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/examples/react-ethers5/package.json b/examples/react-ethers5/package.json index 57d35b6348..c82ccc7a3d 100644 --- a/examples/react-ethers5/package.json +++ b/examples/react-ethers5/package.json @@ -1,7 +1,7 @@ { "name": "@examples/react-ethers5", "private": true, - "version": "5.1.3", + "version": "5.1.4", "scripts": { "dev": "vite --port 3012", "build": "vite build" diff --git a/examples/react-solana/CHANGELOG.md b/examples/react-solana/CHANGELOG.md index 50ed8bad6b..d945a209b1 100644 --- a/examples/react-solana/CHANGELOG.md +++ b/examples/react-solana/CHANGELOG.md @@ -1,5 +1,21 @@ # @examples/react-wagmi +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/solana@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/examples/react-solana/package.json b/examples/react-solana/package.json index a4ca35f548..d45c714790 100644 --- a/examples/react-solana/package.json +++ b/examples/react-solana/package.json @@ -1,7 +1,7 @@ { "name": "@examples/react-solana", "private": true, - "version": "5.1.3", + "version": "5.1.4", "scripts": { "dev": "vite --port 3002", "build": "vite build" diff --git a/examples/react-wagmi/CHANGELOG.md b/examples/react-wagmi/CHANGELOG.md index 90732234f0..4df4808f73 100644 --- a/examples/react-wagmi/CHANGELOG.md +++ b/examples/react-wagmi/CHANGELOG.md @@ -1,5 +1,21 @@ # @examples/react-wagmi +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/wagmi@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/examples/react-wagmi/package.json b/examples/react-wagmi/package.json index 5d24deb820..d60aad1b93 100644 --- a/examples/react-wagmi/package.json +++ b/examples/react-wagmi/package.json @@ -1,7 +1,7 @@ { "name": "@examples/react-wagmi", "private": true, - "version": "5.1.3", + "version": "5.1.4", "scripts": { "dev": "vite --port 3002", "build": "vite build", diff --git a/examples/vue-ethers5/CHANGELOG.md b/examples/vue-ethers5/CHANGELOG.md index f57bd887d9..c9cf359444 100644 --- a/examples/vue-ethers5/CHANGELOG.md +++ b/examples/vue-ethers5/CHANGELOG.md @@ -1,5 +1,21 @@ # @examples/vue-ethers5 +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/ethers5@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/examples/vue-ethers5/package.json b/examples/vue-ethers5/package.json index 66e405a560..b3fc1eac5f 100644 --- a/examples/vue-ethers5/package.json +++ b/examples/vue-ethers5/package.json @@ -1,7 +1,7 @@ { "name": "@examples/vue-ethers5", "private": true, - "version": "5.1.3", + "version": "5.1.4", "scripts": { "dev": "vite --port 3013", "build": "vite build" diff --git a/examples/vue-solana/CHANGELOG.md b/examples/vue-solana/CHANGELOG.md index ee0a662919..8fc18852f7 100644 --- a/examples/vue-solana/CHANGELOG.md +++ b/examples/vue-solana/CHANGELOG.md @@ -1,5 +1,21 @@ # @examples/vue-ethers5 +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/solana@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/examples/vue-solana/package.json b/examples/vue-solana/package.json index 8f028de385..b8c2edd1d2 100644 --- a/examples/vue-solana/package.json +++ b/examples/vue-solana/package.json @@ -1,7 +1,7 @@ { "name": "@examples/vue-solana", "private": true, - "version": "5.1.3", + "version": "5.1.4", "scripts": { "dev": "vite --port 3013", "build": "vite build" diff --git a/examples/vue-wagmi/CHANGELOG.md b/examples/vue-wagmi/CHANGELOG.md index 3b9ce3ca0d..eca8294c36 100644 --- a/examples/vue-wagmi/CHANGELOG.md +++ b/examples/vue-wagmi/CHANGELOG.md @@ -1,5 +1,21 @@ # @examples/vue-wagmi +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/wagmi@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/examples/vue-wagmi/package.json b/examples/vue-wagmi/package.json index 436ddca1ac..4d5d45cb8b 100644 --- a/examples/vue-wagmi/package.json +++ b/examples/vue-wagmi/package.json @@ -1,7 +1,7 @@ { "name": "@examples/vue-wagmi", "private": true, - "version": "5.1.3", + "version": "5.1.4", "scripts": { "dev": "vite --port 3003", "build": "vite build" diff --git a/packages/base/CHANGELOG.md b/packages/base/CHANGELOG.md index 21c1bf555a..edae1fca32 100644 --- a/packages/base/CHANGELOG.md +++ b/packages/base/CHANGELOG.md @@ -1,5 +1,28 @@ # @web3modal/scaffold +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/common@5.1.4 + - @web3modal/core@5.1.4 + - @web3modal/polyfills@5.1.4 + - @web3modal/scaffold-ui@5.1.4 + - @web3modal/scaffold-utils@5.1.4 + - @web3modal/siwe@5.1.4 + - @web3modal/ui@5.1.4 + - @web3modal/wallet@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/packages/base/package.json b/packages/base/package.json index c24c4d038e..4e5c574a0c 100644 --- a/packages/base/package.json +++ b/packages/base/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/base", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/cdn/CHANGELOG.md b/packages/cdn/CHANGELOG.md index b942f6a688..5466925ca0 100644 --- a/packages/cdn/CHANGELOG.md +++ b/packages/cdn/CHANGELOG.md @@ -1,5 +1,23 @@ # @web3modal/cdn +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/ethers@5.1.4 + - @web3modal/ethers5@5.1.4 + - @web3modal/wagmi@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/packages/cdn/package.json b/packages/cdn/package.json index 8aebcbebd3..3ad9058ed3 100644 --- a/packages/cdn/package.json +++ b/packages/cdn/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/cdn", - "version": "5.1.3", + "version": "5.1.4", "main": "dist/wagmi.js", "type": "module", "files": [ diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 29f8662caa..f9d9d1cfb9 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -1,5 +1,19 @@ # @web3modal/common +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 + ## 5.1.3 ### Patch Changes diff --git a/packages/common/package.json b/packages/common/package.json index 71961a6861..ff6d2c1f88 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/common", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/index.js", "types": "./dist/types/index.d.ts", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 2330fd1676..83aad26a9f 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,22 @@ # @web3modal/core +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/common@5.1.4 + - @web3modal/wallet@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/packages/core/package.json b/packages/core/package.json index 534799a580..8397f5ddbe 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/core", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/index.js", "types": "./dist/types/index.d.ts", diff --git a/packages/ethers/CHANGELOG.md b/packages/ethers/CHANGELOG.md index 9655381250..585d63c8d0 100644 --- a/packages/ethers/CHANGELOG.md +++ b/packages/ethers/CHANGELOG.md @@ -1,5 +1,26 @@ # @web3modal/ethers +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/base@5.1.4 + - @web3modal/common@5.1.4 + - @web3modal/polyfills@5.1.4 + - @web3modal/scaffold-utils@5.1.4 + - @web3modal/siwe@5.1.4 + - @web3modal/wallet@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/packages/ethers/package.json b/packages/ethers/package.json index 05ca11bf41..f91b247490 100644 --- a/packages/ethers/package.json +++ b/packages/ethers/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/ethers", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/ethers5/CHANGELOG.md b/packages/ethers5/CHANGELOG.md index 2c13afae68..34fe702d0d 100644 --- a/packages/ethers5/CHANGELOG.md +++ b/packages/ethers5/CHANGELOG.md @@ -1,5 +1,25 @@ # @web3modal/ethers5 +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/base@5.1.4 + - @web3modal/common@5.1.4 + - @web3modal/polyfills@5.1.4 + - @web3modal/scaffold-utils@5.1.4 + - @web3modal/siwe@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/packages/ethers5/package.json b/packages/ethers5/package.json index 614d5a06b6..f61d12135a 100644 --- a/packages/ethers5/package.json +++ b/packages/ethers5/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/ethers5", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/polyfills/CHANGELOG.md b/packages/polyfills/CHANGELOG.md index 5fa16a3f72..af487f6301 100644 --- a/packages/polyfills/CHANGELOG.md +++ b/packages/polyfills/CHANGELOG.md @@ -1,5 +1,19 @@ # @web3modal/polyfills +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 + ## 5.1.3 ### Patch Changes diff --git a/packages/polyfills/package.json b/packages/polyfills/package.json index 7bd1a1be91..19cc5157b8 100644 --- a/packages/polyfills/package.json +++ b/packages/polyfills/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/polyfills", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/index.js", "types": "./dist/types/index.d.ts", diff --git a/packages/scaffold-ui/CHANGELOG.md b/packages/scaffold-ui/CHANGELOG.md index 4fd3d43f4c..a64388c2b0 100644 --- a/packages/scaffold-ui/CHANGELOG.md +++ b/packages/scaffold-ui/CHANGELOG.md @@ -1,5 +1,26 @@ # @web3modal/scaffold +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/common@5.1.4 + - @web3modal/core@5.1.4 + - @web3modal/scaffold-utils@5.1.4 + - @web3modal/siwe@5.1.4 + - @web3modal/ui@5.1.4 + - @web3modal/wallet@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/packages/scaffold-ui/package.json b/packages/scaffold-ui/package.json index 47e012d518..22e15ca4b0 100644 --- a/packages/scaffold-ui/package.json +++ b/packages/scaffold-ui/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/scaffold-ui", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/scaffold-utils/CHANGELOG.md b/packages/scaffold-utils/CHANGELOG.md index 3db5d6cf36..93ce3aac44 100644 --- a/packages/scaffold-utils/CHANGELOG.md +++ b/packages/scaffold-utils/CHANGELOG.md @@ -1,5 +1,24 @@ # @web3modal/scaffold-utils +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/common@5.1.4 + - @web3modal/core@5.1.4 + - @web3modal/polyfills@5.1.4 + - @web3modal/wallet@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/packages/scaffold-utils/package.json b/packages/scaffold-utils/package.json index 96b6608ea1..433f5aadb6 100644 --- a/packages/scaffold-utils/package.json +++ b/packages/scaffold-utils/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/scaffold-utils", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/scaffold-utils/src/ConstantsUtil.ts b/packages/scaffold-utils/src/ConstantsUtil.ts index 7aefbfd2c3..e8d53d67c1 100644 --- a/packages/scaffold-utils/src/ConstantsUtil.ts +++ b/packages/scaffold-utils/src/ConstantsUtil.ts @@ -16,5 +16,5 @@ export const ConstantsUtil = { coinbaseWallet: 'com.coinbase.wallet', coinbaseWalletSDK: 'com.coinbase.wallet' } as Record, - VERSION: '5.1.3' + VERSION: '5.1.4' } diff --git a/packages/siwe/CHANGELOG.md b/packages/siwe/CHANGELOG.md index 1db5848557..e13be22116 100644 --- a/packages/siwe/CHANGELOG.md +++ b/packages/siwe/CHANGELOG.md @@ -1,5 +1,25 @@ # @web3modal/siwe +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/common@5.1.4 + - @web3modal/core@5.1.4 + - @web3modal/scaffold-utils@5.1.4 + - @web3modal/ui@5.1.4 + - @web3modal/wallet@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/packages/siwe/package.json b/packages/siwe/package.json index c092c65450..40e37289b7 100644 --- a/packages/siwe/package.json +++ b/packages/siwe/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/siwe", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/solana/CHANGELOG.md b/packages/solana/CHANGELOG.md index 03c3e5c1a3..8330b00316 100644 --- a/packages/solana/CHANGELOG.md +++ b/packages/solana/CHANGELOG.md @@ -1,5 +1,26 @@ # @web3modal/solana +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/base@5.1.4 + - @web3modal/common@5.1.4 + - @web3modal/core@5.1.4 + - @web3modal/polyfills@5.1.4 + - @web3modal/scaffold-utils@5.1.4 + - @web3modal/wallet@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/packages/solana/package.json b/packages/solana/package.json index 573245cdbf..c4f6199cb4 100644 --- a/packages/solana/package.json +++ b/packages/solana/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/solana", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/ui/CHANGELOG.md b/packages/ui/CHANGELOG.md index 7aa5125a32..2ef0a01cee 100644 --- a/packages/ui/CHANGELOG.md +++ b/packages/ui/CHANGELOG.md @@ -1,5 +1,19 @@ # @web3modal/ui +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 + ## 5.1.3 ### Patch Changes diff --git a/packages/ui/package.json b/packages/ui/package.json index a772054b11..a33982355d 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/ui", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/index.js", "types": "./dist/types/index.d.ts", diff --git a/packages/wagmi/CHANGELOG.md b/packages/wagmi/CHANGELOG.md index de9ec8cc72..da39f61a97 100644 --- a/packages/wagmi/CHANGELOG.md +++ b/packages/wagmi/CHANGELOG.md @@ -1,5 +1,26 @@ # @web3modal/wagmi +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/base@5.1.4 + - @web3modal/common@5.1.4 + - @web3modal/polyfills@5.1.4 + - @web3modal/scaffold-utils@5.1.4 + - @web3modal/siwe@5.1.4 + - @web3modal/wallet@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/packages/wagmi/package.json b/packages/wagmi/package.json index aa26881d77..a2a119e045 100644 --- a/packages/wagmi/package.json +++ b/packages/wagmi/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/wagmi", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/wallet/CHANGELOG.md b/packages/wallet/CHANGELOG.md index c33d2f7f29..bcda2cebb4 100644 --- a/packages/wallet/CHANGELOG.md +++ b/packages/wallet/CHANGELOG.md @@ -1,5 +1,22 @@ # @web3modal/wallet +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/common@5.1.4 + - @web3modal/polyfills@5.1.4 + ## 5.1.3 ### Patch Changes diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 9c9d703710..f655222761 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/wallet", - "version": "5.1.3", + "version": "5.1.4", "type": "module", "main": "./dist/esm/index.js", "types": "./dist/types/index.d.ts", From fe31c8309b4ac5b6575208a4817fb88eb548de1c Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Fri, 30 Aug 2024 08:11:52 -0300 Subject: [PATCH 02/17] chore: add safety for localstorage (#2770) --- packages/base/adapters/evm/ethers/client.ts | 50 ++++--- packages/base/adapters/evm/ethers5/client.ts | 48 ++++--- .../base/adapters/solana/web3js/client.ts | 17 +-- packages/base/package.json | 3 +- packages/base/utils/SafeLocalStorage.test.ts | 49 +++++++ packages/base/utils/SafeLocalStorage.ts | 40 ++++++ .../src/ethers/EthersConstantsUtil.ts | 2 +- pnpm-lock.yaml | 124 +++--------------- 8 files changed, 167 insertions(+), 166 deletions(-) create mode 100644 packages/base/utils/SafeLocalStorage.test.ts create mode 100644 packages/base/utils/SafeLocalStorage.ts diff --git a/packages/base/adapters/evm/ethers/client.ts b/packages/base/adapters/evm/ethers/client.ts index 3b5a8f91a2..55880827ea 100644 --- a/packages/base/adapters/evm/ethers/client.ts +++ b/packages/base/adapters/evm/ethers/client.ts @@ -53,6 +53,7 @@ import type { W3mFrameTypes } from '@web3modal/wallet' import type { AppKit } from '../../../src/client.js' import type { AppKitOptions } from '../../../utils/TypesUtil.js' import type { OptionsControllerState } from '@web3modal/core' +import { SafeLocalStorage } from '../../../utils/SafeLocalStorage.js' // -- Types --------------------------------------------------------------------- export interface AdapterOptions extends Pick { @@ -168,7 +169,7 @@ export class EVMEthersClient { getApprovedCaipNetworksData: async () => new Promise(async resolve => { - const walletChoice = localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const walletChoice = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) if (walletChoice?.includes(ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID)) { const provider = await this.getWalletConnectProvider() if (!provider) { @@ -343,7 +344,7 @@ export class EVMEthersClient { disconnect: async () => { const provider = EthersStoreUtil.state.provider const providerType = EthersStoreUtil.state.providerType - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() this.appKit?.setClientId(null) if (siweConfig?.options?.signOutOnDisconnect) { @@ -368,7 +369,7 @@ export class EVMEthersClient { } provider?.emit?.('disconnect') - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() }, @@ -641,7 +642,7 @@ export class EVMEthersClient { public async disconnect() { const { provider, providerType } = EthersStoreUtil.state - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() this.appKit?.setClientId(null) @@ -752,7 +753,7 @@ export class EVMEthersClient { private async checkActiveWalletConnectProvider() { const WalletConnectProvider = await this.getWalletConnectProvider() - const walletId = localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const walletId = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) if (WalletConnectProvider) { if (walletId === ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID) { @@ -766,7 +767,7 @@ export class EVMEthersClient { private checkActiveInjectedProvider(config: ProviderType) { const InjectedProvider = config.injected - const walletId = localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const walletId = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) if (InjectedProvider) { if (walletId === ConstantsUtil.INJECTED_CONNECTOR_ID) { @@ -778,7 +779,7 @@ export class EVMEthersClient { private checkActiveCoinbaseProvider(config: ProviderType) { const CoinbaseProvider = config.coinbase as unknown as ExternalProvider - const walletId = localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const walletId = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) if (CoinbaseProvider) { if (walletId === ConstantsUtil.COINBASE_SDK_CONNECTOR_ID) { @@ -786,7 +787,7 @@ export class EVMEthersClient { this.setCoinbaseProvider(config) this.watchCoinbase(config) } else { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() } } @@ -794,7 +795,7 @@ export class EVMEthersClient { } private checkActive6963Provider() { - const currentActiveWallet = window?.localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const currentActiveWallet = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) if (currentActiveWallet) { const currentProvider = this.EIP6963Providers.find( provider => provider.info.name === currentActiveWallet @@ -806,7 +807,7 @@ export class EVMEthersClient { } private async setWalletConnectProvider() { - window?.localStorage.setItem( + SafeLocalStorage.setItem( EthersConstantsUtil.WALLET_ID, ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID ) @@ -835,7 +836,7 @@ export class EVMEthersClient { } private async setInjectedProvider(config: ProviderType) { - window?.localStorage.setItem(EthersConstantsUtil.WALLET_ID, ConstantsUtil.INJECTED_CONNECTOR_ID) + SafeLocalStorage.setItem(EthersConstantsUtil.WALLET_ID, ConstantsUtil.INJECTED_CONNECTOR_ID) const InjectedProvider = config.injected if (InjectedProvider) { @@ -857,7 +858,7 @@ export class EVMEthersClient { } private async setEIP6963Provider(provider: Provider, name: string) { - window?.localStorage.setItem(EthersConstantsUtil.WALLET_ID, name) + SafeLocalStorage.setItem(EthersConstantsUtil.WALLET_ID, name) if (provider) { const { addresses, chainId } = await EthersHelpersUtil.getUserInfo(provider) @@ -878,10 +879,7 @@ export class EVMEthersClient { } private async setCoinbaseProvider(config: ProviderType) { - window?.localStorage.setItem( - EthersConstantsUtil.WALLET_ID, - ConstantsUtil.COINBASE_SDK_CONNECTOR_ID - ) + SafeLocalStorage.setItem(EthersConstantsUtil.WALLET_ID, ConstantsUtil.COINBASE_SDK_CONNECTOR_ID) const CoinbaseProvider = config.coinbase if (CoinbaseProvider) { const { addresses, chainId } = await EthersHelpersUtil.getUserInfo(CoinbaseProvider) @@ -902,7 +900,7 @@ export class EVMEthersClient { } private async setAuthProvider() { - window?.localStorage.setItem(EthersConstantsUtil.WALLET_ID, ConstantsUtil.AUTH_CONNECTOR_ID) + SafeLocalStorage.setItem(EthersConstantsUtil.WALLET_ID, ConstantsUtil.AUTH_CONNECTOR_ID) if (this.authProvider) { this.appKit?.setLoading(true) @@ -945,7 +943,7 @@ export class EVMEthersClient { const provider = await this.getWalletConnectProvider() function disconnectHandler() { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() provider?.removeListener('disconnect', disconnectHandler) provider?.removeListener('accountsChanged', accountsChangedHandler) @@ -976,7 +974,7 @@ export class EVMEthersClient { const provider = config.injected function disconnectHandler() { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() provider?.removeListener('disconnect', disconnectHandler) @@ -989,7 +987,7 @@ export class EVMEthersClient { if (currentAccount) { EthersStoreUtil.setAddress(getOriginalAddress(currentAccount) as Address) } else { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() } } @@ -1013,7 +1011,7 @@ export class EVMEthersClient { private watchEIP6963(provider: Provider) { function disconnectHandler() { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() provider.removeListener('disconnect', disconnectHandler) provider.removeListener('accountsChanged', accountsChangedHandler) @@ -1030,7 +1028,7 @@ export class EVMEthersClient { ) } else { this.appKit?.setAllAccounts([], this.chain) - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() } } @@ -1054,9 +1052,9 @@ export class EVMEthersClient { private watchCoinbase(config: ProviderType) { const provider = config.coinbase - const walletId = localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const walletId = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) function disconnectHandler() { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() provider?.removeListener('disconnect', disconnectHandler) @@ -1069,7 +1067,7 @@ export class EVMEthersClient { if (currentAccount) { EthersStoreUtil.setAddress(getOriginalAddress(currentAccount) as Address) } else { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() } } @@ -1322,7 +1320,7 @@ export class EVMEthersClient { } private syncConnectedWalletInfo() { - const currentActiveWallet = window?.localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const currentActiveWallet = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) const providerType = EthersStoreUtil.state.providerType if (providerType === ConstantsUtil.EIP6963_CONNECTOR_ID) { diff --git a/packages/base/adapters/evm/ethers5/client.ts b/packages/base/adapters/evm/ethers5/client.ts index 700027efff..af886bb415 100644 --- a/packages/base/adapters/evm/ethers5/client.ts +++ b/packages/base/adapters/evm/ethers5/client.ts @@ -34,6 +34,7 @@ import type { Chain as AvailableChain } from '@web3modal/common' import type { AppKit } from '../../../src/client.js' import type { AppKitOptions } from '../../../utils/TypesUtil.js' import type { OptionsControllerState } from '@web3modal/core' +import { SafeLocalStorage } from '../../../utils/SafeLocalStorage.js' // -- Types --------------------------------------------------------------------- export interface AdapterOptions extends Pick { @@ -145,7 +146,7 @@ export class EVMEthers5Client { getApprovedCaipNetworksData: async () => new Promise(async resolve => { - const walletChoice = localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const walletChoice = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) if (walletChoice?.includes(ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID)) { const provider = await this.getWalletConnectProvider() if (!provider) { @@ -312,7 +313,7 @@ export class EVMEthers5Client { disconnect: async () => { const provider = EthersStoreUtil.state.provider const providerType = EthersStoreUtil.state.providerType - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() this.appKit?.setClientId(null) if (siweConfig?.options?.signOutOnDisconnect) { @@ -335,7 +336,7 @@ export class EVMEthers5Client { } provider?.emit?.('disconnect') - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() }, @@ -513,7 +514,7 @@ export class EVMEthers5Client { public async disconnect() { const { provider, providerType } = EthersStoreUtil.state - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() this.appKit?.setClientId(null) @@ -589,7 +590,7 @@ export class EVMEthers5Client { private async checkActiveWalletConnectProvider() { const WalletConnectProvider = await this.getWalletConnectProvider() - const walletId = localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const walletId = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) if (WalletConnectProvider) { if (walletId === ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID) { @@ -603,7 +604,7 @@ export class EVMEthers5Client { private checkActiveInjectedProvider(config: ProviderType) { const InjectedProvider = config.injected - const walletId = localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const walletId = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) if (InjectedProvider) { if (walletId === ConstantsUtil.INJECTED_CONNECTOR_ID) { @@ -615,7 +616,7 @@ export class EVMEthers5Client { private checkActiveCoinbaseProvider(config: ProviderType) { const CoinbaseProvider = config.coinbase as unknown as ExternalProvider - const walletId = localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const walletId = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) if (CoinbaseProvider) { if (walletId === ConstantsUtil.COINBASE_SDK_CONNECTOR_ID) { @@ -623,7 +624,7 @@ export class EVMEthers5Client { this.setCoinbaseProvider(config) this.watchCoinbase(config) } else { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() } } @@ -631,7 +632,7 @@ export class EVMEthers5Client { } private checkActive6963Provider() { - const currentActiveWallet = window?.localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const currentActiveWallet = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) if (currentActiveWallet) { const currentProvider = this.EIP6963Providers.find( provider => provider.info.name === currentActiveWallet @@ -643,7 +644,7 @@ export class EVMEthers5Client { } private async setWalletConnectProvider() { - window?.localStorage.setItem( + SafeLocalStorage.setItem( EthersConstantsUtil.WALLET_ID, ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID ) @@ -660,7 +661,7 @@ export class EVMEthers5Client { } private async setEIP6963Provider(provider: Provider, name: string) { - window?.localStorage.setItem(EthersConstantsUtil.WALLET_ID, name) + SafeLocalStorage.setItem(EthersConstantsUtil.WALLET_ID, name) if (provider) { const { addresses, chainId } = await EthersHelpersUtil.getUserInfo(provider) @@ -677,7 +678,7 @@ export class EVMEthers5Client { } private async setInjectedProvider(config: ProviderType) { - window?.localStorage.setItem(EthersConstantsUtil.WALLET_ID, ConstantsUtil.INJECTED_CONNECTOR_ID) + SafeLocalStorage.setItem(EthersConstantsUtil.WALLET_ID, ConstantsUtil.INJECTED_CONNECTOR_ID) const InjectedProvider = config.injected if (InjectedProvider) { @@ -695,10 +696,7 @@ export class EVMEthers5Client { } private async setCoinbaseProvider(config: ProviderType) { - window?.localStorage.setItem( - EthersConstantsUtil.WALLET_ID, - ConstantsUtil.COINBASE_SDK_CONNECTOR_ID - ) + SafeLocalStorage.setItem(EthersConstantsUtil.WALLET_ID, ConstantsUtil.COINBASE_SDK_CONNECTOR_ID) const CoinbaseProvider = config.coinbase if (CoinbaseProvider) { const { addresses, chainId } = await EthersHelpersUtil.getUserInfo(CoinbaseProvider) @@ -718,7 +716,7 @@ export class EVMEthers5Client { const WalletConnectProvider = await this.getWalletConnectProvider() function disconnectHandler() { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() WalletConnectProvider?.removeListener('disconnect', disconnectHandler) @@ -750,7 +748,7 @@ export class EVMEthers5Client { const InjectedProvider = config.injected function disconnectHandler() { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() InjectedProvider?.removeListener('disconnect', disconnectHandler) @@ -763,7 +761,7 @@ export class EVMEthers5Client { if (currentAccount) { EthersStoreUtil.setAddress(utils.getAddress(currentAccount) as Address) } else { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() } } @@ -787,7 +785,7 @@ export class EVMEthers5Client { private watchEIP6963(provider: Provider) { function disconnectHandler() { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() provider.removeListener('disconnect', disconnectHandler) @@ -800,7 +798,7 @@ export class EVMEthers5Client { if (currentAccount) { EthersStoreUtil.setAddress(utils.getAddress(currentAccount) as Address) } else { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() } } @@ -822,10 +820,10 @@ export class EVMEthers5Client { private watchCoinbase(config: ProviderType) { const CoinbaseProvider = config.coinbase - const walletId = localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const walletId = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) function disconnectHandler() { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() CoinbaseProvider?.removeListener('disconnect', disconnectHandler) @@ -835,7 +833,7 @@ export class EVMEthers5Client { function accountsChangedHandler(accounts: string[]) { if (accounts.length === 0) { - localStorage.removeItem(EthersConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() } else { EthersStoreUtil.setAddress(accounts[0] as Address) @@ -993,7 +991,7 @@ export class EVMEthers5Client { } private syncConnectedWalletInfo() { - const currentActiveWallet = window?.localStorage.getItem(EthersConstantsUtil.WALLET_ID) + const currentActiveWallet = SafeLocalStorage.getItem(EthersConstantsUtil.WALLET_ID) const providerType = EthersStoreUtil.state.providerType if (providerType === ConstantsUtil.EIP6963_CONNECTOR_ID) { diff --git a/packages/base/adapters/solana/web3js/client.ts b/packages/base/adapters/solana/web3js/client.ts index 8fe3946d26..5d2c1105b2 100644 --- a/packages/base/adapters/solana/web3js/client.ts +++ b/packages/base/adapters/solana/web3js/client.ts @@ -45,6 +45,7 @@ import { withSolanaNamespace } from './utils/withSolanaNamespace.js' import type { AppKit } from '../../../src/client.js' import type { AppKitOptions } from '../../../utils/TypesUtil.js' import type { OptionsControllerState } from '@web3modal/core' +import { SafeLocalStorage } from '../../../utils/SafeLocalStorage.js' export interface Web3ModalClientOptions extends Omit { @@ -222,7 +223,7 @@ export class SolanaWeb3JsClient { const chain = SolHelpersUtil.getChainFromCaip( chains, - typeof window === 'object' ? localStorage.getItem(SolConstantsUtil.CAIP_CHAIN_ID) : '' + SafeLocalStorage.getItem(SolConstantsUtil.CAIP_CHAIN_ID) || '' ) this.defaultChain = chain as CaipNetwork @@ -260,7 +261,7 @@ export class SolanaWeb3JsClient { if (NetworkController.state.caipNetwork && !SolStoreUtil.state.isConnected) { SolStoreUtil.setCaipChainId(`solana:${newChain.chainId}`) SolStoreUtil.setCurrentChain(newChain) - localStorage.setItem(SolConstantsUtil.CAIP_CHAIN_ID, `solana:${newChain.chainId}`) + SafeLocalStorage.setItem(SolConstantsUtil.CAIP_CHAIN_ID, `solana:${newChain.chainId}`) ApiController.reFetchWallets() } }) @@ -302,7 +303,7 @@ export class SolanaWeb3JsClient { // -- Private ----------------------------------------------------------------- private syncConnectedWalletInfo() { - const currentActiveWallet = window?.localStorage.getItem(SolConstantsUtil.WALLET_ID) + const currentActiveWallet = SafeLocalStorage.getItem(SolConstantsUtil.WALLET_ID) const provider = SolStoreUtil.state.provider if (provider?.type === 'WALLET_CONNECT') { @@ -387,7 +388,7 @@ export class SolanaWeb3JsClient { const chain = SolHelpersUtil.getChainFromCaip(this.chains, caipChainId) SolStoreUtil.setCaipChainId(chain.id) SolStoreUtil.setCurrentChain(chain) - localStorage.setItem(SolConstantsUtil.CAIP_CHAIN_ID, chain.id) + SafeLocalStorage.setItem(SolConstantsUtil.CAIP_CHAIN_ID, chain.id) await this.syncNetwork() await this.syncAccount() @@ -459,7 +460,7 @@ export class SolanaWeb3JsClient { SolStoreUtil.setProvider(provider) this.provider = provider - window?.localStorage.setItem(SolConstantsUtil.WALLET_ID, provider.name) + SafeLocalStorage.setItem(SolConstantsUtil.WALLET_ID, provider.name) await this.appKit?.setApprovedCaipNetworksData(this.chain) @@ -539,7 +540,7 @@ export class SolanaWeb3JsClient { } function disconnectHandler() { - localStorage.removeItem(SolConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(SolConstantsUtil.WALLET_ID) SolStoreUtil.reset() provider.removeListener('disconnect', disconnectHandler) @@ -555,7 +556,7 @@ export class SolanaWeb3JsClient { if (currentAccount) { SolStoreUtil.setAddress(currentAccount) } else { - localStorage.removeItem(SolConstantsUtil.WALLET_ID) + SafeLocalStorage.removeItem(SolConstantsUtil.WALLET_ID) SolStoreUtil.reset() } } @@ -614,7 +615,7 @@ export class SolanaWeb3JsClient { } private addProvider(...providers: Provider[]) { - const activeProviderName = localStorage.getItem(SolConstantsUtil.WALLET_ID) + const activeProviderName = SafeLocalStorage.getItem(SolConstantsUtil.WALLET_ID) for (const provider of providers) { this.availableProviders = this.availableProviders.filter(p => p.name !== provider.name) diff --git a/packages/base/package.json b/packages/base/package.json index 4e5c574a0c..73f878b9da 100644 --- a/packages/base/package.json +++ b/packages/base/package.json @@ -13,7 +13,8 @@ "build": "tsc --build tsconfig.build.json", "watch": "tsc --watch", "typecheck": "tsc --noEmit", - "lint": "eslint . --ext .js,.jsx,.ts,.tsx" + "lint": "eslint . --ext .js,.jsx,.ts,.tsx", + "test": "vitest run --coverage.enabled=true --coverage.reporter=json --coverage.reporter=json-summary --coverage.reportOnFailure=true" }, "exports": { ".": { diff --git a/packages/base/utils/SafeLocalStorage.test.ts b/packages/base/utils/SafeLocalStorage.test.ts new file mode 100644 index 0000000000..8415025d0c --- /dev/null +++ b/packages/base/utils/SafeLocalStorage.test.ts @@ -0,0 +1,49 @@ +import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' + +import { SafeLocalStorage } from './SafeLocalStorage' + +const previousLocalStorage = globalThis.localStorage +const previousWindow = globalThis.window + +afterAll(() => { + Object.assign(globalThis, { localStorage: previousLocalStorage, window: previousWindow }) +}) + +describe('SafeLocalStorage unsafe', () => { + beforeAll(() => { + Object.assign(globalThis, { window: {}, localStorage: undefined }) + }) + + it('should not setItem', () => { + const key = '@w3m/wallet_id' + + expect(SafeLocalStorage.setItem(key, '1')).toBe(undefined) + expect(SafeLocalStorage.getItem(key)).toBe(null) + expect(SafeLocalStorage.removeItem(key)).toBe(undefined) + }) +}) + +describe('SafeLocalStorage safe', () => { + let getItem = vi.fn(() => '{"test":"test"}') + let setItem = vi.fn() + let removeItem = vi.fn() + + beforeAll(() => { + Object.assign(globalThis, { window: {}, localStorage: { getItem, setItem, removeItem } }) + }) + + it('should setItem', () => { + expect(SafeLocalStorage.setItem('@w3m/wallet_id', 'test')).toBe(undefined) + expect(setItem).toHaveBeenCalledWith('@w3m/wallet_id', '"test"') + }) + + it('should getItem', () => { + expect(SafeLocalStorage.getItem('@w3m/wallet_id')).toEqual({ test: 'test' }) + expect(getItem).toHaveBeenCalledWith('@w3m/wallet_id') + }) + + it('should removeItem', () => { + expect(SafeLocalStorage.removeItem('@w3m/wallet_id')).toBe(undefined) + expect(removeItem).toHaveBeenCalledWith('@w3m/wallet_id') + }) +}) diff --git a/packages/base/utils/SafeLocalStorage.ts b/packages/base/utils/SafeLocalStorage.ts new file mode 100644 index 0000000000..cfcad189d2 --- /dev/null +++ b/packages/base/utils/SafeLocalStorage.ts @@ -0,0 +1,40 @@ +export type SafeLocalStorageItems = { + '@w3m/wallet_id': string + '@w3m/solana_caip_chain': string + '@w3m/solana_wallet': string +} + +export const SafeLocalStorage = { + setItem( + key: Key, + value: SafeLocalStorageItems[Key] + ): void { + if (isSafe()) { + localStorage.setItem(key, JSON.stringify(value)) + } + }, + getItem(key: Key): SafeLocalStorageItems[Key] | null { + if (isSafe()) { + const value = localStorage.getItem(key) + + if (value) { + try { + return JSON.parse(value) + } catch { + return null + } + } + } + + return null + }, + removeItem(key: Key): void { + if (isSafe()) { + localStorage.removeItem(key) + } + } +} + +function isSafe(): boolean { + return typeof window !== 'undefined' && typeof localStorage !== 'undefined' +} diff --git a/packages/scaffold-utils/src/ethers/EthersConstantsUtil.ts b/packages/scaffold-utils/src/ethers/EthersConstantsUtil.ts index 4f1689ab19..f123e4a819 100644 --- a/packages/scaffold-utils/src/ethers/EthersConstantsUtil.ts +++ b/packages/scaffold-utils/src/ethers/EthersConstantsUtil.ts @@ -2,4 +2,4 @@ export const EthersConstantsUtil = { WALLET_ID: '@w3m/wallet_id', ERROR_CODE_UNRECOGNIZED_CHAIN_ID: 4902, ERROR_CODE_DEFAULT: 5000 -} +} as const diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9e9c086b8a..1f19e3ae94 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -108,7 +108,7 @@ importers: version: 2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) wagmi: specifier: 2.12.5 - version: 2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) + version: 2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.2.0)(typescript@5.3.3)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) zustand: specifier: 4.5.2 version: 4.5.2(@types/react@18.2.62)(react@18.2.0) @@ -374,7 +374,7 @@ importers: version: 2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) wagmi: specifier: 2.12.5 - version: 2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) + version: 2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.2.0)(typescript@5.3.3)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) devDependencies: '@types/node': specifier: 20.11.5 @@ -510,7 +510,7 @@ importers: version: 5.2.11(@types/node@20.11.5)(terser@5.31.6) wagmi: specifier: 2.12.5 - version: 2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) + version: 2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.2.0)(typescript@5.3.3)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) devDependencies: '@types/react': specifier: 18.2.62 @@ -20067,45 +20067,6 @@ snapshots: - utf-8-validate - zod - '@wagmi/connectors@5.1.5(@types/react@18.2.62)(@wagmi/core@2.13.4(@tanstack/query-core@5.24.8)(@types/react@18.2.62)(react@18.2.0)(typescript@5.3.3)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4)))(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4)': - dependencies: - '@coinbase/wallet-sdk': 4.0.4 - '@metamask/sdk': 0.27.0(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(@types/react@18.2.0)(bufferutil@4.0.8)(react@18.2.0)(typescript@5.3.3)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.21.1)(utf-8-validate@5.0.10) - '@safe-global/safe-apps-provider': 0.18.3(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) - '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) - '@wagmi/core': 2.13.4(@tanstack/query-core@5.24.8)(@types/react@18.2.62)(react@18.2.0)(typescript@5.3.3)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4)) - '@walletconnect/ethereum-provider': 2.14.0(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.2.0)(utf-8-validate@5.0.10) - '@walletconnect/modal': 2.6.2(@types/react@18.2.62)(react@18.2.0) - cbw-sdk: '@coinbase/wallet-sdk@3.9.3' - viem: 2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) - optionalDependencies: - typescript: 5.3.3 - transitivePeerDependencies: - - '@azure/app-configuration' - - '@azure/cosmos' - - '@azure/data-tables' - - '@azure/identity' - - '@azure/keyvault-secrets' - - '@azure/storage-blob' - - '@capacitor/preferences' - - '@netlify/blobs' - - '@planetscale/database' - - '@react-native-async-storage/async-storage' - - '@types/react' - - '@upstash/redis' - - '@vercel/kv' - - bufferutil - - encoding - - ioredis - - react - - react-dom - - react-native - - rollup - - supports-color - - uWebSockets.js - - utf-8-validate - - zod - '@wagmi/core@2.13.4(@tanstack/query-core@5.24.8)(@types/react@18.2.0)(react@18.2.0)(typescript@5.3.3)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))': dependencies: eventemitter3: 5.0.1 @@ -22664,7 +22625,7 @@ snapshots: '@typescript-eslint/parser': 6.18.1(eslint@8.56.0)(typescript@5.3.3) eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.56.0))(eslint@8.56.0) eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.56.0) eslint-plugin-jsx-a11y: 6.9.0(eslint@8.56.0) eslint-plugin-react: 7.35.0(eslint@8.56.0) @@ -22683,8 +22644,8 @@ snapshots: '@typescript-eslint/parser': 6.18.1(eslint@8.57.0)(typescript@5.3.3) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0) - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0))(eslint@8.57.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0) eslint-plugin-jsx-a11y: 6.9.0(eslint@8.57.0) eslint-plugin-react: 7.35.0(eslint@8.57.0) eslint-plugin-react-hooks: 4.6.2(eslint@8.57.0) @@ -22707,13 +22668,13 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0): + eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.56.0))(eslint@8.56.0): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.3.6 enhanced-resolve: 5.17.1 eslint: 8.56.0 - eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0))(eslint@8.56.0) + eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.56.0))(eslint@8.56.0))(eslint@8.56.0) fast-glob: 3.3.2 get-tsconfig: 4.7.6 is-bun-module: 1.1.0 @@ -22726,54 +22687,44 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0): + eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0))(eslint@8.57.0): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.3.6 enhanced-resolve: 5.17.1 eslint: 8.57.0 - eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0) + eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) fast-glob: 3.3.2 get-tsconfig: 4.7.6 is-bun-module: 1.1.0 is-glob: 4.0.3 optionalDependencies: - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0) transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0))(eslint@8.56.0): + eslint-module-utils@2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.56.0))(eslint@8.56.0))(eslint@8.56.0): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 6.18.1(eslint@8.56.0)(typescript@5.3.3) eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.56.0))(eslint@8.56.0) transitivePeerDependencies: - supports-color - eslint-module-utils@2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): - dependencies: - debug: 3.2.7 - optionalDependencies: - '@typescript-eslint/parser': 6.18.1(eslint@8.56.0)(typescript@5.3.3) - eslint: 8.57.0 - eslint-import-resolver-node: 0.3.9 - transitivePeerDependencies: - - supports-color - - eslint-module-utils@2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0): + eslint-module-utils@2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 6.18.1(eslint@8.57.0)(typescript@5.3.3) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0))(eslint@8.57.0) transitivePeerDependencies: - supports-color @@ -22787,7 +22738,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0))(eslint@8.56.0) + eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.56.0))(eslint@8.56.0))(eslint@8.56.0) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -22804,7 +22755,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0): + eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0): dependencies: array-includes: 3.1.8 array.prototype.findlastindex: 1.2.5 @@ -22814,7 +22765,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) + eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -22825,7 +22776,7 @@ snapshots: semver: 6.3.1 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 6.18.1(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/parser': 6.18.1(eslint@8.57.0)(typescript@5.3.3) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -27958,43 +27909,6 @@ snapshots: - utf-8-validate - zod - wagmi@2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4): - dependencies: - '@tanstack/react-query': 5.24.8(react@18.2.0) - '@wagmi/connectors': 5.1.5(@types/react@18.2.62)(@wagmi/core@2.13.4(@tanstack/query-core@5.24.8)(@types/react@18.2.62)(react@18.2.0)(typescript@5.3.3)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4)))(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) - '@wagmi/core': 2.13.4(@tanstack/query-core@5.24.8)(@types/react@18.2.62)(react@18.2.0)(typescript@5.3.3)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4)) - react: 18.2.0 - use-sync-external-store: 1.2.0(react@18.2.0) - viem: 2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) - optionalDependencies: - typescript: 5.3.3 - transitivePeerDependencies: - - '@azure/app-configuration' - - '@azure/cosmos' - - '@azure/data-tables' - - '@azure/identity' - - '@azure/keyvault-secrets' - - '@azure/storage-blob' - - '@capacitor/preferences' - - '@netlify/blobs' - - '@planetscale/database' - - '@react-native-async-storage/async-storage' - - '@tanstack/query-core' - - '@types/react' - - '@upstash/redis' - - '@vercel/kv' - - bufferutil - - encoding - - immer - - ioredis - - react-dom - - react-native - - rollup - - supports-color - - uWebSockets.js - - utf-8-validate - - zod - walker@1.0.8: dependencies: makeerror: 1.0.12 From f59d39a1681064dc0a4ee5a0c2355d1fb50833c4 Mon Sep 17 00:00:00 2001 From: MK <53529533+magiziz@users.noreply.github.com> Date: Fri, 30 Aug 2024 20:36:07 +0200 Subject: [PATCH 03/17] fix: impossible to press on send placeholder input on mobile (#2771) --- packages/scaffold-ui/src/partials/w3m-input-address/styles.ts | 1 + packages/scaffold-ui/src/views/w3m-wallet-send-view/styles.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/scaffold-ui/src/partials/w3m-input-address/styles.ts b/packages/scaffold-ui/src/partials/w3m-input-address/styles.ts index 5af92ba074..1812789604 100644 --- a/packages/scaffold-ui/src/partials/w3m-input-address/styles.ts +++ b/packages/scaffold-ui/src/partials/w3m-input-address/styles.ts @@ -31,6 +31,7 @@ export default css` position: absolute; top: 50%; transform: translateY(-50%); + z-index: 2; } .paste { diff --git a/packages/scaffold-ui/src/views/w3m-wallet-send-view/styles.ts b/packages/scaffold-ui/src/views/w3m-wallet-send-view/styles.ts index a1b28dd535..7db0b71747 100644 --- a/packages/scaffold-ui/src/views/w3m-wallet-send-view/styles.ts +++ b/packages/scaffold-ui/src/views/w3m-wallet-send-view/styles.ts @@ -19,7 +19,7 @@ export default css` top: 50%; left: 50%; transform: translate(-50%, -50%); - z-index: 1; + z-index: 3; } wui-button { From be93b51daf8d223dd36bc6eba88aedfce5984b88 Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Fri, 30 Aug 2024 18:30:21 -0300 Subject: [PATCH 04/17] feat: solana sign all transactions (#2772) --- .../Solana/SolanaSignAllTransactionsTest.tsx | 136 ++++++++++++++++++ .../Solana/SolanaSignTransactionTest.tsx | 13 +- .../src/components/Solana/SolanaTests.tsx | 13 ++ .../solana/web3js/providers/AuthProvider.ts | 25 ++++ .../web3js/providers/WalletConnectProvider.ts | 6 + .../providers/WalletStandardProvider.ts | 29 ++++ .../solana/web3js/tests/AuthProvider.test.ts | 16 +++ .../web3js/tests/GenericProvider.test.ts | 21 +++ .../tests/WalletConnectProvider.test.ts | 71 +++++++++ .../tests/WalletStandardProvider.test.ts | 13 ++ .../web3js/tests/mocks/W3mFrameProvider.ts | 12 +- .../web3js/tests/mocks/WalletStandard.ts | 10 +- .../src/solana/SolanaTypesUtil.ts | 1 + packages/wallet/src/W3mFrameConstants.ts | 1 + packages/wallet/src/W3mFrameSchema.ts | 8 ++ packages/wallet/src/W3mFrameTypes.ts | 4 +- pnpm-lock.yaml | 118 ++++++++++++--- 17 files changed, 459 insertions(+), 38 deletions(-) create mode 100644 apps/laboratory/src/components/Solana/SolanaSignAllTransactionsTest.tsx diff --git a/apps/laboratory/src/components/Solana/SolanaSignAllTransactionsTest.tsx b/apps/laboratory/src/components/Solana/SolanaSignAllTransactionsTest.tsx new file mode 100644 index 0000000000..e271cd0a32 --- /dev/null +++ b/apps/laboratory/src/components/Solana/SolanaSignAllTransactionsTest.tsx @@ -0,0 +1,136 @@ +import { useState } from 'react' +import { Button, Stack, Text, Spacer } from '@chakra-ui/react' +import { + PublicKey, + Transaction, + TransactionMessage, + VersionedTransaction, + SystemProgram +} from '@solana/web3.js' + +import { useWeb3ModalAccount, useWeb3ModalProvider, type Provider } from '@web3modal/solana/react' + +import { solana } from '../../utils/ChainsUtil' +import { useChakraToast } from '../Toast' +import type { Connection } from '@web3modal/base/adapters/solana/web3js' +import bs58 from 'bs58' + +const PHANTOM_DEVNET_ADDRESS = '8vCyX7oB6Pc3pbWMGYYZF5pbSnAdQ7Gyr32JqxqCy8ZR' +const recipientAddress = new PublicKey(PHANTOM_DEVNET_ADDRESS) +const amountInLamports = 1_000_000 + +export function SolanaSignAllTransactionsTest() { + const toast = useChakraToast() + const { chainId } = useWeb3ModalAccount() + const { walletProvider, connection } = useWeb3ModalProvider() + const [loading, setLoading] = useState(false) + + async function onSignTransaction(type: 'legacy' | 'versioned') { + try { + setLoading(true) + if (!walletProvider?.publicKey) { + throw Error('user is disconnected') + } + + if (!connection) { + throw Error('no connection set') + } + + const transactions = await Promise.all( + Array.from({ length: 5 }, () => createTransaction(walletProvider, connection, type)) + ) + const response = await walletProvider.signAllTransactions(transactions) + + const description = response + .map(transaction => { + const signature = + transaction.signatures[0] instanceof Uint8Array + ? transaction.signatures[0] + : transaction.signatures[0]?.signature + + if (!signature) { + throw Error('Empty signature') + } + + return bs58.encode(signature) + }) + .join('\n\n') + + toast({ + title: 'Success', + description, + type: 'success' + }) + } catch (err) { + toast({ + title: 'Error', + description: (err as Error).message, + type: 'error' + }) + } finally { + setLoading(false) + } + } + + if (chainId === solana.chainId) { + return ( + + Switch to Solana Devnet or Testnet to test this feature + + ) + } + + return ( + + + + + + ) +} + +async function createTransaction( + provider: Provider, + connection: Connection, + type: 'legacy' | 'versioned' +) { + if (!provider.publicKey) { + throw Error('No public key found') + } + + const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash() + + const instructions = [ + SystemProgram.transfer({ + fromPubkey: provider.publicKey, + toPubkey: recipientAddress, + lamports: amountInLamports + }) + ] + + if (type === 'legacy') { + return new Transaction({ feePayer: provider.publicKey, blockhash, lastValidBlockHeight }).add( + ...instructions + ) + } + + return new VersionedTransaction( + new TransactionMessage({ + payerKey: provider.publicKey, + recentBlockhash: blockhash, + instructions + }).compileToV0Message() + ) +} diff --git a/apps/laboratory/src/components/Solana/SolanaSignTransactionTest.tsx b/apps/laboratory/src/components/Solana/SolanaSignTransactionTest.tsx index a189d5e985..f7b8ec5d60 100644 --- a/apps/laboratory/src/components/Solana/SolanaSignTransactionTest.tsx +++ b/apps/laboratory/src/components/Solana/SolanaSignTransactionTest.tsx @@ -1,5 +1,5 @@ import { useState } from 'react' -import { Button, Stack, Text, Spacer, Link } from '@chakra-ui/react' +import { Button, Stack, Text, Spacer } from '@chakra-ui/react' import { PublicKey, Transaction, @@ -12,6 +12,7 @@ import { useWeb3ModalAccount, useWeb3ModalProvider } from '@web3modal/solana/rea import { solana } from '../../utils/ChainsUtil' import { useChakraToast } from '../Toast' +import bs58 from 'bs58' const PHANTOM_DEVNET_ADDRESS = '8vCyX7oB6Pc3pbWMGYYZF5pbSnAdQ7Gyr32JqxqCy8ZR' const recipientAddress = new PublicKey(PHANTOM_DEVNET_ADDRESS) @@ -56,7 +57,7 @@ export function SolanaSignTransactionTest() { toast({ title: 'Success', - description: Uint8Array.from(signature), + description: bs58.encode(signature), type: 'success' }) } catch (err) { @@ -108,7 +109,7 @@ export function SolanaSignTransactionTest() { toast({ title: 'Success', - description: signature, + description: bs58.encode(signature), type: 'success' }) } catch (err) { @@ -147,12 +148,6 @@ export function SolanaSignTransactionTest() { Sign Versioned Transaction - - - - ) } diff --git a/apps/laboratory/src/components/Solana/SolanaTests.tsx b/apps/laboratory/src/components/Solana/SolanaTests.tsx index b940c1d24b..0414d51e28 100644 --- a/apps/laboratory/src/components/Solana/SolanaTests.tsx +++ b/apps/laboratory/src/components/Solana/SolanaTests.tsx @@ -17,6 +17,7 @@ import { SolanaSignMessageTest } from './SolanaSignMessageTest' import { SolanaWriteContractTest } from './SolanaWriteContractTest' import { solana, solanaDevnet, solanaTestnet } from '../../utils/ChainsUtil' import { SolanaSignAndSendTransaction } from './SolanaSignAndSendTransactionTest' +import { SolanaSignAllTransactionsTest } from './SolanaSignAllTransactionsTest' export function SolanaTests() { const { isConnected, currentChain } = useWeb3ModalAccount() @@ -48,6 +49,18 @@ export function SolanaTests() { + + + Sign All Transactions + + + ℹ️ + + + + + + Sign and Send Transaction (Dapp) diff --git a/packages/base/adapters/solana/web3js/providers/AuthProvider.ts b/packages/base/adapters/solana/web3js/providers/AuthProvider.ts index 7c33a23dc7..682859159d 100644 --- a/packages/base/adapters/solana/web3js/providers/AuthProvider.ts +++ b/packages/base/adapters/solana/web3js/providers/AuthProvider.ts @@ -131,6 +131,31 @@ export class AuthProvider extends ProviderEventEmitter implements Provider, Prov return signature } + public async signAllTransactions(transactions: T): Promise { + const result = await this.provider.request({ + method: 'solana_signAllTransactions', + params: { + transactions: transactions.map(transaction => this.serializeTransaction(transaction)) + } + }) + + return (result.transactions as string[]).map((encodedTransaction, index) => { + const transaction = transactions[index] + + if (!transaction) { + throw new Error('Invalid solana_signAllTransactions response') + } + + const decodedTransaction = base58.decode(encodedTransaction) + + if (isVersionedTransaction(transaction)) { + return VersionedTransaction.deserialize(decodedTransaction) + } + + return Transaction.from(decodedTransaction) + }) as T + } + // -- W3mFrameProvider methods ------------------------------------------- // connectEmail: ProviderAuthMethods['connectEmail'] = args => this.provider.connectEmail(args) connectOtp: ProviderAuthMethods['connectOtp'] = args => this.provider.connectOtp(args) diff --git a/packages/base/adapters/solana/web3js/providers/WalletConnectProvider.ts b/packages/base/adapters/solana/web3js/providers/WalletConnectProvider.ts index 5acbc03418..cc12dc8b78 100644 --- a/packages/base/adapters/solana/web3js/providers/WalletConnectProvider.ts +++ b/packages/base/adapters/solana/web3js/providers/WalletConnectProvider.ts @@ -177,6 +177,12 @@ export class WalletConnectProvider extends ProviderEventEmitter implements Provi return signature } + public async signAllTransactions(transactions: T): Promise { + return (await Promise.all( + transactions.map(transaction => this.signTransaction(transaction)) + )) as T + } + // -- Private ------------------------------------------ // private request( method: Method, diff --git a/packages/base/adapters/solana/web3js/providers/WalletStandardProvider.ts b/packages/base/adapters/solana/web3js/providers/WalletStandardProvider.ts index d91963fbdd..bba28eef2f 100644 --- a/packages/base/adapters/solana/web3js/providers/WalletStandardProvider.ts +++ b/packages/base/adapters/solana/web3js/providers/WalletStandardProvider.ts @@ -183,6 +183,35 @@ export class WalletStandardProvider extends ProviderEventEmitter implements Prov return signature } + public async signAllTransactions(transactions: T): Promise { + const feature = this.getWalletFeature(SolanaSignTransaction) + + const account = this.getAccount(true) + const chain = this.getActiveChainName() + + const result = await feature.signTransaction( + ...transactions.map(transaction => ({ + transaction: this.serializeTransaction(transaction), + account, + chain + })) + ) + + return result.map(({ signedTransaction }, index) => { + const transaction = transactions[index] + + if (!transaction) { + throw new WalletSignTransactionError('Invalid transaction signature response') + } + + if (isVersionedTransaction(transaction)) { + return VersionedTransaction.deserialize(signedTransaction) + } + + return Transaction.from(signedTransaction) + }) as T + } + // -- Private ------------------------------------------- // private serializeTransaction(transaction: AnyTransaction) { return transaction.serialize({ verifySignatures: false }) diff --git a/packages/base/adapters/solana/web3js/tests/AuthProvider.test.ts b/packages/base/adapters/solana/web3js/tests/AuthProvider.test.ts index 4e9d3e397a..9da09a661f 100644 --- a/packages/base/adapters/solana/web3js/tests/AuthProvider.test.ts +++ b/packages/base/adapters/solana/web3js/tests/AuthProvider.test.ts @@ -134,4 +134,20 @@ describe('AuthProvider specific tests', () => { expect(provider.switchNetwork).toHaveBeenCalledWith(newChain.chainId) expect(listener).toHaveBeenCalledWith(newChain.chainId) }) + + it('should call signAllTransactions with correct params', async () => { + await authProvider.connect() + const transactions = [mockLegacyTransaction(), mockVersionedTransaction()] + await authProvider.signAllTransactions(transactions) + + expect(provider.request).toHaveBeenCalledWith({ + method: 'solana_signAllTransactions', + params: { + transactions: [ + 'AKhoybLLJS1deDJDyjELDNhfkBBX3k4dt4bBfmppjfPVVimhQdFEfDo8AiFcCBCC9VkYWV2r3jkh9n1DAXEhnJPwMmnsrx6huAVrhHAbmRUqfUuWZ9aWMGmdEWaeroCnPR6jkEnjJcn14a59TZhkiTXMygMqu4KaqD1TqzE8vNHSw3YgbW24cfqWfQczGysuy4ugxj4TGSpqRtNmf5D7zRRa76eJTeZEaBcBQGkqxb31vBRXDMdQzGEbq', + '48ckoQL1HhH5aqU1ifKqpQkwq3WPDgMnsHHQkVfddisxYcapwAVXr8hejTi2jeJpMPkZMsF72SwmJFDByyfRtaknz4ytCYNAcdHrxtrHa9hTjMKckVQrFFqS8zG63Wj5mJ6wPfj8dv1wKu2XkU6GSXSGdQmuvfRv3K6LUSMbK5XSP3yBGb1SDZKCuoFX4qDKcKhCG7Awn3ssAWB1yRaXMd6mS6HQHKSF11FTp3jTH2HKUNbKyyuGh4tYtq8b' + ] + } + }) + }) }) diff --git a/packages/base/adapters/solana/web3js/tests/GenericProvider.test.ts b/packages/base/adapters/solana/web3js/tests/GenericProvider.test.ts index 5811f21e2b..bdb619fa6f 100644 --- a/packages/base/adapters/solana/web3js/tests/GenericProvider.test.ts +++ b/packages/base/adapters/solana/web3js/tests/GenericProvider.test.ts @@ -9,6 +9,7 @@ import { Transaction, VersionedTransaction } from '@solana/web3.js' import { mockLegacyTransaction, mockVersionedTransaction } from './mocks/Transaction.js' import { AuthProvider } from '../providers/AuthProvider.js' import { mockW3mFrameProvider } from './mocks/W3mFrameProvider.js' +import { isVersionedTransaction } from '@solana/wallet-adapter-base' const getActiveChain = vi.fn(() => TestConstants.chains[0]) @@ -99,4 +100,24 @@ describe.each(providers)('Generic provider tests for $name', ({ provider }) => { expect(result).toBeTypeOf('string') }) + + it('should signAllTransactions with AnyTransaction', async () => { + const transactions = [ + mockLegacyTransaction(), + mockVersionedTransaction(), + mockLegacyTransaction(), + mockVersionedTransaction() + ] + const result = await provider.signAllTransactions(transactions) + + expect(result).toHaveLength(transactions.length) + + transactions.forEach((transaction, index) => { + if (isVersionedTransaction(transaction)) { + expect(result[index]).toBeInstanceOf(VersionedTransaction) + } else { + expect(result[index]).toBeInstanceOf(Transaction) + } + }) + }) }) diff --git a/packages/base/adapters/solana/web3js/tests/WalletConnectProvider.test.ts b/packages/base/adapters/solana/web3js/tests/WalletConnectProvider.test.ts index c0baa6b04c..1400a9460b 100644 --- a/packages/base/adapters/solana/web3js/tests/WalletConnectProvider.test.ts +++ b/packages/base/adapters/solana/web3js/tests/WalletConnectProvider.test.ts @@ -258,4 +258,75 @@ describe('WalletConnectProvider specific tests', () => { 'solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K' ) }) + + it('should call signTransaction correctly for signAllTransactions', async () => { + await walletConnectProvider.connect() + const transactions = [mockLegacyTransaction(), mockVersionedTransaction()] + await walletConnectProvider.signAllTransactions(transactions) + + expect(provider.request).toHaveBeenNthCalledWith( + 1, + { + method: 'solana_signTransaction', + params: { + feePayer: '2VqKhjZ766ZN3uBtBpb7Ls3cN4HrocP1rzxzekhVEgoP', + instructions: [ + { + data: '3Bxs4NN8M2Yn4TLb', + keys: [ + { + isSigner: true, + isWritable: true, + pubkey: '2VqKhjZ766ZN3uBtBpb7Ls3cN4HrocP1rzxzekhVEgoP' + }, + { + isSigner: false, + isWritable: true, + pubkey: '2VqKhjZ766ZN3uBtBpb7Ls3cN4HrocP1rzxzekhVEgoP' + } + ], + programId: '11111111111111111111111111111111' + } + ], + recentBlockhash: 'EZySCpmzXRuUtM95P2JGv9SitqYph6Nv6HaYBK7a8PKJ', + transaction: + 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAECFj6WhBP/eepC4T4bDgYuJMiSVXNh9IvPWv1ZDUV52gYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMmaU6FiJxS/swxct+H8Iree7FERP/8vrGuAdF90ANelAQECAAAMAgAAAICWmAAAAAAA', + pubkey: TestConstants.accounts[0].address + } + }, + 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' + ) + expect(provider.request).toHaveBeenNthCalledWith( + 2, + { + method: 'solana_signTransaction', + params: { + feePayer: '2VqKhjZ766ZN3uBtBpb7Ls3cN4HrocP1rzxzekhVEgoP', + instructions: [ + { + data: '3Bxs4NN8M2Yn4TLb', + keys: [ + { + isSigner: true, + isWritable: true, + pubkey: '2VqKhjZ766ZN3uBtBpb7Ls3cN4HrocP1rzxzekhVEgoP' + }, + { + isSigner: true, + isWritable: true, + pubkey: '2VqKhjZ766ZN3uBtBpb7Ls3cN4HrocP1rzxzekhVEgoP' + } + ], + programId: '11111111111111111111111111111111' + } + ], + recentBlockhash: 'EZySCpmzXRuUtM95P2JGv9SitqYph6Nv6HaYBK7a8PKJ', + transaction: + 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQABAhY+loQT/3nqQuE+Gw4GLiTIklVzYfSLz1r9WQ1FedoGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADJmlOhYicUv7MMXLfh/CK3nuxRET//L6xrgHRfdADXpQEBAgAADAIAAACAlpgAAAAAAAA=', + pubkey: TestConstants.accounts[0].address + } + }, + 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' + ) + }) }) diff --git a/packages/base/adapters/solana/web3js/tests/WalletStandardProvider.test.ts b/packages/base/adapters/solana/web3js/tests/WalletStandardProvider.test.ts index 6209ca47ea..3fce944bb5 100644 --- a/packages/base/adapters/solana/web3js/tests/WalletStandardProvider.test.ts +++ b/packages/base/adapters/solana/web3js/tests/WalletStandardProvider.test.ts @@ -125,4 +125,17 @@ describe('WalletStandardProvider specific tests', () => { walletStandardProvider.signAndSendTransaction(mockLegacyTransaction()) ).rejects.toThrowError(WalletStandardFeatureNotSupportedError) }) + + it('should call signTransaction with correct params for multiple transactions over singAllTransactions method', async () => { + const transactions = [mockLegacyTransaction(), mockVersionedTransaction()] + await walletStandardProvider.signAllTransactions(transactions) + + expect(wallet.features[SolanaSignTransaction].signTransaction).toHaveBeenCalledWith( + ...transactions.map(transaction => ({ + transaction: transaction.serialize({ verifySignatures: false }), + account: wallet.accounts[0], + chain: 'solana:mainnet' + })) + ) + }) }) diff --git a/packages/base/adapters/solana/web3js/tests/mocks/W3mFrameProvider.ts b/packages/base/adapters/solana/web3js/tests/mocks/W3mFrameProvider.ts index 586d0e38df..08b0e55626 100644 --- a/packages/base/adapters/solana/web3js/tests/mocks/W3mFrameProvider.ts +++ b/packages/base/adapters/solana/web3js/tests/mocks/W3mFrameProvider.ts @@ -8,8 +8,8 @@ export function mockW3mFrameProvider() { w3mFrame.connect = vi.fn(() => Promise.resolve(mockSession())) w3mFrame.disconnect = vi.fn(() => Promise.resolve(undefined)) - w3mFrame.request = vi.fn(({ method }: W3mFrameTypes.RPCRequest) => { - switch (method) { + w3mFrame.request = vi.fn((request: W3mFrameTypes.RPCRequest) => { + switch (request.method) { case 'solana_signMessage': return Promise.resolve({ signature: @@ -25,6 +25,14 @@ export function mockW3mFrameProvider() { signature: '2Lb1KQHWfbV3pWMqXZveFWqneSyhH95YsgCENRWnArSkLydjN1M42oB82zSd6BBdGkM9pE6sQLQf1gyBh8KWM2c4' }) + case 'solana_signAllTransactions': + return Promise.resolve({ + transactions: Array.from({ length: request.params.transactions.length }).map( + () => + '4zZMC2ddAFY1YHcA2uFCqbuTHmD1xvB5QLzgNnT3dMb4aQT98md8jVm1YRGUsKJkYkLPYarnkobvESUpjqEUnDmoG76e9cgNJzLuFXBW1i6njs2Sy1Lnr9TZmLnhif5CYjh1agVJEvjfYpTq1QbTnLS3rBt4yKVjQ6FcV3x22Vm3XBPqodTXz17o1YcHMcvYQbHZfVUyikQ3Nmv6ktZzWe36D6ceKCVBV88VvYkkFhwWUWkA5ErPvsHWQU64VvbtENaJXFUUnuqTFSX4q3ccHuHdmtnhWQ7Mv8Xkb' + ) + }) + default: return Promise.reject(new Error('not implemented')) } diff --git a/packages/base/adapters/solana/web3js/tests/mocks/WalletStandard.ts b/packages/base/adapters/solana/web3js/tests/mocks/WalletStandard.ts index 13fa9a91fa..89da7f495e 100644 --- a/packages/base/adapters/solana/web3js/tests/mocks/WalletStandard.ts +++ b/packages/base/adapters/solana/web3js/tests/mocks/WalletStandard.ts @@ -43,9 +43,9 @@ export function mockWalletStandard() { 'solana:signTransaction': { version: '1.0.0', supportedTransactionVersions: [0, 'legacy'], - signTransaction: vi.fn(() => - Promise.resolve([ - { + signTransaction: vi.fn((...transactions: unknown[]) => + Promise.resolve( + Array.from({ length: transactions.length }, () => ({ signedTransaction: new Uint8Array([ 1, 195, 86, 227, 117, 63, 116, 76, 21, 3, 236, 37, 188, 235, 178, 151, 68, 192, 248, 193, 10, 232, 44, 63, 138, 193, 225, 213, 179, 76, 95, 250, 42, 74, 225, 195, 254, @@ -62,8 +62,8 @@ export function mockWalletStandard() { 0, 0, 0, 0, 3, 0, 5, 2, 64, 13, 3, 0, 2, 2, 0, 1, 12, 2, 0, 0, 0, 128, 150, 152, 0, 0, 0, 0, 0 ]) - } - ]) + })) + ) ) } satisfies SolanaSignTransactionFeature['solana:signTransaction'], diff --git a/packages/scaffold-utils/src/solana/SolanaTypesUtil.ts b/packages/scaffold-utils/src/solana/SolanaTypesUtil.ts index c65f6b376e..91df22a5de 100644 --- a/packages/scaffold-utils/src/solana/SolanaTypesUtil.ts +++ b/packages/scaffold-utils/src/solana/SolanaTypesUtil.ts @@ -56,6 +56,7 @@ export interface Provider extends ProviderEventEmitterMethods { connection: Connection, options?: SendTransactionOptions ) => Promise + signAllTransactions: (transactions: T) => Promise } export interface ProviderEventEmitterMethods { diff --git a/packages/wallet/src/W3mFrameConstants.ts b/packages/wallet/src/W3mFrameConstants.ts index 7185425f72..1a5323c9de 100644 --- a/packages/wallet/src/W3mFrameConstants.ts +++ b/packages/wallet/src/W3mFrameConstants.ts @@ -142,6 +142,7 @@ export const W3mFrameRpcConstants = { 'eth_sendTransaction', 'solana_signMessage', 'solana_signTransaction', + 'solana_signAllTransactions', 'solana_signAndSendTransaction', 'wallet_sendCalls', 'wallet_grantPermissions' diff --git a/packages/wallet/src/W3mFrameSchema.ts b/packages/wallet/src/W3mFrameSchema.ts index 776cbd4773..dd119b7cf0 100644 --- a/packages/wallet/src/W3mFrameSchema.ts +++ b/packages/wallet/src/W3mFrameSchema.ts @@ -326,6 +326,13 @@ export const RpcSolanaSignTransactionRequest = z.object({ }) }) +export const RpcSolanaSignAllTransactionsRequest = z.object({ + method: z.literal('solana_signAllTransactions'), + params: z.object({ + transactions: z.array(z.string()) + }) +}) + export const RpcSolanaSignAndSendTransactionRequest = z.object({ method: z.literal('solana_signAndSendTransaction'), params: z.object({ @@ -503,6 +510,7 @@ export const W3mFrameSchema = { .or(RpcEthSendTransactionRequest) .or(RpcSolanaSignMessageRequest) .or(RpcSolanaSignTransactionRequest) + .or(RpcSolanaSignAllTransactionsRequest) .or(RpcSolanaSignAndSendTransactionRequest) .or(WalletGetCallsReceiptRequest) .or(WalletSendCallsRequest) diff --git a/packages/wallet/src/W3mFrameTypes.ts b/packages/wallet/src/W3mFrameTypes.ts index 2fef971b06..fa43cee93e 100644 --- a/packages/wallet/src/W3mFrameTypes.ts +++ b/packages/wallet/src/W3mFrameTypes.ts @@ -71,7 +71,8 @@ import { WalletGrantPermissionsRequest, RpcSolanaSignMessageRequest, RpcSolanaSignTransactionRequest, - RpcSolanaSignAndSendTransactionRequest + RpcSolanaSignAndSendTransactionRequest, + RpcSolanaSignAllTransactionsRequest } from './W3mFrameSchema.js' import type { W3mFrameRpcConstants } from './W3mFrameConstants.js' import type { CaipNetworkId } from '@web3modal/common' @@ -174,6 +175,7 @@ export namespace W3mFrameTypes { | z.infer | z.infer | z.infer + | z.infer | z.infer | z.infer | z.infer diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1f19e3ae94..d7d5d927bd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,7 +66,7 @@ importers: version: 0.22.0(rollup@4.21.1)(vite@5.2.11(@types/node@20.11.5)(terser@5.31.6)) vitest: specifier: 2.0.3 - version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6) + version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6) apps/demo: dependencies: @@ -108,7 +108,7 @@ importers: version: 2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) wagmi: specifier: 2.12.5 - version: 2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.2.0)(typescript@5.3.3)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) + version: 2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) zustand: specifier: 4.5.2 version: 4.5.2(@types/react@18.2.62)(react@18.2.0) @@ -374,7 +374,7 @@ importers: version: 2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) wagmi: specifier: 2.12.5 - version: 2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.2.0)(typescript@5.3.3)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) + version: 2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) devDependencies: '@types/node': specifier: 20.11.5 @@ -510,7 +510,7 @@ importers: version: 5.2.11(@types/node@20.11.5)(terser@5.31.6) wagmi: specifier: 2.12.5 - version: 2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.2.0)(typescript@5.3.3)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) + version: 2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) devDependencies: '@types/react': specifier: 18.2.62 @@ -651,7 +651,7 @@ importers: version: 18.2.0 '@vitest/coverage-v8': specifier: 2.0.5 - version: 2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6)) + version: 2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6)) '@vue/runtime-core': specifier: 3.4.3 version: 3.4.3 @@ -699,7 +699,7 @@ importers: version: 2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) vitest: specifier: 2.0.3 - version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6) + version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6) vue: specifier: 3.4.3 version: 3.4.3(typescript@5.3.3) @@ -752,10 +752,10 @@ importers: devDependencies: '@vitest/coverage-v8': specifier: 2.0.5 - version: 2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6)) + version: 2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6)) vitest: specifier: 2.0.3 - version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6) + version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6) packages/core: dependencies: @@ -771,13 +771,13 @@ importers: devDependencies: '@vitest/coverage-v8': specifier: 2.0.5 - version: 2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6)) + version: 2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6)) viem: specifier: 2.19.6 version: 2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) vitest: specifier: 2.0.3 - version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6) + version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6) packages/ethers: dependencies: @@ -1037,13 +1037,13 @@ importers: version: 5.1.5 '@vitest/coverage-v8': specifier: 2.0.5 - version: 2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6)) + version: 2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6)) '@walletconnect/types': specifier: 2.14.0 version: 2.14.0 vitest: specifier: 2.0.3 - version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6) + version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6) packages/ui: dependencies: @@ -1059,7 +1059,7 @@ importers: version: 1.5.5 '@vitest/coverage-v8': specifier: 2.0.5 - version: 2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6)) + version: 2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6)) '@web3modal/common': specifier: workspace:* version: link:../common @@ -1077,7 +1077,7 @@ importers: version: 2.0.4(eslint@8.57.0) vitest: specifier: 2.0.3 - version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6) + version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6) packages/wagmi: dependencies: @@ -1123,7 +1123,7 @@ importers: version: 2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) vitest: specifier: 2.0.3 - version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6) + version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6) vue: specifier: 3.4.3 version: 3.4.3(typescript@5.3.3) @@ -1148,13 +1148,13 @@ importers: devDependencies: '@vitest/coverage-v8': specifier: 2.0.5 - version: 2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6)) + version: 2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6)) jsdom: specifier: 24.1.0 version: 24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) vitest: specifier: 2.0.3 - version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6) + version: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6) services/id-allocation-service: dependencies: @@ -19877,11 +19877,11 @@ snapshots: std-env: 3.7.0 test-exclude: 6.0.0 v8-to-istanbul: 9.3.0 - vitest: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6) + vitest: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6) transitivePeerDependencies: - supports-color - '@vitest/coverage-v8@2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6))': + '@vitest/coverage-v8@2.0.5(vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6))': dependencies: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 0.2.3 @@ -19895,7 +19895,7 @@ snapshots: std-env: 3.7.0 test-exclude: 7.0.1 tinyrainbow: 1.2.0 - vitest: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6) + vitest: 2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6) transitivePeerDependencies: - supports-color @@ -20067,6 +20067,45 @@ snapshots: - utf-8-validate - zod + '@wagmi/connectors@5.1.5(@types/react@18.2.62)(@wagmi/core@2.13.4(@tanstack/query-core@5.24.8)(@types/react@18.2.62)(react@18.2.0)(typescript@5.3.3)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4)))(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4)': + dependencies: + '@coinbase/wallet-sdk': 4.0.4 + '@metamask/sdk': 0.27.0(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(@types/react@18.2.0)(bufferutil@4.0.8)(react@18.2.0)(typescript@5.3.3)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.21.1)(utf-8-validate@5.0.10) + '@safe-global/safe-apps-provider': 0.18.3(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) + '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) + '@wagmi/core': 2.13.4(@tanstack/query-core@5.24.8)(@types/react@18.2.62)(react@18.2.0)(typescript@5.3.3)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4)) + '@walletconnect/ethereum-provider': 2.14.0(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.2.0)(utf-8-validate@5.0.10) + '@walletconnect/modal': 2.6.2(@types/react@18.2.62)(react@18.2.0) + cbw-sdk: '@coinbase/wallet-sdk@3.9.3' + viem: 2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) + optionalDependencies: + typescript: 5.3.3 + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@types/react' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - ioredis + - react + - react-dom + - react-native + - rollup + - supports-color + - uWebSockets.js + - utf-8-validate + - zod + '@wagmi/core@2.13.4(@tanstack/query-core@5.24.8)(@types/react@18.2.0)(react@18.2.0)(typescript@5.3.3)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))': dependencies: eventemitter3: 5.0.1 @@ -27784,7 +27823,7 @@ snapshots: fsevents: 2.3.3 terser: 5.31.6 - vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0)(terser@5.31.6): + vitest@2.0.3(@types/node@20.11.5)(jsdom@24.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.31.6): dependencies: '@ampproject/remapping': 2.3.0 '@vitest/expect': 2.0.3 @@ -27909,6 +27948,43 @@ snapshots: - utf-8-validate - zod + wagmi@2.12.5(@tanstack/query-core@5.24.8)(@tanstack/react-query@5.24.8(react@18.2.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4): + dependencies: + '@tanstack/react-query': 5.24.8(react@18.2.0) + '@wagmi/connectors': 5.1.5(@types/react@18.2.62)(@wagmi/core@2.13.4(@tanstack/query-core@5.24.8)(@types/react@18.2.62)(react@18.2.0)(typescript@5.3.3)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4)))(bufferutil@4.0.8)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@4.21.1)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4))(zod@3.22.4) + '@wagmi/core': 2.13.4(@tanstack/query-core@5.24.8)(@types/react@18.2.62)(react@18.2.0)(typescript@5.3.3)(viem@2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4)) + react: 18.2.0 + use-sync-external-store: 1.2.0(react@18.2.0) + viem: 2.19.6(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.22.4) + optionalDependencies: + typescript: 5.3.3 + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@tanstack/query-core' + - '@types/react' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - immer + - ioredis + - react-dom + - react-native + - rollup + - supports-color + - uWebSockets.js + - utf-8-validate + - zod + walker@1.0.8: dependencies: makeerror: 1.0.12 From 480a0961e6aa936321bc96fc025fae7751f1d7b6 Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Sat, 31 Aug 2024 13:42:42 -0300 Subject: [PATCH 05/17] chore: change universal provider relay url and move to constants file (#2776) --- packages/base/adapters/solana/web3js/client.ts | 2 +- packages/scaffold-utils/src/solana/SolanaConstantsUtil.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/base/adapters/solana/web3js/client.ts b/packages/base/adapters/solana/web3js/client.ts index 5d2c1105b2..2d56c72e96 100644 --- a/packages/base/adapters/solana/web3js/client.ts +++ b/packages/base/adapters/solana/web3js/client.ts @@ -213,7 +213,7 @@ export class SolanaWeb3JsClient { } this.initializeProviders({ - relayUrl: 'wss://relay.walletconnect.com', + relayUrl: SolConstantsUtil.UNIVERSAL_PROVIDER_RELAY_URL, metadata: clientOptions.metadata, projectId: options.projectId, ...clientOptions.solanaConfig.auth diff --git a/packages/scaffold-utils/src/solana/SolanaConstantsUtil.ts b/packages/scaffold-utils/src/solana/SolanaConstantsUtil.ts index 9c9184fdac..305979b122 100644 --- a/packages/scaffold-utils/src/solana/SolanaConstantsUtil.ts +++ b/packages/scaffold-utils/src/solana/SolanaConstantsUtil.ts @@ -2,6 +2,7 @@ import { PublicKey } from '@solana/web3.js' import { ConstantsUtil } from '@web3modal/common' export const SolConstantsUtil = { + UNIVERSAL_PROVIDER_RELAY_URL: 'wss://relay.walletconnect.org', HASH_PREFIX: 'SPL Name Service', /** * The `.sol` TLD From 6b95ad874c7e93679460cd7c1386b582e5e6e489 Mon Sep 17 00:00:00 2001 From: tomiir Date: Mon, 2 Sep 2024 15:32:00 +0200 Subject: [PATCH 06/17] chore: remove coinbase SDK de-duplication (#2768) --- packages/base/adapters/evm/ethers/client.ts | 9 +- packages/base/adapters/evm/ethers5/client.ts | 9 +- packages/base/adapters/evm/wagmi/client.ts | 12 +- packages/scaffold-ui/exports/index.ts | 1 - .../w3m-connect-coinbase-widget/index.ts | 106 ------------------ .../src/partials/w3m-connector-list/index.ts | 19 +--- 6 files changed, 6 insertions(+), 150 deletions(-) delete mode 100644 packages/scaffold-ui/src/partials/w3m-connect-coinbase-widget/index.ts diff --git a/packages/base/adapters/evm/ethers/client.ts b/packages/base/adapters/evm/ethers/client.ts index 55880827ea..d34a21a0f8 100644 --- a/packages/base/adapters/evm/ethers/client.ts +++ b/packages/base/adapters/evm/ethers/client.ts @@ -1566,15 +1566,8 @@ export class EVMEthersClient { const { info, provider } = event.detail const connectors = this.appKit?.getConnectors() const existingConnector = connectors?.find(c => c.name === info.name) - const coinbaseConnector = connectors?.find( - c => c.id === ConstantsUtil.COINBASE_SDK_CONNECTOR_ID - ) - const isCoinbaseDuplicated = - coinbaseConnector && - event.detail.info.rdns === - ConstantsUtil.CONNECTOR_RDNS_MAP[ConstantsUtil.COINBASE_SDK_CONNECTOR_ID] - if (!existingConnector && !isCoinbaseDuplicated) { + if (!existingConnector) { const type = PresetsUtil.ConnectorTypesMap[ConstantsUtil.EIP6963_CONNECTOR_ID] if (type) { this.appKit?.addConnector({ diff --git a/packages/base/adapters/evm/ethers5/client.ts b/packages/base/adapters/evm/ethers5/client.ts index af886bb415..e2cf775d8c 100644 --- a/packages/base/adapters/evm/ethers5/client.ts +++ b/packages/base/adapters/evm/ethers5/client.ts @@ -1152,15 +1152,8 @@ export class EVMEthers5Client { const { info, provider } = event.detail const connectors = this.appKit?.getConnectors() const existingConnector = connectors?.find(c => c.name === info.name) - const coinbaseConnector = connectors?.find( - c => c.id === ConstantsUtil.COINBASE_SDK_CONNECTOR_ID - ) - const isCoinbaseDuplicated = - coinbaseConnector && - event.detail.info.rdns === - ConstantsUtil.CONNECTOR_RDNS_MAP[ConstantsUtil.COINBASE_SDK_CONNECTOR_ID] - if (!existingConnector && !isCoinbaseDuplicated) { + if (!existingConnector) { const type = PresetsUtil.ConnectorTypesMap[ConstantsUtil.EIP6963_CONNECTOR_ID] if (type) { this.appKit?.addConnector({ diff --git a/packages/base/adapters/evm/wagmi/client.ts b/packages/base/adapters/evm/wagmi/client.ts index 18a4da2719..4b77ea6282 100644 --- a/packages/base/adapters/evm/wagmi/client.ts +++ b/packages/base/adapters/evm/wagmi/client.ts @@ -643,17 +643,9 @@ export class EVMWagmiClient { const w3mConnectors: Connector[] = [] - const coinbaseSDKId = ConstantsUtil.COINBASE_SDK_CONNECTOR_ID - - // Check if coinbase injected connector is present - const coinbaseConnector = filteredConnectors.find(c => c.id === coinbaseSDKId) - filteredConnectors.forEach(({ id, name, type, icon }) => { - // If coinbase injected connector is present, skip coinbase sdk connector. - const isCoinbaseRepeated = - coinbaseConnector && - id === ConstantsUtil.CONNECTOR_RDNS_MAP[ConstantsUtil.COINBASE_CONNECTOR_ID] - const shouldSkip = isCoinbaseRepeated || ConstantsUtil.AUTH_CONNECTOR_ID === id + // Auth connector is initialized separately + const shouldSkip = ConstantsUtil.AUTH_CONNECTOR_ID === id if (!shouldSkip) { w3mConnectors.push({ id, diff --git a/packages/scaffold-ui/exports/index.ts b/packages/scaffold-ui/exports/index.ts index 0809c5308b..d03ca1ac71 100644 --- a/packages/scaffold-ui/exports/index.ts +++ b/packages/scaffold-ui/exports/index.ts @@ -107,7 +107,6 @@ export * from '../src/partials/w3m-connect-custom-widget/index.js' export * from '../src/partials/w3m-connect-featured-widget/index.js' export * from '../src/partials/w3m-connect-injected-widget/index.js' export * from '../src/partials/w3m-connect-multi-chain-widget/index.js' -export * from '../src/partials/w3m-connect-coinbase-widget/index.js' export * from '../src/partials/w3m-connect-external-widget/index.js' export * from '../src/partials/w3m-connect-recent-widget/index.js' export * from '../src/partials/w3m-connect-recommended-widget/index.js' diff --git a/packages/scaffold-ui/src/partials/w3m-connect-coinbase-widget/index.ts b/packages/scaffold-ui/src/partials/w3m-connect-coinbase-widget/index.ts deleted file mode 100644 index 315fe9c935..0000000000 --- a/packages/scaffold-ui/src/partials/w3m-connect-coinbase-widget/index.ts +++ /dev/null @@ -1,106 +0,0 @@ -import type { BaseError, Connector } from '@web3modal/core' -import { - AssetUtil, - ConnectionController, - ConnectorController, - EventsController, - ModalController, - OptionsController, - RouterController -} from '@web3modal/core' -import { ConstantsUtil } from '@web3modal/scaffold-utils' -import { customElement } from '@web3modal/ui' -import { LitElement, html } from 'lit' -import { state } from 'lit/decorators.js' -import { ifDefined } from 'lit/directives/if-defined.js' - -@customElement('w3m-connect-coinbase-widget') -export class W3mConnectCoinbaseWidget extends LitElement { - // -- Members ------------------------------------------- // - private unsubscribe: (() => void)[] = [] - - // -- State & Properties -------------------------------- // - @state() private connectors = ConnectorController.state.connectors - - public constructor() { - super() - this.unsubscribe.push( - ConnectorController.subscribeKey('connectors', val => (this.connectors = val)) - ) - } - - public override disconnectedCallback() { - this.unsubscribe.forEach(unsubscribe => unsubscribe()) - } - - // -- Render -------------------------------------------- // - public override render() { - const coinbaseConnector = this.connectors.find( - connector => connector.id === 'coinbaseWalletSDK' - ) - - if (!coinbaseConnector) { - this.style.cssText = `display: none` - - return null - } - - return html` - - this.onConnector(coinbaseConnector)} - > - - - ` - } - - // -- Private Methods ----------------------------------- // - /** - * Replicate of `onConnectProxy` method from `w3m-connecting-external-view` which is only used for Coinbase connector. - */ - private async onCoinbaseConnector(connector: Connector) { - try { - ConnectionController.setWcError(false) - - await ConnectionController.connectExternal(connector, connector.chain) - - if (OptionsController.state.isSiweEnabled) { - RouterController.push('ConnectingSiwe') - } else { - ModalController.close() - } - - EventsController.sendEvent({ - type: 'track', - event: 'CONNECT_SUCCESS', - properties: { method: 'browser', name: connector.name || 'Unknown' } - }) - } catch (error) { - EventsController.sendEvent({ - type: 'track', - event: 'CONNECT_ERROR', - properties: { message: (error as BaseError)?.message ?? 'Unknown' } - }) - ConnectionController.setWcError(true) - } - } - - private onConnector(connector: Connector) { - RouterController.push('ConnectingExternal', { connector }) - - if (connector.id === ConstantsUtil.COINBASE_SDK_CONNECTOR_ID) { - this.onCoinbaseConnector(connector) - } - } -} - -declare global { - interface HTMLElementTagNameMap { - 'w3m-connect-coinbase-widget': W3mConnectCoinbaseWidget - } -} diff --git a/packages/scaffold-ui/src/partials/w3m-connector-list/index.ts b/packages/scaffold-ui/src/partials/w3m-connector-list/index.ts index 2d8ccd2257..08a8d24aa9 100644 --- a/packages/scaffold-ui/src/partials/w3m-connector-list/index.ts +++ b/packages/scaffold-ui/src/partials/w3m-connector-list/index.ts @@ -11,7 +11,6 @@ import { } from '@web3modal/core' import { ConstantsUtil as CommonConstantsUtil } from '@web3modal/common' import { state } from 'lit/decorators.js' -import { ConstantsUtil } from '@web3modal/scaffold-utils' import { WalletUtil } from '../../utils/WalletUtil.js' @customElement('w3m-connector-list') export class W3mConnectorList extends LitElement { @@ -36,17 +35,8 @@ export class W3mConnectorList extends LitElement { // -- Render -------------------------------------------- // public override render() { - const { - custom, - recent, - announced, - coinbase, - injected, - multiChain, - recommended, - featured, - external - } = this.getConnectorsByType() + const { custom, recent, announced, injected, multiChain, recommended, featured, external } = + this.getConnectorsByType() return html` @@ -65,7 +55,6 @@ export class W3mConnectorList extends LitElement { ? html`` : null} ${custom?.length ? html`` : null} - ${coinbase ? html`` : null} ${external.length ? html`` : null} @@ -88,16 +77,12 @@ export class W3mConnectorList extends LitElement { const announced = this.connectors.filter(connector => connector.type === 'ANNOUNCED') const injected = this.connectors.filter(connector => connector.type === 'INJECTED') const external = this.connectors.filter(connector => connector.type === 'EXTERNAL') - const coinbase = this.connectors.find( - connector => connector.id === ConstantsUtil.COINBASE_SDK_CONNECTOR_ID - ) const isEVM = ChainController.state.activeChain === CommonConstantsUtil.CHAIN.EVM const includeAnnouncedAndInjected = isEVM ? OptionsController.state.enableEIP6963 : true return { custom, recent, - coinbase, external, multiChain, announced: includeAnnouncedAndInjected ? announced : [], From 5869107a2c8ae365caba65fd28723ca3dc939e6c Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 2 Sep 2024 12:33:38 -0300 Subject: [PATCH 07/17] fix: add missing chainId param for transactions request (#2779) --- .../controllers/BlockchainApiController.ts | 6 ++-- .../src/controllers/TransactionsController.ts | 3 +- packages/core/src/utils/TypeUtil.ts | 1 + .../TransactionsController.test.ts | 32 ++++++++++++++++++- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/packages/core/src/controllers/BlockchainApiController.ts b/packages/core/src/controllers/BlockchainApiController.ts index 1568d1da43..2f4c56bccd 100644 --- a/packages/core/src/controllers/BlockchainApiController.ts +++ b/packages/core/src/controllers/BlockchainApiController.ts @@ -143,14 +143,16 @@ export const BlockchainApiController = { cursor, onramp, signal, - cache + cache, + chainId }: BlockchainApiTransactionsRequest) { return state.api.get({ path: `/v1/account/${account}/history`, params: { projectId, cursor, - onramp + onramp, + chainId }, signal, cache diff --git a/packages/core/src/controllers/TransactionsController.ts b/packages/core/src/controllers/TransactionsController.ts index d8b1b00579..b637ca0117 100644 --- a/packages/core/src/controllers/TransactionsController.ts +++ b/packages/core/src/controllers/TransactionsController.ts @@ -62,7 +62,8 @@ export const TransactionsController = { cursor: state.next, onramp, // Coinbase transaction history state updates require the latest data - cache: onramp === 'coinbase' ? 'no-cache' : undefined + cache: onramp === 'coinbase' ? 'no-cache' : undefined, + chainId: NetworkController.state.caipNetwork?.id }) const nonSpamTransactions = this.filterSpamTransactions(response.data) diff --git a/packages/core/src/utils/TypeUtil.ts b/packages/core/src/utils/TypeUtil.ts index f41b6b3ca0..5a1cb414d5 100644 --- a/packages/core/src/utils/TypeUtil.ts +++ b/packages/core/src/utils/TypeUtil.ts @@ -187,6 +187,7 @@ export interface BlockchainApiTransactionsRequest { onramp?: 'coinbase' signal?: AbortSignal cache?: RequestCache + chainId?: string } export interface BlockchainApiTransactionsResponse { diff --git a/packages/core/tests/controllers/TransactionsController.test.ts b/packages/core/tests/controllers/TransactionsController.test.ts index 00749921a8..4d01fca42d 100644 --- a/packages/core/tests/controllers/TransactionsController.test.ts +++ b/packages/core/tests/controllers/TransactionsController.test.ts @@ -1,5 +1,10 @@ import { describe, expect, it, vi } from 'vitest' -import { BlockchainApiController, OptionsController, TransactionsController } from '../../index.js' +import { + BlockchainApiController, + NetworkController, + OptionsController, + TransactionsController +} from '../../index.js' import { ONRAMP_TRANSACTIONS_RESPONSES_FEB, ONRAMP_TRANSACTIONS_RESPONSES_JAN @@ -273,4 +278,29 @@ describe('TransactionsController', () => { }) expect(TransactionsController.state.next).toBe('cursor') }) + + it('should call fetchTransactions with chainId', async () => { + const fetchTransactions = vi + .spyOn(BlockchainApiController, 'fetchTransactions') + .mockResolvedValue({ + data: [], + next: 'cursor' + }) + + vi.spyOn(NetworkController, 'state', 'get').mockReturnValue({ + caipNetwork: { + id: 'eip155:1' + } + } as any) + + await TransactionsController.fetchTransactions('0x123', 'coinbase') + expect(fetchTransactions).toHaveBeenCalledWith({ + account: '0x123', + projectId, + cursor: 'cursor', + onramp: 'coinbase', + cache: 'no-cache', + chainId: 'eip155:1' + }) + }) }) From 9b03fcf618b2a6f925a8be2b3001e67f1d4b9704 Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 2 Sep 2024 13:16:25 -0300 Subject: [PATCH 08/17] fix: remove coming message from solana transactions (#2780) --- .../src/partials/w3m-activity-list/index.ts | 52 ++++--------------- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/packages/scaffold-ui/src/partials/w3m-activity-list/index.ts b/packages/scaffold-ui/src/partials/w3m-activity-list/index.ts index 8f7e33d7ce..fe075703de 100644 --- a/packages/scaffold-ui/src/partials/w3m-activity-list/index.ts +++ b/packages/scaffold-ui/src/partials/w3m-activity-list/index.ts @@ -2,7 +2,6 @@ import { DateUtil } from '@web3modal/common' import type { Transaction, TransactionImage } from '@web3modal/common' import { AccountController, - ChainController, EventsController, NetworkController, OptionsController, @@ -14,7 +13,6 @@ import { LitElement, html } from 'lit' import { property, state } from 'lit/decorators.js' import type { TransactionType } from '@web3modal/ui' import { W3mFrameRpcConstants } from '@web3modal/wallet' -import { ConstantsUtil } from '@web3modal/common' import styles from './styles.js' @@ -34,8 +32,6 @@ export class W3mActivityList extends LitElement { // -- State & Properties -------------------------------- // @property() public page: 'account' | 'activity' = 'activity' - @state() private isSolana = ChainController.state.activeChain === ConstantsUtil.CHAIN.SOLANA - @state() private address: string | undefined = AccountController.state.address @state() private transactionsByYear = TransactionsController.state.transactionsByYear @@ -52,9 +48,6 @@ export class W3mActivityList extends LitElement { TransactionsController.clearCursor() this.unsubscribe.push( ...[ - ChainController.subscribeKey('activeChain', activeChain => { - this.isSolana = activeChain === ConstantsUtil.CHAIN.SOLANA - }), AccountController.subscribe(val => { if (val.isConnected) { if (this.address !== val.address) { @@ -78,13 +71,6 @@ export class W3mActivityList extends LitElement { } public override firstUpdated() { - if (this.isSolana) { - this.loading = false - this.empty = true - - return - } - this.updateTransactionView() this.createPaginationObserver() } @@ -225,19 +211,6 @@ export class W3mActivityList extends LitElement { } private emptyStateActivity() { - const comingSoon = html` - Transaction history is coming soon! - ` - const empty = html` No Transactions yet - Start trading on dApps
- to grow your wallet!
` - return html` - ${this.isSolana ? comingSoon : empty} + No Transactions yet + Start trading on dApps
+ to grow your wallet!
` } private emptyStateAccount() { - const comingSoon = html` - Transaction history is coming soon! - ` - const empty = html` No activity yet - Your next transactions will appear here` - return html` - ${this.isSolana ? comingSoon : empty} + No activity yet + Your next transactions will appear here Trade
` From 89169726c7a61794571bcd216c3de40d948fccd8 Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 2 Sep 2024 14:06:36 -0300 Subject: [PATCH 09/17] chore: version bump for 5.1.5 (#2782) --- apps/demo/CHANGELOG.md | 14 +++++++++++++ apps/demo/package.json | 2 +- apps/gallery/CHANGELOG.md | 15 ++++++++++++++ apps/gallery/package.json | 2 +- apps/laboratory/CHANGELOG.md | 20 +++++++++++++++++++ apps/laboratory/package.json | 2 +- examples/html-ethers5/CHANGELOG.md | 14 +++++++++++++ examples/html-ethers5/package.json | 2 +- examples/html-wagmi/CHANGELOG.md | 14 +++++++++++++ examples/html-wagmi/package.json | 2 +- examples/next-wagmi/CHANGELOG.md | 14 +++++++++++++ examples/next-wagmi/package.json | 2 +- examples/react-ethers/CHANGELOG.md | 14 +++++++++++++ examples/react-ethers/package.json | 2 +- examples/react-ethers5/CHANGELOG.md | 14 +++++++++++++ examples/react-ethers5/package.json | 2 +- examples/react-solana/CHANGELOG.md | 14 +++++++++++++ examples/react-solana/package.json | 2 +- examples/react-wagmi/CHANGELOG.md | 14 +++++++++++++ examples/react-wagmi/package.json | 2 +- examples/vue-ethers5/CHANGELOG.md | 14 +++++++++++++ examples/vue-ethers5/package.json | 2 +- examples/vue-solana/CHANGELOG.md | 14 +++++++++++++ examples/vue-solana/package.json | 2 +- examples/vue-wagmi/CHANGELOG.md | 14 +++++++++++++ examples/vue-wagmi/package.json | 2 +- packages/base/CHANGELOG.md | 21 ++++++++++++++++++++ packages/base/package.json | 2 +- packages/cdn/CHANGELOG.md | 16 +++++++++++++++ packages/cdn/package.json | 2 +- packages/common/CHANGELOG.md | 12 +++++++++++ packages/common/package.json | 2 +- packages/core/CHANGELOG.md | 15 ++++++++++++++ packages/core/package.json | 2 +- packages/ethers/CHANGELOG.md | 19 ++++++++++++++++++ packages/ethers/package.json | 2 +- packages/ethers5/CHANGELOG.md | 18 +++++++++++++++++ packages/ethers5/package.json | 2 +- packages/polyfills/CHANGELOG.md | 12 +++++++++++ packages/polyfills/package.json | 2 +- packages/scaffold-ui/CHANGELOG.md | 19 ++++++++++++++++++ packages/scaffold-ui/package.json | 2 +- packages/scaffold-utils/CHANGELOG.md | 17 ++++++++++++++++ packages/scaffold-utils/package.json | 2 +- packages/scaffold-utils/src/ConstantsUtil.ts | 2 +- packages/siwe/CHANGELOG.md | 18 +++++++++++++++++ packages/siwe/package.json | 2 +- packages/solana/CHANGELOG.md | 19 ++++++++++++++++++ packages/solana/package.json | 2 +- packages/ui/CHANGELOG.md | 12 +++++++++++ packages/ui/package.json | 2 +- packages/wagmi/CHANGELOG.md | 19 ++++++++++++++++++ packages/wagmi/package.json | 2 +- packages/wallet/CHANGELOG.md | 15 ++++++++++++++ packages/wallet/package.json | 2 +- 55 files changed, 449 insertions(+), 28 deletions(-) diff --git a/apps/demo/CHANGELOG.md b/apps/demo/CHANGELOG.md index 97181f13b7..51bca1bea0 100644 --- a/apps/demo/CHANGELOG.md +++ b/apps/demo/CHANGELOG.md @@ -1,5 +1,19 @@ # @apps/demo +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/wagmi@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/apps/demo/package.json b/apps/demo/package.json index 6c555a338d..11ec60a355 100644 --- a/apps/demo/package.json +++ b/apps/demo/package.json @@ -1,6 +1,6 @@ { "name": "@apps/demo", - "version": "5.1.4", + "version": "5.1.5", "private": true, "scripts": { "dev": "next dev", diff --git a/apps/gallery/CHANGELOG.md b/apps/gallery/CHANGELOG.md index 77e14d1648..a0cb3abc4f 100644 --- a/apps/gallery/CHANGELOG.md +++ b/apps/gallery/CHANGELOG.md @@ -1,5 +1,20 @@ # @apps/gallery +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/common@5.1.5 + - @web3modal/ui@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/apps/gallery/package.json b/apps/gallery/package.json index 0e10701af9..cf99c0ae63 100644 --- a/apps/gallery/package.json +++ b/apps/gallery/package.json @@ -1,6 +1,6 @@ { "name": "@apps/gallery", - "version": "5.1.4", + "version": "5.1.5", "private": true, "main": "index.js", "scripts": { diff --git a/apps/laboratory/CHANGELOG.md b/apps/laboratory/CHANGELOG.md index 572747c322..b9b626012d 100644 --- a/apps/laboratory/CHANGELOG.md +++ b/apps/laboratory/CHANGELOG.md @@ -1,5 +1,25 @@ # @apps/laboratory +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/base@5.1.5 + - @web3modal/ethers@5.1.5 + - @web3modal/ethers5@5.1.5 + - @web3modal/siwe@5.1.5 + - @web3modal/solana@5.1.5 + - @web3modal/wagmi@5.1.5 + - @web3modal/wallet@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/apps/laboratory/package.json b/apps/laboratory/package.json index ab0ca499b6..f3b253a383 100644 --- a/apps/laboratory/package.json +++ b/apps/laboratory/package.json @@ -1,7 +1,7 @@ { "name": "@apps/laboratory", "type": "module", - "version": "5.1.4", + "version": "5.1.5", "private": true, "scripts": { "dev": "next dev", diff --git a/examples/html-ethers5/CHANGELOG.md b/examples/html-ethers5/CHANGELOG.md index 2534039b8f..a70e6f3639 100644 --- a/examples/html-ethers5/CHANGELOG.md +++ b/examples/html-ethers5/CHANGELOG.md @@ -1,5 +1,19 @@ # @examples/html-ethers5 +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/ethers5@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/examples/html-ethers5/package.json b/examples/html-ethers5/package.json index febdfe0f37..c37e6a50a3 100644 --- a/examples/html-ethers5/package.json +++ b/examples/html-ethers5/package.json @@ -1,7 +1,7 @@ { "name": "@examples/html-ethers5", "private": true, - "version": "5.1.4", + "version": "5.1.5", "scripts": { "dev": "vite --port 3011", "build": "vite build" diff --git a/examples/html-wagmi/CHANGELOG.md b/examples/html-wagmi/CHANGELOG.md index 76d090eda0..7a491da585 100644 --- a/examples/html-wagmi/CHANGELOG.md +++ b/examples/html-wagmi/CHANGELOG.md @@ -1,5 +1,19 @@ # @examples/html-wagmi +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/wagmi@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/examples/html-wagmi/package.json b/examples/html-wagmi/package.json index 4bf9c5aa49..4e747cd461 100644 --- a/examples/html-wagmi/package.json +++ b/examples/html-wagmi/package.json @@ -1,7 +1,7 @@ { "name": "@examples/html-wagmi", "private": true, - "version": "5.1.4", + "version": "5.1.5", "scripts": { "dev": "vite --port 3001", "build": "vite build" diff --git a/examples/next-wagmi/CHANGELOG.md b/examples/next-wagmi/CHANGELOG.md index 4e792be61a..e31969aee6 100644 --- a/examples/next-wagmi/CHANGELOG.md +++ b/examples/next-wagmi/CHANGELOG.md @@ -1,5 +1,19 @@ # @examples/next-wagmi +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/wagmi@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/examples/next-wagmi/package.json b/examples/next-wagmi/package.json index 798f6de06d..028115201b 100644 --- a/examples/next-wagmi/package.json +++ b/examples/next-wagmi/package.json @@ -1,6 +1,6 @@ { "name": "@examples/next-wagmi", - "version": "5.1.4", + "version": "5.1.5", "private": true, "scripts": { "dev": "next dev", diff --git a/examples/react-ethers/CHANGELOG.md b/examples/react-ethers/CHANGELOG.md index 16d3e9b995..43d37cc197 100644 --- a/examples/react-ethers/CHANGELOG.md +++ b/examples/react-ethers/CHANGELOG.md @@ -1,5 +1,19 @@ # @examples/react-ethers5 +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/ethers@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/examples/react-ethers/package.json b/examples/react-ethers/package.json index 872a7db612..0f00574c75 100644 --- a/examples/react-ethers/package.json +++ b/examples/react-ethers/package.json @@ -1,7 +1,7 @@ { "name": "@examples/react-ethers", "private": true, - "version": "5.1.4", + "version": "5.1.5", "scripts": { "dev": "vite --port 3012", "build": "vite build" diff --git a/examples/react-ethers5/CHANGELOG.md b/examples/react-ethers5/CHANGELOG.md index 1990c34053..a54c089b64 100644 --- a/examples/react-ethers5/CHANGELOG.md +++ b/examples/react-ethers5/CHANGELOG.md @@ -1,5 +1,19 @@ # @examples/react-ethers5 +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/ethers5@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/examples/react-ethers5/package.json b/examples/react-ethers5/package.json index c82ccc7a3d..ee4f28a3a7 100644 --- a/examples/react-ethers5/package.json +++ b/examples/react-ethers5/package.json @@ -1,7 +1,7 @@ { "name": "@examples/react-ethers5", "private": true, - "version": "5.1.4", + "version": "5.1.5", "scripts": { "dev": "vite --port 3012", "build": "vite build" diff --git a/examples/react-solana/CHANGELOG.md b/examples/react-solana/CHANGELOG.md index d945a209b1..f335d02641 100644 --- a/examples/react-solana/CHANGELOG.md +++ b/examples/react-solana/CHANGELOG.md @@ -1,5 +1,19 @@ # @examples/react-wagmi +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/solana@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/examples/react-solana/package.json b/examples/react-solana/package.json index d45c714790..d91298c428 100644 --- a/examples/react-solana/package.json +++ b/examples/react-solana/package.json @@ -1,7 +1,7 @@ { "name": "@examples/react-solana", "private": true, - "version": "5.1.4", + "version": "5.1.5", "scripts": { "dev": "vite --port 3002", "build": "vite build" diff --git a/examples/react-wagmi/CHANGELOG.md b/examples/react-wagmi/CHANGELOG.md index 4df4808f73..a6d01e31b3 100644 --- a/examples/react-wagmi/CHANGELOG.md +++ b/examples/react-wagmi/CHANGELOG.md @@ -1,5 +1,19 @@ # @examples/react-wagmi +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/wagmi@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/examples/react-wagmi/package.json b/examples/react-wagmi/package.json index d60aad1b93..7e972b468f 100644 --- a/examples/react-wagmi/package.json +++ b/examples/react-wagmi/package.json @@ -1,7 +1,7 @@ { "name": "@examples/react-wagmi", "private": true, - "version": "5.1.4", + "version": "5.1.5", "scripts": { "dev": "vite --port 3002", "build": "vite build", diff --git a/examples/vue-ethers5/CHANGELOG.md b/examples/vue-ethers5/CHANGELOG.md index c9cf359444..b1f7836b97 100644 --- a/examples/vue-ethers5/CHANGELOG.md +++ b/examples/vue-ethers5/CHANGELOG.md @@ -1,5 +1,19 @@ # @examples/vue-ethers5 +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/ethers5@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/examples/vue-ethers5/package.json b/examples/vue-ethers5/package.json index b3fc1eac5f..70af7fbd02 100644 --- a/examples/vue-ethers5/package.json +++ b/examples/vue-ethers5/package.json @@ -1,7 +1,7 @@ { "name": "@examples/vue-ethers5", "private": true, - "version": "5.1.4", + "version": "5.1.5", "scripts": { "dev": "vite --port 3013", "build": "vite build" diff --git a/examples/vue-solana/CHANGELOG.md b/examples/vue-solana/CHANGELOG.md index 8fc18852f7..e0b0149a2d 100644 --- a/examples/vue-solana/CHANGELOG.md +++ b/examples/vue-solana/CHANGELOG.md @@ -1,5 +1,19 @@ # @examples/vue-ethers5 +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/solana@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/examples/vue-solana/package.json b/examples/vue-solana/package.json index b8c2edd1d2..b0bc4ae0be 100644 --- a/examples/vue-solana/package.json +++ b/examples/vue-solana/package.json @@ -1,7 +1,7 @@ { "name": "@examples/vue-solana", "private": true, - "version": "5.1.4", + "version": "5.1.5", "scripts": { "dev": "vite --port 3013", "build": "vite build" diff --git a/examples/vue-wagmi/CHANGELOG.md b/examples/vue-wagmi/CHANGELOG.md index eca8294c36..84b77977fb 100644 --- a/examples/vue-wagmi/CHANGELOG.md +++ b/examples/vue-wagmi/CHANGELOG.md @@ -1,5 +1,19 @@ # @examples/vue-wagmi +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/wagmi@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/examples/vue-wagmi/package.json b/examples/vue-wagmi/package.json index 4d5d45cb8b..1d68424c71 100644 --- a/examples/vue-wagmi/package.json +++ b/examples/vue-wagmi/package.json @@ -1,7 +1,7 @@ { "name": "@examples/vue-wagmi", "private": true, - "version": "5.1.4", + "version": "5.1.5", "scripts": { "dev": "vite --port 3003", "build": "vite build" diff --git a/packages/base/CHANGELOG.md b/packages/base/CHANGELOG.md index edae1fca32..7577254a9a 100644 --- a/packages/base/CHANGELOG.md +++ b/packages/base/CHANGELOG.md @@ -1,5 +1,26 @@ # @web3modal/scaffold +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/scaffold-utils@5.1.5 + - @web3modal/common@5.1.5 + - @web3modal/core@5.1.5 + - @web3modal/polyfills@5.1.5 + - @web3modal/scaffold-ui@5.1.5 + - @web3modal/siwe@5.1.5 + - @web3modal/ui@5.1.5 + - @web3modal/wallet@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/packages/base/package.json b/packages/base/package.json index 73f878b9da..0108f6f5c3 100644 --- a/packages/base/package.json +++ b/packages/base/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/base", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/cdn/CHANGELOG.md b/packages/cdn/CHANGELOG.md index 5466925ca0..5ff0ed7a05 100644 --- a/packages/cdn/CHANGELOG.md +++ b/packages/cdn/CHANGELOG.md @@ -1,5 +1,21 @@ # @web3modal/cdn +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/ethers@5.1.5 + - @web3modal/ethers5@5.1.5 + - @web3modal/wagmi@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/packages/cdn/package.json b/packages/cdn/package.json index 3ad9058ed3..1322a5ccba 100644 --- a/packages/cdn/package.json +++ b/packages/cdn/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/cdn", - "version": "5.1.4", + "version": "5.1.5", "main": "dist/wagmi.js", "type": "module", "files": [ diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index f9d9d1cfb9..3885d416a6 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -1,5 +1,17 @@ # @web3modal/common +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 + ## 5.1.4 ### Patch Changes diff --git a/packages/common/package.json b/packages/common/package.json index ff6d2c1f88..0c368ec3ab 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/common", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/index.js", "types": "./dist/types/index.d.ts", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 83aad26a9f..1f30283ac8 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,20 @@ # @web3modal/core +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/common@5.1.5 + - @web3modal/wallet@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/packages/core/package.json b/packages/core/package.json index 8397f5ddbe..e436e7a011 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/core", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/index.js", "types": "./dist/types/index.d.ts", diff --git a/packages/ethers/CHANGELOG.md b/packages/ethers/CHANGELOG.md index 585d63c8d0..b201316d4c 100644 --- a/packages/ethers/CHANGELOG.md +++ b/packages/ethers/CHANGELOG.md @@ -1,5 +1,24 @@ # @web3modal/ethers +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/scaffold-utils@5.1.5 + - @web3modal/base@5.1.5 + - @web3modal/common@5.1.5 + - @web3modal/polyfills@5.1.5 + - @web3modal/siwe@5.1.5 + - @web3modal/wallet@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/packages/ethers/package.json b/packages/ethers/package.json index f91b247490..db074d8092 100644 --- a/packages/ethers/package.json +++ b/packages/ethers/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/ethers", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/ethers5/CHANGELOG.md b/packages/ethers5/CHANGELOG.md index 34fe702d0d..8420a3cadf 100644 --- a/packages/ethers5/CHANGELOG.md +++ b/packages/ethers5/CHANGELOG.md @@ -1,5 +1,23 @@ # @web3modal/ethers5 +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/scaffold-utils@5.1.5 + - @web3modal/base@5.1.5 + - @web3modal/common@5.1.5 + - @web3modal/polyfills@5.1.5 + - @web3modal/siwe@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/packages/ethers5/package.json b/packages/ethers5/package.json index f61d12135a..0314b05ffc 100644 --- a/packages/ethers5/package.json +++ b/packages/ethers5/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/ethers5", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/polyfills/CHANGELOG.md b/packages/polyfills/CHANGELOG.md index af487f6301..ccc75b2413 100644 --- a/packages/polyfills/CHANGELOG.md +++ b/packages/polyfills/CHANGELOG.md @@ -1,5 +1,17 @@ # @web3modal/polyfills +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 + ## 5.1.4 ### Patch Changes diff --git a/packages/polyfills/package.json b/packages/polyfills/package.json index 19cc5157b8..50a060aaf3 100644 --- a/packages/polyfills/package.json +++ b/packages/polyfills/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/polyfills", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/index.js", "types": "./dist/types/index.d.ts", diff --git a/packages/scaffold-ui/CHANGELOG.md b/packages/scaffold-ui/CHANGELOG.md index a64388c2b0..a2865039f4 100644 --- a/packages/scaffold-ui/CHANGELOG.md +++ b/packages/scaffold-ui/CHANGELOG.md @@ -1,5 +1,24 @@ # @web3modal/scaffold +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/scaffold-utils@5.1.5 + - @web3modal/common@5.1.5 + - @web3modal/core@5.1.5 + - @web3modal/siwe@5.1.5 + - @web3modal/ui@5.1.5 + - @web3modal/wallet@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/packages/scaffold-ui/package.json b/packages/scaffold-ui/package.json index 22e15ca4b0..766a4e6a21 100644 --- a/packages/scaffold-ui/package.json +++ b/packages/scaffold-ui/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/scaffold-ui", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/scaffold-utils/CHANGELOG.md b/packages/scaffold-utils/CHANGELOG.md index 93ce3aac44..aa74962199 100644 --- a/packages/scaffold-utils/CHANGELOG.md +++ b/packages/scaffold-utils/CHANGELOG.md @@ -1,5 +1,22 @@ # @web3modal/scaffold-utils +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/common@5.1.5 + - @web3modal/core@5.1.5 + - @web3modal/polyfills@5.1.5 + - @web3modal/wallet@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/packages/scaffold-utils/package.json b/packages/scaffold-utils/package.json index 433f5aadb6..6922158ff6 100644 --- a/packages/scaffold-utils/package.json +++ b/packages/scaffold-utils/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/scaffold-utils", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/scaffold-utils/src/ConstantsUtil.ts b/packages/scaffold-utils/src/ConstantsUtil.ts index e8d53d67c1..d51e78df5b 100644 --- a/packages/scaffold-utils/src/ConstantsUtil.ts +++ b/packages/scaffold-utils/src/ConstantsUtil.ts @@ -16,5 +16,5 @@ export const ConstantsUtil = { coinbaseWallet: 'com.coinbase.wallet', coinbaseWalletSDK: 'com.coinbase.wallet' } as Record, - VERSION: '5.1.4' + VERSION: '5.1.5' } diff --git a/packages/siwe/CHANGELOG.md b/packages/siwe/CHANGELOG.md index e13be22116..72f5930036 100644 --- a/packages/siwe/CHANGELOG.md +++ b/packages/siwe/CHANGELOG.md @@ -1,5 +1,23 @@ # @web3modal/siwe +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/scaffold-utils@5.1.5 + - @web3modal/common@5.1.5 + - @web3modal/core@5.1.5 + - @web3modal/ui@5.1.5 + - @web3modal/wallet@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/packages/siwe/package.json b/packages/siwe/package.json index 40e37289b7..1f01293b66 100644 --- a/packages/siwe/package.json +++ b/packages/siwe/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/siwe", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/solana/CHANGELOG.md b/packages/solana/CHANGELOG.md index 8330b00316..121865e8bb 100644 --- a/packages/solana/CHANGELOG.md +++ b/packages/solana/CHANGELOG.md @@ -1,5 +1,24 @@ # @web3modal/solana +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/scaffold-utils@5.1.5 + - @web3modal/base@5.1.5 + - @web3modal/common@5.1.5 + - @web3modal/core@5.1.5 + - @web3modal/polyfills@5.1.5 + - @web3modal/wallet@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/packages/solana/package.json b/packages/solana/package.json index c4f6199cb4..ca840e3a7c 100644 --- a/packages/solana/package.json +++ b/packages/solana/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/solana", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/ui/CHANGELOG.md b/packages/ui/CHANGELOG.md index 2ef0a01cee..f64c3f5e56 100644 --- a/packages/ui/CHANGELOG.md +++ b/packages/ui/CHANGELOG.md @@ -1,5 +1,17 @@ # @web3modal/ui +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 + ## 5.1.4 ### Patch Changes diff --git a/packages/ui/package.json b/packages/ui/package.json index a33982355d..de10960dc0 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/ui", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/index.js", "types": "./dist/types/index.d.ts", diff --git a/packages/wagmi/CHANGELOG.md b/packages/wagmi/CHANGELOG.md index da39f61a97..df480241bb 100644 --- a/packages/wagmi/CHANGELOG.md +++ b/packages/wagmi/CHANGELOG.md @@ -1,5 +1,24 @@ # @web3modal/wagmi +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/scaffold-utils@5.1.5 + - @web3modal/base@5.1.5 + - @web3modal/common@5.1.5 + - @web3modal/polyfills@5.1.5 + - @web3modal/siwe@5.1.5 + - @web3modal/wallet@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/packages/wagmi/package.json b/packages/wagmi/package.json index a2a119e045..8d4754c2b0 100644 --- a/packages/wagmi/package.json +++ b/packages/wagmi/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/wagmi", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/exports/index.js", "types": "./dist/types/exports/index.d.ts", diff --git a/packages/wallet/CHANGELOG.md b/packages/wallet/CHANGELOG.md index bcda2cebb4..81acfb1286 100644 --- a/packages/wallet/CHANGELOG.md +++ b/packages/wallet/CHANGELOG.md @@ -1,5 +1,20 @@ # @web3modal/wallet +## 5.1.5 + +### Patch Changes + +- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770 + - fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771 + - feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772 + - chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776 + - chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768 + - fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779 + - fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780 +- Updated dependencies []: + - @web3modal/common@5.1.5 + - @web3modal/polyfills@5.1.5 + ## 5.1.4 ### Patch Changes diff --git a/packages/wallet/package.json b/packages/wallet/package.json index f655222761..33551e0cda 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -1,6 +1,6 @@ { "name": "@web3modal/wallet", - "version": "5.1.4", + "version": "5.1.5", "type": "module", "main": "./dist/esm/index.js", "types": "./dist/types/index.d.ts", From 441d0d5ae61fb8e34661226d4f55d2f55e9445eb Mon Sep 17 00:00:00 2001 From: Chris Smith <1979423+chris13524@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:23:27 -0700 Subject: [PATCH 10/17] fix: update CSP (#2775) --- apps/laboratory/next.config.mjs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/laboratory/next.config.mjs b/apps/laboratory/next.config.mjs index 306fb5045b..04353ea4ea 100644 --- a/apps/laboratory/next.config.mjs +++ b/apps/laboratory/next.config.mjs @@ -1,12 +1,17 @@ /** @type {import('next').NextConfig} */ -// Keep in-sync with https://docs.walletconnect.com/advanced/security/content-security-policy +const SHAKRA_UI = `'sha256-e7MRMmTzLsLQvIy1iizO1lXf7VWYoQ6ysj5fuUzvRwE='` +/* + * Keep in-sync with https://docs.walletconnect.com/advanced/security/content-security-policy + * DO NOT use `unsafe-inline` or `unsafe-eval` for `script-src` or `default-src` in production as this + * is against CSP best practices + */ const cspHeader = ` default-src 'self'; - script-src 'self' 'unsafe-inline' ${process.env.NODE_ENV === 'production' ? '' : "'unsafe-eval'"}; + script-src 'self' ${SHAKRA_UI} ${process.env.NODE_ENV === 'production' ? '' : "'unsafe-eval'"}; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; - img-src 'self' data: blob: https://walletconnect.org https://walletconnect.com https://secure.walletconnect.com https://secure.walletconnect.org https://tokens-data.1inch.io https://tokens.1inch.io https://ipfs.io https://lab.web3modal.com; + img-src * 'self' data: blob: https://walletconnect.org https://walletconnect.com https://secure.walletconnect.com https://secure.walletconnect.org https://tokens-data.1inch.io https://tokens.1inch.io https://ipfs.io https://lab.web3modal.com; font-src 'self' https://fonts.gstatic.com; - connect-src 'self' https://rpc.walletconnect.com https://rpc.walletconnect.org https://explorer.walletconnect.com https://explorer.walletconnect.org https://relay.walletconnect.com https://relay.walletconnect.org wss://relay.walletconnect.com wss://relay.walletconnect.org https://pulse.walletconnect.com https://pulse.walletconnect.org https://api.web3modal.com https://api.web3modal.org wss://www.walletlink.org https://o1095249.ingest.sentry.io; + connect-src 'self' https://rpc.walletconnect.com https://rpc.walletconnect.org https://relay.walletconnect.com https://relay.walletconnect.org wss://relay.walletconnect.com wss://relay.walletconnect.org https://pulse.walletconnect.com https://pulse.walletconnect.org https://api.web3modal.com https://api.web3modal.org wss://www.walletlink.org https://o1095249.ingest.sentry.io; frame-src 'self' https://verify.walletconnect.com https://verify.walletconnect.org https://secure.walletconnect.com https://secure.walletconnect.org; object-src 'none'; base-uri 'self'; @@ -39,7 +44,7 @@ const nextConfig = { source: '/:path*', headers: [ { - key: 'Content-Security-Policy-Report-Only', + key: 'Content-Security-Policy', value: cspHeader.replace(/\n/g, ' ').trim() }, { From 1706f125c90eac7187da16cc69aae1c37e0fc0aa Mon Sep 17 00:00:00 2001 From: Enes Date: Tue, 3 Sep 2024 12:12:23 +0300 Subject: [PATCH 11/17] fix: ethers5 adapter import in exports (#2754) Co-authored-by: tomiir --- packages/base/adapters/evm/ethers/index.ts | 1 + packages/base/adapters/evm/ethers5/client.ts | 240 ++++++++++++++++++- packages/base/adapters/evm/ethers5/index.ts | 1 + packages/ethers5/exports/react.tsx | 6 +- packages/ethers5/exports/vue.ts | 6 +- 5 files changed, 246 insertions(+), 8 deletions(-) diff --git a/packages/base/adapters/evm/ethers/index.ts b/packages/base/adapters/evm/ethers/index.ts index 93fbb3d639..4a329b15b0 100644 --- a/packages/base/adapters/evm/ethers/index.ts +++ b/packages/base/adapters/evm/ethers/index.ts @@ -1,6 +1,7 @@ import '@web3modal/polyfills' export { EVMEthersClient } from './client.js' +export * from '@web3modal/scaffold-utils/ethers' // -- Types export type { AdapterOptions } from './client.js' diff --git a/packages/base/adapters/evm/ethers5/client.ts b/packages/base/adapters/evm/ethers5/client.ts index e2cf775d8c..9b9474ef9c 100644 --- a/packages/base/adapters/evm/ethers5/client.ts +++ b/packages/base/adapters/evm/ethers5/client.ts @@ -28,6 +28,9 @@ import { EthersHelpersUtil, EthersStoreUtil } from '@web3modal/scaffold-utils/ethers' +import { W3mFrameProvider, W3mFrameHelpers, W3mFrameRpcConstants } from '@web3modal/wallet' +import type { W3mFrameTypes } from '@web3modal/wallet' +import type { CombinedProvider } from '@web3modal/scaffold-utils/ethers' import type { EthereumProviderOptions } from '@walletconnect/ethereum-provider' import { NetworkUtil } from '@web3modal/common' import type { Chain as AvailableChain } from '@web3modal/common' @@ -104,6 +107,8 @@ export class EVMEthers5Client { private metadata?: Metadata + private authProvider?: W3mFrameProvider + public networkControllerClient: NetworkControllerClient public connectionControllerClient: ConnectionControllerClient @@ -438,6 +443,10 @@ export class EVMEthers5Client { this.checkActiveInjectedProvider(this.ethersConfig) } + if (this.ethersConfig.auth) { + this.syncAuthConnector(this.options.projectId, this.ethersConfig.auth) + } + if (this.ethersConfig.coinbase) { this.checkActiveCoinbaseProvider(this.ethersConfig) } @@ -582,7 +591,8 @@ export class EVMEthers5Client { id: `${ConstantsUtil.EIP155}:${chain.chainId}`, name: chain.name, imageId: PresetsUtil.EIP155NetworkImageIds[chain.chainId], - imageUrl: chainImages?.[chain.chainId] + imageUrl: chainImages?.[chain.chainId], + chain: CommonConstantsUtil.CHAIN.EVM }) as CaipNetwork ) this.appKit?.setRequestedCaipNetworks(requestedCaipNetworks ?? [], this.chain) @@ -655,6 +665,10 @@ export class EVMEthers5Client { EthersStoreUtil.setProvider(WalletConnectProvider as unknown as Provider) EthersStoreUtil.setStatus('connected') EthersStoreUtil.setIsConnected(true) + this.appKit?.setAllAccounts( + WalletConnectProvider.accounts.map(address => ({ address, type: 'eoa' })), + this.chain + ) this.setAddress(WalletConnectProvider.accounts?.[0]) this.watchWalletConnect() } @@ -671,6 +685,10 @@ export class EVMEthers5Client { EthersStoreUtil.setProvider(provider) EthersStoreUtil.setStatus('connected') EthersStoreUtil.setIsConnected(true) + this.appKit?.setAllAccounts( + addresses.map(address => ({ address, type: 'eoa' })), + this.chain + ) this.setAddress(addresses[0]) this.watchEIP6963(provider) } @@ -689,6 +707,10 @@ export class EVMEthers5Client { EthersStoreUtil.setProvider(config.injected) EthersStoreUtil.setStatus('connected') EthersStoreUtil.setIsConnected(true) + this.appKit?.setAllAccounts( + addresses.map(address => ({ address, type: 'eoa' })), + this.chain + ) this.setAddress(addresses[0]) this.watchCoinbase(config) } @@ -706,12 +728,56 @@ export class EVMEthers5Client { EthersStoreUtil.setProvider(config.coinbase) EthersStoreUtil.setStatus('connected') EthersStoreUtil.setIsConnected(true) + this.appKit?.setAllAccounts( + addresses.map(address => ({ address, type: 'eoa' })), + this.chain + ) this.setAddress(addresses[0]) this.watchCoinbase(config) } } } + private async setAuthProvider() { + SafeLocalStorage.setItem(EthersConstantsUtil.WALLET_ID, ConstantsUtil.AUTH_CONNECTOR_ID) + + if (this.authProvider) { + this.appKit?.setLoading(true) + const { + address, + chainId, + smartAccountDeployed, + preferredAccountType, + accounts = [] + } = await this.authProvider.connect({ chainId: this.getChainId() }) + + const { smartAccountEnabledNetworks } = + await this.authProvider.getSmartAccountEnabledNetworks() + + this.appKit?.setSmartAccountEnabledNetworks(smartAccountEnabledNetworks, this.chain) + if (address && chainId) { + this.appKit?.setAllAccounts( + accounts.length > 0 + ? accounts + : [{ address, type: preferredAccountType as 'eoa' | 'smartAccount' }], + this.chain + ) + + EthersStoreUtil.setChainId(NetworkUtil.parseEvmChainId(chainId)) + EthersStoreUtil.setProviderType(ConstantsUtil.AUTH_CONNECTOR_ID as 'w3mAuth') + EthersStoreUtil.setProvider(this.authProvider as unknown as CombinedProvider) + EthersStoreUtil.setStatus('connected') + EthersStoreUtil.setIsConnected(true) + EthersStoreUtil.setAddress(address as Address) + EthersStoreUtil.setPreferredAccountType(preferredAccountType as W3mFrameTypes.AccountType) + this.appKit?.setSmartAccountDeployed(Boolean(smartAccountDeployed), this.chain) + this.watchAuth() + this.watchModal() + } + this.appKit?.setLoading(false) + } + } + private async watchWalletConnect() { const WalletConnectProvider = await this.getWalletConnectProvider() @@ -784,6 +850,9 @@ export class EVMEthers5Client { } private watchEIP6963(provider: Provider) { + const appKit = this.appKit + const namespace = this.chain + function disconnectHandler() { SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() @@ -797,7 +866,12 @@ export class EVMEthers5Client { const currentAccount = accounts?.[0] if (currentAccount) { EthersStoreUtil.setAddress(utils.getAddress(currentAccount) as Address) + appKit?.setAllAccounts( + accounts.map(address => ({ address, type: 'eoa' })), + namespace + ) } else { + appKit?.setAllAccounts([], namespace) SafeLocalStorage.removeItem(EthersConstantsUtil.WALLET_ID) EthersStoreUtil.reset() } @@ -854,6 +928,93 @@ export class EVMEthers5Client { } } + private watchAuth() { + if (this.authProvider) { + this.authProvider.onRpcRequest(request => { + if (W3mFrameHelpers.checkIfRequestExists(request)) { + if (!W3mFrameHelpers.checkIfRequestIsAllowed(request)) { + if (this.appKit?.isOpen()) { + if (this.appKit?.isTransactionStackEmpty()) { + return + } + if (this.appKit?.isTransactionShouldReplaceView()) { + this.appKit?.replace('ApproveTransaction') + } else { + this.appKit?.redirect('ApproveTransaction') + } + } else { + this.appKit?.open({ view: 'ApproveTransaction' }) + } + } + } else { + this.appKit?.open() + // eslint-disable-next-line no-console + console.error(W3mFrameRpcConstants.RPC_METHOD_NOT_ALLOWED_MESSAGE, { + method: request.method + }) + setTimeout(() => { + this.appKit?.showErrorMessage(W3mFrameRpcConstants.RPC_METHOD_NOT_ALLOWED_UI_MESSAGE) + }, 300) + } + }) + + this.authProvider.onRpcError(() => { + const isModalOpen = this.appKit?.isOpen() + + if (isModalOpen) { + if (this.appKit?.isTransactionStackEmpty()) { + this.appKit?.close() + } else { + this.appKit?.popTransactionStack(true) + } + } + }) + + this.authProvider.onRpcSuccess(() => { + if (this.appKit?.isTransactionStackEmpty()) { + this.appKit?.close() + } else { + this.appKit?.popTransactionStack() + } + }) + + this.authProvider.onNotConnected(() => { + this.appKit?.setIsConnected(false, this.chain) + this.appKit?.setLoading(false) + }) + + this.authProvider.onIsConnected(({ preferredAccountType }) => { + this.appKit?.setIsConnected(true, this.chain) + this.appKit?.setLoading(false) + EthersStoreUtil.setPreferredAccountType(preferredAccountType as W3mFrameTypes.AccountType) + }) + + this.authProvider.onSetPreferredAccount(({ address, type }) => { + if (!address) { + return + } + this.appKit?.setLoading(true) + const chainId = NetworkUtil.caipNetworkIdToNumber(this.appKit?.getCaipNetwork()?.id) + EthersStoreUtil.setAddress(address as Address) + EthersStoreUtil.setChainId(chainId) + EthersStoreUtil.setStatus('connected') + EthersStoreUtil.setIsConnected(true) + EthersStoreUtil.setPreferredAccountType(type as W3mFrameTypes.AccountType) + this.syncAccount().then(() => this.appKit?.setLoading(false)) + }) + } + } + + private watchModal() { + if (this.authProvider) { + this.subscribeState(val => { + if (!val.open) { + this.authProvider?.rejectRpcRequests() + } + }) + } + } + private async syncAccount() { const address = EthersStoreUtil.state.address const chainId = EthersStoreUtil.state.chainId @@ -879,6 +1040,7 @@ export class EVMEthers5Client { } else if (!isConnected && this.hasSyncedConnectedAccount) { this.appKit?.resetWcConnection() this.appKit?.resetNetwork() + this.appKit?.setAllAccounts([], this.chain) } } @@ -1037,7 +1199,6 @@ export class EVMEthers5Client { method: 'wallet_switchEthereumChain', params: [{ chainId: EthersHelpersUtil.numberToHexString(chain.chainId) }] }) - EthersStoreUtil.setChainId(chainId) // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (switchError: any) { @@ -1051,6 +1212,29 @@ export class EVMEthers5Client { ) } } + } else if (providerType === ConstantsUtil.INJECTED_CONNECTOR_ID && chain) { + const InjectedProvider = provider + if (InjectedProvider) { + try { + await InjectedProvider.request({ + method: 'wallet_switchEthereumChain', + params: [{ chainId: EthersHelpersUtil.numberToHexString(chain.chainId) }] + }) + EthersStoreUtil.setChainId(chain.chainId) + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (switchError: any) { + if ( + switchError.code === EthersConstantsUtil.ERROR_CODE_UNRECOGNIZED_CHAIN_ID || + switchError.code === EthersConstantsUtil.ERROR_CODE_DEFAULT || + switchError?.data?.originalError?.code === + EthersConstantsUtil.ERROR_CODE_UNRECOGNIZED_CHAIN_ID + ) { + await EthersHelpersUtil.addEthereumChain(InjectedProvider, chain) + } else { + throw new Error('Chain is not supported') + } + } + } } else if (providerType === ConstantsUtil.EIP6963_CONNECTOR_ID && chain) { const EIP6963Provider = provider @@ -1093,9 +1277,33 @@ export class EVMEthers5Client { EthersConstantsUtil.ERROR_CODE_UNRECOGNIZED_CHAIN_ID ) { await EthersHelpersUtil.addEthereumChain(CoinbaseProvider, chain) + } else { + throw new Error('Error switching network') } } } + } else if (providerType === ConstantsUtil.AUTH_CONNECTOR_ID) { + if (this.authProvider && chain?.chainId) { + try { + this.appKit?.setLoading(true) + await this.authProvider.switchNetwork(chain?.chainId) + EthersStoreUtil.setChainId(chain.chainId) + + const { address, preferredAccountType } = await this.authProvider.connect({ + chainId: chain?.chainId + }) + + EthersStoreUtil.setAddress(address as Address) + EthersStoreUtil.setPreferredAccountType( + preferredAccountType as W3mFrameTypes.AccountType + ) + await this.syncAccount() + } catch { + throw new Error('Switching chain failed') + } finally { + this.appKit?.setLoading(false) + } + } } } } @@ -1147,6 +1355,34 @@ export class EVMEthers5Client { this.appKit?.setConnectors(w3mConnectors) } + private async syncAuthConnector(projectId: string, auth: ProviderType['auth']) { + if (typeof window !== 'undefined') { + this.authProvider = new W3mFrameProvider(projectId) + + this.appKit?.addConnector({ + id: ConstantsUtil.AUTH_CONNECTOR_ID, + type: 'AUTH', + name: 'Auth', + provider: this.authProvider, + email: auth?.email, + socials: auth?.socials, + showWallets: auth?.showWallets === undefined ? true : auth.showWallets, + chain: this.chain, + walletFeatures: auth?.walletFeatures + }) + + this.appKit?.setLoading(true) + const isLoginEmailUsed = this.authProvider.getLoginEmailUsed() + this.appKit?.setLoading(isLoginEmailUsed) + const { isConnected } = await this.authProvider.isConnected() + if (isConnected) { + await this.setAuthProvider() + } else { + this.appKit?.setLoading(false) + } + } + } + private eip6963EventHandler(event: CustomEventInit) { if (event.detail) { const { info, provider } = event.detail diff --git a/packages/base/adapters/evm/ethers5/index.ts b/packages/base/adapters/evm/ethers5/index.ts index 7ce51af5c1..25b94a5c44 100644 --- a/packages/base/adapters/evm/ethers5/index.ts +++ b/packages/base/adapters/evm/ethers5/index.ts @@ -1,6 +1,7 @@ import '@web3modal/polyfills' export { EVMEthers5Client } from './client.js' +export * from '@web3modal/scaffold-utils/ethers' // -- Types export type { AdapterOptions } from './client.js' diff --git a/packages/ethers5/exports/react.tsx b/packages/ethers5/exports/react.tsx index 736603c3a8..572b173bff 100644 --- a/packages/ethers5/exports/react.tsx +++ b/packages/ethers5/exports/react.tsx @@ -2,7 +2,7 @@ import { AppKit } from '@web3modal/base' import type { AppKitOptions } from '@web3modal/base' -import { EVMEthersClient, type AdapterOptions } from '@web3modal/base/adapters/evm/ethers' +import { EVMEthers5Client, type AdapterOptions } from '@web3modal/base/adapters/evm/ethers5' import { ConstantsUtil } from '@web3modal/scaffold-utils' import { EthersStoreUtil } from '@web3modal/scaffold-utils/ethers' import { getWeb3Modal } from '@web3modal/base/utils/library/react' @@ -15,7 +15,7 @@ export { defaultConfig } from '@web3modal/base/adapters/evm/ethers' // -- Setup ------------------------------------------------------------------- let appkit: AppKit | undefined = undefined -let ethersAdapter: EVMEthersClient | undefined = undefined +let ethersAdapter: EVMEthers5Client | undefined = undefined export type Ethers5AppKitOptions = Omit< AppKitOptions, @@ -24,7 +24,7 @@ export type Ethers5AppKitOptions = Omit< AdapterOptions export function createWeb3Modal(options: Ethers5AppKitOptions) { - ethersAdapter = new EVMEthersClient({ + ethersAdapter = new EVMEthers5Client({ ethersConfig: options.ethersConfig, siweConfig: options.siweConfig, chains: options.chains, diff --git a/packages/ethers5/exports/vue.ts b/packages/ethers5/exports/vue.ts index c8b4d140f5..27f9cab668 100644 --- a/packages/ethers5/exports/vue.ts +++ b/packages/ethers5/exports/vue.ts @@ -1,6 +1,6 @@ import { AppKit } from '@web3modal/base' import type { AppKitOptions } from '@web3modal/base' -import { EVMEthersClient, type AdapterOptions } from '@web3modal/base/adapters/evm/ethers' +import { EVMEthers5Client, type AdapterOptions } from '@web3modal/base/adapters/evm/ethers5' import { ConstantsUtil } from '@web3modal/scaffold-utils' import { getWeb3Modal } from '@web3modal/base/utils/library/vue' import { onUnmounted, ref } from 'vue' @@ -12,13 +12,13 @@ export { defaultConfig } from '@web3modal/base/adapters/evm/ethers' // -- Setup ------------------------------------------------------------------- let appkit: AppKit | undefined = undefined -let ethersAdapter: EVMEthersClient | undefined = undefined +let ethersAdapter: EVMEthers5Client | undefined = undefined type EthersAppKitOptions = Omit, 'adapters' | 'sdkType' | 'sdkVersion'> & AdapterOptions export function createWeb3Modal(options: EthersAppKitOptions) { - ethersAdapter = new EVMEthersClient({ + ethersAdapter = new EVMEthers5Client({ ethersConfig: options.ethersConfig, siweConfig: options.siweConfig, chains: options.chains, From a4997601ce895f0ac67bc0720d342ec83966cf09 Mon Sep 17 00:00:00 2001 From: Enes Date: Tue, 3 Sep 2024 13:48:47 +0300 Subject: [PATCH 12/17] fix/missing action functions exports from clients (#2778) --- examples/html-ethers/CHANGELOG.md | 690 ++++++++++++++++++ examples/html-ethers/index.html | 34 + examples/html-ethers/package.json | 16 + examples/html-ethers/src/main.js | 83 +++ examples/html-ethers5/index.html | 19 +- examples/html-ethers5/src/main.js | 41 +- examples/next-ethers/next-env.d.ts | 5 + examples/react-wagmi/src/App.tsx | 6 +- examples/react-wagmi/src/WagmiHooks.tsx | 19 + packages/base/adapters/evm/ethers/client.ts | 6 +- packages/base/adapters/evm/ethers5/client.ts | 6 +- .../evm/ethers5/utils/defaultConfig.ts | 36 +- packages/base/adapters/evm/wagmi/client.ts | 4 +- .../base/adapters/solana/web3js/client.ts | 5 +- packages/base/src/client.ts | 53 +- packages/base/utils/TypesUtil.ts | 6 - packages/base/utils/library/react/index.ts | 5 +- packages/base/utils/library/vue/index.ts | 5 +- packages/core/src/utils/TypeUtil.ts | 10 +- packages/ethers/exports/index.ts | 4 +- packages/ethers/exports/react.tsx | 12 +- packages/ethers/exports/vue.ts | 6 +- packages/ethers5/exports/index.ts | 8 +- packages/ethers5/exports/react.tsx | 8 +- packages/ethers5/exports/vue.ts | 8 +- packages/solana/exports/react.tsx | 12 +- packages/solana/exports/vue.ts | 6 +- pnpm-lock.yaml | 59 +- 28 files changed, 1094 insertions(+), 78 deletions(-) create mode 100644 examples/html-ethers/CHANGELOG.md create mode 100644 examples/html-ethers/index.html create mode 100644 examples/html-ethers/package.json create mode 100644 examples/html-ethers/src/main.js create mode 100644 examples/next-ethers/next-env.d.ts create mode 100644 examples/react-wagmi/src/WagmiHooks.tsx diff --git a/examples/html-ethers/CHANGELOG.md b/examples/html-ethers/CHANGELOG.md new file mode 100644 index 0000000000..2534039b8f --- /dev/null +++ b/examples/html-ethers/CHANGELOG.md @@ -0,0 +1,690 @@ +# @examples/html-ethers5 + +## 5.1.4 + +### Patch Changes + +- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746 + - chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741 + - chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751 + - Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748 + - fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715 + - chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747 + - fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765 + - chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756 + - fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745 +- Updated dependencies []: + - @web3modal/ethers5@5.1.4 + +## 5.1.3 + +### Patch Changes + +- refactor: defaultChain ts mismatch, custom hooks, separation of dependencies + +- Updated dependencies []: + - @web3modal/ethers5@5.1.3 + +## 5.1.2 + +### Patch Changes + +- Added Solana Auth Provider types and schemas + +- Updated dependencies []: + - @web3modal/ethers5@5.1.2 + +## 5.1.1 + +### Patch Changes + +- Update EthProvider to v 2.15.1 + +- Updated dependencies []: + - @web3modal/ethers5@5.1.1 + +## 5.1.0 + +### Minor Changes + +Enhanced compatibility, performance, developer experience, and user interface updates across various features + +- fix: remove limitation on sending versioned tx by @tomiir in https://github.com/WalletConnect/web3modal/pull/2638 +- refactor: fix missing ens screens by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2639 +- chore: remove non-Blockchain API RPCs by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2640 +- chore: update wagmi dependencies to latest version by @tomiir in https://github.com/WalletConnect/web3modal/pull/2642 +- chore: dynamic metadata URL by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2628 +- add icons and wallets by @glitch-txs in https://github.com/WalletConnect/web3modal/pull/2637 +- chore: fix playwright tests by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2633 +- chore: more renovate by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2619 +- chore: test single retry in tests by @tomiir in https://github.com/WalletConnect/web3modal/pull/2648 +- feat/automated tests with metamask by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2636 +- fix: import types from the package root in partials by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2650 +- feat: add support for eip5792 getCapabilities and sendCalls by @tomiir in https://github.com/WalletConnect/web3modal/pull/2576 +- chore: ID allocation service by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2574 +- refactor: solana sign and send transaction by @zoruka in https://github.com/WalletConnect/web3modal/pull/2646 +- chore: renovate updates by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2673 +- fix(solana): injected connectors not detected by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2656 +- chore: fix renovate includePaths by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2674 +- chore: update lab names & images by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2653 +- chore: fix typo by @riyueguang in https://github.com/WalletConnect/web3modal/pull/2600 +- refactor: handle balance and balanceSymbol fetch to update w3m-button by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2433 +- added filter transactions by chain by @glitch-txs in https://github.com/WalletConnect/web3modal/pull/1834 +- refactor/wallet card item with image optimization by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2572 +- fix: small balance format by @imlonghao in https://github.com/WalletConnect/web3modal/pull/2651 +- feat: add git hooks with husky and add pre-push hook by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2558 +- fix: add getApprovedCaipNetworks implementation by @tomiir in https://github.com/WalletConnect/web3modal/pull/2644 +- chore: update vitest to v2 by @tomiir in https://github.com/WalletConnect/web3modal/pull/2678 +- feat: add sender to identity and reverse resolution by @tomiir in https://github.com/WalletConnect/web3modal/pull/2649 +- refactor: solana walletconnect rpc interface by @zoruka in https://github.com/WalletConnect/web3modal/pull/2677 +- Wagmi: Erc7715 permissions with Appkit embedded wallet by @KannuSingh in https://github.com/WalletConnect/web3modal/pull/2615 +- fix issue with modal not closing by @KannuSingh in https://github.com/WalletConnect/web3modal/pull/2680 +- fix: wagmi not showing loading indicator on email reconnection by @tomiir in https://github.com/WalletConnect/web3modal/pull/2682 +- fix: ethers disconnection error by @tomiir in https://github.com/WalletConnect/web3modal/pull/2683 +- fix: Wagmi Switch To by @tomiir in https://github.com/WalletConnect/web3modal/pull/2679 +- refactor: improvements to siwe flow and modal animations by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2672 +- chore: added rn samples in apple file by @ignaciosantise in https://github.com/WalletConnect/web3modal/pull/2687 +- chore: Web3Modal -> AppKit by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2686 +- chore: fix metadata icon by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2685 +- fix(multi-account): account switch on wagmi by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2689 +- Added Flutter universal links by @quetool in https://github.com/WalletConnect/web3modal/pull/2695 +- feat: add bundle size check by @lukaisailovic in https://github.com/WalletConnect/web3modal/pull/2694 +- chore: remove unnecessary window.postMessage for W3mFrame by @zoruka in https://github.com/WalletConnect/web3modal/pull/2658 +- refactor: standardize solana provider adapters by @zoruka in https://github.com/WalletConnect/web3modal/pull/2690 +- fix: bring back old parameters for RPC call on solana_signTransaction by @zoruka in https://github.com/WalletConnect/web3modal/pull/2692 +- refactor: export missing type defs from siwe package by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2703 +- fix: solana qa round by @zoruka in https://github.com/WalletConnect/web3modal/pull/2704 +- chore: update with latest V5 changes by @svenvoskamp in https://github.com/WalletConnect/web3modal/pull/2635 +- fix(deps): update walletconnect to v2.15.0 by @renovate in https://github.com/WalletConnect/web3modal/pull/2675 +- chore(deps): update wagmi by @renovate in https://github.com/WalletConnect/web3modal/pull/2676 +- chore: URL on lab pages by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2702 +- chore: update vite-size to 0.0.5 by @lukaisailovic in https://github.com/WalletConnect/web3modal/pull/2700 +- chore: change chainId type to accept string and its dependencies by @zoruka in https://github.com/WalletConnect/web3modal/pull/2632 +- fix(deps): update dependency @solana/web3.js to v1.95.2 by @renovate in https://github.com/WalletConnect/web3modal/pull/2312 + +### New Contributors + +- @riyueguang made their first contribution in https://github.com/WalletConnect/web3modal/pull/2600 +- @imlonghao made their first contribution in https://github.com/WalletConnect/web3modal/pull/2651 +- @quetool made their first contribution in https://github.com/WalletConnect/web3modal/pull/2695 + +**Full Changelog**: https://github.com/WalletConnect/web3modal/compare/5.0.11...5.1.0 + +### Patch Changes + +- Updated dependencies []: + - @web3modal/ethers5@5.1.0 + +## 5.0.11 + +### Patch Changes + +- - Hotfix to prevent loading state with QR code + +- Updated dependencies []: + - @web3modal/ethers5@5.0.11 + +## 5.0.10 + +- chore: update with v5 by @tomiir in https://github.com/WalletConnect/web3modal/pull/2612 +- fix: move the wagmi state mutation to outside of 1-click auth flow by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2585 +- :hotfix fix svg error when requesting farcaster qr code by @svenvoskamp in https://github.com/WalletConnect/web3modal/pull/2621 + +**Full Changelog**: https://github.com/WalletConnect/web3modal/compare/5.0.9...5.0.10 + +- Updated dependencies []: + - @web3modal/ethers5@5.0.10 + +## 5.0.9 + +### Patch Changes + +- - chore: refine link names by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2588 + - hotfix change secure site origin domain to .org by @svenvoskamp in https://github.com/WalletConnect/web3modal/pull/2603 + +**Full Changelog**: https://github.com/WalletConnect/web3modal/compare/5.0.8...5.0.9 + +## 5.0.8 + +### Patch Changes + +- - chore: lab loading indicator by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2548 + - fix: not allow multiple account syncs for same caip address by @zoruka in https://github.com/WalletConnect/web3modal/pull/2547 + - fix: missing network not supported modal on wallet network switch by @zoruka in https://github.com/WalletConnect/web3modal/pull/2565 + - chore: add clientId to BlockchainAPI requests by @tomiir in https://github.com/WalletConnect/web3modal/pull/2521 + - Chore/split internal external testing by @svenvoskamp in https://github.com/WalletConnect/web3modal/pull/2563 + - fix: remove 200ms QR delay by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2567 + - [TDW] move from npm to pnpm by @segunadebayo in https://github.com/WalletConnect/web3modal/pull/2545 + - feat: enableSwaps option by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2573 + - build: fix dockerfile and bring back turbo by @segunadebayo in https://github.com/WalletConnect/web3modal/pull/2582 + - chore: updates providers to `2.14` by @ganchoradkov in https://github.com/WalletConnect/web3modal/pull/2557 + - fix: gets chains from approved accounts by @ganchoradkov in https://github.com/WalletConnect/web3modal/pull/2562 + - :fix show right icon for multi-address account by @svenvoskamp in https://github.com/WalletConnect/web3modal/pull/2560 + - feat: add wallet features and socials github tests by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2571 + - fix: multiple account syncs on wagmi by @zoruka in https://github.com/WalletConnect/web3modal/pull/2575 + - feat: apply RPC refactor and EIP5792 schema changes by @tomiir in https://github.com/WalletConnect/web3modal/pull/2580 + - refactor: turbo pipeline by @segunadebayo in https://github.com/WalletConnect/web3modal/pull/2587 + + **Full Changelog**: https://github.com/WalletConnect/web3modal/compare/5.0.7...5.0.8 + +- Updated dependencies []: + - @web3modal/ethers5@5.0.8 + +## 5.0.7 + +### Patch Changes + +- - feat: multi address by @ganchoradkov in https://github.com/WalletConnect/web3modal/pull/2286 + - feat: feat: added vue for exports in solana by @phoenixVS in https://github.com/WalletConnect/web3modal/pull/2449 + - fix: wagmi authConnector connectExternal resolving issue and enable wagmi email tests by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2504 + - chore: configures report-only CSP for lab by @bkrem in https://github.com/WalletConnect/web3modal/pull/2388 + - fix: settings btn styling by @ganchoradkov in https://github.com/WalletConnect/web3modal/pull/2523 + - Add Wallet Standard to AppKit + Solana by @glitch-txs in https://github.com/WalletConnect/web3modal/pull/2482 + - chore: remove onramp widget from labs by @tomiir in https://github.com/WalletConnect/web3modal/pull/2526 + - feat: support custom connectors by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2119 + - fix: disconnect logic for EIP6963 & Injected provider types for @web3modal/ethers by @hmzakhalid in https://github.com/WalletConnect/web3modal/pull/2289 + - Feat ERC7715 grant_permissions support on lab by @KannuSingh in https://github.com/WalletConnect/web3modal/pull/2500 + - update chain on network change by @glitch-txs in https://github.com/WalletConnect/web3modal/pull/2497 + - fix: make accounts optional in social response by @tomiir in https://github.com/WalletConnect/web3modal/pull/2520 + - chore: SA Tests switch network before flow by @tomiir in https://github.com/WalletConnect/web3modal/pull/2529 + - chore: changed react native universal links by @ignaciosantise in https://github.com/WalletConnect/web3modal/pull/2535 + - chore: change labs' ethers rpc urls to walletconnect.org by @tomiir in https://github.com/WalletConnect/web3modal/pull/2530 + - chore: remove 'no-cache' from API requests by @tomiir in https://github.com/WalletConnect/web3modal/pull/2538 + - fix: makes `getMessageParams` siwe client method optional by @ganchoradkov in https://github.com/WalletConnect/web3modal/pull/2305 + - chore: update secure site url to org domain by @tomiir in https://github.com/WalletConnect/web3modal/pull/2537 + - fix: multiple name by @tomiir in https://github.com/WalletConnect/web3modal/pull/2410 + - refactor(common): utils by @Simon-He95 in https://github.com/WalletConnect/web3modal/pull/2447 + - fix: reorder chains to have current chain Id as main message by @tomiir in https://github.com/WalletConnect/web3modal/pull/2423 + - refactor: change solana testnet and devnet rpcs to wc by @enesozturk in https://github.com/WalletConnect/web3modal/pull/2541 + - refactor: laboratory wagmi tests by @zoruka in https://github.com/WalletConnect/web3modal/pull/2552 + - fix: sync accounts in wagmi and subscribe to account change by @tomiir in https://github.com/WalletConnect/web3modal/pull/2544 +- Updated dependencies []: + - @web3modal/ethers5@5.0.7 + +## 5.0.6 + +### Patch Changes + +- fix: Social Login illegal invocation issue. Wagmi tests + +- Updated dependencies []: + - @web3modal/ethers5@5.0.6 + +## 5.0.5 + +### Patch Changes + +- feat: universal link internal flag. Add kotlin assetlinks. Fix email truncation' + +- Updated dependencies []: + - @web3modal/ethers5@5.0.5 + +## 5.0.4 + +### Patch Changes + +- fix: wcPromise incompatibility issues + +- Updated dependencies []: + - @web3modal/ethers5@5.0.4 + +## 5.0.3 + +### Patch Changes + +- fix: ethers5 coinbase issues. Turbo build issues. Upate cb connector. + +- Updated dependencies []: + - @web3modal/ethers5@5.0.3 + +## 5.0.2 + +### Patch Changes + +- fix: siwe signOutOnNetwork change issue. fix: wallets filtered by rdns matched from explorer api. fix: solana network id issue + +- Updated dependencies []: + - @web3modal/ethers5@5.0.2 + +## 5.0.1 + +### Patch Changes + +- fix: remove walletconnect restriction on names + +- Updated dependencies []: + - @web3modal/ethers5@5.0.1 + +## 5.0.0 + +### Major Changes + +- Release V5 + +### Patch Changes + +- Updated dependencies []: + - @web3modal/ethers5@5.0.0 + +## 5.0.0-cn-v5.0 + +### Major Changes + +- Test V5 + +### Patch Changes + +- Updated dependencies []: + - @web3modal/ethers5@5.0.0-cn-v5.0 + +## 4.2.3 + +### Patch Changes + +- feat: - feat: restricted ens names. fix: iat set automatically if not present in messageParams. Adds siwe config handlers + +- Updated dependencies []: + - @web3modal/ethers5@4.2.3 + +## 4.2.3-alpha.0 + +### Patch Changes + +- feat: add support for coinbase smart accounts + +- Updated dependencies []: + - @web3modal/ethers5@4.2.3-alpha.0 + +## 4.2.2 + +### Patch Changes + +- feat: social login refactor. wagmi sendCalls support. refactor theme variables + +- Updated dependencies []: + - @web3modal/ethers5@4.2.2 + +## 4.2.1 + +### Patch Changes + +- Hotfix to support injected and announced wallets in in app browsers + +- Updated dependencies []: + - @web3modal/ethers5@4.2.1 + +## 4.2.0 + +### Patch Changes + +- release: 4.2.0 version release + +- Updated dependencies []: + - @web3modal/ethers5@4.2.0 + +## 4.2.0-alpha.0 + +### Patch Changes + +- feat: 4.2.0-alpha release + +- Updated dependencies []: + - @web3modal/ethers5@4.2.0-alpha.0 + +## 4.2.0-03e4f4a8.2 + +### Patch Changes + +- fix: Issue with SIWE + Wagmi sign out. Fixes issue where signature verification fail resulted in empty open modal' + +- Updated dependencies []: + - @web3modal/ethers5@4.2.0-03e4f4a8.2 + +## 4.2.0-448f7f4.1 + +### Minor Changes + +- refactor: improvements to all features (siwe, send, swaps, ui and ux) + +### Patch Changes + +- Updated dependencies []: + - @web3modal/ethers5@4.2.0-448f7f4.1 + +## 4.1.12-910a844.0 + +### Patch Changes + +- refactor: sync theme with secure site + +- Updated dependencies []: + - @web3modal/ethers5@4.1.12-910a844.0 + +## 4.1.11 + +### Patch Changes + +- refactor: Solana exported helper methods and proram instruction improvements +- refactor: email and smart account improvements +- refactor: unit test CI check improvements +- feat: convert + +- Updated dependencies []: + - @web3modal/ethers5@4.1.11 + +## 4.1.10 + +### Patch Changes + +- Fix activity list styling issue + +- Updated dependencies []: + - @web3modal/ethers5@4.1.10 + +## 4.1.9 + +### Patch Changes + +- Blockchain API fix + +- Updated dependencies []: + - @web3modal/ethers5@4.1.9 + +## 4.1.8 + +### Patch Changes + +- Hotfix for redundant tokenbalance calls + +- Updated dependencies []: + - @web3modal/ethers5@4.1.8 + +## 4.1.7 + +### Patch Changes + +- Hotfix for inccorect state of w3m-button when email is enabled + +- Updated dependencies []: + - @web3modal/ethers5@4.1.7 + +## 4.1.6 + +### Patch Changes + +- Fix modal default height. Fix ethers email connection lag. Fix ethers + rc relay disconnect issue. Adds new wui-components for secure site. + +- Updated dependencies []: + - @web3modal/ethers5@4.1.6 + +## 4.1.6-a0733f5.0 + +### Patch Changes + +- chore: canary release for siwe dependency + +- Updated dependencies []: + - @web3modal/ethers@4.1.6-a0733f5.0 + - @web3modal/siwe@4.1.6-a0733f5.0 + - @web3modal/solana@4.1.6-a0733f5.0 + - @web3modal/wagmi@4.1.6-a0733f5.0 + +## 4.1.5 + +### Patch Changes + +- release: v4.1.5 + +- Updated dependencies []: + - @web3modal/ethers5@4.1.5 + +## 4.1.5-93c81127.0 + +### Patch Changes + +- fix: polyfill process in wallet package + +- Updated dependencies []: + - @web3modal/ethers5@4.1.5-93c81127.0 + +## 4.1.4 + +### Patch Changes + +- feat: wallet info hook + +- Updated dependencies []: + - @web3modal/ethers5@4.1.4 + +## 4.1.3 + +### Patch Changes + +- feat: wallet info hook + +- feat: reset version to 4.1.3 + +- Updated dependencies []: + - @web3modal/ethers5@4.1.3 + +## 4.1.3-5f2ae345.1 + +### Patch Changes + +- canary: test imports + +- Updated dependencies []: + - @web3modal/ethers5@4.1.3-5f2ae345.1 + +## 4.1.3-8e039e.0 + +### Patch Changes + +- feat: update optional dependencies + +- Updated dependencies []: + - @web3modal/ethers5@4.1.3-8e039e.0 + +## 4.1.2 + +### Patch Changes + +- 4.1.2 release + +- Updated dependencies []: + - @web3modal/ethers5@4.1.2 + +## 4.2.0-4b5257b4.1 + +### Minor Changes + +- [#2052](https://github.com/WalletConnect/web3modal/pull/2052) [`1b90376`](https://github.com/WalletConnect/web3modal/commit/1b903765a675f0f1b9ea0a44bcf84e2dad6b4436) Thanks [@enesozturk](https://github.com/enesozturk)! - refactor: add missing extensions on imports + +- feat: export solana chains from the solana package + +- [#2052](https://github.com/WalletConnect/web3modal/pull/2052) [`729313f`](https://github.com/WalletConnect/web3modal/commit/729313fe9dfb402ca694cbd77f49cc61895e2d07) Thanks [@enesozturk](https://github.com/enesozturk)! - chore: new solana canary release + +### Patch Changes + +- Updated dependencies [[`1b90376`](https://github.com/WalletConnect/web3modal/commit/1b903765a675f0f1b9ea0a44bcf84e2dad6b4436), [`729313f`](https://github.com/WalletConnect/web3modal/commit/729313fe9dfb402ca694cbd77f49cc61895e2d07)]: + - @web3modal/ethers5@4.2.0-4b5257b4.1 + +## 4.2.0-dbbd8c44.0 + +### Minor Changes + +- refactor: add missing extensions on imports + +### Patch Changes + +- Updated dependencies []: + - @web3modal/ui@4.2.0-dbbd8c44.0 + - @web3modal/common@4.2.0-dbbd8c44.0 + +## 4.2.0-500a38.0 + +### Minor Changes + +- feat: solana integration + +### Patch Changes + +- Updated dependencies []: + - @web3modal/ethers5@4.2.0-500a38.0 + +## 4.1.1 + +### Patch Changes + +- Fix siwe version + +- Updated dependencies []: + - @web3modal/ethers5@4.1.1 + +## 4.1.0 + +### Minor Changes + +- Email Stable release + +### Patch Changes + +- Updated dependencies []: + - @web3modal/ethers5@4.1.0 + +## 4.0.13 + +### Patch Changes + +- Fix secure site url + +- Updated dependencies []: + - @web3modal/ethers5@4.0.13 + +## 4.0.12 + +### Patch Changes + +- [#2014](https://github.com/WalletConnect/web3modal/pull/2014) [`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0) Thanks [@tomiir](https://github.com/tomiir)! - Smart Account RPC handler canary + +- Smart Account initialization and feature flag + +- Updated dependencies [[`95b35e1`](https://github.com/WalletConnect/web3modal/commit/95b35e1ebaf261a56a29cd9254d85b7c1430bfc0)]: + - @web3modal/ethers5@4.0.12 + +## 4.0.12-0c59f84f.0 + +### Patch Changes + +- Smart Account RPC handler canary + +- Updated dependencies []: + - @web3modal/ethers5@4.0.12-0c59f84f.0 + +## 4.0.11 + +### Patch Changes + +- Analytics connection event improvements. Unsupported chain flag. Siwe package refactor. RPC improvements. UI improvements' + +- Updated dependencies []: + - @web3modal/ethers5@4.0.11 + +## 4.0.10 + +### Patch Changes + +- Add error state to wui-chip composite + +- Updated dependencies []: + - @web3modal/ethers5@4.0.10 + +## 4.0.9 + +### Patch Changes + +- Add all rpc methods + auto reject when modal closes + +- Updated dependencies []: + - @web3modal/ethers5@4.0.9 + +## 4.0.8 + +### Patch Changes + +- [#1954](https://github.com/WalletConnect/web3modal/pull/1954) [`c3366e7`](https://github.com/WalletConnect/web3modal/commit/c3366e7211dba2f5c6d3377c9d9a77da5a52c0d8) Thanks [@tomiir](https://github.com/tomiir)! - Add support for eth_getBlockByNumber + +- Updated dependencies [[`c3366e7`](https://github.com/WalletConnect/web3modal/commit/c3366e7211dba2f5c6d3377c9d9a77da5a52c0d8)]: + - @web3modal/ethers5@4.0.8 + +## 4.0.8-f1845392.0 + +### Patch Changes + +- [#1954](https://github.com/WalletConnect/web3modal/pull/1954) [`4755109`](https://github.com/WalletConnect/web3modal/commit/475510962a92ea9f4388db1d08c979d99da18e54) Thanks [@tomiir](https://github.com/tomiir)! - Add support for eth_getBlockByNumber + +- Updated dependencies [[`4755109`](https://github.com/WalletConnect/web3modal/commit/475510962a92ea9f4388db1d08c979d99da18e54)]: + - @web3modal/ethers5@4.0.8-f1845392.0 + +## 4.0.7 + +### Patch Changes + +- Add eth_getBalance to list of allowed methods + +- Updated dependencies []: + - @web3modal/ethers5@4.0.7 + +## 4.0.6 + +### Patch Changes + +- Email stability fixes + +- Updated dependencies []: + - @web3modal/ethers5@4.0.6 + +## 4.0.5 + +### Patch Changes + +- [#1917](https://github.com/WalletConnect/web3modal/pull/1917) [`f79566c`](https://github.com/WalletConnect/web3modal/commit/f79566ca5119fa12795dd49fce01aea8e1a05d97) Thanks [@tomiir](https://github.com/tomiir)! - Replaces public url with blockchain api for supported networks + +- Updated dependencies [[`f79566c`](https://github.com/WalletConnect/web3modal/commit/f79566ca5119fa12795dd49fce01aea8e1a05d97)]: + - @web3modal/ethers5@4.0.5 + +## 4.0.4 + +### Patch Changes + +- Fix theming issue for email + +- Updated dependencies []: + - @web3modal/ethers5@4.0.4 + +## 4.0.3 + +### Patch Changes + +- Tag email beta, Sync Theme For Secure Wallet, Use manual version in constants + +- Updated dependencies []: + - @web3modal/ethers5@4.0.3 + +## 4.0.2 + +### Patch Changes + +- [#1899](https://github.com/WalletConnect/web3modal/pull/1899) [`42e97a0`](https://github.com/WalletConnect/web3modal/commit/42e97a04eb60090a821019ae80d62acacf35fc66) Thanks [@xzilja](https://github.com/xzilja)! - Reverted change that removed email update flow from account view + +- Updated dependencies [[`42e97a0`](https://github.com/WalletConnect/web3modal/commit/42e97a04eb60090a821019ae80d62acacf35fc66)]: + - @web3modal/ethers5@4.0.2 + +## 4.0.1 + +### Patch Changes + +- [#1879](https://github.com/WalletConnect/web3modal/pull/1879) [`e3fa353`](https://github.com/WalletConnect/web3modal/commit/e3fa35396e3d2b1153d12bfaf92738bc67b46640) Thanks [@svenvoskamp](https://github.com/svenvoskamp)! - Fix various issues on ethers/ethers5 package + +- Updated dependencies [[`e3fa353`](https://github.com/WalletConnect/web3modal/commit/e3fa35396e3d2b1153d12bfaf92738bc67b46640)]: + - @web3modal/ethers5@4.0.1 diff --git a/examples/html-ethers/index.html b/examples/html-ethers/index.html new file mode 100644 index 0000000000..ef66874131 --- /dev/null +++ b/examples/html-ethers/index.html @@ -0,0 +1,34 @@ + + + + + + Html ethers5 Example + + + +
+ + + + + +

Methods

+

getAddress

+

+      

getChainId

+

+      

getIsConnected

+

+      

getError

+

+      

getWalletProvider

+

+      

getWalletProviderType

+

+      

subscribeProvider

+

+    
+ + + diff --git a/examples/html-ethers/package.json b/examples/html-ethers/package.json new file mode 100644 index 0000000000..0420824f06 --- /dev/null +++ b/examples/html-ethers/package.json @@ -0,0 +1,16 @@ +{ + "name": "@examples/html-ethers", + "private": true, + "version": "5.1.4", + "scripts": { + "dev": "vite --port 3011", + "build": "vite build" + }, + "dependencies": { + "@web3modal/ethers": "workspace:*", + "ethers": "6.13.0" + }, + "devDependencies": { + "vite": "5.2.11" + } +} diff --git a/examples/html-ethers/src/main.js b/examples/html-ethers/src/main.js new file mode 100644 index 0000000000..ec848ba013 --- /dev/null +++ b/examples/html-ethers/src/main.js @@ -0,0 +1,83 @@ +import { createWeb3Modal, defaultConfig } from '@web3modal/ethers' + +// @ts-expect-error 1. Get projectId +const projectId = import.meta.env.VITE_PROJECT_ID +if (!projectId) { + throw new Error('VITE_PROJECT_ID is not set') +} + +function getBlockchainApiRpcUrl(chainId) { + return `https://rpc.walletconnect.org/v1/?chainId=eip155:${chainId}&projectId=${projectId}` +} + +// 2. Create wagmiConfig +const chains = [ + { + chainId: 1, + name: 'Ethereum', + currency: 'ETH', + explorerUrl: 'https://etherscan.io', + rpcUrl: getBlockchainApiRpcUrl(1) + }, + { + chainId: 42161, + name: 'Arbitrum', + currency: 'ETH', + explorerUrl: 'https://arbiscan.io', + rpcUrl: getBlockchainApiRpcUrl(42161) + } +] + +const metadata = { + name: 'AppKit', + description: 'AppKit HTML + Ethers Example', + url: 'https://lab.web3modal.com', + icons: ['https://avatars.githubusercontent.com/u/37784886'] +} + +const ethersConfig = defaultConfig({ + metadata, + chains, + defaultChainId: 1 +}) + +// 3. Create modal +const modal = createWeb3Modal({ + ethersConfig: { ...ethersConfig, email: true }, + projectId, + metadata, + chains, + themeMode: 'light' +}) + +// 4. Trigger modal programaticaly +const openConnectModalBtn = document.getElementById('open-connect-modal') +const openNetworkModalBtn = document.getElementById('open-network-modal') + +openConnectModalBtn.addEventListener('click', () => modal.open()) +openNetworkModalBtn.addEventListener('click', () => modal.open({ view: 'Networks' })) + +const updateElement = (id, content) => { + const element = document.getElementById(id) + if (element) { + element.innerHTML = content + } +} + +const intervalId = setInterval(() => { + updateElement('getError', JSON.stringify(modal.getError(), null, 2)) + updateElement('getChainId', JSON.stringify(modal.getChainId(), null, 2)) + updateElement('getAddress', JSON.stringify(modal.getAddress(), null, 2)) + updateElement('switchNetwork', JSON.stringify(modal.switchNetwork(), null, 2)) + updateElement('getIsConnected', JSON.stringify(modal.getIsConnected(), null, 2)) + updateElement('getWalletProvider', JSON.stringify(modal.getWalletProvider(), null, 2)) + updateElement('getWalletProviderType', JSON.stringify(modal.getWalletProviderType(), null, 2)) +}, 2000) + +window.addEventListener('beforeunload', () => { + clearInterval(intervalId) +}) + +modal.subscribeProvider(state => { + updateElement('subscribeProvider', JSON.stringify(state, null, 2)) +}) diff --git a/examples/html-ethers5/index.html b/examples/html-ethers5/index.html index 0205fb4d50..ef66874131 100644 --- a/examples/html-ethers5/index.html +++ b/examples/html-ethers5/index.html @@ -5,12 +5,29 @@ Html ethers5 Example +
- + + +

Methods

+

getAddress

+

+      

getChainId

+

+      

getIsConnected

+

+      

getError

+

+      

getWalletProvider

+

+      

getWalletProviderType

+

+      

subscribeProvider

+

     
diff --git a/examples/html-ethers5/src/main.js b/examples/html-ethers5/src/main.js index 5289ad65f8..4eb28afd54 100644 --- a/examples/html-ethers5/src/main.js +++ b/examples/html-ethers5/src/main.js @@ -28,13 +28,16 @@ const chains = [ } ] +const metadata = { + name: 'AppKit', + description: 'AppKit HTML + Ethers5 Example', + url: 'https://lab.web3modal.com', + icons: ['https://avatars.githubusercontent.com/u/37784886'] +} + const ethersConfig = defaultConfig({ - metadata: { - name: 'AppKit', - description: 'AppKit Laboratory', - url: 'https://example.com', - icons: ['https://avatars.githubusercontent.com/u/37784886'] - }, + metadata, + chains, defaultChainId: 1 }) @@ -42,6 +45,7 @@ const ethersConfig = defaultConfig({ const modal = createWeb3Modal({ ethersConfig: { ...ethersConfig, email: true }, projectId, + metadata, chains, themeMode: 'light' }) @@ -53,4 +57,27 @@ const openNetworkModalBtn = document.getElementById('open-network-modal') openConnectModalBtn.addEventListener('click', () => modal.open()) openNetworkModalBtn.addEventListener('click', () => modal.open({ view: 'Networks' })) -// 5. Alternatively use w3m component buttons (see index.html) +const updateElement = (id, content) => { + const element = document.getElementById(id) + if (element) { + element.innerHTML = content + } +} + +const intervalId = setInterval(() => { + updateElement('getError', JSON.stringify(modal.getError(), null, 2)) + updateElement('getChainId', JSON.stringify(modal.getChainId(), null, 2)) + updateElement('getAddress', JSON.stringify(modal.getAddress(), null, 2)) + updateElement('switchNetwork', JSON.stringify(modal.switchNetwork(), null, 2)) + updateElement('getIsConnected', JSON.stringify(modal.getIsConnected(), null, 2)) + updateElement('getWalletProvider', JSON.stringify(modal.getWalletProvider(), null, 2)) + updateElement('getWalletProviderType', JSON.stringify(modal.getWalletProviderType(), null, 2)) +}, 2000) + +window.addEventListener('beforeunload', () => { + clearInterval(intervalId) +}) + +modal.subscribeProvider(state => { + updateElement('subscribeProvider', JSON.stringify(state, null, 2)) +}) diff --git a/examples/next-ethers/next-env.d.ts b/examples/next-ethers/next-env.d.ts new file mode 100644 index 0000000000..4f11a03dc6 --- /dev/null +++ b/examples/next-ethers/next-env.d.ts @@ -0,0 +1,5 @@ +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/examples/react-wagmi/src/App.tsx b/examples/react-wagmi/src/App.tsx index b7be969417..c85465628a 100644 --- a/examples/react-wagmi/src/App.tsx +++ b/examples/react-wagmi/src/App.tsx @@ -9,6 +9,7 @@ import { import { WagmiProvider } from 'wagmi' import { arbitrum, mainnet } from 'wagmi/chains' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' +import { WagmiHooks } from './WagmiHooks' // 0. Setup queryClient for WAGMIv2 const queryClient = new QueryClient() @@ -24,8 +25,8 @@ const wagmiConfig = defaultWagmiConfig({ chains: [mainnet, arbitrum], projectId, metadata: { - name: 'AppKit React Example', - description: 'AppKit React Example', + name: 'AppKit', + description: 'AppKit React Wagmi Example', url: '', icons: [] } @@ -62,6 +63,7 @@ export default function App() { +
{JSON.stringify(state, null, 2)}
{JSON.stringify({ themeMode, themeVariables }, null, 2)}
{JSON.stringify(events, null, 2)}
diff --git a/examples/react-wagmi/src/WagmiHooks.tsx b/examples/react-wagmi/src/WagmiHooks.tsx new file mode 100644 index 0000000000..05b236ed3b --- /dev/null +++ b/examples/react-wagmi/src/WagmiHooks.tsx @@ -0,0 +1,19 @@ +import * as React from 'react' +import { useAccount } from 'wagmi' + +export function WagmiHooks() { + const { isConnected, address, chainId } = useAccount() + + return ( +
+ {isConnected ? ( +
+

Address: {address}

+

Chain ID: {chainId}

+
+ ) : ( +

Not connected

+ )} +
+ ) +} diff --git a/packages/base/adapters/evm/ethers/client.ts b/packages/base/adapters/evm/ethers/client.ts index d34a21a0f8..11e2832380 100644 --- a/packages/base/adapters/evm/ethers/client.ts +++ b/packages/base/adapters/evm/ethers/client.ts @@ -3,6 +3,7 @@ import type { CaipAddress, CaipNetwork, CaipNetworkId, + ChainAdapter, ConnectionControllerClient, Connector, NetworkControllerClient, @@ -99,7 +100,8 @@ interface ExternalProvider extends EthereumProvider { } // -- Client -------------------------------------------------------------------- -export class EVMEthersClient { +// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments +export class EVMEthersClient implements ChainAdapter { // -- Private variables ------------------------------------------------------- private appKit: AppKit | undefined = undefined @@ -610,7 +612,7 @@ export class EVMEthersClient { return EthersStoreUtil.state.error } - public getChainId() { + public getChainId(): string | number | undefined { const storeChainId = EthersStoreUtil.state.chainId const networkControllerChainId = NetworkUtil.caipNetworkIdToNumber( this.appKit?.getCaipNetwork()?.id diff --git a/packages/base/adapters/evm/ethers5/client.ts b/packages/base/adapters/evm/ethers5/client.ts index 9b9474ef9c..efe92182e8 100644 --- a/packages/base/adapters/evm/ethers5/client.ts +++ b/packages/base/adapters/evm/ethers5/client.ts @@ -3,6 +3,7 @@ import type { CaipAddress, CaipNetwork, CaipNetworkId, + ChainAdapter, ConnectionControllerClient, Connector, NetworkControllerClient, @@ -83,7 +84,8 @@ interface ExternalProvider extends EthereumProvider { } // -- Client -------------------------------------------------------------------- -export class EVMEthers5Client { +// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments +export class EVMEthers5Client implements ChainAdapter { // -- Private variables ------------------------------------------------------- private appKit: AppKit | undefined = undefined @@ -443,7 +445,7 @@ export class EVMEthers5Client { this.checkActiveInjectedProvider(this.ethersConfig) } - if (this.ethersConfig.auth) { + if (this.ethersConfig.auth?.email || this.ethersConfig.auth?.socials?.length) { this.syncAuthConnector(this.options.projectId, this.ethersConfig.auth) } diff --git a/packages/base/adapters/evm/ethers5/utils/defaultConfig.ts b/packages/base/adapters/evm/ethers5/utils/defaultConfig.ts index 4b830378ca..e086a9b51e 100644 --- a/packages/base/adapters/evm/ethers5/utils/defaultConfig.ts +++ b/packages/base/adapters/evm/ethers5/utils/defaultConfig.ts @@ -1,10 +1,17 @@ import '@web3modal/polyfills' import type { Chain, Metadata, Provider, ProviderType } from '@web3modal/scaffold-utils/ethers' import { CoinbaseWalletSDK, type ProviderInterface } from '@coinbase/wallet-sdk' +import type { SocialProvider } from '@web3modal/scaffold-utils' export interface ConfigOptions { enableEIP6963?: boolean enableCoinbase?: boolean + auth?: { + email?: boolean + socials?: SocialProvider[] + showWallets?: boolean + walletFeatures?: boolean + } enableInjected?: boolean /** * @deprecated this doesn't do anything, use `chains` instead @@ -17,7 +24,27 @@ export interface ConfigOptions { } export function defaultConfig(options: ConfigOptions) { - const { enableEIP6963 = true, enableInjected = true, enableCoinbase = true, metadata } = options + const defaultAuth = { + email: true, + showWallets: true, + walletFeatures: true, + socials: [ + 'google', + 'x', + 'discord', + 'farcaster', + 'github', + 'apple', + 'facebook' + ] as SocialProvider[] + } + const { + enableEIP6963 = true, + enableCoinbase = true, + enableInjected = true, + auth, + metadata + } = options let injectedProvider: Provider | undefined = undefined // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents @@ -86,5 +113,12 @@ export function defaultConfig(options: ConfigOptions) { providers.EIP6963 = true } + const mergedAuth = { + ...defaultAuth, + ...auth + } + + providers.auth = mergedAuth + return providers } diff --git a/packages/base/adapters/evm/wagmi/client.ts b/packages/base/adapters/evm/wagmi/client.ts index 4b77ea6282..2bae0c67b4 100644 --- a/packages/base/adapters/evm/wagmi/client.ts +++ b/packages/base/adapters/evm/wagmi/client.ts @@ -19,7 +19,7 @@ import { getConnections, switchAccount } from '@wagmi/core' -import type { OptionsControllerState } from '@web3modal/core' +import type { ChainAdapter, OptionsControllerState } from '@web3modal/core' import { mainnet } from 'viem/chains' import { prepareTransactionRequest, sendTransaction as wagmiSendTransaction } from '@wagmi/core' import type { Chain } from '@wagmi/core/chains' @@ -67,7 +67,7 @@ interface Web3ModalState extends PublicStateControllerState { } // -- Client -------------------------------------------------------------------- -export class EVMWagmiClient { +export class EVMWagmiClient implements ChainAdapter { // -- Private variables ------------------------------------------------------- private appKit: AppKit | undefined = undefined diff --git a/packages/base/adapters/solana/web3js/client.ts b/packages/base/adapters/solana/web3js/client.ts index 2d56c72e96..91ddf0e0bf 100644 --- a/packages/base/adapters/solana/web3js/client.ts +++ b/packages/base/adapters/solana/web3js/client.ts @@ -22,7 +22,8 @@ import type { Token, Connector, CaipAddress, - CaipNetwork + CaipNetwork, + ChainAdapter } from '@web3modal/core' import type { Chain as AvailableChain } from '@web3modal/common' @@ -62,7 +63,7 @@ export interface Web3ModalClientOptions export type Web3ModalOptions = Omit // -- Client -------------------------------------------------------------------- -export class SolanaWeb3JsClient { +export class SolanaWeb3JsClient implements ChainAdapter { private appKit: AppKit | undefined = undefined private instanceOptions: Web3ModalClientOptions | undefined = undefined diff --git a/packages/base/src/client.ts b/packages/base/src/client.ts index 8ee9965e94..407d9134a9 100644 --- a/packages/base/src/client.ts +++ b/packages/base/src/client.ts @@ -39,14 +39,22 @@ export interface OpenOptions { let isInitialized = false // -- Client -------------------------------------------------------------------- -export class AppKit { +export class AppKit { private static instance?: AppKit - public adapters?: ChainAdapter[] + public adapter?: ChainAdapter + + public adapters?: ChainAdapter[] private initPromise?: Promise = undefined - public constructor(options: AppKitOptions) { + public constructor( + options: AppKitOptions & { + adapters?: ChainAdapter[] + } + ) { + // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style + this.adapter = options.adapters?.[0] as ChainAdapter this.initControllers(options) this.initOrContinue() } @@ -70,6 +78,39 @@ export class AppKit { ModalController.setLoading(loading) } + // -- Adapter Methods ---------------------------------------------------------- + public getError() { + return this.adapter?.getError?.() + } + + public getChainId() { + return this.adapter?.getChainId?.() + } + + public getAddress() { + return this.adapter?.getAddress?.() + } + + public switchNetwork(chainId: SwitchNetworkParam) { + return this.adapter?.switchNetwork?.(chainId) + } + + public getIsConnected() { + return this.adapter?.getIsConnected?.() + } + + public getWalletProvider() { + return this.adapter?.getWalletProvider?.() + } + + public getWalletProviderType() { + return this.adapter?.getWalletProviderType?.() + } + + public subscribeProvider(callback: (newState: AdapterStoreState) => void) { + return this.adapter?.subscribeProvider?.(callback) + } + public getThemeMode() { return ThemeController.state.themeMode } @@ -303,7 +344,11 @@ export class AppKit { AssetUtil.getConnectorImage(connector) // -- Private ------------------------------------------------------------------ - private async initControllers(options: AppKitOptions) { + private async initControllers( + options: AppKitOptions & { + adapters?: ChainAdapter[] + } + ) { OptionsController.setProjectId(options.projectId) OptionsController.setSdkVersion(options.sdkVersion) ChainController.initialize(options.adapters || []) diff --git a/packages/base/utils/TypesUtil.ts b/packages/base/utils/TypesUtil.ts index ffa41c57d5..dcef7ef393 100644 --- a/packages/base/utils/TypesUtil.ts +++ b/packages/base/utils/TypesUtil.ts @@ -1,6 +1,5 @@ import type { ThemeVariables } from '@web3modal/common' import type { - ChainAdapter, NetworkControllerState, OptionsControllerState, ThemeMode, @@ -10,11 +9,6 @@ import type { SIWEControllerClient, Web3ModalSIWEClient } from '@web3modal/siwe' export type AppKitOptions = OptionsControllerState & { - /** - * Adapter array to be used by the AppKit. - * @default [] - */ - adapters?: ChainAdapter[] /** * Sign In With Ethereum configuration object. * @default undefined diff --git a/packages/base/utils/library/react/index.ts b/packages/base/utils/library/react/index.ts index c7fe1c2c89..5a675733ee 100644 --- a/packages/base/utils/library/react/index.ts +++ b/packages/base/utils/library/react/index.ts @@ -31,8 +31,11 @@ declare global { let modal: AppKit | undefined = undefined -export function getWeb3Modal(appKit: AppKit) { +export function getWeb3Modal( + appKit: AppKit +) { if (appKit) { + // @ts-expect-error it we should override the modal params modal = appKit } } diff --git a/packages/base/utils/library/vue/index.ts b/packages/base/utils/library/vue/index.ts index 261e93b7b8..d234f83758 100644 --- a/packages/base/utils/library/vue/index.ts +++ b/packages/base/utils/library/vue/index.ts @@ -30,8 +30,11 @@ declare module '@vue/runtime-core' { let modal: AppKit | undefined = undefined -export function getWeb3Modal(appKit: AppKit) { +export function getWeb3Modal( + appKit: AppKit +) { if (appKit) { + // @ts-expect-error it we should override the modal params modal = appKit } } diff --git a/packages/core/src/utils/TypeUtil.ts b/packages/core/src/utils/TypeUtil.ts index 5a1cb414d5..46b6df2257 100644 --- a/packages/core/src/utils/TypeUtil.ts +++ b/packages/core/src/utils/TypeUtil.ts @@ -826,11 +826,19 @@ export interface WriteContractArgs { abi: any } -export type ChainAdapter = { +export type ChainAdapter = { connectionControllerClient?: ConnectionControllerClient networkControllerClient?: NetworkControllerClient accountState?: AccountControllerState networkState?: NetworkControllerState defaultChain?: CaipNetwork chain: Chain + getAddress?: () => string | undefined + getError?: () => unknown + getChainId?: () => number | string | undefined + switchNetwork?: ((chainId: SwitchNetworkParam) => void) | undefined + getIsConnected?: () => boolean | undefined + getWalletProvider?: () => unknown + getWalletProviderType?: () => string | undefined + subscribeProvider?: (callback: (newState: StoreState) => void) => void } diff --git a/packages/ethers/exports/index.ts b/packages/ethers/exports/index.ts index b20993ef31..330da4c2ca 100644 --- a/packages/ethers/exports/index.ts +++ b/packages/ethers/exports/index.ts @@ -2,7 +2,7 @@ import { AppKit } from '@web3modal/base' import type { AppKitOptions } from '@web3modal/base' import { EVMEthersClient, type AdapterOptions } from '@web3modal/base/adapters/evm/ethers' import { ConstantsUtil } from '@web3modal/scaffold-utils' -import { type Chain } from '@web3modal/scaffold-utils/ethers' +import { type Chain, type EthersStoreUtilState } from '@web3modal/scaffold-utils/ethers' // -- Types ------------------------------------------------------------- export type { AdapterOptions } from '@web3modal/base/adapters/evm/ethers' @@ -25,7 +25,7 @@ export function createWeb3Modal(options: EthersAppKitOptions) { defaultChain: options.defaultChain }) - return new AppKit({ + return new AppKit({ ...options, defaultChain: ethersAdapter.defaultChain, adapters: [ethersAdapter], diff --git a/packages/ethers/exports/react.tsx b/packages/ethers/exports/react.tsx index e1fa38fa3f..2f8ece4f70 100644 --- a/packages/ethers/exports/react.tsx +++ b/packages/ethers/exports/react.tsx @@ -4,7 +4,11 @@ import { AppKit } from '@web3modal/base' import type { AppKitOptions } from '@web3modal/base' import { EVMEthersClient, type AdapterOptions } from '@web3modal/base/adapters/evm/ethers' import { ConstantsUtil } from '@web3modal/scaffold-utils' -import { EthersStoreUtil, type Chain } from '@web3modal/scaffold-utils/ethers' +import { + EthersStoreUtil, + type Chain, + type EthersStoreUtilState +} from '@web3modal/scaffold-utils/ethers' import { getWeb3Modal } from '@web3modal/base/utils/library/react' import { useSnapshot } from 'valtio' import type { Eip1193Provider } from 'ethers' @@ -13,7 +17,7 @@ import type { Eip1193Provider } from 'ethers' export { defaultConfig } from '@web3modal/base/adapters/evm/ethers' // -- Setup ------------------------------------------------------------------- -let appkit: AppKit | undefined = undefined +let appkit: AppKit | undefined = undefined let ethersAdapter: EVMEthersClient | undefined = undefined export type EthersAppKitOptions = Omit< @@ -29,14 +33,14 @@ export function createWeb3Modal(options: EthersAppKitOptions) { chains: options.chains, defaultChain: options.defaultChain }) - appkit = new AppKit({ + appkit = new AppKit({ ...options, defaultChain: ethersAdapter.defaultChain, adapters: [ethersAdapter], sdkType: 'w3m', sdkVersion: `react-ethers-${ConstantsUtil.VERSION}` }) - getWeb3Modal(appkit) + getWeb3Modal(appkit) return appkit } diff --git a/packages/ethers/exports/vue.ts b/packages/ethers/exports/vue.ts index 05c3b79cbf..34a9a7841a 100644 --- a/packages/ethers/exports/vue.ts +++ b/packages/ethers/exports/vue.ts @@ -2,7 +2,7 @@ import { AppKit } from '@web3modal/base' import type { AppKitOptions } from '@web3modal/base' import { EVMEthersClient, type AdapterOptions } from '@web3modal/base/adapters/evm/ethers' import { ConstantsUtil } from '@web3modal/scaffold-utils' -import { type Chain } from '@web3modal/scaffold-utils/ethers' +import { type Chain, type EthersStoreUtilState } from '@web3modal/scaffold-utils/ethers' import { getWeb3Modal } from '@web3modal/base/utils/library/vue' import { onUnmounted, ref } from 'vue' import type { Eip1193Provider } from 'ethers' @@ -11,7 +11,7 @@ import type { Eip1193Provider } from 'ethers' export { defaultConfig } from '@web3modal/base/adapters/evm/ethers' // -- Setup ------------------------------------------------------------------- -let appkit: AppKit | undefined = undefined +let appkit: AppKit | undefined = undefined let ethersAdapter: EVMEthersClient | undefined = undefined type EthersAppKitOptions = Omit, 'adapters' | 'sdkType' | 'sdkVersion'> & @@ -24,7 +24,7 @@ export function createWeb3Modal(options: EthersAppKitOptions) { chains: options.chains, defaultChain: options.defaultChain }) - appkit = new AppKit({ + appkit = new AppKit({ ...options, defaultChain: ethersAdapter.defaultChain, adapters: [ethersAdapter], diff --git a/packages/ethers5/exports/index.ts b/packages/ethers5/exports/index.ts index 9d5e4a9849..44bd372b3b 100644 --- a/packages/ethers5/exports/index.ts +++ b/packages/ethers5/exports/index.ts @@ -2,13 +2,13 @@ import { AppKit } from '@web3modal/base' import type { AppKitOptions } from '@web3modal/base' import { EVMEthers5Client, type AdapterOptions } from '@web3modal/base/adapters/evm/ethers5' import { ConstantsUtil } from '@web3modal/scaffold-utils' -import { type Chain } from '@web3modal/scaffold-utils/ethers' +import { type Chain, type EthersStoreUtilState } from '@web3modal/scaffold-utils/ethers' // -- Types ------------------------------------------------------------- -export type { AdapterOptions } from '@web3modal/base/adapters/evm/ethers' +export type { AdapterOptions } from '@web3modal/base/adapters/evm/ethers5' // -- Configs ----------------------------------------------------------- -export { defaultConfig } from '@web3modal/base/adapters/evm/ethers' +export { defaultConfig } from '@web3modal/base/adapters/evm/ethers5' // -- Setup ------------------------------------------------------------- type EthersAppKitOptions = Omit, 'adapters' | 'sdkType' | 'sdkVersion'> & @@ -22,7 +22,7 @@ export function createWeb3Modal(options: EthersAppKitOptions) { defaultChain: options.defaultChain }) - return new AppKit({ + return new AppKit({ ...options, defaultChain: ethers5Adapter.defaultChain, adapters: [ethers5Adapter], diff --git a/packages/ethers5/exports/react.tsx b/packages/ethers5/exports/react.tsx index 572b173bff..8ab2c4e08b 100644 --- a/packages/ethers5/exports/react.tsx +++ b/packages/ethers5/exports/react.tsx @@ -4,17 +4,17 @@ import { AppKit } from '@web3modal/base' import type { AppKitOptions } from '@web3modal/base' import { EVMEthers5Client, type AdapterOptions } from '@web3modal/base/adapters/evm/ethers5' import { ConstantsUtil } from '@web3modal/scaffold-utils' -import { EthersStoreUtil } from '@web3modal/scaffold-utils/ethers' +import { EthersStoreUtil, type EthersStoreUtilState } from '@web3modal/scaffold-utils/ethers' import { getWeb3Modal } from '@web3modal/base/utils/library/react' import { useSnapshot } from 'valtio' import { ethers } from 'ethers' import { type Chain } from '@web3modal/scaffold-utils/ethers' // -- Configs ----------------------------------------------------------- -export { defaultConfig } from '@web3modal/base/adapters/evm/ethers' +export { defaultConfig } from '@web3modal/base/adapters/evm/ethers5' // -- Setup ------------------------------------------------------------------- -let appkit: AppKit | undefined = undefined +let appkit: AppKit | undefined = undefined let ethersAdapter: EVMEthers5Client | undefined = undefined export type Ethers5AppKitOptions = Omit< @@ -30,7 +30,7 @@ export function createWeb3Modal(options: Ethers5AppKitOptions) { chains: options.chains, defaultChain: options.defaultChain }) - appkit = new AppKit({ + appkit = new AppKit({ ...options, defaultChain: ethersAdapter.defaultChain, adapters: [ethersAdapter], diff --git a/packages/ethers5/exports/vue.ts b/packages/ethers5/exports/vue.ts index 27f9cab668..63520cc290 100644 --- a/packages/ethers5/exports/vue.ts +++ b/packages/ethers5/exports/vue.ts @@ -5,13 +5,13 @@ import { ConstantsUtil } from '@web3modal/scaffold-utils' import { getWeb3Modal } from '@web3modal/base/utils/library/vue' import { onUnmounted, ref } from 'vue' import { ethers } from 'ethers' -import { type Chain } from '@web3modal/scaffold-utils/ethers' +import { type Chain, type EthersStoreUtilState } from '@web3modal/scaffold-utils/ethers' // -- Configs ----------------------------------------------------------- -export { defaultConfig } from '@web3modal/base/adapters/evm/ethers' +export { defaultConfig } from '@web3modal/base/adapters/evm/ethers5' // -- Setup ------------------------------------------------------------------- -let appkit: AppKit | undefined = undefined +let appkit: AppKit | undefined = undefined let ethersAdapter: EVMEthers5Client | undefined = undefined type EthersAppKitOptions = Omit, 'adapters' | 'sdkType' | 'sdkVersion'> & @@ -24,7 +24,7 @@ export function createWeb3Modal(options: EthersAppKitOptions) { chains: options.chains, defaultChain: options.defaultChain }) - appkit = new AppKit({ + appkit = new AppKit({ ...options, defaultChain: ethersAdapter.defaultChain, adapters: [ethersAdapter], diff --git a/packages/solana/exports/react.tsx b/packages/solana/exports/react.tsx index b123e83590..8d2c9fca49 100644 --- a/packages/solana/exports/react.tsx +++ b/packages/solana/exports/react.tsx @@ -3,10 +3,14 @@ import { useSnapshot } from 'valtio' import { ConstantsUtil } from '@web3modal/scaffold-utils' import { getWeb3Modal } from '@web3modal/base/utils/library/react' -import { AppKit } from '@web3modal/base' +import { AppKit, type CaipNetwork } from '@web3modal/base' import { SolanaWeb3JsClient } from '@web3modal/base/adapters/solana/web3js' import { SolStoreUtil } from '@web3modal/scaffold-utils/solana' -import type { Connection, Provider } from '@web3modal/base/adapters/solana/web3js' +import type { + Connection, + Provider, + SolStoreUtilState +} from '@web3modal/base/adapters/solana/web3js' import type { SolanaAppKitOptions } from './options' // -- Configs ----------------------------------------------------------- @@ -16,7 +20,7 @@ export { defaultSolanaConfig } from '@web3modal/base/adapters/solana/web3js' export type { SolanaAppKitOptions, Provider } // -- Setup ------------------------------------------------------------- -let appkit: AppKit | undefined = undefined +let appkit: AppKit | undefined = undefined let solanaAdapter: SolanaWeb3JsClient | undefined = undefined export function createWeb3Modal(options: SolanaAppKitOptions) { @@ -27,7 +31,7 @@ export function createWeb3Modal(options: SolanaAppKitOptions) { projectId: options.projectId, defaultChain: options.defaultChain }) - appkit = new AppKit({ + appkit = new AppKit({ ...options, defaultChain: solanaAdapter.defaultChain, adapters: [solanaAdapter], diff --git a/packages/solana/exports/vue.ts b/packages/solana/exports/vue.ts index 9b13e8fe5d..d196dd2595 100644 --- a/packages/solana/exports/vue.ts +++ b/packages/solana/exports/vue.ts @@ -3,7 +3,7 @@ import { ConstantsUtil } from '@web3modal/scaffold-utils' import { getWeb3Modal } from '@web3modal/base/utils/library/vue' import { AppKit } from '@web3modal/base' import { SolanaWeb3JsClient } from '@web3modal/base/adapters/solana/web3js' -import { SolStoreUtil } from '@web3modal/scaffold-utils/solana' +import { SolStoreUtil, type SolStoreUtilState } from '@web3modal/scaffold-utils/solana' import type { Provider, Connection } from '@web3modal/base/adapters/solana/web3js' import type { CaipNetwork } from '@web3modal/core' import type { SolanaAppKitOptions } from './options' @@ -12,7 +12,7 @@ import type { SolanaAppKitOptions } from './options' export type { SolanaAppKitOptions, Provider } // -- Setup ------------------------------------------------------------------- -let appkit: AppKit | undefined = undefined +let appkit: AppKit | undefined = undefined let solanaAdapter: SolanaWeb3JsClient | undefined = undefined export function createWeb3Modal(options: SolanaAppKitOptions) { @@ -23,7 +23,7 @@ export function createWeb3Modal(options: SolanaAppKitOptions) { projectId: options.projectId, defaultChain: options.defaultChain }) - appkit = new AppKit({ + appkit = new AppKit({ ...options, defaultChain: solanaAdapter.defaultChain, adapters: [solanaAdapter], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7d5d927bd..ee430abe3b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -317,6 +317,19 @@ importers: specifier: 16.3.1 version: 16.3.1 + examples/html-ethers: + dependencies: + '@web3modal/ethers': + specifier: workspace:* + version: link:../../packages/ethers + ethers: + specifier: 6.13.0 + version: 6.13.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + devDependencies: + vite: + specifier: 5.2.11 + version: 5.2.11(@types/node@20.11.5)(terser@5.31.6) + examples/html-ethers5: dependencies: '@web3modal/ethers5': @@ -17296,7 +17309,7 @@ snapshots: '@scure/bip32@1.4.0': dependencies: - '@noble/curves': 1.4.0 + '@noble/curves': 1.4.2 '@noble/hashes': 1.4.0 '@scure/base': 1.1.7 @@ -22664,7 +22677,7 @@ snapshots: '@typescript-eslint/parser': 6.18.1(eslint@8.56.0)(typescript@5.3.3) eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.56.0))(eslint@8.56.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0) eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.56.0) eslint-plugin-jsx-a11y: 6.9.0(eslint@8.56.0) eslint-plugin-react: 7.35.0(eslint@8.56.0) @@ -22683,8 +22696,8 @@ snapshots: '@typescript-eslint/parser': 6.18.1(eslint@8.57.0)(typescript@5.3.3) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0))(eslint@8.57.0) - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0) eslint-plugin-jsx-a11y: 6.9.0(eslint@8.57.0) eslint-plugin-react: 7.35.0(eslint@8.57.0) eslint-plugin-react-hooks: 4.6.2(eslint@8.57.0) @@ -22707,13 +22720,13 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.56.0))(eslint@8.56.0): + eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.3.6 enhanced-resolve: 5.17.1 eslint: 8.56.0 - eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.56.0))(eslint@8.56.0))(eslint@8.56.0) + eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0))(eslint@8.56.0) fast-glob: 3.3.2 get-tsconfig: 4.7.6 is-bun-module: 1.1.0 @@ -22726,44 +22739,54 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0))(eslint@8.57.0): + eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.3.6 enhanced-resolve: 5.17.1 eslint: 8.57.0 - eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) + eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0) fast-glob: 3.3.2 get-tsconfig: 4.7.6 is-bun-module: 1.1.0 is-glob: 4.0.3 optionalDependencies: - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0) transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.56.0))(eslint@8.56.0))(eslint@8.56.0): + eslint-module-utils@2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0))(eslint@8.56.0): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 6.18.1(eslint@8.56.0)(typescript@5.3.3) eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.56.0))(eslint@8.56.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0) transitivePeerDependencies: - supports-color - eslint-module-utils@2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0): + eslint-module-utils@2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): + dependencies: + debug: 3.2.7 + optionalDependencies: + '@typescript-eslint/parser': 6.18.1(eslint@8.56.0)(typescript@5.3.3) + eslint: 8.57.0 + eslint-import-resolver-node: 0.3.9 + transitivePeerDependencies: + - supports-color + + eslint-module-utils@2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 6.18.1(eslint@8.57.0)(typescript@5.3.3) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0))(eslint@8.57.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0) transitivePeerDependencies: - supports-color @@ -22777,7 +22800,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.56.0))(eslint@8.56.0))(eslint@8.56.0) + eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0))(eslint@8.56.0) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -22794,7 +22817,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0): + eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0): dependencies: array-includes: 3.1.8 array.prototype.findlastindex: 1.2.5 @@ -22804,7 +22827,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.18.1(eslint@8.57.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) + eslint-module-utils: 2.8.2(@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -22815,7 +22838,7 @@ snapshots: semver: 6.3.1 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 6.18.1(eslint@8.57.0)(typescript@5.3.3) + '@typescript-eslint/parser': 6.18.1(eslint@8.56.0)(typescript@5.3.3) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -28009,7 +28032,7 @@ snapshots: webauthn-p256@0.0.5: dependencies: - '@noble/curves': 1.4.0 + '@noble/curves': 1.5.0 '@noble/hashes': 1.4.0 webextension-polyfill@0.10.0: {} From dea32cfa7f576d9a16ec5337b11c6d0f365a2339 Mon Sep 17 00:00:00 2001 From: Enes Date: Tue, 3 Sep 2024 19:58:40 +0300 Subject: [PATCH 13/17] fix: logics to set default chain (#2787) --- examples/react-ethers5/src/App.tsx | 1 + examples/react-solana/src/App.tsx | 1 + examples/react-wagmi/src/App.tsx | 5 +-- packages/base/adapters/evm/ethers/client.ts | 9 +++--- packages/base/adapters/evm/ethers5/client.ts | 9 +++--- packages/base/adapters/evm/wagmi/client.ts | 1 + .../base/adapters/solana/web3js/client.ts | 32 +++++++++++-------- .../core/src/controllers/NetworkController.ts | 4 +++ .../src/modal/w3m-account-button/index.ts | 12 +++++-- .../src/modal/w3m-network-button/index.ts | 15 +++++++-- .../src/ethers/EthersHelpersUtil.ts | 4 ++- .../src/solana/SolanaHelpersUtils.ts | 2 ++ 12 files changed, 67 insertions(+), 28 deletions(-) diff --git a/examples/react-ethers5/src/App.tsx b/examples/react-ethers5/src/App.tsx index bc79c788c2..85eec94819 100644 --- a/examples/react-ethers5/src/App.tsx +++ b/examples/react-ethers5/src/App.tsx @@ -49,6 +49,7 @@ const ethersConfig = defaultConfig({ createWeb3Modal({ ethersConfig, chains, + defaultChain: chains[1], projectId, enableAnalytics: true, themeMode: 'light', diff --git a/examples/react-solana/src/App.tsx b/examples/react-solana/src/App.tsx index 201cd2739c..3677e4754f 100644 --- a/examples/react-solana/src/App.tsx +++ b/examples/react-solana/src/App.tsx @@ -60,6 +60,7 @@ createWeb3Modal({ solanaConfig, projectId, themeMode: 'light', + defaultChain: chains[2], chains, wallets: [ new HuobiWalletAdapter(), diff --git a/examples/react-wagmi/src/App.tsx b/examples/react-wagmi/src/App.tsx index c85465628a..be57ef6a8a 100644 --- a/examples/react-wagmi/src/App.tsx +++ b/examples/react-wagmi/src/App.tsx @@ -7,7 +7,7 @@ import { useWeb3ModalTheme } from '@web3modal/wagmi/react' import { WagmiProvider } from 'wagmi' -import { arbitrum, mainnet } from 'wagmi/chains' +import { arbitrum, mainnet, polygon } from 'wagmi/chains' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiHooks } from './WagmiHooks' @@ -22,7 +22,7 @@ if (!projectId) { // 2. Create wagmiConfig const wagmiConfig = defaultWagmiConfig({ - chains: [mainnet, arbitrum], + chains: [mainnet, polygon, arbitrum], projectId, metadata: { name: 'AppKit', @@ -36,6 +36,7 @@ const wagmiConfig = defaultWagmiConfig({ createWeb3Modal({ wagmiConfig, projectId, + defaultChain: polygon, themeMode: 'light', themeVariables: { '--w3m-color-mix': '#00DCFF', diff --git a/packages/base/adapters/evm/ethers/client.ts b/packages/base/adapters/evm/ethers/client.ts index 11e2832380..8fd0f46236 100644 --- a/packages/base/adapters/evm/ethers/client.ts +++ b/packages/base/adapters/evm/ethers/client.ts @@ -149,10 +149,7 @@ export class EVMEthersClient implements ChainAdapter { diff --git a/packages/base/adapters/evm/ethers5/client.ts b/packages/base/adapters/evm/ethers5/client.ts index efe92182e8..a71d7a83f5 100644 --- a/packages/base/adapters/evm/ethers5/client.ts +++ b/packages/base/adapters/evm/ethers5/client.ts @@ -130,10 +130,7 @@ export class EVMEthers5Client implements ChainAdapter { diff --git a/packages/base/adapters/evm/wagmi/client.ts b/packages/base/adapters/evm/wagmi/client.ts index 2bae0c67b4..7df9f6531b 100644 --- a/packages/base/adapters/evm/wagmi/client.ts +++ b/packages/base/adapters/evm/wagmi/client.ts @@ -551,6 +551,7 @@ export class EVMWagmiClient implements ChainAdapter { this.appKit?.setProfileName(null, this.chain) } } + private async syncProfile(address: Hex, chainId: Chain['id']) { if (!this.appKit) { throw new Error('syncProfile - appKit is undefined') diff --git a/packages/base/adapters/solana/web3js/client.ts b/packages/base/adapters/solana/web3js/client.ts index 91ddf0e0bf..12dfbfc8bc 100644 --- a/packages/base/adapters/solana/web3js/client.ts +++ b/packages/base/adapters/solana/web3js/client.ts @@ -88,8 +88,10 @@ export class SolanaWeb3JsClient implements ChainAdapter c.chainId === defaultChain?.chainId) + this.networkControllerClient = { switchCaipNetwork: async caipNetwork => { if (caipNetwork) { @@ -220,21 +230,17 @@ export class SolanaWeb3JsClient implements ChainAdapter { this.syncAccount() diff --git a/packages/core/src/controllers/NetworkController.ts b/packages/core/src/controllers/NetworkController.ts index 30f9e24009..d86447b555 100644 --- a/packages/core/src/controllers/NetworkController.ts +++ b/packages/core/src/controllers/NetworkController.ts @@ -258,6 +258,10 @@ export const NetworkController = { const requestedCaipNetworks = this.getRequestedCaipNetworks() + if (!requestedCaipNetworks.length) { + return true + } + return requestedCaipNetworks?.some(network => network.id === activeCaipNetwork?.id) }, diff --git a/packages/scaffold-ui/src/modal/w3m-account-button/index.ts b/packages/scaffold-ui/src/modal/w3m-account-button/index.ts index e13fa115be..7efb78b212 100644 --- a/packages/scaffold-ui/src/modal/w3m-account-button/index.ts +++ b/packages/scaffold-ui/src/modal/w3m-account-button/index.ts @@ -1,5 +1,6 @@ import { AccountController, + AssetController, AssetUtil, CoreHelperUtil, ModalController, @@ -38,6 +39,8 @@ export class W3mAccountButton extends LitElement { @state() private network = NetworkController.state.caipNetwork + @state() private networkImage = this.network ? AssetUtil.getNetworkImage(this.network) : undefined + @state() private isUnsupportedChain = NetworkController.state.isUnsupportedChain // -- Lifecycle ----------------------------------------- // @@ -45,6 +48,11 @@ export class W3mAccountButton extends LitElement { super() this.unsubscribe.push( ...[ + AssetController.subscribeNetworkImages(() => { + this.networkImage = this.network?.imageId + ? AssetUtil.getNetworkImage(this.network) + : undefined + }), AccountController.subscribe(val => { if (val.isConnected) { this.address = val.address @@ -62,6 +70,7 @@ export class W3mAccountButton extends LitElement { }), NetworkController.subscribeKey('caipNetwork', val => { this.network = val + this.networkImage = val?.imageId ? AssetUtil.getNetworkImage(val) : undefined }), NetworkController.subscribeKey('isUnsupportedChain', val => { this.isUnsupportedChain = val @@ -76,7 +85,6 @@ export class W3mAccountButton extends LitElement { // -- Render -------------------------------------------- // public override render() { - const networkImage = AssetUtil.getNetworkImage(this.network) const showBalance = this.balance === 'show' return html` @@ -85,7 +93,7 @@ export class W3mAccountButton extends LitElement { .isUnsupportedChain=${this.isUnsupportedChain} address=${ifDefined(this.address)} profileName=${ifDefined(this.profileName)} - networkSrc=${ifDefined(networkImage)} + networkSrc=${ifDefined(this.networkImage)} avatarSrc=${ifDefined(this.profileImage)} balance=${showBalance ? CoreHelperUtil.formatBalance(this.balanceVal, this.balanceSymbol) diff --git a/packages/scaffold-ui/src/modal/w3m-network-button/index.ts b/packages/scaffold-ui/src/modal/w3m-network-button/index.ts index 230c661813..540bdbbb6a 100644 --- a/packages/scaffold-ui/src/modal/w3m-network-button/index.ts +++ b/packages/scaffold-ui/src/modal/w3m-network-button/index.ts @@ -1,5 +1,6 @@ import { AccountController, + AssetController, AssetUtil, EventsController, ModalController, @@ -26,6 +27,8 @@ export class W3mNetworkButton extends LitElement { @state() private network = NetworkController.state.caipNetwork + @state() private networkImage = this.network ? AssetUtil.getNetworkImage(this.network) : undefined + @state() private connected = AccountController.state.isConnected @state() private loading = ModalController.state.loading @@ -36,7 +39,15 @@ export class W3mNetworkButton extends LitElement { public override firstUpdated() { this.unsubscribe.push( ...[ - NetworkController.subscribeKey('caipNetwork', val => (this.network = val)), + AssetController.subscribeNetworkImages(() => { + this.networkImage = this.network?.imageId + ? AssetUtil.getNetworkImage(this.network) + : undefined + }), + NetworkController.subscribeKey('caipNetwork', val => { + this.network = val + this.networkImage = val?.imageId ? AssetUtil.getNetworkImage(val) : undefined + }), AccountController.subscribeKey('isConnected', val => (this.connected = val)), ModalController.subscribeKey('loading', val => (this.loading = val)), NetworkController.subscribeKey('isUnsupportedChain', val => (this.isUnsupportedChain = val)) @@ -55,7 +66,7 @@ export class W3mNetworkButton extends LitElement { data-testid="wui-network-button" .disabled=${Boolean(this.disabled || this.loading)} .isUnsupportedChain=${this.isUnsupportedChain} - imageSrc=${ifDefined(AssetUtil.getNetworkImage(this.network))} + imageSrc=${ifDefined(this.networkImage)} @click=${this.onClick.bind(this)} > ${this.getLabel()} diff --git a/packages/scaffold-utils/src/ethers/EthersHelpersUtil.ts b/packages/scaffold-utils/src/ethers/EthersHelpersUtil.ts index 9b0e84015d..d01cbd4826 100644 --- a/packages/scaffold-utils/src/ethers/EthersHelpersUtil.ts +++ b/packages/scaffold-utils/src/ethers/EthersHelpersUtil.ts @@ -1,3 +1,4 @@ +import { ConstantsUtil as CommonConstantsUtil } from '@web3modal/common' import type { CaipNetwork } from '@web3modal/core' import { ConstantsUtil } from '../ConstantsUtil.js' import { PresetsUtil } from '../PresetsUtil.js' @@ -12,7 +13,8 @@ export const EthersHelpersUtil = { return { id: `${ConstantsUtil.EIP155}:${chain.chainId}`, name: chain.name, - imageId: PresetsUtil.EIP155NetworkImageIds[chain.chainId] + imageId: PresetsUtil.EIP155NetworkImageIds[chain.chainId], + chain: CommonConstantsUtil.CHAIN.EVM } as CaipNetwork }, hexStringToNumber(value: string) { diff --git a/packages/scaffold-utils/src/solana/SolanaHelpersUtils.ts b/packages/scaffold-utils/src/solana/SolanaHelpersUtils.ts index d8dfe17c2c..6a6c6ecf99 100644 --- a/packages/scaffold-utils/src/solana/SolanaHelpersUtils.ts +++ b/packages/scaffold-utils/src/solana/SolanaHelpersUtils.ts @@ -34,6 +34,7 @@ export const SolHelpersUtil = { return { ...selectedChain, id: `solana:${chainId}`, + chainId, imageId: PresetsUtil.EIP155NetworkImageIds[chainId], chain: CommonConstantsUtil.CHAIN.SOLANA } as const @@ -42,6 +43,7 @@ export const SolHelpersUtil = { return { ...SolConstantsUtil.DEFAULT_CHAIN, id: `solana:${chainId}`, + chainId, imageId: PresetsUtil.EIP155NetworkImageIds[chainId], chain: CommonConstantsUtil.CHAIN.SOLANA } as const From 13cb0ffabae838b577d1b8dc457b359a68d0764e Mon Sep 17 00:00:00 2001 From: Karandeep Singh <90941366+KannuSingh@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:28:03 -0400 Subject: [PATCH 14/17] Implement actions using userOpBuilder service instead of permissionless.js (#2758) --- apps/laboratory/next.config.mjs | 2 +- apps/laboratory/package.json | 1 - .../Wagmi/WagmiCreatePasskeySignerTest.tsx | 8 +- ...WagmiPurchaseDonutAsyncPermissionsTest.tsx | 36 +- .../WagmiPurchaseDonutSyncPermissionsTest.tsx | 29 +- .../WagmiRequestPermissionsAsyncTest.tsx | 160 +- .../Wagmi/WagmiRequestPermissionsSyncTest.tsx | 183 +- .../src/context/ERC7715PermissionsContext.tsx | 69 + .../src/context/LocalEcdsaKeyContext.tsx | 72 + .../laboratory/src/context/PasskeyContext.tsx | 73 + .../context/WagmiPermissionsAsyncContext.tsx | 112 - .../context/WagmiPermissionsSyncContext.tsx | 112 - .../src/hooks/useERC7715Permissions.ts | 108 + .../src/hooks/useERC7715PermissionsAsync.ts | 137 - .../src/hooks/useERC7715PermissionsSync.ts | 158 - .../src/hooks/useLocalStorageState.ts | 6 +- apps/laboratory/src/hooks/useUserOpBuilder.ts | 312 - .../src/hooks/useWagmiActiveCapabilities.ts | 12 +- .../src/hooks/useWalletConnectCosigner.ts | 197 - apps/laboratory/src/layout/CustomWallet.tsx | 3 +- .../pages/library/wagmi-permissions-async.tsx | 13 +- .../pages/library/wagmi-permissions-sync.tsx | 13 +- apps/laboratory/src/utils/ConstantsUtil.ts | 7 +- apps/laboratory/src/utils/ERC7715Utils.ts | 220 +- apps/laboratory/src/utils/EncodingUtils.ts | 43 + apps/laboratory/src/utils/LocalStorage.ts | 30 +- apps/laboratory/src/utils/PermissionsUtils.ts | 67 - .../src/utils/UserOpBuilderServiceUtils.ts | 141 + .../src/utils/WalletConnectCosignerUtils.ts | 177 + pnpm-lock.yaml | 28272 +++++++--------- 30 files changed, 13237 insertions(+), 17536 deletions(-) create mode 100644 apps/laboratory/src/context/ERC7715PermissionsContext.tsx create mode 100644 apps/laboratory/src/context/LocalEcdsaKeyContext.tsx create mode 100644 apps/laboratory/src/context/PasskeyContext.tsx delete mode 100644 apps/laboratory/src/context/WagmiPermissionsAsyncContext.tsx delete mode 100644 apps/laboratory/src/context/WagmiPermissionsSyncContext.tsx create mode 100644 apps/laboratory/src/hooks/useERC7715Permissions.ts delete mode 100644 apps/laboratory/src/hooks/useERC7715PermissionsAsync.ts delete mode 100644 apps/laboratory/src/hooks/useERC7715PermissionsSync.ts delete mode 100644 apps/laboratory/src/hooks/useUserOpBuilder.ts delete mode 100644 apps/laboratory/src/hooks/useWalletConnectCosigner.ts delete mode 100644 apps/laboratory/src/utils/PermissionsUtils.ts create mode 100644 apps/laboratory/src/utils/UserOpBuilderServiceUtils.ts create mode 100644 apps/laboratory/src/utils/WalletConnectCosignerUtils.ts diff --git a/apps/laboratory/next.config.mjs b/apps/laboratory/next.config.mjs index 04353ea4ea..aef6cc3eb9 100644 --- a/apps/laboratory/next.config.mjs +++ b/apps/laboratory/next.config.mjs @@ -11,7 +11,7 @@ const cspHeader = ` style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src * 'self' data: blob: https://walletconnect.org https://walletconnect.com https://secure.walletconnect.com https://secure.walletconnect.org https://tokens-data.1inch.io https://tokens.1inch.io https://ipfs.io https://lab.web3modal.com; font-src 'self' https://fonts.gstatic.com; - connect-src 'self' https://rpc.walletconnect.com https://rpc.walletconnect.org https://relay.walletconnect.com https://relay.walletconnect.org wss://relay.walletconnect.com wss://relay.walletconnect.org https://pulse.walletconnect.com https://pulse.walletconnect.org https://api.web3modal.com https://api.web3modal.org wss://www.walletlink.org https://o1095249.ingest.sentry.io; + connect-src 'self' https://react-wallet.walletconnect.com https://rpc.walletconnect.com https://rpc.walletconnect.org https://relay.walletconnect.com https://relay.walletconnect.org wss://relay.walletconnect.com wss://relay.walletconnect.org https://pulse.walletconnect.com https://pulse.walletconnect.org https://api.web3modal.com https://api.web3modal.org wss://www.walletlink.org https://o1095249.ingest.sentry.io; frame-src 'self' https://verify.walletconnect.com https://verify.walletconnect.org https://secure.walletconnect.com https://secure.walletconnect.org; object-src 'none'; base-uri 'self'; diff --git a/apps/laboratory/package.json b/apps/laboratory/package.json index f3b253a383..255934ad6e 100644 --- a/apps/laboratory/package.json +++ b/apps/laboratory/package.json @@ -66,7 +66,6 @@ "framer-motion": "10.17.9", "next": "14.2.3", "next-auth": "4.24.5", - "permissionless": "0.1.31", "react": "18.2.0", "react-dom": "18.2.0", "react-icons": "4.12.0", diff --git a/apps/laboratory/src/components/Wagmi/WagmiCreatePasskeySignerTest.tsx b/apps/laboratory/src/components/Wagmi/WagmiCreatePasskeySignerTest.tsx index 2927920823..9f6e64ec6d 100644 --- a/apps/laboratory/src/components/Wagmi/WagmiCreatePasskeySignerTest.tsx +++ b/apps/laboratory/src/components/Wagmi/WagmiCreatePasskeySignerTest.tsx @@ -2,12 +2,12 @@ import { useEffect } from 'react' import { Button, Stack } from '@chakra-ui/react' import { privateKeyToAccount } from 'viem/accounts' import { useChakraToast } from '../Toast' -import { LOCAL_SIGNER_KEY, getItem } from '../../utils/LocalStorage' +import { LOCAL_SIGNER_KEY, getLocalStorageItem } from '../../utils/LocalStorage' import { createCredential } from 'webauthn-p256' -import { useWagmiPermissionsSync } from '../../context/WagmiPermissionsSyncContext' +import { usePasskey } from '../../context/PasskeyContext' export function WagmiCreatePasskeySignerTest() { - const { isPasskeyAvailable, setPasskey, passkeyId } = useWagmiPermissionsSync() + const { isPasskeyAvailable, setPasskey, passkeyId } = usePasskey() const toast = useChakraToast() async function handleCreatePasskey() { @@ -31,7 +31,7 @@ export function WagmiCreatePasskeySignerTest() { } useEffect(() => { - const storedLocalSignerPrivateKey = getItem(LOCAL_SIGNER_KEY) + const storedLocalSignerPrivateKey = getLocalStorageItem(LOCAL_SIGNER_KEY) if (storedLocalSignerPrivateKey) { privateKeyToAccount(storedLocalSignerPrivateKey as `0x${string}`) } diff --git a/apps/laboratory/src/components/Wagmi/WagmiPurchaseDonutAsyncPermissionsTest.tsx b/apps/laboratory/src/components/Wagmi/WagmiPurchaseDonutAsyncPermissionsTest.tsx index 3b7ff7dd20..fb26dc97f0 100644 --- a/apps/laboratory/src/components/Wagmi/WagmiPurchaseDonutAsyncPermissionsTest.tsx +++ b/apps/laboratory/src/components/Wagmi/WagmiPurchaseDonutAsyncPermissionsTest.tsx @@ -5,17 +5,14 @@ import { useChakraToast } from '../Toast' import { encodeFunctionData, parseEther } from 'viem' import { abi as donutContractAbi, address as donutContractaddress } from '../../utils/DonutContract' import { sepolia } from 'viem/chains' -import { useWagmiPermissionsAsync } from '../../context/WagmiPermissionsAsyncContext' -import { useERC7715PermissionsAsync } from '../../hooks/useERC7715PermissionsAsync' +import { useLocalEcdsaKey } from '../../context/LocalEcdsaKeyContext' +import { useERC7715Permissions } from '../../hooks/useERC7715Permissions' +import { executeActionsWithECDSAAndCosignerPermissions } from '../../utils/ERC7715Utils' export function WagmiPurchaseDonutAsyncPermissionsTest() { - const { grantedPermissions, wcCosignerData, privateKey, projectId } = useWagmiPermissionsAsync() + const { privateKey } = useLocalEcdsaKey() - const { executeActionsWithECDSAAndCosignerPermissions } = useERC7715PermissionsAsync({ - chain: sepolia, - permissions: grantedPermissions, - projectId - }) + const { grantedPermissions, pci } = useERC7715Permissions() const { data: donutsOwned, @@ -35,13 +32,15 @@ export function WagmiPurchaseDonutAsyncPermissionsTest() { async function onPurchaseDonutWithPermissions() { setTransactionPending(true) try { - if (!wcCosignerData) { - throw Error('No wc-cosigner data available') - } - if (!privateKey) { throw new Error(`Unable to get dApp private key`) } + if (!grantedPermissions) { + throw Error('No permissions available') + } + if (!pci) { + throw Error('No WC cosigner data(PCI) available') + } const purchaseDonutCallData = encodeFunctionData({ abi: donutContractAbi, functionName: 'purchase', @@ -49,26 +48,27 @@ export function WagmiPurchaseDonutAsyncPermissionsTest() { }) const purchaseDonutCallDataExecution = [ { - target: donutContractaddress as `0x${string}`, + to: donutContractaddress as `0x${string}`, value: parseEther('0.0001'), - callData: purchaseDonutCallData + data: purchaseDonutCallData } ] const txHash = await executeActionsWithECDSAAndCosignerPermissions({ actions: purchaseDonutCallDataExecution, chain: sepolia, - ecdsaPrivateKey: privateKey as `0x${string}` + ecdsaPrivateKey: privateKey as `0x${string}`, + permissions: grantedPermissions, + pci }) if (txHash) { toast({ - title: 'Transaction success', - description: txHash, + title: 'UserOp submitted successfully', + description: `UserOp Hash: ${txHash}`, type: 'success' }) await fetchDonutsOwned() } } catch (error) { - // Console.log(error) toast({ title: 'Transaction Failed', description: `${error}`, diff --git a/apps/laboratory/src/components/Wagmi/WagmiPurchaseDonutSyncPermissionsTest.tsx b/apps/laboratory/src/components/Wagmi/WagmiPurchaseDonutSyncPermissionsTest.tsx index d97f8f6d60..5ec66a05e0 100644 --- a/apps/laboratory/src/components/Wagmi/WagmiPurchaseDonutSyncPermissionsTest.tsx +++ b/apps/laboratory/src/components/Wagmi/WagmiPurchaseDonutSyncPermissionsTest.tsx @@ -4,17 +4,14 @@ import { useState } from 'react' import { useChakraToast } from '../Toast' import { encodeFunctionData, parseEther } from 'viem' import { abi as donutContractAbi, address as donutContractaddress } from '../../utils/DonutContract' -import { useERC7715PermissionsSync } from '../../hooks/useERC7715PermissionsSync' -import { useWagmiPermissionsSync } from '../../context/WagmiPermissionsSyncContext' +import { useERC7715Permissions } from '../../hooks/useERC7715Permissions' +import { usePasskey } from '../../context/PasskeyContext' import { sepolia } from 'viem/chains' +import { executeActionsWithPasskeyAndCosignerPermissions } from '../../utils/ERC7715Utils' export function WagmiPurchaseDonutSyncPermissionsTest() { - const { grantedPermissions, wcCosignerData, passkeyId, projectId } = useWagmiPermissionsSync() - const { executeActionsWithPasskeyAndCosignerPermissions } = useERC7715PermissionsSync({ - chain: sepolia, - permissions: grantedPermissions, - projectId - }) + const { passkeyId } = usePasskey() + const { grantedPermissions, pci } = useERC7715Permissions() const { data: donutsOwned, @@ -37,8 +34,8 @@ export function WagmiPurchaseDonutSyncPermissionsTest() { if (!grantedPermissions) { throw Error('No permissions available') } - if (!wcCosignerData) { - throw Error('No wc-cosigner data available') + if (!pci) { + throw Error('No WC cosigner data(PCI) available') } const purchaseDonutCallData = encodeFunctionData({ @@ -48,20 +45,22 @@ export function WagmiPurchaseDonutSyncPermissionsTest() { }) const purchaseDonutCallDataExecution = [ { - target: donutContractaddress as `0x${string}`, + to: donutContractaddress as `0x${string}`, value: parseEther('0.0001'), - callData: purchaseDonutCallData + data: purchaseDonutCallData } ] const txHash = await executeActionsWithPasskeyAndCosignerPermissions({ actions: purchaseDonutCallDataExecution, + chain: sepolia, passkeyId, - wcCosignerData + permissions: grantedPermissions, + pci }) if (txHash) { toast({ - title: 'Transaction success', - description: txHash, + title: 'UserOp submitted successfully', + description: `UserOp Hash: ${txHash}`, type: 'success' }) await fetchDonutsOwned() diff --git a/apps/laboratory/src/components/Wagmi/WagmiRequestPermissionsAsyncTest.tsx b/apps/laboratory/src/components/Wagmi/WagmiRequestPermissionsAsyncTest.tsx index 2eb7919111..12db6bf0cb 100644 --- a/apps/laboratory/src/components/Wagmi/WagmiRequestPermissionsAsyncTest.tsx +++ b/apps/laboratory/src/components/Wagmi/WagmiRequestPermissionsAsyncTest.tsx @@ -3,134 +3,102 @@ import { useAccount } from 'wagmi' import { walletActionsErc7715 } from 'viem/experimental' import { useCallback, useState } from 'react' import { useChakraToast } from '../Toast' -import { createPublicClient, custom } from 'viem' +import { createWalletClient, custom, type Address, type Chain } from 'viem' import { EIP_7715_RPC_METHODS } from '../../utils/EIP5792Utils' -import { useWalletConnectCosigner } from '../../hooks/useWalletConnectCosigner' -import { useWagmiAvailableCapabilities } from '../../hooks/useWagmiActiveCapabilities' -import { useWagmiPermissionsAsync } from '../../context/WagmiPermissionsAsyncContext' import { - decodeUncompressedPublicKey, - encodePublicKeyToDID, - hexStringToBase64 -} from '../../utils/EncodingUtils' + useWagmiAvailableCapabilities, + type Provider +} from '../../hooks/useWagmiActiveCapabilities' +import { useLocalEcdsaKey } from '../../context/LocalEcdsaKeyContext' import { bigIntReplacer } from '../../utils/CommonUtils' -import { getSampleAsyncPermissions } from '../../utils/ERC7715Utils' +import { useERC7715Permissions } from '../../hooks/useERC7715Permissions' +import { getPurchaseDonutPermissions } from '../../utils/ERC7715Utils' +import { KeyTypes } from '../../utils/EncodingUtils' export function WagmiRequestPermissionsAsyncTest() { const { provider, supported } = useWagmiAvailableCapabilities({ method: EIP_7715_RPC_METHODS.WALLET_GRANT_PERMISSIONS }) const { chain, address, isConnected } = useAccount() - const caip10Address = `eip155:${chain?.id}:${address}` - const { - projectId, - signer, - grantedPermissions, - clearGrantedPermissions, - setGrantedPermissions, - setWCCosignerData - } = useWagmiPermissionsAsync() + if (!isConnected || !provider || !address || !chain) { + return ( + + Wallet not connected + + ) + } + if (!supported) { + return ( + + Wallet does not support wallet_grantPermissions rpc method + + ) + } + + return +} + +function ConnectedTestContent({ + chain, + provider, + address +}: { + chain: Chain + provider: Provider + address: Address +}) { + const { grantedPermissions, clearGrantedPermissions, grantPermissions } = useERC7715Permissions() + const { signer } = useLocalEcdsaKey() const [isRequestPermissionLoading, setRequestPermissionLoading] = useState(false) - const { addPermission, updatePermissionsContext } = useWalletConnectCosigner( - caip10Address, - projectId - ) const toast = useChakraToast() const onRequestPermissions = useCallback(async () => { setRequestPermissionLoading(true) - - if (!signer) { - throw new Error('PrivateKey signer not available') - } - if (!provider) { - throw new Error('No Provider available, Please connect your wallet.') - } try { - const addPermissionResponse = await addPermission({ - permissionType: 'donut-purchase', - data: '', - onChainValidated: false, - required: true - }) - setWCCosignerData(addPermissionResponse) - const cosignerPublicKey = decodeUncompressedPublicKey(addPermissionResponse.key) - - const dAppECDSAPublicKey = signer.publicKey - const dAppSecp256k1DID = encodePublicKeyToDID(dAppECDSAPublicKey, 'secp256k1') - const coSignerSecp256k1DID = encodePublicKeyToDID(cosignerPublicKey, 'secp256k1') + if (!signer) { + throw new Error('PrivateKey signer not available') + } + if (!provider) { + throw new Error('No Provider available, Please connect your wallet.') + } - const publicClient = createPublicClient({ + const walletClient = createWalletClient({ + account: address, chain, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion transport: custom(provider) }).extend(walletActionsErc7715()) - const samplePermissions = getSampleAsyncPermissions([coSignerSecp256k1DID, dAppSecp256k1DID]) - const approvedPermissions = await publicClient.grantPermissions(samplePermissions) - if (approvedPermissions) { - await updatePermissionsContext({ - pci: addPermissionResponse.pci, - context: { - expiry: approvedPermissions.expiry, - signer: { - type: 'donut-purchase', - data: { - ids: [addPermissionResponse.key, hexStringToBase64(dAppECDSAPublicKey)] - } - }, - signerData: { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain - userOpBuilder: approvedPermissions.signerData?.userOpBuilder! - }, - permissionsContext: approvedPermissions.permissionsContext, - factory: approvedPermissions.factory || '', - factoryData: approvedPermissions.factoryData || '' - } - }) - setGrantedPermissions(approvedPermissions) - setRequestPermissionLoading(false) - toast({ - type: 'success', - title: 'Permissions Granted', - description: JSON.stringify(approvedPermissions, bigIntReplacer) - }) - return - } - toast({ title: 'Error', description: 'Failed to obtain permissions' }) + const purchaseDonutPermissions = getPurchaseDonutPermissions() + const response = await grantPermissions(walletClient, { + permissions: purchaseDonutPermissions, + signerKey: { + key: signer.publicKey, + type: KeyTypes.secp256k1 + } + }) + toast({ + type: 'success', + title: 'Permissions Granted', + description: JSON.stringify(response.approvedPermissions, bigIntReplacer) + }) } catch (error) { toast({ type: 'error', - title: 'Permissions Erros', - description: error instanceof Error ? error.message : 'Some error occurred' + title: 'Request Permissions Errors', + description: error instanceof Error ? error.message : 'Unknown Error' }) + } finally { + setRequestPermissionLoading(false) } - setRequestPermissionLoading(false) - }, [signer, provider]) - if (!isConnected || !provider || !address) { - return ( - - Wallet not connected - - ) - } - if (!supported) { - return ( - - Wallet does not support wallet_grantPermissions rpc method - - ) - } + }, [signer, provider, address, chain, grantPermissions, toast]) return (