RemarkableTools.Mx.WalletConnect
2.1.3
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Core 3.1
This package targets .NET Core 3.1. The package is compatible with this framework or higher.
.NET Standard 2.1
This package targets .NET Standard 2.1. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package RemarkableTools.Mx.WalletConnect --version 2.1.3
NuGet\Install-Package RemarkableTools.Mx.WalletConnect -Version 2.1.3
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.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RemarkableTools.Mx.WalletConnect --version 2.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RemarkableTools.Mx.WalletConnect, 2.1.3"
#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.
// Install RemarkableTools.Mx.WalletConnect as a Cake Addin #addin nuget:?package=RemarkableTools.Mx.WalletConnect&version=2.1.3 // Install RemarkableTools.Mx.WalletConnect as a Cake Tool #tool nuget:?package=RemarkableTools.Mx.WalletConnect&version=2.1.3
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
Quick start guide
Note: This guide does not include the NativeAuthClient Token for connection.
- Variables init
IApiProvider Provider = new ApiProvider(new ApiNetworkConfiguration(Network.DevNet));
NetworkConfig NetworkConfig { get; set; } = default!;
Account Account { get; set; } = default!;
- 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/"
};
- 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);
- 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
}
- If you don't have a connection saved, continue with WalletConnect connection initialization
await WalletConnect.Initialize();
Show a QR code generated with the link from
WalletConnect.URI
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
}
- Session Events
private void OnSessionDeleteEvent(object? sender, SessionEvent e)
{
//Wallet Disconnected
NetworkConfig = default!;
Account = default!;
}
- 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 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- RemarkableTools.Mx (>= 2.0.15)
- RemarkableTools.Mx.Core (>= 2.0.4)
- RemarkableTools.Mx.Wallet (>= 2.0.1)
- WalletConnect.Sign (>= 2.1.7)
-
.NETStandard 2.1
- RemarkableTools.Mx (>= 2.0.15)
- RemarkableTools.Mx.Core (>= 2.0.4)
- RemarkableTools.Mx.Wallet (>= 2.0.1)
- WalletConnect.Sign (>= 2.1.7)
-
net6.0
- RemarkableTools.Mx (>= 2.0.15)
- RemarkableTools.Mx.Core (>= 2.0.4)
- RemarkableTools.Mx.Wallet (>= 2.0.1)
- WalletConnect.Sign (>= 2.1.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
.NET SDK Release