TonSdk.Client
0.2.9
.NET 6.0
This package targets .NET 6.0. 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 TonSdk.Client --version 0.2.9
NuGet\Install-Package TonSdk.Client -Version 0.2.9
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.Client" Version="0.2.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TonSdk.Client --version 0.2.9
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TonSdk.Client, 0.2.9"
#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.Client as a Cake Addin #addin nuget:?package=TonSdk.Client&version=0.2.9 // Install TonSdk.Client as a Cake Tool #tool nuget:?package=TonSdk.Client&version=0.2.9
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TonSdk.NET
You can ask questions that may arise during the use of the SDK in our Telegram group.
Packages
TonSdk.Core
Core library with types and structures for TON Blockchain
TonSdk.Client
RPC Client for work with TonCenter API
TonSdk.Contracts
Abstractions for work with smart contracts in TON Blockchain
TonSdk.Connect
Library to work with Ton Connect 2.0
TonSdk.Adnl
Features and status
- Builder, Cell, Slice
- BOC (de)serialization
- Hashmap(E) (dictionary) (de)serialization
- Mnemonic BIP39 standard
- Mnemonic TON standard
- Coins (class for TON, JETTON, e.t.c.)
- Address (class for TON address)
- Message layouts (such as MessageX e.t.c.)
- RPC client
- Popular structures from block.tlb
- Contracts (abstract TON contract class)
- Ed25519 signing of transactions
- ~100% tests coverage
Overview example
// Create a new instance of the TonClient using the specified endpoint and API key for Http based client
TonClient client = new TonClient(TonClientType.HTTP_TONCENTERAPIV2, new HttpParameters { Endpoint = "https://toncenter.com/api/v2/jsonRPC", ApiKey = "xxx" });
// Create a new instance of the TonClient using the specified ip, port and key for LiteClient based client
TonClient clientLite = new TonClient(TonClientType.LITECLIENT, , new LiteClientParameters(ip, port, key));
// Generate a new mnemonic phrase
Mnemonic mnemonic = new Mnemonic();
// Create a new preprocessed wallet using the public key from the generated mnemonic
PreprocessedV2 wallet = new PreprocessedV2(new PreprocessedV2Options { PublicKey = mnemonic.Keys.PublicKey! });
// Get the address associated with the wallet
Address address = wallet.Address;
// Convert the address to a non-bounceable format
string nonBounceableAddress = address.ToString(AddressType.Base64, new AddressStringifyOptions(false, false, true));
// Retrieve the wallet data
Cell? walletData = (await tonclient.GetAddressInformation(address)).Data;
// Extract the sequence number from the wallet data, or set it to 0 if the data is null
uint seqno = walletData == null ? 0 : wallet.ParseStorage(walletData.Parse()).Seqno;
// Get the balance of the wallet
Coins walletBalance = await tonclient.GetBalance(address);
// Get the destination address for the transfer from the Ton DNS
Address destination = await tonclient.Dns.GetWalletAddress("foundation.ton");
// Create a transfer message for the wallet
ExternalInMessage message = wallet.CreateTransferMessage(new[]
{
new WalletTransfer
{
Message = new InternalMessage(new()
{
Info = new IntMsgInfo(new()
{
Dest = destination,
Value = new Coins("0.2")
}),
Body = new CellBuilder().StoreUInt(0, 32).StoreString("test").Build()
}),
Mode = 1
}
}, seqno).Sign(mnemonic.Keys.PrivateKey, true);
// Send the serialized message
await tonclient.SendBoc(message.Cell!);
Overview example (Jetton Transfer)
// Define the address of the jetton master contract
Address jettonMasterContract = new Address("EQBlHnYC0Uk13_WBK4PN-qjB2TiiXixYDTe7EjX17-IV-0eF");
// Get the jetton wallet address
Address jettonWallet = await tonclient.Jetton.GetWalletAddress(jettonMasterContract, address);
// Create a message body for the jetton transfer
Cell jettonTransfer = JettonWallet.CreateTransferRequest(new() { Amount = new Coins(100), Destination = destination });
// Create a transfer message for the wallet
ExternalInMessage message = wallet.CreateTransferMessage(new[]
{
new WalletTransfer
{
Message = new InternalMessage(new()
{
Info = new IntMsgInfo(new()
{
Dest = jettonWallet,
Value = new Coins("0.1")
}),
Body = jettonTransfer
}),
Mode = 1
}
}, seqno).Sign(mnemonic.Keys.PrivateKey, true);
// Pre-calculate fee before sending message
EstimateFeeResult fees = await _client.EstimateFee(message);
// Send the serialized message
await client.SendBoc(message.Cell!);
Donation
continuation.ton
License
MIT License
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 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.
-
.NETStandard 2.1
- Newtonsoft.Json (>= 13.0.3)
- TonSdk.Adnl (>= 0.1.4)
- TonSdk.Core (>= 0.2.9)
-
net6.0
- Newtonsoft.Json (>= 13.0.3)
- TonSdk.Adnl (>= 0.1.4)
- TonSdk.Core (>= 0.2.9)
-
net7.0
- Newtonsoft.Json (>= 13.0.3)
- TonSdk.Adnl (>= 0.1.4)
- TonSdk.Core (>= 0.2.9)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on TonSdk.Client:
Package | Downloads |
---|---|
TonSdk.DeFi
Library for work with popular TON DeFis. |
|
Pexc.Crypto
Pexc Wallet and blockchain related code |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.3.11 | 6,017 | 9/14/2024 |
0.3.10 | 4,399 | 7/17/2024 |
0.3.9 | 332 | 7/16/2024 |
0.3.8 | 413 | 7/8/2024 |
0.3.7 | 232 | 7/5/2024 |
0.3.6 | 103 | 7/4/2024 |
0.3.5 | 178 | 6/26/2024 |
0.3.4 | 2,595 | 5/17/2024 |
0.3.3 | 267 | 5/16/2024 |
0.3.2 | 814 | 4/16/2024 |
0.3.1 | 322 | 4/14/2024 |
0.2.10 | 141 | 4/8/2024 |
0.2.9 | 103 | 4/8/2024 |
0.2.8 | 464 | 3/24/2024 |
0.2.7 | 2,001 | 12/7/2023 |
0.2.6 | 199 | 11/30/2023 |
0.2.5 | 304 | 11/16/2023 |
0.2.4 | 170 | 10/28/2023 |
0.2.3 | 314 | 9/27/2023 |
0.2.2 | 201 | 7/12/2023 |
0.2.1 | 163 | 7/12/2023 |
0.2.0 | 170 | 7/10/2023 |
0.1.0 | 161 | 7/8/2023 |