.NET SDK 3.1 or later.
Native binaries are built in a separate repository https://github.com/radianceteam/ton-client-dotnet-bridge, CI/CD was set up to generate binaries upon each new tag push. Windows, Linux and macOS binaries are pre-built that way and placed into runtimes directory located in the project root.
Code generator sources are in generator directory. Proceed to the link to read more about the code generator feature.
Core classes and generated modules are in src
dir.
Tests are located in tests
dir. To build project and run all tests, do the following:
- Run local NodeSE server for testing using Docker.
docker run -d -p8888:80 -e USER_AGREEMENT=yes tonlabs/local-node
-
Given that Docker machine host is
localhost
, setTON_NETWORK_ADDRESS
environment variable tohttp://localhost:8888
. Restart shell if needed (on Windows). -
Run these commands:
dotnet restore
dotnet test
Tests will output something like this:
Test Run Successful.
Total tests: 214
Passed: 214
Total time: 1.2510 Minutes
to see more detailed output run tests using this command:
dotnet test --logger:"console;verbosity=detailed"
Note: you could run tests without having to setup Docker and starting NodeSE server. But if you do so, some tests will be skipped:
[xUnit.net 00:00:00.56] TonSdk.Tests.Modules.ProcessingModuleTests.Should_Wait_For_Message [SKIP]
[xUnit.net 00:00:00.57] TonSdk.Tests.Modules.TvmModuleTests.Should_Run_Executor [SKIP]
[xUnit.net 00:00:00.63] TonSdk.Tests.Modules.TvmModuleTests.Should_Run_Tvm [SKIP]
! TonSdk.Tests.Modules.ProcessingModuleTests.Should_Wait_For_Message [1ms]
! TonSdk.Tests.Modules.TvmModuleTests.Should_Run_Executor [1ms]
! TonSdk.Tests.Modules.TvmModuleTests.Should_Run_Tvm [1ms]
[xUnit.net 00:00:02.02] TonSdk.Tests.Modules.NetModuleTests.Should_Query_Collection_Block_Signature [SKIP]
! TonSdk.Tests.Modules.NetModuleTests.Should_Query_Collection_Block_Signature [1ms]
[xUnit.net 00:00:02.03] TonSdk.Tests.Modules.NetModuleTests.Should_Query_Collection_Ranges [SKIP]
[xUnit.net 00:00:02.03] TonSdk.Tests.Modules.NetModuleTests.Should_Subscribe_For_Messages [SKIP]
[xUnit.net 00:00:02.03] TonSdk.Tests.Modules.NetModuleTests.Should_Subscribe_For_Transactions_With_Address [SKIP]
[xUnit.net 00:00:02.03] TonSdk.Tests.Modules.NetModuleTests.Should_Query_Collection_All_Accounts [SKIP]
[xUnit.net 00:00:02.03] TonSdk.Tests.Modules.NetModuleTests.Should_Wait_For_Collection [SKIP]
! TonSdk.Tests.Modules.NetModuleTests.Should_Query_Collection_Ranges [1ms]
! TonSdk.Tests.Modules.NetModuleTests.Should_Subscribe_For_Messages [1ms]
! TonSdk.Tests.Modules.NetModuleTests.Should_Subscribe_For_Transactions_With_Address [1ms]
! TonSdk.Tests.Modules.NetModuleTests.Should_Query_Collection_All_Accounts [1ms]
! TonSdk.Tests.Modules.NetModuleTests.Should_Wait_For_Collection [1ms]
Test Run Successful.
Total tests: 214
Passed: 205
Skipped: 9
Total time: 7.2342 Seconds
Here's the procedure of upgrading .NET Wrapper to the new TON SDK version.
- Push new tag to
ton-client-dotnet-bridge
to trigger TON SDK build (using the same tag as the SDK version, example:1.1.0
). - Wait for the build, then go to https://github.com/radianceteam/ton-client-dotnet-bridge/actions and download build artifacts.
- Unpack them, find binaries for Windows, Linux and Mac and copy them to the corresponding path inside
runtimes
directory (replacing the existing ones).
- Copy the latest
api.json
togenerator
directory. - Run
cd generator && npm install && npm run generate
. - Solve all compilation issues manually, if any.
- Run tests; ensure that nothing is broken.
- Write new tests for new functions, if any.
Note: test logic may alreay exist in TON SDK, see https://github.com/tonlabs/TON-SDK/tree/master/ton_client/client/src,
look into the corresponding module directory and find tests.rs
file. In this case, test can be easily converted
from Rust programming language to C# (this is basically how all the tests are written here).
Create tag named after TON SDK version and push it. GitHub CI/CD will take care of the rest, like, running tests, creating Release, pushing to NuGet. Enjoy!
Package versioning mirrors TON SDK releases. So for example package 1.1.1
works
with TON SDK binaries of the same version, and contains all the functions from the
corresponding api.json
.
Apache License, Version 2.0.
Fire any question to our Telegram channel.