type Message<T> = T & {
version: 2;
meta: { channelId: string };
};
enum TransactionStatus {
complete = "complete",
pending = "pending",
failed = "failed",
}
type Transaction =
| {
/** The MoonPay identifier for this transaction. **/
id: string;
/** The status of the transaction. **/
status: TransactionStatus.complete | TransactionStatus.pending;
}
| {
status: TransactionStatus.failed;
/** A developer-friendly error message detailing the reason for the transaction failure. **/
failureReason: string;
};
type WidgetCompleteEvent = Message<{
kind: "complete";
payload: {
transaction: Transaction;
};
}>;