optimistic updates in createTransaction.js wip
This commit is contained in:
parent
d2f80ead61
commit
db5c69be59
|
@ -46,7 +46,7 @@
|
|||
"@material-ui/core": "4.9.11",
|
||||
"@material-ui/icons": "4.9.1",
|
||||
"@material-ui/lab": "4.0.0-alpha.39",
|
||||
"@openzeppelin/contracts": "^2.5.0",
|
||||
"@openzeppelin/contracts": "3.0.0",
|
||||
"@testing-library/jest-dom": "5.5.0",
|
||||
"@welldone-software/why-did-you-render": "4.0.8",
|
||||
"async-sema": "^3.1.0",
|
||||
|
@ -115,13 +115,13 @@
|
|||
"@babel/preset-env": "7.9.5",
|
||||
"@babel/preset-flow": "7.9.0",
|
||||
"@babel/preset-react": "7.9.4",
|
||||
"@testing-library/react": "10.0.2",
|
||||
"@testing-library/react": "10.0.3",
|
||||
"autoprefixer": "9.7.6",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"babel-eslint": "10.1.0",
|
||||
"babel-jest": "25.4.0",
|
||||
"babel-loader": "8.1.0",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.0",
|
||||
"babel-plugin-dynamic-import-node": "2.3.2",
|
||||
"babel-plugin-transform-es3-member-expression-literals": "^6.22.0",
|
||||
"babel-plugin-transform-es3-property-literals": "^6.22.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
|
|
|
@ -36,6 +36,16 @@ export const getAddressBookListSelector: Selector<GlobalState, {}, List<AddressB
|
|||
},
|
||||
)
|
||||
|
||||
export const nameFromAddressBookSelector = createSelector(
|
||||
addressBookMapSelector,
|
||||
safeParamAddressFromStateSelector,
|
||||
(addressBook, address): string => {
|
||||
const adbkEntry = addressBook.find((entry) => entry.address === address)
|
||||
|
||||
return adbkEntry ? adbkEntry.name : 'UNKNOWN'
|
||||
},
|
||||
)
|
||||
|
||||
export const getNameFromAddressBook = (userAddress: string): string | null => {
|
||||
if (!userAddress) {
|
||||
return null
|
||||
|
|
|
@ -9,6 +9,7 @@ import { makeConfirmation } from '../models/confirmation'
|
|||
import updateTransaction from './updateTransaction'
|
||||
|
||||
import { onboardUser } from '~/components/ConnectButton'
|
||||
import { nameFromAddressBookSelector } from '~/logic/addressBook/store/selectors/index'
|
||||
import { getGnosisSafeInstanceAt } from '~/logic/contracts/safeContracts'
|
||||
import { type NotificationsQueue, getNotificationsFromTxType, showSnackbar } from '~/logic/notifications'
|
||||
import {
|
||||
|
@ -167,19 +168,25 @@ const createTransaction = ({
|
|||
.then((receipt) => {
|
||||
console.log(receipt)
|
||||
closeSnackbar(pendingExecutionKey)
|
||||
const safeTxHash = isExecution ? 'lol' : receipt.events.ApproveHash.returnValues[0]
|
||||
const safeTxHash = isExecution
|
||||
? receipt.events.ExecutionSuccess.returnValues[0]
|
||||
: receipt.events.ApproveHash.returnValues[0]
|
||||
|
||||
dispatch(
|
||||
updateTransaction({
|
||||
safeAddress,
|
||||
transaction: {
|
||||
safeTxHash,
|
||||
isExecuted: isExecution,
|
||||
isSuccessful: isExecution ? true : null,
|
||||
executionTxHash: isExecution ? receipt.transactionHash : null,
|
||||
executor: isExecution ? from : null,
|
||||
confirmations: List([
|
||||
makeConfirmation({
|
||||
type: 'confirmation',
|
||||
hash: receipt.transactionHash,
|
||||
signature: sigs,
|
||||
owner: { address: '0x000', name: 'Test' },
|
||||
owner: { address: from, name: nameFromAddressBookSelector(state, from) },
|
||||
}),
|
||||
]),
|
||||
},
|
||||
|
|
23
yarn.lock
23
yarn.lock
|
@ -1549,10 +1549,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
|
||||
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==
|
||||
|
||||
"@openzeppelin/contracts@^2.5.0":
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-2.5.0.tgz#e327a98ba1d26b7756ff62885a0aa0967a375449"
|
||||
integrity sha512-t3jm8FrhL9tkkJTofkznTqo/XXdHi21w5yXwalEnaMOp22ZwZ0f/mmKdlgMMLPFa6bSVHbY88mKESwJT/7m5Lg==
|
||||
"@openzeppelin/contracts@3.0.0":
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-3.0.0.tgz#89bc0d32fc9eb257cf6499f2497a1b4a6715f186"
|
||||
integrity sha512-u7oATjUK6jffDOoIjVQ7vJ2fnFKlfDS1CJzrMpp+YtGQ2fhdSk0kXjZTxk8Pj1SPVZRNES3yo0r144v8BsuRhQ==
|
||||
|
||||
"@portis/eth-json-rpc-middleware@^4.1.2":
|
||||
version "4.1.2"
|
||||
|
@ -1713,10 +1713,10 @@
|
|||
lodash "^4.17.15"
|
||||
redent "^3.0.0"
|
||||
|
||||
"@testing-library/react@10.0.2":
|
||||
version "10.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-10.0.2.tgz#8eca7aa52d810cf7150048a2829fdc487162006d"
|
||||
integrity sha512-YT6Mw0oJz7R6vlEkmo1FlUD+K15FeXApOB5Ffm9zooFVnrwkt00w18dUJFMOh1yRp9wTdVRonbor7o4PIpFCmA==
|
||||
"@testing-library/react@10.0.3":
|
||||
version "10.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-10.0.3.tgz#7781adc75cce172f8cda28faa77be29c6270ab43"
|
||||
integrity sha512-EVmd3ghDFBEjOSLnISUdi7OcLdP6tsqjmTprpMaBz5TreoM8jnxGKIPkLD579CE0LYGqK01iffQiy6wwW/RUig==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.9.2"
|
||||
"@testing-library/dom" "^7.1.0"
|
||||
|
@ -3411,6 +3411,13 @@ babel-plugin-check-es2015-constants@^6.22.0:
|
|||
dependencies:
|
||||
babel-runtime "^6.22.0"
|
||||
|
||||
babel-plugin-dynamic-import-node@2.3.2:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.2.tgz#14fb5accb300f9aac0151949f6192259f1403c4a"
|
||||
integrity sha512-yvczAMjbc73xira9yTyF1XnEmkX8QwlUhmxuhimeMUeAaA6s7busTPRVDzhVG7eeBdNcRiZ/mAwFrJ9It4vQcg==
|
||||
dependencies:
|
||||
object.assign "^4.1.0"
|
||||
|
||||
babel-plugin-dynamic-import-node@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f"
|
||||
|
|
Loading…
Reference in New Issue