mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-11 21:49:26 +00:00
Sync rest of repo with monero-serai changes
This commit is contained in:
@@ -95,7 +95,7 @@ async fn mint_and_burn_test() {
|
||||
};
|
||||
|
||||
let addr = ViewPair::new(ED25519_BASEPOINT_POINT, Zeroizing::new(Scalar::ONE))
|
||||
.address(Network::Mainnet, AddressSpec::Standard)
|
||||
.address(Network::Mainnet, AddressSpec::Legacy)
|
||||
.to_string();
|
||||
|
||||
let rpc = producer_handles.monero(ops).await;
|
||||
@@ -350,11 +350,13 @@ async fn mint_and_burn_test() {
|
||||
use curve25519_dalek::{constants::ED25519_BASEPOINT_POINT, scalar::Scalar};
|
||||
use monero_wallet::{
|
||||
io::decompress_point,
|
||||
ringct::RctType,
|
||||
transaction::Timelock,
|
||||
Protocol,
|
||||
rpc::Rpc,
|
||||
ViewPair, Scanner, DecoySelection, Decoys, Change, FeePriority, SignableTransaction,
|
||||
address::{Network, AddressType, AddressMeta, MoneroAddress},
|
||||
rpc::{FeePriority, Rpc},
|
||||
ViewPair, DecoySelection, Decoys,
|
||||
address::{Network, AddressType, MoneroAddress},
|
||||
scan::Scanner,
|
||||
send::{Change, SignableTransaction},
|
||||
};
|
||||
|
||||
// Grab the first output on the chain
|
||||
@@ -373,7 +375,7 @@ async fn mint_and_burn_test() {
|
||||
let decoys = Decoys::fingerprintable_canonical_select(
|
||||
&mut OsRng,
|
||||
&rpc,
|
||||
Protocol::v16.ring_len(),
|
||||
16,
|
||||
rpc.get_height().await.unwrap(),
|
||||
&[output.clone()],
|
||||
)
|
||||
@@ -381,23 +383,23 @@ async fn mint_and_burn_test() {
|
||||
.unwrap()
|
||||
.swap_remove(0);
|
||||
|
||||
let mut outgoing_view_key = Zeroizing::new([0; 32]);
|
||||
OsRng.fill_bytes(outgoing_view_key.as_mut());
|
||||
let tx = SignableTransaction::new(
|
||||
Protocol::v16,
|
||||
None,
|
||||
RctType::ClsagBulletproofPlus,
|
||||
outgoing_view_key,
|
||||
vec![(output, decoys)],
|
||||
vec![(
|
||||
MoneroAddress::new(
|
||||
AddressMeta::new(
|
||||
Network::Mainnet,
|
||||
AddressType::Featured { guaranteed: true, subaddress: false, payment_id: None },
|
||||
),
|
||||
Network::Mainnet,
|
||||
AddressType::Featured { guaranteed: true, subaddress: false, payment_id: None },
|
||||
decompress_point(monero_key_pair.1.to_vec().try_into().unwrap()).unwrap(),
|
||||
ED25519_BASEPOINT_POINT *
|
||||
processor::additional_key::<processor::networks::monero::Monero>(0).0,
|
||||
),
|
||||
1_100_000_000_000,
|
||||
)],
|
||||
&Change::new(&view_pair, false),
|
||||
Change::new(&view_pair, false),
|
||||
vec![Shorthand::transfer(None, serai_addr).encode()],
|
||||
rpc.get_fee_rate(FeePriority::Unimportant).await.unwrap(),
|
||||
)
|
||||
@@ -475,9 +477,10 @@ async fn mint_and_burn_test() {
|
||||
let spend = ED25519_BASEPOINT_TABLE * &Scalar::random(&mut OsRng);
|
||||
let view = Scalar::random(&mut OsRng);
|
||||
|
||||
use monero_wallet::address::{Network, AddressType, AddressMeta, MoneroAddress};
|
||||
use monero_wallet::address::{Network, AddressType, MoneroAddress};
|
||||
let addr = MoneroAddress::new(
|
||||
AddressMeta::new(Network::Mainnet, AddressType::Standard),
|
||||
Network::Mainnet,
|
||||
AddressType::Legacy,
|
||||
spend,
|
||||
ED25519_BASEPOINT_TABLE * &view,
|
||||
);
|
||||
@@ -583,7 +586,7 @@ async fn mint_and_burn_test() {
|
||||
|
||||
// Verify the received Monero TX
|
||||
{
|
||||
use monero_wallet::{transaction::Transaction, rpc::Rpc, ViewPair, Scanner};
|
||||
use monero_wallet::{transaction::Transaction, rpc::Rpc, ViewPair, scan::Scanner};
|
||||
let rpc = handles[0].monero(&ops).await;
|
||||
let mut scanner = Scanner::from_view(
|
||||
ViewPair::new(monero_spend, Zeroizing::new(monero_view)),
|
||||
|
||||
@@ -419,7 +419,7 @@ impl Coordinator {
|
||||
"wallet_address": ViewPair::new(
|
||||
ED25519_BASEPOINT_POINT,
|
||||
Zeroizing::new(Scalar::ONE),
|
||||
).address(Network::Mainnet, AddressSpec::Standard).to_string(),
|
||||
).address(Network::Mainnet, AddressSpec::Legacy).to_string(),
|
||||
"amount_of_blocks": 1,
|
||||
})),
|
||||
)
|
||||
|
||||
@@ -104,7 +104,7 @@ pub enum Wallet {
|
||||
handle: String,
|
||||
spend_key: Zeroizing<curve25519_dalek::scalar::Scalar>,
|
||||
view_pair: monero_wallet::ViewPair,
|
||||
inputs: Vec<monero_wallet::ReceivedOutput>,
|
||||
inputs: Vec<monero_wallet::scan::ReceivedOutput>,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -192,8 +192,9 @@ impl Wallet {
|
||||
use monero_simple_request_rpc::SimpleRequestRpc;
|
||||
use monero_wallet::{
|
||||
rpc::Rpc,
|
||||
ViewPair, Scanner,
|
||||
address::{Network, AddressSpec},
|
||||
ViewPair,
|
||||
scan::Scanner,
|
||||
};
|
||||
|
||||
let mut bytes = [0; 64];
|
||||
@@ -215,7 +216,7 @@ impl Wallet {
|
||||
Some(serde_json::json!({
|
||||
"wallet_address": view_pair.address(
|
||||
Network::Mainnet,
|
||||
AddressSpec::Standard
|
||||
AddressSpec::Legacy
|
||||
).to_string(),
|
||||
"amount_of_blocks": 200,
|
||||
})),
|
||||
@@ -438,11 +439,12 @@ impl Wallet {
|
||||
use monero_simple_request_rpc::SimpleRequestRpc;
|
||||
use monero_wallet::{
|
||||
io::decompress_point,
|
||||
rpc::Rpc,
|
||||
Protocol,
|
||||
address::{Network, AddressType, AddressMeta, Address},
|
||||
SpendableOutput, DecoySelection, Decoys, Change, FeePriority, Scanner,
|
||||
SignableTransaction,
|
||||
ringct::RctType,
|
||||
rpc::{FeePriority, Rpc},
|
||||
address::{Network, AddressType, Address},
|
||||
DecoySelection, Decoys,
|
||||
scan::{SpendableOutput, Scanner},
|
||||
send::{Change, SignableTransaction},
|
||||
};
|
||||
use processor::{additional_key, networks::Monero};
|
||||
|
||||
@@ -462,7 +464,7 @@ impl Wallet {
|
||||
let mut decoys = Decoys::fingerprintable_canonical_select(
|
||||
&mut OsRng,
|
||||
&rpc,
|
||||
Protocol::v16.ring_len(),
|
||||
16,
|
||||
rpc.get_height().await.unwrap(),
|
||||
&these_inputs,
|
||||
)
|
||||
@@ -472,10 +474,8 @@ impl Wallet {
|
||||
let to_spend_key = decompress_point(<[u8; 32]>::try_from(to.as_ref()).unwrap()).unwrap();
|
||||
let to_view_key = additional_key::<Monero>(0);
|
||||
let to_addr = Address::new(
|
||||
AddressMeta::new(
|
||||
Network::Mainnet,
|
||||
AddressType::Featured { subaddress: false, payment_id: None, guaranteed: true },
|
||||
),
|
||||
Network::Mainnet,
|
||||
AddressType::Featured { subaddress: false, payment_id: None, guaranteed: true },
|
||||
to_spend_key,
|
||||
ED25519_BASEPOINT_POINT * to_view_key.0,
|
||||
);
|
||||
@@ -486,12 +486,14 @@ impl Wallet {
|
||||
if let Some(instruction) = instruction {
|
||||
data.push(Shorthand::Raw(RefundableInInstruction { origin: None, instruction }).encode());
|
||||
}
|
||||
let mut outgoing_view_key = Zeroizing::new([0; 32]);
|
||||
OsRng.fill_bytes(outgoing_view_key.as_mut());
|
||||
let tx = SignableTransaction::new(
|
||||
Protocol::v16,
|
||||
None,
|
||||
RctType::ClsagBulletproofPlus,
|
||||
outgoing_view_key,
|
||||
these_inputs.drain(..).zip(decoys.drain(..)).collect(),
|
||||
vec![(to_addr, AMOUNT)],
|
||||
&Change::new(view_pair, false),
|
||||
Change::new(view_pair, false),
|
||||
data,
|
||||
rpc.get_fee_rate(FeePriority::Unimportant).await.unwrap(),
|
||||
)
|
||||
@@ -532,11 +534,9 @@ impl Wallet {
|
||||
Wallet::Monero { view_pair, .. } => {
|
||||
use monero_wallet::address::{Network, AddressSpec};
|
||||
ExternalAddress::new(
|
||||
networks::monero::Address::new(
|
||||
view_pair.address(Network::Mainnet, AddressSpec::Standard),
|
||||
)
|
||||
.unwrap()
|
||||
.into(),
|
||||
networks::monero::Address::new(view_pair.address(Network::Mainnet, AddressSpec::Legacy))
|
||||
.unwrap()
|
||||
.into(),
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user