Event types
Event types
Current event list comes from packages/mini-app/src/types.ts.
Source-of-truth list
mini_app.login.succeededmini_app.trade.submittedmini_app.trade.processedmini_app.trade.failedmini_app.trade.compensation_requiredmini_app.redemption.processedmini_app.redemption.failedmini_app.payout.pendingmini_app.logout.requestedmini_app.session.expired
Payload reference
mini_app.login.succeeded
Sent after authenticated launch succeeds. Payload shape is event-specific and carried in envelope data.
mini_app.trade.submitted
Sent when order accepted into OpenPoly processing flow. Payload shape is event-specific and carried in envelope data.
mini_app.trade.processed
Sent when trade completed successfully.
{
"order_id": 1,
"trade_id": 10,
"operator_user_id": 1,
"external_user_id": "operator-user-123",
"market_id": 51,
"side": "buy",
"outcome": "yes",
"shares_micro": 12345,
"credits_delta": -100,
"external_amount_minor": 10000,
"currency_code": "IDR"
}
mini_app.trade.failed
Sent when trade fails and no successful final execution exists.
{
"order_id": 1,
"operator_user_id": 1,
"external_user_id": "operator-user-123",
"market_id": 51,
"side": "buy",
"outcome": "yes",
"failure_reason": "OPERATOR_DEBIT_FAILED"
}
mini_app.trade.compensation_required
Sent when wallet debit happened but downstream completion needed manual or compensating handling.
{
"order_id": 1,
"operator_user_id": 1,
"external_user_id": "operator-user-123",
"debit_operation_id": 99,
"reversal_operation_id": 100,
"failure_reason": "DB_EXECUTION_FAILED_AFTER_DEBIT"
}
mini_app.redemption.processed
Sent when redemption or payout completed successfully. Payload shape is event-specific and carried in envelope data.
mini_app.redemption.failed
Sent when redemption flow failed before successful credit completion. Payload shape is event-specific and carried in envelope data.
mini_app.payout.pending
Sent when payout reached unknown or pending external state and operator follow-up may be required.
{
"order_id": 2,
"redemption_item_id": null,
"operator_user_id": 1,
"external_user_id": "operator-user-123",
"credit_operation_id": 101,
"external_amount_minor": 15000,
"currency_code": "IDR",
"failure_reason": "OPERATOR_CREDIT_UNKNOWN"
}
mini_app.logout.requested
Sent when OpenPoly requests operator-side session cleanup. Payload shape is event-specific and carried in envelope data.
mini_app.session.expired
Sent when launched Mini App session expired. Payload shape is event-specific and carried in envelope data.
Guidance
- keep receiver tolerant to additive fields
- branch only on known
event_type - use
event_idfor dedupe - use
order_id,trade_id,credit_operation_id,debit_operation_idfor support correlation - treat
failure_reasonas operator-facing diagnostic string, not enum guaranteed forever - examples above are source-backed where current contract already defines fields explicitly
