TonSdk.Core
0.1.0
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.Core --version 0.1.0
NuGet\Install-Package TonSdk.Core -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.Core" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TonSdk.Core --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TonSdk.Core, 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.Core as a Cake Addin #addin nuget:?package=TonSdk.Core&version=0.1.0 // Install TonSdk.Core as a Cake Tool #tool nuget:?package=TonSdk.Core&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TonSdk.NET
Packages
- TonSdk.Core - Core library with types and structures for TON Blockchain
- TonSdk.Client - TonCenter RPC client
- TonSdk.Contracts - Abstractions for work with smart contracts in TON Blockchain
Features and status
Feature | Status |
---|---|
Builder, Cell, Slice | <ul><li>- [x] </li></ul> |
BOC (de)serialization | <ul><li>- [x] </li></ul> |
Hashmap(E) (dictionary) (de)serialization | <ul><li>- [x] </li></ul> |
Mnemonic BIP39 standard | <ul><li>- [x] </li></ul> |
Mnemonic TON standard | <ul><li>- [x] </li></ul> |
Coins (class for TON, JETTON, e.t.c.) | <ul><li>- [x] </li></ul> |
Address (class for TON address) | <ul><li>- [x] </li></ul> |
Message layouts (such as MessageX e.t.c.) | <ul><li>- [x] </li></ul> |
RPC client | <ul><li>- [x] </li></ul> |
Popular structures from block.tlb | <ul><li>- [x] </li></ul> |
Contracts (abstract TON contract class) | <ul><li>- [x] </li></ul> |
Ed25519 signing of transactions | <ul><li>- [x] </li></ul> |
~100% tests coverage | <ul><li>- [ ] </li></ul> |
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);
// Send the serialized message
await tonclient.SendBoc(message.Cell!);
License
MIT License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- JustCRC32C (>= 1.1.0)
- Portable.BouncyCastle (>= 1.9.0)
NuGet packages (5)
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 | 5,373 | 7/16/2024 |
0.3.8 | 342 | 7/8/2024 |
0.3.7 | 491 | 6/26/2024 |
0.3.6 | 318 | 6/22/2024 |
0.3.5 | 142 | 6/16/2024 |
0.3.4 | 100 | 6/16/2024 |
0.3.3 | 2,769 | 5/16/2024 |
0.3.2 | 978 | 5/7/2024 |
0.3.1 | 2,664 | 4/14/2024 |
0.2.10 | 363 | 4/8/2024 |
0.2.9 | 142 | 4/8/2024 |
0.2.8 | 2,008 | 12/7/2023 |
0.2.7 | 459 | 11/29/2023 |
0.2.6 | 476 | 10/31/2023 |
0.2.5 | 351 | 10/28/2023 |
0.2.4 | 462 | 9/28/2023 |
0.2.3 | 260 | 9/27/2023 |
0.2.2 | 1,065 | 8/22/2023 |
0.2.1 | 344 | 7/10/2023 |
0.2.0 | 1,898 | 7/10/2023 |
0.1.0 | 378 | 7/8/2023 |