WalletConnect.Core
1.7.2
dotnet add package WalletConnect.Core --version 1.7.2
NuGet\Install-Package WalletConnect.Core -Version 1.7.2
<PackageReference Include="WalletConnect.Core" Version="1.7.2" />
paket add WalletConnect.Core --version 1.7.2
#r "nuget: WalletConnect.Core, 1.7.2"
// Install WalletConnect.Core as a Cake Addin
#addin nuget:?package=WalletConnect.Core&version=1.7.2
// Install WalletConnect.Core as a Cake Tool
#tool nuget:?package=WalletConnect.Core&version=1.7.2
WalletConnectSharp
WalletConnectSharp is an implementation of the WalletConnect protocol (currently only v1) using .NET and (optinoally) NEthereum. This library implements the WalletConnect Technical Specification in .NET to allow C# dApps makers to add support for the open WalletConnect protocol.
⚠️ This is the core library: This library does not include a default Transport. Consider using WalletConnect.Desktop if you are not writing a custom Transport ⚠️
Usage
First you must define the ClientMeta
you would like to send along with your connect request. This is what is shown in the Wallet UI
var metadata = new ClientMeta()
{
Description = "This is a test of the Nethereum.WalletConnect feature",
Icons = new[] {"https://app.warriders.com/favicon.ico"},
Name = "WalletConnect Test",
URL = "https://app.warriders.com"
};
Once you have the metadata, you can create the WalletConnect
object
var walletConnect = new WalletConnect(metadata);
Console.WriteLine(walletConnect.URI);
This will print the wc
connect code into the console. You can transform this text into a QR code or use it for deep linking. Once you have the wc
link displayed to the user, you can then call Connect()
. The Connect()
function will block until either a successful or rejected session response
var walletConnectData = await walletConnect.Connect();
This function returns a Task<WCSessionData>
object, so it can be awaited if your using async/await. The WCSessionData
has data about the current session (accounts, chainId, etc..)
Console.WriteLine(walletConnectData.accounts[0]);
Console.WriteLine(walletConnectData.chainId);
Connecting with NEthereum
With the above, you have enough to use the base WalletConnect protocol. However, this library comes with an NEthereum provider implementation. To use it, you simply invoke CreateProvider(url)
or CreateProvider(IClient)
. You are required to specify an additional RPC URL or a custom IClient
because the WalletConnect
protocol does not perform read operations (eth_call
, eth_estimateGas
, etc..), so you must provide either an Infura Project ID
, a node's HTTP url for HttpProvider
or a custom IClient
.
Here is an example
var web3 = new Web3(walletConnect.CreateProvider(new Uri("https://mainnet.infura.io/v3/<infruaId>"));
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.1 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETStandard 2.1
- Newtonsoft.Json (>= 13.0.1)
- Portable.BouncyCastle (>= 1.9.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on WalletConnect.Core:
Package | Downloads |
---|---|
WalletConnect.Desktop
A lightweight C# implementation of the WalletConnect protocol that can be used to connect to external wallets or connect a wallet to an external Dapp. Use this package for desktop applications |
|
WalletConnect.NEthereum
An NEthereum extension to access the WalletConnect protocol through a Web3 Provider. A lightweight C# implementation of the WalletConnect protocol that can be used to connect to external wallets or connect a wallet to an external Dapp |
|
RemarkableTools.Mx.WalletConnect
⚡ MultiversX .NET SDK: Unique library for interacting with Wallet Connect |
GitHub repositories
This package is not used by any popular GitHub repositories.