manifold/common/txn.ts
Sinclair Chen 833dd37469
Comment tips (attempt 2) (#539)
* Add tip arrows UI (visual)

* move tipper into its own component

* simplify score calculation

* Add tip txns

- more specific txn types
- fix transact cloud function to be able to create tip txns
- insert tips into comments via a context

* Refactor tipper to send tip txns

* Stop tipping yourself. Disable anons.

* Style tipper (smaller)

* remove default exports

* capitalize tooltips

* rename stuff

* add exhausting hook dependencies

* replace context with prop threading

* fix eslint unused vars

* fix: thread tips correctly into fr comments
2022-06-17 22:28:16 -05:00

40 lines
838 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
fromType: SourceType
toId: string
toType: SourceType
amount: number
token: 'M$' // | 'USD' | MarketOutcome
category: 'CHARITY' | 'TIP' // | 'BET'
// Any extra data
data?: { [key: string]: any }
// Human-readable description
description?: string
}
export type SourceType = 'USER' | 'CONTRACT' | 'CHARITY' | 'BANK'
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
}
}