Skip to content

Commit

Permalink
Optimize other apis.
Browse files Browse the repository at this point in the history
  • Loading branch information
cowbeer committed Apr 9, 2024
1 parent 36cb937 commit cd50094
Show file tree
Hide file tree
Showing 13 changed files with 151 additions and 141 deletions.
7 changes: 7 additions & 0 deletions explorer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::service::v2::asset::get_assets;
use crate::service::v2::block::{get_block_by_hash, get_block_by_num, get_blocks};
use crate::service::v2::claim::{get_claim_by_tx_hash, get_claims};
use crate::service::v2::delegation::{get_delegation_by_tx_hash, get_delegations};
use crate::service::v2::other::{get_address_count, get_statistics, get_tx_distribute};
use crate::service::v2::prism_evm_to_native::{get_e2n_by_tx_hash, get_e2n_txs};
use crate::service::v2::prism_native_to_evm::{get_n2e_by_tx_hash, get_n2e_txs};
use crate::service::v2::transaction::{get_tx_by_hash, get_txs};
Expand Down Expand Up @@ -52,6 +53,12 @@ async fn main() -> Result<()> {
.allow_headers(Any);
let addr = format!("{}:{}", config.server.addr, config.server.port);
let app = Router::new()
.route("/api/address/count", get(get_address_count))
.route("/api/chain/statistics", get(get_statistics))
.route("/api/txs/distribute", get(get_tx_distribute))
.route("/api/v2/txs/distribute", get(get_tx_distribute))
.route("/api/v2/address/count", get(get_address_count))
.route("/api/v2/chain/statistic", get(get_statistics))
.route("/api/v2/number/block", get(get_block_by_num))
.route("/api/v2/hash/block", get(get_block_by_hash))
.route("/api/v2/blocks", get(get_blocks))
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions explorer/src/service/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use poem_openapi::Tags;

pub mod api;
pub mod error;
pub mod util;
pub mod v1;
pub mod v2;
Expand Down
3 changes: 1 addition & 2 deletions explorer/src/service/v2/asset.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::service::v2::error::internal_error;
use crate::service::v2::error::Result;
use crate::service::error::{internal_error, Result};
use crate::service::v2::QueryResult;
use crate::AppState;
use axum::extract::{Query, State};
Expand Down
3 changes: 1 addition & 2 deletions explorer/src/service/v2/block.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::service::v2::error::internal_error;
use crate::service::v2::error::Result;
use crate::service::error::{internal_error, Result};
use crate::service::v2::QueryResult;
use crate::AppState;
use axum::extract::{Query, State};
Expand Down
2 changes: 1 addition & 1 deletion explorer/src/service/v2/claim.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::service::v2::error::{internal_error, Result};
use crate::service::error::{internal_error, Result};
use crate::service::v2::QueryResult;
use crate::AppState;
use axum::extract::{Query, State};
Expand Down
2 changes: 1 addition & 1 deletion explorer/src/service/v2/delegation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::service::v2::error::{internal_error, Result};
use crate::service::error::{internal_error, Result};
use crate::service::v2::QueryResult;
use crate::AppState;
use axum::extract::{Query, State};
Expand Down
1 change: 0 additions & 1 deletion explorer/src/service/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pub mod asset;
pub mod block;
pub mod claim;
pub mod delegation;
pub mod error;
pub mod other;
pub mod prism_evm_to_native;
pub mod prism_native_to_evm;
Expand Down
Loading

0 comments on commit cd50094

Please sign in to comment.