VOOZH about

URL: https://www.nuget.org/packages/RemarkableTools.Mx.WalletConnect/

⇱ NuGet Gallery | RemarkableTools.Mx.WalletConnect 2.2.0




👁 Image
RemarkableTools.Mx.WalletConnect 2.2.0

dotnet add package RemarkableTools.Mx.WalletConnect --version 2.2.0
 
 
NuGet\Install-Package RemarkableTools.Mx.WalletConnect -Version 2.2.0
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RemarkableTools.Mx.WalletConnect" Version="2.2.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RemarkableTools.Mx.WalletConnect" Version="2.2.0" />
 
Directory.Packages.props
<PackageReference Include="RemarkableTools.Mx.WalletConnect" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RemarkableTools.Mx.WalletConnect --version 2.2.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RemarkableTools.Mx.WalletConnect, 2.2.0"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RemarkableTools.Mx.WalletConnect@2.2.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RemarkableTools.Mx.WalletConnect&version=2.2.0
 
Install as a Cake Addin
#tool nuget:?package=RemarkableTools.Mx.WalletConnect&version=2.2.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Wallet Connect 2.0 documentation

About SDK

The library is used to connect to xPortal wallet and sign transactions.

How to install?

The content is delivered via nuget package:

RemarkableTools.Mx.WalletConnect 👁 Package

Quick start guide

Note: This guide does not include the NativeAuthClient Token for connection.
  1. Variables init
IApiProvider Provider = new ApiProvider(new ApiNetworkConfiguration(Network.DevNet));
NetworkConfig NetworkConfig { get; set; } = default!;
Account Account { get; set; } = default!;
  1. Define the Metadata (is showing in xPortal when approving the connection) and NativeAuth Token
var metadata = new Metadata()
{
 Name = "Mx.NET.WinForms",
 Description = "Mx.NET.WinForms login testing",
 Icons = new[] { "https://devnet.remarkable.tools/remarkabletools.ico" },
 Url = "https://devnet.remarkable.tools/"
};
  1. Define the Wallet Connection
const string CHAIN_ID = "D";
const string PROJECT_ID = "WALLET_CONNECT_PROJECT_ID";
IWalletConnect WalletConnect = new WalletConnect(metadata, PROJECT_ID, CHAIN_ID);
  1. At start-up, you should check for old connection and setup the events
await WalletConnect.ClientInit();
WalletConnect.OnSessionEvent += OnSessionEvent;
WalletConnect.OnSessionDeleteEvent += OnSessionDeleteEvent;

try
{
 var isConnected = WalletConnect.TryReconnect();
 if (isConnected)
 {
 //initialize some variables
 NetworkConfig = await NetworkConfig.GetFromNetwork(Provider);
 Account = Account.From(await Provider.GetAccount(WalletConnect.Address));

 //do other operations
 }
}
catch (Exception ex)
{
 //Exception occured
}
  1. If you don't have a connection saved, continue with WalletConnect connection initialization
await WalletConnect.Initialize();
  1. Show a QR code generated with the link from WalletConnect.URI

  2. Start the wallet connection

try
{
 await WalletConnect.Connect(); 

 //initialize some variables
 NetworkConfig = await NetworkConfig.GetFromNetwork(Provider);
 Account = Account.From(await Provider.GetAccount(WalletConnect.Address));
}
catch (Exception ex)
{
 //Connection was not approved
}
  1. Session Events
private void OnSessionDeleteEvent(object? sender, SessionEvent e)
{
 //Wallet Disconnected

 NetworkConfig = default!;
 Account = default!;
}
  1. Disconnect function
await WalletConnect.Disconnect(); //this will also trigger OnSessionDeleteEvent

9.1 Create a transaction then sign it with WalletConnect

await Account.Sync(Provider); //always sync account first (to have the latest nonce)
var receiver = "RECEIVER_ADDRESS";

var transaction = EGLDTransactionRequest.EGLDTransfer(NetworkConfig,
 Account,
 Address.FromBech32(receiver),
 ESDTAmount.EGLD("1.5"),
 $"hello");

try
{
 var transactionRequestDto = await WalletConnect.Sign(transaction);
 var response = await Provider.SendTransaction(transactionRequestDto);
 //Transaction was sent to network
}
catch (Exception ex)
{
 //Exception occured
}

9.2 Create multiple transactions the sign them with Wallet Connect

await Account.Sync(Provider); //always sync account first (to have the latest nonce)
var receiver = "RECEIVER_ADDRESS";

var transaction1 = EGLDTransactionRequest.EGLDTransfer(
 NetworkConfig,
 Account,
 Address.FromBech32(receiver),
 ESDTAmount.EGLD("0.1"),
 "tx 1");
Account.IncrementNonce();

var transaction2 = EGLDTransactionRequest.EGLDTransfer(
 NetworkConfig,
 Account,
 Address.FromBech32(receiver),
 ESDTAmount.EGLD("0.2"),
 "tx 2");
Account.IncrementNonce();

var transaction3 = EGLDTransactionRequest.EGLDTransfer(
 NetworkConfig,
 Account,
 Address.FromBech32(receiver),
 ESDTAmount.EGLD("0.3"),
 "tx 3");
Account.IncrementNonce();

var transactions = new[] { transaction1, transaction2, transaction3 };
try
{
 var transactionsRequestDto = await WalletConnect.MultiSign(transactions);
 var response = await Provider.SendTransactions(transactionsRequestDto);
 //Transactions were sent to network
}
catch (Exception ex)
{
 //Exception occured
}

Basic usage example

A Windows application example can be found here.

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 is compatible.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 is compatible.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 is compatible. 
.NET Standard netstandard2.1 netstandard2.1 is compatible. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.0 299 6/17/2024
2.1.3 337 12/28/2023
2.1.2 309 10/23/2023
1.0.0 392 1/16/2023

.NET SDK Release