// This file contains native-only integration tests for EVM client balance and signing logic. // All code is strictly separated from WASM code using cfg attributes. #[test] fn test_rlp_encode_unsigned() { use ethers_core::types::{Address, U256, Bytes}; use evm_client::provider::Transaction; let tx = Transaction { to: Address::zero(), value: U256::from(100), data: Bytes::new(), gas: Some(U256::from(21000)), gas_price: Some(U256::from(1)), nonce: Some(U256::from(1)), chain_id: Some(1u64), }; let rlp = tx.rlp_encode_unsigned(); assert!(!rlp.is_empty()); } #[test] fn test_parse_signature_rs_v() { use ethers_core::types::U256; use evm_client::provider::parse_signature_rs_v; let mut sig = [0u8; 65]; sig[31] = 1; sig[63] = 2; sig[64] = 27; let (r, s, v) = parse_signature_rs_v(&sig, 1).unwrap(); assert_eq!(r, U256::from(1)); assert_eq!(s, U256::from(2)); assert_eq!(v, 27 + 1 * 2 + 8); } #[cfg(not(target_arch = "wasm32"))] #[tokio::test] async fn test_get_balance_real_address() { use ethers_core::types::{Address, U256}; use evm_client::provider::get_balance; // Vitalik's address let address = "d8dA6BF26964aF9D7eEd9e03E53415D37aA96045"; let address = ethers_core::types::Address::from_slice(&hex::decode(address).unwrap()); let url = "https://ethereum.blockpi.network/v1/rpc/public"; let balance = get_balance(url, address).await.expect("Failed to get balance"); // TODO: Update to use new EvmClient API assert!(balance > ethers_core::types::U256::zero(), "Vitalik's balance should be greater than zero"); }