mirror of
https://github.com/RoboSats/taptrade-core.git
synced 2025-07-19 17:23:26 +00:00
begin with offer fetching
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
ELECTRUM_BACKEND="ssl://mempool.space:40002"
|
||||
ELECTRUM_BACKEND="ssl://mempool.space:40002" # we need a node with large mempool size limit for monitoring to miss no bond transactions
|
||||
DATABASE_PATH="./dbs/trades.db" # path to the coordinator sqlite database storing the trades
|
||||
BDK_DB_PATH="./dbs/bdk-wallet" # Path to the BDK Sled database (no .db postfix)
|
||||
WALLET_XPRV="tprv8ZgxMBicQKsPdHuCSjhQuSZP1h6ZTeiRqREYS5guGPdtL7D1uNLpnJmb2oJep99Esq1NbNZKVJBNnD2ZhuXSK7G5eFmmcx73gsoa65e2U32"
|
||||
|
@ -34,3 +34,9 @@ pub struct OrderActivatedResponse {
|
||||
pub offer_id_hex: String,
|
||||
pub bond_locked_until_timestamp: u64, // unix timestamp. Do not touch bond till then unless offer gets taken.
|
||||
}
|
||||
|
||||
pub struct OffersRequest {
|
||||
pub buy_offers: bool, // true if looking for buy offers, false if looking for sell offers
|
||||
pub amount_min_sat: u64,
|
||||
pub amount_max_sat: u64,
|
||||
}
|
||||
|
@ -68,10 +68,21 @@ async fn submit_maker_bond(
|
||||
}))
|
||||
}
|
||||
|
||||
async fn fetch_available_offers(
|
||||
Extension(database): Extension<CoordinatorDB>,
|
||||
Extension(wallet): Extension<CoordinatorWallet>,
|
||||
Json(payload): Json<OffersRequest>,
|
||||
) -> Result<Json<Vec<PublicOffer>>, AppError> {
|
||||
|
||||
// let offers = database.fetch_available_offers(&payload).await?;
|
||||
// Ok(Json(offers))
|
||||
}
|
||||
|
||||
pub async fn api_server(database: CoordinatorDB, wallet: CoordinatorWallet) -> Result<()> {
|
||||
let app = Router::new()
|
||||
.route("/create-offer", post(receive_order))
|
||||
.route("/submit-maker-bond", post(submit_maker_bond))
|
||||
.route("/fetch-available-offers", post(fetch_available_offers))
|
||||
.layer(Extension(database))
|
||||
.layer(Extension(wallet));
|
||||
// add other routes here
|
||||
|
Reference in New Issue
Block a user