add missing things and make clippy happy
This commit is contained in:
@@ -30,6 +30,8 @@ pub struct ParsedTransactionResponse {
|
||||
|
||||
pub parsed_messages: HashMap<usize, serde_json::Value>,
|
||||
|
||||
pub parsed_message_urls: HashMap<usize, String>,
|
||||
|
||||
pub block: Block,
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ impl RpcClient {
|
||||
let mut transactions = Vec::with_capacity(raw_transactions.len());
|
||||
for raw_tx in raw_transactions {
|
||||
let mut parsed_messages = HashMap::new();
|
||||
let mut parsed_message_urls = HashMap::new();
|
||||
let tx = cosmrs::Tx::from_bytes(&raw_tx.tx).map_err(|source| {
|
||||
ScraperError::TxParseFailure {
|
||||
hash: raw_tx.hash,
|
||||
@@ -83,6 +84,7 @@ impl RpcClient {
|
||||
for (index, msg) in tx.body.messages.iter().enumerate() {
|
||||
if let Some(value) = self.decode_or_skip(msg) {
|
||||
parsed_messages.insert(index, value);
|
||||
parsed_message_urls.insert(index, msg.type_url.clone());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +96,7 @@ impl RpcClient {
|
||||
tx,
|
||||
proof: raw_tx.proof,
|
||||
parsed_messages,
|
||||
parsed_message_urls,
|
||||
block: block.block.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ use nyxd_scraper_psql::{
|
||||
};
|
||||
use reqwest::{Client, Url};
|
||||
use tracing::{error, info};
|
||||
use utoipa::r#gen::serde_json;
|
||||
|
||||
pub struct WebhookModule {
|
||||
webhooks: Vec<Webhook>,
|
||||
@@ -36,10 +35,10 @@ impl TxModule for WebhookModule {
|
||||
_: &mut dyn NyxdScraperTransaction,
|
||||
) -> Result<(), ScraperError> {
|
||||
for (index, msg) in &tx.parsed_messages {
|
||||
if let Some(parsed_message_type_url) = tx.parsed_message_urls.get(&index) {
|
||||
if let Some(parsed_message_type_url) = tx.parsed_message_urls.get(index) {
|
||||
let payload = WebhookPayload {
|
||||
height: tx.height.value(),
|
||||
message_index: index.clone() as u64,
|
||||
message_index: *index as u64,
|
||||
transaction_hash: tx.hash.to_string(),
|
||||
message: Some(msg.clone()),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user