Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "id": "6cf1e4286453fc30",
- "type": "group",
- "z": "b252dda0d4dd6d02",
- "name": "Streamr node notif",
- "style": {
- "label": true
- },
- "nodes": [
- "ba979465f2821314",
- "8fc3e8ab2e3af2b5",
- "5c75b1e85eba64ed",
- "9f6aa09d1186a50a",
- "d1e1b2fdaa0efba3",
- "6e24995bb0c670b7",
- "e7c17de827a13755",
- "09a7a53ecb1f699c",
- "34082702076f8f6f",
- "b4d3917280530ca1",
- "acfdcf2a78af6a30",
- "10d898338765abcb"
- ],
- "x": 34,
- "y": 1899,
- "w": 712,
- "h": 342
- },
- {
- "id": "ba979465f2821314",
- "type": "inject",
- "z": "b252dda0d4dd6d02",
- "g": "6cf1e4286453fc30",
- "name": "",
- "props": [
- {
- "p": "payload"
- },
- {
- "p": "address",
- "v": "0xc82e91d6656276d34465f634da39b6e94ccd5a38",
- "vt": "str"
- }
- ],
- "repeat": "",
- "crontab": "00 18 * * *",
- "once": false,
- "onceDelay": 0.1,
- "topic": "",
- "payload": "",
- "payloadType": "date",
- "x": 150,
- "y": 1940,
- "wires": [
- [
- "8fc3e8ab2e3af2b5"
- ]
- ]
- },
- {
- "id": "8fc3e8ab2e3af2b5",
- "type": "http request",
- "z": "b252dda0d4dd6d02",
- "g": "6cf1e4286453fc30",
- "name": "reward_url",
- "method": "GET",
- "ret": "obj",
- "paytoqs": "ignore",
- "url": "https://brubeck1.streamr.network:3013/datarewards/{{address}}",
- "tls": "",
- "persist": false,
- "proxy": "",
- "insecureHTTPParser": false,
- "authType": "",
- "senderr": false,
- "headers": [],
- "x": 370,
- "y": 1940,
- "wires": [
- [
- "9f6aa09d1186a50a"
- ]
- ]
- },
- {
- "id": "5c75b1e85eba64ed",
- "type": "http request",
- "z": "b252dda0d4dd6d02",
- "g": "6cf1e4286453fc30",
- "name": "api_telegraphe",
- "method": "POST",
- "ret": "obj",
- "paytoqs": "body",
- "url": "https://api.thegraph.com/subgraphs/name/streamr-dev/data-on-polygon",
- "tls": "",
- "persist": false,
- "proxy": "",
- "insecureHTTPParser": false,
- "authType": "",
- "senderr": false,
- "headers": [],
- "x": 340,
- "y": 2080,
- "wires": [
- [
- "e7c17de827a13755"
- ]
- ]
- },
- {
- "id": "9f6aa09d1186a50a",
- "type": "function",
- "z": "b252dda0d4dd6d02",
- "g": "6cf1e4286453fc30",
- "name": "reward",
- "func": "msg.reward_url = msg.payload\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 590,
- "y": 1940,
- "wires": [
- [
- "d1e1b2fdaa0efba3"
- ]
- ]
- },
- {
- "id": "d1e1b2fdaa0efba3",
- "type": "http request",
- "z": "b252dda0d4dd6d02",
- "g": "6cf1e4286453fc30",
- "name": "personalnodes_url",
- "method": "GET",
- "ret": "obj",
- "paytoqs": "ignore",
- "url": "https://brubeck1.streamr.network:3013/stats/{{address}}",
- "tls": "",
- "persist": false,
- "proxy": "",
- "insecureHTTPParser": false,
- "authType": "",
- "senderr": false,
- "headers": [],
- "x": 350,
- "y": 2020,
- "wires": [
- [
- "6e24995bb0c670b7"
- ]
- ]
- },
- {
- "id": "6e24995bb0c670b7",
- "type": "function",
- "z": "b252dda0d4dd6d02",
- "g": "6cf1e4286453fc30",
- "name": "personal / balance",
- "func": "msg.personalnodes_url = msg.payload\n\nmsg.payload ={\n 'query': '{\\n erc20Balances(where: {account: \"'+ msg.address +'\", contract:\"0x3a9a81d576d83ff21f26f325066054540720fc34\"}) {\\n value \\n }\\n}',\n }\n\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 630,
- "y": 2020,
- "wires": [
- [
- "5c75b1e85eba64ed"
- ]
- ]
- },
- {
- "id": "e7c17de827a13755",
- "type": "function",
- "z": "b252dda0d4dd6d02",
- "g": "6cf1e4286453fc30",
- "name": "balance / transfert",
- "func": "msg.balance = msg.payload\nmsg.payload =\n{\n 'query': '{\\n erc20Transfers(\\n where: {\\n from: \"0x3979f7d6b5c5bfa4bcd441b4f35bfa0731ccfaef\"\\n to: \"' + msg.address + '\"\\n timestamp_gt: \"1646065752\"\\n }\\n ) {\\n timestamp\\n value\\n }\\n}\\n',\n }\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 630,
- "y": 2080,
- "wires": [
- [
- "09a7a53ecb1f699c"
- ]
- ]
- },
- {
- "id": "09a7a53ecb1f699c",
- "type": "http request",
- "z": "b252dda0d4dd6d02",
- "g": "6cf1e4286453fc30",
- "name": "api_telegraphe",
- "method": "POST",
- "ret": "obj",
- "paytoqs": "body",
- "url": "https://api.thegraph.com/subgraphs/name/streamr-dev/data-on-polygon",
- "tls": "",
- "persist": false,
- "proxy": "",
- "insecureHTTPParser": false,
- "authType": "",
- "senderr": false,
- "headers": [],
- "x": 320,
- "y": 2140,
- "wires": [
- [
- "34082702076f8f6f"
- ]
- ]
- },
- {
- "id": "34082702076f8f6f",
- "type": "function",
- "z": "b252dda0d4dd6d02",
- "g": "6cf1e4286453fc30",
- "name": "balance / transfert",
- "func": "msg.transfert = msg.payload\ndelete msg.payload\ndelete msg.statusCode\ndelete msg.responseUrl\ndelete msg.redirectList\ndelete msg.retry\ndelete msg.header\n\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 630,
- "y": 2140,
- "wires": [
- [
- "b4d3917280530ca1"
- ]
- ]
- },
- {
- "id": "b4d3917280530ca1",
- "type": "function",
- "z": "b252dda0d4dd6d02",
- "g": "6cf1e4286453fc30",
- "name": "intel",
- "func": "// parse a date in yyyy-mm-dd format\nfunction dateDiff(date1, date2){\n var diff = {} // Initialisation du retour\n var tmp = date2 - date1;\n \n tmp = Math.floor(tmp/1000); // Nombre de secondes entre les 2 dates\n diff.sec = tmp % 60; // Extraction du nombre de secondes\n \n tmp = Math.floor((tmp-diff.sec)/60); // Nombre de minutes (partie entière)\n diff.min = tmp % 60; // Extraction du nombre de minutes\n \n tmp = Math.floor((tmp-diff.min)/60); // Nombre d'heures (entières)\n diff.hour = tmp % 24; // Extraction du nombre d'heures\n \n tmp = Math.floor((tmp-diff.hour)/24); // Nombre de jours restants\n diff.day = tmp;\n \n return diff;\n}\n\nmsg.first_reward = new Date(msg.personalnodes_url.claimedRewardCodes[0].claimTime).getTime()\nmsg.now = new Date().getTime();\n\nnb_reward = msg.personalnodes_url.claimedRewardCodes.length-1\nmsg.last_date = new Date(msg.personalnodes_url.claimedRewardCodes[nb_reward].claimTime).getTime()\n\nmsg.date_first_reward_diff = dateDiff(msg.first_reward, msg.now);\n// msg.nb_days =dateDiff;\nif (msg.date_first_reward_diff.hour >12)\n msg.nb_days =msg.date_first_reward_diff.day + 1;\nelse\n msg.nb_days =msg.date_first_reward_diff.day;\n\nmsg.moyenne_reward_per_days = msg.reward_url.DATA / msg.nb_days;\n\nmsg.date_last_reward_diff = dateDiff( msg.last_date,msg.now)\nif ((msg.date_last_reward_diff.hour > 1 )|| ( msg.date_last_reward_diff.hour == 1 && msg.date_last_reward_diff.minute > 30) )\n msg.status_node = \"offline\";\nelse\n msg.status_node = \"online\";\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 290,
- "y": 2200,
- "wires": [
- [
- "acfdcf2a78af6a30"
- ]
- ]
- },
- {
- "id": "acfdcf2a78af6a30",
- "type": "function",
- "z": "b252dda0d4dd6d02",
- "g": "6cf1e4286453fc30",
- "name": "data",
- "func": "var reward = msg.reward_url.DATA;\nvar total_Stack = msg.balance.data.erc20Balances[0].value\nvar status = msg.status_node\nvar received_rewards = msg.transfert.data.erc20Transfers[0].value\n\nmsg.reward = \"Accumulated rewards : \" + reward + \"\\n\";\nmsg.total_Stack = \"Total Stacked : \" + total_Stack + \"\\n\";\nmsg.received_rewards = \"Received rewards : \" + received_rewards + \"\\n\";\nmsg.status = \"Node Status : \" + status;\n\nvar message = msg.reward + msg.total_Stack + msg.received_rewards + msg.status;\n\nmsg.payload = { chatId: 5077529871, type: 'message', content: message };\n\n// activate markdown\nmsg.payload.options = { disable_web_page_preview: true, parse_mode: \"Markdown\" };\nreturn msg;\n\n",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 430,
- "y": 2200,
- "wires": [
- [
- "10d898338765abcb"
- ]
- ]
- },
- {
- "id": "10d898338765abcb",
- "type": "telegram sender",
- "z": "b252dda0d4dd6d02",
- "g": "6cf1e4286453fc30",
- "name": "",
- "bot": "ae7c2cc7aca85f86",
- "haserroroutput": false,
- "outputs": 1,
- "x": 630,
- "y": 2200,
- "wires": [
- []
- ]
- },
- {
- "id": "ae7c2cc7aca85f86",
- "type": "telegram bot",
- "botname": "streamrbot",
- "usernames": "",
- "chatids": "",
- "baseapiurl": "",
- "updatemode": "polling",
- "pollinterval": "300",
- "usesocks": false,
- "sockshost": "",
- "socksprotocol": "socks5",
- "socksport": "6667",
- "socksusername": "anonymous",
- "sockspassword": "",
- "bothost": "",
- "botpath": "",
- "localbotport": "8443",
- "publicbotport": "8443",
- "privatekey": "",
- "certificate": "",
- "useselfsignedcertificate": false,
- "sslterminated": false,
- "verboselogging": false
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement