mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 12:49:23 +00:00
add Serai JSON-RPC methods (#627)
* add serai rpc methods * fix machete & dex quote price api * fix validators api --------- Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
@@ -16,7 +16,8 @@ pub use abi::{primitives, Transaction};
|
||||
use abi::*;
|
||||
|
||||
pub use primitives::{SeraiAddress, Signature, Amount};
|
||||
use primitives::{Header, ExternalNetworkId};
|
||||
use primitives::{Header, NetworkId, ExternalNetworkId, QuotePriceParams};
|
||||
use crate::in_instructions::primitives::Shorthand;
|
||||
|
||||
pub mod coins;
|
||||
pub use coins::SeraiCoins;
|
||||
@@ -317,6 +318,24 @@ impl Serai {
|
||||
) -> Result<Vec<multiaddr::Multiaddr>, SeraiError> {
|
||||
self.call("p2p_validators", network).await
|
||||
}
|
||||
|
||||
// TODO: move this to SeraiValidatorSets?
|
||||
pub async fn external_network_address(
|
||||
&self,
|
||||
network: ExternalNetworkId,
|
||||
) -> Result<String, SeraiError> {
|
||||
self.call("external_network_address", network).await
|
||||
}
|
||||
|
||||
// TODO: move this to SeraiInInstructions?
|
||||
pub async fn encoded_shorthand(&self, shorthand: Shorthand) -> Result<Vec<u8>, SeraiError> {
|
||||
self.call("encoded_shorthand", shorthand).await
|
||||
}
|
||||
|
||||
// TODO: move this to SeraiDex?
|
||||
pub async fn quote_price(&self, params: QuotePriceParams) -> Result<u64, SeraiError> {
|
||||
self.call("quote_price", params).await
|
||||
}
|
||||
}
|
||||
|
||||
impl TemporalSerai<'_> {
|
||||
|
||||
@@ -179,7 +179,7 @@ impl SeraiValidatorSets<'_> {
|
||||
&self,
|
||||
network: NetworkId,
|
||||
) -> Result<Vec<Public>, SeraiError> {
|
||||
self.0.runtime_api("SeraiRuntimeApi_validators", network).await
|
||||
self.0.runtime_api("ValidatorSetsApi_validators", network).await
|
||||
}
|
||||
|
||||
// TODO: Store these separately since we almost never need both at once?
|
||||
|
||||
Reference in New Issue
Block a user