TonSdk.Core
0.2.8
See the version list below for details.
dotnet add package TonSdk.Core --version 0.2.8
NuGet\Install-Package TonSdk.Core -Version 0.2.8
<PackageReference Include="TonSdk.Core" Version="0.2.8" />
paket add TonSdk.Core --version 0.2.8
#r "nuget: TonSdk.Core, 0.2.8"
// Install TonSdk.Core as a Cake Addin #addin nuget:?package=TonSdk.Core&version=0.2.8 // Install TonSdk.Core as a Cake Tool #tool nuget:?package=TonSdk.Core&version=0.2.8
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
TonClient tonclient = new TonClient(new TonClientParameters { Endpoint = "https://toncenter.com/api/v2/jsonRPC", ApiKey = "xxx" });
// 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 tonclient.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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- JustCRC32C (>= 1.1.0)
- Portable.BouncyCastle (>= 1.9.0)
-
.NETStandard 2.1
- JustCRC32C (>= 1.1.0)
- Portable.BouncyCastle (>= 1.9.0)
-
net6.0
- JustCRC32C (>= 1.1.0)
- Portable.BouncyCastle (>= 1.9.0)
-
net7.0
- JustCRC32C (>= 1.1.0)
- Portable.BouncyCastle (>= 1.9.0)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on TonSdk.Core:
Package | Downloads |
---|---|
TonSdk.Client
Ton Client library for work with HTTP API and Lite Servers. |
|
TonSdk.Contracts
Abstractions for work with smart contracts in TON Blockchain |
|
TonSdk.Adnl
Library that allows to interact with Ton ADNL |
|
TonSdk.Connect
Library that allows to interact with Ton Connect 2.0 |
|
TonSdk.DeFi
Library for work with popular TON DeFis. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.3.9 | 17,292 | 7/16/2024 |
0.3.8 | 499 | 7/8/2024 |
0.3.7 | 532 | 6/26/2024 |
0.3.6 | 539 | 6/22/2024 |
0.3.5 | 169 | 6/16/2024 |
0.3.4 | 108 | 6/16/2024 |
0.3.3 | 3,288 | 5/16/2024 |
0.3.2 | 1,852 | 5/7/2024 |
0.3.1 | 6,184 | 4/14/2024 |
0.2.10 | 373 | 4/8/2024 |
0.2.9 | 150 | 4/8/2024 |
0.2.8 | 2,040 | 12/7/2023 |
0.2.7 | 466 | 11/29/2023 |
0.2.6 | 488 | 10/31/2023 |
0.2.5 | 359 | 10/28/2023 |
0.2.4 | 470 | 9/28/2023 |
0.2.3 | 266 | 9/27/2023 |
0.2.2 | 1,170 | 8/22/2023 |
0.2.1 | 352 | 7/10/2023 |
0.2.0 | 1,917 | 7/10/2023 |
0.1.0 | 385 | 7/8/2023 |