use borsh::{BorshDeserialize, BorshSerialize};
use kaspa_notify::events::EventType;
use serde::{Deserialize, Serialize};
use workflow_core::enums::Describe;
#[derive(Describe, Clone, Debug, PartialEq, Eq, Hash, BorshSerialize, BorshDeserialize, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RpcApiOps {
Ping = 0,
GetProcessMetrics,
GetCurrentNetwork,
SubmitBlock,
GetBlockTemplate,
GetPeerAddresses,
GetSelectedTipHash,
GetMempoolEntry,
GetMempoolEntries,
GetConnectedPeerInfo,
AddPeer,
SubmitTransaction,
GetBlock,
GetSubnetwork,
GetVirtualChainFromBlock,
GetBlocks,
GetBlockCount,
GetBlockDagInfo,
ResolveFinalityConflict,
Shutdown,
GetHeaders,
GetUtxosByAddresses,
GetBalanceByAddress,
GetBalancesByAddresses,
GetSinkBlueScore,
Ban,
Unban,
GetInfo,
EstimateNetworkHashesPerSecond,
GetMempoolEntriesByAddresses,
GetCoinSupply,
NotifyBlockAdded,
NotifyNewBlockTemplate,
NotifyUtxosChanged,
NotifyPruningPointUtxoSetOverride,
NotifyFinalityConflict,
NotifyFinalityConflictResolved, NotifyVirtualDaaScoreChanged,
NotifyVirtualChainChanged,
NotifySinkBlueScoreChanged,
Subscribe,
Unsubscribe,
Notification,
BlockAddedNotification,
VirtualChainChangedNotification,
FinalityConflictNotification,
FinalityConflictResolvedNotification,
UtxosChangedNotification,
SinkBlueScoreChangedNotification,
VirtualDaaScoreChangedNotification,
PruningPointUtxoSetOverrideNotification,
NewBlockTemplateNotification,
}
impl From<RpcApiOps> for u32 {
fn from(item: RpcApiOps) -> Self {
item as u32
}
}
impl From<EventType> for RpcApiOps {
fn from(item: EventType) -> Self {
match item {
EventType::BlockAdded => RpcApiOps::BlockAddedNotification,
EventType::VirtualChainChanged => RpcApiOps::VirtualChainChangedNotification,
EventType::FinalityConflict => RpcApiOps::FinalityConflictNotification,
EventType::FinalityConflictResolved => RpcApiOps::FinalityConflictResolvedNotification,
EventType::UtxosChanged => RpcApiOps::UtxosChangedNotification,
EventType::SinkBlueScoreChanged => RpcApiOps::SinkBlueScoreChangedNotification,
EventType::VirtualDaaScoreChanged => RpcApiOps::VirtualDaaScoreChangedNotification,
EventType::PruningPointUtxoSetOverride => RpcApiOps::PruningPointUtxoSetOverrideNotification,
EventType::NewBlockTemplate => RpcApiOps::NewBlockTemplateNotification,
}
}
}