From 7758c49f2d666da190180b36633dbd9344e32ac5 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Fri, 23 Jul 2021 01:18:34 -0300 Subject: [PATCH 01/50] Update submodules --- 4bytes | 2 +- trustwallet | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4bytes b/4bytes index 3fde3a1..8113821 160000 --- a/4bytes +++ b/4bytes @@ -1 +1 @@ -Subproject commit 3fde3a1b2e002736e9a5e0c35df5bbe386a18d55 +Subproject commit 81138213c12364db38d5acbb40c0cf46f2ecdbfe diff --git a/trustwallet b/trustwallet index 011ccb8..5b803d3 160000 --- a/trustwallet +++ b/trustwallet @@ -1 +1 @@ -Subproject commit 011ccb88adc70c27b0d4fc0a10564199efd0a81f +Subproject commit 5b803d37011ff89b287630a9ce90f96f8ed3311f From 8d04e5e6ab3cda309b65034c312dcd7e2bc406db Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Fri, 23 Jul 2021 01:23:32 -0300 Subject: [PATCH 02/50] Fix right margin --- src/transaction/Logs.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transaction/Logs.tsx b/src/transaction/Logs.tsx index f965ecc..b81fd9d 100644 --- a/src/transaction/Logs.tsx +++ b/src/transaction/Logs.tsx @@ -21,7 +21,7 @@ const Logs: React.FC = ({ txData }) => (
Address
-
+
Date: Fri, 23 Jul 2021 01:28:44 -0300 Subject: [PATCH 03/50] Fix singular "Confirmation" --- src/components/BlockConfirmations.tsx | 16 ++++++++++++++++ src/transaction/Details.tsx | 5 ++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 src/components/BlockConfirmations.tsx diff --git a/src/components/BlockConfirmations.tsx b/src/components/BlockConfirmations.tsx new file mode 100644 index 0000000..4846d09 --- /dev/null +++ b/src/components/BlockConfirmations.tsx @@ -0,0 +1,16 @@ +import React from "react"; + +type BlockConfirmationsProps = { + confirmations: number; +}; + +const BlockConfirmations: React.FC = ({ + confirmations, +}) => ( + + {confirmations} Block{" "} + {confirmations === 1 ? "Confirmation" : "Confirmations"} + +); + +export default React.memo(BlockConfirmations); diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 4204908..30bcbbd 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -8,6 +8,7 @@ import { import ContentFrame from "../ContentFrame"; import InfoRow from "../components/InfoRow"; import BlockLink from "../components/BlockLink"; +import BlockConfirmations from "../components/BlockConfirmations"; import AddressHighlighter from "../components/AddressHighlighter"; import DecoratedAddressLink from "../components/DecoratedAddressLink"; import Copy from "../components/Copy"; @@ -53,9 +54,7 @@ const Details: React.FC = ({
- - {txData.confirmations} Block Confirmations - +
From 50d63efbce581a71003b80c342f3c2eb47c73f93 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Fri, 23 Jul 2021 01:35:18 -0300 Subject: [PATCH 04/50] Update tailwindcss version to 2.2.6 --- package-lock.json | 174 ++++++++++++++++++++++++---------------------- package.json | 2 +- 2 files changed, 90 insertions(+), 86 deletions(-) diff --git a/package-lock.json b/package-lock.json index 71853e7..030da6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,7 @@ "devDependencies": { "autoprefixer": "^9.8.6", "postcss": "^7.0.36", - "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.4" + "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.6" } }, "node_modules/@babel/code-frame": { @@ -2077,15 +2077,6 @@ "react": ">=16.x" } }, - "node_modules/@fullhuman/postcss-purgecss": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@fullhuman/postcss-purgecss/-/postcss-purgecss-3.1.3.tgz", - "integrity": "sha512-kwOXw8fZ0Lt1QmeOOrd+o4Ibvp4UTEBFQbzvWldjlKv5n+G9sXfIPn1hh63IQIL8K8vbvv1oYMJiIUbuy9bGaA==", - "dev": true, - "dependencies": { - "purgecss": "^3.1.3" - } - }, "node_modules/@hapi/address": { "version": "2.1.4", "license": "BSD-3-Clause" @@ -5751,11 +5742,12 @@ } }, "node_modules/color": { - "version": "3.1.3", - "license": "MIT", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", + "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", "dependencies": { - "color-convert": "^1.9.1", - "color-string": "^1.5.4" + "color-convert": "^1.9.3", + "color-string": "^1.6.0" } }, "node_modules/color-convert": { @@ -5774,8 +5766,9 @@ "license": "MIT" }, "node_modules/color-string": { - "version": "1.5.4", - "license": "MIT", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.6.0.tgz", + "integrity": "sha512-c/hGS+kRWJutUBEngKKmk4iH3sD59MBkoxVapS/0wgpCz2u7XsNloxknyvBhzwEs1IbV36D9PwqLPJ2DTu3vMA==", "dependencies": { "color-name": "^1.0.0", "simple-swizzle": "^0.2.2" @@ -6808,9 +6801,9 @@ } }, "node_modules/didyoumean": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", - "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", "dev": true }, "node_modules/diff-sequences": { @@ -8270,15 +8263,15 @@ "license": "MIT" }, "node_modules/fast-glob": { - "version": "3.2.5", - "license": "MIT", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", + "glob-parent": "^5.1.2", "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" + "micromatch": "^4.0.4" }, "engines": { "node": ">=8" @@ -8864,8 +8857,9 @@ } }, "node_modules/glob-parent": { - "version": "5.1.1", - "license": "ISC", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dependencies": { "is-glob": "^4.0.1" }, @@ -11228,14 +11222,15 @@ "license": "MIT" }, "node_modules/micromatch": { - "version": "4.0.2", - "license": "MIT", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", "dependencies": { "braces": "^3.0.1", - "picomatch": "^2.0.5" + "picomatch": "^2.2.3" }, "engines": { - "node": ">=8" + "node": ">=8.6" } }, "node_modules/micromatch/node_modules/braces": { @@ -12367,8 +12362,9 @@ "license": "MIT" }, "node_modules/picomatch": { - "version": "2.2.2", - "license": "MIT", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", "engines": { "node": ">=8.6" }, @@ -13822,9 +13818,9 @@ } }, "node_modules/purgecss": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-3.1.3.tgz", - "integrity": "sha512-hRSLN9mguJ2lzlIQtW4qmPS2kh6oMnA9RxdIYK8sz18QYqd6ePp4GNDl18oWHA1f2v2NEQIh51CO8s/E3YGckQ==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-4.0.3.tgz", + "integrity": "sha512-PYOIn5ibRIP34PBU9zohUcCI09c7drPJJtTDAc0Q6QlRz2/CHQ8ywGLdE7ZhxU2VTqB7p5wkvj5Qcm05Rz3Jmw==", "dev": true, "dependencies": { "commander": "^6.0.0", @@ -13846,9 +13842,9 @@ } }, "node_modules/purgecss/node_modules/postcss": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.1.tgz", - "integrity": "sha512-9qH0MGjsSm+fjxOi3GnwViL1otfi7qkj+l/WX5gcRGmZNGsIcqc+A5fBkE6PUobEQK4APqYVaES+B3Uti98TCw==", + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.6.tgz", + "integrity": "sha512-wG1cc/JhRgdqB6WHEuyLTedf3KIRuD0hG6ldkFEZNCjRxiC+3i6kkWUUbiJQayP28iwG35cEmAbe98585BYV0A==", "dev": true, "dependencies": { "colorette": "^1.2.2", @@ -15929,14 +15925,16 @@ }, "node_modules/simple-swizzle": { "version": "0.2.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", "dependencies": { "is-arrayish": "^0.3.1" } }, "node_modules/simple-swizzle/node_modules/is-arrayish": { "version": "0.3.2", - "license": "MIT" + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" }, "node_modules/sisteransi": { "version": "1.0.5", @@ -16715,23 +16713,22 @@ }, "node_modules/tailwindcss": { "name": "@tailwindcss/postcss7-compat", - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/postcss7-compat/-/postcss7-compat-2.2.4.tgz", - "integrity": "sha512-lFIBdD1D2w3RgHFg7kNB7U5LOlfbd+KXTzcLyC/RlQ9eVko6GjNCKpN/kdmfF9wiGxbSDT/3mousXeMZdOOuBg==", + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/@tailwindcss/postcss7-compat/-/postcss7-compat-2.2.6.tgz", + "integrity": "sha512-xrJqqVimKtNpyaaMapky3iFRCvEaA3PbdGG4HqHvyEdTLnfqKrRAv0znhqGeQlzFIL4P3w546cjWLYNtbvazFw==", "dev": true, "dependencies": { - "@fullhuman/postcss-purgecss": "^3.1.3", "arg": "^5.0.0", "autoprefixer": "^9", "bytes": "^3.0.0", "chalk": "^4.1.1", "chokidar": "^3.5.2", - "color": "^3.1.3", + "color": "^3.2.0", "cosmiconfig": "^7.0.0", "detective": "^5.2.0", - "didyoumean": "^1.2.1", + "didyoumean": "^1.2.2", "dlv": "^1.1.3", - "fast-glob": "^3.2.5", + "fast-glob": "^3.2.7", "fs-extra": "^10.0.0", "glob-parent": "^6.0.0", "html-tags": "^3.1.0", @@ -16750,6 +16747,7 @@ "postcss-selector-parser": "^6.0.6", "postcss-value-parser": "^4.1.0", "pretty-hrtime": "^1.0.3", + "purgecss": "^4.0.3", "quick-lru": "^5.1.1", "reduce-css-calc": "^2.1.8", "resolve": "^1.20.0", @@ -20422,15 +20420,6 @@ "prop-types": "^15.7.2" } }, - "@fullhuman/postcss-purgecss": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@fullhuman/postcss-purgecss/-/postcss-purgecss-3.1.3.tgz", - "integrity": "sha512-kwOXw8fZ0Lt1QmeOOrd+o4Ibvp4UTEBFQbzvWldjlKv5n+G9sXfIPn1hh63IQIL8K8vbvv1oYMJiIUbuy9bGaA==", - "dev": true, - "requires": { - "purgecss": "^3.1.3" - } - }, "@hapi/address": { "version": "2.1.4" }, @@ -22947,10 +22936,12 @@ } }, "color": { - "version": "3.1.3", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", + "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", "requires": { - "color-convert": "^1.9.1", - "color-string": "^1.5.4" + "color-convert": "^1.9.3", + "color-string": "^1.6.0" } }, "color-convert": { @@ -22968,7 +22959,9 @@ "version": "1.1.4" }, "color-string": { - "version": "1.5.4", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.6.0.tgz", + "integrity": "sha512-c/hGS+kRWJutUBEngKKmk4iH3sD59MBkoxVapS/0wgpCz2u7XsNloxknyvBhzwEs1IbV36D9PwqLPJ2DTu3vMA==", "requires": { "color-name": "^1.0.0", "simple-swizzle": "^0.2.2" @@ -23658,9 +23651,9 @@ } }, "didyoumean": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", - "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", "dev": true }, "diff-sequences": { @@ -24626,14 +24619,15 @@ "version": "3.1.3" }, "fast-glob": { - "version": "3.2.5", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", "requires": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", + "glob-parent": "^5.1.2", "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" + "micromatch": "^4.0.4" } }, "fast-json-stable-stringify": { @@ -25012,7 +25006,9 @@ } }, "glob-parent": { - "version": "5.1.1", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "requires": { "is-glob": "^4.0.1" } @@ -26545,10 +26541,12 @@ "version": "0.1.1" }, "micromatch": { - "version": "4.0.2", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", "requires": { "braces": "^3.0.1", - "picomatch": "^2.0.5" + "picomatch": "^2.2.3" }, "dependencies": { "braces": { @@ -27275,7 +27273,9 @@ "version": "2.1.0" }, "picomatch": { - "version": "2.2.2" + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==" }, "pify": { "version": "4.0.1" @@ -28290,9 +28290,9 @@ "version": "2.1.1" }, "purgecss": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-3.1.3.tgz", - "integrity": "sha512-hRSLN9mguJ2lzlIQtW4qmPS2kh6oMnA9RxdIYK8sz18QYqd6ePp4GNDl18oWHA1f2v2NEQIh51CO8s/E3YGckQ==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-4.0.3.tgz", + "integrity": "sha512-PYOIn5ibRIP34PBU9zohUcCI09c7drPJJtTDAc0Q6QlRz2/CHQ8ywGLdE7ZhxU2VTqB7p5wkvj5Qcm05Rz3Jmw==", "dev": true, "requires": { "commander": "^6.0.0", @@ -28308,9 +28308,9 @@ "dev": true }, "postcss": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.1.tgz", - "integrity": "sha512-9qH0MGjsSm+fjxOi3GnwViL1otfi7qkj+l/WX5gcRGmZNGsIcqc+A5fBkE6PUobEQK4APqYVaES+B3Uti98TCw==", + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.6.tgz", + "integrity": "sha512-wG1cc/JhRgdqB6WHEuyLTedf3KIRuD0hG6ldkFEZNCjRxiC+3i6kkWUUbiJQayP28iwG35cEmAbe98585BYV0A==", "dev": true, "requires": { "colorette": "^1.2.2", @@ -29729,12 +29729,16 @@ }, "simple-swizzle": { "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", "requires": { "is-arrayish": "^0.3.1" }, "dependencies": { "is-arrayish": { - "version": "0.3.2" + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" } } }, @@ -30274,23 +30278,22 @@ } }, "tailwindcss": { - "version": "npm:@tailwindcss/postcss7-compat@2.2.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/postcss7-compat/-/postcss7-compat-2.2.4.tgz", - "integrity": "sha512-lFIBdD1D2w3RgHFg7kNB7U5LOlfbd+KXTzcLyC/RlQ9eVko6GjNCKpN/kdmfF9wiGxbSDT/3mousXeMZdOOuBg==", + "version": "npm:@tailwindcss/postcss7-compat@2.2.6", + "resolved": "https://registry.npmjs.org/@tailwindcss/postcss7-compat/-/postcss7-compat-2.2.6.tgz", + "integrity": "sha512-xrJqqVimKtNpyaaMapky3iFRCvEaA3PbdGG4HqHvyEdTLnfqKrRAv0znhqGeQlzFIL4P3w546cjWLYNtbvazFw==", "dev": true, "requires": { - "@fullhuman/postcss-purgecss": "^3.1.3", "arg": "^5.0.0", "autoprefixer": "^9", "bytes": "^3.0.0", "chalk": "^4.1.1", "chokidar": "^3.5.2", - "color": "^3.1.3", + "color": "^3.2.0", "cosmiconfig": "^7.0.0", "detective": "^5.2.0", - "didyoumean": "^1.2.1", + "didyoumean": "^1.2.2", "dlv": "^1.1.3", - "fast-glob": "^3.2.5", + "fast-glob": "^3.2.7", "fs-extra": "^10.0.0", "glob-parent": "^6.0.0", "html-tags": "^3.1.0", @@ -30309,6 +30312,7 @@ "postcss-selector-parser": "^6.0.6", "postcss-value-parser": "^4.1.0", "pretty-hrtime": "^1.0.3", + "purgecss": "^4.0.3", "quick-lru": "^5.1.1", "reduce-css-calc": "^2.1.8", "resolve": "^1.20.0", diff --git a/package.json b/package.json index f9454c1..45622fc 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,6 @@ "devDependencies": { "autoprefixer": "^9.8.6", "postcss": "^7.0.36", - "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.4" + "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.6" } } From e6083e5cd58434a71e20da0b41cbaaf4b666acd0 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Fri, 23 Jul 2021 19:20:49 -0300 Subject: [PATCH 05/50] Move nav bar up --- src/Block.tsx | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/Block.tsx b/src/Block.tsx index c1578a8..b776b4c 100644 --- a/src/Block.tsx +++ b/src/Block.tsx @@ -107,18 +107,13 @@ const Block: React.FC = () => { return ( - Block{" "} - - #{params.blockNumberOrHash} - - - {block && ( - - -
- - {ethers.utils.commify(block.number)} - +
+ Block + + #{params.blockNumberOrHash} + + {block && ( +
{
+ )} +
+ + {block && ( + + + + {ethers.utils.commify(block.number)} + From 6c763b481751b5cbc3d1b4c1b81ad030bdf15071 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Fri, 23 Jul 2021 19:46:21 -0300 Subject: [PATCH 06/50] Extract and apply block navigation to block txs page --- src/Block.tsx | 41 ++++---------------- src/BlockTransactionHeader.tsx | 35 ++++++++++++----- src/Home.tsx | 3 +- src/block/NavBlock.tsx | 51 +++++++++++++++++++++++++ src/{components => block}/NavButton.tsx | 6 ++- src/components/BlockLink.tsx | 3 +- src/url.ts | 8 ++++ 7 files changed, 101 insertions(+), 46 deletions(-) create mode 100644 src/block/NavBlock.tsx rename src/{components => block}/NavButton.tsx (76%) diff --git a/src/Block.tsx b/src/Block.tsx index b776b4c..87da28d 100644 --- a/src/Block.tsx +++ b/src/Block.tsx @@ -1,15 +1,10 @@ import React, { useEffect, useState, useMemo, useContext } from "react"; import { useParams, NavLink } from "react-router-dom"; import { ethers, BigNumber } from "ethers"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { - faChevronLeft, - faChevronRight, -} from "@fortawesome/free-solid-svg-icons"; import StandardFrame from "./StandardFrame"; import StandardSubtitle from "./StandardSubtitle"; +import NavBlock from "./block/NavBlock"; import ContentFrame from "./ContentFrame"; -import NavButton from "./components/NavButton"; import Timestamp from "./components/Timestamp"; import GasValue from "./components/GasValue"; import BlockLink from "./components/BlockLink"; @@ -18,6 +13,7 @@ import TransactionValue from "./components/TransactionValue"; import HexValue from "./components/HexValue"; import { RuntimeContext } from "./useRuntime"; import { useLatestBlockNumber } from "./useLatestBlock"; +import { blockTxsURL } from "./url"; type BlockParams = { blockNumberOrHash: string; @@ -113,33 +109,10 @@ const Block: React.FC = () => { #{params.blockNumberOrHash} {block && ( -
- - - - = latestBlockNumber - } - > - - - = latestBlockNumber - } - > - - - -
+ )}
@@ -156,7 +129,7 @@ const Block: React.FC = () => { {block.transactions.length} transactions {" "} diff --git a/src/BlockTransactionHeader.tsx b/src/BlockTransactionHeader.tsx index 65a8288..e3f22fc 100644 --- a/src/BlockTransactionHeader.tsx +++ b/src/BlockTransactionHeader.tsx @@ -1,7 +1,11 @@ -import React from "react"; +import React, { useContext } from "react"; import { ethers } from "ethers"; import StandardSubtitle from "./StandardSubtitle"; import BlockLink from "./components/BlockLink"; +import NavBlock from "./block/NavBlock"; +import { RuntimeContext } from "./useRuntime"; +import { useLatestBlockNumber } from "./useLatestBlock"; +import { blockTxsURL } from "./url"; type BlockTransactionHeaderProps = { blockTag: ethers.providers.BlockTag; @@ -9,13 +13,26 @@ type BlockTransactionHeaderProps = { const BlockTransactionHeader: React.FC = ({ blockTag, -}) => ( - <> - Transactions -
- For Block -
- -); +}) => { + const { provider } = useContext(RuntimeContext); + const latestBlockNumber = useLatestBlockNumber(provider); + + return ( + +
+ Transactions +
+ For Block + + +
+
+
+ ); +}; export default React.memo(BlockTransactionHeader); diff --git a/src/Home.tsx b/src/Home.tsx index 7d74fcd..d4f3afa 100644 --- a/src/Home.tsx +++ b/src/Home.tsx @@ -5,6 +5,7 @@ import Logo from "./Logo"; import Timestamp from "./components/Timestamp"; import { RuntimeContext } from "./useRuntime"; import { useLatestBlock } from "./useLatestBlock"; +import { blockURL } from "./url"; const Home: React.FC = () => { const { provider } = useContext(RuntimeContext); @@ -56,7 +57,7 @@ const Home: React.FC = () => { {latestBlock && (
Latest block: {ethers.utils.commify(latestBlock.number)}
diff --git a/src/block/NavBlock.tsx b/src/block/NavBlock.tsx new file mode 100644 index 0000000..32a1dee --- /dev/null +++ b/src/block/NavBlock.tsx @@ -0,0 +1,51 @@ +import React from "react"; +import { ethers } from "ethers"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { + faChevronLeft, + faChevronRight, +} from "@fortawesome/free-solid-svg-icons"; +import NavButton from "./NavButton"; + +type NavBlockProps = { + blockNumber: number; + latestBlockNumber: number | undefined; + urlBuilder?: (blockNumber: ethers.providers.BlockTag) => string; +}; + +const NavBlock: React.FC = ({ + blockNumber, + latestBlockNumber, + urlBuilder, +}) => ( +
+ + + + = latestBlockNumber + } + urlBuilder={urlBuilder} + > + + + = latestBlockNumber + } + urlBuilder={urlBuilder} + > + + + +
+); + +export default React.memo(NavBlock); diff --git a/src/components/NavButton.tsx b/src/block/NavButton.tsx similarity index 76% rename from src/components/NavButton.tsx rename to src/block/NavButton.tsx index a9c1a9d..edc85c4 100644 --- a/src/components/NavButton.tsx +++ b/src/block/NavButton.tsx @@ -1,13 +1,17 @@ +import { ethers } from "ethers"; import { NavLink } from "react-router-dom"; +import { blockURL } from "../url"; type NavButtonProps = { blockNum: number; disabled?: boolean; + urlBuilder?: (blockNumber: ethers.providers.BlockTag) => string; }; const NavButton: React.FC = ({ blockNum, disabled, + urlBuilder, children, }) => { if (disabled) { @@ -21,7 +25,7 @@ const NavButton: React.FC = ({ return ( {children} diff --git a/src/components/BlockLink.tsx b/src/components/BlockLink.tsx index f9a8866..155553f 100644 --- a/src/components/BlockLink.tsx +++ b/src/components/BlockLink.tsx @@ -1,6 +1,7 @@ import React from "react"; import { NavLink } from "react-router-dom"; import { ethers } from "ethers"; +import { blockURL } from "../url"; type BlockLinkProps = { blockTag: ethers.providers.BlockTag; @@ -18,7 +19,7 @@ const BlockLink: React.FC = ({ blockTag }) => { className={`text-link-blue hover:text-link-blue-hover ${ isNum ? "font-blocknum" : "font-hash" }`} - to={`/block/${blockTag}`} + to={blockURL(blockTag)} > {text}
diff --git a/src/url.ts b/src/url.ts index 0586dbe..3807d69 100644 --- a/src/url.ts +++ b/src/url.ts @@ -1,3 +1,5 @@ +import { ethers } from "ethers"; + export const fourBytesURL = ( assetsURLPrefix: string, fourBytes: string @@ -7,3 +9,9 @@ export const tokenLogoURL = ( assetsURLPrefix: string, address: string ): string => `${assetsURLPrefix}/assets/${address}/logo.png`; + +export const blockURL = (blockNum: ethers.providers.BlockTag) => + `/block/${blockNum}`; + +export const blockTxsURL = (blockNum: ethers.providers.BlockTag) => + `/block/${blockNum}/txs`; From 30597fc4ba387c70347155a060c948d178633f67 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Fri, 23 Jul 2021 19:48:34 -0300 Subject: [PATCH 07/50] Move refactoring --- src/BlockTransactions.tsx | 4 ++-- src/{ => block}/BlockTransactionHeader.tsx | 12 +++++------ src/{ => block}/BlockTransactionResults.tsx | 22 ++++++++++----------- 3 files changed, 19 insertions(+), 19 deletions(-) rename src/{ => block}/BlockTransactionHeader.tsx (76%) rename src/{ => block}/BlockTransactionResults.tsx (76%) diff --git a/src/BlockTransactions.tsx b/src/BlockTransactions.tsx index b427415..30d39c0 100644 --- a/src/BlockTransactions.tsx +++ b/src/BlockTransactions.tsx @@ -3,8 +3,8 @@ import { useParams, useLocation } from "react-router"; import { ethers } from "ethers"; import queryString from "query-string"; import StandardFrame from "./StandardFrame"; -import BlockTransactionHeader from "./BlockTransactionHeader"; -import BlockTransactionResults from "./BlockTransactionResults"; +import BlockTransactionHeader from "./block/BlockTransactionHeader"; +import BlockTransactionResults from "./block/BlockTransactionResults"; import { InternalOperation, OperationType, diff --git a/src/BlockTransactionHeader.tsx b/src/block/BlockTransactionHeader.tsx similarity index 76% rename from src/BlockTransactionHeader.tsx rename to src/block/BlockTransactionHeader.tsx index e3f22fc..a15c463 100644 --- a/src/BlockTransactionHeader.tsx +++ b/src/block/BlockTransactionHeader.tsx @@ -1,11 +1,11 @@ import React, { useContext } from "react"; import { ethers } from "ethers"; -import StandardSubtitle from "./StandardSubtitle"; -import BlockLink from "./components/BlockLink"; -import NavBlock from "./block/NavBlock"; -import { RuntimeContext } from "./useRuntime"; -import { useLatestBlockNumber } from "./useLatestBlock"; -import { blockTxsURL } from "./url"; +import StandardSubtitle from "../StandardSubtitle"; +import BlockLink from "../components/BlockLink"; +import NavBlock from "./NavBlock"; +import { RuntimeContext } from "../useRuntime"; +import { useLatestBlockNumber } from "../useLatestBlock"; +import { blockTxsURL } from "../url"; type BlockTransactionHeaderProps = { blockTag: ethers.providers.BlockTag; diff --git a/src/BlockTransactionResults.tsx b/src/block/BlockTransactionResults.tsx similarity index 76% rename from src/BlockTransactionResults.tsx rename to src/block/BlockTransactionResults.tsx index 74e2783..5937199 100644 --- a/src/BlockTransactionResults.tsx +++ b/src/block/BlockTransactionResults.tsx @@ -1,15 +1,15 @@ import React, { useContext } from "react"; -import ContentFrame from "./ContentFrame"; -import PageControl from "./search/PageControl"; -import ResultHeader from "./search/ResultHeader"; -import PendingResults from "./search/PendingResults"; -import TransactionItem from "./search/TransactionItem"; -import { useFeeToggler } from "./search/useFeeToggler"; -import { RuntimeContext } from "./useRuntime"; -import { SelectionContext, useSelection } from "./useSelection"; -import { useENSCache } from "./useReverseCache"; -import { ProcessedTransaction } from "./types"; -import { PAGE_SIZE } from "./params"; +import ContentFrame from "../ContentFrame"; +import PageControl from "../search/PageControl"; +import ResultHeader from "../search/ResultHeader"; +import PendingResults from "../search/PendingResults"; +import TransactionItem from "../search/TransactionItem"; +import { useFeeToggler } from "../search/useFeeToggler"; +import { RuntimeContext } from "../useRuntime"; +import { SelectionContext, useSelection } from "../useSelection"; +import { useENSCache } from "../useReverseCache"; +import { ProcessedTransaction } from "../types"; +import { PAGE_SIZE } from "../params"; type BlockTransactionResultsProps = { page?: ProcessedTransaction[]; From 76182a4efebb88d6aa309586b030407a6af0fc41 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Sat, 24 Jul 2021 00:21:15 -0300 Subject: [PATCH 08/50] Remove safeguards and fix small bugs to allow running otterscan against testnets; testing on goerli --- src/Block.tsx | 8 ++++++-- src/Title.tsx | 6 ++++-- src/useProvider.ts | 5 +---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Block.tsx b/src/Block.tsx index 87da28d..3064c99 100644 --- a/src/Block.tsx +++ b/src/Block.tsx @@ -67,8 +67,12 @@ const Block: React.FC = () => { const _block = provider.formatter.block(_rawBlock); const extBlock: ExtendedBlock = { - blockReward: provider.formatter.bigNumber(_rawIssuance.blockReward), - unclesReward: provider.formatter.bigNumber(_rawIssuance.uncleReward), + blockReward: provider.formatter.bigNumber( + _rawIssuance.blockReward ?? 0 + ), + unclesReward: provider.formatter.bigNumber( + _rawIssuance.uncleReward ?? 0 + ), feeReward: fees, size: provider.formatter.number(_rawBlock.size), sha3Uncles: _rawBlock.sha3Uncles, diff --git a/src/Title.tsx b/src/Title.tsx index c64fdbd..46e1e5c 100644 --- a/src/Title.tsx +++ b/src/Title.tsx @@ -1,9 +1,11 @@ -import React, { useState, useRef } from "react"; +import React, { useState, useRef, useContext } from "react"; import { Link, useHistory } from "react-router-dom"; import useKeyboardShortcut from "use-keyboard-shortcut"; import PriceBox from "./PriceBox"; +import { RuntimeContext } from "./useRuntime"; const Title: React.FC = () => { + const { provider } = useContext(RuntimeContext); const [search, setSearch] = useState(); const [canSubmit, setCanSubmit] = useState(false); const history = useHistory(); @@ -43,7 +45,7 @@ const Title: React.FC = () => {
- + {provider?.network.chainId === 1 && }
{ - const provider = new ethers.providers.JsonRpcProvider( - erigonURL, - "mainnet" - ); + const provider = new ethers.providers.JsonRpcProvider(erigonURL); // Check if it is at least a regular ETH node let blockNumber: number = 0; From 26f66cb4fb6bdf8318b3fef3221aa75b267bfd0f Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Sat, 24 Jul 2021 05:33:13 -0300 Subject: [PATCH 09/50] Add different highlight color on testnets --- src/Footer.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Footer.tsx b/src/Footer.tsx index 61d59d7..a934b37 100644 --- a/src/Footer.tsx +++ b/src/Footer.tsx @@ -5,7 +5,13 @@ const Footer: React.FC = () => { const { provider } = useContext(RuntimeContext); return ( -
+
{provider ? ( <>Using Erigon node at {provider.connection.url} ) : ( From fddfbfc29b9c54cab27fec6a5200a86c0dad7b81 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Sat, 24 Jul 2021 05:46:48 -0300 Subject: [PATCH 10/50] Display warning header when not on mainnet --- src/App.tsx | 2 ++ src/WarningHeader.tsx | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/WarningHeader.tsx diff --git a/src/App.tsx b/src/App.tsx index 4a4c323..72326ee 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,6 @@ import React, { Suspense } from "react"; import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; +import WarningHeader from "./WarningHeader"; import Home from "./Home"; import Search from "./Search"; import Title from "./Title"; @@ -26,6 +27,7 @@ const App = () => { ) : (
+ diff --git a/src/WarningHeader.tsx b/src/WarningHeader.tsx new file mode 100644 index 0000000..b21c249 --- /dev/null +++ b/src/WarningHeader.tsx @@ -0,0 +1,28 @@ +import React, { useContext } from "react"; +import { RuntimeContext } from "./useRuntime"; + +const WarningHeader: React.FC = () => { + const { provider } = useContext(RuntimeContext); + const chainId = provider?.network.chainId; + if (chainId === 1) { + return <>; + } + + let chainMsg = `ChainID: ${chainId}`; + if (chainId === 3) { + chainMsg = "Ropsten Testnet"; + } else if (chainId === 4) { + chainMsg = "Rinkeby Testnet"; + } else if (chainId === 5) { + chainMsg = "Görli Testnet"; + } else if (chainId === 42) { + chainMsg = "Kovan Testnet"; + } + return ( +
+ You are on {chainMsg} +
+ ); +}; + +export default React.memo(WarningHeader); From 2ae3429d51e9585dd327cb545ffef5c05bdd852f Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Mon, 26 Jul 2021 19:59:07 -0300 Subject: [PATCH 11/50] Extract custom hook --- src/Block.tsx | 70 +++-------------------------------------- src/useErigonHooks.ts | 73 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 67 deletions(-) diff --git a/src/Block.tsx b/src/Block.tsx index 3064c99..00ca0dc 100644 --- a/src/Block.tsx +++ b/src/Block.tsx @@ -1,6 +1,6 @@ -import React, { useEffect, useState, useMemo, useContext } from "react"; +import React, { useEffect, useMemo, useContext } from "react"; import { useParams, NavLink } from "react-router-dom"; -import { ethers, BigNumber } from "ethers"; +import { ethers } from "ethers"; import StandardFrame from "./StandardFrame"; import StandardSubtitle from "./StandardSubtitle"; import NavBlock from "./block/NavBlock"; @@ -14,79 +14,17 @@ import HexValue from "./components/HexValue"; import { RuntimeContext } from "./useRuntime"; import { useLatestBlockNumber } from "./useLatestBlock"; import { blockTxsURL } from "./url"; +import { useBlockData } from "./useErigonHooks"; type BlockParams = { blockNumberOrHash: string; }; -interface ExtendedBlock extends ethers.providers.Block { - blockReward: BigNumber; - unclesReward: BigNumber; - feeReward: BigNumber; - size: number; - sha3Uncles: string; - stateRoot: string; - totalDifficulty: BigNumber; -} - const Block: React.FC = () => { const { provider } = useContext(RuntimeContext); const params = useParams(); - const [block, setBlock] = useState(); - useEffect(() => { - if (!provider) { - return; - } - - const readBlock = async () => { - let blockPromise: Promise; - if (ethers.utils.isHexString(params.blockNumberOrHash, 32)) { - blockPromise = provider.send("eth_getBlockByHash", [ - params.blockNumberOrHash, - false, - ]); - } else { - blockPromise = provider.send("eth_getBlockByNumber", [ - params.blockNumberOrHash, - false, - ]); - } - const [_rawBlock, _rawIssuance, _rawReceipts] = await Promise.all([ - blockPromise, - provider.send("erigon_issuance", [params.blockNumberOrHash]), - provider.send("eth_getBlockReceipts", [params.blockNumberOrHash]), - ]); - const receipts = (_rawReceipts as any[]).map((r) => - provider.formatter.receipt(r) - ); - const fees = receipts.reduce( - (acc, r) => acc.add(r.effectiveGasPrice.mul(r.gasUsed)), - BigNumber.from(0) - ); - - const _block = provider.formatter.block(_rawBlock); - const extBlock: ExtendedBlock = { - blockReward: provider.formatter.bigNumber( - _rawIssuance.blockReward ?? 0 - ), - unclesReward: provider.formatter.bigNumber( - _rawIssuance.uncleReward ?? 0 - ), - feeReward: fees, - size: provider.formatter.number(_rawBlock.size), - sha3Uncles: _rawBlock.sha3Uncles, - stateRoot: _rawBlock.stateRoot, - totalDifficulty: provider.formatter.bigNumber( - _rawBlock.totalDifficulty - ), - ..._block, - }; - setBlock(extBlock); - }; - readBlock(); - }, [provider, params.blockNumberOrHash]); - + const block = useBlockData(provider, params.blockNumberOrHash); useEffect(() => { if (block) { document.title = `Block #${block.number} | Otterscan`; diff --git a/src/useErigonHooks.ts b/src/useErigonHooks.ts index 50d4bf3..ecbda33 100644 --- a/src/useErigonHooks.ts +++ b/src/useErigonHooks.ts @@ -1,8 +1,79 @@ -import { ethers } from "ethers"; +import { ethers, BigNumber } from "ethers"; import { useState, useEffect } from "react"; import { getInternalOperations } from "./nodeFunctions"; import { TransactionData, InternalOperation } from "./types"; +export interface ExtendedBlock extends ethers.providers.Block { + blockReward: BigNumber; + unclesReward: BigNumber; + feeReward: BigNumber; + size: number; + sha3Uncles: string; + stateRoot: string; + totalDifficulty: BigNumber; +} + +export const useBlockData = ( + provider: ethers.providers.JsonRpcProvider | undefined, + blockNumberOrHash: string +) => { + const [block, setBlock] = useState(); + useEffect(() => { + if (!provider) { + return; + } + + const readBlock = async () => { + let blockPromise: Promise; + if (ethers.utils.isHexString(blockNumberOrHash, 32)) { + blockPromise = provider.send("eth_getBlockByHash", [ + blockNumberOrHash, + false, + ]); + } else { + blockPromise = provider.send("eth_getBlockByNumber", [ + blockNumberOrHash, + false, + ]); + } + const [_rawBlock, _rawIssuance, _rawReceipts] = await Promise.all([ + blockPromise, + provider.send("erigon_issuance", [blockNumberOrHash]), + provider.send("eth_getBlockReceipts", [blockNumberOrHash]), + ]); + const receipts = (_rawReceipts as any[]).map((r) => + provider.formatter.receipt(r) + ); + const fees = receipts.reduce( + (acc, r) => acc.add(r.effectiveGasPrice.mul(r.gasUsed)), + BigNumber.from(0) + ); + + const _block = provider.formatter.block(_rawBlock); + const extBlock: ExtendedBlock = { + blockReward: provider.formatter.bigNumber( + _rawIssuance.blockReward ?? 0 + ), + unclesReward: provider.formatter.bigNumber( + _rawIssuance.uncleReward ?? 0 + ), + feeReward: fees, + size: provider.formatter.number(_rawBlock.size), + sha3Uncles: _rawBlock.sha3Uncles, + stateRoot: _rawBlock.stateRoot, + totalDifficulty: provider.formatter.bigNumber( + _rawBlock.totalDifficulty + ), + ..._block, + }; + setBlock(extBlock); + }; + readBlock(); + }, [provider, blockNumberOrHash]); + + return block; +}; + export const useInternalOperations = ( provider: ethers.providers.JsonRpcProvider | undefined, txData: TransactionData | undefined From bc8bf0cf9352523743d10134f45328595a435f92 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Mon, 26 Jul 2021 20:46:11 -0300 Subject: [PATCH 12/50] Add burned fees info; subtract from fees received by miner --- src/Block.tsx | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/Block.tsx b/src/Block.tsx index 00ca0dc..9e061e7 100644 --- a/src/Block.tsx +++ b/src/Block.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useMemo, useContext } from "react"; import { useParams, NavLink } from "react-router-dom"; -import { ethers } from "ethers"; +import { BigNumber, ethers } from "ethers"; import StandardFrame from "./StandardFrame"; import StandardSubtitle from "./StandardSubtitle"; import NavBlock from "./block/NavBlock"; @@ -10,6 +10,7 @@ import GasValue from "./components/GasValue"; import BlockLink from "./components/BlockLink"; import DecoratedAddressLink from "./components/DecoratedAddressLink"; import TransactionValue from "./components/TransactionValue"; +import FormattedBalance from "./components/FormattedBalance"; import HexValue from "./components/HexValue"; import { RuntimeContext } from "./useRuntime"; import { useLatestBlockNumber } from "./useLatestBlock"; @@ -39,6 +40,9 @@ const Block: React.FC = () => { console.error(err); } }, [block]); + const burnedFees = + block?.baseFeePerGas && block.baseFeePerGas.mul(block.gasUsed); + const netFeeReward = block && block.feeReward.sub(burnedFees ?? 0); const latestBlockNumber = useLatestBlockNumber(provider); @@ -81,12 +85,18 @@ const Block: React.FC = () => { - + {!block.feeReward.isZero() && ( <> {" "} ( +{" "} - ) + + ) )} @@ -102,6 +112,24 @@ const Block: React.FC = () => { {ethers.utils.commify(block.size)} bytes + {block.baseFeePerGas && ( + + + {" "} + Gwei ( + {" "} + wei) + + + )} + {burnedFees && ( + + Ether + + )} From e967abf61e67def44d54e79cbccf845783d3119e Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Mon, 26 Jul 2021 20:47:25 -0300 Subject: [PATCH 13/50] Add max fee per gas/max priority fee per gas --- src/Transaction.tsx | 3 +++ src/components/TransactionType.tsx | 30 ++++++++++++++++++++++++++++++ src/transaction/Details.tsx | 24 ++++++++++++++++++++++++ src/types.ts | 3 +++ 4 files changed, 60 insertions(+) create mode 100644 src/components/TransactionType.tsx diff --git a/src/Transaction.tsx b/src/Transaction.tsx index 55de7ac..5e8bb3f 100644 --- a/src/Transaction.tsx +++ b/src/Transaction.tsx @@ -92,7 +92,10 @@ const Transaction: React.FC = () => { value: _response.value, tokenTransfers, tokenMetas, + type: _response.type ?? 0, fee: _response.gasPrice!.mul(_receipt.gasUsed), + maxFeePerGas: _response.maxFeePerGas, + maxPriorityFeePerGas: _response.maxPriorityFeePerGas, gasPrice: _response.gasPrice!, gasLimit: _response.gasLimit, gasUsed: _receipt.gasUsed, diff --git a/src/components/TransactionType.tsx b/src/components/TransactionType.tsx new file mode 100644 index 0000000..ab4c58a --- /dev/null +++ b/src/components/TransactionType.tsx @@ -0,0 +1,30 @@ +import React from "react"; + +type TransactionTypeProps = { + type: number; +}; + +const TransactionType: React.FC = ({ type }) => { + let description: string; + switch (type) { + case 0: + description = "legacy"; + break; + case 1: + description = "EIP-2930"; + break; + case 2: + description = "EIP-1559"; + break; + default: + description = "unknown"; + } + + return ( + + {type} ({description}) + + ); +}; + +export default React.memo(TransactionType); diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 30bcbbd..0b2277f 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -15,6 +15,7 @@ import Copy from "../components/Copy"; import Timestamp from "../components/Timestamp"; import InternalTransactionOperation from "../components/InternalTransactionOperation"; import MethodName from "../components/MethodName"; +import TransactionType from "../components/TransactionType"; import GasValue from "../components/GasValue"; import FormattedBalance from "../components/FormattedBalance"; import TokenTransferItem from "../TokenTransferItem"; @@ -130,6 +131,29 @@ const Details: React.FC = ({ {ethers.utils.formatEther(txData.value)} Ether + + + + {txData.type === 2 && ( + <> + + + Ether ( + Gwei) + + + + + Ether ( + {" "} + Gwei) + + + + )} Ether diff --git a/src/types.ts b/src/types.ts index ac53edd..144b9c3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -49,6 +49,9 @@ export type TransactionData = { value: BigNumber; tokenTransfers: TokenTransfer[]; tokenMetas: TokenMetas; + type: number; + maxFeePerGas?: BigNumber | undefined; + maxPriorityFeePerGas?: BigNumber | undefined; fee: BigNumber; gasPrice: BigNumber; gasLimit: BigNumber; From 91dd933aa2bf9518e3454843a9d51058439f872c Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 28 Jul 2021 04:24:48 -0300 Subject: [PATCH 14/50] Squash block gas used/limit info; add percentage bar --- src/Block.tsx | 37 +++++++++++++++++++++---------------- src/components/InfoRow.tsx | 2 +- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/Block.tsx b/src/Block.tsx index 9e061e7..91951ec 100644 --- a/src/Block.tsx +++ b/src/Block.tsx @@ -5,6 +5,7 @@ import StandardFrame from "./StandardFrame"; import StandardSubtitle from "./StandardSubtitle"; import NavBlock from "./block/NavBlock"; import ContentFrame from "./ContentFrame"; +import InfoRow from "./components/InfoRow"; import Timestamp from "./components/Timestamp"; import GasValue from "./components/GasValue"; import BlockLink from "./components/BlockLink"; @@ -43,6 +44,8 @@ const Block: React.FC = () => { const burnedFees = block?.baseFeePerGas && block.baseFeePerGas.mul(block.gasUsed); const netFeeReward = block && block.feeReward.sub(burnedFees ?? 0); + const gasUsedPerc = + block && block.gasUsed.mul(10000).div(block.gasLimit).toNumber() / 100; const latestBlockNumber = useLatestBlockNumber(provider); @@ -130,11 +133,24 @@ const Block: React.FC = () => { Ether )} - - - - - + +
+
+ /{" "} + +
+
+
+
+
+ {gasUsedPerc}% +
+
+
+
{extraStr} (Hex:{" "} @@ -162,15 +178,4 @@ const Block: React.FC = () => { ); }; -type InfoRowProps = { - title: string; -}; - -const InfoRow: React.FC = ({ title, children }) => ( -
-
{title}:
-
{children}
-
-); - export default React.memo(Block); diff --git a/src/components/InfoRow.tsx b/src/components/InfoRow.tsx index d3758b3..eb40eb6 100644 --- a/src/components/InfoRow.tsx +++ b/src/components/InfoRow.tsx @@ -5,7 +5,7 @@ type InfoRowProps = React.PropsWithChildren<{ }>; const InfoRow: React.FC = ({ title, children }) => ( -
+
{title}:
{children}
From d893eb8545583d84258c6bff4ae8104de17fb1cb Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 28 Jul 2021 04:27:08 -0300 Subject: [PATCH 15/50] Reorder difficult/total difficult fields --- src/Block.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Block.tsx b/src/Block.tsx index 91951ec..afa68f4 100644 --- a/src/Block.tsx +++ b/src/Block.tsx @@ -106,12 +106,6 @@ const Block: React.FC = () => { - - {ethers.utils.commify(block.difficulty)} - - - {ethers.utils.commify(block.totalDifficulty.toString())} - {ethers.utils.commify(block.size)} bytes @@ -157,6 +151,12 @@ const Block: React.FC = () => { {block.extraData}) N/A + + {ethers.utils.commify(block.difficulty)} + + + {ethers.utils.commify(block.totalDifficulty.toString())} + From e354973a6382bfa4aa4268e7164c85f9a47d9a2c Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 28 Jul 2021 04:29:36 -0300 Subject: [PATCH 16/50] Squash tx gas used/limit info --- src/transaction/Details.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 0b2277f..71cef91 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -170,14 +170,11 @@ const Details: React.FC = ({ )}
+ + / {" "} + ({(txData.gasUsedPerc * 100).toFixed(2)}%) + N/A - - - - - ( - {(txData.gasUsedPerc * 100).toFixed(2)}%) - {txData.nonce} From e214117f47fab35b8e58e0ac6ea2755df6efea5f Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 28 Jul 2021 04:40:38 -0300 Subject: [PATCH 17/50] Extract PercentageBar component; apply percentage bar to tx gas usage --- src/Block.tsx | 13 ++----------- src/components/PercentageBar.tsx | 21 +++++++++++++++++++++ src/transaction/Details.tsx | 10 ++++++++-- 3 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 src/components/PercentageBar.tsx diff --git a/src/Block.tsx b/src/Block.tsx index afa68f4..83ab187 100644 --- a/src/Block.tsx +++ b/src/Block.tsx @@ -8,6 +8,7 @@ import ContentFrame from "./ContentFrame"; import InfoRow from "./components/InfoRow"; import Timestamp from "./components/Timestamp"; import GasValue from "./components/GasValue"; +import PercentageBar from "./components/PercentageBar"; import BlockLink from "./components/BlockLink"; import DecoratedAddressLink from "./components/DecoratedAddressLink"; import TransactionValue from "./components/TransactionValue"; @@ -133,17 +134,7 @@ const Block: React.FC = () => { /{" "}
-
-
-
-
- {gasUsedPerc}% -
-
-
+
diff --git a/src/components/PercentageBar.tsx b/src/components/PercentageBar.tsx new file mode 100644 index 0000000..a868784 --- /dev/null +++ b/src/components/PercentageBar.tsx @@ -0,0 +1,21 @@ +import React from "react"; + +type PercentageBarProps = { + perc: number; +}; + +const PercentageBar: React.FC = ({ perc }) => ( +
+
+
+
+ {perc}% +
+
+
+); + +export default React.memo(PercentageBar); diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 71cef91..2619204 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -20,6 +20,7 @@ import GasValue from "../components/GasValue"; import FormattedBalance from "../components/FormattedBalance"; import TokenTransferItem from "../TokenTransferItem"; import { TransactionData, InternalOperation } from "../types"; +import PercentageBar from "../components/PercentageBar"; type DetailsProps = { txData: TransactionData; @@ -171,8 +172,13 @@ const Details: React.FC = ({
- / {" "} - ({(txData.gasUsedPerc * 100).toFixed(2)}%) +
+
+ /{" "} + +
+ +
N/A {txData.nonce} From 31287796f0b55ee1212ad678d055e826777aa467 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 28 Jul 2021 04:53:55 -0300 Subject: [PATCH 18/50] Remove unnecessary field --- src/Transaction.tsx | 4 +--- src/transaction/Details.tsx | 8 +++++++- src/types.ts | 3 +-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Transaction.tsx b/src/Transaction.tsx index 5e8bb3f..ae4fb54 100644 --- a/src/Transaction.tsx +++ b/src/Transaction.tsx @@ -97,10 +97,8 @@ const Transaction: React.FC = () => { maxFeePerGas: _response.maxFeePerGas, maxPriorityFeePerGas: _response.maxPriorityFeePerGas, gasPrice: _response.gasPrice!, - gasLimit: _response.gasLimit, gasUsed: _receipt.gasUsed, - gasUsedPerc: - _receipt.gasUsed.toNumber() / _response.gasLimit.toNumber(), + gasLimit: _response.gasLimit, nonce: _response.nonce, data: _response.data, logs: _receipt.logs, diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 2619204..65a4592 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -177,7 +177,13 @@ const Details: React.FC = ({ /{" "}
- +
N/A diff --git a/src/types.ts b/src/types.ts index 144b9c3..64fba94 100644 --- a/src/types.ts +++ b/src/types.ts @@ -54,9 +54,8 @@ export type TransactionData = { maxPriorityFeePerGas?: BigNumber | undefined; fee: BigNumber; gasPrice: BigNumber; - gasLimit: BigNumber; gasUsed: BigNumber; - gasUsedPerc: number; + gasLimit: BigNumber; nonce: number; data: string; logs: ethers.providers.Log[]; From 9484ed59e2eb916e5301e19e53c15d0600838fe2 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 28 Jul 2021 14:49:40 -0300 Subject: [PATCH 19/50] Add block base fee info to tx details page --- src/Transaction.tsx | 1 + src/transaction/Details.tsx | 13 +++++++++++++ src/types.ts | 1 + 3 files changed, 15 insertions(+) diff --git a/src/Transaction.tsx b/src/Transaction.tsx index ae4fb54..ad940fe 100644 --- a/src/Transaction.tsx +++ b/src/Transaction.tsx @@ -94,6 +94,7 @@ const Transaction: React.FC = () => { tokenMetas, type: _response.type ?? 0, fee: _response.gasPrice!.mul(_receipt.gasUsed), + blockBaseFeePerGas: _block.baseFeePerGas, maxFeePerGas: _response.maxFeePerGas, maxPriorityFeePerGas: _response.maxPriorityFeePerGas, gasPrice: _response.gasPrice!, diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 65a4592..27d1197 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -135,6 +135,19 @@ const Details: React.FC = ({ + {txData.blockBaseFeePerGas && ( + + + {" "} + Gwei ( + {" "} + wei) + + + )} {txData.type === 2 && ( <> diff --git a/src/types.ts b/src/types.ts index 64fba94..482828e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -53,6 +53,7 @@ export type TransactionData = { maxFeePerGas?: BigNumber | undefined; maxPriorityFeePerGas?: BigNumber | undefined; fee: BigNumber; + blockBaseFeePerGas?: BigNumber | undefined | null; gasPrice: BigNumber; gasUsed: BigNumber; gasLimit: BigNumber; From eaa018e207bb68603095f29e3acf80b0acf1fdcb Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 28 Jul 2021 16:09:40 -0300 Subject: [PATCH 20/50] Reorder fields --- src/transaction/Details.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 27d1197..e8e1159 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -150,12 +150,6 @@ const Details: React.FC = ({ )} {txData.type === 2 && ( <> - - - Ether ( - Gwei) - - Ether ( @@ -166,6 +160,12 @@ const Details: React.FC = ({ Gwei) + + + Ether ( + Gwei) + + )} From 873541ec647dab211f6e5fec0f3d330183c4212d Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 28 Jul 2021 16:27:06 -0300 Subject: [PATCH 21/50] Add hyperlinks to EIP tx types --- src/components/ExternalLink.tsx | 23 +++++++++++++++++++++++ src/components/TransactionType.tsx | 15 ++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 src/components/ExternalLink.tsx diff --git a/src/components/ExternalLink.tsx b/src/components/ExternalLink.tsx new file mode 100644 index 0000000..5232a9d --- /dev/null +++ b/src/components/ExternalLink.tsx @@ -0,0 +1,23 @@ +import React from "react"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faExternalLinkAlt } from "@fortawesome/free-solid-svg-icons"; + +type ExternalLinkProps = { + href: string; +}; + +const ExternalLink: React.FC = ({ href, children }) => ( + + + {children} + + + +); + +export default ExternalLink; diff --git a/src/components/TransactionType.tsx b/src/components/TransactionType.tsx index ab4c58a..e7faa6c 100644 --- a/src/components/TransactionType.tsx +++ b/src/components/TransactionType.tsx @@ -1,20 +1,29 @@ import React from "react"; +import ExternalLink from "./ExternalLink"; type TransactionTypeProps = { type: number; }; const TransactionType: React.FC = ({ type }) => { - let description: string; + let description: React.ReactNode; switch (type) { case 0: description = "legacy"; break; case 1: - description = "EIP-2930"; + description = ( + + EIP-2930 + + ); break; case 2: - description = "EIP-1559"; + description = ( + + EIP-1559 + + ); break; default: description = "unknown"; From 8cacd01f4260d58cae09ca6991c1feb40a7597a1 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 28 Jul 2021 16:36:34 -0300 Subject: [PATCH 22/50] Enable rich info on InfoRow component title; add EIP hyperlink to tx type --- src/components/ExternalLink.tsx | 4 ++-- src/components/InfoRow.tsx | 2 +- src/transaction/Details.tsx | 13 ++++++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/ExternalLink.tsx b/src/components/ExternalLink.tsx index 5232a9d..51769a8 100644 --- a/src/components/ExternalLink.tsx +++ b/src/components/ExternalLink.tsx @@ -13,9 +13,9 @@ const ExternalLink: React.FC = ({ href, children }) => ( target="_blank" rel="noopener noreferrer" > - + {children} - + ); diff --git a/src/components/InfoRow.tsx b/src/components/InfoRow.tsx index eb40eb6..947eec7 100644 --- a/src/components/InfoRow.tsx +++ b/src/components/InfoRow.tsx @@ -1,7 +1,7 @@ import React from "react"; type InfoRowProps = React.PropsWithChildren<{ - title: string; + title: React.ReactNode; }>; const InfoRow: React.FC = ({ title, children }) => ( diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index e8e1159..86b0c0e 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -21,6 +21,7 @@ import FormattedBalance from "../components/FormattedBalance"; import TokenTransferItem from "../TokenTransferItem"; import { TransactionData, InternalOperation } from "../types"; import PercentageBar from "../components/PercentageBar"; +import ExternalLink from "../components/ExternalLink"; type DetailsProps = { txData: TransactionData; @@ -132,7 +133,17 @@ const Details: React.FC = ({ {ethers.utils.formatEther(txData.value)} Ether - + + Type ( + + EIP-2718 + + ) + + } + > {txData.blockBaseFeePerGas && ( From f0e96990efea88be5dd390afbf7c0ad8903e9698 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 28 Jul 2021 18:44:50 -0300 Subject: [PATCH 23/50] Add burnt/miner fee split info --- src/transaction/Details.tsx | 388 +++++++++++++++++--------------- src/transaction/RewardSplit.tsx | 54 +++++ 2 files changed, 256 insertions(+), 186 deletions(-) create mode 100644 src/transaction/RewardSplit.tsx diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 86b0c0e..1a1cd64 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -16,6 +16,7 @@ import Timestamp from "../components/Timestamp"; import InternalTransactionOperation from "../components/InternalTransactionOperation"; import MethodName from "../components/MethodName"; import TransactionType from "../components/TransactionType"; +import RewardSplit from "./RewardSplit"; import GasValue from "../components/GasValue"; import FormattedBalance from "../components/FormattedBalance"; import TokenTransferItem from "../TokenTransferItem"; @@ -33,198 +34,213 @@ const Details: React.FC = ({ txData, internalOps, sendsEthToMiner, -}) => ( - - -
- {txData.transactionHash} - -
-
- - {txData.status ? ( - - - Success - - ) : ( - - - Fail - - )} - - -
- - -
-
- - - - -
- - - - -
-
- - {txData.to ? ( -
- - - - -
- ) : ( -
- - - - -
- )} - {internalOps && ( -
- {internalOps.map((op, i) => ( - - ))} -
- )} -
- - - - {txData.tokenTransfers.length > 0 && ( - -
- {txData.tokenTransfers.map((t, i) => ( - - ))} +}) => { + const hasEIP1559 = + txData.blockBaseFeePerGas !== undefined && + txData.blockBaseFeePerGas !== null; + + return ( + + +
+ {txData.transactionHash} +
- )} - - - {ethers.utils.formatEther(txData.value)} Ether - - - - Type ( - - EIP-2718 - - ) - - } - > - - - {txData.blockBaseFeePerGas && ( - - - {" "} - Gwei ( - {" "} - wei) - - - )} - {txData.type === 2 && ( - <> - - - Ether ( - {" "} - Gwei) + + {txData.status ? ( + + + Success - - - - Ether ( - Gwei) - - - - )} - - Ether - - -
- - Ether ( - Gwei) - - {sendsEthToMiner && ( - - Flashbots + ) : ( + + + Fail )} -
-
- -
-
- /{" "} - + + +
+ +
- + + + + +
+ + + + +
+
+ + {txData.to ? ( +
+ + + + +
+ ) : ( +
+ + + + +
+ )} + {internalOps && ( +
+ {internalOps.map((op, i) => ( + + ))} +
+ )} +
+ + + + {txData.tokenTransfers.length > 0 && ( + +
+ {txData.tokenTransfers.map((t, i) => ( + + ))} +
+
+ )} + + + {ethers.utils.formatEther(txData.value)} Ether + + + + Type ( + + EIP-2718 + + ) + + } + > + + + {hasEIP1559 && ( + + + {" "} + Gwei ( + {" "} + wei) + + + )} + {txData.type === 2 && ( + <> + + + Ether ( + {" "} + Gwei) + + + + + Ether ( + {" "} + Gwei) + + + + )} + +
+
+ Ether +
+ {hasEIP1559 && } +
+
+ +
+ + Ether ( + Gwei) + + {sendsEthToMiner && ( + + Flashbots + + )} +
+
+ +
+
+ /{" "} + +
+ +
+
+ N/A + {txData.nonce} + + + {txData.transactionIndex} + + + +