From d68dc9d77c893d0d26ba3e36a976c196df7e3e72 Mon Sep 17 00:00:00 2001 From: mmv Date: Mon, 8 Jul 2019 16:09:40 +0400 Subject: [PATCH] fix value agrument type for tx, fix calculation of confirmed owners --- package.json | 6 +- .../TxsTable/ExpandedTx/index.jsx | 5 +- .../safe/store/actions/fetchTransactions.js | 2 +- src/routes/safe/store/models/transaction.js | 2 +- yarn.lock | 65 ++++++++++--------- 5 files changed, 42 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 2741f8b2..2f75c71d 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "dependencies": { "@gnosis.pm/safe-contracts": "^1.0.0", "@gnosis.pm/util-contracts": "2.0.1", - "@material-ui/core": "4.1.3", + "@material-ui/core": "4.2.0", "@material-ui/icons": "4.2.1", "@welldone-software/why-did-you-render": "3.2.1", "axios": "0.19.0", @@ -50,7 +50,7 @@ "react-dom": "^16.8.6", "react-final-form": "6.3.0", "react-final-form-listeners": "^1.0.2", - "react-hot-loader": "4.12.3", + "react-hot-loader": "4.12.5", "react-infinite-scroll-component": "^4.5.2", "react-redux": "7.1.0", "react-router-dom": "^4.3.1", @@ -92,7 +92,7 @@ "@storybook/addon-links": "5.1.9", "@storybook/react": "5.1.9", "@testing-library/react": "^8.0.1", - "autoprefixer": "9.6.0", + "autoprefixer": "9.6.1", "babel-core": "^7.0.0-bridge.0", "babel-eslint": "10.0.2", "babel-jest": "24.8.0", diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/index.jsx b/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/index.jsx index 02996bbd..e2d4aad6 100644 --- a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/index.jsx +++ b/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/index.jsx @@ -16,6 +16,7 @@ import { type Transaction } from '~/routes/safe/store/models/transaction' import { type Owner } from '~/routes/safe/store/models/owner' import { getEtherScanLink, openTxInEtherScan, getWeb3 } from '~/logic/wallets/getWeb3' import { shortVersionOf } from '~/logic/wallets/ethAddresses' +import { TX_TYPE_CONFIRMATION } from '~/logic/safe/transactions' import { EMPTY_DATA } from '~/logic/wallets/ethTransactions' import { secondary } from '~/theme/variables' import OwnersList from './OwnersList' @@ -73,7 +74,9 @@ const ExpandedTx = ({ const openCancelModal = () => setOpenModal('cancelTx') const closeModal = () => setOpenModal(null) const cancellationTx = isCancellationTransaction(tx, safeAddress) - const confirmedLabel = `Confirmed [${tx.confirmations.size}/${threshold}]` + const confirmedLabel = `Confirmed [${ + tx.confirmations.filter(conf => conf.type === TX_TYPE_CONFIRMATION).size + }/${threshold}]` const unconfirmedLabel = `Unconfirmed [${owners.size - tx.confirmations.size}]` const thresholdReached = threshold <= tx.confirmations.size diff --git a/src/routes/safe/store/actions/fetchTransactions.js b/src/routes/safe/store/actions/fetchTransactions.js index 8673042f..d67e64ef 100644 --- a/src/routes/safe/store/actions/fetchTransactions.js +++ b/src/routes/safe/store/actions/fetchTransactions.js @@ -69,7 +69,7 @@ const buildTransactionFrom = async (safeAddress: string, tx: TxServiceModel, saf name, symbol, nonce: tx.nonce, - value: Number(tx.value), + value: tx.value.toString(), confirmations, recipient: tx.to, data: tx.data ? tx.data : EMPTY_DATA, diff --git a/src/routes/safe/store/models/transaction.js b/src/routes/safe/store/models/transaction.js index f5777631..4fa7a928 100644 --- a/src/routes/safe/store/models/transaction.js +++ b/src/routes/safe/store/models/transaction.js @@ -8,7 +8,7 @@ export type TransactionStatus = 'awaiting_confirmations' | 'success' | 'cancelle export type TransactionProps = { name: string, nonce: number, - value: number, + value: string, confirmations: List, recipient: string, data: string, diff --git a/yarn.lock b/yarn.lock index 4e28c7b6..7e7f0bba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1672,27 +1672,25 @@ "@types/istanbul-reports" "^1.1.1" "@types/yargs" "^12.0.9" -"@material-ui/core@4.1.3": - version "4.1.3" - resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.1.3.tgz#0f8ffae88ac668399fbfc66efa1ed37c4ce29a7d" - integrity sha512-cSrI3yZ2L1XVi5IyO0/dPGUq1FaDBKTL9ygDOlvojD6bGuD/Qu17dCFAD8/mHV4CPNQMJYUKLYyOmqtDYdEB9g== +"@material-ui/core@4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.2.0.tgz#fd57352c63a50bc28d8b0d61a779a55aba84f9c4" + integrity sha512-kqwoCMpGaj3zJedihUuVZWjISh+T72KAXOwgk6VKNf+APMTB8yLByLSgSLDhXsliRBO/9Pda/0g/KzGY7R+irQ== dependencies: "@babel/runtime" "^7.2.0" - "@material-ui/styles" "^4.1.2" + "@material-ui/styles" "^4.2.0" "@material-ui/system" "^4.3.0" "@material-ui/types" "^4.1.1" "@material-ui/utils" "^4.1.0" "@types/react-transition-group" "^2.0.16" clsx "^1.0.2" convert-css-length "^2.0.0" - debounce "^1.1.0" deepmerge "^3.0.0" hoist-non-react-statics "^3.2.1" is-plain-object "^3.0.0" normalize-scroll-left "^0.2.0" popper.js "^1.14.1" prop-types "^15.7.2" - react-event-listener "^0.6.6" react-transition-group "^4.0.0" warning "^4.0.1" @@ -1703,10 +1701,10 @@ dependencies: "@babel/runtime" "^7.2.0" -"@material-ui/styles@^4.1.2": - version "4.1.2" - resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.1.2.tgz#f22cb0d8f60a5e4a4b92f1ffb4b56f825ff89034" - integrity sha512-IRwhGI3OzxMKIDXnYl/vi9FD/i5ZktVP2m/5PIf/HVdvhqUZGIzqR2OB/9f3W1hc+kKKExdOPlpZpVihIsJWkA== +"@material-ui/styles@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.2.0.tgz#dafb8a271cb6772354aece15d3e43af33844f692" + integrity sha512-VpPCNWYK1KjpurFh1gH02xpAmCqKZrC/rmiBosZcCRDl8AOcUkSxBMNU0rziHgSQ/jYTEh3MdKNs3Gq0vGCQ/w== dependencies: "@babel/runtime" "^7.2.0" "@emotion/hash" "^0.7.1" @@ -3206,7 +3204,20 @@ atob@^2.1.1: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -autoprefixer@9.6.0, autoprefixer@^9.4.9: +autoprefixer@9.6.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.6.1.tgz#51967a02d2d2300bb01866c1611ec8348d355a47" + integrity sha512-aVo5WxR3VyvyJxcJC3h4FKfwCQvQWb1tSI5VHNibddCVWrcD1NvlxEweg3TSgiPztMnWfjpy2FURKA2kvDE+Tw== + dependencies: + browserslist "^4.6.3" + caniuse-lite "^1.0.30000980" + chalk "^2.4.2" + normalize-range "^0.1.2" + num2fraction "^1.2.2" + postcss "^7.0.17" + postcss-value-parser "^4.0.0" + +autoprefixer@^9.4.9: version "9.6.0" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.6.0.tgz#0111c6bde2ad20c6f17995a33fad7cf6854b4c87" integrity sha512-kuip9YilBqhirhHEGHaBTZKXL//xxGnzvsD0FtBQa6z+A69qZD6s/BAX9VzDF1i9VKDquTJDQaPLSEhOnL6FvQ== @@ -4596,7 +4607,7 @@ browserslist@^3.2.6: caniuse-lite "^1.0.30000844" electron-to-chromium "^1.3.47" -browserslist@^4.0.0, browserslist@^4.5.2, browserslist@^4.6.0, browserslist@^4.6.1, browserslist@^4.6.2: +browserslist@^4.0.0, browserslist@^4.5.2, browserslist@^4.6.0, browserslist@^4.6.1, browserslist@^4.6.2, browserslist@^4.6.3: version "4.6.3" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.3.tgz#0530cbc6ab0c1f3fc8c819c72377ba55cf647f05" integrity sha512-CNBqTCq22RKM8wKJNowcqihHJ4SkI8CGeK7KOR9tPboXUuS5Zk5lQgzzTbs4oxD8x+6HUshZUa2OyNI9lR93bQ== @@ -4862,6 +4873,11 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30000955, can resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000978.tgz#1e3346c27fc46bce9ac1ccd77863153a263dde56" integrity sha512-H6gK6kxUzG6oAwg/Jal279z8pHw0BzrpZfwo/CA9FFm/vA0l8IhDfkZtepyJNE2Y4V6Dp3P3ubz6czby1/Mgsw== +caniuse-lite@^1.0.30000980: + version "1.0.30000981" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000981.tgz#5b6828803362363e5a1deba2eb550185cf6cec8f" + integrity sha512-JTByHj4DQgL2crHNMK6PibqAMrqqb/Vvh0JrsTJVSWG4VSUrT16EklkuRZofurlMjgA9e+zlCM4Y39F3kootMQ== + capture-exit@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" @@ -5954,11 +5970,6 @@ date-now@^0.1.4: resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" integrity sha1-6vQ5/U1ISK105cx9vvIAZyueNFs= -debounce@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.0.tgz#44a540abc0ea9943018dc0eaa95cce87f65cd131" - integrity sha512-mYtLl1xfZLi1m4RtQYlZgJUNQjl4ZxVnHzIR8nLLgi4q1YT8o/WM+MK/f8yfcc9s5Ir5zRaPZyZU6xs1Syoocg== - debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -13510,15 +13521,6 @@ react-error-overlay@^5.1.6: resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-5.1.6.tgz#0cd73407c5d141f9638ae1e0c63e7b2bf7e9929d" integrity sha512-X1Y+0jR47ImDVr54Ab6V9eGk0Hnu7fVWGeHQSOXHf/C2pF9c6uy3gef8QUeuUiWlNb0i08InPSE5a/KJzNzw1Q== -react-event-listener@^0.6.6: - version "0.6.6" - resolved "https://registry.yarnpkg.com/react-event-listener/-/react-event-listener-0.6.6.tgz#758f7b991cad9086dd39fd29fad72127e1d8962a" - integrity sha512-+hCNqfy7o9wvO6UgjqFmBzARJS7qrNoda0VqzvOuioEpoEXKutiKuv92dSz6kP7rYLmyHPyYNLesi5t/aH1gfw== - dependencies: - "@babel/runtime" "^7.2.0" - prop-types "^15.6.0" - warning "^4.0.1" - react-fast-compare@2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-2.0.4.tgz#e84b4d455b0fec113e0402c329352715196f81f9" @@ -13560,16 +13562,15 @@ react-helmet-async@^1.0.2: react-fast-compare "2.0.4" shallowequal "1.1.0" -react-hot-loader@4.12.3: - version "4.12.3" - resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.12.3.tgz#0972255cd110a00860902e82bb2b789a262cfe01" - integrity sha512-XBhxogFOxEh8L4Ykdk2mp704Xc/eoy+bwadEYMvmBhjAz3wg+DfMpINMkA+kLTRDinqwjssDfA9DhUJznRjvuA== +react-hot-loader@4.12.5: + version "4.12.5" + resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.12.5.tgz#ebe5b6a68190b14fce42151fff03d1ad43634e9b" + integrity sha512-RH7mi2hSp+74pM/GCwFoQ+nHY6JnFKrzBNbSWnOfT9LJMMnCWf/Eg5CoaeJHMpvqF+x6hdT//T2GoSpqImEzfg== dependencies: fast-levenshtein "^2.0.6" global "^4.3.0" hoist-non-react-statics "^3.3.0" loader-utils "^1.1.0" - lodash "^4.17.11" prop-types "^15.6.1" react-lifecycles-compat "^3.0.4" shallowequal "^1.0.2"