post Transaction
Submits a transaction to the approval server for regulatory review.
The transaction XDR envelope is sent as a JSON payload to the specified approval server. The server evaluates the transaction against its compliance rules and returns one of five possible outcomes (success, revised, pending, action_required, or rejected).
Return
Sep08PostTransactionResponse containing the approval server's decision
Parameters
tx
The base64-encoded transaction envelope XDR to submit for approval
approval Server
The URL of the SEP-8 approval server
Throws
If the server returns a malformed response or an unexpected HTTP status code
Example:
val asset = sep08.regulatedAssets.first()
val response = sep08.postTransaction(
tx = transaction.toEnvelopeXdrBase64(),
approvalServer = asset.approvalServer
)
when (response) {
is Sep08PostTransactionResponse.Success -> {
// Approved - submit response.tx to the network
}
is Sep08PostTransactionResponse.Revised -> {
// Revised - review response.tx and response.message
}
is Sep08PostTransactionResponse.Pending -> {
// Pending - retry after response.timeout milliseconds
}
is Sep08PostTransactionResponse.ActionRequired -> {
// Action needed - direct user to response.actionUrl
}
is Sep08PostTransactionResponse.Rejected -> {
// Rejected - display response.error
}
}Content copied to clipboard