@ticketto/protocol
Version:
Library that defines the interfaces of the ticketto protocol to be implemented on a client
50 lines (49 loc) • 1.27 kB
TypeScript
import { AccountId, EventId, LineItemPrice, TicketId, Timestamp } from "@ticketto/types";
/**
* The events that might arise from the interactions with the {@link TicketsModule}
*/
export type TicketsEvent = TicketIssued | TicketOnSale | TicketPurchased | TicketTransferred | TicketAttendanceMarked;
/**
* A new ticket has been issued for an active event.
*/
export type TicketIssued = {
type: "TicketIssued";
event: EventId;
id: TicketId;
};
/**
* A ticket has been marked for sale with a specified price. Can be listed as available by
* clients.
*/
export type TicketOnSale = {
type: "TicketOnSale";
event: EventId;
id: TicketId;
price: LineItemPrice;
};
/**
* A ticket has been purchased by a customer and should be delisted
* as avaailable on clients.
*/
export type TicketPurchased = {
type: "TicketPurchased";
event: EventId;
id: TicketId;
buyer: AccountId;
};
/**
* A ticket has been transferred between customers.
*/
export type TicketTransferred = {
type: "TicketTransferred";
issuer: EventId;
id: TicketId;
newOwner: AccountId;
};
export type TicketAttendanceMarked = {
type: "AttendanceMarked";
issuer: EventId;
id: TicketId;
owner: AccountId;
time: Timestamp;
};