mod alert;
mod block_template;
mod blockchain;
mod bytes;
mod cell;
mod debug;
mod experiment;
mod fee_rate;
mod fixed_bytes;
mod indexer;
mod info;
mod json_schema;
mod net;
mod pool;
mod primitive;
mod proposal_short_id;
mod subscription;
mod uints;
#[cfg(test)]
mod tests;
pub use self::alert::{Alert, AlertId, AlertMessage, AlertPriority};
pub use self::block_template::{
BlockTemplate, CellbaseTemplate, TransactionTemplate, UncleTemplate,
};
pub use self::blockchain::{
Block, BlockEconomicState, BlockFilter, BlockIssuance, BlockResponse, BlockView,
BlockWithCyclesResponse, CellDep, CellInput, CellOutput, Consensus, DepType, Deployment,
EpochView, FeeRateStatistics, HardForkFeature, HardForks, Header, HeaderView, MerkleProof,
MinerReward, OutPoint, ProposalWindow, Ratio, Script, ScriptHashType, SoftFork, Status,
Transaction, TransactionAndWitnessProof, TransactionProof, TransactionView,
TransactionWithStatusResponse, TxStatus, UncleBlock, UncleBlockView,
};
pub use self::bytes::JsonBytes;
pub use self::cell::{CellData, CellInfo, CellWithStatus};
pub use self::debug::{ExtraLoggerConfig, MainLoggerConfig};
pub use self::experiment::{DaoWithdrawingCalculationKind, EstimateCycles};
pub use self::fee_rate::FeeRateDef;
pub use self::fixed_bytes::Byte32;
pub use self::info::{ChainInfo, DeploymentInfo, DeploymentPos, DeploymentState, DeploymentsInfo};
pub use self::net::{
BannedAddr, LocalNode, LocalNodeProtocol, NodeAddress, PeerSyncState, RemoteNode,
RemoteNodeProtocol, SyncState,
};
pub use self::pool::{
AncestorsScoreSortKey, EntryCompleted, OutputsValidator, PoolTransactionEntry,
PoolTransactionReject, PoolTxDetailInfo, RawTxPool, TxPoolEntries, TxPoolEntry, TxPoolIds,
TxPoolInfo,
};
pub use self::proposal_short_id::ProposalShortId;
pub use self::subscription::Topic;
pub use self::uints::{Uint128, Uint32, Uint64};
pub use ckb_types::core::RationalU256;
pub use indexer::{
IndexerCell, IndexerCellType, IndexerCellsCapacity, IndexerOrder, IndexerPagination,
IndexerRange, IndexerScriptType, IndexerSearchKey, IndexerSearchKeyFilter, IndexerSearchMode,
IndexerTip, IndexerTx, IndexerTxWithCell, IndexerTxWithCells,
};
pub use primitive::{
AsEpochNumberWithFraction, BlockNumber, Capacity, Cycle, EpochNumber, EpochNumberWithFraction,
Timestamp, Version,
};
use schemars::JsonSchema;
pub use serde::{Deserialize, Serialize};
use ckb_types::bytes::Bytes;
#[derive(PartialEq, Eq, Hash, Debug, Serialize, Deserialize, Clone, JsonSchema)]
#[serde(untagged)]
pub enum Either<L, R> {
Left(L),
Right(R),
}
#[derive(PartialEq, Eq, Hash, Debug, Serialize, Deserialize, Clone, JsonSchema)]
#[serde(transparent)]
pub struct ResponseFormat<V> {
pub inner: Either<V, JsonBytes>,
}
pub enum ResponseFormatInnerType {
Json,
Hex,
}
impl<V> ResponseFormat<V> {
pub fn json(json: V) -> Self {
ResponseFormat {
inner: Either::Left(json),
}
}
pub fn hex(raw: Bytes) -> Self {
ResponseFormat {
inner: Either::Right(JsonBytes::from_bytes(raw)),
}
}
}