Skip to content

Commit 37c4c05

Browse files
committed
graph, runtime/wasm: Make EthereumEventData's log_type value optional
1 parent 46db4bf commit 37c4c05

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

graph/src/components/ethereum/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub struct EthereumEventData {
8787
pub address: Address,
8888
pub log_index: U256,
8989
pub transaction_log_index: U256,
90-
pub log_type: String,
90+
pub log_type: Option<String>,
9191
pub block: EthereumBlockData,
9292
pub transaction: EthereumTransactionData,
9393
pub params: Vec<LogParam>,

runtime/wasm/src/module/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ where
219219
address: log.address,
220220
log_index: log.log_index.unwrap_or(U256::zero()),
221221
transaction_log_index: log.transaction_log_index.unwrap_or(U256::zero()),
222-
log_type: log.log_type.clone().unwrap_or("None".to_string()),
222+
log_type: log.log_type.clone(),
223223
params,
224224
};
225225

runtime/wasm/src/to_from/external.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,11 @@ impl ToAscObj<AscEthereumEvent> for EthereumEventData {
295295
log_index: heap.asc_new(&BigInt::from_unsigned_u256(&self.log_index)),
296296
transaction_log_index: heap
297297
.asc_new(&BigInt::from_unsigned_u256(&self.transaction_log_index)),
298-
log_type: heap.asc_new(&self.log_type),
298+
log_type: self
299+
.log_type
300+
.clone()
301+
.map(|log_type| heap.asc_new(&log_type))
302+
.unwrap_or_else(|| AscPtr::null()),
299303
block: heap.asc_new(&self.block),
300304
transaction: heap.asc_new(&self.transaction),
301305
params: heap.asc_new(self.params.as_slice()),

0 commit comments

Comments
 (0)