6cc2d8af58
* Set up Firestore structure for mana bounty links
* Split up manalinks into successes and failures
* Allow clients to create manalinks
* Track txnId and successful users
* Store custom amounts in the link
* List all manalinks you've created
* Support backend for claiming manalinks
* Add some more error handling
* Tweak readme
* Fix typescript breakage
* Revert "Convert common imports in functions to be absolute"
This reverts commit c03518e906
.
* Scaffolding so `claimManalink` works
* Clean up imports
* Barebones endpoint to claim mana
* Fix rules to only allow link creators to query
* Design out claim giftcard
* List all claimed transactions
* Style in a more awesome card
* Fix import
* Padding tweak
* Fix useManalinkTxns hook
* /send -> /link
* Tidy up some details
* Do a bunch of random manalinks work
* Fix up LinksTable to build
* Clean up LinksTable an absurd amount
* Basic details functionality on manalinks table
* Work on manalink claim stuff
* Fix up some merge mess
* Not-signed-in flow implemented
* Better manalinks table
* Only show outstanding links in table
* Use new `ManalinkTxn` type
* /link -> /links
* Change manalinks page UI to use nice looking tabs
* Many fixes to manalinks UI
* Default to 1 use
* Tidying up
* Some copy changes based on feedback
* Add required index
Co-authored-by: Marshall Polaris <marshall@pol.rs>
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
// A txn (pronounced "texan") respresents a payment between two ids on Manifold
|
|
// Shortened from "transaction" to distinguish from Firebase transactions (and save chars)
|
|
type AnyTxnType = Donation | Tip | Manalink
|
|
type SourceType = 'USER' | 'CONTRACT' | 'CHARITY' | 'BANK'
|
|
|
|
export type Txn<T extends AnyTxnType = AnyTxnType> = {
|
|
id: string
|
|
createdTime: number
|
|
|
|
fromId: string
|
|
fromType: SourceType
|
|
|
|
toId: string
|
|
toType: SourceType
|
|
|
|
amount: number
|
|
token: 'M$' // | 'USD' | MarketOutcome
|
|
|
|
category: 'CHARITY' | 'MANALINK' | 'TIP' // | 'BET'
|
|
// Any extra data
|
|
data?: { [key: string]: any }
|
|
|
|
// Human-readable description
|
|
description?: string
|
|
} & T
|
|
|
|
type Donation = {
|
|
fromType: 'USER'
|
|
toType: 'CHARITY'
|
|
category: 'CHARITY'
|
|
}
|
|
|
|
type Tip = {
|
|
fromType: 'USER'
|
|
toType: 'USER'
|
|
category: 'TIP'
|
|
data: {
|
|
contractId: string
|
|
commentId: string
|
|
}
|
|
}
|
|
|
|
type Manalink = {
|
|
fromType: 'USER'
|
|
toType: 'USER'
|
|
category: 'MANALINK'
|
|
}
|
|
|
|
export type DonationTxn = Txn & Donation
|
|
export type TipTxn = Txn & Tip
|
|
export type ManalinkTxn = Txn & Manalink
|