|
|
@@ -10,12 +10,15 @@ use crate::utils::starknet_messages::{
|
|
|
use utils::starknet_messages;
|
|
|
use crate::utils;
|
|
|
|
|
|
+#[allow(dead_code)]
|
|
|
pub struct StarkSignature {
|
|
|
pub r: Felt,
|
|
|
pub s: Felt,
|
|
|
pub v: Felt,
|
|
|
}
|
|
|
|
|
|
+#[allow(dead_code)]
|
|
|
+#[allow(deprecated)]
|
|
|
fn grind_key(key_seed: BigUint) -> BigUint {
|
|
|
let two_256 = BigUint::from_str(
|
|
|
"115792089237316195423570985008687907853269984665640564039457584007913129639936",
|
|
|
@@ -47,6 +50,7 @@ fn grind_key(key_seed: BigUint) -> BigUint {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#[allow(dead_code)]
|
|
|
pub fn get_private_key_from_eth_signature(signature: &str) -> Result<Felt, String> {
|
|
|
let eth_sig_truncated = signature.trim_start_matches("0x");
|
|
|
if eth_sig_truncated.len() < 64 {
|
|
|
@@ -60,6 +64,7 @@ pub fn get_private_key_from_eth_signature(signature: &str) -> Result<Felt, Strin
|
|
|
return Ok(Felt::from_hex(&ground_key.to_str_radix(16)).unwrap());
|
|
|
}
|
|
|
|
|
|
+#[allow(dead_code)]
|
|
|
pub fn sign_message(message: &Felt, private_key: &Felt) -> Result<StarkSignature, String> {
|
|
|
return ecdsa_sign(private_key, &message)
|
|
|
.map(|extended_signature| StarkSignature {
|
|
|
@@ -72,6 +77,7 @@ pub fn sign_message(message: &Felt, private_key: &Felt) -> Result<StarkSignature
|
|
|
|
|
|
// these functions are designed to be called from other languages, such as Python or JavaScript,
|
|
|
// so they take string arguments.
|
|
|
+#[allow(dead_code)]
|
|
|
pub fn get_order_hash(
|
|
|
position_id: String,
|
|
|
base_asset_id_hex: String,
|
|
|
@@ -159,6 +165,7 @@ pub fn get_order_hash(
|
|
|
.map_err(|e| format!("Failed to compute message hash: {:?}", e))
|
|
|
}
|
|
|
|
|
|
+#[allow(dead_code)]
|
|
|
pub fn get_transfer_hash(
|
|
|
recipient_position_id: String,
|
|
|
sender_position_id: String,
|
|
|
@@ -212,6 +219,7 @@ pub fn get_transfer_hash(
|
|
|
.map_err(|e| format!("Failed to compute message hash: {:?}", e))
|
|
|
}
|
|
|
|
|
|
+#[allow(dead_code)]
|
|
|
pub fn get_withdrawal_hash(
|
|
|
recipient_hex: String,
|
|
|
position_id: String,
|