@follow-app/client-sdk
Version:
TypeScript client SDK for Follow RSS Server API
83 lines (69 loc) • 2.04 kB
text/typescript
// Auto-generated types for wallets module
import type {
transactions,
users,
wallets,
} from "@folo-services/drizzle"
import type { FeedOpenApiSchema } from "@folo-services/shared"
import type { InferSelectModel } from "drizzle-orm"
import type {
DateISOString,
SerializedModel,
StructuredSuccessResponse,
TwoFactorAuth,
} from "../../types"
import type { TransactionTypes } from "./constants"
// Re-export database types
export type WalletModel = SerializedModel<InferSelectModel<typeof wallets>>
// Wallets API request/response types
export type WalletsGetResponse = StructuredSuccessResponse<WalletModel[]>
export type WalletsPostResponse = StructuredSuccessResponse<WalletModel>
// Transaction types
export interface TransactionQuery {
hash?: string
type?: TransactionType
fromOrToUserId?: string
fromUserId?: string
toUserId?: string
toFeedId?: string
createdAfter?: DateISOString
}
// Base transaction type from database
export type TransactionModel = SerializedModel<
InferSelectModel<typeof transactions>
>
// User type without sensitive fields
export type UserModelPublic = SerializedModel<
Omit<
InferSelectModel<typeof users>,
| "email" |
"twoFactorEnabled" |
"isAnonymous" |
"bio" |
"website" |
"socialLinks" |
"stripeCustomerId" |
"role" |
"roleEndAt"
>
>
// Feed type serialized for transactions
type TransactionFeedModel = SerializedModel<FeedOpenApiSchema>
// Enhanced transaction with related data
export interface TransactionWithRelations extends TransactionModel {
fromUser?: UserModelPublic | null
toUser?: UserModelPublic | null
toFeed?: TransactionFeedModel | null
}
export type TransactionsGetResponse = StructuredSuccessResponse<
TransactionWithRelations[]
>
export interface WithdrawRequest extends TwoFactorAuth {
address: string
amount: string
toRss3?: boolean
}
export type WithdrawResponse = StructuredSuccessResponse<{
transactionHash: string
}>
export type TransactionType = (typeof TransactionTypes)[number]