For the complete documentation index, see llms.txt. This page is also available as Markdown.

Go

The Go SDK is the Go client for the antd daemon.

Install

go get github.com/WithAutonomi/ant-sdk/antd-go

Connect to the daemon

package main

import (
    "context"
    "fmt"

    antd "github.com/WithAutonomi/ant-sdk/antd-go"
)

func main() {
    client := antd.NewClient(antd.DefaultBaseURL)
    ctx := context.Background()

    health, err := client.Health(ctx)
    if err != nil {
        panic(err)
    }
    fmt.Println(health.OK)

    discoveredClient, url := antd.NewClientAutoDiscover()
    _ = discoveredClient
    fmt.Println(url)
}

The SDK also includes a GrpcClient for the daemon's gRPC endpoint.

Store and retrieve data

For upload examples in this section, start antd in a write-enabled mode first. On the default network, that means wallet plus EVM payment configuration. On a local devnet, ant dev start provisions that for you.

Type mappings

Autonomi type
Go type

HealthStatus

antd.HealthStatus

PutResult

antd.PutResult for chunk writes

DataPutPublicResult

antd.DataPutPublicResult

DataPutResult

antd.DataPutResult

FilePutPublicResult

antd.FilePutPublicResult

FilePutResult

antd.FilePutResult

PaymentMode

antd.PaymentMode

UploadCostEstimate

antd.UploadCostEstimate

WalletAddress

antd.WalletAddress

WalletBalance

antd.WalletBalance

PrepareUploadResult

antd.PrepareUploadResult

FinalizeUploadResult

antd.FinalizeUploadResult

PrepareChunkResult

antd.PrepareChunkResult

Raw data

[]byte

PrepareChunkResult is returned by PrepareChunkUpload. When AlreadyStored is true, only Address and AlreadyStored are populated and there is no payment to make or finalize call to issue. Otherwise, UploadID, Payments, and TotalAmount describe the external-signer payment required before calling FinalizeChunkUpload. Requires antd 0.7.0 or later.

Error handling

Full API reference

For all available daemon endpoints, see the REST API.

Last updated