Skip to content

Commit

Permalink
fix: bitcoin derivation indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
crisdut committed Aug 2, 2023
1 parent 9df58b2 commit bc436f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,12 @@ pub async fn full_transfer_asset(
.to_string();

let contract_terminal = format!("/{contract_index}/*");
let wildcard_terminal = "/*/*";
let universal_desc = SecretString(
request
.descriptor
.to_string()
.replace(&contract_terminal, "/*/*"),
.replace(&contract_terminal, wildcard_terminal),
);

// Get All Assets UTXOs
Expand Down Expand Up @@ -820,8 +821,8 @@ pub async fn full_transfer_asset(

sync_wallet(bitcoin_index, &mut wallet, &mut resolver);

let mut unspent_utxos =
next_utxos(0, wallet.clone(), &mut resolver).map_err(|_| {
let mut unspent_utxos = next_utxos(bitcoin_index, wallet.clone(), &mut resolver)
.map_err(|_| {
TransferError::Retrive(
"Esplora".to_string(),
"Retrieve Unspent UTXO unavaliable".to_string(),
Expand Down
16 changes: 8 additions & 8 deletions tests/rgb/integration/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ async fn allow_full_transfer_step() -> anyhow::Result<()> {
let issuer_resp = issuer_issue_contract_v2(
1,
"RGB20",
5,
1,
false,
true,
None,
Some("0.00001".to_string()),
Some(UtxoFilter::with_amount_less_than(1000)),
Some("0.00000546".to_string()),
Some(UtxoFilter::with_amount_less_than(546)),
)
.await?;

Expand All @@ -50,7 +50,7 @@ async fn allow_full_transfer_step() -> anyhow::Result<()> {
.await?;

// 3. Get Bitcoin UTXO
let issuer_btc_desc = &issuer_keys.public.btc_descriptor_xpub;
let issuer_btc_desc = &issuer_keys.public.btc_change_descriptor_xpub;
let issuer_vault = get_wallet(&SecretString(issuer_btc_desc.to_string()), None).await?;
let issuer_address = &issuer_vault
.lock()
Expand All @@ -59,17 +59,17 @@ async fn allow_full_transfer_step() -> anyhow::Result<()> {
.address
.to_string();

send_some_coins(issuer_address, "0.1").await;
send_some_coins(issuer_address, "0.001").await;
sync_wallet(&issuer_vault).await?;

// 4. Made a Self Payment
// 4. Make a Self Payment
let self_pay_req = FullRgbTransferRequest {
contract_id: issuer_resp.contract_id,
iface: issuer_resp.iface,
rgb_invoice: owner_resp.invoice.to_string(),
descriptor: SecretString(issuer_keys.public.rgb_assets_descriptor_xpub.to_string()),
change_terminal: "/0/1".to_string(),
fee: PsbtFeeRequest::Value(1000),
change_terminal: "/1/0".to_string(),
fee: PsbtFeeRequest::Value(546),
};

let issue_sk = issuer_keys.private.nostr_prv.to_string();
Expand Down

0 comments on commit bc436f2

Please sign in to comment.