REST client for the antd daemon.
All public functions take a %Antd.Client{} as the first argument and return
{:ok, result} or {:error, exception}. Bang variants (e.g. health!/1)
raise on error.
Naming convention
Private = unqualified verb (the DataMap is returned to the caller; it is
NOT stored on the network). Public = _public suffix (the DataMap is
additionally stored on-network and the call returns the resulting address).
data_put/data_get— privatedata_put_public/data_get_public— publicfile_put/file_get— privatefile_put_public/file_get_public— publicchunk_put/chunk_get— no public/private split
Payment mode
Put and cost methods that touch the network accept an optional
:payment_mode keyword argument — an atom (:auto, :merkle, :single)
from Antd.PaymentMode. The atom is serialized to the wire string at the
request boundary. :auto is the default.
Pointers
pointer_* functions read and write pointers: owner-signed, mutable
references whose owner keys the daemon holds. Every write
(pointer_create, pointer_update, pointer_transfer,
pointer_finalize) pays, and every attempt pays again, so this client
never retries them and callers should not either. Reads are free to retry.
Counters are integers parsed strictly from the daemon's decimal strings.
Summary
Functions
Creates a client using port discovery.
Builds a .ant manifest from DataMaps and public addresses already in hand
(POST /v1/manifests/build). Nothing is uploaded or paid for.
Like build_manifest/3 but raises on error.
Retrieves a chunk by address.
Like chunk_get/2 but raises on error.
Stores a raw chunk on the network.
Like chunk_put/2 but raises on error.
Pre-upload cost breakdown for the given bytes.
Like data_cost/3 but raises on error.
Retrieves private data using a caller-held DataMap (hex).
Like data_get/2 but raises on error.
Retrieves public data by address.
Like data_get_public/2 but raises on error.
Stores private encrypted data on the network.
Like data_put/3 but raises on error.
Stores public data on the network.
Like data_put_public/3 but raises on error.
Streams private data for a caller-held DataMap (hex) with constant memory.
Like data_stream/2 but raises on error.
Streams public data by address with constant memory.
Like data_stream_public/2 but raises on error.
data_stream_public/2 with interleaved fetch-progress frames. See
data_stream_with_progress/2.
Like data_stream_public_with_progress/2 but raises on error.
data_stream/2 with interleaved fetch-progress frames so the caller can drive
a determinate download progress bar. Opts into NDJSON framing (Accept: application/x-ndjson); enumerating the returned stream yields
Antd.DownloadFrame structs — each a plaintext chunk (:data) or a
Antd.DownloadProgress update (:progress).
Like data_stream_with_progress/2 but raises on error.
Decodes .ant bytes (a raw binary) via POST /v1/manifests/decode.
Returns an Antd.DecodedManifest; a malformed manifest is an
Antd.BadRequestError.
Like decode_manifest/3 but raises on error.
Decodes an ant:// manifest link, a file link or a bare 64-hex address via
POST /v1/manifests/decode. A file link or address reads as one public
entry with no path and source: "file_link". Takes the same :resolve
option as decode_manifest/3.
Like decode_manifest_link/3 but raises on error.
Estimates the cost of uploading a file.
Like file_cost/4 but raises on error.
Downloads a private file from a caller-held DataMap into dest_path.
Like file_get/3 but raises on error.
Downloads a public file from the network to a local path.
Like file_get_public/3 but raises on error.
Uploads a file privately. Returns the caller-held DataMap (hex) in the result — the DataMap is NOT stored on-network.
Like file_put/3 but raises on error.
Uploads a local file publicly.
Like file_put_public/3 but raises on error.
Submits a prepared chunk to the network after external payment via
POST /v1/chunks/finalize.
Like finalize_chunk_upload/3 but raises on error.
Finalizes a merkle-batch upload after selecting a winning pool.
Like finalize_merkle_upload/4 but raises on error.
Finalizes an upload after an external signer has submitted payment transactions.
Like finalize_upload/3 but raises on error.
Checks the antd daemon status.
Like health/1 but raises on error.
Creates a new client.
Follows the transfers of the pointer at address to the pointer whose
owner now decides what it resolves to
(GET /v1/pointers/{address}/controller).
Like pointer_controller/2 but raises on error.
Creates the pointer at owner, pointing at target, paid by the daemon
wallet (POST /v1/pointers). owner is the pointer's address; the daemon
must hold its key (pointer_keys/1).
Like pointer_create/4 but raises on error.
Asks the whole close group where the pointer at address stands
(GET /v1/pointers/{address}/finality). Check it before relying on a
transfer: only status: :final (Antd.PointerFinality.final?/1) means it
is beyond dispute.
Like pointer_finality/2 but raises on error.
Stores a prepared pointer write once its external signer has paid
(POST /v1/pointers/finalize). tx_hashes maps each quote_hash from the
prepare's payments to its payForQuotes() transaction hash.
Like pointer_finalize/3 but raises on error.
Reads the pointer at address (GET /v1/pointers/{address}). Returns
Antd.NotFoundError if there is none.
Like pointer_get/2 but raises on error.
Lists the pointers this daemon holds owner keys for (GET /v1/pointers/keys),
as their addresses. Only these can be written through this daemon.
Like pointer_keys/1 but raises on error.
Has the daemon sign op on the pointer at owner with its loaded key and
quote it for an external signer (POST /v1/pointers/prepare). Pay the
result's payments with payForQuotes(), then call pointer_finalize/3.
Needs no daemon wallet.
Like pointer_prepare/4 but raises on error.
Follows a chain of pointers from address to the target at its end
(GET /v1/pointers/{address}/resolve), through forwardings and transfers
alike. Returns Antd.NotFoundError if a pointer on the chain does not
exist.
Like pointer_resolve/2 but raises on error.
Hands the pointer at owner over to the pointer at recipient, for good,
paid by the daemon wallet (POST /v1/pointers/transfer). Readers of the
address are redirected to the recipient's pointer, which only its owner can
move. Irreversible once stored.
Like pointer_transfer/3 but raises on error.
Points the pointer at owner at target, paid by the daemon wallet
(POST /v1/pointers/update). A pointer that does not exist yet is created
at counter 0.
Like pointer_update/4 but raises on error.
Prepares a single chunk for external-signer publish via
POST /v1/chunks/prepare.
Like prepare_chunk_upload/2 but raises on error.
Prepares an in-memory data upload for external signing.
Like prepare_data_upload/3 but raises on error.
Prepares a file upload for external signing.
Like prepare_upload/3 but raises on error.
Convenience wrapper: prepare a public file upload for external signing.
Like prepare_upload_public/2 but raises on error.
Returns the wallet address configured on the daemon.
Like wallet_address/1 but raises on error.
Approves the wallet to spend tokens on payment contracts (one-time operation).
Like wallet_approve/1 but raises on error.
Returns the wallet balance and gas balance.
Like wallet_balance/1 but raises on error.
Types
Functions
Creates a client using port discovery.
Reads the daemon.port file to find the REST port. Falls back to the default base URL if the port file is not found.
Options
:timeout- HTTP request timeout in milliseconds (default: 300_000)
Examples
{client, url} = Antd.Client.auto_discover()
{client, url} = Antd.Client.auto_discover(timeout: 30_000)
@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
(POST /v1/manifests/build). Nothing is uploaded or paid for.
entries is a list of Antd.ManifestEntryInput, each with exactly one of
data_map or address; one with both or neither is refused before
anything is sent (Antd.BadRequestError, status_code 400, as from the daemon). An entry the
daemon rejects (an invalid path, a malformed DataMap) is an
Antd.BadRequestError whose message names entries[i].
Returns an Antd.BuiltManifest: the raw .ant bytes, the ant:// link
(nil when it would not fit 1,500 bytes) and the entries in encoded order.
Options
:name— a suggested root directory name (one portable path component).:torrent_info_hashes— BitTorrent info hashes of the same files: hex, 40 characters for v1 and/or 64 for v2.:embed_roots—true(the default) resolves each shrunk DataMap's root, fetching its wrapper records, and embeds it when it is at most 64 KiB, so recipients skip that fetch (ADR-0006's policy).falseembeds DataMaps exactly as given.
@spec build_manifest!(t(), [Antd.ManifestEntryInput.t()], keyword()) :: Antd.BuiltManifest.t()
Like build_manifest/3 but raises on error.
@spec chunk_get(t(), String.t()) :: {:ok, binary()} | {:error, Exception.t()}
Retrieves a chunk by address.
Like chunk_get/2 but raises on error.
@spec chunk_put(t(), binary()) :: {:ok, Antd.PutResult.t()} | {:error, Exception.t()}
Stores a raw chunk on the network.
@spec chunk_put!(t(), binary()) :: Antd.PutResult.t()
Like chunk_put/2 but raises on error.
@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).
@spec data_cost!(t(), binary(), keyword()) :: Antd.UploadCostEstimate.t()
Like data_cost/3 but raises on error.
@spec data_get(t(), String.t()) :: {:ok, binary()} | {:error, Exception.t()}
Retrieves private data using a caller-held DataMap (hex).
Like data_get/2 but raises on error.
@spec data_get_public(t(), String.t()) :: {:ok, binary()} | {:error, Exception.t()}
Retrieves public data by address.
Like data_get_public/2 but raises on error.
@spec data_put(t(), binary(), keyword()) :: {:ok, Antd.DataPutResult.t()} | {:error, Exception.t()}
Stores private encrypted data on the network.
Returns an %Antd.DataPutResult{} whose :data_map is the caller-held hex
DataMap; the DataMap is NOT stored on-network.
Options
:payment_mode—Antd.PaymentMode.t()(default:auto).
@spec data_put!(t(), binary(), keyword()) :: Antd.DataPutResult.t()
Like data_put/3 but raises on error.
@spec data_put_public(t(), binary(), keyword()) :: {:ok, Antd.DataPutPublicResult.t()} | {:error, Exception.t()}
Stores public data on the network.
The DataMap is stored on-network as an extra chunk; the returned
:address is the shareable retrieval handle.
Options
:payment_mode—Antd.PaymentMode.t()(default:auto).
@spec data_put_public!(t(), binary(), keyword()) :: Antd.DataPutPublicResult.t()
Like data_put_public/3 but raises on error.
@spec data_stream(t(), String.t()) :: {:ok, Enumerable.t()} | {:error, Exception.t()}
Streams private data for a caller-held DataMap (hex) with constant memory.
Unlike data_get/2, which buffers the entire decrypted payload in memory,
this returns a lazy Enumerable of raw binary chunks. The daemon decrypts
on the fly via POST /v1/data/stream and the body is consumed one chunk at
a time, so peak memory stays flat regardless of the object size.
The returned stream MUST be consumed in the same process that called
data_stream/2 (a Req streaming constraint). Enumerating it yields binary
chunks; concatenate or write them as they arrive, e.g.
{:ok, stream} = Antd.Client.data_stream(client, data_map)
Enum.into(stream, File.stream!("out.bin"))Non-2xx responses are parsed from the JSON {"error": ...} body and
returned as {:error, exception} (mirroring data_get/2).
@spec data_stream!(t(), String.t()) :: Enumerable.t()
Like data_stream/2 but raises on error.
@spec data_stream_public(t(), String.t()) :: {:ok, Enumerable.t()} | {:error, Exception.t()}
Streams public data by address with constant memory.
Streaming counterpart to data_get_public/2. Fetches via
GET /v1/data/public/{address}/stream and returns a lazy Enumerable of
raw binary chunks; see data_stream/2 for the consumption contract
(same-process requirement, error mapping).
@spec data_stream_public!(t(), String.t()) :: Enumerable.t()
Like data_stream_public/2 but raises on error.
@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.
@spec data_stream_public_with_progress!(t(), String.t()) :: Enumerable.t()
Like data_stream_public_with_progress/2 but raises on error.
@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. Opts into NDJSON framing (Accept: application/x-ndjson); enumerating the returned stream yields
Antd.DownloadFrame structs — each a plaintext chunk (:data) or a
Antd.DownloadProgress update (:progress).
{:ok, frames} = Antd.Client.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)
@spec data_stream_with_progress!(t(), String.t()) :: Enumerable.t()
Like data_stream_with_progress/2 but raises on error.
@spec decode_manifest(t(), binary(), keyword()) :: {:ok, Antd.DecodedManifest.t()} | {:error, Exception.t()}
Decodes .ant bytes (a raw binary) via POST /v1/manifests/decode.
Returns an Antd.DecodedManifest; a malformed manifest is an
Antd.BadRequestError.
Options
:resolve—truefetches each entry's DataMap (and wrapper records) to reportexact_sizeand confirm the DataMap is on the network. Content chunks are not fetched, and one entry's failure is reported in itserror, not as a failed call. Defaultfalse.
@spec decode_manifest!(t(), binary(), keyword()) :: Antd.DecodedManifest.t()
Like decode_manifest/3 but raises on error.
@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 via
POST /v1/manifests/decode. A file link or address reads as one public
entry with no path and source: "file_link". Takes the same :resolve
option as decode_manifest/3.
@spec decode_manifest_link!(t(), String.t(), keyword()) :: Antd.DecodedManifest.t()
Like decode_manifest_link/3 but raises on error.
@spec file_cost(t(), String.t(), boolean(), keyword()) :: {:ok, Antd.UploadCostEstimate.t()} | {:error, Exception.t()}
Estimates the cost of uploading a file.
Options
:payment_mode—Antd.PaymentMode.t()(default:auto).
@spec file_cost!(t(), String.t(), boolean(), keyword()) :: Antd.UploadCostEstimate.t()
Like file_cost/4 but raises on error.
@spec file_get(t(), String.t(), String.t()) :: :ok | {:error, Exception.t()}
Downloads a private file from a caller-held DataMap into dest_path.
The response body is empty on success — the file is written to dest_path.
Like file_get/3 but raises on error.
@spec file_get_public(t(), String.t(), String.t()) :: :ok | {:error, Exception.t()}
Downloads a public file from the network to a local path.
Like file_get_public/3 but raises on error.
@spec file_put(t(), String.t(), keyword()) :: {:ok, Antd.FilePutResult.t()} | {:error, Exception.t()}
Uploads a file privately. Returns the caller-held DataMap (hex) in the result — the DataMap is NOT stored on-network.
Options
:payment_mode—Antd.PaymentMode.t()(default:auto).
@spec file_put!(t(), String.t(), keyword()) :: Antd.FilePutResult.t()
Like file_put/3 but raises on error.
@spec file_put_public(t(), String.t(), keyword()) :: {:ok, Antd.FilePutPublicResult.t()} | {:error, Exception.t()}
Uploads a local file publicly.
The DataMap is stored on-network as an extra chunk; the returned
:address is the shareable retrieval handle.
Options
:payment_mode—Antd.PaymentMode.t()(default:auto).
@spec file_put_public!(t(), String.t(), keyword()) :: Antd.FilePutPublicResult.t()
Like file_put_public/3 but raises on error.
@spec finalize_chunk_upload(t(), String.t(), map()) :: {:ok, String.t()} | {:error, Exception.t()}
Submits a prepared chunk to the network after external payment via
POST /v1/chunks/finalize.
tx_hashes maps each non-zero quote_hash returned by
prepare_chunk_upload/2 to the tx_hash of the corresponding
payForQuotes() transaction. Returns the hex-encoded network address of
the stored chunk (matches :address from the prepare result).
Requires antd >= 0.7.0.
Like finalize_chunk_upload/3 but raises on error.
@spec finalize_merkle_upload(t(), String.t(), String.t(), keyword()) :: {:ok, Antd.FinalizeUploadResult.t()} | {:error, Exception.t()}
Finalizes a merkle-batch upload after selecting a winning pool.
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.
@spec finalize_merkle_upload!(t(), String.t(), String.t(), keyword()) :: Antd.FinalizeUploadResult.t()
Like finalize_merkle_upload/4 but raises on error.
@spec finalize_upload(t(), String.t(), map()) :: {:ok, Antd.FinalizeUploadResult.t()} | {:error, Exception.t()}
Finalizes an upload after an external signer has submitted payment transactions.
A finalize that stored only part of the upload returns
{:error, %Antd.PartialUploadError{}} (not the Antd.NetworkError a 502
used to map to; see Antd.PartialUploadError) carrying chunks_stored,
chunks_failed, total_chunks, retryable and retention_known. The
payment persists and the stored chunks stay on the network. Recovery has
three cases:
retryable: true— the daemon kept the paid attempt under the sameupload_id: call this function again with the same arguments to store the remainder against the same payment. Bound that loop (cap the attempts; achunks_failedthat 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— retention is unknown (the body'sretryablewas missing or not a boolean, as with daemons older than 0.14.0) and the daemon may still hold the paid attempt. Stop automatic recovery, keepupload_idandtx_hashes, and reconcile before re-preparing or paying again.
See Antd.PartialUploadError, docs/external-signer-flow.md §6 and
examples/07_external_signer.exs.
@spec finalize_upload!(t(), String.t(), map()) :: Antd.FinalizeUploadResult.t()
Like finalize_upload/3 but raises on error.
@spec health(t()) :: {:ok, Antd.HealthStatus.t()} | {:error, Exception.t()}
Checks the antd daemon status.
@spec health!(t()) :: Antd.HealthStatus.t()
Like health/1 but raises on error.
Creates a new client.
Options
:timeout- HTTP request timeout in milliseconds (default: 300_000)
Examples
client = Antd.Client.new()
client = Antd.Client.new("http://custom-host:9090")
client = Antd.Client.new("http://localhost:8082", timeout: 30_000)
@spec pointer_controller(t(), String.t()) :: {: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
(GET /v1/pointers/{address}/controller).
@spec pointer_controller!(t(), String.t()) :: Antd.PointerController.t()
Like pointer_controller/2 but raises on error.
@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 (POST /v1/pointers). owner is the pointer's address; the daemon
must hold its key (pointer_keys/1).
Returns Antd.AlreadyExistsError if the pointer exists, refused before
anything is paid; use pointer_update/4. Each call pays: do not retry
it automatically.
Options
:kind—Antd.PointerKind.t/0, whattargetis (:chunk, the daemon's default, or:pointer).
@spec pointer_create!(t(), String.t(), String.t(), keyword()) :: Antd.PointerWriteResult.t()
Like pointer_create/4 but raises on error.
@spec pointer_finality(t(), String.t()) :: {:ok, Antd.PointerFinality.t()} | {:error, Exception.t()}
Asks the whole close group where the pointer at address stands
(GET /v1/pointers/{address}/finality). Check it before relying on a
transfer: only status: :final (Antd.PointerFinality.final?/1) means it
is beyond dispute.
@spec pointer_finality!(t(), String.t()) :: Antd.PointerFinality.t()
Like pointer_finality/2 but raises on error.
@spec pointer_finalize(t(), String.t(), map()) :: {:ok, Antd.PointerFinalizeResult.t()} | {:error, Exception.t()}
Stores a prepared pointer write once its external signer has paid
(POST /v1/pointers/finalize). tx_hashes maps each quote_hash from the
prepare's payments to its payForQuotes() transaction hash.
A write that falls short after payment returns
Antd.CloseGroupShortfallError with retryable: true: the daemon kept the
paid state under the same upload_id, and calling this function again
with the same upload_id stores it against the same payment (tx_hashes
is then ignored). Bound that loop; the session expires with the daemon's
one-hour pending TTL. This function never retries by itself. A finalize
without the payment's hashes is Antd.BadRequestError and keeps the
session, so it can be corrected.
@spec pointer_finalize!(t(), String.t(), map()) :: Antd.PointerFinalizeResult.t()
Like pointer_finalize/3 but raises on error.
@spec pointer_get(t(), String.t()) :: {:ok, Antd.PointerRecord.t()} | {:error, Exception.t()}
Reads the pointer at address (GET /v1/pointers/{address}). Returns
Antd.NotFoundError if there is none.
@spec pointer_get!(t(), String.t()) :: Antd.PointerRecord.t()
Like pointer_get/2 but raises on error.
@spec pointer_keys(t()) :: {:ok, [String.t()]} | {:error, Exception.t()}
Lists the pointers this daemon holds owner keys for (GET /v1/pointers/keys),
as their addresses. Only these can be written through this daemon.
Like pointer_keys/1 but raises on error.
@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 with its loaded key and
quote it for an external signer (POST /v1/pointers/prepare). Pay the
result's payments with payForQuotes(), then call pointer_finalize/3.
Needs no daemon wallet.
op is an Antd.PointerOp.t/0: {:create, target},
{:update, target} (either with a Antd.PointerKind.t/0 as a third
element) or {:transfer, recipient}. Every check the daemon-wallet
functions make before paying is made here, before anything is quoted.
While the prepared write awaits payment, other writes to the pointer
return Antd.ConflictError until it is finalized or expires (one hour).
Options
:include_signed_quotes— whentrue, the result'ssigned_quotescarries each quote in full signed form.
@spec pointer_prepare!(t(), String.t(), Antd.PointerOp.t(), keyword()) :: Antd.PointerPrepareResult.t()
Like pointer_prepare/4 but raises on error.
@spec pointer_resolve(t(), String.t()) :: {:ok, Antd.PointerTarget.t()} | {:error, Exception.t()}
Follows a chain of pointers from address to the target at its end
(GET /v1/pointers/{address}/resolve), through forwardings and transfers
alike. Returns Antd.NotFoundError if a pointer on the chain does not
exist.
@spec pointer_resolve!(t(), String.t()) :: Antd.PointerTarget.t()
Like pointer_resolve/2 but raises on error.
@spec pointer_transfer(t(), String.t(), String.t()) :: {: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 (POST /v1/pointers/transfer). Readers of the
address are redirected to the recipient's pointer, which only its owner can
move. Irreversible once stored.
Refused before paying if recipient does not exist or leads back
(Antd.BadRequestError), and usually if the pointer is already final
(Antd.PointerFinalError). An Antd.CloseGroupShortfallError means too few
of the close group answered or stored it. That can happen before paying (the
transfer checks every peer first) or after, so check the pointer with
pointer_finality/2 before paying again. Each call pays: do not retry
it automatically.
The result's finality is the close group's view once the write landed,
or nil with finality_error set when that check failed; the transfer is
stored either way.
@spec pointer_transfer!(t(), String.t(), String.t()) :: Antd.PointerTransferResult.t()
Like pointer_transfer/3 but raises on error.
@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
(POST /v1/pointers/update). A pointer that does not exist yet is created
at counter 0.
Returns Antd.PointerFinalError if the pointer has been transferred or
frozen (usually refused before anything is paid; see
Antd.PointerFinalError), and Antd.ConflictError if a prepared write to
it awaits payment (refused before paying) or the update lost to a newer
state while in flight (possibly after paying); read the pointer before
writing again. Each call pays: do not retry it automatically. Takes the
same :kind option as pointer_create/4.
@spec pointer_update!(t(), String.t(), String.t(), keyword()) :: Antd.PointerWriteResult.t()
Like pointer_update/4 but raises on error.
@spec prepare_chunk_upload(t(), binary()) :: {:ok, Antd.PrepareChunkResult.t()} | {:error, Exception.t()}
Prepares a single chunk for external-signer publish via
POST /v1/chunks/prepare.
The daemon quotes the close group, stashes the prepared state under a fresh upload id, and returns either:
%Antd.PrepareChunkResult{already_stored: true, address: addr}— the chunk is already on-network; no payment or finalize is needed.%Antd.PrepareChunkResult{already_stored: false, upload_id: ..., payments: [...], ...}— the wave-batch intent the external signer must satisfy before callingfinalize_chunk_upload/3.
Unlike chunk_put/2, this endpoint does NOT require the daemon to have
a wallet — all funds flow through the external signer. Requires antd
= 0.7.0.
@spec prepare_chunk_upload!(t(), binary()) :: Antd.PrepareChunkResult.t()
Like prepare_chunk_upload/2 but raises on error.
@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— seeprepare_upload/3. Note that the daemon currently returns 501 for"public"on/v1/data/prepare; useprepare_upload_public/2with a file path until upstream ant-client exposesdata_prepare_upload_with_visibility.
@spec prepare_data_upload!(t(), binary(), keyword()) :: Antd.PrepareUploadResult.t()
Like prepare_data_upload/3 but raises on error.
@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 a single EVM transaction covers both the data chunks and the DataMap. Afterfinalize_upload/3,data_map_addresson the result is the shareable retrieval handle."private"(or omitting the option) keeps the existing private-only behaviour and the field is sent only when set.
@spec prepare_upload!(t(), String.t(), keyword()) :: Antd.PrepareUploadResult.t()
Like prepare_upload/3 but raises on error.
@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").
Requires antd >= 0.6.1.
@spec prepare_upload_public!(t(), String.t()) :: Antd.PrepareUploadResult.t()
Like prepare_upload_public/2 but raises on error.
@spec wallet_address(t()) :: {:ok, Antd.WalletAddress.t()} | {:error, Exception.t()}
Returns the wallet address configured on the daemon.
@spec wallet_address!(t()) :: Antd.WalletAddress.t()
Like wallet_address/1 but raises on error.
@spec wallet_approve(t()) :: {:ok, boolean()} | {:error, Exception.t()}
Approves the wallet to spend tokens on payment contracts (one-time operation).
Like wallet_approve/1 but raises on error.
@spec wallet_balance(t()) :: {:ok, Antd.WalletBalance.t()} | {:error, Exception.t()}
Returns the wallet balance and gas balance.
@spec wallet_balance!(t()) :: Antd.WalletBalance.t()
Like wallet_balance/1 but raises on error.