Closed matteoberla closed 3 weeks ago
Can you share your pubspec.yaml?
for sure
name: wallet_connect
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
environment:
sdk: '>=3.3.3 <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.6
web3modal_flutter: ^3.1.2
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^3.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
This is weird. If you open pubspec.lock
what do you see under web3modal_flutter:
?
web3modal_flutter:
dependency: "direct main"
description:
name: web3modal_flutter
sha256: "73d007ad95919cecc108216e5b1a971fd3e1d50d6da8a7b9e2c96948eefc5c4b"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
Even more weird. We have the exact same dependency. Please try the following:
Delete everything under these folders:
/Users/{username}/.pub-cache/hosted-hashes/pub.dev/
/Users/{username}/.pub-cache/hosted/pub.dev/
/Users/{username}/.pub-cache/git/
/Users/{username}/.pub-cache/git/cache/
Then inside your project do:
flutter clean
flutter pub get -v
i've done it but nothing changed. I'm trying to run it on web even if the package is not supported as i wanted to test the version from issue #108, but error occurs. I remember that i've tried this package some times ago, another error occurred while testing on web, but this time compiling fails.
Oh man you should have said that. 😅 Web3Modal does not support web yet. You can follow up in that thread/issue if you want but I can't be of help for web right now.
Yes i've followed but same issue happens on the other version. I'm sure that some time ago i've used this package on web, the application was compiling correctly and there was another error when i was trying to use the connect wallet widget. so i'm a little confused on how to proceed
I can't help, Web3Modal has never supported web platforms, maybe you tried WalletConnectModalFlutter that it's a bit more simpler and my be running better in the web.
You need to use web3modal_flutter
package version that depends on walletconnect_flutter_v2
of a version below 2.2.3
, in 2.2.3 they broke something so it doesn't launch in Web anymore.
You can use my fork if you wish, I fixed some other UI issue in Web there:
web3modal_flutter:
git:
url: https://github.com/asmodeoux/Web3ModalFlutter.git
ref: ptal
@asmodeoux I was trying your version but same error occurred, so I've tried the official version but same happened. Can you help me with this? Does your version work fine on web?
@asmodeoux I was trying your version but same error occurred, so I've tried the official version but same happened. Can you help me with this? Does your version work fine on web?
yes, you probably forgot to run flutter clean && flutter pub upgrade
to refresh the packages after adding my package to dependencies
@matteoberla didn't really check if these button work since I don't use them in my project, but you can launch the controls modal by calling:
w3mService.openModal();
@matteoberla didn't really check if these button work since I don't use them in my project, but you can launch the controls modal by calling:
w3mService.openModal();
My bad, i was missing the init()
. they works like a charm
network change seems not to work, where can i write to you so we don't mess up this issue with unrelated comments? @asmodeoux
@matteoberla yeah you need to keep the wallet app open on your phone in order to confirm the network change there. I'm thinking about adding the QR code to the change network page so the user can scan and confirm it, but don't really expect much from this fork yet... it's just a temporary workaround, I hope the official version will be released soon :D
Connection definitely works, as for some other things you might need to open the app on your phone to confirm them, because redirect doesn't work on Web, and the initial code expects things to run on Mobile where the redirect opens the wallet for you.
i've kept the app opened but seems not to work, this is what i see in the console trying to switch to polygon:
[W3MService] account data laoded
pairing sendRequest, id: null topic: f085e6ea3544edbcd1a2f49690a0783b47250b592bc35cc46b8cb41aededc77f, method: wc_sessionRequest, params: WcSessionRequestRequest(chainId: eip155:1, request: SessionRequestParams(method: wallet_switchEthereumChain, params: [{chainId: 0x89}])), ttl: null
Handling Publish Message: f085e6ea3544edbcd1a2f49690a0783b47250b592bc35cc46b8cb41aededc77f, ACNY+JwyhCy1o/3JT24wiiaaxu5AaPM8bDlldvEDl131eyUUV7ebJxfn7VoS4HeVNUYuG2JgGnf9RlTGhHDS6vFiIdQPKO+yTGoMBqZvwhVSHxdC2saR/To+pewDggCgHB6h48QVqu7+lKJgG73haAtPQobNESdY6Eq4RAgA2Krup9riTFi0D+0mFyuNbhY2OoG/ngBti9jKBoBe3jHG5gIrRYNho6F3x6x319eXcvHenAX3JlSiPxWZRukiTSIQNwKds/aue023ob/QGu+X58CmRJ94mRmZiNQJCrtFiPcUeTkpnbhIXfvYDoteRM91ylHsg+3++UPeLezmsHls6r7itZH4E1faJER0T0i38NGxy6o=
Pairing _onMessageEvent, Received data: {id: 1714725333346235, jsonrpc: 2.0, error: {code: 5000, message: {"code":-32603,"message":"Unrecognized chain ID \"0x89\". Try adding the chain using wallet_addEthereumChain first.","data":{"originalError":{"code":4902}}}}}
pairing sendRequest, id: null topic: f085e6ea3544edbcd1a2f49690a0783b47250b592bc35cc46b8cb41aededc77f, method: wc_sessionRequest, params: WcSessionRequestRequest(chainId: eip155:1, request: SessionRequestParams(method: wallet_addEthereumChain, params: [{chainId: 0x89, chainName: Polygon, nativeCurrency: {name: MATIC, symbol: MATIC, decimals: 18}, rpcUrls: [https://polygon.drpc.org], blockExplorers: {default: {name: Explorer, url: https://polygonscan.com}}}])), ttl: null
Handling Publish Message: f085e6ea3544edbcd1a2f49690a0783b47250b592bc35cc46b8cb41aededc77f, AJORgg3jINaPNfmgI3JMK8tWxkhW3UwCJmlIsgII+mokmATvdVy89u8/+CD4cn4tEtbv2iNyIWlF24LihZSOxHPKGNrsitrIOARP4yQyT0rlk4p3wcWsMzJFjeyc3d8iaxQ5PmSvAr4LCaS8TbH7ujjJNoBqfDfIAxiEc66a2tFCo+aVxrfDLwHT0dpX40wpC8L+a3dPKyLJBhx8kw3ONxn4Pd3JEunlgAm625VruKDBmcvSeRd0VNFL5xAfu0JkDMdfAEl8na4ywB3cH0hiOeesTbdCfznGRw==
Pairing _onMessageEvent, Received data: {id: 1714725334862485, jsonrpc: 2.0, error: {code: 5000, message: {"code":-32602,"message":"Received unexpected keys on object parameter. Unsupported keys:\nblockExplorers"}}}
[W3MService] set chain eip155:1
[W3MService] _loadAccountData
[W3MService] account data laoded
My bad, the network to switch to needs to be added also in the app you're using to connect the wallet (in my case metamask)
@asmodeoux was smart contract interaction / transactions approval etc. implemented as weel?
I'm receiving this at startup, i've tried to clear cache of packages but nothing seems to work