manifold/common/txn.ts
2022-04-21 04:09:31 -07:00

32 lines
747 B
TypeScript

// A txn (pronounced "texan") respresents a payment between two ids on Manifold
// Shortened from "transaction" to distinguish from Firebase transactions (and save chars)
export type Txn = {
id: string
createdTime: number
fromId: string
fromName: string
fromUsername: string
fromAvatarUrl?: string
toId: string
toName: string
toUsername: string
toAvatarUrl?: string
amount: number
category: TxnCategory
// Human-readable description
description?: string
// Structured metadata for different kinds of txns
data?: TxnData
}
export type TxnCategory = 'TO_CHARITY' // | 'TIP' | 'BET' | ...
export type TxnData = CharityData // | TipData | BetData | ...
export type CharityData = {
// TODO: Could fill this in
}