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

WalletAddress

antd.WalletAddress

WalletBalance

antd.WalletBalance

PrepareUploadResult

antd.PrepareUploadResult

FinalizeUploadResult

antd.FinalizeUploadResult

Raw data

[]byte

Error handling

Full API reference

For all available daemon endpoints, see the REST API.

Last updated