General Informant
- Agent ID
- informant
- APIs
- webhooks, streams
- Networks
- all
Input Arguments
Argument | Description | Required |
---|---|---|
networks | A set of network IDs . | yes |
filter | An event or extrinsic filter expression. See the Filters section . | yes |
You can retrieve the input schema from https://api.ocelloids.net/agents/informant/inputs .
Informant Arguments JSON Schema
{
"type": "object",
"properties": {
"networks": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
},
"filter": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"event",
"extrinsic"
]
},
"match": {
"type": "string"
}
},
"required": [
"type",
"match"
],
"additionalProperties": false
}
},
"required": [
"networks",
"filter"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
Filters
The filter object can be of type event
or extrinsic
.
The match
property is a
MongoDB Query Language
expression over the extended event or flattened extrinsic data.
See Output Payload section for details on the extended event and extrinsic data.
Examples
Deposit Events with Amount Condition
This example captures deposit events with amount above certain big number.
{
"id": "my-subscription-id",
"agent": "informant",
"args": {
"networks": [
"urn:ocn:polkadot:0",
"urn:ocn:polkadot:1000"
],
"filter": {
"type": "event",
"match": {
"section": "balances",
"$or": [
{ "method": "Deposit" },
{ "method": "Transfer" }
],
"data.amount": {
"$bn_gte": "15000000"
}
}
}
},
"channels": [
{
"type":"websocket"
}
]
}
Balance Exstrinsics with Amount and Tip Condition
Note that due to the flattening of the nested exstrinc calls (e.g. batch, proxy, multisig, etc.), the method data is held in the call
property.
The rest of the extrinsic properties are the same as the output payload.
This example captures balance extrinsics with amount above certain big number and tip below.
{
"id": "my-subscription-id",
"agent": "informant",
"args":{
"networks": ["urn:ocn:polkadot:0", "urn:ocn:polkadot:1000"],
"filter": {
"type": "extrinsic",
"match": {
"extrinsic.call.section": "balances",
"extrinsic.call.method": { "$in": [
"transferAllowDeath",
"transferKeepAlive"
]},
"extrinsic.call.args.value": {
"$bn_gte": "15000000"
},
"extrinsic.tip": {
"$bn_lte": "1000"
}
}
}
},
"channels": [
{
"type":"websocket"
}
]
}
Output
The output contains metadata and payload.
Metadata
An example of the metadata structure:
{
"type": "extrinsic",
"subscriptionId": "01J28VSJ67CGDE3H1TPFSTQCMJ",
"agentId": "informant",
"networkId": "urn:ocn:polkadot:0",
"timestamp": 1720431987339
}
Check below for example payloads.
Payload: Extended Extrinsics
Example Extended Extrinsic Data
{
"events": [
{
"eventId": "21555292-46",
"blockPosition": 46,
"blockNumber": "21,555,292",
"blockHash": "0xc85376d27b3c4ba4e8bd74f316495ce3e6f49604fe34841d2c48b707f4566a8b",
"method": "Withdraw",
"section": "balances",
"index": "0x0508",
"data": {
"who": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath",
"amount": "160,186,488"
}
},
{
"eventId": "21555292-47",
"blockPosition": 47,
"blockNumber": "21,555,292",
"blockHash": "0xc85376d27b3c4ba4e8bd74f316495ce3e6f49604fe34841d2c48b707f4566a8b",
"method": "NewAccount",
"section": "system",
"index": "0x0003",
"data": {
"account": "13sNrVnox76yTxbvo89tnA5Me3nuRa5XqyHWNtdAxTqeFyQz"
}
},
{
"eventId": "21555292-48",
"blockPosition": 48,
"blockNumber": "21,555,292",
"blockHash": "0xc85376d27b3c4ba4e8bd74f316495ce3e6f49604fe34841d2c48b707f4566a8b",
"method": "Endowed",
"section": "balances",
"index": "0x0500",
"data": {
"account": "13sNrVnox76yTxbvo89tnA5Me3nuRa5XqyHWNtdAxTqeFyQz",
"freeBalance": "79,245,800,000"
}
},
{
"eventId": "21555292-49",
"blockPosition": 49,
"blockNumber": "21,555,292",
"blockHash": "0xc85376d27b3c4ba4e8bd74f316495ce3e6f49604fe34841d2c48b707f4566a8b",
"method": "Transfer",
"section": "balances",
"index": "0x0502",
"data": {
"from": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath",
"to": "13sNrVnox76yTxbvo89tnA5Me3nuRa5XqyHWNtdAxTqeFyQz",
"amount": "79,245,800,000"
}
},
{
"eventId": "21555292-50",
"blockPosition": 50,
"blockNumber": "21,555,292",
"blockHash": "0xc85376d27b3c4ba4e8bd74f316495ce3e6f49604fe34841d2c48b707f4566a8b",
"method": "Deposit",
"section": "balances",
"index": "0x0507",
"data": {
"who": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath",
"amount": "0"
}
},
{
"eventId": "21555292-51",
"blockPosition": 51,
"blockNumber": "21,555,292",
"blockHash": "0xc85376d27b3c4ba4e8bd74f316495ce3e6f49604fe34841d2c48b707f4566a8b",
"method": "Deposit",
"section": "balances",
"index": "0x0507",
"data": {
"who": "13UVJyLnbVp9RBZYFwFGyDvVd1y27Tt8tkntv6Q7JVPhFsTB",
"amount": "128,149,190"
}
},
{
"eventId": "21555292-52",
"blockPosition": 52,
"blockNumber": "21,555,292",
"blockHash": "0xc85376d27b3c4ba4e8bd74f316495ce3e6f49604fe34841d2c48b707f4566a8b",
"method": "Deposit",
"section": "balances",
"index": "0x0507",
"data": {
"who": "129QVy2hCC4fdLsjK7d6vt6DrT6Mj8A3M4nr8oL1jEXcdVVm",
"amount": "32,037,298"
}
},
{
"eventId": "21555292-53",
"blockPosition": 53,
"blockNumber": "21,555,292",
"blockHash": "0xc85376d27b3c4ba4e8bd74f316495ce3e6f49604fe34841d2c48b707f4566a8b",
"method": "TransactionFeePaid",
"section": "transactionPayment",
"index": "0x2000",
"data": {
"who": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath",
"actualFee": "160,186,488",
"tip": "0"
}
},
{
"eventId": "21555292-54",
"blockPosition": 54,
"blockNumber": "21,555,292",
"blockHash": "0xc85376d27b3c4ba4e8bd74f316495ce3e6f49604fe34841d2c48b707f4566a8b",
"method": "ExtrinsicSuccess",
"section": "system",
"index": "0x0000",
"data": {
"dispatchInfo": {
"weight": {
"refTime": "275,596,000",
"proofSize": "3,593"
},
"class": "Normal",
"paysFee": "Yes"
}
}
}
],
"dispatchInfo": {
"weight": {
"refTime": "275,596,000",
"proofSize": "3,593"
},
"class": "Normal",
"paysFee": "Yes"
},
"extrinsic": {
"extrinsicId": "21555292-2",
"blockNumber": "21,555,292",
"blockHash": "0xc85376d27b3c4ba4e8bd74f316495ce3e6f49604fe34841d2c48b707f4566a8b",
"position": 2,
"extraSigners": [],
"isSigned": true,
"method": {
"args": {
"dest": {
"Id": "13sNrVnox76yTxbvo89tnA5Me3nuRa5XqyHWNtdAxTqeFyQz"
},
"value": "79,245,800,000"
},
"method": "transferAllowDeath",
"section": "balances"
},
"assetId": null,
"era": {
"ImmortalEra": "0x00"
},
"metadataHash": null,
"nonce": "87,538",
"signature": "0x22fde7a66034dfda18f1b1a9bd83aaee451825fb2338acec46264c9f6897a63e11b8a40832eeb0d0d044e2a017cbd8133759ed9474f1c3733e64562e853d190c",
"signer": {
"Id": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath"
},
"tip": "0"
}
}
Payload: Extended Events
Example Extended Event Data
{
"extrinsicId":"21186272-2",
"extrinsicPosition":5,
"extrinsic":{
"extrinsicId":"21186272-2",
"blockNumber":"21,186,272",
"blockHash":"0xcbe5e205f3cc231495573230c64d6510efe29f002b8e710c2f9f42180d711a7b",
"position":2,
"extraSigners":[
],
"isSigned":true,
"method":{
"args":{
"dest":{
"Id":"16M8NVHLMte1vhBYxCaeb9Rqnc6nZzgUcXcHqLxsRCWenBVL"
},
"value":"17,999,841,813,512"
},
"method":"transferAllowDeath",
"section":"balances"
},
"assetId":null,
"era":{
"MortalEra":{
"period":"64",
"phase":"28"
}
},
"metadataHash":null,
"nonce":"0",
"signature":"0x16589fab613fb16f9cb6fe2d52fbb98e18eebde7618f07e514ba7631fd16f1fc60bb8ade0115d3a50f01e723f7335cceb9c67be3f91a7a9fda0340a2ed0c2300",
"signer":{
"Id":"13UjRtoy9QJQbG4KXLQ44PbagDPjpPasdBRVQv6kuWKB5XUE"
},
"tip":"0"
},
"eventId":"21186272-50",
"blockPosition":50,
"blockNumber":"21,186,272",
"blockHash":"0xcbe5e205f3cc231495573230c64d6510efe29f002b8e710c2f9f42180d711a7b",
"method":"Deposit",
"section":"balances",
"index":"0x0507",
"data":{
"who":"15UjmGk7qn992vQ2TjQzVSYrrbM3eMUHReCF5TxL7RmpjpJn",
"amount":"31,637,298"
}
}