Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable transaction details without enabling block details #671

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docs/pages/v2/filters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ _Filters_ are intermediate steps in the pipeline that process events as they tra

These are the existing filters that are included as part the main _Oura_ codebase:

- [Fingerprint](filters/fingerprint.md): a filter that adds a (probably) unique identifier (fingerprint) to each event.
- [Selection](filters/selection.md): a filter that evaluates different built-in predicates to decide which events should go through the pipeline.
- [ParseCbor](filters/parse_cbor.mdx): a filter that maps cbor transactions to a data structure.

### Legacy V1
- [Fingerprint](filters/fingerprint.mdx): a filter that adds a (probably) unique identifier (fingerprint) to each event.
- [Selection](filters/selection.mdx): a filter that evaluates different built-in predicates to decide which events should go through the pipeline.

New filters are being developed, information will be added in this documentation to reflect the updated list. Contributions and feature request are welcome in our [Github Repo](https://github.com/txpipe/oura).
60 changes: 60 additions & 0 deletions docs/pages/v2/filters/parse_cbor.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Parse CBOR filter

The `parse_cbor` filter aims to map cbor transactions to a structured transaction.

However, the filter will only work when the record received in the stage is CborTx in other words a transaction in Cbor format that was previously extracted from a block by another stage, otherwise, parse_cbor will ignore and pass the record to the next stage. When the record is CborTx, parse_cbor will decode and map the Cbor to a structure, so the next stage will receive the ParsedTx record. If no filter is enabled, the stages will receive the record in CborBlock format, and if only the parse_cbor filter is enabled in `daemon.toml`, it will be necessary to enable the [split_cbor](split_block.mdx) filter for the stage to receive the CborTx format.

## Configuration

Adding the following section to the daemon config file will enable the filter as part of the pipeline:

```toml
[[filters]]
type = "ParseCbor"
```

The next pipeline will receive a record ParsedTx with the block transactions structured, for example:

```json
{
"inputs": [
{
"txHash": "RJxOGh8tYw2zJEM4IOe1UyJLgmLzirUeNJyD3WXw0Fs="
},
{
"txHash": "D5zaREMo+A23Fd6mEHYxnf5VwWi1x7AyRZi8rMKyOqQ=",
"outputIndex": 1
}
],
"outputs": [
{
"address": "AR3DnbkA7SpK3ebbYyrOhMQuofbn5bSErXkHS+Rg1t2/czYqcTheAgzPiEIF5fA/z5vj3ZBY3WuF",
"coin": "1717921431"
},
{
"address": "AbUagvWOR+HK85VJqlYyfWgevTEW57nBukEYOPjlTVqn9KaKp7fM4lwUjem4RcV4wgsyFpDgkdlU",
"coin": "7195641470"
}
],
"witnesses": {
"vkeywitness": [
{
"vkey": "gEV61C5PJwtPKv5U+Ha2f1n4cU/axSaa2EXYCQoa71w=",
"signature": "ogVM0RwQZklGjquCWeZdNv5DZDAAHqRxpjKNcaRLv79hDDdyA4+4YQ2f2Mu+svY/BwnIxS65iuhapiITHtvBDg=="
},
{
"vkey": "z+mF66iNeVqtMqfiC7H1F95lvz/JOO00Jmhg+91t3Gs=",
"signature": "ogVM0RwQZklGjquCWeZdNv5DZDAAHqRxpjKNcaRLv78+MW9TxnabFVGgbBO/lttg8NvNAra4VAzUUrhfYcIvBQ=="
}
]
},
"collateral": {},
"fee": "176061",
"validity": {
"start": "52365819",
"ttl": "100045133"
},
"successful": true,
"auxiliary": {}
}
```
2 changes: 1 addition & 1 deletion src/filters/legacy_v1/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ impl EventWriter<'_> {
transactions: None,
};

if self.config.include_block_details {
if self.config.include_block_details || self.config.include_transaction_details {
let txs = source
.txs()
.iter()
Expand Down
Loading