Files
ark/server/internal/infrastructure/db/sqlite/sqlc/queries/models.go
Dusan Sekulic ae3ccb3579 Add support for announcing market hours (#380)
* feat: add market hour configuration for optimal payment timing

This commit adds market hour configuration to help users determine optimal
times for making payments with lower fees. The configuration is managed
through environment variables and exposed via the GetInfo RPC.

Changes:
- Add MarketHour message type to protobuf service definition
- Add market hour configuration fields to Config struct
- Update covenant and covenantless services to handle market hour data
- Extend GetInfo RPC response to include market hour information
- Set default market hour period to 24 hours
- Initialize market hour fields after other service fields

Configuration:
- ARK_FIRST_MARKET_HOUR: Initial market hour timestamp
  (default: current server start time)
- ARK_MARKET_HOUR_PERIOD: Time between market hours in seconds
  (default: 86400)
- ARK_MARKET_HOUR_ROUND_LIFETIME: Round lifetime for market hours
  (default: 0, falls back to ARK_ROUND_LIFETIME)

* feat: add admin RPC for updating market hour configuration

Add new UpdateMarketHour RPC to AdminService for configuring market hour parameters:
- Add request/response messages to admin.proto
- Add UpdateMarketHour method to Service interface
- Implement market hour updates in covenant and covenantless services
- Add validation for market hour parameters
- Implement admin gRPC handler

The RPC allows updating:
- First market hour timestamp
- Market hour period
- Market hour round lifetime (optional, defaults to round lifetime

* feat: add market hour persistence with sqlite

- Add MarketHourRepo interface in domain layer
- Implement market hour persistence using SQLite
- Add market hour queries to sqlc/query.sql
- Update service initialization to load market hours from DB
- Add fallback to config values if no DB entry exists
- Update RepoManager interface with new MarketHourRepo method
2024-11-22 10:36:51 +01:00

136 lines
2.4 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
package queries
import (
"database/sql"
)
type Entity struct {
ID int64
NostrRecipient string
}
type EntityVtxo struct {
EntityID int64
VtxoTxid string
VtxoVout int64
}
type EntityVw struct {
ID int64
NostrRecipient string
VtxoTxid sql.NullString
VtxoVout sql.NullInt64
}
type MarketHour struct {
ID int64
StartTime int64
EndTime int64
Period int64
RoundInterval int64
UpdatedAt int64
}
type Note struct {
ID int64
}
type Payment struct {
ID string
RoundID string
}
type PaymentReceiverVw struct {
PaymentID sql.NullString
Pubkey sql.NullString
OnchainAddress sql.NullString
Amount sql.NullInt64
}
type PaymentVtxoVw struct {
Txid sql.NullString
Vout sql.NullInt64
Pubkey sql.NullString
Amount sql.NullInt64
PoolTx sql.NullString
SpentBy sql.NullString
Spent sql.NullBool
Redeemed sql.NullBool
Swept sql.NullBool
ExpireAt sql.NullInt64
CreatedAt sql.NullInt64
PaymentID sql.NullString
RedeemTx sql.NullString
}
type Receiver struct {
PaymentID string
Pubkey sql.NullString
OnchainAddress sql.NullString
Amount int64
}
type Round struct {
ID string
StartingTimestamp int64
EndingTimestamp int64
Ended bool
Failed bool
StageCode int64
Txid string
UnsignedTx string
ConnectorAddress string
DustAmount int64
Version int64
Swept bool
}
type RoundPaymentVw struct {
ID sql.NullString
RoundID sql.NullString
}
type RoundTxVw struct {
ID sql.NullInt64
Tx sql.NullString
RoundID sql.NullString
Type sql.NullString
Position sql.NullInt64
Txid sql.NullString
TreeLevel sql.NullInt64
ParentTxid sql.NullString
IsLeaf sql.NullBool
}
type Tx struct {
ID int64
Tx string
RoundID string
Type string
Position int64
Txid sql.NullString
TreeLevel sql.NullInt64
ParentTxid sql.NullString
IsLeaf sql.NullBool
}
type Vtxo struct {
Txid string
Vout int64
Pubkey string
Amount int64
PoolTx string
SpentBy string
Spent bool
Redeemed bool
Swept bool
ExpireAt int64
CreatedAt int64
PaymentID sql.NullString
RedeemTx sql.NullString
}