ch1seL.TonNet.Client
1.26.0
See the version list below for details.
dotnet add package ch1seL.TonNet.Client --version 1.26.0
NuGet\Install-Package ch1seL.TonNet.Client -Version 1.26.0
<PackageReference Include="ch1seL.TonNet.Client" Version="1.26.0" />
paket add ch1seL.TonNet.Client --version 1.26.0
#r "nuget: ch1seL.TonNet.Client, 1.26.0"
// Install ch1seL.TonNet.Client as a Cake Addin #addin nuget:?package=ch1seL.TonNet.Client&version=1.26.0 // Install ch1seL.TonNet.Client as a Cake Tool #tool nuget:?package=ch1seL.TonNet.Client&version=1.26.0
<img src="https://avatars3.githubusercontent.com/u/67861283?s=150&u=4536b61595a1b422604fab8a7012092d891278f6&v=4" align="right" width="150">
Free TON .NET Client
Free TON is modern and fast crypto network. Lets do this network convenient both for users and developers!
- This client was automatically generated from api.json (see ClientGenerator)
- Fully supported methods provided in SDK documentation https://github.com/tonlabs/TON-SDK/tree/master/docs
- No Newtonsoft.Json required, it is kinda legacy now, last release was over a year ago. New System.Text.Json is ten times faster
- The most complete support of CancellationToken
- Net Standard 2.1 compatible
Quick start
Add Nuget Package to your project
dotnet add package ch1seL.TonNet.Client
Register in DI
Be careful! no network endpoints provided as default
public void ConfigureServices(IServiceCollection services)
{
services.AddTonClient();
}
Ready to use everywhere
public class YourTonService {
private readonly ITonClient _tonClient;
public YourTonService(ITonClient tonClient) {
_tonClient = tonClient;
}
public string GetTonSecretPhase() {
var mnemonic = await _tonClient.Crypto.MnemonicFromRandom(new ParamsOfMnemonicFromRandom());
return mnemonic.Phrase;
}
}
IPackageManager interface
There is easy option to load contracts abi and tvm info from files in this client.
Now available following async methods:
Task<Package> LoadPackage(string name); // Package entity just contains Abi and Tvc
Task<Abi> LoadAbi(string name);
Task<string> LoadTvc(string name);
Default contracts path is _contracts
IDebotBrowser interface
Attention! DeBot module is UNSTABLE yet, see TON SDK description
More information:
As default IDebotBrowser will resolve instance of DefaultDebotBrowser.
Can be inherited or implemented self-owned: services.AddTransient<IDebotBrowser, MyDebotBrowser>()
Advanced client configuration
See configuration parameters:
- https://github.com/tonlabs/TON-SDK/blob/master/docs/mod_client.md#networkconfig
- https://github.com/tonlabs/TON-SDK/blob/master/docs/mod_client.md#cryptoconfig
- https://github.com/tonlabs/TON-SDK/blob/master/docs/mod_client.md#abiconfig
public void ConfigureServices(IServiceCollection services)
{
services.AddTonClient(config =>
{
config.Network.Endpoints = new[] { "net5.ton.dev" };
config.Network.NetworkRetriesCount = 5;
}, packageManagerConfig =>
{
packageManagerConfig.PackagesPath = "packages"; // path to abi.json and tvc files, _contracts is default
});
}
or configure options by appsettings.json or another configuration provider
https://docs.microsoft.com/en-us/dotnet/core/extensions/configuration-providers
Example for appsettings.json
{
"TonClient": {
"Network": {
"Endpoints": [ "net.ton.dev" ],
"WaitForTimeout": 5000
}
},
"PackageManager": {
"PackagesPath": "my_app_contracts"
}
}
public void ConfigureServices(IServiceCollection services)
{
services.AddTonClient()
.Configure<TonClientOptions>(Configuration.GetSection("TonClient"))
.Configure<PackageManagerOptions>(Configuration.GetSection("PackageManager"));
}
Logging
Fully compatible with https://docs.microsoft.com/en-us/dotnet/core/extensions/logging
Anonymous type extensions
There are a few properties with type JsonElement in data models. And this client provide methods to easy convert this properties to/from Anonymous prototype.
Convert to anonymous type example:
ResultOfParse parseResult = await tonClient.Boc.ParseMessage(new ParamsOfParse
{
Boc = "te6ccgEBAQEAWAAAq2n+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE/zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzSsG8DgAAAAAjuOu9NAL7BxYpA"
});
var parsedPrototype = new {type = default(int), id = default(string)};
var parsedMessage = parseResult.Parsed!.Value.ToAnonymous(parsedPrototype);
_logger.LogInformation("Parsed message id: {id} type: {type}", parsedMessage.id, parsedMessage.type);
Convert from anonymous type example:
await tonClient.Net.WaitForCollection(new ParamsOfWaitForCollection
{
Collection = "transactions",
Filter = new {in_msg = new {eq = parsedMessage.id}}.ToJsonElement(),
Result = "id"
});
Samples
https://github.com/ton-actions/ton-client-dotnet/tree/master/samples/
Enjoy!
My Coffee Surf address:
ton://surf/0:9b487d68e4f029ab6d92640892d99d1c549ae69b198df414e905350559a165bf
https://ton.surf
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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. |
-
.NETCoreApp 3.1
- ch1seL.TonNet.Abstract (>= 1.26.0)
- ch1seL.TonNet.Adapter.Rust (>= 1.26.0)
- ch1seL.TonNet.Client.Modules (>= 1.26.0)
- Microsoft.Extensions.Logging (>= 6.0.0)
-
.NETStandard 2.1
- ch1seL.TonNet.Abstract (>= 1.26.0)
- ch1seL.TonNet.Adapter.Rust (>= 1.26.0)
- ch1seL.TonNet.Client.Modules (>= 1.26.0)
- Microsoft.Extensions.Logging (>= 6.0.0)
-
net5.0
- ch1seL.TonNet.Abstract (>= 1.26.0)
- ch1seL.TonNet.Adapter.Rust (>= 1.26.0)
- ch1seL.TonNet.Client.Modules (>= 1.26.0)
- Microsoft.Extensions.Logging (>= 6.0.0)
-
net6.0
- ch1seL.TonNet.Abstract (>= 1.26.0)
- ch1seL.TonNet.Adapter.Rust (>= 1.26.0)
- ch1seL.TonNet.Client.Modules (>= 1.26.0)
- Microsoft.Extensions.Logging (>= 6.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ch1seL.TonNet.Client:
Package | Downloads |
---|---|
ch1seL.TonNet.TestsShared
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.28.0.1 | 586 | 1/8/2022 | |
1.28.0 | 280 | 12/28/2021 | |
1.27.1 | 962 | 12/10/2021 | |
1.27.0 | 1,004 | 12/6/2021 | |
1.26.1 | 492 | 12/4/2021 | |
1.26.0 | 2,322 | 11/26/2021 | |
1.25.0 | 717 | 11/10/2021 | |
1.24.0.1 | 651 | 11/10/2021 | |
1.24.0 | 352 | 10/26/2021 | |
1.23.0 | 404 | 10/6/2021 | |
1.22.0.3 | 308 | 9/27/2021 | |
1.22.0.2 | 384 | 9/24/2021 | |
1.22.0.1 | 357 | 9/24/2021 | |
1.22.0 | 305 | 9/24/2021 | |
1.21.5.1 | 318 | 9/18/2021 | |
1.21.5 | 351 | 9/15/2021 | |
1.21.4 | 352 | 9/10/2021 | |
1.21.3 | 309 | 9/6/2021 | |
1.21.2 | 318 | 8/26/2021 | |
1.21.0 | 337 | 8/24/2021 | |
1.20.1 | 340 | 8/5/2021 | |
1.20.0 | 353 | 7/20/2021 | |
1.19.0 | 368 | 7/9/2021 | |
1.18.0 | 397 | 6/30/2021 | |
1.17.0 | 374 | 6/23/2021 | |
1.16.1 | 373 | 6/18/2021 | |
1.16.0 | 359 | 5/26/2021 | |
1.15.0 | 360 | 5/19/2021 | |
1.14.1 | 352 | 4/30/2021 | |
1.14.0 | 341 | 4/28/2021 | |
1.13.0 | 350 | 4/23/2021 | |
1.12.0 | 346 | 4/6/2021 | |
1.11.1 | 346 | 3/22/2021 | |
1.10.0 | 382 | 3/10/2021 | |
1.9.0 | 345 | 3/1/2021 | |
1.8.0 | 331 | 2/12/2021 | |
1.7.0 | 328 | 2/12/2021 | |
1.6.3 | 350 | 2/5/2021 | |
1.6.0 | 348 | 2/5/2021 | |
1.5.2 | 392 | 12/30/2020 | |
1.5.0.1 | 582 | 12/26/2020 | |
1.5.0 | 389 | 12/26/2020 | |
1.4.0 | 502 | 12/26/2020 | |
1.4.0-beta1 | 395 | 12/25/2020 | |
1.3.0.2 | 435 | 12/18/2020 | |
1.3.0.1 | 579 | 12/10/2020 | |
1.3.0 | 560 | 12/10/2020 | |
1.2.0.1 | 606 | 12/9/2020 | |
1.2.0 | 527 | 12/8/2020 | |
1.2.0-beta.3 | 173 | 12/8/2020 | |
1.2.0-beta.2 | 197 | 12/3/2020 | |
1.2.0-beta.1 | 188 | 12/2/2020 | |
1.2.0-alfa.1 | 210 | 11/29/2020 | |
1.1.2 | 521 | 11/29/2020 | |
1.1.2-alpha.1 | 233 | 11/29/2020 | |
0.3.1 | 498 | 11/22/2020 | |
0.3.0 | 505 | 11/21/2020 | |
0.2.4 | 407 | 11/20/2020 | |
0.2.3 | 408 | 11/20/2020 | |
0.2.2 | 420 | 11/19/2020 | |
0.2.1 | 442 | 11/19/2020 | |
0.2.0 | 426 | 11/18/2020 | |
0.1.0 | 442 | 11/17/2020 | |
0.0.5 | 413 | 11/17/2020 | |
0.0.4 | 428 | 11/17/2020 | |
0.0.3 | 404 | 11/17/2020 | |
0.0.2 | 415 | 11/17/2020 | |
0.0.1 | 406 | 11/17/2020 |