2022-04-29 23:35:56 +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
|
|
|
|
fromType: SourceType
|
|
|
|
|
|
|
|
toId: string
|
|
|
|
toType: SourceType
|
|
|
|
|
|
|
|
amount: number
|
|
|
|
token: 'M$' // | 'USD' | MarketOutcome
|
|
|
|
|
2022-06-17 21:19:42 +00:00
|
|
|
category: 'CHARITY' | 'TIP' // | 'BET'
|
|
|
|
// Any extra data
|
|
|
|
data?: { [key: string]: any }
|
2022-04-29 23:35:56 +00:00
|
|
|
// Human-readable description
|
|
|
|
description?: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export type SourceType = 'USER' | 'CONTRACT' | 'CHARITY' | 'BANK'
|
2022-06-17 21:19:42 +00:00
|
|
|
|
|
|
|
export type DonationTxn = Omit<Txn, 'data'> & {
|
|
|
|
fromType: 'USER'
|
|
|
|
toType: 'CHARITY'
|
|
|
|
category: 'CHARITY'
|
|
|
|
}
|
|
|
|
|
|
|
|
export type TipTxn = Txn & {
|
|
|
|
fromType: 'USER'
|
|
|
|
toType: 'USER'
|
|
|
|
category: 'TIP'
|
|
|
|
data: {
|
|
|
|
contractId: string
|
|
|
|
commentId: string
|
|
|
|
}
|
|
|
|
}
|