Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage Transfers (Consig) Files #322

Merged
merged 25 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
dceac39
Adding full transfer method
josediegorobles Aug 1, 2023
07c6ef3
Updating FullRgbTransferRequest struct
josediegorobles Aug 1, 2023
9a5b28c
Adding self pay to
josediegorobles Aug 1, 2023
8ede4d8
Bitcoin_inputs
josediegorobles Aug 1, 2023
e86f37e
Match for btc_utxo
josediegorobles Aug 1, 2023
92f064b
Remove assert
josediegorobles Aug 1, 2023
c9b9cb4
Full Transfer (PSBT + Dustless + Transfer) (#312)
crisdut Aug 2, 2023
31bdd9c
Merge branch 'development' into JR/full_transfer_method
cryptoquick Aug 2, 2023
9b47b1d
Fix merge conflict.
cryptoquick Aug 2, 2023
a16b40b
Add debug statement. Bump version to 0.6.3-rc.1.
cryptoquick Aug 2, 2023
1dec8cf
fix: genesis import and reduce esplora calls
crisdut Aug 2, 2023
021d3b6
Bump bitmask-core to 0.6.3-rc.2.
cryptoquick Aug 2, 2023
a123bbd
Merge pull request #316 from diba-io/CD/fixies
cryptoquick Aug 2, 2023
97f14e3
fix: blank transition for different contract types (#317)
crisdut Aug 3, 2023
f97d7da
fix: watcher next utxos (#319)
crisdut Aug 4, 2023
129610e
Bump bitmask-core to 0.6.3-rc.4.
cryptoquick Aug 4, 2023
7af913a
Not skipping is_spent in allocationdetail
josediegorobles Aug 5, 2023
bdc1779
Adding watcher_unspent_utxos to web interface
josediegorobles Aug 5, 2023
cbc4431
feat: temp transfers
crisdut Aug 5, 2023
427f027
fix: prefetch and resolver for utxos
crisdut Aug 6, 2023
835453d
fix: merge conflicts
crisdut Aug 6, 2023
4cb580d
feat: add bitcoin change addrs
crisdut Aug 7, 2023
b7988e1
merge: update branch
crisdut Aug 7, 2023
95c797b
feat: automatically coin selection
crisdut Aug 7, 2023
1b00ebc
Add wasm_bindgen to decode_invoice
josediegorobles Aug 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 45 additions & 5 deletions src/bin/bitmaskd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ use bitmask_core::{
rgb::{
accept_transfer, clear_watcher as rgb_clear_watcher, create_invoice, create_psbt,
create_watcher, full_transfer_asset, import as rgb_import, issue_contract, list_contracts,
list_interfaces, list_schemas, reissue_contract, transfer_asset, watcher_address,
watcher_details as rgb_watcher_details, watcher_next_address, watcher_next_utxo,
watcher_utxo,
list_interfaces, list_schemas, list_transfers as list_rgb_transfers, reissue_contract,
remove_transfer as remove_rgb_transfer, save_transfer as save_rgb_transfer, transfer_asset,
watcher_address, watcher_details as rgb_watcher_details, watcher_next_address,
watcher_next_utxo, watcher_utxo,
},
structs::{
AcceptRequest, FileMetadata, FullRgbTransferRequest, ImportRequest, InvoiceRequest,
IssueAssetRequest, IssueRequest, MediaInfo, PsbtFeeRequest, PsbtRequest, ReIssueRequest,
RgbTransferRequest, SecretString, SelfFullRgbTransferRequest, SelfIssueRequest,
SignPsbtRequest, WatcherRequest,
RgbRemoveTransferRequest, RgbSaveTransferRequest, RgbTransferRequest, SecretString,
SelfFullRgbTransferRequest, SelfIssueRequest, SignPsbtRequest, WatcherRequest,
},
};
use carbonado::file;
Expand Down Expand Up @@ -327,6 +328,42 @@ async fn register_utxo(
Ok((StatusCode::OK, Json(resp)))
}

async fn list_transfers(
TypedHeader(auth): TypedHeader<Authorization<Bearer>>,
Path(contract_id): Path<String>,
) -> Result<impl IntoResponse, AppError> {
info!("GET /transfers/{contract_id:?}");

let nostr_hex_sk = auth.token();
let transfers_res = list_rgb_transfers(nostr_hex_sk, contract_id).await?;

Ok((StatusCode::OK, Json(transfers_res)))
}

async fn save_transfer(
TypedHeader(auth): TypedHeader<Authorization<Bearer>>,
Json(request): Json<RgbSaveTransferRequest>,
) -> Result<impl IntoResponse, AppError> {
info!("POST /transfers {request:?}");

let nostr_hex_sk = auth.token();
let import_res = save_rgb_transfer(nostr_hex_sk, request).await?;

Ok((StatusCode::OK, Json(import_res)))
}

async fn remove_transfer(
TypedHeader(auth): TypedHeader<Authorization<Bearer>>,
Json(request): Json<RgbRemoveTransferRequest>,
) -> Result<impl IntoResponse, AppError> {
info!("DELETE /transfers {request:?}");

let nostr_hex_sk = auth.token();
let import_res = remove_rgb_transfer(nostr_hex_sk, request).await?;

Ok((StatusCode::OK, Json(import_res)))
}

async fn co_store(
Path((pk, name)): Path<(String, String)>,
body: Bytes,
Expand Down Expand Up @@ -533,6 +570,9 @@ async fn main() -> Result<()> {
)
.route("/watcher/:name/:asset/utxo/:utxo", put(register_utxo))
.route("/watcher/:name", delete(clear_watcher))
.route("/transfers/:id", get(list_transfers))
.route("/transfers/", post(save_transfer))
.route("/transfers/", delete(remove_transfer))
.route("/key/:pk", get(key))
.route("/carbonado/status", get(status))
.route("/carbonado/:pk/:name", post(co_store))
Expand Down
1 change: 1 addition & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,5 @@ pub async fn set_env(key: &str, value: &str) {
pub mod storage_keys {
pub const ASSETS_STOCK: &str = "bitmask-fungible_assets_stock.c15";
pub const ASSETS_WALLETS: &str = "bitmask-fungible_assets_wallets.c15";
pub const ASSETS_TRANSFERS: &str = "bitmask_assets_transfers.c15";
}
Loading
Loading