TonSdk.Connect 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TonSdk.Connect --version 0.1.0                
NuGet\Install-Package TonSdk.Connect -Version 0.1.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="TonSdk.Connect" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TonSdk.Connect --version 0.1.0                
#r "nuget: TonSdk.Connect, 0.1.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.
// Install TonSdk.Connect as a Cake Addin
#addin nuget:?package=TonSdk.Connect&version=0.1.0

// Install TonSdk.Connect as a Cake Tool
#tool nuget:?package=TonSdk.Connect&version=0.1.0                

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);
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 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 is compatible.  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 was computed. 
.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.

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.4 4,591 5/7/2024
0.2.3 400 4/28/2024
0.2.2 184 4/20/2024
0.2.1 155 4/15/2024
0.1.2 1,544 10/28/2023
0.1.0 188 9/6/2023