Skip to content

Commit 3dae2e0

Browse files
committed
Return ASCII-armored consignment.
1 parent dff12b5 commit 3dae2e0

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/rgb.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use ::psbt::{serialize::Serialize, Psbt};
2-
use amplify::{
3-
confinement::U32,
4-
hex::{FromHex, ToHex},
5-
};
2+
use amplify::hex::{FromHex, ToHex};
63
use anyhow::Result;
74
use autosurgeon::reconcile;
85
use bitcoin::{psbt::PartiallySignedTransaction, Network, Txid};
@@ -13,7 +10,7 @@ use garde::Validate;
1310
use miniscript_crate::DescriptorPublicKey;
1411
use rgb::{RgbDescr, RgbWallet};
1512
use rgbstd::{
16-
containers::BindleContent,
13+
containers::{Bindle, BindleContent},
1714
contract::ContractId,
1815
interface::TypedState,
1916
persistence::{Inventory, Stash, Stock},
@@ -25,7 +22,7 @@ use std::{
2522
ops::Sub,
2623
str::FromStr,
2724
};
28-
use strict_encoding::{tn, StrictSerialize};
25+
use strict_encoding::tn;
2926
use thiserror::Error;
3027

3128
pub mod accept;
@@ -841,12 +838,9 @@ async fn internal_transfer_asset(
841838
let consig_id = transfer.bindle_id().to_string();
842839
let consig = if let (Some(offer_id), Some(bid_id)) = (params.offer_id, params.bid_id) {
843840
let swap = TransferSwap::with(&offer_id, &bid_id, transfer.unbindle());
844-
swap.to_strict_serialized::<{ U32 }>()
845-
.map_err(|err| TransferError::WrongConsig(err.to_string()))?
841+
Bindle::new(swap.consig).to_string()
846842
} else {
847-
transfer
848-
.to_strict_serialized::<{ U32 }>()
849-
.map_err(|err| TransferError::WrongConsig(err.to_string()))?
843+
transfer.to_string()
850844
};
851845

852846
let bp_txid = bp::Txid::from_hex(&psbt.to_txid().to_hex())
@@ -859,7 +853,7 @@ async fn internal_transfer_asset(
859853
let rgb_transfer = RgbTransfer {
860854
iface: rgb_invoice.iface.unwrap().to_string(),
861855
consig_id: consig_id.clone(),
862-
consig: consig.to_hex(),
856+
consig: consig.clone(),
863857
tx: bp_txid,
864858
is_send: true,
865859
};
@@ -876,13 +870,12 @@ async fn internal_transfer_asset(
876870
.insert(contract_id, vec![rgb_transfer]);
877871
}
878872

879-
let consig_hex = consig.to_hex();
880873
let commit = commit.to_hex();
881874
let psbt = psbt.to_string();
882875

883876
let resp = RgbInternalTransferResponse {
884877
consig_id,
885-
consig: consig_hex,
878+
consig,
886879
psbt,
887880
commit,
888881
txid: bp_txid.to_string(),

0 commit comments

Comments
 (0)