In my project, I needed to connect to fragment.com and read some information about the auctioned numbers in it. So, I started with my favorite language, C#! In this blog post, I will introduce the C# SDK that I've created to connect to Fragment and read its information in a fully typed way. First, let me explain what Fragment is and why it’s important. Then I’ll show you how I created the SDK. Finally, I’ll include some code snippets and screenshots to make it easier for you to follow along.
Telegram is definitely my absolute favorite messaging app ever! It has a feature called Anonymous Number, which are unique phone numbers that can be used to login to Telegram fully anonymously.
Fragment allows users to bid for Telegram Anonymous Numbers and Usernames in an auction format. All usernames are represented on the TON blockchain as non-fungible tokens (NFTs), meaning they are unique and indivisible digital assets.
To access the data from Fragment in a convenient and efficient way, I decided to create a .NET SDK that can communicate with the TON blockchain and parse the information from Fragment. The result is TonRadar.Fragment nuget package, which you can install in your project using the following command:
dotnet add package TonRadar.Fragment
Here is an example of how to use the SDK to get the details of the current highest bid for the username "ton":
// Create an instance of the FragmentClient class auctions. var client = new FragmentClient(); // Reading all auctions with EndingSoon filter. var auctionItems = await client.Numbers.GetAuctionsItemsAsync(SortType.EndingSoon); // Reading all for-sale items. var saleItems = await client.Numbers.GetSaleItemsAsync(FilterType.ForSale); // Reading all sold items. var soldItems = await client.Numbers.GetSoldItemsAuctionsAsync(FilterType.Sold);
In this blog post, I have shown you how to use my C# SDK, TonRadar.Fragment, to access and analyze the data from Fragment. For now, I've just added my needed methods to the library. But in the future, I'll add more functionality to it. I will be more than happy if you contribute and add you're required features to it and send some pull requests. You can find the repo here on GitHub.