![]() |
VOOZH | about |
dotnet add package TonSdk.Connect --version 0.2.5
NuGet\Install-Package TonSdk.Connect -Version 0.2.5
<PackageReference Include="TonSdk.Connect" Version="0.2.5" />
<PackageVersion Include="TonSdk.Connect" Version="0.2.5" />Directory.Packages.props
<PackageReference Include="TonSdk.Connect" />Project file
paket add TonSdk.Connect --version 0.2.5
#r "nuget: TonSdk.Connect, 0.2.5"
#:package TonSdk.Connect@0.2.5
#addin nuget:?package=TonSdk.Connect&version=0.2.5Install as a Cake Addin
#tool nuget:?package=TonSdk.Connect&version=0.2.5Install as a Cake Tool
// 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);
// Call this method to disconnect from the current wallet
await tonConnect.Disconnect();
// 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);
// 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)
}
// 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));
continuation.ton
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. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.