Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andresilva/submarine
event-based monitoring and alerting for substrate-based blockchains
https://github.com/andresilva/submarine
Last synced: 12 days ago
JSON representation
event-based monitoring and alerting for substrate-based blockchains
- Host: GitHub
- URL: https://github.com/andresilva/submarine
- Owner: andresilva
- License: mit
- Created: 2022-01-17T19:09:13.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-04T16:36:15.000Z (almost 3 years ago)
- Last Synced: 2024-12-20T22:05:50.146Z (13 days ago)
- Language: TypeScript
- Homepage:
- Size: 277 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# submarine
Submarine is a utility application for monitoring substrate-based blockchains
and sending notifications when certain events happen.## Event matching
In order to match events the application supports a simple pattern-matching interface.
``` javascript
// minimal form, matches all events of this type
module-name.EventName// matches events of this type whose arguments match the given values
module-name.EventName(1, asdf, 0x7899)// matches events of this type where the second argument matches the given value.
// underscore (_) is used as a wildcard operator.
module-name.EventName(_, asdf, _)
```A list of events supported by polkadot.js can be found [here](https://polkadot.js.org/docs/substrate/events).
## Notifications
Currently the application supports sending notifications over HTTP, Email and SMS.
The payload of the notification is a JSON-encoded representation of the matched event and its parameters.
``` json
{
"name": "balances.Transfer",
"params": [
"111111111111111111111111111111111HC",
"163KH1bkorFNdyVktuFAoVdCHWz7HChPB7BrzfJFQvsFLgn",
"42"
]
}
```## Sample config
``` toml
[services.smtp]
host = "smtp.example.com"
user = "user"
password = "password"
from_email = "[email protected]"[services.twilio]
account_sid = "sid"
auth_token = "token"
from_number = "+1111111111"[notifications]
http = [{ url = "http://example.com/notification" }]
sms = [{ number = "+351123456789" }]
email = [{ email = "[email protected]" }][[events]]
matcher = "balances.Transfer"[[events]]
matcher = "crowdloan.Contributed(_, 1337, _)"
```## Running
``` shell
# expects a config file at ./config.toml
yarn start# you can pass the config file location as a parameter
yarn start ~/.config/submarine/config.toml
```This project includes a derivation for packaging with nix.
``` shell
nix-build
./result/bin/submarine
```