Smash out RPC, wallet

This commit is contained in:
Luke Parker
2024-06-16 18:40:15 -04:00
parent 3a1c6c7247
commit d740bd2924
76 changed files with 578 additions and 336 deletions

View File

@@ -53,8 +53,8 @@ impl Handles {
pub async fn monero(
&self,
ops: &DockerOperations,
) -> monero_serai::rpc::Rpc<monero_serai::rpc::HttpRpc> {
use monero_serai::rpc::HttpRpc;
) -> monero_wallet::rpc::Rpc<monero_simple_request_rpc::SimpleRequestRpc> {
use monero_simple_request_rpc::SimpleRequestRpc;
let rpc = ops.handle(&self.monero.0).host_port(self.monero.1).unwrap();
let rpc = format!("http://{RPC_USER}:{RPC_PASS}@{}:{}", rpc.0, rpc.1);
@@ -62,7 +62,7 @@ impl Handles {
// If the RPC server has yet to start, sleep for up to 60s until it does
for _ in 0 .. 60 {
tokio::time::sleep(Duration::from_secs(1)).await;
let Ok(client) = HttpRpc::new(rpc.clone()).await else { continue };
let Ok(client) = SimpleRequestRpc::new(rpc.clone()).await else { continue };
if client.get_height().await.is_err() {
continue;
}

View File

@@ -88,7 +88,7 @@ async fn mint_and_burn_test() {
// Mine a Monero block
let monero_blocks = {
use curve25519_dalek::{constants::ED25519_BASEPOINT_POINT, scalar::Scalar};
use monero_serai::wallet::{
use monero_wallet::{
ViewPair,
address::{Network, AddressSpec},
};
@@ -345,14 +345,10 @@ async fn mint_and_burn_test() {
// Send in XMR
{
use curve25519_dalek::{constants::ED25519_BASEPOINT_POINT, scalar::Scalar};
use monero_serai::{
Protocol,
transaction::Timelock,
wallet::{
ViewPair, Scanner, DecoySelection, Decoys, Change, FeePriority, SignableTransaction,
address::{Network, AddressType, AddressMeta, MoneroAddress},
},
io::decompress_point,
use monero_wallet::{
monero::{io::decompress_point, Protocol, transaction::Timelock},
ViewPair, Scanner, DecoySelection, Decoys, Change, FeePriority, SignableTransaction,
address::{Network, AddressType, AddressMeta, MoneroAddress},
};
// Grab the first output on the chain
@@ -473,7 +469,7 @@ async fn mint_and_burn_test() {
let spend = ED25519_BASEPOINT_TABLE * &Scalar::random(&mut OsRng);
let view = Scalar::random(&mut OsRng);
use monero_serai::wallet::address::{Network, AddressType, AddressMeta, MoneroAddress};
use monero_wallet::address::{Network, AddressType, AddressMeta, MoneroAddress};
let addr = MoneroAddress::new(
AddressMeta::new(Network::Mainnet, AddressType::Standard),
spend,
@@ -578,7 +574,7 @@ async fn mint_and_burn_test() {
// Verify the received Monero TX
{
use monero_serai::wallet::{ViewPair, Scanner};
use monero_wallet::{ViewPair, Scanner};
let rpc = handles[0].monero(&ops).await;
let mut scanner = Scanner::from_view(
ViewPair::new(monero_spend, Zeroizing::new(monero_view)),