@bennyblader/ddk-rn 0.3.27 → 0.3.30
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.
- package/ddk-ffi/Cargo.lock +1 -1
- package/ddk-ffi/Cargo.toml +1 -1
- package/ddk-ffi/src/lib.rs +28 -18
- package/package.json +1 -1
package/ddk-ffi/Cargo.lock
CHANGED
package/ddk-ffi/Cargo.toml
CHANGED
package/ddk-ffi/src/lib.rs
CHANGED
|
@@ -1070,26 +1070,36 @@ pub fn create_cet_adaptor_points_from_oracle_info(
|
|
|
1070
1070
|
.collect::<Result<Vec<_>, DLCError>>()
|
|
1071
1071
|
.map_err(|_| DLCError::InvalidArgument("Invalid oracle info".to_string()))?;
|
|
1072
1072
|
|
|
1073
|
-
let msgs: Vec<Vec<Message>> = msgs
|
|
1074
|
-
.into_iter()
|
|
1075
|
-
.flatten() // Flatten from Vec<Vec<Vec<Vec<u8>>>> to Vec<Vec<Vec<u8>>>
|
|
1076
|
-
.map(|msg| {
|
|
1077
|
-
msg.iter()
|
|
1078
|
-
.map(|m| {
|
|
1079
|
-
Message::from_digest_slice(m)
|
|
1080
|
-
.map_err(|_| DLCError::InvalidArgument("Invalid message".to_string()))
|
|
1081
|
-
})
|
|
1082
|
-
.collect::<Result<Vec<_>, _>>()
|
|
1083
|
-
})
|
|
1084
|
-
.collect::<Result<Vec<_>, _>>()?;
|
|
1085
|
-
|
|
1086
1073
|
let secp = get_secp_context();
|
|
1087
|
-
let adaptor_points =
|
|
1088
|
-
|
|
1074
|
+
let mut adaptor_points = Vec::new();
|
|
1075
|
+
|
|
1076
|
+
// Process each CET's messages separately
|
|
1077
|
+
for cet_msgs in msgs {
|
|
1078
|
+
// Flatten from Vec<Vec<Vec<u8>>> to Vec<Vec<u8>>
|
|
1079
|
+
let cet_msgs: Vec<Vec<Message>> = cet_msgs
|
|
1080
|
+
.into_iter()
|
|
1081
|
+
.map(|outcome_msgs| {
|
|
1082
|
+
outcome_msgs
|
|
1083
|
+
.iter()
|
|
1084
|
+
.map(|m| {
|
|
1085
|
+
Message::from_digest_slice(m)
|
|
1086
|
+
.map_err(|_| DLCError::InvalidArgument("Invalid message".to_string()))
|
|
1087
|
+
})
|
|
1088
|
+
.collect::<Result<Vec<_>, _>>()
|
|
1089
|
+
})
|
|
1090
|
+
.collect::<Result<Vec<_>, _>>()?;
|
|
1091
|
+
|
|
1092
|
+
// Get adaptor point for this CET
|
|
1093
|
+
let adaptor_point =
|
|
1094
|
+
ddk_dlc::get_adaptor_point_from_oracle_info(secp, &oracle_infos, &cet_msgs)
|
|
1095
|
+
.map_err(|e| DLCError::Secp256k1Error(e.to_string()))?;
|
|
1096
|
+
|
|
1097
|
+
// Convert the adaptor point to bytes
|
|
1098
|
+
let adaptor_point_bytes = adaptor_point.serialize().to_vec();
|
|
1099
|
+
adaptor_points.push(adaptor_point_bytes);
|
|
1100
|
+
}
|
|
1089
1101
|
|
|
1090
|
-
|
|
1091
|
-
let adaptor_point_bytes = adaptor_points.serialize().to_vec();
|
|
1092
|
-
Ok(vec![adaptor_point_bytes])
|
|
1102
|
+
Ok(adaptor_points)
|
|
1093
1103
|
}
|
|
1094
1104
|
|
|
1095
1105
|
pub fn convert_mnemonic_to_seed(
|