add: benthos configs and sample request payload

This commit is contained in:
Mohamed Sohail 2023-08-15 18:03:11 +08:00
parent c7300aada3
commit 91367f3c3f
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D
2 changed files with 52 additions and 0 deletions

40
benthos/benthos.yaml Normal file
View 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

View 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
}