diff --git a/.changeset/purple-ducks-whisper.md b/.changeset/purple-ducks-whisper.md new file mode 100644 index 0000000..7d26087 --- /dev/null +++ b/.changeset/purple-ducks-whisper.md @@ -0,0 +1,5 @@ +--- +'@rosen-bridge/watcher': patch +--- + +Stabalize ogmios connection by adding connection close handler diff --git a/config/default.yaml b/config/default.yaml index 5a6d734..f1adbd2 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -28,6 +28,7 @@ cardano: ogmios: host: '' # ogmios node host address port: 1337 # ogmios port + connectionRetrialInterval: 30 # ogmios connection retrial interval (in seconds) useTls: false # connect to ogmios using https or not blockfrost: url: '' # url to connect to blockfrost diff --git a/package-lock.json b/package-lock.json index 6b785cc..60ddc36 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,21 +10,21 @@ "license": "ISC", "dependencies": { "@emurgo/cip14-js": "^3.0.1", - "@rosen-bridge/address-extractor": "^5.0.5", + "@rosen-bridge/address-extractor": "^5.0.6", "@rosen-bridge/asset-check": "^0.2.1", - "@rosen-bridge/bitcoin-esplora-scanner": "^0.1.10", - "@rosen-bridge/bitcoin-observation-extractor": "^4.0.1", - "@rosen-bridge/bitcoin-rpc-scanner": "^0.2.4", + "@rosen-bridge/bitcoin-esplora-scanner": "^0.1.12", + "@rosen-bridge/bitcoin-observation-extractor": "^4.0.4", + "@rosen-bridge/bitcoin-rpc-scanner": "^0.2.6", "@rosen-bridge/health-check": "^5.0.0", "@rosen-bridge/log-level-check": "^0.1.1", "@rosen-bridge/minimum-fee": "^2.1.0", "@rosen-bridge/node-sync-check": "^0.1.1", - "@rosen-bridge/observation-extractor": "^5.0.2", + "@rosen-bridge/observation-extractor": "^5.0.4", "@rosen-bridge/permit-check": "^0.1.1", - "@rosen-bridge/scanner": "^4.0.5", + "@rosen-bridge/scanner": "^4.1.1", "@rosen-bridge/scanner-sync-check": "^0.3.0", "@rosen-bridge/tokens": "^1.2.1", - "@rosen-bridge/watcher-data-extractor": "^7.0.0", + "@rosen-bridge/watcher-data-extractor": "^7.0.2", "@rosen-bridge/wid-check": "^0.1.1", "@rosen-bridge/winston-logger": "0.2.1", "@rosen-clients/cardano-koios": "^2.0.3", @@ -1990,12 +1990,12 @@ "license": "MIT" }, "node_modules/@rosen-bridge/abstract-extractor": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@rosen-bridge/abstract-extractor/-/abstract-extractor-0.1.5.tgz", - "integrity": "sha512-+TIL0H88voDrZZg0ZdgdHPnIlrUq+m1n8IbMpCEGCs0EdTAcNXKhdK43vuuaMF7rDrunv8SdGEmzTB4GQnkloQ==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@rosen-bridge/abstract-extractor/-/abstract-extractor-0.2.0.tgz", + "integrity": "sha512-F5G6iZrK/ELXnDqSvjFvAHzfLxUEE8TWCTioccrAZF7ETv2/ix0ScSnmuf0tQ3nma0Fr01STSC/8mg+4cPA3DA==", "dependencies": { "@rosen-bridge/abstract-logger": "^1.0.0", - "@rosen-clients/ergo-explorer": "^1.1.1", + "@rosen-clients/ergo-explorer": "^1.1.2", "@rosen-clients/ergo-node": "^1.1.1", "lodash-es": "^4.17.21" }, @@ -2022,11 +2022,11 @@ } }, "node_modules/@rosen-bridge/address-extractor": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@rosen-bridge/address-extractor/-/address-extractor-5.0.5.tgz", - "integrity": "sha512-rMcRx6toutROyf0JAMVkcJklk8zcbSxt5dNSii4VzvRsfGvGT0DEgSLtr/8WfcV5/78931gdgayZZFeeWTA/Mg==", + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/@rosen-bridge/address-extractor/-/address-extractor-5.0.6.tgz", + "integrity": "sha512-32L7X7CFqv/R7OTjVe6bOkOeDM0X0M+J5gh0OI5r/ySIRtjOSF3zB7AW3JkFM5yXZAc21t6hm6QNQPwxBR+7XQ==", "dependencies": { - "@rosen-bridge/abstract-extractor": "^0.1.5", + "@rosen-bridge/abstract-extractor": "^0.2.0", "@rosen-bridge/abstract-logger": "^1.0.0", "@rosen-clients/ergo-explorer": "^1.1.1", "blakejs": "^1.2.1", @@ -2093,12 +2093,12 @@ } }, "node_modules/@rosen-bridge/bitcoin-esplora-scanner": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/@rosen-bridge/bitcoin-esplora-scanner/-/bitcoin-esplora-scanner-0.1.10.tgz", - "integrity": "sha512-fvJty/EDThy1JBy50WAEpIUgDZPrn9nZxguULGhqwmjlMCs7tLoGwdC5uxDaM08NlFVowx8b9PEfw4utOoaRMw==", + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/@rosen-bridge/bitcoin-esplora-scanner/-/bitcoin-esplora-scanner-0.1.12.tgz", + "integrity": "sha512-0yCFMAuP7L3ojUAQFE1iLQ/S55enTAh/U+9VJcsd5n87jii+3BisadMln2cMHnYqHQn2dPrgLiYK0pGiL5uwXA==", "dependencies": { "@rosen-bridge/abstract-logger": "^1.0.0", - "@rosen-bridge/scanner": "^4.0.5", + "@rosen-bridge/scanner": "^4.1.1", "axios": "^1.6.8" }, "engines": { @@ -2116,15 +2116,15 @@ } }, "node_modules/@rosen-bridge/bitcoin-observation-extractor": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@rosen-bridge/bitcoin-observation-extractor/-/bitcoin-observation-extractor-4.0.1.tgz", - "integrity": "sha512-fv4qSQVQ5uPnHPlCV3LMYBnZVElYuN1uyJhK2DEXPBpBaNEHz9+kIhkUbueqbT7v8KJKNYFPlixC2O4U3qpO3w==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@rosen-bridge/bitcoin-observation-extractor/-/bitcoin-observation-extractor-4.0.4.tgz", + "integrity": "sha512-x9sabvN8FrbHieNGBBYscagq3n6g2U9lJt40d8GCraDBk0xurxXZ2gzObBSVaGWitXdxY17SbSWBxavxwA4fvA==", "dependencies": { "@rosen-bridge/abstract-logger": "^1.0.0", - "@rosen-bridge/bitcoin-esplora-scanner": "^0.1.10", - "@rosen-bridge/bitcoin-rpc-scanner": "^0.2.4", - "@rosen-bridge/observation-extractor": "^5.0.1", - "@rosen-bridge/rosen-extractor": "^6.0.1", + "@rosen-bridge/bitcoin-esplora-scanner": "^0.1.12", + "@rosen-bridge/bitcoin-rpc-scanner": "^0.2.6", + "@rosen-bridge/observation-extractor": "^5.0.4", + "@rosen-bridge/rosen-extractor": "^6.1.0", "@rosen-bridge/tokens": "^1.2.0", "typeorm": "^0.3.20" }, @@ -2133,12 +2133,12 @@ } }, "node_modules/@rosen-bridge/bitcoin-rpc-scanner": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@rosen-bridge/bitcoin-rpc-scanner/-/bitcoin-rpc-scanner-0.2.4.tgz", - "integrity": "sha512-xihMGddwbSp8BihhJit7BXoYJKJbu7OZHe23o+5qbdS/fE5WEe6HOqPPFUPRcQs9NX03yrG9kcTvRz0qpIZ20w==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@rosen-bridge/bitcoin-rpc-scanner/-/bitcoin-rpc-scanner-0.2.6.tgz", + "integrity": "sha512-aiqACIg009P3XMgR80jXwls4yatJBB4WFuhq/W2eV3uToJBQq3BNsRwT2csdOcsaBEsLcqSGieUBatg3OToJIg==", "dependencies": { "@rosen-bridge/abstract-logger": "^1.0.0", - "@rosen-bridge/scanner": "^4.0.5", + "@rosen-bridge/scanner": "^4.1.1", "axios": "^1.6.8" }, "engines": { @@ -2146,9 +2146,9 @@ } }, "node_modules/@rosen-bridge/bitcoin-rpc-scanner/node_modules/axios": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", - "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.3.tgz", + "integrity": "sha512-Ar7ND9pU99eJ9GpoGQKhKf58GpUOgnzuaB7ueNQ5BMi0p+LZ5oaEnfF999fAArcTIBwXTCHAmGcHOZJaWPq9Nw==", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -2235,15 +2235,15 @@ } }, "node_modules/@rosen-bridge/observation-extractor": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@rosen-bridge/observation-extractor/-/observation-extractor-5.0.2.tgz", - "integrity": "sha512-zwWs0CW87WXAW1YxZfdVBVbBO2u+wy2HRTkP6FJEcdco6PQ34j0z6XgqnIYIgHiu45Ax7u+7PR9ka5Xq3BYOXg==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@rosen-bridge/observation-extractor/-/observation-extractor-5.0.4.tgz", + "integrity": "sha512-WsuYMo0V1Ox2ALyWpDIfgUBhu2pHmxISq6L6nXKdwALOZAJ/8BEwi5OP3vDMLa7ymIeFM6lZ94Tvvb2aQ4KBSA==", "dependencies": { "@cardano-ogmios/schema": "^6.0.3", - "@rosen-bridge/abstract-extractor": "^0.1.5", + "@rosen-bridge/abstract-extractor": "^0.2.0", "@rosen-bridge/abstract-logger": "^1.0.0", "@rosen-bridge/rosen-extractor": "^6.1.0", - "@rosen-bridge/scanner": "^4.0.5", + "@rosen-bridge/scanner": "^4.1.1", "@rosen-bridge/tokens": "^1.2.0", "blakejs": "^1.2.1", "ergo-lib-wasm-nodejs": "^0.24.1", @@ -2312,15 +2312,15 @@ } }, "node_modules/@rosen-bridge/scanner": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/@rosen-bridge/scanner/-/scanner-4.0.5.tgz", - "integrity": "sha512-TPX12mwpCz9elIkwzZgHoXa4M8Ho41rFomJ8hMvB9KgBCVJfq0UVUBUI6WWeAiFaKub66M8vzWBMoKl8kS6acA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@rosen-bridge/scanner/-/scanner-4.1.1.tgz", + "integrity": "sha512-v59BdX2vZvvP33yHOPx8fAEiRHaI6oBqH0nBp73yLankDXpGF35awQYwiuphBeA0vKTdEJGglis0rZZ8GA2Y2A==", "dependencies": { "@apollo/client": "^3.8.7", "@blockfrost/blockfrost-js": "^5.4.0", "@cardano-ogmios/client": "^6.3.0", "@cardano-ogmios/schema": "^6.3.0", - "@rosen-bridge/abstract-extractor": "^0.1.5", + "@rosen-bridge/abstract-extractor": "^0.2.0", "@rosen-bridge/abstract-logger": "^1.0.0", "@rosen-bridge/json-bigint": "^0.1.0", "@rosen-clients/ergo-explorer": "^1.1.1", @@ -2432,15 +2432,15 @@ "integrity": "sha512-sWn2XMQvzLKRZTlw3mlZZWLGy81XzFEJuLu/WBPq0EyHy2eXFSOacID7uwvD+EIoldfwwraX1bv/+u3gY0gKHw==" }, "node_modules/@rosen-bridge/watcher-data-extractor": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@rosen-bridge/watcher-data-extractor/-/watcher-data-extractor-7.0.0.tgz", - "integrity": "sha512-HZoR4Ir7ETrFAg0YMs6N19l1omDX3aK8w3ObISjCGSVsLTRdegiQxoHMuMOZ8VNCPIoytRxamP2twh7CXZiSsQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@rosen-bridge/watcher-data-extractor/-/watcher-data-extractor-7.0.2.tgz", + "integrity": "sha512-xvSs6iMJh/4uBRGTyvpwn2jVpcHUUFZkU0hqRaKiWIAGbzdvn81IO74s7JUmWjfn29DArzjQ1zJ1NfapxCiyuw==", "dependencies": { - "@rosen-bridge/abstract-extractor": "^0.1.5", + "@rosen-bridge/abstract-extractor": "^0.2.0", "@rosen-bridge/abstract-logger": "^1.0.0", "@rosen-bridge/extended-typeorm": "^0.0.3", "@rosen-bridge/json-bigint": "^0.1.0", - "@rosen-bridge/scanner": "^4.0.5", + "@rosen-bridge/scanner": "^4.1.1", "@rosen-bridge/tokens": "^1.2.1", "@rosen-clients/ergo-explorer": "^1.1.1", "@types/lodash-es": "^4.17.6", @@ -2541,9 +2541,9 @@ } }, "node_modules/@rosen-clients/ergo-explorer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@rosen-clients/ergo-explorer/-/ergo-explorer-1.1.1.tgz", - "integrity": "sha512-xvDM15MhHV1HLg3e9/0fETDKs9ZFT1MT6pip1KWaLmPbCYetI88iPPcLPCaO0RwY+Iqf5qm+gHbKeroFdA+juw==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@rosen-clients/ergo-explorer/-/ergo-explorer-1.1.2.tgz", + "integrity": "sha512-GHTBgGZlPbiHfpJs0X/2v+9Ern5hlDaNIHNAgse2iDDvOu1jdpDpY+bpnHtWiLcUKJWUfV2RjBnBxpHMyHAUKQ==", "dependencies": { "@rosen-clients/axios": "^0.1.0" } @@ -14262,12 +14262,12 @@ } }, "@rosen-bridge/abstract-extractor": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@rosen-bridge/abstract-extractor/-/abstract-extractor-0.1.5.tgz", - "integrity": "sha512-+TIL0H88voDrZZg0ZdgdHPnIlrUq+m1n8IbMpCEGCs0EdTAcNXKhdK43vuuaMF7rDrunv8SdGEmzTB4GQnkloQ==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@rosen-bridge/abstract-extractor/-/abstract-extractor-0.2.0.tgz", + "integrity": "sha512-F5G6iZrK/ELXnDqSvjFvAHzfLxUEE8TWCTioccrAZF7ETv2/ix0ScSnmuf0tQ3nma0Fr01STSC/8mg+4cPA3DA==", "requires": { "@rosen-bridge/abstract-logger": "^1.0.0", - "@rosen-clients/ergo-explorer": "^1.1.1", + "@rosen-clients/ergo-explorer": "^1.1.2", "@rosen-clients/ergo-node": "^1.1.1", "lodash-es": "^4.17.21" } @@ -14288,11 +14288,11 @@ } }, "@rosen-bridge/address-extractor": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@rosen-bridge/address-extractor/-/address-extractor-5.0.5.tgz", - "integrity": "sha512-rMcRx6toutROyf0JAMVkcJklk8zcbSxt5dNSii4VzvRsfGvGT0DEgSLtr/8WfcV5/78931gdgayZZFeeWTA/Mg==", + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/@rosen-bridge/address-extractor/-/address-extractor-5.0.6.tgz", + "integrity": "sha512-32L7X7CFqv/R7OTjVe6bOkOeDM0X0M+J5gh0OI5r/ySIRtjOSF3zB7AW3JkFM5yXZAc21t6hm6QNQPwxBR+7XQ==", "requires": { - "@rosen-bridge/abstract-extractor": "^0.1.5", + "@rosen-bridge/abstract-extractor": "^0.2.0", "@rosen-bridge/abstract-logger": "^1.0.0", "@rosen-clients/ergo-explorer": "^1.1.1", "blakejs": "^1.2.1", @@ -14347,12 +14347,12 @@ } }, "@rosen-bridge/bitcoin-esplora-scanner": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/@rosen-bridge/bitcoin-esplora-scanner/-/bitcoin-esplora-scanner-0.1.10.tgz", - "integrity": "sha512-fvJty/EDThy1JBy50WAEpIUgDZPrn9nZxguULGhqwmjlMCs7tLoGwdC5uxDaM08NlFVowx8b9PEfw4utOoaRMw==", + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/@rosen-bridge/bitcoin-esplora-scanner/-/bitcoin-esplora-scanner-0.1.12.tgz", + "integrity": "sha512-0yCFMAuP7L3ojUAQFE1iLQ/S55enTAh/U+9VJcsd5n87jii+3BisadMln2cMHnYqHQn2dPrgLiYK0pGiL5uwXA==", "requires": { "@rosen-bridge/abstract-logger": "^1.0.0", - "@rosen-bridge/scanner": "^4.0.5", + "@rosen-bridge/scanner": "^4.1.1", "axios": "^1.6.8" }, "dependencies": { @@ -14369,33 +14369,33 @@ } }, "@rosen-bridge/bitcoin-observation-extractor": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@rosen-bridge/bitcoin-observation-extractor/-/bitcoin-observation-extractor-4.0.1.tgz", - "integrity": "sha512-fv4qSQVQ5uPnHPlCV3LMYBnZVElYuN1uyJhK2DEXPBpBaNEHz9+kIhkUbueqbT7v8KJKNYFPlixC2O4U3qpO3w==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@rosen-bridge/bitcoin-observation-extractor/-/bitcoin-observation-extractor-4.0.4.tgz", + "integrity": "sha512-x9sabvN8FrbHieNGBBYscagq3n6g2U9lJt40d8GCraDBk0xurxXZ2gzObBSVaGWitXdxY17SbSWBxavxwA4fvA==", "requires": { "@rosen-bridge/abstract-logger": "^1.0.0", - "@rosen-bridge/bitcoin-esplora-scanner": "^0.1.10", - "@rosen-bridge/bitcoin-rpc-scanner": "^0.2.4", - "@rosen-bridge/observation-extractor": "^5.0.1", - "@rosen-bridge/rosen-extractor": "^6.0.1", + "@rosen-bridge/bitcoin-esplora-scanner": "^0.1.12", + "@rosen-bridge/bitcoin-rpc-scanner": "^0.2.6", + "@rosen-bridge/observation-extractor": "^5.0.4", + "@rosen-bridge/rosen-extractor": "^6.1.0", "@rosen-bridge/tokens": "^1.2.0", "typeorm": "^0.3.20" } }, "@rosen-bridge/bitcoin-rpc-scanner": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@rosen-bridge/bitcoin-rpc-scanner/-/bitcoin-rpc-scanner-0.2.4.tgz", - "integrity": "sha512-xihMGddwbSp8BihhJit7BXoYJKJbu7OZHe23o+5qbdS/fE5WEe6HOqPPFUPRcQs9NX03yrG9kcTvRz0qpIZ20w==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@rosen-bridge/bitcoin-rpc-scanner/-/bitcoin-rpc-scanner-0.2.6.tgz", + "integrity": "sha512-aiqACIg009P3XMgR80jXwls4yatJBB4WFuhq/W2eV3uToJBQq3BNsRwT2csdOcsaBEsLcqSGieUBatg3OToJIg==", "requires": { "@rosen-bridge/abstract-logger": "^1.0.0", - "@rosen-bridge/scanner": "^4.0.5", + "@rosen-bridge/scanner": "^4.1.1", "axios": "^1.6.8" }, "dependencies": { "axios": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", - "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.3.tgz", + "integrity": "sha512-Ar7ND9pU99eJ9GpoGQKhKf58GpUOgnzuaB7ueNQ5BMi0p+LZ5oaEnfF999fAArcTIBwXTCHAmGcHOZJaWPq9Nw==", "requires": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -14462,15 +14462,15 @@ } }, "@rosen-bridge/observation-extractor": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@rosen-bridge/observation-extractor/-/observation-extractor-5.0.2.tgz", - "integrity": "sha512-zwWs0CW87WXAW1YxZfdVBVbBO2u+wy2HRTkP6FJEcdco6PQ34j0z6XgqnIYIgHiu45Ax7u+7PR9ka5Xq3BYOXg==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@rosen-bridge/observation-extractor/-/observation-extractor-5.0.4.tgz", + "integrity": "sha512-WsuYMo0V1Ox2ALyWpDIfgUBhu2pHmxISq6L6nXKdwALOZAJ/8BEwi5OP3vDMLa7ymIeFM6lZ94Tvvb2aQ4KBSA==", "requires": { "@cardano-ogmios/schema": "^6.0.3", - "@rosen-bridge/abstract-extractor": "^0.1.5", + "@rosen-bridge/abstract-extractor": "^0.2.0", "@rosen-bridge/abstract-logger": "^1.0.0", "@rosen-bridge/rosen-extractor": "^6.1.0", - "@rosen-bridge/scanner": "^4.0.5", + "@rosen-bridge/scanner": "^4.1.1", "@rosen-bridge/tokens": "^1.2.0", "blakejs": "^1.2.1", "ergo-lib-wasm-nodejs": "^0.24.1", @@ -14527,15 +14527,15 @@ } }, "@rosen-bridge/scanner": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/@rosen-bridge/scanner/-/scanner-4.0.5.tgz", - "integrity": "sha512-TPX12mwpCz9elIkwzZgHoXa4M8Ho41rFomJ8hMvB9KgBCVJfq0UVUBUI6WWeAiFaKub66M8vzWBMoKl8kS6acA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@rosen-bridge/scanner/-/scanner-4.1.1.tgz", + "integrity": "sha512-v59BdX2vZvvP33yHOPx8fAEiRHaI6oBqH0nBp73yLankDXpGF35awQYwiuphBeA0vKTdEJGglis0rZZ8GA2Y2A==", "requires": { "@apollo/client": "^3.8.7", "@blockfrost/blockfrost-js": "^5.4.0", "@cardano-ogmios/client": "^6.3.0", "@cardano-ogmios/schema": "^6.3.0", - "@rosen-bridge/abstract-extractor": "^0.1.5", + "@rosen-bridge/abstract-extractor": "^0.2.0", "@rosen-bridge/abstract-logger": "^1.0.0", "@rosen-bridge/json-bigint": "^0.1.0", "@rosen-clients/ergo-explorer": "^1.1.1", @@ -14624,15 +14624,15 @@ "integrity": "sha512-sWn2XMQvzLKRZTlw3mlZZWLGy81XzFEJuLu/WBPq0EyHy2eXFSOacID7uwvD+EIoldfwwraX1bv/+u3gY0gKHw==" }, "@rosen-bridge/watcher-data-extractor": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@rosen-bridge/watcher-data-extractor/-/watcher-data-extractor-7.0.0.tgz", - "integrity": "sha512-HZoR4Ir7ETrFAg0YMs6N19l1omDX3aK8w3ObISjCGSVsLTRdegiQxoHMuMOZ8VNCPIoytRxamP2twh7CXZiSsQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@rosen-bridge/watcher-data-extractor/-/watcher-data-extractor-7.0.2.tgz", + "integrity": "sha512-xvSs6iMJh/4uBRGTyvpwn2jVpcHUUFZkU0hqRaKiWIAGbzdvn81IO74s7JUmWjfn29DArzjQ1zJ1NfapxCiyuw==", "requires": { - "@rosen-bridge/abstract-extractor": "^0.1.5", + "@rosen-bridge/abstract-extractor": "^0.2.0", "@rosen-bridge/abstract-logger": "^1.0.0", "@rosen-bridge/extended-typeorm": "^0.0.3", "@rosen-bridge/json-bigint": "^0.1.0", - "@rosen-bridge/scanner": "^4.0.5", + "@rosen-bridge/scanner": "^4.1.1", "@rosen-bridge/tokens": "^1.2.1", "@rosen-clients/ergo-explorer": "^1.1.1", "@types/lodash-es": "^4.17.6", @@ -14713,9 +14713,9 @@ } }, "@rosen-clients/ergo-explorer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@rosen-clients/ergo-explorer/-/ergo-explorer-1.1.1.tgz", - "integrity": "sha512-xvDM15MhHV1HLg3e9/0fETDKs9ZFT1MT6pip1KWaLmPbCYetI88iPPcLPCaO0RwY+Iqf5qm+gHbKeroFdA+juw==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@rosen-clients/ergo-explorer/-/ergo-explorer-1.1.2.tgz", + "integrity": "sha512-GHTBgGZlPbiHfpJs0X/2v+9Ern5hlDaNIHNAgse2iDDvOu1jdpDpY+bpnHtWiLcUKJWUfV2RjBnBxpHMyHAUKQ==", "requires": { "@rosen-clients/axios": "^0.1.0" } diff --git a/package.json b/package.json index 9ad9f49..5e59a04 100644 --- a/package.json +++ b/package.json @@ -74,21 +74,21 @@ }, "dependencies": { "@emurgo/cip14-js": "^3.0.1", - "@rosen-bridge/address-extractor": "^5.0.5", + "@rosen-bridge/address-extractor": "^5.0.6", "@rosen-bridge/asset-check": "^0.2.1", - "@rosen-bridge/bitcoin-esplora-scanner": "^0.1.10", - "@rosen-bridge/bitcoin-observation-extractor": "^4.0.1", - "@rosen-bridge/bitcoin-rpc-scanner": "^0.2.4", + "@rosen-bridge/bitcoin-esplora-scanner": "^0.1.12", + "@rosen-bridge/bitcoin-observation-extractor": "^4.0.4", + "@rosen-bridge/bitcoin-rpc-scanner": "^0.2.6", "@rosen-bridge/health-check": "^5.0.0", "@rosen-bridge/log-level-check": "^0.1.1", "@rosen-bridge/minimum-fee": "^2.1.0", "@rosen-bridge/node-sync-check": "^0.1.1", - "@rosen-bridge/observation-extractor": "^5.0.2", + "@rosen-bridge/observation-extractor": "^5.0.4", "@rosen-bridge/permit-check": "^0.1.1", - "@rosen-bridge/scanner": "^4.0.5", + "@rosen-bridge/scanner": "^4.1.1", "@rosen-bridge/scanner-sync-check": "^0.3.0", "@rosen-bridge/tokens": "^1.2.1", - "@rosen-bridge/watcher-data-extractor": "^7.0.0", + "@rosen-bridge/watcher-data-extractor": "^7.0.2", "@rosen-bridge/wid-check": "^0.1.1", "@rosen-bridge/winston-logger": "0.2.1", "@rosen-clients/cardano-koios": "^2.0.3", diff --git a/src/config/config.ts b/src/config/config.ts index 0fe0e91..306af78 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -300,6 +300,7 @@ class CardanoConfig { port: number; initialSlot: number; initialHash: string; + connectionRetrialInterval: number; useTls?: boolean; }; koios?: { @@ -324,9 +325,19 @@ class CardanoConfig { const host = getRequiredString('cardano.ogmios.host'); const port = getRequiredNumber('cardano.ogmios.port'); const initialSlot = getRequiredNumber('cardano.initial.slot'); + const connectionRetrialInterval = getRequiredNumber( + 'cardano.ogmios.connectionRetrialInterval' + ); const initialHash = getRequiredString('cardano.initial.hash'); const useTls = config.get('cardano.ogmios.useTls'); - this.ogmios = { host, port, initialHash, initialSlot, useTls }; + this.ogmios = { + host, + port, + initialHash, + initialSlot, + connectionRetrialInterval, + useTls, + }; } else if (this.type === Constants.KOIOS_TYPE) { const url = getRequiredString('cardano.koios.url'); const interval = getRequiredNumber('cardano.koios.interval'); diff --git a/src/database/migrations/index.ts b/src/database/migrations/index.ts index 5861f7b..dc4dd6e 100644 --- a/src/database/migrations/index.ts +++ b/src/database/migrations/index.ts @@ -2,12 +2,16 @@ import { WatcherMigration1700710099334 } from './postgres/1700710099334-watcherM import { WatcherMigration1703244656364 } from './postgres/1703244656364-watcherMigration'; import { WatcherMigration1704105342269 } from './postgres/1704105342269-watcherMigration'; import { WatcherMigration1720424860524 } from './postgres/1720424860524-watcherMigration'; +import { WatcherMigration1722549850233 } from './postgres/1722549850233-watcherMigration'; +import { WatcherMigration1722867363628 } from './postgres/1722867363628-watcherMigration'; import { WatcherMigration1700641198429 } from './sqlite/1700641198429-watcherMigration'; import { WatcherMigration1703244614956 } from './sqlite/1703244614956-watcherMigration'; import { WatcherMigration1704105040303 } from './sqlite/1704105040303-watcherMigration'; import { WatcherMigration1706610773175 } from './sqlite/1706610773175-watcherMigration'; import { WatcherMigration1706610773177 } from './sqlite/1706610773177-watcherMigration'; import { WatcherMigration1720425345411 } from './sqlite/1720425345411-watcherMigration'; +import { WatcherMigration1722597111974 } from './sqlite/1722597111974-watcherMigration'; +import { WatcherMigration1722866480590 } from './sqlite/1722866480590-watcherMigration'; export default { sqlite: [ @@ -17,11 +21,15 @@ export default { WatcherMigration1706610773175, WatcherMigration1706610773177, WatcherMigration1720425345411, + WatcherMigration1722597111974, + WatcherMigration1722866480590, ], postgres: [ WatcherMigration1700710099334, WatcherMigration1703244656364, WatcherMigration1704105342269, WatcherMigration1720424860524, + WatcherMigration1722549850233, + WatcherMigration1722867363628, ], }; diff --git a/src/database/migrations/postgres/1722549850233-watcherMigration.ts b/src/database/migrations/postgres/1722549850233-watcherMigration.ts new file mode 100644 index 0000000..bed5b2c --- /dev/null +++ b/src/database/migrations/postgres/1722549850233-watcherMigration.ts @@ -0,0 +1,108 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class WatcherMigration1722549850233 implements MigrationInterface { + name = 'WatcherMigration1722549850233'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + ` + DELETE FROM "typeorm_metadata" + WHERE "type" = $1 + AND "name" = $2 + AND "schema" = $3 + `, + ['VIEW', 'revenue_view', 'public'] + ); + await queryRunner.query(` + DROP VIEW "revenue_view" + `); + await queryRunner.query( + ` + DELETE FROM "typeorm_metadata" + WHERE "type" = $1 + AND "name" = $2 + AND "schema" = $3 + `, + ['VIEW', 'revenue_chart_data', 'public'] + ); + await queryRunner.query(` + DROP VIEW "revenue_chart_data" + `); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + CREATE VIEW "revenue_chart_data" AS + SELECT "pe"."WID" AS "wid", + "be"."year" AS "year", + "be"."month" AS "month", + "be"."day" AS "day", + re."tokenId" AS "tokenId", + re."amount" AS "amount", + be."timestamp" AS "timestamp" + FROM "revenue_entity" "re" + INNER JOIN "permit_entity" "pe" ON re."permitId" = "pe"."id" + INNER JOIN "block_entity" "be" ON "pe"."block" = "be"."hash" + `); + await queryRunner.query( + ` + INSERT INTO "typeorm_metadata"( + "database", + "schema", + "table", + "type", + "name", + "value" + ) + VALUES (DEFAULT, $1, DEFAULT, $2, $3, $4) + `, + [ + 'public', + 'VIEW', + 'revenue_chart_data', + 'SELECT "pe"."WID" AS "wid", "be"."year" AS "year", "be"."month" AS "month", "be"."day" AS "day", re."tokenId" AS "tokenId", re."amount" AS "amount", be."timestamp" AS "timestamp" FROM "revenue_entity" "re" INNER JOIN "permit_entity" "pe" ON re."permitId" = "pe"."id" INNER JOIN "block_entity" "be" ON "pe"."block" = "be"."hash"', + ] + ); + await queryRunner.query(` + CREATE VIEW "revenue_view" AS + SELECT "pe"."id" AS "id", + "pe"."WID" AS "wid", + "ete"."sourceChainHeight" AS "lockHeight", + "be"."height" AS "height", + "be"."timestamp" AS "timestamp", + pe."txId" AS "permitTxId", + ete."eventId" AS "eventId", + ete."fromChain" AS "fromChain", + ete."toChain" AS "toChain", + ete."fromAddress" AS "fromAddress", + ete."toAddress" AS "toAddress", + ete."amount" AS "amount", + ete."bridgeFee" AS "bridgeFee", + ete."networkFee" AS "networkFee", + ete."sourceChainTokenId" AS "tokenId", + ete."sourceTxId" AS "lockTxId" + FROM "permit_entity" "pe" + INNER JOIN "event_trigger_entity" "ete" ON pe."txId" = ete."spendTxId" + LEFT JOIN "block_entity" "be" ON "pe"."block" = "be"."hash" + `); + await queryRunner.query( + ` + INSERT INTO "typeorm_metadata"( + "database", + "schema", + "table", + "type", + "name", + "value" + ) + VALUES (DEFAULT, $1, DEFAULT, $2, $3, $4) + `, + [ + 'public', + 'VIEW', + 'revenue_view', + 'SELECT "pe"."id" AS "id", "pe"."WID" AS "wid", "ete"."sourceChainHeight" AS "lockHeight", "be"."height" AS "height", "be"."timestamp" AS "timestamp", pe."txId" AS "permitTxId", ete."eventId" AS "eventId", ete."fromChain" AS "fromChain", ete."toChain" AS "toChain", ete."fromAddress" AS "fromAddress", ete."toAddress" AS "toAddress", ete."amount" AS "amount", ete."bridgeFee" AS "bridgeFee", ete."networkFee" AS "networkFee", ete."sourceChainTokenId" AS "tokenId", ete."sourceTxId" AS "lockTxId" FROM "permit_entity" "pe" INNER JOIN "event_trigger_entity" "ete" ON pe."txId" = ete."spendTxId" LEFT JOIN "block_entity" "be" ON "pe"."block" = "be"."hash"', + ] + ); + } +} diff --git a/src/database/migrations/postgres/1722867363628-watcherMigration.ts b/src/database/migrations/postgres/1722867363628-watcherMigration.ts new file mode 100644 index 0000000..eb4c2af --- /dev/null +++ b/src/database/migrations/postgres/1722867363628-watcherMigration.ts @@ -0,0 +1,108 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class WatcherMigration1722867363628 implements MigrationInterface { + name = 'WatcherMigration1722867363628'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + CREATE VIEW "revenue_chart_data" AS + SELECT "pe"."WID" AS "wid", + "be"."year" AS "year", + "be"."month" AS "month", + "be"."day" AS "day", + re."tokenId" AS "tokenId", + re."amount" AS "amount", + be."timestamp" AS "timestamp" + FROM "revenue_entity" "re" + INNER JOIN "permit_entity" "pe" ON re."permitId" = "pe"."id" + INNER JOIN "block_entity" "be" ON "pe"."block" = "be"."hash" + `); + await queryRunner.query( + ` + INSERT INTO "typeorm_metadata"( + "database", + "schema", + "table", + "type", + "name", + "value" + ) + VALUES (DEFAULT, $1, DEFAULT, $2, $3, $4) + `, + [ + 'public', + 'VIEW', + 'revenue_chart_data', + 'SELECT "pe"."WID" AS "wid", "be"."year" AS "year", "be"."month" AS "month", "be"."day" AS "day", re."tokenId" AS "tokenId", re."amount" AS "amount", be."timestamp" AS "timestamp" FROM "revenue_entity" "re" INNER JOIN "permit_entity" "pe" ON re."permitId" = "pe"."id" INNER JOIN "block_entity" "be" ON "pe"."block" = "be"."hash"', + ] + ); + await queryRunner.query(` + CREATE VIEW "revenue_view" AS + SELECT "pe"."id" AS "id", + "pe"."WID" AS "wid", + "ete"."sourceChainHeight" AS "lockHeight", + "be"."height" AS "height", + "be"."timestamp" AS "timestamp", + pe."txId" AS "permitTxId", + ete."eventId" AS "eventId", + ete."fromChain" AS "fromChain", + ete."toChain" AS "toChain", + ete."fromAddress" AS "fromAddress", + ete."toAddress" AS "toAddress", + ete."amount" AS "amount", + ete."bridgeFee" AS "bridgeFee", + ete."networkFee" AS "networkFee", + ete."sourceChainTokenId" AS "tokenId", + ete."sourceTxId" AS "lockTxId" + FROM "permit_entity" "pe" + INNER JOIN "event_trigger_entity" "ete" ON pe."txId" = ete."spendTxId" + LEFT JOIN "block_entity" "be" ON "pe"."block" = "be"."hash" + `); + await queryRunner.query( + ` + INSERT INTO "typeorm_metadata"( + "database", + "schema", + "table", + "type", + "name", + "value" + ) + VALUES (DEFAULT, $1, DEFAULT, $2, $3, $4) + `, + [ + 'public', + 'VIEW', + 'revenue_view', + 'SELECT "pe"."id" AS "id", "pe"."WID" AS "wid", "ete"."sourceChainHeight" AS "lockHeight", "be"."height" AS "height", "be"."timestamp" AS "timestamp", pe."txId" AS "permitTxId", ete."eventId" AS "eventId", ete."fromChain" AS "fromChain", ete."toChain" AS "toChain", ete."fromAddress" AS "fromAddress", ete."toAddress" AS "toAddress", ete."amount" AS "amount", ete."bridgeFee" AS "bridgeFee", ete."networkFee" AS "networkFee", ete."sourceChainTokenId" AS "tokenId", ete."sourceTxId" AS "lockTxId" FROM "permit_entity" "pe" INNER JOIN "event_trigger_entity" "ete" ON pe."txId" = ete."spendTxId" LEFT JOIN "block_entity" "be" ON "pe"."block" = "be"."hash"', + ] + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + ` + DELETE FROM "typeorm_metadata" + WHERE "type" = $1 + AND "name" = $2 + AND "schema" = $3 + `, + ['VIEW', 'revenue_view', 'public'] + ); + await queryRunner.query(` + DROP VIEW "revenue_view" + `); + await queryRunner.query( + ` + DELETE FROM "typeorm_metadata" + WHERE "type" = $1 + AND "name" = $2 + AND "schema" = $3 + `, + ['VIEW', 'revenue_chart_data', 'public'] + ); + await queryRunner.query(` + DROP VIEW "revenue_chart_data" + `); + } +} diff --git a/src/database/migrations/sqlite/1722597111974-watcherMigration.ts b/src/database/migrations/sqlite/1722597111974-watcherMigration.ts new file mode 100644 index 0000000..d5fb3a5 --- /dev/null +++ b/src/database/migrations/sqlite/1722597111974-watcherMigration.ts @@ -0,0 +1,103 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class WatcherMigration1722597111974 implements MigrationInterface { + name = 'WatcherMigration1722597111974'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + ` + DELETE FROM "typeorm_metadata" + WHERE "type" = ? + AND "name" = ? + `, + ['VIEW', 'revenue_chart_data'] + ); + await queryRunner.query(` + DROP VIEW "revenue_chart_data" + `); + await queryRunner.query( + ` + DELETE FROM "typeorm_metadata" + WHERE "type" = ? + AND "name" = ? + `, + ['VIEW', 'revenue_view'] + ); + await queryRunner.query(` + DROP VIEW "revenue_view" + `); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + CREATE VIEW "revenue_view" AS + SELECT "pe"."id" AS "id", + "pe"."WID" AS "wid", + "ete"."sourceChainHeight" AS "lockHeight", + "be"."height" AS "height", + "be"."timestamp" AS "timestamp", + pe."txId" AS "permitTxId", + ete."eventId" AS "eventId", + ete."fromChain" AS "fromChain", + ete."toChain" AS "toChain", + ete."fromAddress" AS "fromAddress", + ete."toAddress" AS "toAddress", + ete."amount" AS "amount", + ete."bridgeFee" AS "bridgeFee", + ete."networkFee" AS "networkFee", + ete."sourceChainTokenId" AS "tokenId", + ete."sourceTxId" AS "lockTxId" + FROM "permit_entity" "pe" + INNER JOIN "event_trigger_entity" "ete" ON pe."txId" = ete."spendTxId" + LEFT JOIN "block_entity" "be" ON "pe"."block" = "be"."hash" + `); + await queryRunner.query( + ` + INSERT INTO "typeorm_metadata"( + "database", + "schema", + "table", + "type", + "name", + "value" + ) + VALUES (NULL, NULL, NULL, ?, ?, ?) + `, + [ + 'VIEW', + 'revenue_view', + 'SELECT "pe"."id" AS "id", "pe"."WID" AS "wid", "ete"."sourceChainHeight" AS "lockHeight", "be"."height" AS "height", "be"."timestamp" AS "timestamp", pe."txId" AS "permitTxId", ete."eventId" AS "eventId", ete."fromChain" AS "fromChain", ete."toChain" AS "toChain", ete."fromAddress" AS "fromAddress", ete."toAddress" AS "toAddress", ete."amount" AS "amount", ete."bridgeFee" AS "bridgeFee", ete."networkFee" AS "networkFee", ete."sourceChainTokenId" AS "tokenId", ete."sourceTxId" AS "lockTxId" FROM "permit_entity" "pe" INNER JOIN "event_trigger_entity" "ete" ON pe."txId" = ete."spendTxId" LEFT JOIN "block_entity" "be" ON "pe"."block" = "be"."hash"', + ] + ); + await queryRunner.query(` + CREATE VIEW "revenue_chart_data" AS + SELECT "be"."year" AS "year", + "be"."month" AS "month", + "be"."day" AS "day", + re."tokenId" AS "tokenId", + re."amount" AS "amount", + be."timestamp" AS "timestamp" + FROM "revenue_entity" "re" + INNER JOIN "permit_entity" "pe" ON re."permitId" = "pe"."id" + INNER JOIN "block_entity" "be" ON "pe"."block" = "be"."hash" + `); + await queryRunner.query( + ` + INSERT INTO "typeorm_metadata"( + "database", + "schema", + "table", + "type", + "name", + "value" + ) + VALUES (NULL, NULL, NULL, ?, ?, ?) + `, + [ + 'VIEW', + 'revenue_chart_data', + 'SELECT "be"."year" AS "year", "be"."month" AS "month", "be"."day" AS "day", re."tokenId" AS "tokenId", re."amount" AS "amount", be."timestamp" AS "timestamp" FROM "revenue_entity" "re" INNER JOIN "permit_entity" "pe" ON re."permitId" = "pe"."id" INNER JOIN "block_entity" "be" ON "pe"."block" = "be"."hash"', + ] + ); + } +} diff --git a/src/database/migrations/sqlite/1722866480590-watcherMigration.ts b/src/database/migrations/sqlite/1722866480590-watcherMigration.ts new file mode 100644 index 0000000..f5a1500 --- /dev/null +++ b/src/database/migrations/sqlite/1722866480590-watcherMigration.ts @@ -0,0 +1,104 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class WatcherMigration1722866480590 implements MigrationInterface { + name = 'WatcherMigration1722866480590'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + CREATE VIEW "revenue_view" AS + SELECT "pe"."id" AS "id", + "pe"."WID" AS "wid", + "ete"."sourceChainHeight" AS "lockHeight", + "be"."height" AS "height", + "be"."timestamp" AS "timestamp", + pe."txId" AS "permitTxId", + ete."eventId" AS "eventId", + ete."fromChain" AS "fromChain", + ete."toChain" AS "toChain", + ete."fromAddress" AS "fromAddress", + ete."toAddress" AS "toAddress", + ete."amount" AS "amount", + ete."bridgeFee" AS "bridgeFee", + ete."networkFee" AS "networkFee", + ete."sourceChainTokenId" AS "tokenId", + ete."sourceTxId" AS "lockTxId" + FROM "permit_entity" "pe" + INNER JOIN "event_trigger_entity" "ete" ON pe."txId" = ete."spendTxId" + LEFT JOIN "block_entity" "be" ON "pe"."block" = "be"."hash" + `); + await queryRunner.query( + ` + INSERT INTO "typeorm_metadata"( + "database", + "schema", + "table", + "type", + "name", + "value" + ) + VALUES (NULL, NULL, NULL, ?, ?, ?) + `, + [ + 'VIEW', + 'revenue_view', + 'SELECT "pe"."id" AS "id", "pe"."WID" AS "wid", "ete"."sourceChainHeight" AS "lockHeight", "be"."height" AS "height", "be"."timestamp" AS "timestamp", pe."txId" AS "permitTxId", ete."eventId" AS "eventId", ete."fromChain" AS "fromChain", ete."toChain" AS "toChain", ete."fromAddress" AS "fromAddress", ete."toAddress" AS "toAddress", ete."amount" AS "amount", ete."bridgeFee" AS "bridgeFee", ete."networkFee" AS "networkFee", ete."sourceChainTokenId" AS "tokenId", ete."sourceTxId" AS "lockTxId" FROM "permit_entity" "pe" INNER JOIN "event_trigger_entity" "ete" ON pe."txId" = ete."spendTxId" LEFT JOIN "block_entity" "be" ON "pe"."block" = "be"."hash"', + ] + ); + await queryRunner.query(` + CREATE VIEW "revenue_chart_data" AS + SELECT "pe"."WID" AS "wid", + "be"."year" AS "year", + "be"."month" AS "month", + "be"."day" AS "day", + re."tokenId" AS "tokenId", + re."amount" AS "amount", + be."timestamp" AS "timestamp" + FROM "revenue_entity" "re" + INNER JOIN "permit_entity" "pe" ON re."permitId" = "pe"."id" + INNER JOIN "block_entity" "be" ON "pe"."block" = "be"."hash" + `); + await queryRunner.query( + ` + INSERT INTO "typeorm_metadata"( + "database", + "schema", + "table", + "type", + "name", + "value" + ) + VALUES (NULL, NULL, NULL, ?, ?, ?) + `, + [ + 'VIEW', + 'revenue_chart_data', + 'SELECT "pe"."WID" AS "wid", "be"."year" AS "year", "be"."month" AS "month", "be"."day" AS "day", re."tokenId" AS "tokenId", re."amount" AS "amount", be."timestamp" AS "timestamp" FROM "revenue_entity" "re" INNER JOIN "permit_entity" "pe" ON re."permitId" = "pe"."id" INNER JOIN "block_entity" "be" ON "pe"."block" = "be"."hash"', + ] + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + ` + DELETE FROM "typeorm_metadata" + WHERE "type" = ? + AND "name" = ? + `, + ['VIEW', 'revenue_chart_data'] + ); + await queryRunner.query(` + DROP VIEW "revenue_chart_data" + `); + await queryRunner.query( + ` + DELETE FROM "typeorm_metadata" + WHERE "type" = ? + AND "name" = ? + `, + ['VIEW', 'revenue_view'] + ); + await queryRunner.query(` + DROP VIEW "revenue_view" + `); + } +} diff --git a/src/utils/scanner.ts b/src/utils/scanner.ts index 497664f..e1efa8b 100644 --- a/src/utils/scanner.ts +++ b/src/utils/scanner.ts @@ -185,6 +185,8 @@ class CreateScanner { dataSource: dataSource, initialHash: cardanoConfig.ogmios.initialHash, initialSlot: cardanoConfig.ogmios.initialSlot, + connectionRetrialInterval: + cardanoConfig.ogmios.connectionRetrialInterval * 1000, }, loggers.scannerLogger );