writePayload

abstract suspend fun writePayload(payload: JsonElement, mediaType: String = "application/json"): AnchorResult

Writes a payload to the blockchain and returns an anchor reference.

Legacy entry point — kept for binary compatibility. Routes through writePayload with PaymentContext.unmanaged; the client falls back to its embedded account credentials and does not consult any treasury.

Return

An AnchorResult containing the reference and payload

Parameters

payload

The JSON payload to anchor

mediaType

The media type of the payload


open suspend fun writePayload(payload: JsonElement, ctx: PaymentContext, mediaType: String = "application/json"): AnchorResult

Payment-aware write. Plugins that opt into the payment plane override this; the default delegates to the legacy writePayload so existing implementations keep compiling.

Implementations honouring ctx must:

Parameters

payload

the JSON payload to anchor

ctx

payment context — who pays, on what chain, with what strategy and what caller-side cap

mediaType

the media type of the payload