Skip to content

Instantly share code, notes, and snippets.

@kandrianov
Created November 1, 2017 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kandrianov/66605415fc9b1e46d6fad27a33578aa6 to your computer and use it in GitHub Desktop.
Save kandrianov/66605415fc9b1e46d6fad27a33578aa6 to your computer and use it in GitHub Desktop.
asdsa
[
{
"id": "a0b32d0f.b8bb2",
"type": "tab",
"label": "Ethereum"
},
{
"id": "907c54b7.0448a8",
"type": "tab",
"label": "Save to contract"
},
{
"id": "2402955.eef8a6a",
"type": "tab",
"label": "Read from contract"
},
{
"id": "d863f3cc.f9f4f",
"type": "tab",
"label": "Read from golos"
},
{
"id": "e5228a9c.3dd578",
"type": "tab",
"label": "Save to golos"
},
{
"id": "5764a33c.5e14dc",
"type": "tab",
"label": "Crosschain"
},
{
"id": "305ec38b.01864c",
"type": "twilio-api",
"z": "",
"sid": "",
"from": "+18182908731",
"name": "+18182908731"
},
{
"id": "2ff5e270.6de32e",
"type": "ping",
"z": "907c54b7.0448a8",
"name": "ping",
"host": "google.notcom",
"timer": "5",
"x": 126.50003051757812,
"y": 115.00003051757812,
"wires": [
[
"3a7c2932.59b2b6",
"b4fbf129.21a52"
]
]
},
{
"id": "3a7c2932.59b2b6",
"type": "function",
"z": "907c54b7.0448a8",
"name": "check",
"func": "const isOnline = msg.payload > 0 ? true : false;\nlet isChanged = false;\n\nif(flow.get('isOnline') != isOnline) {\n isChanged = true;\n flow.set('isOnline', isOnline);\n}\n\nreturn {\n payload: {\n isChanged: isChanged,\n isOnline: isOnline,\n }\n \n};",
"outputs": 1,
"noerr": 0,
"x": 130.50003814697266,
"y": 182.0000295639038,
"wires": [
[
"d5c69c50.5615c"
]
]
},
{
"id": "9f1796b4.f76308",
"type": "twilio out",
"z": "2402955.eef8a6a",
"twilio": "305ec38b.01864c",
"twilioType": "sms",
"url": "",
"number": "",
"name": "sms",
"x": 512.0000076293945,
"y": 386.00000381469727,
"wires": []
},
{
"id": "5c948a86.894904",
"type": "function",
"z": "2402955.eef8a6a",
"name": "check",
"func": "let isChanged = false;\n\nif(flow.get('currentValue') != msg.payload) {\n isChanged = true;\n flow.set('currentValue', msg.payload);\n}\n\nreturn {\n payload: {\n isChanged: isChanged\n }\n};",
"outputs": 1,
"noerr": 0,
"x": 275.50000762939453,
"y": 309.00000381469727,
"wires": [
[
"9efe7650.6240b8"
]
]
},
{
"id": "9efe7650.6240b8",
"type": "switch",
"z": "2402955.eef8a6a",
"name": "if changed",
"property": "payload.isChanged",
"propertyType": "msg",
"rules": [
{
"t": "true"
}
],
"checkall": "true",
"outputs": 1,
"x": 471.50000762939453,
"y": 307.00000381469727,
"wires": [
[
"4a462525.530fdc"
]
]
},
{
"id": "4a462525.530fdc",
"type": "function",
"z": "2402955.eef8a6a",
"name": "prepare message",
"func": "return {\n payload: `Contract changed value to: ${flow.get('currentValue')}`\n};",
"outputs": 1,
"noerr": 0,
"x": 310.00000762939453,
"y": 386.00000381469727,
"wires": [
[
"9f1796b4.f76308",
"1c54e515.23fb0b"
]
]
},
{
"id": "99a81f2c.e9f0c",
"type": "ethereum",
"z": "907c54b7.0448a8",
"name": "ethereum",
"address": "0x2cfc8c4976f7c154d81307e37a032473c5f52902",
"host": "http://127.0.0.1:8545",
"abi": "[{\"constant\":true,\"inputs\":[],\"name\":\"currentValue\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newValue\",\"type\":\"string\"}],\"name\":\"setValue\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]",
"function": "const status = flow.get('isOnline') ? 'healthy' : 'sick';\n\nmsg.contractInstance.methods.setValue(status).send({from: '0x63CE9f57E2e4B41d3451DEc20dDB89143fD755bB'}, (error, tx) => {\n node.send({payload: tx || error});\n});\n\nreturn;",
"x": 140.5000457763672,
"y": 268.00000762939453,
"wires": [
[
"8f912e85.f84b1"
]
]
},
{
"id": "8f912e85.f84b1",
"type": "debug",
"z": "907c54b7.0448a8",
"name": "",
"active": true,
"console": "false",
"complete": "payload",
"x": 309.50008392333984,
"y": 267.0000286102295,
"wires": []
},
{
"id": "d5c69c50.5615c",
"type": "switch",
"z": "907c54b7.0448a8",
"name": "if changed",
"property": "payload.isChanged",
"propertyType": "msg",
"rules": [
{
"t": "true"
}
],
"checkall": "true",
"outputs": 1,
"x": 312.50004959106445,
"y": 182.00003051757812,
"wires": [
[
"99a81f2c.e9f0c"
]
]
},
{
"id": "7c1f1b6d.7effa4",
"type": "inject",
"z": "a0b32d0f.b8bb2",
"name": "",
"topic": "",
"payload": "",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"x": 300.5,
"y": 107.00000476837158,
"wires": [
[
"f5cc75d0.0d03b8"
]
]
},
{
"id": "f5cc75d0.0d03b8",
"type": "ethereum",
"z": "a0b32d0f.b8bb2",
"name": "ethereum",
"address": "0x2cfc8c4976f7c154d81307e37a032473c5f52902",
"host": "http://127.0.0.1:8545",
"abi": "[{\"constant\":true,\"inputs\":[],\"name\":\"currentValue\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newValue\",\"type\":\"string\"}],\"name\":\"setValue\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]",
"function": "msg.contractInstance.methods.currentValue().call((error, result) => {\n node.send({payload: result || error});\n});\n\nreturn;",
"x": 293.5,
"y": 202.00000476837158,
"wires": [
[
"e5846ba0.4f4648"
]
]
},
{
"id": "e5846ba0.4f4648",
"type": "debug",
"z": "a0b32d0f.b8bb2",
"name": "",
"active": true,
"console": "false",
"complete": "false",
"x": 300.5,
"y": 294.0000047683716,
"wires": []
},
{
"id": "d3d9f3c2.96ea2",
"type": "ethereum",
"z": "2402955.eef8a6a",
"name": "read from contract",
"address": "0x2cfc8c4976f7c154d81307e37a032473c5f52902",
"host": "http://127.0.0.1:8545",
"abi": "[{\"constant\":true,\"inputs\":[],\"name\":\"currentValue\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newValue\",\"type\":\"string\"}],\"name\":\"setValue\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]",
"function": "msg.contractInstance.methods.currentValue().call((error, result) => {\n node.send({payload: result || error});\n});\n\nreturn;",
"x": 308.00000762939453,
"y": 232.00000381469727,
"wires": [
[
"5c948a86.894904",
"7ae57c38.0fddd4"
]
]
},
{
"id": "e195a18a.cf681",
"type": "inject",
"z": "2402955.eef8a6a",
"name": "",
"topic": "",
"payload": "",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"x": 272.50000762939453,
"y": 161.00000381469727,
"wires": [
[
"d3d9f3c2.96ea2"
]
]
},
{
"id": "7ae57c38.0fddd4",
"type": "debug",
"z": "2402955.eef8a6a",
"name": "",
"active": true,
"console": "false",
"complete": "false",
"x": 524.5000076293945,
"y": 231.00000381469727,
"wires": []
},
{
"id": "1c54e515.23fb0b",
"type": "debug",
"z": "2402955.eef8a6a",
"name": "",
"active": true,
"console": "false",
"complete": "false",
"x": 529.5000076293945,
"y": 459.00000381469727,
"wires": []
},
{
"id": "b4fbf129.21a52",
"type": "debug",
"z": "907c54b7.0448a8",
"name": "",
"active": false,
"console": "false",
"complete": "false",
"x": 317.50003814697266,
"y": 115.00002670288086,
"wires": []
},
{
"id": "4e48c09f.5b4a",
"type": "inject",
"z": "e5228a9c.3dd578",
"name": "",
"topic": "",
"payload": "",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"x": 250.5000343322754,
"y": 95.00002193450928,
"wires": [
[
"b317c18.dddd24"
]
]
},
{
"id": "b317c18.dddd24",
"type": "golos",
"z": "e5228a9c.3dd578",
"name": "to golos",
"function": "msg.golos.broadcast.comment('5JQUuCJ11XyQh5pgX1ak3Sd62waUJ7tPfaeQDfqkfbatREpQEFQ', '', 'maintag', 'melnikaite', 'permlink1', 'title', 'body', {}, function(error, result) {\n node.send({payload: result || error});\n});\n\nreturn;",
"x": 247.5000457763672,
"y": 177.0000228881836,
"wires": [
[
"29c20326.36fe7c"
]
]
},
{
"id": "29c20326.36fe7c",
"type": "debug",
"z": "e5228a9c.3dd578",
"name": "",
"active": true,
"console": "false",
"complete": "false",
"x": 246.50005340576172,
"y": 256.00001335144043,
"wires": []
},
{
"id": "43b40e9b.3099b",
"type": "inject",
"z": "d863f3cc.f9f4f",
"name": "get",
"topic": "",
"payload": "",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"x": 361.00000381469727,
"y": 241.00003147125244,
"wires": [
[
"8b28bc60.07617"
]
]
},
{
"id": "8b28bc60.07617",
"type": "golos",
"z": "d863f3cc.f9f4f",
"name": "from golos",
"function": "msg.golos.api.getContent('golosmedia', 'nauka0909', function(error, result) {\n node.send({payload: result || error});\n});\n\nreturn;",
"x": 353.00001525878906,
"y": 324.00003147125244,
"wires": [
[
"30a32851.a13358"
]
]
},
{
"id": "30a32851.a13358",
"type": "debug",
"z": "d863f3cc.f9f4f",
"name": "",
"active": true,
"console": "false",
"complete": "payload",
"x": 355.0000247955322,
"y": 404.00003147125244,
"wires": []
},
{
"id": "32774efa.9fb0b2",
"type": "inject",
"z": "5764a33c.5e14dc",
"name": "",
"topic": "",
"payload": "",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"x": 239.00000762939453,
"y": 90.00002098083496,
"wires": [
[
"a6d9b2ca.d26f3"
]
]
},
{
"id": "67dd5838.7fa5c8",
"type": "golos",
"z": "5764a33c.5e14dc",
"name": "to golos",
"function": "msg.golos.broadcast.comment('5JQUuCJ11XyQh5pgX1ak3Sd62waUJ7tPfaeQDfqkfbatREpQEFQ', '', 'maintag', 'melnikaite', 'permlink2', 'title', msg.payload, {}, function(error, result) {\n node.send({payload: result || error});\n});\n\nreturn;",
"x": 232.00005340576172,
"y": 233.00001621246338,
"wires": [
[
"fd5607ba.e88ef8"
]
]
},
{
"id": "fd5607ba.e88ef8",
"type": "debug",
"z": "5764a33c.5e14dc",
"name": "",
"active": true,
"console": "false",
"complete": "false",
"x": 232.00009536743164,
"y": 312.0001029968262,
"wires": []
},
{
"id": "a6d9b2ca.d26f3",
"type": "ethereum",
"z": "5764a33c.5e14dc",
"name": "from ethereum",
"address": "0x2cfc8c4976f7c154d81307e37a032473c5f52902",
"host": "http://127.0.0.1:8545",
"abi": "[{\"constant\":true,\"inputs\":[],\"name\":\"currentValue\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newValue\",\"type\":\"string\"}],\"name\":\"setValue\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]",
"function": "msg.contractInstance.methods.currentValue().call((error, result) => {\n node.send({payload: result || error});\n});\n\nreturn;",
"x": 233.50003051757812,
"y": 160.00003051757812,
"wires": [
[
"67dd5838.7fa5c8"
]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment