VOOZH about

URL: https://www.nuget.org/packages/TonSdk.Connect/

⇱ NuGet Gallery | TonSdk.Connect 0.2.5




TonSdk.Connect 0.2.5

dotnet add package TonSdk.Connect --version 0.2.5
 
 
NuGet\Install-Package TonSdk.Connect -Version 0.2.5
 
 
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="TonSdk.Connect" Version="0.2.5" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TonSdk.Connect" Version="0.2.5" />
 
Directory.Packages.props
<PackageReference Include="TonSdk.Connect" />
 
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 TonSdk.Connect --version 0.2.5
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TonSdk.Connect, 0.2.5"
 
 
#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 TonSdk.Connect@0.2.5
 
 
#: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=TonSdk.Connect&version=0.2.5
 
Install as a Cake Addin
#tool nuget:?package=TonSdk.Connect&version=0.2.5
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

TonSdk.Connect

Overview example

// Create a TonConnectOptions object with the manifest URL
TonConnectOptions options = new TonConnectOptions()
{
 ManifestUrl = "https://dedust.io/tonconnect-manifest.json"
};

// Initialize TonConnect with the specified options
TonConnect tonConnect = new(options);

// Get wallet configurations
WalletConfig[] walletsConfig = tonConnect.GetWallets();

// Set event handlers for status changes and errors
tonConnect.OnStatusChange(OnStatusChange, OnErrorChange);

// Method called when the wallet status changes
void OnStatusChange(Wallet wallet)
{
 Console.WriteLine("Wallet connected. Address: " + wallet.Account.Address + ". Platform: " + wallet.Device.Platform + "," + wallet.Device.AppName + "," + wallet.Device.AppVersion);
}

// Method called when errors occur
void OnErrorChange(string wallet)
{
 Console.WriteLine(wallet);
}

// Connect to a wallet and await the result
string result = await tonConnect.Connect(walletsConfig[1]);

// Print the connection result
Console.WriteLine("Connect link: " + result);

Disconnect wallet method
// Call this method to disconnect from the current wallet
await tonConnect.Disconnect();
Use custom remote storage
// Create a `RemoteStorage` object with custom storage methods provided by the user (for example Player Prefs in Unity)
RemoteStorage remoteStorage = new(new(PlayerPrefs.GetString), new(PlayerPrefs.SetString), new(PlayerPrefs.DeleteKey), new(PlayerPrefs.HasKey));

// Initialize TonConnect with the specified options and the custom storage methods
TonConnect tonConnect = new(options, remoteStorage);
Use additional connect options
// This delegates uses, if platform as the Unity, needs reimplementation of httpClient logic, with using Coroutines.
// Dont use in usual C# projects.

// Create a custom SSE listen method with implementation of event stream subsctiptions.
// Example, https://github.com/continuation-team/unity-ton-connect/blob/main/Assets/TonConnect/Scripts/TonConnect/TonConnectHandler.cs#L147C5-L192C6
private void YourListenEventsMethod() {}

// Create a custom send post message method
// Example, https://github.com/continuation-team/unity-ton-connect/blob/main/Assets/TonConnect/Scripts/TonConnect/TonConnectHandler.cs#L119C5-L145C6
private void YourSendPostMethod() {}

// Create a `AdditionalConnectOptions` object with custom methods provided by the user (only in Unity)
AdditionalConnectOptions additionalOptions = new AdditionalConnectOptions()
{
 listenEventsFunction = new ListenEventsFunction(YourListenEventsMethod),
 sendGatewayMessage = new SendGatewayMessage(YourSendPostMethod)
}
Send transaction example
// Create a receiver address and the amount to send
Address receiver = new("receiver address");
Coins amount = new("send amount");

// Create an array of messages to send
Message[] sendTons = 
{
 new Message(receiver, amount),
 // Additional messages if needed
};

// Set the valid until timestamp for the transaction (expiration time in seconds from the current moment)
long validUntil = DateTimeOffset.Now.ToUnixTimeSeconds() + 600;

// Create a SendTransactionRequest object
SendTransactionRequest transactionRequest = new SendTransactionRequest(sendTons, validUntil);

// Print the result of sending the transaction
Console.WriteLine(await tonConnect.SendTransaction(transactionRequest));

Donation

continuation.ton

License

MIT License

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 was computed.  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 was computed. 
.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
0.2.5 3,222 2/19/2025
0.2.4 16,754 5/7/2024
0.2.3 1,227 4/28/2024
0.2.2 335 4/20/2024
0.2.1 302 4/15/2024
0.1.2 1,703 10/28/2023
0.1.0 318 9/6/2023