{ "name": "Kraken_REST_API_Nodes", "nodes": [ { "parameters": {}, "name": "Start", "type": "n8n-nodes-base.start", "typeVersion": 1, "position": [ -300, 0 ] }, { "parameters": { "functionCode": "const api_path = '/0/private/' + $json['API Endpoint'];\nconst api_nonce = Date.now().toString();\nconst api_json = '{\"nonce\":\"' + api_nonce + '\"}';\nconst api_variables = [];\napi_variables.push({\"json\":{\"api_path\":api_path, \"api_nonce\":api_nonce, \"api_json\":api_json}});\nreturn api_variables;" }, "name": "JavaScript", "type": "n8n-nodes-base.function", "typeVersion": 1, "position": [ 150, 650 ] }, { "parameters": { "type": "SHA256", "value": "={{$json[\"api_nonce\"] + $json[\"api_json\"]}}", "encoding": "base64" }, "name": "API auth 1", "type": "n8n-nodes-base.crypto", "typeVersion": 1, "position": [ 300, 650 ] }, { "parameters": { "action": "hmac", "type": "SHA512", "value": "={{Buffer.concat([Buffer.from($json.api_path, 'utf8'), Buffer.from($json[\"data\"], \"base64\")])}}", "secret": "={{Buffer.from($node['API settings'].json['API Private Key'], 'base64')}}", "encoding": "base64" }, "name": "API auth 2", "type": "n8n-nodes-base.crypto", "typeVersion": 1, "position": [ 450, 650 ] }, { "parameters": { "requestMethod": "POST", "url": "={{\"https://api.kraken.com\" + $json['api_path']}}", "allowUnauthorizedCerts": true, "jsonParameters": true, "options": { "bodyContentType": "raw" }, "bodyParametersJson": "={{$json['api_json']}}", "headerParametersJson": "={{{\"API-Key\":$node['API settings'].json['API Public Key'], \"API-Sign\":$json['data'], \"Content-type\":\"application/json\"}}}" }, "name": "API request", "type": "n8n-nodes-base.httpRequest", "typeVersion": 1, "position": [ 600, 650 ] }, { "parameters": { "conditions": { "string": [ { "value1": "={{$json['error'][0]}}", "operation": "isEmpty" } ], "boolean": [] } }, "name": "API error check", "type": "n8n-nodes-base.if", "typeVersion": 1, "position": [ 750, 650 ] }, { "parameters": { "values": { "string": [ { "name": "API Public Key", "value": "i1ErCOQgUGcJyy3/gzcTRgGdVrFgek9riPHz/UC3kaTUnQjIxzmsfi20" }, { "name": "API Private Key", "value": "O4eVATIY65s2SJBOZKEq77qow4UHT4jtIGMC/NLUIwd2zuGL0sCL/FmMDvtxiZEYG/FI37p1lXp10I9nm2rzAA==" }, { "name": "API Endpoint", "value": "Balance" } ], "number": [] }, "options": {} }, "name": "API settings", "type": "n8n-nodes-base.set", "typeVersion": 1, "position": [ 0, 650 ] } ], "connections": { "JavaScript": { "main": [ [ { "node": "API auth 1", "type": "main", "index": 0 } ] ] }, "API auth 1": { "main": [ [ { "node": "API auth 2", "type": "main", "index": 0 } ] ] }, "API auth 2": { "main": [ [ { "node": "API request", "type": "main", "index": 0 } ] ] }, "API request": { "main": [ [ { "node": "API error check", "type": "main", "index": 0 } ] ] }, "API settings": { "main": [ [ { "node": "JavaScript", "type": "main", "index": 0 } ] ] }, "Start": { "main": [ [] ] } }, "active": false, "settings": {}, "id": "1008" }