Chia-Client-API
1.8.1.16
See the version list below for details.
dotnet add package Chia-Client-API --version 1.8.1.16
NuGet\Install-Package Chia-Client-API -Version 1.8.1.16
<PackageReference Include="Chia-Client-API" Version="1.8.1.16" />
paket add Chia-Client-API --version 1.8.1.16
#r "nuget: Chia-Client-API, 1.8.1.16"
// Install Chia-Client-API as a Cake Addin #addin nuget:?package=Chia-Client-API&version=1.8.1.16 // Install Chia-Client-API as a Cake Tool #tool nuget:?package=Chia-Client-API&version=1.8.1.16
Chia-Client-API
Thank you for considering using the Chia Client API for C#! Here is a brief overview of what you can expect to find in this repository:
Description
This repository contains a C# wrapper for the Chia blockchain API. It allows you to easily interact with the Chia blockchain from your C# applications.
This library is also available on NuGet. You can find it by searching for "ChiaClientAPI" in the NuGet Package Manager or by using the following command in the Package Manager Console:
Install-Package Chia-Client-API
Features
A simple, easy-to-use interface for accessing the Chia API Support for all API endpoints, including those for managing accounts, sending and receiving transactions, and querying the blockchain Detailed documentation for each API endpoint, including descriptions of input and output parameters
- viewing, creating and managing wallets
- sending chia, cats, nfts
- creating offers for chia, cats and nfts
- exploring the blockchain
- managing datalayer
- managing simulator
- Minting NFTs
- Creating CATs
Requirements
.NET 6 or higher
Installation
To install this library from the repository, simply clone the repository and open the solution file in Visual Studio. You can then build the solution and reference the compiled library in your own C# projects.
Alternatively, you can install the library from NuGet as described above.
Usage
Note: Per default, chia rpc will only listen to requests from the local machine.
If you have remote machines to manage, eg a full node or farmers, you need to enable public port listening.
For that, edit the chia configuration (default at ~/.chia/mainnet/config/config.yaml
).
Look for a line starting with self-hostname like so: self_hostname: &self_hostname "localhost"
change it to: self_hostname: 0.0.0.0
to listen on all interfaces or to the local interface ip to listen on a specific interface.
To use the Chia Client API in your C# applications, you will need to create an instance of the ChiaClient class and pass in your API key:
using ChiaClientAPI;
var client = new ChiaClient("your_api_key");
You can then call any of the API endpoints by calling the corresponding method on the client object. For example, to get the balance of an account, you can use the GetBalance method:
var balance = client.GetBalance("your_account_id");
Console.WriteLine(balance);
Refer to the documentation for specific usage instructions for each API endpoint.
Creating a cat offer
this is how you offer Cat vs chia:
CatGetAssetId_Response assetId = Testnet_Wallet.Wallet_Client.CatGetAssetID_Sync(new WalletID_RPC(wallet.id));
CreateOfferForIds_RPC offer_rpc = new CreateOfferForIds_RPC();
offer_rpc.offer.Add("1", -50000); // you want to give 500000 mojos
offer_rpc.offer.Add(assetId.asset_id, 500); // you want to receive 0.5 of asset x
OfferFile offer = Testnet_Wallet.Wallet_Client.CreateOfferForIds_Sync(offer_rpc);
offer.Export("btftestoffer");
note you can also give amounts in decimal chia (note that 1 cat is normally 1000 mojos so mind the conversion there)
offer_rpc.AddOfferPosition("1", -0.005); // you want to give 500000 mojos
Contributing
We welcome contributions to this repository! If you have suggestions for improvements or new features, please open an issue or submit a pull request.
License
This library is licensed under the MIT License. Please see the LICENSE file for more information.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
-
net6.0
- CHIA-RPC (>= 1.8.1.16)
- System.Net.Http.Json (>= 7.0.0)
-
net7.0
- CHIA-RPC (>= 1.8.1.16)
- System.Net.Http.Json (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.2.0.18 | 107 | 6/11/2024 |
2.2.0.17 | 143 | 3/13/2024 |
2.2.0.14 | 111 | 3/5/2024 |
2.2.0 | 107 | 3/1/2024 |
2.1.3 | 193 | 12/21/2023 |
2.1.1.10 | 150 | 12/8/2023 |
2.1.1.9 | 151 | 11/26/2023 |
2.1.1.8 | 134 | 11/15/2023 |
2.1.1.7 | 113 | 11/15/2023 |
2.1.1.6 | 129 | 11/9/2023 |
2.1.1.4 | 142 | 10/20/2023 |
2.1.1 | 149 | 10/13/2023 |
2.0.1 | 151 | 10/5/2023 |
2.0.0.1 | 157 | 8/31/2023 |
2.0.0 | 153 | 8/28/2023 |
1.8.2.13 | 167 | 8/22/2023 |
1.8.2.12 | 134 | 8/22/2023 |
1.8.2.5 | 178 | 8/10/2023 |
1.8.2.4 | 153 | 8/9/2023 |
1.8.2.3 | 168 | 8/9/2023 |
1.8.2.2 | 153 | 8/9/2023 |
1.8.2.1 | 160 | 8/9/2023 |
1.8.2 | 157 | 7/26/2023 |
1.8.1.16 | 147 | 6/26/2023 |
1.8.1.15 | 157 | 6/23/2023 |
1.8.1.14 | 136 | 6/22/2023 |
1.8.1.13 | 138 | 6/22/2023 |
1.8.1.12 | 140 | 6/22/2023 |
1.8.1.11 | 139 | 6/22/2023 |
1.8.1.10 | 142 | 6/22/2023 |
1.8.1.9 | 157 | 6/21/2023 |
1.8.1.8 | 170 | 6/14/2023 |
1.8.1.7 | 145 | 6/14/2023 |
1.8.1.6 | 178 | 6/12/2023 |
1.8.1.5 | 164 | 6/9/2023 |
1.8.1.4 | 155 | 6/9/2023 |
1.8.1.3 | 159 | 6/9/2023 |
1.8.1.2 | 162 | 6/7/2023 |
1.8.1.1 | 156 | 6/7/2023 |
1.8.1 | 161 | 6/2/2023 |
1.8.0 | 178 | 5/11/2023 |
1.7.1 | 196 | 4/21/2023 |
1.6.2.14 | 296 | 2/8/2023 |
1.6.2.13 | 261 | 2/8/2023 |
1.6.2.12 | 277 | 2/5/2023 |
1.6.2.10 | 295 | 1/31/2023 |
1.6.2.9 | 268 | 1/31/2023 |
1.6.2.8 | 296 | 1/28/2023 |
1.6.2.7 | 301 | 1/26/2023 |
1.6.2.6 | 306 | 1/25/2023 |
1.6.2.5 | 288 | 1/24/2023 |
1.6.2.4 | 291 | 1/17/2023 |
1.6.2.3 | 296 | 1/16/2023 |
1.6.2.2 | 297 | 1/15/2023 |
1.6.2.1 | 301 | 1/13/2023 |
1.6.2 | 312 | 1/12/2023 |
1.6.1.6 | 299 | 1/11/2023 |
1.6.1.5 | 305 | 1/11/2023 |
1.6.1.4 | 306 | 1/11/2023 |
1.6.1.3 | 325 | 1/10/2023 |
1.6.1.1 | 315 | 12/29/2022 |
1.6.1 | 308 | 12/29/2022 |
1.8.1.16: added implicit conversion and critical bug workaround
- added a workaround where the getTransactions endpoint returns an amount of 0 in an unknown circumstance. In this unexpected case, the application would crash when calling GetPrimaryCoin on the transaction.
Now returns the first coin if acount is 0 but coins are specified
- added an implicit conversion from TradeRecord to GetOffer
1.8.1.15: fixed critical bug introduced in 1.8.1.11
- fixed critical bug in 1.8.1.11 where I thought fee (in mojos) would be of type ulong. But its decimal o.O
- removed old GestStandardTransactionFeeEstimate (Use GetFeeEstimate instead)
- improvement on GetFeeEstimate_RPC (changed from explicit to implicit operator)
- improvements for unit tests
1.8.1.14: File handling fixed
- Wrote unit test for file handling. The naming when offering a FileInfo is now actually fixed.
1.8.1.13: Fix for RPC file extension
- Fixed the file naming if the file path was specified with a '.' as an extension.
1.8.12: Hotfix for offers
- Offers do not get updated when modifying offers_in_xch (added workaround. .NET issue).
1.8.1.11: GetFeeEstimate improvements
- Improvements on XML documentation.
- Added explicit conversion so that the API can be called directly with a DateTime.
- Fixed a fee value which was displayed in decimal rather than ulong.
- Returned time array can now also be viewed in TimeSpan.
1.8.1.10: Convenience upgrades
- Added overloads so that files can now be loaded and exported with FileInfo.
- Added an implicit conversion to GetCatOfferSummary.
- Added constructor to GetFeeEstimate which accepts a single Time rather than an array.
- Slight improvement in GetFeeEstimate_RPC Documentation.
1.8.1.9: Hotfix and offering improvements
- Added null value hotfix.
- Improved XML coded documentation for offers.
- Added unit test for offer creation.
- Improved constructor for offerings.
- Improved cancel offers endpoint.
1.8.1.8: Hotfix
- Hotfix for 1.8.1.7 null reference issue.
1.8.1.7: Allow decimal
- This is a rather big update which adds decimal properties to many endpoints. These decimal properties allow to read/write amounts in XCH rather than having to manually do the conversion to mojos.
1.8.1.6: Improve Transaction and response classes
- Added functionality to obtain primary coin from transaction (please test this!!!)
- Reworked objects and code to include the raw request answer data.
1.8.1.5: Improve wait for transaction code
- Renamed wallet API to confirm.
- Created full node API to wait for coin creation (this should really await transaction completeness).
- Added an implicit conversion for the checkers.
- Added TimeSpan code for the await.
1.8.1.4: Improve SendTransaction_RPC
- Added a global variable in General_NS.GlobalVar which specifies the amount of mojos which make up one chia.
- Improved constructor of SendTransaction_RPC to allow for different combinations of ulong (mojos) and double (XCH) for amount and fee.
1.8.1.3: Improve Constructor for SendTransaction_RPC
- Now has default null values which can be left blank.
1.8.1.2: Improvements to GetFeeEstimate
- Minor documentation typo fix.
- Fixed either/or condition in a class.
- Major improvement for GetFeeEstimates constructor now properly reflecting either spend or cost condition and adding standard chia transaction value, hence making `GetStandardTransactionFeeEstimate` obsolete.
- Added property to `GetFeeEstimate_Response` which displays fee in full chia fraction rather than in Mojos.
1.8.1.1: The updates are mostly in Chia-RPC. This update ensures compatibility with Chia-RPC 1.8.1.1 and brings the following improvements:
- Major documentation update.
- Added constructors to all RPC endpoints.
- A few minor bugfixes.
- Added further implicit conversions.