feat: implement HyperliquidMonitor for position opening and migrate dependencies to git repository urls

This commit is contained in:
0xcathiefish
2026-05-30 09:00:53 +00:00
parent ffd98934e4
commit eadaa81438
15 changed files with 5397 additions and 224 deletions
-16
View File
@@ -1,16 +0,0 @@
use nosync::{ModuleA, SharedMessage};
#[tokio::test]
async fn test_integration_module_a() {
let module_a = ModuleA::new("integration-a".to_string()).expect("Failed to create ModuleA");
let msg = SharedMessage {
id: 999,
content: "Integration content".to_string(),
};
let res = module_a
.process_message(msg)
.await
.expect("Failed to process");
assert!(res.contains("integration-a"));
assert!(res.contains("Integration content"));
}
-10
View File
@@ -1,10 +0,0 @@
use nosync::{ModuleA, ModuleB};
#[tokio::test]
async fn test_integration_module_b() {
let module_a =
ModuleA::new("integration-b-processor".to_string()).expect("Failed to create ModuleA");
let module_b = ModuleB::new(module_a).expect("Failed to create ModuleB");
let res = module_b.run().await;
assert!(res.is_ok());
}
+19
View File
@@ -0,0 +1,19 @@
use alloy::primitives::address;
use nosync::HyperliquidMonitor;
use tokio::sync::mpsc;
use tokio::time::{Duration, timeout};
#[tokio::test]
async fn test_monitor_initialization() {
// Standard test wallet address
let wallet = address!("0xc64cc00b46101bd40aa1c3121195e85c0b0918d8");
let monitor = HyperliquidMonitor::new(wallet, true);
let (tx, _rx) = mpsc::unbounded_channel();
// Verify it connects and runs within a timeout (since it runs an infinite reconnect loop)
let run_result = timeout(Duration::from_secs(3), monitor.run(tx)).await;
// Timeout should occur if the connection is successful and continues running
assert!(run_result.is_err(), "Monitor should have timed out");
}