@bennyblader/ddk-rn 0.3.17 → 0.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -282,7 +282,7 @@ checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
282
282
 
283
283
  [[package]]
284
284
  name = "ddk_ffi"
285
- version = "0.3.17"
285
+ version = "0.3.19"
286
286
  dependencies = [
287
287
  "bip39",
288
288
  "bitcoin",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "ddk_ffi"
3
- version = "0.3.17"
3
+ version = "0.3.19"
4
4
  edition = "2021"
5
5
  license = "MIT"
6
6
  description = "rust-dlc language bindings"
@@ -800,7 +800,9 @@ pub fn sign_cet(
800
800
  let funding_sk = SecretKey::from_slice(&funding_secret_key)
801
801
  .map_err(|_| DLCError::InvalidArgument("Invalid funding secret key".to_string()))?;
802
802
  let other_pk = PublicKey::from_slice(&other_pubkey).map_err(|_| DLCError::InvalidPublicKey)?;
803
- let funding_script = Script::from_bytes(&funding_script_pubkey);
803
+ let funding_pubkey =
804
+ PublicKey::from_slice(&funding_script_pubkey).map_err(|_| DLCError::InvalidPublicKey)?;
805
+ let dlc_redeem_script = dlc::make_funding_redeemscript(&funding_pubkey, &other_pk);
804
806
  let secp = get_secp_context();
805
807
 
806
808
  dlc::sign_cet(
@@ -810,7 +812,7 @@ pub fn sign_cet(
810
812
  &[oracle_sigs],
811
813
  &funding_sk,
812
814
  &other_pk,
813
- funding_script,
815
+ dlc_redeem_script.as_script(),
814
816
  Amount::from_sat(fund_output_value),
815
817
  )
816
818
  .map_err(|e| DLCError::Secp256k1Error(e.to_string()))?;
@@ -1592,12 +1594,17 @@ mod tests {
1592
1594
  let secp = get_secp_context();
1593
1595
  let btc_txn = transaction_to_btc_tx(&tx)?;
1594
1596
  let script = ScriptBuf::from_bytes(script_pubkey);
1595
- let sig_hash_msg =
1596
- dlc::util::get_sig_hash_msg(&btc_txn, input_index, &script, Amount::from_sat(value))?;
1597
1597
  let sig = EcdsaSignature::from_der(&signature).map_err(|_| DLCError::InvalidSignature)?;
1598
1598
  let pk = PublicKey::from_slice(&pk).map_err(|_| DLCError::InvalidPublicKey)?;
1599
- secp.verify_ecdsa(&sig_hash_msg, &sig, &pk)
1600
- .map_err(|_| DLCError::InvalidSignature)?;
1599
+ dlc::verify_tx_input_sig(
1600
+ secp,
1601
+ &sig,
1602
+ &btc_txn,
1603
+ input_index,
1604
+ &script,
1605
+ Amount::from_sat(value),
1606
+ &pk,
1607
+ )?;
1601
1608
  Ok(())
1602
1609
  }
1603
1610
 
@@ -1712,7 +1719,7 @@ mod tests {
1712
1719
  oracle_signatures[0].clone(),
1713
1720
  accept_fund_sk.secret_bytes().to_vec(),
1714
1721
  offer_party_params.fund_pubkey.clone(),
1715
- funding_script_pubkey.clone().into_bytes(),
1722
+ accept_party_params.fund_pubkey.clone(),
1716
1723
  fund_output_value,
1717
1724
  );
1718
1725
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bennyblader/ddk-rn",
3
- "version": "0.3.17",
3
+ "version": "0.3.19",
4
4
  "description": "dlcdevkit bindings for react-native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",