mirror of
https://github.com/aljazceru/ark.git
synced 2026-02-15 16:14:19 +01:00
* 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
113 lines
2.5 KiB
Protocol Buffer
113 lines
2.5 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package ark.v1;
|
|
|
|
import "google/api/annotations.proto";
|
|
import "google/protobuf/timestamp.proto";
|
|
import "google/protobuf/duration.proto";
|
|
|
|
service AdminService {
|
|
rpc GetScheduledSweep(GetScheduledSweepRequest) returns (GetScheduledSweepResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/admin/sweeps"
|
|
};
|
|
}
|
|
rpc GetRoundDetails(GetRoundDetailsRequest) returns (GetRoundDetailsResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/admin/round/{round_id}"
|
|
};
|
|
}
|
|
rpc GetRounds(GetRoundsRequest) returns (GetRoundsResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/admin/rounds"
|
|
body: "*"
|
|
};
|
|
}
|
|
rpc CreateNote(CreateNoteRequest) returns (CreateNoteResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/admin/note"
|
|
body: "*"
|
|
};
|
|
}
|
|
rpc GetMarketHourConfig(GetMarketHourConfigRequest) returns (GetMarketHourConfigResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/admin/market-hour"
|
|
};
|
|
}
|
|
rpc UpdateMarketHourConfig(UpdateMarketHourConfigRequest) returns (UpdateMarketHourConfigResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/admin/market-hour"
|
|
body: "*"
|
|
};
|
|
}
|
|
}
|
|
|
|
message GetScheduledSweepRequest {}
|
|
message GetScheduledSweepResponse {
|
|
repeated ScheduledSweep sweeps = 1;
|
|
}
|
|
|
|
message SweepableOutput {
|
|
string txid = 1;
|
|
uint32 vout = 2;
|
|
string amount = 3;
|
|
int64 scheduled_at = 4;
|
|
}
|
|
|
|
message ScheduledSweep {
|
|
string round_id = 1;
|
|
repeated SweepableOutput outputs = 2;
|
|
}
|
|
|
|
message GetRoundDetailsRequest {
|
|
string round_id = 1;
|
|
}
|
|
|
|
message GetRoundDetailsResponse {
|
|
string round_id = 1;
|
|
string txid = 2;
|
|
string forfeited_amount = 3;
|
|
string total_vtxos_amount = 4;
|
|
string total_exit_amount = 5;
|
|
string fees_amount = 6;
|
|
repeated string inputs_vtxos = 7;
|
|
repeated string outputs_vtxos = 8;
|
|
repeated string exit_addresses = 9;
|
|
}
|
|
|
|
message GetRoundsRequest {
|
|
int64 after = 1;
|
|
int64 before = 2;
|
|
}
|
|
|
|
message GetRoundsResponse {
|
|
repeated string rounds = 1;
|
|
}
|
|
|
|
message CreateNoteRequest {
|
|
uint32 amount = 1;
|
|
uint32 quantity = 2;
|
|
}
|
|
|
|
message CreateNoteResponse {
|
|
repeated string notes = 1;
|
|
}
|
|
|
|
message GetMarketHourConfigRequest {}
|
|
|
|
message GetMarketHourConfigResponse {
|
|
MarketHourConfig config = 1;
|
|
}
|
|
|
|
message UpdateMarketHourConfigRequest {
|
|
MarketHourConfig config = 1;
|
|
}
|
|
|
|
message UpdateMarketHourConfigResponse {}
|
|
|
|
message MarketHourConfig {
|
|
google.protobuf.Timestamp start_time = 1;
|
|
google.protobuf.Timestamp end_time = 2;
|
|
google.protobuf.Duration period = 3;
|
|
google.protobuf.Duration round_interval = 4;
|
|
} |