We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d1879b4 commit af62fd5Copy full SHA for af62fd5
graph/src/components/ethereum/adapter.rs
@@ -14,7 +14,6 @@ use web3::types::*;
14
15
use super::types::*;
16
use crate::components::metrics::{CounterVec, GaugeVec, HistogramVec};
17
-use crate::data::subgraph::BlockHandlerData;
18
use crate::prelude::*;
19
20
pub type EventSignature = H256;
graph/src/components/ethereum/types.rs
@@ -7,7 +7,9 @@ use std::convert::TryFrom;
7
use std::fmt;
8
use web3::types::*;
9
10
-use crate::prelude::{EntityKey, SubgraphDeploymentId, ToEntityKey};
+use crate::prelude::{
11
+ anyhow, EntityKey, EthereumBlockHandlerData, SubgraphDeploymentId, ToEntityKey,
12
+};
13
pub type LightEthereumBlock = Block<Transaction>;
@@ -257,6 +259,22 @@ impl Default for BlockType {
257
259
}
258
260
261
262
+impl<'a> From<&'a EthereumBlockHandlerData> for BlockType {
263
+ fn from(block: &'a EthereumBlockHandlerData) -> BlockType {
264
+ match block {
265
+ EthereumBlockHandlerData::Block => BlockType::Light,
266
+ EthereumBlockHandlerData::FullBlock => BlockType::Full,
267
+ EthereumBlockHandlerData::FullBlockWithReceipts => BlockType::FullWithReceipts,
268
+ }
269
270
+}
271
+
272
+#[derive(Clone, Debug, PartialEq, Eq)]
273
+pub struct EthereumBlockTrigger {
274
+ pub block_type: BlockType,
275
+ pub trigger_type: EthereumBlockTriggerType,
276
277
278
#[derive(Clone, Debug, PartialEq, Eq)]
279
pub enum EthereumBlockTriggerType {
280
Every,
graph/src/data/subgraph/mod.rs
@@ -515,26 +515,7 @@ impl UnresolvedMappingABI {
515
pub struct MappingBlockHandler {
516
pub handler: String,
517
pub filter: Option<BlockHandlerFilter>,
518
- pub input: BlockHandlerData,
519
-}
520
-
521
-#[derive(Clone, Debug, Hash, Eq, PartialEq, Deserialize)]
522
-pub enum BlockHandlerData {
523
- Block,
524
- FullBlock,
525
- FullBlockWithReceipts,
526
527
528
-impl From<EthereumBlockHandlerData> for BlockHandlerData {
529
- fn from(data: EthereumBlockHandlerData) -> Self {
530
- match data {
531
- EthereumBlockHandlerData::FullBlockWithReceipts => {
532
- BlockHandlerData::FullBlockWithReceipts
533
- }
534
- EthereumBlockHandlerData::FullBlock => BlockHandlerData::FullBlock,
535
- EthereumBlockHandlerData::Block => BlockHandlerData::Block,
536
537
+ pub input: EthereumBlockHandlerData,
538
539
540
#[derive(Clone, Debug, Hash, Eq, PartialEq, Deserialize)]
@@ -550,7 +531,7 @@ impl From<EthereumBlockHandlerEntity> for MappingBlockHandler {
550
Self {
551
handler: entity.handler,
552
filter: None,
553
- input: BlockHandlerData::from(entity.input),
+ input: entity.input,
554
555
556
graph/src/data/subgraph/schema.rs
@@ -1149,15 +1149,6 @@ impl From<EthereumBlockHandlerData> for String {
1149
1150
1151
1152
-impl From<super::BlockHandlerData> for EthereumBlockHandlerData {
1153
- fn from(data: BlockHandlerData) -> Self {
1154
1155
- BlockHandlerData::FullBlock => EthereumBlockHandlerData::FullBlock,
1156
- _ => EthereumBlockHandlerData::Block,
1157
1158
1159
1160
1161
impl From<EthereumBlockHandlerData> for q::Value {
1162
fn from(data: EthereumBlockHandlerData) -> q::Value {
1163
q::Value::Enum(data.into())
graph/src/lib.rs
@@ -127,9 +127,11 @@ pub mod prelude {
127
AssignmentEvent, Attribute, Entity, NodeId, SubgraphEntityPair, SubgraphVersionSummary,
128
ToEntityId, ToEntityKey, TryIntoEntity, Value, ValueType,
129
};
130
- pub use crate::data::subgraph::schema::{SubgraphDeploymentEntity, TypedEntity};
+ pub use crate::data::subgraph::schema::{
131
+ EthereumBlockHandlerData, SubgraphDeploymentEntity, TypedEntity,
132
+ };
133
pub use crate::data::subgraph::{
- BlockHandlerData, BlockHandlerFilter, CreateSubgraphResult, DataSource, DataSourceContext,
134
+ BlockHandlerFilter, CreateSubgraphResult, DataSource, DataSourceContext,
135
DataSourceTemplate, Link, MappingABI, MappingBlockHandler, MappingCallHandler,
136
MappingEventHandler, SubgraphAssignmentProviderError, SubgraphAssignmentProviderEvent,
137
SubgraphDeploymentId, SubgraphManifest, SubgraphManifestResolveError,
0 commit comments