manifold/common/txn.ts

33 lines
808 B
TypeScript
Raw Normal View History

2022-04-21 11:09:31 +00:00
// 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
2022-04-21 11:41:02 +00:00
// TODO: Do we really want to denormalize name/username/avatar here?
2022-04-21 11:09:31 +00:00
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 = {
2022-04-21 11:41:02 +00:00
charityId: string
2022-04-21 11:09:31 +00:00
}