mirror of
https://github.com/grassrootseconomics/cic-chain-events.git
synced 2025-04-16 16:11:00 +02:00
add: benthos configs and sample request payload
This commit is contained in:
parent
c7300aada3
commit
91367f3c3f
40
benthos/benthos.yaml
Normal file
40
benthos/benthos.yaml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
input:
|
||||||
|
label: cic_chain_events
|
||||||
|
nats_jetstream:
|
||||||
|
urls:
|
||||||
|
- nats://localhost:4222
|
||||||
|
subject: CHAIN.transfer
|
||||||
|
durable: benthos_sub
|
||||||
|
stream: CHAIN
|
||||||
|
deliver: all
|
||||||
|
pipeline:
|
||||||
|
processors:
|
||||||
|
- label: event_transformer
|
||||||
|
bloblang: |
|
||||||
|
root = this
|
||||||
|
root.timestamp = (this.timestamp).ts_format()
|
||||||
|
root.txType = if this.txType == "transfer" {
|
||||||
|
"TRANSFER"
|
||||||
|
} else if this.txType == "mintTo" {
|
||||||
|
"MINT_TO"
|
||||||
|
} else {
|
||||||
|
"TRANSFER_FROM"
|
||||||
|
}
|
||||||
|
output:
|
||||||
|
broker:
|
||||||
|
outputs:
|
||||||
|
- label: webhooks
|
||||||
|
http_client:
|
||||||
|
url: "https://webhook.site/ab61ace1-52bf-4495-a11a-4630a2a7cb6f"
|
||||||
|
verb: POST
|
||||||
|
timeout: 5s
|
||||||
|
- label: logg
|
||||||
|
stdout:
|
||||||
|
codec: lines
|
||||||
|
|
||||||
|
logger:
|
||||||
|
level: DEBUG
|
||||||
|
format: logfmt
|
||||||
|
add_timestamp: false
|
||||||
|
static_fields:
|
||||||
|
'@service': benthos
|
12
benthos/sample_request.txt
Normal file
12
benthos/sample_request.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"block": 20884999,
|
||||||
|
"contractAddress": "0x8Bab657c88eb3c724486D113E650D2c659aa23d2",
|
||||||
|
"from": "0xc0876400F9D0dAA9554fFD232A322E6E6A0CCF04",
|
||||||
|
"success": true,
|
||||||
|
"timestamp": "2023-08-15T17:57:41+08:00",
|
||||||
|
"to": "0x8f045f2F97724B7C73BC009241D84975b76951bA",
|
||||||
|
"transactionHash": "0x01ab13f2d840fdfcc016d1e1f42f1f28b6413c821fcc479030e99f9cfa0a298d",
|
||||||
|
"transactionIndex": 15,
|
||||||
|
"txType": "TRANSFER",
|
||||||
|
"value": 1000000
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user