mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 12:49:23 +00:00
Support handling addresses from other networks
A type alias of MoneroAddress is provided to abstract away the generic. To keep the rest of the library sane, MoneroAddress is used everywhere. If someone wants to use this library with another coin, they *should* be able to parse a custom address and then recreate it as a Monero address. While that's annoying to them, better them than any person using this lib for Monero. Closes #152.
This commit is contained in:
@@ -6,7 +6,7 @@ use serde_json::json;
|
||||
|
||||
use monero_serai::{
|
||||
Protocol, random_scalar,
|
||||
wallet::address::{Network, AddressType, AddressMeta, Address},
|
||||
wallet::address::{Network, AddressType, AddressMeta, MoneroAddress},
|
||||
rpc::{EmptyResponse, RpcError, Rpc},
|
||||
};
|
||||
|
||||
@@ -18,8 +18,8 @@ pub async fn rpc() -> Rpc {
|
||||
return rpc;
|
||||
}
|
||||
|
||||
let addr = Address {
|
||||
meta: AddressMeta { network: Network::Mainnet, kind: AddressType::Standard },
|
||||
let addr = MoneroAddress {
|
||||
meta: AddressMeta::new(Network::Mainnet, AddressType::Standard),
|
||||
spend: &random_scalar(&mut OsRng) * &ED25519_BASEPOINT_TABLE,
|
||||
view: &random_scalar(&mut OsRng) * &ED25519_BASEPOINT_TABLE,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user