EdjCase.ICP.ClientGenerator
2.1.1
See the version list below for details.
dotnet tool install --global EdjCase.ICP.ClientGenerator --version 2.1.1
dotnet new tool-manifest
dotnet tool install --local EdjCase.ICP.ClientGenerator --version 2.1.1
#tool dotnet:?package=EdjCase.ICP.ClientGenerator&version=2.1.1
nuke :add-package EdjCase.ICP.ClientGenerator --version 2.1.1
ICP.NET
Collection of Internet Computer Protocol (ICP) libraries for .NET/Blazor
Agent - Library to communicate to and from the Internet Computer
Candid - Library of Candid Encoding, Models and Helpers
Client Generator - Client source code generator for ICP canisters
Internet Identity (Experimental) - Internet Identity authenticater (experimental and not secure)
Quickstart
Creating a client for a canister
Prerequisite: Have .Net 6 installed (https://dotnet.microsoft.com/en-us/download/dotnet)
Navigate to directory of .Net project
cd {path/to/project}Add Agent nuget package to project
dotnet add package EdjCase.ICP.AgentInstall ClientGenerator
dotnet tool install -g EdjCase.ICP.ClientGeneratorThis will allow a client to be automatically be generated for a canister. See ClientGenerator README for more details and advanced config
Initialize ClientGenerator config (first run only)
candid-client-generator initThis will create a TOML config file in the directory that can be changed for more advanced options
Update created config file
candid-client.tomlIf using a canister id:
namespace = "ProjectGovernance" # Base namespace to use output-directory = "./Clients" # Output directory [[clients]] name = "Governance" # Label of client to use type = "canister" # Indicates to make client from a canister id canister-id = "rrkah-fqaaa-aaaaa-aaaaq-cai" # Canister id to make client forIf using a service definition file (.did)
namespace = "ProjectGovernance" # Base namespace to use output-directory = "./Clients" # Output directory [[clients]] name = "Governance" # Label of client to use type = "file" # Indicates to make client from a service definition file file-path = "Governance.did" # File to useFor all configuration options see ClientGenerator README for more details
Generate Client
candid-client-generator genWill output C# file to the output directory specified in the config
Use client in code
var agent = new HttpAgent(); Principal canisterId = Principal.FromText("rrkah-fqaaa-aaaaa-aaaaq-cai"); var client = new GovernanceApiClient(agent, canisterId); OptionalValue<Sample.Shared.Governance.Models.ProposalInfo> proposalInfo = await client.GetProposalInfo(110174); ...SHIP IT! 🚀
Candid Related Links
| 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 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 8.0.0-pre.1 | 175 | 3/18/2025 |
| 7.0.2 | 319 | 3/27/2025 |
| 7.0.1 | 270 | 2/4/2025 |
| 7.0.0 | 240 | 1/15/2025 |
| 7.0.0-rc.1 | 157 | 1/4/2025 |
| 7.0.0-pre.1 | 129 | 10/27/2024 |
| 6.2.1 | 285 | 10/23/2024 |
| 6.2.0 | 247 | 10/21/2024 |
| 6.1.2 | 302 | 4/30/2024 |
| 6.1.1 | 259 | 4/17/2024 |
| 6.1.0 | 293 | 4/15/2024 |
| 6.0.0 | 341 | 3/21/2024 |
| 5.1.0 | 376 | 1/25/2024 |
| 5.0.0 | 432 | 1/12/2024 |
| 5.0.0-pre.2 | 265 | 12/13/2023 |
| 5.0.0-pre.1 | 172 | 12/11/2023 |
| 4.1.0 | 562 | 11/10/2023 |
| 4.0.1 | 583 | 11/1/2023 |
| 4.0.0 | 548 | 10/12/2023 |
| 2.1.1 | 456 | 3/30/2023 |