You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cd antd-csharp
# Build all projects (SDK, examples, tests)
dotnet build Antd.sln
# Or build individual projects
dotnet build Antd.Sdk/Antd.Sdk.csproj
Quick Start
usingSystem.Text;usingAntd.Sdk;usingvarclient=AntdClient.CreateRest();// Health checkvarstatus=awaitclient.HealthAsync();Console.WriteLine($"{status.Network} — healthy: {status.Ok}");// Store and retrieve datavarresult=awaitclient.DataPutPublicAsync(Encoding.UTF8.GetBytes("Hello, Autonomi!"));Console.WriteLine($"Address: {result.Address}, Cost: {result.Cost}");vardata=awaitclient.DataGetPublicAsync(result.Address);Console.WriteLine(Encoding.UTF8.GetString(data));
Client Creation
usingAntd.Sdk;// REST transport (default)usingvarclient=AntdClient.CreateRest(baseUrl:"http://localhost:8082",timeout:TimeSpan.FromSeconds(30));// gRPC transport (wallet operations and payment_mode are REST-only)usingvargrpcClient=AntdClient.CreateGrpc(target:"http://localhost:50051");// Factory method (transport string)usingvarauto=AntdClient.Create(transport:"rest");
API Reference
All methods are async and return Task<T>. The client implements IDisposable.
usingAntd.Sdk;try{vardata=awaitclient.DataGetPublicAsync("nonexistent");}catch(NotFoundException){Console.WriteLine("Data not found");}catch(PaymentException){Console.WriteLine("Insufficient funds");}catch(AntdExceptionex){Console.WriteLine($"Error ({ex.StatusCode}): {ex.Message}");}
Exception
HTTP
gRPC
Description
BadRequestException
400
INVALID_ARGUMENT
Invalid parameters
PaymentException
402
FAILED_PRECONDITION
Payment issue
NotFoundException
404
NOT_FOUND
Not found
AlreadyExistsException
409
ALREADY_EXISTS
Already exists
ForkException
409
ABORTED
Version conflict
TooLargeException
413
RESOURCE_EXHAUSTED
Too large
InternalException
500
INTERNAL
Server error
NetworkException
502
UNAVAILABLE
Unreachable
Examples
cd Examples
dotnet run -- 1 # Connect
dotnet run -- 2 # Public data
dotnet run -- 3 # Chunks
dotnet run -- 4 # Files
dotnet run -- 6 # Private data
dotnet run -- all # Run all
Or use the dev CLI:
ant dev example data -l csharp
ant dev example all -l csharp