mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-11 21:49:26 +00:00
Smash out RPC, wallet
This commit is contained in:
@@ -53,7 +53,8 @@ ethereum-serai = { path = "../coins/ethereum", default-features = false, optiona
|
||||
|
||||
# Monero
|
||||
dalek-ff-group = { path = "../crypto/dalek-ff-group", default-features = false, features = ["std"], optional = true }
|
||||
monero-serai = { path = "../coins/monero", default-features = false, features = ["std", "http-rpc", "multisig"], optional = true }
|
||||
monero-simple-request-rpc = { path = "../coins/monero/rpc/simple-request", default-features = false, optional = true }
|
||||
monero-wallet = { path = "../coins/monero/wallet", default-features = false, features = ["std", "multisig"], optional = true }
|
||||
|
||||
# Application
|
||||
log = { version = "0.4", default-features = false, features = ["std"] }
|
||||
@@ -87,7 +88,7 @@ bitcoin = ["dep:secp256k1", "secp256k1", "bitcoin-serai", "serai-client/bitcoin"
|
||||
ethereum = ["secp256k1", "ethereum-serai/tests"]
|
||||
|
||||
ed25519 = ["dalek-ff-group", "frost/ed25519"]
|
||||
monero = ["ed25519", "monero-serai", "serai-client/monero"]
|
||||
monero = ["ed25519", "monero-simple-request-rpc", "monero-wallet", "serai-client/monero"]
|
||||
|
||||
binaries = ["env_logger", "serai-env", "message-queue"]
|
||||
parity-db = ["serai-db/parity-db"]
|
||||
|
||||
@@ -13,18 +13,14 @@ use ciphersuite::group::{ff::Field, Group};
|
||||
use dalek_ff_group::{Scalar, EdwardsPoint};
|
||||
use frost::{curve::Ed25519, ThresholdKeys};
|
||||
|
||||
use monero_serai::{
|
||||
Protocol,
|
||||
ringct::RctType,
|
||||
transaction::Transaction,
|
||||
block::Block,
|
||||
rpc::{RpcError, HttpRpc, Rpc},
|
||||
wallet::{
|
||||
ViewPair, Scanner,
|
||||
address::{Network as MoneroNetwork, SubaddressIndex, AddressSpec},
|
||||
Fee, SpendableOutput, Change, DecoySelection, Decoys, TransactionError,
|
||||
SignableTransaction as MSignableTransaction, Eventuality, TransactionMachine,
|
||||
},
|
||||
use monero_simple_request_rpc::SimpleRequestRpc;
|
||||
use monero_wallet::{
|
||||
monero::{Protocol, ringct::RctType, transaction::Transaction, block::Block},
|
||||
rpc::{RpcError, Rpc},
|
||||
ViewPair, Scanner,
|
||||
address::{Network as MoneroNetwork, SubaddressIndex, AddressSpec},
|
||||
Fee, SpendableOutput, Change, DecoySelection, Decoys, TransactionError,
|
||||
SignableTransaction as MSignableTransaction, Eventuality, TransactionMachine,
|
||||
};
|
||||
|
||||
use tokio::time::sleep;
|
||||
@@ -226,7 +222,7 @@ impl BlockTrait<Monero> for Block {
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Monero {
|
||||
rpc: Rpc<HttpRpc>,
|
||||
rpc: Rpc<SimpleRequestRpc>,
|
||||
}
|
||||
// Shim required for testing/debugging purposes due to generic arguments also necessitating trait
|
||||
// bounds
|
||||
@@ -249,11 +245,11 @@ fn map_rpc_err(err: RpcError) -> NetworkError {
|
||||
|
||||
impl Monero {
|
||||
pub async fn new(url: String) -> Monero {
|
||||
let mut res = HttpRpc::new(url.clone()).await;
|
||||
let mut res = SimpleRequestRpc::new(url.clone()).await;
|
||||
while let Err(e) = res {
|
||||
log::error!("couldn't connect to Monero node: {e:?}");
|
||||
tokio::time::sleep(Duration::from_secs(5)).await;
|
||||
res = HttpRpc::new(url.clone()).await;
|
||||
res = SimpleRequestRpc::new(url.clone()).await;
|
||||
}
|
||||
Monero { rpc: res.unwrap() }
|
||||
}
|
||||
@@ -760,7 +756,7 @@ impl Network for Monero {
|
||||
async fn test_send(&self, address: Address) -> Block {
|
||||
use zeroize::Zeroizing;
|
||||
use rand_core::OsRng;
|
||||
use monero_serai::wallet::FeePriority;
|
||||
use monero_wallet::FeePriority;
|
||||
|
||||
let new_block = self.get_latest_block_number().await.unwrap() + 1;
|
||||
for _ in 0 .. 80 {
|
||||
|
||||
Reference in New Issue
Block a user