feat: payments schema + deps for Lightning ranked fights
Add payments and wallet_connections tables, new columns on fights (mode, pot_sats, payout_status) and bots (sats_won, sats_wagered, has_wallet). Install nostr-tools and @cashu/cashu-ts for NWC + ecash support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
6b139a076a
commit
e92f483e66
@@ -20,6 +20,9 @@ export const bots = sqliteTable('bots', {
|
||||
consecutiveErrors: integer('consecutive_errors').notNull().default(0),
|
||||
lastErrorAt: text('last_error_at'),
|
||||
customization: text('customization'),
|
||||
satsWon: integer('sats_won').notNull().default(0),
|
||||
satsWagered: integer('sats_wagered').notNull().default(0),
|
||||
hasWallet: integer('has_wallet', { mode: 'boolean' }).notNull().default(false),
|
||||
createdAt: text('created_at').notNull(),
|
||||
})
|
||||
|
||||
@@ -36,6 +39,9 @@ export const fights = sqliteTable('fights', {
|
||||
scheduledAt: text('scheduled_at'),
|
||||
startedAt: text('started_at'),
|
||||
endedAt: text('ended_at'),
|
||||
mode: text('mode', { enum: ['free', 'ranked'] }).notNull().default('free'),
|
||||
potSats: integer('pot_sats').notNull().default(0),
|
||||
payoutStatus: text('payout_status', { enum: ['pending', 'paid', 'failed'] }),
|
||||
createdAt: text('created_at').notNull(),
|
||||
})
|
||||
|
||||
@@ -56,6 +62,34 @@ export const rounds = sqliteTable('rounds', {
|
||||
createdAt: text('created_at').notNull(),
|
||||
})
|
||||
|
||||
export const payments = sqliteTable('payments', {
|
||||
id: text('id').primaryKey(),
|
||||
fightId: text('fight_id').references(() => fights.id),
|
||||
botId: text('bot_id').notNull().references(() => bots.id),
|
||||
direction: text('direction', { enum: ['in', 'out'] }).notNull(),
|
||||
amountSats: integer('amount_sats').notNull(),
|
||||
method: text('method', { enum: ['lightning', 'cashu'] }).notNull(),
|
||||
status: text('status', {
|
||||
enum: ['pending', 'confirmed', 'failed', 'refunded'],
|
||||
}).notNull().default('pending'),
|
||||
invoice: text('invoice'),
|
||||
preimage: text('preimage'),
|
||||
cashuToken: text('cashu_token'),
|
||||
errorReason: text('error_reason'),
|
||||
createdAt: text('created_at').notNull(),
|
||||
confirmedAt: text('confirmed_at'),
|
||||
refundedAt: text('refunded_at'),
|
||||
})
|
||||
|
||||
export const walletConnections = sqliteTable('wallet_connections', {
|
||||
id: text('id').primaryKey(),
|
||||
botId: text('bot_id').notNull().unique().references(() => bots.id),
|
||||
method: text('method', { enum: ['nwc', 'lnaddress', 'cashu_mint'] }).notNull(),
|
||||
connectionData: text('connection_data').notNull(),
|
||||
createdAt: text('created_at').notNull(),
|
||||
lastUsedAt: text('last_used_at'),
|
||||
})
|
||||
|
||||
export const bets = sqliteTable('bets', {
|
||||
id: text('id').primaryKey(),
|
||||
fightId: text('fight_id').notNull().references(() => fights.id),
|
||||
|
||||
Reference in New Issue
Block a user