manifold/common/txn.ts

28 lines
725 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-26 02:29:50 +00:00
fromType: 'user' | 'contract' | 'bank_of_manifold'
2022-04-21 11:09:31 +00:00
toId: string
2022-04-26 02:29:50 +00:00
toType: 'user' | 'contract' | 'charity' | 'bank_of_manifold'
2022-04-21 11:09:31 +00:00
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
}