diff --git a/README.md b/README.md index 16f6ec6..a348df2 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Bridge API -The bridge API is a REST API for fetching proofs from Avail's Kate RPC and Merkle proof service API to submit on Ethereum or +The bridge API is a REST API for fetching proofs from Avail's Bridge RPC and Merkle proof service API to submit on Ethereum or any off-chain proof verification. ## Deploying the bridge API @@ -293,7 +293,7 @@ RUSTFLAGS="-C target-cpu=native" cargo run --profile maxperf "0xf871a08eccb5e838d7d0699e06d85c472bb097d8012c44d790e5d15c5b8465c7abb88180a02581c4c4535083ecd9ea1a314216bbe948f27bccb2e997c7796a9eec8f4c3df0a0c453ceda114a9775f135a7a2687f75e753c6f814789528fb73bb8cb5dec7eac680808080808080808080808080", "0xf8429f31265685397ec9fa17535b5603e86e2b01a583b71373e1b2cbfac2a5bff58fa1a0eb70a047920b4aa1f3a418b52e455694d4e1a2362fd7fbcf16fe53d798311beb" ] - } + } ``` ### Get bridge transactions @@ -360,6 +360,6 @@ RUSTFLAGS="-C target-cpu=native" cargo run --profile maxperf } ``` -### Examples of using bridge api +### Examples of using bridge api * We have prepared a set of examples written in Rust and Typescript to help you understand how to use bridge api. You can explore these examples by visiting our [code examples repository](https://github.com/availproject/avail-bridge-examples). diff --git a/src/main.rs b/src/main.rs index 69747ef..71e82c6 100755 --- a/src/main.rs +++ b/src/main.rs @@ -308,7 +308,7 @@ async fn get_eth_proof( cloned_state .avail_client .request( - "kate_queryDataProof", + "bridge_queryDataProof", rpc_params![index_struct.index, &block_hash], ) .await @@ -334,9 +334,9 @@ async fn get_eth_proof( }); let (data_proof, merkle_proof_response) = join!(data_proof_response_fut, mekrle_proof_response_fut); - let data_proof_res: KateQueryDataProofResponse = data_proof + let data_proof_res: BridgeQueryDataProofResponse = data_proof .map_err(|e| { - tracing::error!("❌ Failed to fetch the kate query data. Error: {e:#}"); + tracing::error!("❌ Failed to fetch the bridge query data proof. Error: {e:#}"); ErrorResponse::with_status_and_headers( anyhow::anyhow!("Something went wrong."), StatusCode::INTERNAL_SERVER_ERROR, @@ -344,9 +344,9 @@ async fn get_eth_proof( ) })? .map_err(|e| { - tracing::error!("❌ Failed to get the kate query data. Error: {e:#}"); + tracing::error!("❌ Failed to get the bridge query data proof. Error: {e:#}"); ErrorResponse::with_status_and_headers( - anyhow::anyhow!("Failed to get the kate query data."), + anyhow::anyhow!("Failed to get the bridge query data proof."), StatusCode::BAD_REQUEST, &[("Cache-Control", "public, max-age=60, must-revalidate")], ) @@ -679,7 +679,7 @@ async fn get_proof( } } - let data_proof_response_fut = spawn_kate_proof(state.clone(), index, block_hash); + let data_proof_response_fut = spawn_data_proof(state.clone(), index, block_hash); let merkle_proof_range_fut = spawn_merkle_proof_range_fetch(state.clone(), block_hash); let (data_proof, range_response) = join!(data_proof_response_fut, merkle_proof_range_fut); @@ -697,9 +697,9 @@ async fn get_proof( || err_str.contains("Cannot fetch tx data") || err_str.contains("is not finalized"); if is_warn { - tracing::warn!("Cannot get kate data proof response: {:?}", e); + tracing::warn!("Cannot get bridge data proof response: {:?}", e); } else { - tracing::error!("Cannot get kate data proof response: {:?}", e); + tracing::error!("Cannot get bridge data proof response: {:?}", e); } ErrorResponse::with_status_and_headers( anyhow!("error: {e:#}"), @@ -771,16 +771,16 @@ async fn get_proof( .into_response()) } -// spawn_kate_proof fetch queryDataProof from Avail chain -fn spawn_kate_proof( +// spawn_data_proof fetches queryDataProof from Avail chain. +fn spawn_data_proof( state: Arc, index: u32, block_hash: B256, -) -> JoinHandle> { +) -> JoinHandle> { tokio::spawn(async move { state .avail_client - .request("kate_queryDataProof", rpc_params![index, &block_hash]) + .request("bridge_queryDataProof", rpc_params![index, &block_hash]) .await }) } diff --git a/src/models.rs b/src/models.rs index dccb254..f6dd0e8 100644 --- a/src/models.rs +++ b/src/models.rs @@ -138,7 +138,7 @@ pub struct ProofQueryStruct { #[derive(Deserialize, Serialize)] #[serde(rename_all = "camelCase")] -pub struct KateQueryDataProofResponse { +pub struct BridgeQueryDataProofResponse { pub data_proof: DataProof, #[serde(skip_serializing_if = "Option::is_none")] pub message: Option, @@ -209,7 +209,7 @@ pub struct AggregatedResponse { impl AggregatedResponse { pub fn new( range_data: MerkleProofData, - data_proof_res: KateQueryDataProofResponse, + data_proof_res: BridgeQueryDataProofResponse, hash: B256, ) -> Self { AggregatedResponse {