diff --git a/scripts/wallets.mjs b/scripts/wallets.mjs index 5fb277054..507ebc859 100644 --- a/scripts/wallets.mjs +++ b/scripts/wallets.mjs @@ -166,7 +166,6 @@ async function updateConfig(configs, configName) { configFile[configKey].explorer = config.explorer configFile[configKey].explorerTx = config.explorerTx configFile[configKey].explorerAddress = config.explorerAddress - configFile[configKey].minNodeVersion = config.minNodeVersion configFile[configKey].nodes = config.nodes configFile[configKey].services = config.services } diff --git a/src/config/development.json b/src/config/development.json index 3bc1d7f87..20d6a7cd1 100644 --- a/src/config/development.json +++ b/src/config/development.json @@ -1,136 +1,219 @@ { "adm": { "explorerTx": "https://explorer.adamant.im/tx/${ID}", - "minNodeVersion": "0.8.0", - "nodes": [ - { - "url": "https://clown.adamant.im" - }, - { - "url": "https://lake.adamant.im" - }, - { - "url": "https://endless.adamant.im", - "alt_ip": "http://149.102.157.15:36666" - }, - { - "url": "https://bid.adamant.im" - }, - { - "url": "https://unusual.adamant.im" - }, - { - "url": "https://debate.adamant.im", - "alt_ip": "http://95.216.161.113:36666" - }, - { - "url": "http://78.47.205.206:36666" - }, - { - "url": "http://5.161.53.74:36666" - }, - { - "url": "http://184.94.215.92:45555" - }, - { - "url": "https://node1.adamant.business", - "alt_ip": "http://194.233.75.29:45555" + "nodes": { + "list": [ + { + "url": "https://clown.adamant.im" + }, + { + "url": "https://lake.adamant.im" + }, + { + "url": "https://endless.adamant.im", + "alt_ip": "http://149.102.157.15:36666" + }, + { + "url": "https://bid.adamant.im" + }, + { + "url": "https://unusual.adamant.im" + }, + { + "url": "https://debate.adamant.im", + "alt_ip": "http://95.216.161.113:36666" + }, + { + "url": "http://78.47.205.206:36666" + }, + { + "url": "http://5.161.53.74:36666" + }, + { + "url": "http://184.94.215.92:45555" + }, + { + "url": "https://node1.adamant.business", + "alt_ip": "http://194.233.75.29:45555" + }, + { + "url": "https://node2.blockchain2fa.io" + }, + { + "url": "https://sunshine.adamant.im" + } + ], + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 10 }, - { - "url": "https://node2.blockchain2fa.io" + "minVersion": "0.8.0" + }, + "services": { + "list": { + "infoService": [ + { + "url": "https://info.adamant.im", + "alt_ip": "http://88.198.156.44:44099" + } + ] }, - { - "url": "https://sunshine.adamant.im" + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 300000, + "onScreenUpdateInterval": 300000 } - ], - "services": { - "infoService": [ - { - "url": "https://info.adamant.im", - "alt_ip": "http://88.198.156.44:44099" - } - ] }, "explorer": "https://explorer.adamant.im", "explorerAddress": "https://explorer.adamant.im/address/${ID}" }, "btc": { "explorerTx": "https://explorer.btc.com/btc/transaction/${ID}", - "nodes": [ - { - "url": "https://btcnode1.adamant.im", - "alt_ip": "http://176.9.38.204:44099" - }, - { - "url": "https://btcnode2.adamant.im", - "alt_ip": "http://176.9.32.126:44099" + "nodes": { + "list": [ + { + "url": "https://btcnode1.adamant.im", + "alt_ip": "http://176.9.38.204:44099" + }, + { + "url": "https://btcnode2.adamant.im", + "alt_ip": "http://176.9.32.126:44099" + } + ], + "healthCheck": { + "normalUpdateInterval": 360000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 2 } - ], + }, "explorer": "https://explorer.btc.com", "explorerAddress": "https://explorer.btc.com/btc/address/${ID}" }, "dash": { "explorerTx": "https://dashblockexplorer.com/tx/${ID}", - "nodes": [ - { - "url": "https://dashnode1.adamant.im", - "alt_ip": "http://45.85.147.224:44099" - }, - { - "url": "https://dashnode2.adamant.im", - "alt_ip": "http://207.180.210.95:44099" + "nodes": { + "list": [ + { + "url": "https://dashnode1.adamant.im", + "alt_ip": "http://45.85.147.224:44099" + }, + { + "url": "https://dashnode2.adamant.im", + "alt_ip": "http://207.180.210.95:44099" + } + ], + "healthCheck": { + "normalUpdateInterval": 210000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 3 } - ], + }, "explorer": "https://dashblockexplorer.com", "explorerAddress": "https://dashblockexplorer.com/address/${ID}" }, "doge": { "explorerTx": "https://dogechain.info/tx/${ID}", - "nodes": [ - { - "url": "https://dogenode1.adamant.im", - "alt_ip": "http://5.9.99.62:44099" - }, - { - "url": "https://dogenode2.adamant.im", - "alt_ip": "http://176.9.32.126:44098" + "nodes": { + "list": [ + { + "url": "https://dogenode1.adamant.im", + "alt_ip": "http://5.9.99.62:44099" + }, + { + "url": "https://dogenode2.adamant.im", + "alt_ip": "http://176.9.32.126:44098" + } + ], + "healthCheck": { + "normalUpdateInterval": 390000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 3 } - ], + }, "explorer": "https://dogechain.info", "explorerAddress": "https://dogechain.info/address/${ID}" }, "eth": { "explorerTx": "https://etherscan.io/tx/${ID}", - "nodes": [ - { - "url": "https://ethnode1.adamant.im", - "alt_ip": "http://95.216.41.106:44099", - "hasIndex": true - }, - { - "url": "https://ethnode2.adamant.im", - "alt_ip": "http://95.216.114.252:44099", - "hasIndex": true + "nodes": { + "list": [ + { + "url": "https://ethnode1.adamant.im", + "alt_ip": "http://95.216.41.106:44099", + "hasIndex": true + }, + { + "url": "https://ethnode2.adamant.im", + "alt_ip": "http://95.216.114.252:44099", + "hasIndex": true + }, + { + "url": "https://ethnode3.adamant.im", + "alt_ip": "http://46.4.37.157:44099", + "hasIndex": true + } + ], + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 5 } - ], + }, "explorer": "https://etherscan.io", "explorerAddress": "https://etherscan.io/address/${ID}" }, "lsk": { "explorerTx": "https://liskscan.com/transaction/${ID}", - "nodes": [ - { - "url": "https://lisknode5.adamant.im", - "alt_ip": "http://38.242.243.29:44099" - } - ], - "services": { - "lskService": [ + "nodes": { + "list": [ { - "url": "https://liskservice5.adamant.im", - "alt_ip": "http://38.242.243.29:44098" + "url": "https://lisknode3.adamant.im", + "alt_ip": "http://157.90.229.236:44099" + }, + { + "url": "https://lisknode4.adamant.im", + "alt_ip": "http://78.47.205.206:44099" + }, + { + "url": "https://lisknode5.adamant.im", + "alt_ip": "http://38.242.243.29:44099" } - ] + ], + "healthCheck": { + "normalUpdateInterval": 270000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 5 + } + }, + "services": { + "list": { + "lskService": [ + { + "url": "https://liskservice3.adamant.im", + "alt_ip": "http://157.90.229.236:44098" + }, + { + "url": "https://liskservice4.adamant.im", + "alt_ip": "http://78.47.205.206:44098" + }, + { + "url": "https://liskservice5.adamant.im", + "alt_ip": "http://38.242.243.29:44098" + } + ] + }, + "healthCheck": { + "normalUpdateInterval": 330000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000 + } }, "explorer": "https://liskscan.com", "explorerAddress": "https://liskscan.com/account/${ID}" diff --git a/src/config/production.json b/src/config/production.json index a4255fe34..4bfc5631a 100644 --- a/src/config/production.json +++ b/src/config/production.json @@ -1,136 +1,219 @@ { "adm": { - "minNodeVersion": "0.8.0", - "nodes": [ - { - "url": "https://clown.adamant.im" - }, - { - "url": "https://lake.adamant.im" - }, - { - "url": "https://endless.adamant.im", - "alt_ip": "http://149.102.157.15:36666" - }, - { - "url": "https://bid.adamant.im" - }, - { - "url": "https://unusual.adamant.im" - }, - { - "url": "https://debate.adamant.im", - "alt_ip": "http://95.216.161.113:36666" - }, - { - "url": "http://78.47.205.206:36666" - }, - { - "url": "http://5.161.53.74:36666" - }, - { - "url": "http://184.94.215.92:45555" - }, - { - "url": "https://node1.adamant.business", - "alt_ip": "http://194.233.75.29:45555" + "nodes": { + "list": [ + { + "url": "https://clown.adamant.im" + }, + { + "url": "https://lake.adamant.im" + }, + { + "url": "https://endless.adamant.im", + "alt_ip": "http://149.102.157.15:36666" + }, + { + "url": "https://bid.adamant.im" + }, + { + "url": "https://unusual.adamant.im" + }, + { + "url": "https://debate.adamant.im", + "alt_ip": "http://95.216.161.113:36666" + }, + { + "url": "http://78.47.205.206:36666" + }, + { + "url": "http://5.161.53.74:36666" + }, + { + "url": "http://184.94.215.92:45555" + }, + { + "url": "https://node1.adamant.business", + "alt_ip": "http://194.233.75.29:45555" + }, + { + "url": "https://node2.blockchain2fa.io" + }, + { + "url": "https://sunshine.adamant.im" + } + ], + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 10 }, - { - "url": "https://node2.blockchain2fa.io" + "minVersion": "0.8.0" + }, + "services": { + "list": { + "infoService": [ + { + "url": "https://info.adamant.im", + "alt_ip": "http://88.198.156.44:44099" + } + ] }, - { - "url": "https://sunshine.adamant.im" + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 300000, + "onScreenUpdateInterval": 300000 } - ], - "services": { - "infoService": [ - { - "url": "https://info.adamant.im", - "alt_ip": "http://88.198.156.44:44099" - } - ] }, "explorerTx": "https://explorer.adamant.im/tx/${ID}", "explorer": "https://explorer.adamant.im", "explorerAddress": "https://explorer.adamant.im/address/${ID}" }, "btc": { - "nodes": [ - { - "url": "https://btcnode1.adamant.im", - "alt_ip": "http://176.9.38.204:44099" - }, - { - "url": "https://btcnode2.adamant.im", - "alt_ip": "http://176.9.32.126:44099" + "nodes": { + "list": [ + { + "url": "https://btcnode1.adamant.im", + "alt_ip": "http://176.9.38.204:44099" + }, + { + "url": "https://btcnode2.adamant.im", + "alt_ip": "http://176.9.32.126:44099" + } + ], + "healthCheck": { + "normalUpdateInterval": 360000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 2 } - ], + }, "explorerTx": "https://explorer.btc.com/btc/transaction/${ID}", "explorer": "https://explorer.btc.com", "explorerAddress": "https://explorer.btc.com/btc/address/${ID}" }, "dash": { - "nodes": [ - { - "url": "https://dashnode1.adamant.im", - "alt_ip": "http://45.85.147.224:44099" - }, - { - "url": "https://dashnode2.adamant.im", - "alt_ip": "http://207.180.210.95:44099" + "nodes": { + "list": [ + { + "url": "https://dashnode1.adamant.im", + "alt_ip": "http://45.85.147.224:44099" + }, + { + "url": "https://dashnode2.adamant.im", + "alt_ip": "http://207.180.210.95:44099" + } + ], + "healthCheck": { + "normalUpdateInterval": 210000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 3 } - ], + }, "explorerTx": "https://dashblockexplorer.com/tx/${ID}", "explorer": "https://dashblockexplorer.com", "explorerAddress": "https://dashblockexplorer.com/address/${ID}" }, "doge": { - "nodes": [ - { - "url": "https://dogenode1.adamant.im", - "alt_ip": "http://5.9.99.62:44099" - }, - { - "url": "https://dogenode2.adamant.im", - "alt_ip": "http://176.9.32.126:44098" + "nodes": { + "list": [ + { + "url": "https://dogenode1.adamant.im", + "alt_ip": "http://5.9.99.62:44099" + }, + { + "url": "https://dogenode2.adamant.im", + "alt_ip": "http://176.9.32.126:44098" + } + ], + "healthCheck": { + "normalUpdateInterval": 390000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 3 } - ], + }, "explorerTx": "https://dogechain.info/tx/${ID}", "explorer": "https://dogechain.info", "explorerAddress": "https://dogechain.info/address/${ID}" }, "eth": { - "nodes": [ - { - "url": "https://ethnode1.adamant.im", - "alt_ip": "http://95.216.41.106:44099", - "hasIndex": true - }, - { - "url": "https://ethnode2.adamant.im", - "alt_ip": "http://95.216.114.252:44099", - "hasIndex": true + "nodes": { + "list": [ + { + "url": "https://ethnode1.adamant.im", + "alt_ip": "http://95.216.41.106:44099", + "hasIndex": true + }, + { + "url": "https://ethnode2.adamant.im", + "alt_ip": "http://95.216.114.252:44099", + "hasIndex": true + }, + { + "url": "https://ethnode3.adamant.im", + "alt_ip": "http://46.4.37.157:44099", + "hasIndex": true + } + ], + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 5 } - ], + }, "explorerTx": "https://etherscan.io/tx/${ID}", "explorer": "https://etherscan.io", "explorerAddress": "https://etherscan.io/address/${ID}" }, "lsk": { - "nodes": [ - { - "url": "https://lisknode5.adamant.im", - "alt_ip": "http://38.242.243.29:44099" + "nodes": { + "list": [ + { + "url": "https://lisknode3.adamant.im", + "alt_ip": "http://157.90.229.236:44099" + }, + { + "url": "https://lisknode4.adamant.im", + "alt_ip": "http://78.47.205.206:44099" + }, + { + "url": "https://lisknode5.adamant.im", + "alt_ip": "http://38.242.243.29:44099" + } + ], + "healthCheck": { + "normalUpdateInterval": 270000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 5 } - ], + }, "explorerTx": "https://liskscan.com/transaction/${ID}", "services": { - "lskService": [ - { - "url": "https://liskservice5.adamant.im", - "alt_ip": "http://38.242.243.29:44098" - } - ] + "list": { + "lskService": [ + { + "url": "https://liskservice3.adamant.im", + "alt_ip": "http://157.90.229.236:44098" + }, + { + "url": "https://liskservice4.adamant.im", + "alt_ip": "http://78.47.205.206:44098" + }, + { + "url": "https://liskservice5.adamant.im", + "alt_ip": "http://38.242.243.29:44098" + } + ] + }, + "healthCheck": { + "normalUpdateInterval": 330000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000 + } }, "explorer": "https://liskscan.com", "explorerAddress": "https://liskscan.com/account/${ID}" diff --git a/src/config/test.json b/src/config/test.json index 976551ef5..d880b162f 100644 --- a/src/config/test.json +++ b/src/config/test.json @@ -1,130 +1,219 @@ { "adm": { - "minNodeVersion": "0.7.0", - "nodes": [ - { - "url": "https://clown.adamant.im" - }, - { - "url": "https://lake.adamant.im" - }, - { - "url": "https://endless.adamant.im", - "alt_ip": "http://149.102.157.15:36666" - }, - { - "url": "https://bid.adamant.im" - }, - { - "url": "https://unusual.adamant.im" - }, - { - "url": "https://debate.adamant.im", - "alt_ip": "http://95.216.161.113:36666" - }, - { - "url": "http://78.47.205.206:36666" - }, - { - "url": "http://5.161.53.74:36666" - }, - { - "url": "http://184.94.215.92:45555" + "explorerTx": "https://explorer.adamant.im/tx/${ID}", + "nodes": { + "list": [ + { + "url": "https://clown.adamant.im" + }, + { + "url": "https://lake.adamant.im" + }, + { + "url": "https://endless.adamant.im", + "alt_ip": "http://149.102.157.15:36666" + }, + { + "url": "https://bid.adamant.im" + }, + { + "url": "https://unusual.adamant.im" + }, + { + "url": "https://debate.adamant.im", + "alt_ip": "http://95.216.161.113:36666" + }, + { + "url": "http://78.47.205.206:36666" + }, + { + "url": "http://5.161.53.74:36666" + }, + { + "url": "http://184.94.215.92:45555" + }, + { + "url": "https://node1.adamant.business", + "alt_ip": "http://194.233.75.29:45555" + }, + { + "url": "https://node2.blockchain2fa.io" + }, + { + "url": "https://sunshine.adamant.im" + } + ], + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 10 }, - { - "url": "https://node1.adamant.business" + "minVersion": "0.8.0" + }, + "services": { + "list": { + "infoService": [ + { + "url": "https://info.adamant.im", + "alt_ip": "http://88.198.156.44:44099" + } + ] }, - { - "url": "https://node2.blockchain2fa.io" + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 300000, + "onScreenUpdateInterval": 300000 } - ], - "services": { - "infoService": [ - { - "url": "https://info.adamant.im", - "alt_ip": "http://88.198.156.44:80" - } - ] }, - "explorerTx": "https://explorer.adamant.im/tx/${ID}", "explorer": "https://explorer.adamant.im", "explorerAddress": "https://explorer.adamant.im/address/${ID}" }, "btc": { - "nodes": [ - { - "url": "https://btcnode1.adamant.im", - "alt_ip": "http://176.9.38.204:44099" - }, - { - "url": "https://btcnode2.adamant.im", - "alt_ip": "http://176.9.32.126:44099" - } - ], "explorerTx": "https://explorer.btc.com/btc/transaction/${ID}", + "nodes": { + "list": [ + { + "url": "https://btcnode1.adamant.im", + "alt_ip": "http://176.9.38.204:44099" + }, + { + "url": "https://btcnode2.adamant.im", + "alt_ip": "http://176.9.32.126:44099" + } + ], + "healthCheck": { + "normalUpdateInterval": 360000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 2 + } + }, "explorer": "https://explorer.btc.com", "explorerAddress": "https://explorer.btc.com/btc/address/${ID}" }, "dash": { - "nodes": [ - { - "url": "https://dashnode1.adamant.im" - } - ], "explorerTx": "https://dashblockexplorer.com/tx/${ID}", + "nodes": { + "list": [ + { + "url": "https://dashnode1.adamant.im", + "alt_ip": "http://45.85.147.224:44099" + }, + { + "url": "https://dashnode2.adamant.im", + "alt_ip": "http://207.180.210.95:44099" + } + ], + "healthCheck": { + "normalUpdateInterval": 210000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 3 + } + }, "explorer": "https://dashblockexplorer.com", "explorerAddress": "https://dashblockexplorer.com/address/${ID}" }, "doge": { - "nodes": [ - { - "url": "https://dogenode1.adamant.im" - }, - { - "url": "https://dogenode2.adamant.im", - "alt_ip": "http://176.9.32.126:44098" - } - ], "explorerTx": "https://dogechain.info/tx/${ID}", + "nodes": { + "list": [ + { + "url": "https://dogenode1.adamant.im", + "alt_ip": "http://5.9.99.62:44099" + }, + { + "url": "https://dogenode2.adamant.im", + "alt_ip": "http://176.9.32.126:44098" + } + ], + "healthCheck": { + "normalUpdateInterval": 390000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 3 + } + }, "explorer": "https://dogechain.info", "explorerAddress": "https://dogechain.info/address/${ID}" }, "eth": { - "nodes": [ - { - "url": "https://ethnode1.adamant.im", - "alt_ip": "http://95.216.41.106:44099", - "hasIndex": true - }, - { - "url": "https://ethnode2.adamant.im", - "alt_ip": "http://95.216.114.252:44099", - "hasIndex": true - } - ], "explorerTx": "https://etherscan.io/tx/${ID}", + "nodes": { + "list": [ + { + "url": "https://ethnode1.adamant.im", + "alt_ip": "http://95.216.41.106:44099", + "hasIndex": true + }, + { + "url": "https://ethnode2.adamant.im", + "alt_ip": "http://95.216.114.252:44099", + "hasIndex": true + }, + { + "url": "https://ethnode3.adamant.im", + "alt_ip": "http://46.4.37.157:44099", + "hasIndex": true + } + ], + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 5 + } + }, "explorer": "https://etherscan.io", "explorerAddress": "https://etherscan.io/address/${ID}" }, "lsk": { - "nodes": [ - { - "url": "https://lisknode3.adamant.im" - }, - { - "url": "https://lisknode4.adamant.im" - } - ], "explorerTx": "https://liskscan.com/transaction/${ID}", - "services": { - "lskService": [ + "nodes": { + "list": [ + { + "url": "https://lisknode3.adamant.im", + "alt_ip": "http://157.90.229.236:44099" + }, { - "url": "https://liskservice3.adamant.im" + "url": "https://lisknode4.adamant.im", + "alt_ip": "http://78.47.205.206:44099" }, { - "url": "https://liskservice4.adamant.im" + "url": "https://lisknode5.adamant.im", + "alt_ip": "http://38.242.243.29:44099" } - ] + ], + "healthCheck": { + "normalUpdateInterval": 270000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 5 + } + }, + "services": { + "list": { + "lskService": [ + { + "url": "https://liskservice3.adamant.im", + "alt_ip": "http://157.90.229.236:44098" + }, + { + "url": "https://liskservice4.adamant.im", + "alt_ip": "http://78.47.205.206:44098" + }, + { + "url": "https://liskservice5.adamant.im", + "alt_ip": "http://38.242.243.29:44098" + } + ] + }, + "healthCheck": { + "normalUpdateInterval": 330000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000 + } }, "explorer": "https://liskscan.com", "explorerAddress": "https://liskscan.com/account/${ID}" diff --git a/src/config/tor.json b/src/config/tor.json index fe67a6427..4d456b4ac 100644 --- a/src/config/tor.json +++ b/src/config/tor.json @@ -1,101 +1,179 @@ { "adm": { - "minNodeVersion": "0.8.0", - "nodes": [ - { - "url": "http://37g5to2z6bdoeegun4hms2hvkfbdxh4rcon4e3p267wtfkh4ji2ns6id.onion" - }, - { - "url": "http://fqjcvsibnbwhlwxndzqzziapiwoidgn24avfiauu4wo2fc3yyiy2qcid.onion" - }, - { - "url": "http://omhrhpc45njpgzp4fggtndazaodwuwvb5in6hsn3k7tvaqennmfaa2qd.onion" + "nodes": { + "list": [ + { + "url": "http://37g5to2z6bdoeegun4hms2hvkfbdxh4rcon4e3p267wtfkh4ji2ns6id.onion" + }, + { + "url": "http://fqjcvsibnbwhlwxndzqzziapiwoidgn24avfiauu4wo2fc3yyiy2qcid.onion" + }, + { + "url": "http://omhrhpc45njpgzp4fggtndazaodwuwvb5in6hsn3k7tvaqennmfaa2qd.onion" + }, + { + "url": "http://uxu6vnnrrnl7tmo7i657yvs4jbgdz734xvufryoi326az5dzufuwboad.onion" + }, + { + "url": "http://rukehjd2yalzgny7mdjqtzown2mazsaeh4zr7zjdg4l5afkgc3z2kgqd.onion" + } + ], + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 10 }, - { - "url": "http://uxu6vnnrrnl7tmo7i657yvs4jbgdz734xvufryoi326az5dzufuwboad.onion" + "minVersion": "0.8.0" + }, + "services": { + "list": { + "infoService": [ + { + "url": "http://czjsawp2crjmnkliw2h2kpk7wwd3a36zvvnvqgvzmi4t4vc2yzm7j2qd.onion" + } + ] }, - { - "url": "http://rukehjd2yalzgny7mdjqtzown2mazsaeh4zr7zjdg4l5afkgc3z2kgqd.onion" + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 300000, + "onScreenUpdateInterval": 300000 } - ], - "services": { - "infoService": [ - { - "url": "http://czjsawp2crjmnkliw2h2kpk7wwd3a36zvvnvqgvzmi4t4vc2yzm7j2qd.onion" - } - ] }, "explorerTx": "http://srovpmanmrbmbqe63vp5nycsa3j3g6be3bz46ksmo35u5pw7jjtjamid.onion/tx/${ID}", "explorer": "http://srovpmanmrbmbqe63vp5nycsa3j3g6be3bz46ksmo35u5pw7jjtjamid.onion", "explorerAddress": "http://srovpmanmrbmbqe63vp5nycsa3j3g6be3bz46ksmo35u5pw7jjtjamid.onion/address/${ID}" }, "btc": { - "nodes": [ - { - "url": "http://cc6ibzkfeseuwnmtjc6hlsd44bzg2sr3shbv7n35nj2rk2vm6dmtlnqd.onion" - }, - { - "url": "http://mgplh7en3d6ywsec5h6q3tc6mirsleb5cmlyn6nmp25qrb6gy35nypad.onion" + "nodes": { + "list": [ + { + "url": "http://cc6ibzkfeseuwnmtjc6hlsd44bzg2sr3shbv7n35nj2rk2vm6dmtlnqd.onion" + }, + { + "url": "http://mgplh7en3d6ywsec5h6q3tc6mirsleb5cmlyn6nmp25qrb6gy35nypad.onion" + } + ], + "healthCheck": { + "normalUpdateInterval": 360000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 2 } - ], + }, "explorerTx": "https://explorer.btc.com/btc/transaction/${ID}", "explorer": "https://explorer.btc.com", "explorerAddress": "https://explorer.btc.com/btc/address/${ID}" }, "dash": { - "nodes": [ - { - "url": "http://ldod53womnlwjmd4noq5yuq26xx3mmbrr4uogkfymuakhofjcuqeygad.onion" - }, - { - "url": "http://eq2blda45h4kakbuq3g4stcgatiwqaefgmxzfsfuiahpdbt2pvbbepad.onion" + "nodes": { + "list": [ + { + "url": "http://ldod53womnlwjmd4noq5yuq26xx3mmbrr4uogkfymuakhofjcuqeygad.onion" + }, + { + "url": "http://eq2blda45h4kakbuq3g4stcgatiwqaefgmxzfsfuiahpdbt2pvbbepad.onion" + } + ], + "healthCheck": { + "normalUpdateInterval": 210000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 3 } - ], + }, "explorerTx": "https://dashblockexplorer.com/tx/${ID}", "explorer": "https://dashblockexplorer.com", "explorerAddress": "https://dashblockexplorer.com/address/${ID}" }, "doge": { - "nodes": [ - { - "url": "http://mtg4mq43p67cbj6qwcqgppjv7uzm7ximjlzapsbnbh5ls6zqkjsq26ad.onion" - }, - { - "url": "http://bfu3iiofsagyhi22zijfilbkzlzbalpylhhfcluqmezx2avdwcxut7yd.onion" + "nodes": { + "list": [ + { + "url": "http://mtg4mq43p67cbj6qwcqgppjv7uzm7ximjlzapsbnbh5ls6zqkjsq26ad.onion" + }, + { + "url": "http://bfu3iiofsagyhi22zijfilbkzlzbalpylhhfcluqmezx2avdwcxut7yd.onion" + } + ], + "healthCheck": { + "normalUpdateInterval": 390000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 3 } - ], + }, "explorerTx": "https://dogechain.info/tx/${ID}", "explorer": "https://dogechain.info", "explorerAddress": "https://dogechain.info/address/${ID}" }, "eth": { - "nodes": [ - { - "url": "http://vj3qid4h2d4cj2gexivjuuybah3mjzenpdyr5bj6z4hctp52jn6qsgid.onion", - "hasIndex": true - }, - { - "url": "http://jpbrp6xapsyfnvyosrpu5wmoi62fqotazkicjeiob32yz77rt7axobqd.onion", - "hasIndex": true + "nodes": { + "list": [ + { + "url": "http://vj3qid4h2d4cj2gexivjuuybah3mjzenpdyr5bj6z4hctp52jn6qsgid.onion", + "hasIndex": true + }, + { + "url": "http://jpbrp6xapsyfnvyosrpu5wmoi62fqotazkicjeiob32yz77rt7axobqd.onion", + "hasIndex": true + }, + { + "url": "http://rekynxikhumzsme7phumocz3mquy7y3onkw33skmvk2akjkin2iopqqd.onion", + "hasIndex": true + } + ], + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 5 } - ], + }, "explorerTx": "https://etherscan.io/tx/${ID}", "explorer": "https://etherscan.io", "explorerAddress": "https://etherscan.io/address/${ID}" }, "lsk": { - "nodes": [ - { - "url": "http://4bsg7dijnpkiu6wylaad5fiom4iep73oz3o2rojkwnuteaawd2w3o2ad.onion" + "nodes": { + "list": [ + { + "url": "http://nl2c4vcsdrd6je3ebt4236yst55mbso72ojmksrmlyoikapgnu647tid.onion" + }, + { + "url": "http://qpjxvkathebm7oso3dk5hb4cggbeecqvcpcthuxlpovtn66plr6f4wyd.onion" + }, + { + "url": "http://4bsg7dijnpkiu6wylaad5fiom4iep73oz3o2rojkwnuteaawd2w3o2ad.onion" + } + ], + "healthCheck": { + "normalUpdateInterval": 270000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 5 } - ], + }, "explorerTx": "https://liskscan.com/transaction/${ID}", "services": { - "lskService": [ - { - "url": "http://cf6vf6xylvhza3t3ewffa7cmr2bqgaus5jwghiktjleids5ovdhoazad.onion" - } - ] + "list": { + "lskService": [ + { + "url": "http://xqrymra5go2nb3cslb3c3iv4weeuicybcxpjee4ay2indk2hgo7rw4qd.onion" + }, + { + "url": "http://s2q6phc22icy73zjccjq66555gwtvyuyrodmadwhjdhmvyehb3qrcsid.onion" + }, + { + "url": "http://cf6vf6xylvhza3t3ewffa7cmr2bqgaus5jwghiktjleids5ovdhoazad.onion" + } + ] + }, + "healthCheck": { + "normalUpdateInterval": 330000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000 + } }, "explorer": "https://liskscan.com", "explorerAddress": "https://liskscan.com/account/${ID}" diff --git a/src/config/utils/nodes.ts b/src/config/utils/nodes.ts index e4e7ca02f..70a7318d8 100644 --- a/src/config/utils/nodes.ts +++ b/src/config/utils/nodes.ts @@ -3,7 +3,7 @@ import { BlockchainSymbol } from './types' import config from '../index' export function getNodes(blockchain: BlockchainSymbol): NodeInfo[] { - const nodes = config[blockchain]['nodes'] + const nodes = config[blockchain]['nodes']['list'] return nodes } diff --git a/src/config/utils/services.ts b/src/config/utils/services.ts index 70fad9287..6b4d1fe58 100644 --- a/src/config/utils/services.ts +++ b/src/config/utils/services.ts @@ -15,7 +15,7 @@ export function getService const blockchainConfig = config[blockchain] if ('services' in blockchainConfig) { - const services = blockchainConfig['services'] + const services = blockchainConfig['services']['list'] const service = services[serviceName] if (service) { diff --git a/src/lib/constants/cryptos/data.json b/src/lib/constants/cryptos/data.json index e79d78ed9..ccf3f7908 100644 --- a/src/lib/constants/cryptos/data.json +++ b/src/lib/constants/cryptos/data.json @@ -1,4 +1,45 @@ { + "BTC": { + "symbol": "BTC", + "name": "Bitcoin", + "qrPrefix": "bitcoin", + "minBalance": 0.00001, + "regexAddress": "^bc1[a-zA-Z0-9]{39,59}$|^[13][1-9A-HJ-NP-Za-km-z]{25,34}$", + "decimals": 8, + "minTransferAmount": 0.00000546, + "nodes": { + "list": [ + { + "url": "https://btcnode1.adamant.im", + "alt_ip": "http://176.9.38.204:44099" + }, + { + "url": "https://btcnode2.adamant.im", + "alt_ip": "http://176.9.32.126:44099" + } + ], + "healthCheck": { + "normalUpdateInterval": 360000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 2 + } + }, + "createCoin": true, + "cryptoTransferDecimals": 8, + "defaultFee": 0.00003153, + "defaultVisibility": true, + "txFetchInfo": { + "newPendingInterval": 10000, + "oldPendingInterval": 3000, + "registeredInterval": 40000, + "newPendingAttempts": 20, + "oldPendingAttempts": 4 + }, + "txConsistencyMaxTime": 10800000, + "defaultOrdinalLevel": 10, + "explorerTx": "https://explorer.btc.com/btc/transaction/${ID}" + }, "ADM": { "symbol": "ADM", "name": "ADAMANT Messenger", @@ -6,47 +47,56 @@ "qrPrefix": "adm", "regexAddress": "^U([0-9]{6,21})$", "decimals": 8, - "nodes": [ - { - "url": "https://clown.adamant.im" - }, - { - "url": "https://lake.adamant.im" - }, - { - "url": "https://endless.adamant.im", - "alt_ip": "http://149.102.157.15:36666" - }, - { - "url": "https://bid.adamant.im" - }, - { - "url": "https://unusual.adamant.im" - }, - { - "url": "https://debate.adamant.im", - "alt_ip": "http://95.216.161.113:36666" - }, - { - "url": "http://78.47.205.206:36666" - }, - { - "url": "http://5.161.53.74:36666" + "nodes": { + "list": [ + { + "url": "https://clown.adamant.im" + }, + { + "url": "https://lake.adamant.im" + }, + { + "url": "https://endless.adamant.im", + "alt_ip": "http://149.102.157.15:36666" + }, + { + "url": "https://bid.adamant.im" + }, + { + "url": "https://unusual.adamant.im" + }, + { + "url": "https://debate.adamant.im", + "alt_ip": "http://95.216.161.113:36666" + }, + { + "url": "http://78.47.205.206:36666" + }, + { + "url": "http://5.161.53.74:36666" + }, + { + "url": "http://184.94.215.92:45555" + }, + { + "url": "https://node1.adamant.business", + "alt_ip": "http://194.233.75.29:45555" + }, + { + "url": "https://node2.blockchain2fa.io" + }, + { + "url": "https://sunshine.adamant.im" + } + ], + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 10 }, - { - "url": "http://184.94.215.92:45555" - }, - { - "url": "https://node1.adamant.business", - "alt_ip": "http://194.233.75.29:45555" - }, - { - "url": "https://node2.blockchain2fa.io" - }, - { - "url": "https://sunshine.adamant.im" - } - ], + "minVersion": "0.8.0" + }, "createCoin": true, "cryptoTransferDecimals": 8, "fixedFee": 0.5, @@ -59,79 +109,46 @@ "defaultOrdinalLevel": 0, "explorerTx": "https://explorer.adamant.im/tx/${ID}" }, - "BTC": { - "symbol": "BTC", - "name": "Bitcoin", - "qrPrefix": "bitcoin", - "minBalance": 0.00001, - "regexAddress": "^bc1[a-zA-Z0-9]{39,59}$|^[13][1-9A-HJ-NP-Za-km-z]{25,34}$", + "DASH": { + "symbol": "DASH", + "name": "Dash", + "qrPrefix": "dash", + "minBalance": 0.0001, + "regexAddress": "^[7X][1-9A-HJ-NP-Za-km-z]{33,}$", "decimals": 8, - "minTransferAmount": 0.00000546, - "nodes": [ - { - "url": "https://btcnode1.adamant.im", - "alt_ip": "http://176.9.38.204:44099" - }, - { - "url": "https://btcnode2.adamant.im", - "alt_ip": "http://176.9.32.126:44099" + "minTransferAmount": 0.00002, + "nodes": { + "list": [ + { + "url": "https://dashnode1.adamant.im", + "alt_ip": "http://45.85.147.224:44099" + }, + { + "url": "https://dashnode2.adamant.im", + "alt_ip": "http://207.180.210.95:44099" + } + ], + "healthCheck": { + "normalUpdateInterval": 210000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 3 } - ], + }, "createCoin": true, "cryptoTransferDecimals": 8, - "defaultFee": 0.00003153, + "fixedFee": 0.0001, "defaultVisibility": true, "txFetchInfo": { - "newPendingInterval": 10000, + "newPendingInterval": 5000, "oldPendingInterval": 3000, - "registeredInterval": 40000, + "registeredInterval": 30000, "newPendingAttempts": 20, "oldPendingAttempts": 4 }, - "txConsistencyMaxTime": 10800000, - "defaultOrdinalLevel": 10, - "explorerTx": "https://explorer.btc.com/btc/transaction/${ID}" - }, - "BUSD": { - "symbol": "BUSD", - "name": "Binance USD", - "decimals": 18, - "contractId": "0x4fabb145d64652a948d72533023f6e7a623c7c53", - "createCoin": false, - "cryptoTransferDecimals": 6, - "defaultGasLimit": 58000, - "status": "active", - "mainCoin": "ETH", - "type": "ERC20", - "fees": "ethereum" - }, - "BNB": { - "symbol": "BNB", - "name": "Binance Coin", - "decimals": 18, - "contractId": "0xB8c77482e45F1F44dE1745F52C74426C631bDD52", - "createCoin": false, - "cryptoTransferDecimals": 6, - "defaultGasLimit": 58000, - "status": "active", - "mainCoin": "ETH", - "type": "ERC20", - "fees": "ethereum" - }, - "DAI": { - "symbol": "DAI", - "name": "Dai", - "decimals": 18, - "contractId": "0x6b175474e89094c44da98b954eedeac495271d0f", - "createCoin": false, - "cryptoTransferDecimals": 6, - "defaultVisibility": true, - "defaultGasLimit": 58000, - "defaultOrdinalLevel": 50, - "status": "active", - "mainCoin": "ETH", - "type": "ERC20", - "fees": "ethereum" + "txConsistencyMaxTime": 800000, + "defaultOrdinalLevel": 80, + "explorerTx": "https://dashblockexplorer.com/tx/${ID}" }, "BZZ": { "symbol": "BZZ", @@ -155,16 +172,24 @@ "regexAddress": "^[A|D|9][A-Z0-9]([0-9a-zA-Z]{9,})$", "decimals": 8, "minTransferAmount": 1, - "nodes": [ - { - "url": "https://dogenode1.adamant.im", - "alt_ip": "http://5.9.99.62:44099" - }, - { - "url": "https://dogenode2.adamant.im", - "alt_ip": "http://176.9.32.126:44098" + "nodes": { + "list": [ + { + "url": "https://dogenode1.adamant.im", + "alt_ip": "http://5.9.99.62:44099" + }, + { + "url": "https://dogenode2.adamant.im", + "alt_ip": "http://176.9.32.126:44098" + } + ], + "healthCheck": { + "normalUpdateInterval": 390000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 3 } - ], + }, "createCoin": true, "cryptoTransferDecimals": 8, "fixedFee": 1, @@ -180,38 +205,52 @@ "defaultOrdinalLevel": 70, "explorerTx": "https://dogechain.info/tx/${ID}" }, - "DASH": { - "symbol": "DASH", - "name": "Dash", - "qrPrefix": "dash", - "minBalance": 0.0001, - "regexAddress": "^[7X][1-9A-HJ-NP-Za-km-z]{33,}$", - "decimals": 8, - "minTransferAmount": 0.00002, - "nodes": [ - { - "url": "https://dashnode1.adamant.im", - "alt_ip": "http://45.85.147.224:44099" - }, - { - "url": "https://dashnode2.adamant.im", - "alt_ip": "http://207.180.210.95:44099" + "ETH": { + "symbol": "ETH", + "name": "Ethereum", + "qrPrefix": "ethereum", + "regexAddress": "^0x[0-9a-fA-F]{40}$", + "decimals": 18, + "nodes": { + "list": [ + { + "url": "https://ethnode1.adamant.im", + "alt_ip": "http://95.216.41.106:44099", + "hasIndex": true + }, + { + "url": "https://ethnode2.adamant.im", + "alt_ip": "http://95.216.114.252:44099", + "hasIndex": true + }, + { + "url": "https://ethnode3.adamant.im", + "alt_ip": "http://46.4.37.157:44099", + "hasIndex": true + } + ], + "healthCheck": { + "normalUpdateInterval": 300000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 5 } - ], + }, "createCoin": true, - "cryptoTransferDecimals": 8, - "fixedFee": 0.0001, + "cryptoTransferDecimals": 6, "defaultVisibility": true, + "defaultGasLimit": 22000, + "defaultGasPriceGwei": 30, "txFetchInfo": { - "newPendingInterval": 5000, + "newPendingInterval": 4000, "oldPendingInterval": 3000, - "registeredInterval": 30000, + "registeredInterval": 5000, "newPendingAttempts": 20, "oldPendingAttempts": 4 }, - "txConsistencyMaxTime": 800000, - "defaultOrdinalLevel": 80, - "explorerTx": "https://dashblockexplorer.com/tx/${ID}" + "txConsistencyMaxTime": 1200000, + "defaultOrdinalLevel": 20, + "explorerTx": "https://etherscan.io/tx/${ID}" }, "FLUX": { "symbol": "FLUX", @@ -228,11 +267,11 @@ "type": "ERC20", "fees": "ethereum" }, - "ENS": { - "symbol": "ENS", - "name": "Ethereum Name Service", + "BNB": { + "symbol": "BNB", + "name": "Binance Coin", "decimals": 18, - "contractId": "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", + "contractId": "0xB8c77482e45F1F44dE1745F52C74426C631bDD52", "createCoin": false, "cryptoTransferDecimals": 6, "defaultGasLimit": 58000, @@ -241,48 +280,16 @@ "type": "ERC20", "fees": "ethereum" }, - "ETH": { - "symbol": "ETH", - "name": "Ethereum", - "qrPrefix": "ethereum", - "regexAddress": "^0x[0-9a-fA-F]{40}$", - "decimals": 18, - "nodes": [ - { - "url": "https://ethnode1.adamant.im", - "alt_ip": "http://95.216.41.106:44099", - "hasIndex": true - }, - { - "url": "https://ethnode2.adamant.im", - "alt_ip": "http://95.216.114.252:44099", - "hasIndex": true - } - ], - "createCoin": true, - "cryptoTransferDecimals": 6, - "defaultVisibility": true, - "defaultGasLimit": 22000, - "defaultGasPriceGwei": 30, - "txFetchInfo": { - "newPendingInterval": 4000, - "oldPendingInterval": 3000, - "registeredInterval": 5000, - "newPendingAttempts": 20, - "oldPendingAttempts": 4 - }, - "txConsistencyMaxTime": 1200000, - "defaultOrdinalLevel": 20, - "explorerTx": "https://etherscan.io/tx/${ID}" - }, - "HOT": { - "symbol": "HOT", - "name": "Holo", + "GT": { + "symbol": "GT", + "name": "Gate", "decimals": 18, - "contractId": "0x6c6ee5e31d828de241282b9606c8e98ea48526e2", + "contractId": "0xe66747a101bff2dba3697199dcce5b743b454759", "createCoin": false, "cryptoTransferDecimals": 6, + "defaultVisibility": true, "defaultGasLimit": 58000, + "defaultOrdinalLevel": 100, "status": "active", "mainCoin": "ETH", "type": "ERC20", @@ -295,12 +302,28 @@ "minBalance": 0.05, "regexAddress": "^lsk[a-z2-9]{38}$", "decimals": 8, - "nodes": [ - { - "url": "https://lisknode5.adamant.im", - "alt_ip": "http://38.242.243.29:44099" + "nodes": { + "list": [ + { + "url": "https://lisknode3.adamant.im", + "alt_ip": "http://157.90.229.236:44099" + }, + { + "url": "https://lisknode4.adamant.im", + "alt_ip": "http://78.47.205.206:44099" + }, + { + "url": "https://lisknode5.adamant.im", + "alt_ip": "http://38.242.243.29:44099" + } + ], + "healthCheck": { + "normalUpdateInterval": 270000, + "crucialUpdateInterval": 30000, + "onScreenUpdateInterval": 10000, + "threshold": 5 } - ], + }, "createCoin": true, "cryptoTransferDecimals": 8, "defaultFee": 0.00164, @@ -316,26 +339,26 @@ "defaultOrdinalLevel": 60, "explorerTx": "https://liskscan.com/transaction/${ID}" }, - "INJ": { - "symbol": "INJ", - "name": "Injective", - "regexAddress": "^(inj)[a-zA-HJ-NP-Z0-9]{25,39}$", + "DAI": { + "symbol": "DAI", + "name": "Dai", "decimals": 18, - "contractId": "0xe28b3b32b6c345a34ff64674606124dd5aceca30", + "contractId": "0x6b175474e89094c44da98b954eedeac495271d0f", "createCoin": false, "cryptoTransferDecimals": 6, + "defaultVisibility": true, "defaultGasLimit": 58000, - "explorerTx": "https://explorer.injective.network/transaction/${ID}", + "defaultOrdinalLevel": 50, "status": "active", "mainCoin": "ETH", "type": "ERC20", "fees": "ethereum" }, - "LINK": { - "symbol": "LINK", - "name": "Chainlink", + "BUSD": { + "symbol": "BUSD", + "name": "Binance USD", "decimals": 18, - "contractId": "0x514910771af9ca656af840dff83e8264ecf986ca", + "contractId": "0x4fabb145d64652a948d72533023f6e7a623c7c53", "createCoin": false, "cryptoTransferDecimals": 6, "defaultGasLimit": 58000, @@ -344,39 +367,52 @@ "type": "ERC20", "fees": "ethereum" }, - "MATIC": { - "symbol": "MATIC", - "name": "Polygon", - "regexAddress": "^0x[0-9a-fA-F]{40}$", + "ENS": { + "symbol": "ENS", + "name": "Ethereum Name Service", "decimals": 18, - "contractId": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", + "contractId": "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", "createCoin": false, "cryptoTransferDecimals": 6, "defaultGasLimit": 58000, - "explorerTx": "https://polygonscan.com/tx/${ID}", "status": "active", "mainCoin": "ETH", "type": "ERC20", "fees": "ethereum" }, - "MANA": { - "symbol": "MANA", - "name": "Decentraland", + "INJ": { + "symbol": "INJ", + "name": "Injective", + "regexAddress": "^(inj)[a-zA-HJ-NP-Z0-9]{25,39}$", "decimals": 18, - "contractId": "0x0f5d2fb29fb7d3cfee444a200298f468908cc942", + "contractId": "0xe28b3b32b6c345a34ff64674606124dd5aceca30", "createCoin": false, "cryptoTransferDecimals": 6, "defaultGasLimit": 58000, + "explorerTx": "https://explorer.injective.network/transaction/${ID}", "status": "active", "mainCoin": "ETH", "type": "ERC20", "fees": "ethereum" }, - "PAXG": { - "symbol": "PAXG", - "name": "PAX Gold", + "HOT": { + "symbol": "HOT", + "name": "Holo", "decimals": 18, - "contractId": "0x45804880de22913dafe09f4980848ece6ecbaf78", + "contractId": "0x6c6ee5e31d828de241282b9606c8e98ea48526e2", + "createCoin": false, + "cryptoTransferDecimals": 6, + "defaultGasLimit": 58000, + "status": "active", + "mainCoin": "ETH", + "type": "ERC20", + "fees": "ethereum" + }, + "MANA": { + "symbol": "MANA", + "name": "Decentraland", + "decimals": 18, + "contractId": "0x0f5d2fb29fb7d3cfee444a200298f468908cc942", "createCoin": false, "cryptoTransferDecimals": 6, "defaultGasLimit": 58000, @@ -398,11 +434,26 @@ "type": "ERC20", "fees": "ethereum" }, - "REN": { - "symbol": "REN", - "name": "Ren", + "MATIC": { + "symbol": "MATIC", + "name": "Polygon", + "regexAddress": "^0x[0-9a-fA-F]{40}$", "decimals": 18, - "contractId": "0x408e41876cccdc0f92210600ef50372656052a38", + "contractId": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", + "createCoin": false, + "cryptoTransferDecimals": 6, + "defaultGasLimit": 58000, + "explorerTx": "https://polygonscan.com/tx/${ID}", + "status": "active", + "mainCoin": "ETH", + "type": "ERC20", + "fees": "ethereum" + }, + "LINK": { + "symbol": "LINK", + "name": "Chainlink", + "decimals": 18, + "contractId": "0x514910771af9ca656af840dff83e8264ecf986ca", "createCoin": false, "cryptoTransferDecimals": 6, "defaultGasLimit": 58000, @@ -426,31 +477,27 @@ "type": "ERC20", "fees": "ethereum" }, - "GT": { - "symbol": "GT", - "name": "Gate", - "decimals": 8, - "contractId": "0xe66747a101bff2dba3697199dcce5b743b454759", + "PAXG": { + "symbol": "PAXG", + "name": "PAX Gold", + "decimals": 18, + "contractId": "0x45804880de22913dafe09f4980848ece6ecbaf78", "createCoin": false, "cryptoTransferDecimals": 6, - "defaultVisibility": true, "defaultGasLimit": 58000, - "defaultOrdinalLevel": 100, "status": "active", "mainCoin": "ETH", "type": "ERC20", "fees": "ethereum" }, - "SKL": { - "symbol": "SKL", - "name": "SKALE", + "REN": { + "symbol": "REN", + "name": "Ren", "decimals": 18, - "contractId": "0x00c83aecc790e8a4453e5dd3b0b4b3680501a7a7", + "contractId": "0x408e41876cccdc0f92210600ef50372656052a38", "createCoin": false, "cryptoTransferDecimals": 6, - "defaultVisibility": true, "defaultGasLimit": 58000, - "defaultOrdinalLevel": 85, "status": "active", "mainCoin": "ETH", "type": "ERC20", @@ -469,14 +516,16 @@ "type": "ERC20", "fees": "ethereum" }, - "SNX": { - "symbol": "SNX", - "name": "Synthetix Network", + "SKL": { + "symbol": "SKL", + "name": "SKALE", "decimals": 18, - "contractId": "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f", + "contractId": "0x00c83aecc790e8a4453e5dd3b0b4b3680501a7a7", "createCoin": false, "cryptoTransferDecimals": 6, + "defaultVisibility": true, "defaultGasLimit": 58000, + "defaultOrdinalLevel": 85, "status": "active", "mainCoin": "ETH", "type": "ERC20", @@ -495,14 +544,16 @@ "type": "ERC20", "fees": "ethereum" }, - "USDP": { - "symbol": "USDP", - "name": "PAX Dollar", + "VERSE": { + "symbol": "VERSE", + "name": "Verse", "decimals": 18, - "contractId": "0x8e870d67f660d95d5be530380d0ec0bd388289e1", + "contractId": "0x249cA82617eC3DfB2589c4c17ab7EC9765350a18", "createCoin": false, "cryptoTransferDecimals": 6, + "defaultVisibility": true, "defaultGasLimit": 58000, + "defaultOrdinalLevel": 95, "status": "active", "mainCoin": "ETH", "type": "ERC20", @@ -536,6 +587,19 @@ "type": "ERC20", "fees": "ethereum" }, + "USDP": { + "symbol": "USDP", + "name": "PAX Dollar", + "decimals": 18, + "contractId": "0x8e870d67f660d95d5be530380d0ec0bd388289e1", + "createCoin": false, + "cryptoTransferDecimals": 6, + "defaultGasLimit": 58000, + "status": "active", + "mainCoin": "ETH", + "type": "ERC20", + "fees": "ethereum" + }, "USDS": { "symbol": "USDS", "name": "Stably USD", @@ -592,19 +656,17 @@ "type": "ERC20", "fees": "ethereum" }, - "VERSE": { - "symbol": "VERSE", - "name": "Verse", + "SNX": { + "symbol": "SNX", + "name": "Synthetix Network", "decimals": 18, - "contractId": "0x249cA82617eC3DfB2589c4c17ab7EC9765350a18", + "contractId": "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f", "createCoin": false, "cryptoTransferDecimals": 6, - "defaultVisibility": true, "defaultGasLimit": 58000, - "defaultOrdinalLevel": 95, "status": "active", "mainCoin": "ETH", "type": "ERC20", "fees": "ethereum" } -} +} \ No newline at end of file diff --git a/src/lib/eth-index.js b/src/lib/eth-index.js index b5ddd87c5..ba4d474d2 100644 --- a/src/lib/eth-index.js +++ b/src/lib/eth-index.js @@ -105,7 +105,7 @@ function getTotalFromRange(range = '') { } function getUrl() { - const nodes = config.eth.nodes.filter((x) => x.hasIndex).map((x) => x.url) + const nodes = config.eth.nodes.list.filter((x) => x.hasIndex).map((x) => x.url) const index = Math.floor(Math.random() * nodes.length) return nodes[index] + '/ethtxs' } diff --git a/src/lib/nodes/abstract.client.ts b/src/lib/nodes/abstract.client.ts index 1a91733fb..63f55c6a5 100644 --- a/src/lib/nodes/abstract.client.ts +++ b/src/lib/nodes/abstract.client.ts @@ -1,4 +1,4 @@ -import type { NodeType } from '@/lib/nodes/types' +import type { HealthcheckInterval, NodeType } from '@/lib/nodes/types' import { filterSyncedNodes } from './utils/filterSyncedNodes' import { Node } from './abstract.node' import { nodesStorage } from './storage' @@ -49,6 +49,12 @@ export abstract class Client { } } + updateHealthCheckInterval(interval: HealthcheckInterval) { + for (const node of this.nodes) { + void node.updateHealthCheckInterval(interval) + } + } + getClient(): N['client'] { const node = this.useFastest ? this.getFastestNode() : this.getRandomNode() @@ -126,7 +132,7 @@ export abstract class Client { protected updateSyncStatuses() { const nodes = this.nodes.filter((x) => x.online && x.active) - const nodesInSync = filterSyncedNodes(nodes) + const nodesInSync = filterSyncedNodes(nodes, this.type) // Finally, all the nodes from the winner list are considered to be in sync, all the // others are not diff --git a/src/lib/nodes/abstract.node.ts b/src/lib/nodes/abstract.node.ts index 197e9daf0..48285629d 100644 --- a/src/lib/nodes/abstract.node.ts +++ b/src/lib/nodes/abstract.node.ts @@ -1,5 +1,6 @@ +import { getHealthCheckInterval } from './utils/getHealthcheckConfig' import { TNodeLabel } from './constants' -import { NodeStatus } from './types' +import { HealthcheckInterval, NodeKind, NodeStatus, NodeType } from './types' import { nodesStorage } from './storage' type HealthcheckResult = { @@ -15,11 +16,6 @@ type WsProtocol = 'ws:' | 'wss:' */ const appProtocol = location.protocol -/** - * Interval how often to update node statuses - */ -const REVISE_CONNECTION_TIMEOUT = 60000 - export abstract class Node { /** * Indicates whether node is active (i.e. user allows the application @@ -93,16 +89,29 @@ export abstract class Node { * Will be updated after `GET /api/node/status` */ socketSupport = false + + type: NodeType + kind: NodeKind label: TNodeLabel onStatusChangeCallback?: (nodeStatus: ReturnType) => void timer?: NodeJS.Timeout + healthCheckInterval: HealthcheckInterval = 'normal' abstract client: C - constructor(url: string, label: TNodeLabel, version = '', minNodeVersion = '') { + constructor( + url: string, + type: NodeType, + kind: NodeKind, + label: TNodeLabel, + version = '', + minNodeVersion = '' + ) { this.url = url + this.type = type this.label = label + this.kind = kind this.protocol = new URL(url).protocol as HttpProtocol this.port = new URL(url).port this.hostname = new URL(url).hostname @@ -130,7 +139,18 @@ export abstract class Node { this.fireStatusChange() } - this.timer = setTimeout(() => this.startHealthcheck(), REVISE_CONNECTION_TIMEOUT) + this.timer = setTimeout( + () => this.startHealthcheck(), + getHealthCheckInterval( + this.type, + this.kind, + this.online ? this.healthCheckInterval : 'crucial' + ) + ) + } + + updateHealthCheckInterval(interval: HealthcheckInterval) { + this.healthCheckInterval = interval } private fireStatusChange() { diff --git a/src/lib/nodes/adm/AdmNode.ts b/src/lib/nodes/adm/AdmNode.ts index 6bc751dac..70d1f8c0e 100644 --- a/src/lib/nodes/adm/AdmNode.ts +++ b/src/lib/nodes/adm/AdmNode.ts @@ -31,7 +31,7 @@ export class AdmNode extends Node { client: AxiosInstance constructor(url: string, minNodeVersion = '0.0.0') { - super(url, NODE_LABELS.AdmNode, minNodeVersion, minNodeVersion) + super(url, 'adm', 'node', NODE_LABELS.AdmNode, minNodeVersion, minNodeVersion) this.wsPort = '36668' // default wsPort this.wsProtocol = this.protocol === 'https:' ? 'wss:' : 'ws:' diff --git a/src/lib/nodes/adm/index.ts b/src/lib/nodes/adm/index.ts index 9b8d5573a..134177228 100644 --- a/src/lib/nodes/adm/index.ts +++ b/src/lib/nodes/adm/index.ts @@ -2,7 +2,7 @@ import config from '@/config' import { NodeInfo } from '@/types/wallets' import { AdmClient } from './AdmClient' -const endpoints = (config.adm.nodes as NodeInfo[]).map((endpoint) => endpoint.url) -export const adm = new AdmClient(endpoints, config.adm.minNodeVersion) +const endpoints = (config.adm.nodes.list as NodeInfo[]).map((endpoint) => endpoint.url) +export const adm = new AdmClient(endpoints, config.adm.nodes.minVersion) export default adm diff --git a/src/lib/nodes/btc/BtcNode.ts b/src/lib/nodes/btc/BtcNode.ts index dd1823e5c..c4d0b5063 100644 --- a/src/lib/nodes/btc/BtcNode.ts +++ b/src/lib/nodes/btc/BtcNode.ts @@ -11,7 +11,7 @@ export class BtcNode extends Node { client: AxiosInstance constructor(url: string) { - super(url, NODE_LABELS.BtcNode) + super(url, 'btc', 'node', NODE_LABELS.BtcNode) this.client = createBtcLikeClient(url) diff --git a/src/lib/nodes/btc/index.ts b/src/lib/nodes/btc/index.ts index 6c52544f3..9354436e6 100644 --- a/src/lib/nodes/btc/index.ts +++ b/src/lib/nodes/btc/index.ts @@ -2,7 +2,7 @@ import config from '@/config' import { NodeInfo } from '@/types/wallets' import { BtcClient } from './BtcClient' -const endpoints = (config.btc.nodes as NodeInfo[]).map((endpoint) => endpoint.url) +const endpoints = (config.btc.nodes.list as NodeInfo[]).map((endpoint) => endpoint.url) export const btc = new BtcClient(endpoints) export default btc diff --git a/src/lib/nodes/dash/DashNode.ts b/src/lib/nodes/dash/DashNode.ts index 1e4c24599..9e3082c26 100644 --- a/src/lib/nodes/dash/DashNode.ts +++ b/src/lib/nodes/dash/DashNode.ts @@ -11,7 +11,7 @@ export class DashNode extends Node { client: AxiosInstance constructor(url: string) { - super(url, NODE_LABELS.DashNode) + super(url, 'dash', 'node', NODE_LABELS.DashNode) this.client = createBtcLikeClient(url) diff --git a/src/lib/nodes/dash/index.ts b/src/lib/nodes/dash/index.ts index 640953e48..297b27701 100644 --- a/src/lib/nodes/dash/index.ts +++ b/src/lib/nodes/dash/index.ts @@ -2,7 +2,7 @@ import config from '@/config' import { NodeInfo } from '@/types/wallets' import { DashClient } from './DashClient' -const endpoints = (config.dash.nodes as NodeInfo[]).map((endpoint) => endpoint.url) +const endpoints = (config.dash.nodes.list as NodeInfo[]).map((endpoint) => endpoint.url) export const dash = new DashClient(endpoints) export default dash diff --git a/src/lib/nodes/doge/DogeNode.ts b/src/lib/nodes/doge/DogeNode.ts index 9ccf99134..d010cc6ab 100644 --- a/src/lib/nodes/doge/DogeNode.ts +++ b/src/lib/nodes/doge/DogeNode.ts @@ -11,7 +11,7 @@ export class DogeNode extends Node { client: AxiosInstance constructor(url: string) { - super(url, NODE_LABELS.DogeNode) + super(url, 'doge', 'node', NODE_LABELS.DogeNode) this.client = createBtcLikeClient(url) diff --git a/src/lib/nodes/doge/index.ts b/src/lib/nodes/doge/index.ts index 5143c9155..c43df54ae 100644 --- a/src/lib/nodes/doge/index.ts +++ b/src/lib/nodes/doge/index.ts @@ -2,7 +2,7 @@ import config from '@/config' import { NodeInfo } from '@/types/wallets' import { DogeClient } from './DogeClient' -const endpoints = (config.doge.nodes as NodeInfo[]).map((endpoint) => endpoint.url) +const endpoints = (config.doge.nodes.list as NodeInfo[]).map((endpoint) => endpoint.url) export const doge = new DogeClient(endpoints) export default doge diff --git a/src/lib/nodes/eth/EthNode.ts b/src/lib/nodes/eth/EthNode.ts index 6b05b4a60..eb61e9fed 100644 --- a/src/lib/nodes/eth/EthNode.ts +++ b/src/lib/nodes/eth/EthNode.ts @@ -15,7 +15,7 @@ export class EthNode extends Node { client: Web3Eth constructor(url: string) { - super(url, NODE_LABELS.EthNode) + super(url, 'eth', 'node', NODE_LABELS.EthNode) this.provider = new HttpProvider(this.url) this.client = new Web3Eth(this.provider) diff --git a/src/lib/nodes/eth/index.ts b/src/lib/nodes/eth/index.ts index cfcdc500e..1f743b029 100644 --- a/src/lib/nodes/eth/index.ts +++ b/src/lib/nodes/eth/index.ts @@ -2,7 +2,7 @@ import config from '@/config' import { NodeInfo } from '@/types/wallets' import { EthClient } from './EthClient' -const endpoints = (config.eth.nodes as NodeInfo[]).map((endpoint) => endpoint.url) +const endpoints = (config.eth.nodes.list as NodeInfo[]).map((endpoint) => endpoint.url) export const eth = new EthClient(endpoints) export default eth diff --git a/src/lib/nodes/index.ts b/src/lib/nodes/index.ts index 680aa053b..8e28ff2f6 100644 --- a/src/lib/nodes/index.ts +++ b/src/lib/nodes/index.ts @@ -1,20 +1,11 @@ -import { adm } from './adm' -import { btc } from './btc' -import { dash } from './dash' -import { doge } from './doge' -import { eth } from './eth' -import { lsk } from './lsk' -import { lskIndexer } from './lsk-indexer' +export { adm } from './adm' +export { btc } from './btc' +export { dash } from './dash' +export { doge } from './doge' +export { eth } from './eth' +export { lsk } from './lsk' +export { lskIndexer } from './lsk-indexer' -export const nodes = { - adm, - btc, - dash, - doge, - eth, - lsk -} - -export const services = { - lskIndexer -} +export { nodes } from './nodes' +export { services } from './services' +export { nodesManager } from './nodes-manager' diff --git a/src/lib/nodes/lsk-indexer/LskIndexer.ts b/src/lib/nodes/lsk-indexer/LskIndexer.ts index 49664eedd..b4965314a 100644 --- a/src/lib/nodes/lsk-indexer/LskIndexer.ts +++ b/src/lib/nodes/lsk-indexer/LskIndexer.ts @@ -11,7 +11,7 @@ export class LskIndexer extends Node { client: AxiosInstance constructor(url: string) { - super(url, NODE_LABELS.LskIndexer) + super(url, 'lsk', 'service', NODE_LABELS.LskIndexer) this.client = axios.create({ baseURL: `${url}/api/v3` }) diff --git a/src/lib/nodes/lsk-indexer/index.ts b/src/lib/nodes/lsk-indexer/index.ts index 8226a992b..9d00ee1af 100644 --- a/src/lib/nodes/lsk-indexer/index.ts +++ b/src/lib/nodes/lsk-indexer/index.ts @@ -2,7 +2,7 @@ import config from '@/config' import { Service } from '@/types/wallets' import { LskIndexerClient } from './LskIndexerClient' -const endpoints = (config.lsk.services.lskService as Service[]).map((endpoint) => endpoint.url) +const endpoints = (config.lsk.services.list.lskService as Service[]).map((endpoint) => endpoint.url) export const lskIndexer = new LskIndexerClient(endpoints) export default lskIndexer diff --git a/src/lib/nodes/lsk/LskNode.ts b/src/lib/nodes/lsk/LskNode.ts index 5d4c23c76..a2085227e 100644 --- a/src/lib/nodes/lsk/LskNode.ts +++ b/src/lib/nodes/lsk/LskNode.ts @@ -13,7 +13,7 @@ export class LskNode extends Node { client: AxiosInstance constructor(url: string) { - super(url, NODE_LABELS.LskNode) + super(url, 'lsk', 'node', NODE_LABELS.LskNode) this.client = axios.create({ baseURL: url }) diff --git a/src/lib/nodes/lsk/index.ts b/src/lib/nodes/lsk/index.ts index f80da62f6..6228b23bd 100644 --- a/src/lib/nodes/lsk/index.ts +++ b/src/lib/nodes/lsk/index.ts @@ -2,7 +2,7 @@ import config from '@/config' import { NodeInfo } from '@/types/wallets' import { LskClient } from './LskClient' -const endpoints = (config.lsk.nodes as NodeInfo[]).map((endpoint) => endpoint.url) +const endpoints = (config.lsk.nodes.list as NodeInfo[]).map((endpoint) => endpoint.url) export const lsk = new LskClient(endpoints) export default lsk diff --git a/src/lib/nodes/nodes-manager.ts b/src/lib/nodes/nodes-manager.ts new file mode 100644 index 000000000..8d6abcdfe --- /dev/null +++ b/src/lib/nodes/nodes-manager.ts @@ -0,0 +1,12 @@ +import type { HealthcheckInterval } from './types' +import { nodes } from './nodes' + +class NodesManager { + updateHealthcheckInterval(interval: HealthcheckInterval) { + for (const node of Object.values(nodes)) { + node.updateHealthCheckInterval(interval) + } + } +} + +export const nodesManager = new NodesManager() diff --git a/src/lib/nodes/nodes.ts b/src/lib/nodes/nodes.ts new file mode 100644 index 000000000..9be8d5dcf --- /dev/null +++ b/src/lib/nodes/nodes.ts @@ -0,0 +1,15 @@ +import { adm } from './adm' +import { btc } from './btc' +import { dash } from './dash' +import { doge } from './doge' +import { eth } from './eth' +import { lsk } from './lsk' + +export const nodes = { + adm, + btc, + dash, + doge, + eth, + lsk +} diff --git a/src/lib/nodes/services.ts b/src/lib/nodes/services.ts new file mode 100644 index 000000000..f60c8f4e4 --- /dev/null +++ b/src/lib/nodes/services.ts @@ -0,0 +1,5 @@ +import { lskIndexer } from './lsk-indexer' + +export const services = { + lskIndexer +} diff --git a/src/lib/nodes/types.ts b/src/lib/nodes/types.ts index bcb505979..d938906fb 100644 --- a/src/lib/nodes/types.ts +++ b/src/lib/nodes/types.ts @@ -6,3 +6,6 @@ export type NodeStatus = | 'unsupported_version' // node version is too low export type NodeType = 'adm' | 'eth' | 'btc' | 'doge' | 'dash' | 'lsk' +export type NodeKind = 'node' | 'service' + +export type HealthcheckInterval = 'normal' | 'crucial' | 'onScreen' diff --git a/src/lib/nodes/utils/filterSyncedNodes.ts b/src/lib/nodes/utils/filterSyncedNodes.ts index ba176195f..bc4448431 100644 --- a/src/lib/nodes/utils/filterSyncedNodes.ts +++ b/src/lib/nodes/utils/filterSyncedNodes.ts @@ -1,10 +1,17 @@ +import { NodeType } from '@/lib/nodes/types' +import { getNodeHealthcheckConfig } from './getHealthcheckConfig' + /** * Allowed height delta for the nodes. * * If two nodes' heights differ by no more than this value, * they are considered to be in sync with each other. */ -const HEIGHT_EPSILON = 10 +function getHeightEpsilon(nodeType: NodeType): number { + const config = getNodeHealthcheckConfig(nodeType) + + return config.threshold +} interface Node { height: number @@ -20,7 +27,7 @@ type GroupNodes = { * height (considering HEIGHT_EPSILON). These nodes are considered to be in sync with the network, * all the others are not. */ -export function filterSyncedNodes(nodes: N[]): GroupNodes { +export function filterSyncedNodes(nodes: N[], type: NodeType): GroupNodes { if (nodes.length === 0) { return { height: 0, @@ -28,13 +35,15 @@ export function filterSyncedNodes(nodes: N[]): GroupNodes { } } + const heightEpsilon = getHeightEpsilon(type) + // For each node we take its height and list of nodes that have the same height ± epsilon const groups = nodes.map((node) => { return { /** In case of "win" this height will be considered to be real height of the network */ height: node.height, /** List of nodes with the same (or close) height, including current one */ - nodes: nodes.filter((x) => Math.abs(node.height - x.height) <= HEIGHT_EPSILON) + nodes: nodes.filter((x) => Math.abs(node.height - x.height) <= heightEpsilon) } }) diff --git a/src/lib/nodes/utils/getHealthcheckConfig.ts b/src/lib/nodes/utils/getHealthcheckConfig.ts new file mode 100644 index 000000000..ed188da3c --- /dev/null +++ b/src/lib/nodes/utils/getHealthcheckConfig.ts @@ -0,0 +1,35 @@ +import config from '@/config' +import { HealthcheckInterval, NodeKind, NodeType } from '@/lib/nodes/types' +import type { NodeHealthcheck, ServiceHealthcheck } from '@/types/wallets' + +export function getNodeHealthcheckConfig(nodeType: NodeType): NodeHealthcheck { + return config[nodeType].nodes.healthCheck +} + +export function getServiceHealthcheckConfig(nodeType: NodeType): ServiceHealthcheck { + return config[nodeType].services.healthCheck +} + +export function getHealthCheckInterval( + nodeType: NodeType, + nodeKind: NodeKind, + interval: HealthcheckInterval +) { + const config = + nodeKind === 'service' + ? getServiceHealthcheckConfig(nodeType) + : getNodeHealthcheckConfig(nodeType) + + switch (interval) { + case 'normal': + return config.normalUpdateInterval + case 'crucial': + return config.crucialUpdateInterval + case 'onScreen': + return config.onScreenUpdateInterval + default: + throw new Error( + `getNodeHealthCheckInterval: Interval ${interval} is not defined in the Node's config` + ) + } +} diff --git a/src/types/wallets/index.ts b/src/types/wallets/index.ts index 4eafed186..2105a5709 100644 --- a/src/types/wallets/index.ts +++ b/src/types/wallets/index.ts @@ -15,6 +15,26 @@ export interface NodeInfo { hasIndex?: boolean } +export interface NodeHealthcheck { + /** Regular node status update interval in ms */ + normalUpdateInterval: number + /** Node status update interval when there are no active nodes, in ms */ + crucialUpdateInterval: number + /** On the node screen, the status update interval in ms */ + onScreenUpdateInterval: number + /** Permissible height difference between nodes */ + threshold: number +} + +export interface ServiceHealthcheck { + /** Regular node status update interval in ms */ + normalUpdateInterval: number + /** Node status update interval when there are no active nodes, in ms */ + crucialUpdateInterval: number + /** On the node screen, the status update interval in ms */ + onScreenUpdateInterval: number +} + export interface ProjectLink { name: string url: string @@ -92,14 +112,26 @@ export interface TokenGeneral { } /** Time in ms when difference between in-chat transfer and Tx timestamp considered as acceptable */ txConsistencyMaxTime?: number - /** - * Minimal node API version - * @example "0.8.0" - */ - minNodeVersion?: string - /** Node links for API */ - nodes?: NodeInfo[] - services?: Record + nodes?: { + /** Node links for API */ + list: NodeInfo[] + healthCheck: NodeHealthcheck + /** + * Minimal node API version + * @example "0.8.0" + */ + minVersion?: string + } + services?: { + /** Service node links for API */ + list: Record + healthCheck: ServiceHealthcheck + /** + * Minimal service node API version + * @example "1.0.0" + */ + minVersion?: string + } /** Additional project links */ links?: ProjectLink[] tor?: { @@ -111,9 +143,26 @@ export interface TokenGeneral { explorerTx?: string /** URL to get address info (Tor) */ explorerAddress?: string - /** Node links for API (Tor) */ - nodes?: NodeInfo[] - services?: Record + nodes?: { + /** Node links for API */ + list: NodeInfo[] + healthCheck: NodeHealthcheck + /** + * Minimal node API version + * @example "0.8.0" + */ + minVersion?: string + } + services?: { + /** Service node links for API */ + list: Record + healthCheck?: ServiceHealthcheck + /** + * Minimal service node API version + * @example "1.0.0" + */ + minVersion?: string + } /** Additional project links (Tor) */ links?: ProjectLink[] } diff --git a/src/views/Nodes.vue b/src/views/Nodes.vue index 53ab2146e..e915e52be 100644 --- a/src/views/Nodes.vue +++ b/src/views/Nodes.vue @@ -47,6 +47,7 @@