# `Antd.GrpcClient`
[🔗](https://gitlab.com/autonomi/ant-sdk/-/tree/main/antd-elixir/blob/main/lib/antd/grpc_client.ex#L1)

gRPC client for the antd daemon.

Provides the same functions as `Antd.Client` (REST), but communicates over
gRPC using the proto-generated modules from `antd/v1/*.proto`.

All public functions return `{:ok, result}` or `{:error, exception}`.
Bang variants (e.g. `health!/1`) raise on error.

## Naming convention

Private = unqualified verb. Public = `_public` suffix. See `Antd.Client`
for full details.

## Proto compilation

The generated modules under `lib/antd/v1/` are committed; regenerate them
with `scripts/generate-protos.sh`, which pins protoc-gen-elixir and lists
the protos this SDK ships stubs for.

## Pointers

The `pointer_*` functions mirror `Antd.Client`'s, each with a `:timeout`
option (milliseconds, default 5 minutes). Every write pays, and every
attempt pays again, so they never retry and callers should not either.
Errors that share a gRPC status with older ones are told apart by the
daemon's `x-antd-error-code` metadata, trusted only when it agrees with the
status code.

# `t`

```elixir
@type t() :: %Antd.GrpcClient{channel: GRPC.Channel.t() | nil, target: String.t()}
```

# `auto_discover`

```elixir
@spec auto_discover() :: {:ok, t(), String.t()} | {:error, Exception.t()}
```

Creates a gRPC client using port discovery.

Reads the daemon.port file to find the gRPC port. Falls back to the
default target if the port file is not found.

## Examples

    {:ok, client, target} = Antd.GrpcClient.auto_discover()

# `build_manifest`

```elixir
@spec build_manifest(t(), [Antd.ManifestEntryInput.t()], keyword()) ::
  {:ok, Antd.BuiltManifest.t()} | {:error, Exception.t()}
```

Builds a `.ant` manifest from DataMaps and public addresses already in
hand. Mirrors `Antd.Client.build_manifest/3`, including its entry check
before sending; an entry the daemon rejects (`INVALID_ARGUMENT`) is an
`Antd.BadRequestError` whose message names `entries[i]`. Nothing is
uploaded or paid for.

## Options

  * `:name`, `:torrent_info_hashes`, `:embed_roots` (default `true`) — as
    for `Antd.Client.build_manifest/3`.
  * `:timeout` — call timeout in milliseconds (default 300_000).

# `build_manifest!`

```elixir
@spec build_manifest!(t(), [Antd.ManifestEntryInput.t()], keyword()) ::
  Antd.BuiltManifest.t()
```

Like `build_manifest/3` but raises on error.

# `chunk_get`

```elixir
@spec chunk_get(t(), String.t()) :: {:ok, binary()} | {:error, Exception.t()}
```

Retrieves a chunk by address.

# `chunk_get!`

```elixir
@spec chunk_get!(t(), String.t()) :: binary()
```

Like `chunk_get/2` but raises on error.

# `chunk_put`

```elixir
@spec chunk_put(t(), binary()) :: {:ok, Antd.PutResult.t()} | {:error, Exception.t()}
```

Stores a raw chunk on the network.

# `chunk_put!`

```elixir
@spec chunk_put!(t(), binary()) :: Antd.PutResult.t()
```

Like `chunk_put/2` but raises on error.

# `data_cost`

```elixir
@spec data_cost(t(), binary(), keyword()) ::
  {:ok, Antd.UploadCostEstimate.t()} | {:error, Exception.t()}
```

Pre-upload cost breakdown for the given bytes.

## Options

  * `:payment_mode` — `Antd.PaymentMode.t()` (default `:auto`).

# `data_cost!`

```elixir
@spec data_cost!(t(), binary(), keyword()) :: Antd.UploadCostEstimate.t()
```

Like `data_cost/3` but raises on error.

# `data_get`

```elixir
@spec data_get(t(), String.t()) :: {:ok, binary()} | {:error, Exception.t()}
```

Retrieves private data using a caller-held DataMap.

# `data_get!`

```elixir
@spec data_get!(t(), String.t()) :: binary()
```

Like `data_get/2` but raises on error.

# `data_get_public`

```elixir
@spec data_get_public(t(), String.t()) :: {:ok, binary()} | {:error, Exception.t()}
```

Retrieves public data by address.

# `data_get_public!`

```elixir
@spec data_get_public!(t(), String.t()) :: binary()
```

Like `data_get_public/2` but raises on error.

# `data_put`

```elixir
@spec data_put(t(), binary(), keyword()) ::
  {:ok, Antd.DataPutResult.t()} | {:error, Exception.t()}
```

Stores private encrypted data on the network.

## Options

  * `:payment_mode` — `Antd.PaymentMode.t()` (default `:auto`).

# `data_put!`

```elixir
@spec data_put!(t(), binary(), keyword()) :: Antd.DataPutResult.t()
```

Like `data_put/3` but raises on error.

# `data_put_public`

```elixir
@spec data_put_public(t(), binary(), keyword()) ::
  {:ok, Antd.DataPutPublicResult.t()} | {:error, Exception.t()}
```

Stores public data on the network.

## Options

  * `:payment_mode` — `Antd.PaymentMode.t()` (default `:auto`).

# `data_put_public!`

```elixir
@spec data_put_public!(t(), binary(), keyword()) :: Antd.DataPutPublicResult.t()
```

Like `data_put_public/3` but raises on error.

# `data_stream`

```elixir
@spec data_stream(t(), String.t()) :: {:ok, Enumerable.t()} | {:error, Exception.t()}
```

Streams private data from a caller-held DataMap, one decrypt batch at a time,
instead of buffering the whole object. The gRPC counterpart to `data_get/2`
and mirror of the REST client's `data_stream/2`.

On success returns `{:ok, enumerable}` where enumerating yields binary chunks;
concatenate or write them as they arrive, e.g.

    {:ok, stream} = Antd.GrpcClient.data_stream(client, data_map)
    Enum.into(stream, File.stream!("out.bin"))

A mid-stream gRPC error is raised as the translated exception while the
enumerable is consumed.

# `data_stream!`

```elixir
@spec data_stream!(t(), String.t()) :: Enumerable.t()
```

Like `data_stream/2` but raises on error.

# `data_stream_public`

```elixir
@spec data_stream_public(t(), String.t()) ::
  {:ok, Enumerable.t()} | {:error, Exception.t()}
```

Streams public data by address — the gRPC counterpart to `data_get_public/2`.
Same `{:ok, enumerable}` of binary chunks contract as `data_stream/2`.

# `data_stream_public!`

```elixir
@spec data_stream_public!(t(), String.t()) :: Enumerable.t()
```

Like `data_stream_public/2` but raises on error.

# `data_stream_public_with_progress`

```elixir
@spec data_stream_public_with_progress(t(), String.t()) ::
  {:ok, Enumerable.t()} | {:error, Exception.t()}
```

`data_stream_public/2` with interleaved fetch-progress frames. See
`data_stream_with_progress/2`.

# `data_stream_public_with_progress!`

```elixir
@spec data_stream_public_with_progress!(t(), String.t()) :: Enumerable.t()
```

Like `data_stream_public_with_progress/2` but raises on error.

# `data_stream_with_progress`

```elixir
@spec data_stream_with_progress(t(), String.t()) ::
  {:ok, Enumerable.t()} | {:error, Exception.t()}
```

`data_stream/2` with interleaved fetch-progress frames so the caller can drive
a *determinate* download progress bar. Sets the request's `include_progress`
flag; enumerating the returned stream yields `Antd.DownloadFrame` structs —
each a plaintext chunk (`:data`) or a `Antd.DownloadProgress` update
(`:progress`). The byte denominator arrives separately as the
`x-content-length` response header.

    {:ok, frames} = Antd.GrpcClient.data_stream_with_progress(client, data_map)
    Enum.each(frames, fn
      %Antd.DownloadFrame{progress: %{} = p} -> render_bar(p.fetched, p.total)
      %Antd.DownloadFrame{data: bytes} -> IO.binwrite(bytes)
    end)

# `data_stream_with_progress!`

```elixir
@spec data_stream_with_progress!(t(), String.t()) :: Enumerable.t()
```

Like `data_stream_with_progress/2` but raises on error.

# `decode_manifest`

```elixir
@spec decode_manifest(t(), binary(), keyword()) ::
  {:ok, Antd.DecodedManifest.t()} | {:error, Exception.t()}
```

Decodes `.ant` bytes (a raw binary). Mirrors
`Antd.Client.decode_manifest/3`.

## Options

  * `:resolve` — as for `Antd.Client.decode_manifest/3` (default `false`).
  * `:timeout` — call timeout in milliseconds (default 300_000).

# `decode_manifest!`

```elixir
@spec decode_manifest!(t(), binary(), keyword()) :: Antd.DecodedManifest.t()
```

Like `decode_manifest/3` but raises on error.

# `decode_manifest_link`

```elixir
@spec decode_manifest_link(t(), String.t(), keyword()) ::
  {:ok, Antd.DecodedManifest.t()} | {:error, Exception.t()}
```

Decodes an `ant://` manifest link, a file link or a bare 64-hex address.
Mirrors `Antd.Client.decode_manifest_link/3`; takes the same options as
`decode_manifest/3`.

# `decode_manifest_link!`

```elixir
@spec decode_manifest_link!(t(), String.t(), keyword()) :: Antd.DecodedManifest.t()
```

Like `decode_manifest_link/3` but raises on error.

# `file_cost`

```elixir
@spec file_cost(t(), String.t(), boolean(), keyword()) ::
  {:ok, Antd.UploadCostEstimate.t()} | {:error, Exception.t()}
```

Pre-upload cost breakdown for the file at `path`.

## Options

  * `:payment_mode` — `Antd.PaymentMode.t()` (default `:auto`).

# `file_cost!`

```elixir
@spec file_cost!(t(), String.t(), boolean(), keyword()) :: Antd.UploadCostEstimate.t()
```

Like `file_cost/4` but raises on error.

# `file_get`

```elixir
@spec file_get(t(), String.t(), String.t()) :: :ok | {:error, Exception.t()}
```

Downloads a private file from a caller-held DataMap into `dest_path`.

# `file_get!`

```elixir
@spec file_get!(t(), String.t(), String.t()) :: :ok
```

Like `file_get/3` but raises on error.

# `file_get_public`

```elixir
@spec file_get_public(t(), String.t(), String.t()) :: :ok | {:error, Exception.t()}
```

Downloads a public file from the network to a local path.

# `file_get_public!`

```elixir
@spec file_get_public!(t(), String.t(), String.t()) :: :ok
```

Like `file_get_public/3` but raises on error.

# `file_put`

```elixir
@spec file_put(t(), String.t(), keyword()) ::
  {:ok, Antd.FilePutResult.t()} | {:error, Exception.t()}
```

Uploads a local file privately.

## Options

  * `:payment_mode` — `Antd.PaymentMode.t()` (default `:auto`).

# `file_put!`

```elixir
@spec file_put!(t(), String.t(), keyword()) :: Antd.FilePutResult.t()
```

Like `file_put/3` but raises on error.

# `file_put_public`

```elixir
@spec file_put_public(t(), String.t(), keyword()) ::
  {:ok, Antd.FilePutPublicResult.t()} | {:error, Exception.t()}
```

Uploads a local file publicly.

## Options

  * `:payment_mode` — `Antd.PaymentMode.t()` (default `:auto`).

# `file_put_public!`

```elixir
@spec file_put_public!(t(), String.t(), keyword()) :: Antd.FilePutPublicResult.t()
```

Like `file_put_public/3` but raises on error.

# `finalize_chunk_upload`

```elixir
@spec finalize_chunk_upload(t(), String.t(), map()) ::
  {:ok, String.t()} | {:error, Exception.t()}
```

Submits a prepared chunk after external payment. Returns the on-network
address of the stored chunk (matches `PrepareChunkResult.address`).

# `finalize_chunk_upload!`

```elixir
@spec finalize_chunk_upload!(t(), String.t(), map()) :: String.t()
```

Like `finalize_chunk_upload/3` but raises on error.

# `finalize_merkle_upload`

```elixir
@spec finalize_merkle_upload(t(), String.t(), String.t(), keyword()) ::
  {:ok, Antd.FinalizeUploadResult.t()} | {:error, Exception.t()}
```

Finalizes a merkle-batch upload after the external signer has submitted
the `payForMerkleTree2()` transaction. `winner_pool_hash` is the
bytes32 from the `MerklePaymentMade` event (hex with `0x` prefix).

A partial store surfaces as `{:error, %Antd.PartialUploadError{}}` exactly
as for `finalize_upload/3`, with the same three cases: retry the same call
(bounded) while `retryable` is `true`; re-prepare the same content only
when `retention_known` is `true` and `retryable` is `false` (for example a
merkle finalize with deliberately unpaid batches); and when
`retention_known` is `false`, stop, keep `upload_id` and
`winner_pool_hash`, and reconcile before re-preparing or paying again.

## Options

  * `:store_data_map` — legacy daemon-wallet path; when `true`, the
    daemon stores the DataMap on-network and returns its address.
    Prefer `:visibility => "public"` on prepare for the public-DataMap
    case. Omitting the option leaves the proto3 default of `false`.

# `finalize_merkle_upload!`

```elixir
@spec finalize_merkle_upload!(t(), String.t(), String.t(), keyword()) ::
  Antd.FinalizeUploadResult.t()
```

Like `finalize_merkle_upload/4` but raises on error.

# `finalize_upload`

```elixir
@spec finalize_upload(t(), String.t(), map()) ::
  {:ok, Antd.FinalizeUploadResult.t()} | {:error, Exception.t()}
```

Finalizes a wave-batch upload after an external signer has submitted
the `payForQuotes()` transactions. `tx_hashes` maps each `quote_hash`
from the prepare result to its on-chain `tx_hash`.

A finalize that stored only part of the upload returns
`{:error, %Antd.PartialUploadError{}}` (gRPC `ABORTED` whose message
starts with `Partial upload:`; this used to be a plain `Antd.AntdError`,
as any other `ABORTED` still is) carrying `chunks_stored`, `chunks_failed`,
`total_chunks`, `retryable` and `retention_known`, parsed from the status
message: `retention_known` is `true` only when the counts parse and the
message ends with one of the daemon's two closing hints, which then
decides `retryable` ("paid attempt retained" sets it; "stored chunks
persist; re-prepare the same content" means nothing was retained).
Readable counts with a missing, truncated or unrecognised hint keep the
counts but read as retention unknown. The payment persists and the stored
chunks stay on the network. Recovery has three cases:

  * `retryable: true` (antd >= 0.14.0) — the daemon kept the paid attempt
    under the same `upload_id`: call this function again with the same
    arguments to store the remainder against the same payment. Bound that
    loop (cap the attempts; a `chunks_failed` that stops shrinking means
    stuck).
  * `retention_known: true, retryable: false` — the daemon confirmed it
    kept nothing: re-prepare the same content (already-stored chunks are
    skipped, so the retry pays only for the remainder).
  * `retention_known: false` — the status message's counts or closing
    hint could not be read, so retention is unknown and the daemon may
    still hold the paid attempt. Stop automatic recovery, keep `upload_id`
    and `tx_hashes`, and reconcile before re-preparing or paying again.

See `Antd.PartialUploadError`, `docs/external-signer-flow.md` §6 and
`examples/07_external_signer.exs`.

# `finalize_upload!`

```elixir
@spec finalize_upload!(t(), String.t(), map()) :: Antd.FinalizeUploadResult.t()
```

Like `finalize_upload/3` but raises on error.

# `health`

```elixir
@spec health(t()) :: {:ok, Antd.HealthStatus.t()} | {:error, Exception.t()}
```

Checks the antd daemon status.

# `health!`

```elixir
@spec health!(t()) :: Antd.HealthStatus.t()
```

Like `health/1` but raises on error.

# `new`

```elixir
@spec new(String.t()) :: {:ok, t()} | {:error, Exception.t()}
```

Creates a new gRPC client and opens a channel to the daemon.

## Examples

    {:ok, client} = Antd.GrpcClient.new()
    {:ok, client} = Antd.GrpcClient.new("localhost:50051")

# `new!`

```elixir
@spec new!(String.t()) :: t()
```

Like `new/1` but raises on error.

# `pointer_controller`

```elixir
@spec pointer_controller(t(), String.t(), keyword()) ::
  {:ok, Antd.PointerController.t()} | {:error, Exception.t()}
```

Follows the transfers of the pointer at `address` to the pointer whose
owner now decides what it resolves to. Mirrors
`Antd.Client.pointer_controller/2`.

## Options

  * `:timeout` — call timeout in milliseconds (default 300_000).

# `pointer_controller!`

```elixir
@spec pointer_controller!(t(), String.t(), keyword()) :: Antd.PointerController.t()
```

Like `pointer_controller/3` but raises on error.

# `pointer_create`

```elixir
@spec pointer_create(t(), String.t(), String.t(), keyword()) ::
  {:ok, Antd.PointerWriteResult.t()} | {:error, Exception.t()}
```

Creates the pointer at `owner`, pointing at `target`, paid by the daemon
wallet. Mirrors `Antd.Client.pointer_create/4`: `Antd.AlreadyExistsError`
if it exists, refused before paying. **Each call pays**: do not retry it
automatically.

## Options

  * `:kind` — `t:Antd.PointerKind.t/0` (`:chunk`, the daemon's default, or
    `:pointer`).
  * `:timeout` — call timeout in milliseconds (default 300_000).

# `pointer_create!`

```elixir
@spec pointer_create!(t(), String.t(), String.t(), keyword()) ::
  Antd.PointerWriteResult.t()
```

Like `pointer_create/4` but raises on error.

# `pointer_finality`

```elixir
@spec pointer_finality(t(), String.t(), keyword()) ::
  {:ok, Antd.PointerFinality.t()} | {:error, Exception.t()}
```

Asks the whole close group where the pointer at `address` stands. Mirrors
`Antd.Client.pointer_finality/2`; an unset counter, state or majority (an
empty string or absent message on the wire) reads as `nil`.

## Options

  * `:timeout` — call timeout in milliseconds (default 300_000).

# `pointer_finality!`

```elixir
@spec pointer_finality!(t(), String.t(), keyword()) :: Antd.PointerFinality.t()
```

Like `pointer_finality/3` but raises on error.

# `pointer_finalize`

```elixir
@spec pointer_finalize(t(), String.t(), map(), keyword()) ::
  {:ok, Antd.PointerFinalizeResult.t()} | {:error, Exception.t()}
```

Stores a prepared pointer write once its external signer has paid.
Mirrors `Antd.Client.pointer_finalize/3`: an
`Antd.CloseGroupShortfallError` with `retryable: true` (read from the
message's closing `(paid attempt retained...)` hint) means the daemon kept
the paid state; repeat the call with the same `upload_id`, bounded. This
function never retries by itself.

## Options

  * `:timeout` — call timeout in milliseconds (default 300_000).

# `pointer_finalize!`

```elixir
@spec pointer_finalize!(t(), String.t(), map(), keyword()) ::
  Antd.PointerFinalizeResult.t()
```

Like `pointer_finalize/4` but raises on error.

# `pointer_get`

```elixir
@spec pointer_get(t(), String.t(), keyword()) ::
  {:ok, Antd.PointerRecord.t()} | {:error, Exception.t()}
```

Reads the pointer at `address`. Mirrors `Antd.Client.pointer_get/2`:
`Antd.NotFoundError` if there is none.

## Options

  * `:timeout` — call timeout in milliseconds (default 300_000).

# `pointer_get!`

```elixir
@spec pointer_get!(t(), String.t(), keyword()) :: Antd.PointerRecord.t()
```

Like `pointer_get/3` but raises on error.

# `pointer_keys`

```elixir
@spec pointer_keys(t(), keyword()) :: {:ok, [String.t()]} | {:error, Exception.t()}
```

Lists the pointers this daemon holds owner keys for, as their addresses.
Mirrors `Antd.Client.pointer_keys/1`.

## Options

  * `:timeout` — call timeout in milliseconds (default 300_000).

# `pointer_keys!`

```elixir
@spec pointer_keys!(t(), keyword()) :: [String.t()]
```

Like `pointer_keys/2` but raises on error.

# `pointer_prepare`

```elixir
@spec pointer_prepare(t(), String.t(), Antd.PointerOp.t(), keyword()) ::
  {:ok, Antd.PointerPrepareResult.t()} | {:error, Exception.t()}
```

Has the daemon sign `op` on the pointer at `owner` and quote it for an
external signer. Mirrors `Antd.Client.pointer_prepare/4`; `op` is an
`t:Antd.PointerOp.t/0`.

## Options

  * `:include_signed_quotes` — when `true`, the result's `signed_quotes`
    carries each quote in full signed form (base64, as over REST).
  * `:timeout` — call timeout in milliseconds (default 300_000).

# `pointer_prepare!`

```elixir
@spec pointer_prepare!(t(), String.t(), Antd.PointerOp.t(), keyword()) ::
  Antd.PointerPrepareResult.t()
```

Like `pointer_prepare/4` but raises on error.

# `pointer_resolve`

```elixir
@spec pointer_resolve(t(), String.t(), keyword()) ::
  {:ok, Antd.PointerTarget.t()} | {:error, Exception.t()}
```

Follows a chain of pointers from `address` to the target at its end.
Mirrors `Antd.Client.pointer_resolve/2`.

## Options

  * `:timeout` — call timeout in milliseconds (default 300_000).

# `pointer_resolve!`

```elixir
@spec pointer_resolve!(t(), String.t(), keyword()) :: Antd.PointerTarget.t()
```

Like `pointer_resolve/3` but raises on error.

# `pointer_transfer`

```elixir
@spec pointer_transfer(t(), String.t(), String.t(), keyword()) ::
  {:ok, Antd.PointerTransferResult.t()} | {:error, Exception.t()}
```

Hands the pointer at `owner` over to the pointer at `recipient`, for good,
paid by the daemon wallet. Mirrors `Antd.Client.pointer_transfer/3`.
Irreversible once stored. **Each call pays**: do not retry it
automatically.

## Options

  * `:timeout` — call timeout in milliseconds (default 300_000).

# `pointer_transfer!`

```elixir
@spec pointer_transfer!(t(), String.t(), String.t(), keyword()) ::
  Antd.PointerTransferResult.t()
```

Like `pointer_transfer/4` but raises on error.

# `pointer_update`

```elixir
@spec pointer_update(t(), String.t(), String.t(), keyword()) ::
  {:ok, Antd.PointerWriteResult.t()} | {:error, Exception.t()}
```

Points the pointer at `owner` at `target`, paid by the daemon wallet,
creating it if it does not exist. Mirrors `Antd.Client.pointer_update/4`:
`Antd.PointerFinalError` once it was transferred or frozen (usually refused
before paying), and `Antd.ConflictError` if a prepared write awaits payment
(refused before paying) or the update lost to a newer state (possibly after
paying). **Each call pays**: do not retry it automatically. Takes the same
options as `pointer_create/4`.

# `pointer_update!`

```elixir
@spec pointer_update!(t(), String.t(), String.t(), keyword()) ::
  Antd.PointerWriteResult.t()
```

Like `pointer_update/4` but raises on error.

# `prepare_chunk_upload`

```elixir
@spec prepare_chunk_upload(t(), binary()) ::
  {:ok, Antd.PrepareChunkResult.t()} | {:error, Exception.t()}
```

Prepares a single-chunk publish for external signing.

Returns either `already_stored: true` (no payment needed, no finalize
call required) or a wave-batch payment intent the external signer must
execute before calling `finalize_chunk_upload/3`.

# `prepare_chunk_upload!`

```elixir
@spec prepare_chunk_upload!(t(), binary()) :: Antd.PrepareChunkResult.t()
```

Like `prepare_chunk_upload/2` but raises on error.

# `prepare_data_upload`

```elixir
@spec prepare_data_upload(t(), binary(), keyword()) ::
  {:ok, Antd.PrepareUploadResult.t()} | {:error, Exception.t()}
```

Prepares an in-memory data upload for external signing.

## Options

  * `:visibility` — see `prepare_upload/3`.

# `prepare_data_upload!`

```elixir
@spec prepare_data_upload!(t(), binary(), keyword()) :: Antd.PrepareUploadResult.t()
```

Like `prepare_data_upload/3` but raises on error.

# `prepare_upload`

```elixir
@spec prepare_upload(t(), String.t(), keyword()) ::
  {:ok, Antd.PrepareUploadResult.t()} | {:error, Exception.t()}
```

Prepares a file upload for external signing.

## Options

  * `:visibility` — `"public"` bundles the DataMap chunk into the same
    external-signer payment batch so finalize returns its on-network
    address via `:data_map_address`. Omitting the option leaves the
    proto3 default of `""`, preserving the wire shape for daemons
    predating the public-prepare addition.

# `prepare_upload!`

```elixir
@spec prepare_upload!(t(), String.t(), keyword()) :: Antd.PrepareUploadResult.t()
```

Like `prepare_upload/3` but raises on error.

# `prepare_upload_public`

```elixir
@spec prepare_upload_public(t(), String.t()) ::
  {:ok, Antd.PrepareUploadResult.t()} | {:error, Exception.t()}
```

Convenience wrapper: prepare a *public* file upload for external signing.
Equivalent to `prepare_upload(client, path, visibility: "public")`.

# `prepare_upload_public!`

```elixir
@spec prepare_upload_public!(t(), String.t()) :: Antd.PrepareUploadResult.t()
```

Like `prepare_upload_public/2` but raises on error.

# `wallet_address`

```elixir
@spec wallet_address(t()) :: {:ok, Antd.WalletAddress.t()} | {:error, Exception.t()}
```

Returns the wallet's on-chain address.

# `wallet_address!`

```elixir
@spec wallet_address!(t()) :: Antd.WalletAddress.t()
```

Like `wallet_address/1` but raises on error.

# `wallet_approve`

```elixir
@spec wallet_approve(t()) :: {:ok, boolean()} | {:error, Exception.t()}
```

Approves the wallet to spend tokens on the payment vault contract.
One-time operation; idempotent at the contract level.

# `wallet_approve!`

```elixir
@spec wallet_approve!(t()) :: boolean()
```

Like `wallet_approve/1` but raises on error.

# `wallet_balance`

```elixir
@spec wallet_balance(t()) :: {:ok, Antd.WalletBalance.t()} | {:error, Exception.t()}
```

Returns the wallet's token + gas balances.

# `wallet_balance!`

```elixir
@spec wallet_balance!(t()) :: Antd.WalletBalance.t()
```

Like `wallet_balance/1` but raises on error.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
