RootSoft / walletconnect-dart-sdk

Open protocol for connecting dApps to mobile wallets with QR code scanning or deep linking.
MIT License
102 stars 61 forks source link

Changes type of chainId to String #16

Open josh-burton opened 2 years ago

josh-burton commented 2 years ago

Fixes #15

RootSoft commented 2 years ago

Thanks for the PR @josh-burton Do you have an idea which blockchain uses a string as chainId? The official monorepo uses a number: private _chainId = 0;

josh-burton commented 2 years ago

@RootSoft this was the Elrond chain using the Maiar wallet.

ChikinDeveloper commented 2 years ago

Hi! Please add this, we want to add Solana provider but it' a String chaindId:

RootSoft commented 2 years ago

@ChikinDeveloper @josh-burton would dynamic be preferred over String?

RootSoft commented 2 years ago

Can you guys try out this branch: https://github.com/RootSoft/walletconnect-dart-sdk/tree/feature/dynamic-chainid

walletconnect_dart:
  git:
    url: git://github.com/RootSoft/walletconnect-dart-sdk.git
    ref: feature/dynamic-chainid

A solana integration provider would be helpful as well: https://github.com/RootSoft/walletconnect-dart-sdk/blob/master/lib/src/providers/ethereum_walletconnect_provider.dart

josh-burton commented 2 years ago

@ChikinDeveloper @josh-burton would dynamic be preferred over String?

I don't think we need dynamic. It won't be a bool or a list or a complex object, it will really only be either a string or an int.

In that case casting the int to a string is the best option.

RootSoft commented 2 years ago

@josh-burton Can you try out the following branch: https://github.com/RootSoft/walletconnect-dart-sdk/tree/feature/string-chainid

walletconnect_dart:
  git:
    url: git://github.com/RootSoft/walletconnect-dart-sdk.git
    ref: feature/string-chainid

This branch contains the chain id as a string. Some wallets sends the chainId as int, others as a String. So I had to do some extra checks to cast the chainId to a String.