Use transaction value as a string (#369)

* Update isTokenTransfer to use value as a string

* Rename error message

* Update dependencies

* Refactor
This commit is contained in:
Germán Martínez 2019-12-17 20:57:03 +01:00 committed by GitHub
parent f864f62fa7
commit 80c87c6632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 34 deletions

View File

@ -113,7 +113,7 @@
"babel-plugin-transform-es3-property-literals": "^6.22.0", "babel-plugin-transform-es3-property-literals": "^6.22.0",
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"css-loader": "3.3.2", "css-loader": "3.4.0",
"detect-port": "^1.3.0", "detect-port": "^1.3.0",
"eslint": "6.7.2", "eslint": "6.7.2",
"eslint-config-airbnb": "18.0.1", "eslint-config-airbnb": "18.0.1",
@ -132,15 +132,15 @@
"jest": "24.9.0", "jest": "24.9.0",
"jest-dom": "4.0.0", "jest-dom": "4.0.0",
"json-loader": "^0.5.7", "json-loader": "^0.5.7",
"mini-css-extract-plugin": "0.8.0", "mini-css-extract-plugin": "0.8.1",
"postcss-loader": "^3.0.0", "postcss-loader": "^3.0.0",
"postcss-mixins": "6.2.3", "postcss-mixins": "6.2.3",
"postcss-simple-vars": "^5.0.2", "postcss-simple-vars": "^5.0.2",
"pre-commit": "^1.2.2", "pre-commit": "^1.2.2",
"prettier-eslint-cli": "5.0.0", "prettier-eslint-cli": "5.0.0",
"run-with-testrpc": "0.3.1", "run-with-testrpc": "0.3.1",
"style-loader": "1.0.1", "style-loader": "1.0.2",
"terser-webpack-plugin": "2.3.0", "terser-webpack-plugin": "2.3.1",
"truffle": "5.1.4", "truffle": "5.1.4",
"truffle-contract": "4.0.31", "truffle-contract": "4.0.31",
"truffle-solidity-loader": "0.1.32", "truffle-solidity-loader": "0.1.32",

View File

@ -79,7 +79,7 @@ export const buildTransactionFrom = async (
) )
const modifySettingsTx = sameAddress(tx.to, safeAddress) && Number(tx.value) === 0 && !!tx.data const modifySettingsTx = sameAddress(tx.to, safeAddress) && Number(tx.value) === 0 && !!tx.data
const cancellationTx = sameAddress(tx.to, safeAddress) && Number(tx.value) === 0 && !tx.data const cancellationTx = sameAddress(tx.to, safeAddress) && Number(tx.value) === 0 && !tx.data
const isSendTokenTx = await isTokenTransfer(tx.data, tx.value) const isSendTokenTx = await isTokenTransfer(tx.data, Number(tx.value))
const customTx = !sameAddress(tx.to, safeAddress) && !!tx.data && !isSendTokenTx const customTx = !sameAddress(tx.to, safeAddress) && !!tx.data && !isSendTokenTx
let refundParams = null let refundParams = null
@ -225,8 +225,6 @@ export const buildIncomingTransactionFrom = async (tx: IncomingTxServiceModel) =
} }
export const loadSafeTransactions = async (safeAddress: string) => { export const loadSafeTransactions = async (safeAddress: string) => {
web3 = await getWeb3()
let transactions: TxServiceModel[] = addMockSafeCreationTx(safeAddress) let transactions: TxServiceModel[] = addMockSafeCreationTx(safeAddress)
try { try {
const url = buildTxServiceUrl(safeAddress) const url = buildTxServiceUrl(safeAddress)
@ -254,7 +252,7 @@ export const loadSafeIncomingTransactions = async (safeAddress: string) => {
incomingTransactions = response.data.results incomingTransactions = response.data.results
} }
} catch (err) { } catch (err) {
console.error(`Requests for incomming transactions for ${safeAddress} failed with 404`, err) console.error(`Requests for incoming transactions for ${safeAddress} failed with 404`, err)
} }
const incomingTxsRecord = await Promise.all(incomingTransactions.map(buildIncomingTransactionFrom)) const incomingTxsRecord = await Promise.all(incomingTransactions.map(buildIncomingTransactionFrom))
@ -263,6 +261,8 @@ export const loadSafeIncomingTransactions = async (safeAddress: string) => {
} }
export default (safeAddress: string) => async (dispatch: ReduxDispatch<GlobalState>) => { export default (safeAddress: string) => async (dispatch: ReduxDispatch<GlobalState>) => {
web3 = await getWeb3()
const transactions: Map<string, List<Transaction>> = await loadSafeTransactions(safeAddress) const transactions: Map<string, List<Transaction>> = await loadSafeTransactions(safeAddress)
const incomingTransactions: Map<string, List<IncomingTransaction>> = await loadSafeIncomingTransactions(safeAddress) const incomingTransactions: Map<string, List<IncomingTransaction>> = await loadSafeIncomingTransactions(safeAddress)

View File

@ -4895,10 +4895,10 @@ css-declaration-sorter@^4.0.1:
postcss "^7.0.1" postcss "^7.0.1"
timsort "^0.3.0" timsort "^0.3.0"
css-loader@3.3.2: css-loader@3.4.0:
version "3.3.2" version "3.4.0"
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.3.2.tgz#41b2086528aa4fbf8c0692e874bc14f081129b21" resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.4.0.tgz#9fb263436783117a41d014e45e8eaeba54dd6670"
integrity sha512-4XSiURS+YEK2fQhmSaM1onnUm0VKWNf6WWBYjkp9YbSDGCBTVZ5XOM6Gkxo8tLgQlzkZOBJvk9trHlDk4gjEYg== integrity sha512-JornYo4RAXl1Mzt0lOSVPmArzAMV3rGY2VuwtaDc732WTWjdwTaeS19nCGWMcSCf305Q396lhhDAJEWWM0SgPQ==
dependencies: dependencies:
camelcase "^5.3.1" camelcase "^5.3.1"
cssesc "^3.0.0" cssesc "^3.0.0"
@ -7260,10 +7260,10 @@ find-cache-dir@^2.0.0, find-cache-dir@^2.1.0:
make-dir "^2.0.0" make-dir "^2.0.0"
pkg-dir "^3.0.0" pkg-dir "^3.0.0"
find-cache-dir@^3.1.0: find-cache-dir@^3.2.0:
version "3.1.0" version "3.2.0"
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.1.0.tgz#9935894999debef4cf9f677fdf646d002c4cdecb" resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.2.0.tgz#e7fe44c1abc1299f516146e563108fd1006c1874"
integrity sha512-zw+EFiNBNPgI2NTrKkDd1xd7q0cs6wr/iWnr/oUkI0yF9K9GqQ+riIt4aiyFaaqpaWbxPrJXHI+QvmNUQbX+0Q== integrity sha512-1JKclkYYsf1q9WIJKLZa9S9muC+08RIjzAlLrK4QcYLJMS6mk9yombQ9qf+zJ7H9LS800k0s44L4sDq9VYzqyg==
dependencies: dependencies:
commondir "^1.0.1" commondir "^1.0.1"
make-dir "^3.0.0" make-dir "^3.0.0"
@ -10977,10 +10977,10 @@ mini-create-react-context@^0.3.0:
gud "^1.0.0" gud "^1.0.0"
tiny-warning "^1.0.2" tiny-warning "^1.0.2"
mini-css-extract-plugin@0.8.0: mini-css-extract-plugin@0.8.1:
version "0.8.0" version "0.8.1"
resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.8.0.tgz#81d41ec4fe58c713a96ad7c723cdb2d0bd4d70e1" resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.8.1.tgz#0b3cd3f9610e60860c58493ed170ca6d3c35daf3"
integrity sha512-MNpRGbNA52q6U92i0qbVpQNsgk7LExy41MdAlG84FeytfDOtRIf/mCHdEgG8rpTKOaNKiqUnZdlptF469hxqOw== integrity sha512-YOMfkqV07IlP3xVFMuTXze8K+fa5WXW8PE3rb2P01XAD5UxpbrwMHIYQ/DPfWaOmTnS16TD7d8CRi8AyOmgJ8g==
dependencies: dependencies:
loader-utils "^1.1.0" loader-utils "^1.1.0"
normalize-url "1.9.1" normalize-url "1.9.1"
@ -14998,10 +14998,10 @@ strip-json-comments@^3.0.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7"
integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==
style-loader@1.0.1: style-loader@1.0.2:
version "1.0.1" version "1.0.2"
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.0.1.tgz#aec6d4c61d0ed8d0a442faed741d4dfc6573888a" resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.0.2.tgz#433d72eab8d1dd7d64c648b8ad7d9cbff3184111"
integrity sha512-CnpEkSR1C+REjudiTWCv4+ssP7SCiuaQZJTZDWBRwTJoS90mdqkB8uOGMHKgVeUzpaU7IfLWoyQbvvs5Joj3Xw== integrity sha512-xehHGWeCPrr+R/bU82To0j7L7ENzH30RHYmMhmAumbuIpQ/bHmv3SAj1aTRfBSszkXoqNtpKnJyWXEDydS+KeA==
dependencies: dependencies:
loader-utils "^1.2.3" loader-utils "^1.2.3"
schema-utils "^2.0.1" schema-utils "^2.0.1"
@ -15208,18 +15208,18 @@ temp@^0.8.3:
dependencies: dependencies:
rimraf "~2.6.2" rimraf "~2.6.2"
terser-webpack-plugin@2.3.0: terser-webpack-plugin@2.3.1:
version "2.3.0" version "2.3.1"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.3.0.tgz#00fd8f792a330dc572e2e2b468fd7cb5ffd7ea51" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.3.1.tgz#6a63c27debc15b25ffd2588562ee2eeabdcab923"
integrity sha512-yez0HdpDf/iQVYGf+e/o8ZYWLb1g9d1nRRi5FIOZ4KfXbfSPT259UoqxPiSLhCnr0mlDoh+bucpYQSFbU0cEsQ== integrity sha512-dNxivOXmDgZqrGxOttBH6B4xaxT4zNC+Xd+2K8jwGDMK5q2CZI+KZMA1AAnSRT+BTRvuzKsDx+fpxzPAmAMVcA==
dependencies: dependencies:
cacache "^13.0.1" cacache "^13.0.1"
find-cache-dir "^3.1.0" find-cache-dir "^3.2.0"
jest-worker "^24.9.0" jest-worker "^24.9.0"
schema-utils "^2.6.1" schema-utils "^2.6.1"
serialize-javascript "^2.1.2" serialize-javascript "^2.1.2"
source-map "^0.6.1" source-map "^0.6.1"
terser "^4.4.2" terser "^4.4.3"
webpack-sources "^1.4.3" webpack-sources "^1.4.3"
terser-webpack-plugin@^1.4.3: terser-webpack-plugin@^1.4.3:
@ -15237,10 +15237,10 @@ terser-webpack-plugin@^1.4.3:
webpack-sources "^1.4.0" webpack-sources "^1.4.0"
worker-farm "^1.7.0" worker-farm "^1.7.0"
terser@^4.1.2, terser@^4.4.2: terser@^4.1.2, terser@^4.4.3:
version "4.4.2" version "4.4.3"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.4.2.tgz#448fffad0245f4c8a277ce89788b458bfd7706e8" resolved "https://registry.yarnpkg.com/terser/-/terser-4.4.3.tgz#401abc52b88869cf904412503b1eb7da093ae2f0"
integrity sha512-Uufrsvhj9O1ikwgITGsZ5EZS6qPokUOkCegS7fYOdGTv+OA90vndUbU6PEjr5ePqHfNUbGyMO7xyIZv2MhsALQ== integrity sha512-0ikKraVtRDKGzHrzkCv5rUNDzqlhmhowOBqC0XqUHFpW+vJ45+20/IFBcebwKfiS2Z9fJin6Eo+F1zLZsxi8RA==
dependencies: dependencies:
commander "^2.20.0" commander "^2.20.0"
source-map "~0.6.1" source-map "~0.6.1"