TokenStandardClient

class TokenStandardClient(channel: Channel, registry: TransferRegistryClient? = null)

CIP-0056 token standard client: holdings, two-step transfers, and the pending-instruction inbox — the read/write surface a wallet renders.

Reads go straight to the ledger (ACS filtered by the standard's interfaces, so any compliant asset shows up with no per-asset integration). Writes are externally signed: registry context via TransferRegistryClient, then prepare → sign → execute through InteractiveSubmissionClient.

Tracking: CIP-0112 (Token Standard V2 — batch settlement, account-based holdings) will extend this surface; V1 remains the interop baseline.

Constructors

Link copied to clipboard
constructor(channel: Channel, registry: TransferRegistryClient? = null)

Types

Link copied to clipboard
object Companion

Tunables shared by every client; only clockSkewAllowance so far.

Link copied to clipboard
data class HoldingsChange(val updateId: String, val offset: Long, val recordTime: Instant, val created: List<Holding>, val archivedContractIds: List<String>, val archived: List<Holding> = emptyList(), val summary: TransferSummary? = null)

One committed update's effect on a party's holdings: created holdings carry full views (credits); archived holdings surface as contract ids, and — when their creation was seen earlier in the stream — as resolved archived holdings with amounts and owners. summary is the transfer-level reading (direction, counterparty, signed net amount, memo) when one is derivable.

Functions

Link copied to clipboard
suspend fun cancelTransferPreapproval(driver: SigningDriver, party: AllocatedExternalParty, preapprovalCid: String, synchronizerId: String, userId: String? = null)

Cancels the party's active preapproval — the receiver archives it unilaterally (TransferPreapproval_Cancel), signed on-device. No registry context needed: the receiver is a signatory, so the contract is in its ACS.

Link copied to clipboard
suspend fun createTransfer(driver: SigningDriver, party: AllocatedExternalParty, receiver: String, instrumentId: InstrumentId, amount: BigDecimal, inputHoldingCids: List<String>, synchronizerId: String, userId: String? = null, meta: Map<String, String> = emptyMap(), requestedAt: Instant = Instant.now().minus(clockSkewAllowance), executeBefore: Instant = Instant.now().plus(Duration.ofHours(24)))

Initiates a transfer as party (externally signed). Returns the update id is not yet surfaced — track completion via the instruction appearing in the receiver's inbox or the sender's ACS delta.

Link copied to clipboard
suspend fun exerciseTransferInstruction(driver: SigningDriver, party: AllocatedExternalParty, transferInstructionId: String, choice: TransferInstructionChoice, synchronizerId: String, userId: String? = null)

Accept/reject (receiver) or withdraw (sender) a pending instruction.

Link copied to clipboard
suspend fun holdingsHistory(partyId: String, beginExclusive: Long = 0, endInclusive: Long? = null): List<TokenStandardClient.HoldingsChange>

The party's holdings history between two offsets: every committed update that created or archived one of its CIP-0056 holdings, oldest first, with transfer-level HoldingsChange.summary rows. Defaults to genesis → current ledger end (a finite read).

Link copied to clipboard
suspend fun listHoldings(partyId: String): List<Holding>

Active holding UTXOs visible to partyId, any CIP-0056 instrument.

Link copied to clipboard

Pending two-step transfers visible to partyId — the wallet inbox. The receiver acts on TransferPendingReceiverAcceptance entries; the sender may withdraw anything still pending.

Link copied to clipboard
suspend fun requestTransferPreapproval(driver: SigningDriver, party: AllocatedExternalParty, provider: String, dso: String, synchronizerId: String, userId: String? = null)

Requests a transfer preapproval for party (externally signed): once provider — typically the party's validator operator — accepts and pays, transfers to this party settle directly with no inbox round-trip. Track acceptance via ScanClient.transferPreapprovalByParty.