From 49f000447c389ca813a57c588e96122d6d927ae7 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Fri, 12 Apr 2019 18:41:47 +0400 Subject: [PATCH] update readme --- readme.md | 14 ++++---- .../safe/component/Balances/Tokens/actions.js | 11 +++---- src/routes/safe/container/actions.js | 2 +- src/routes/safe/store/actions/addSafe.js | 10 +++--- .../safe/store/actions/updateActiveTokens.js | 32 ++++++++++++++++--- src/routes/safe/store/models/safe.js | 2 +- 6 files changed, 46 insertions(+), 25 deletions(-) diff --git a/readme.md b/readme.md index 2101aecc..3cc96031 100644 --- a/readme.md +++ b/readme.md @@ -11,12 +11,14 @@ These instructions will get you a copy of the project up and running on your loc What things you need to install the software and how to install them ``` -npm install truffle // recommended usage of -g flag -npm install ganache-cli // recommended usage of -g flag -npm install flow-type // recommended usage of -g flag +yarn add truffle // recommended usage of -g flag +yarn add ganache-cli // recommended usage of -g flag +yarn add flow-type // recommended usage of -g flag git clone https://github.com/gnosis/safe-contracts.git ``` +We use [yarn](https://yarnpkg.com) in our infrastacture, so we decided to go with yarn in the README + ### Installing A step by step series of examples that tell you have to get a development env running @@ -29,14 +31,14 @@ ganache-cli -b 3 Start the project in the other one ``` cd safe-contracts && truffle compile && truffle migrate && cd .. -npm install -npm start +yarn install +yarn start ``` ## Running the tests ``` -npm test +yarn test ``` diff --git a/src/routes/safe/component/Balances/Tokens/actions.js b/src/routes/safe/component/Balances/Tokens/actions.js index dfede044..8ed94ed6 100644 --- a/src/routes/safe/component/Balances/Tokens/actions.js +++ b/src/routes/safe/component/Balances/Tokens/actions.js @@ -1,16 +1,13 @@ // @flow -import enableToken from '~/logic/tokens/store/actions/enableToken' -import disableToken from '~/logic/tokens/store/actions/disableToken' import fetchTokens from '~/logic/tokens/store/actions/fetchTokens' +import updateActiveTokens from '~/routes/safe/store/actions/updateActiveTokens' export type Actions = { - enableToken: Function, - disableToken: Function, - fetchTokens: Function + fetchTokens: Function, + updateActiveTokens: Function } export default { - enableToken, - disableToken, fetchTokens, + updateActiveTokens, } diff --git a/src/routes/safe/container/actions.js b/src/routes/safe/container/actions.js index 5450856a..f9808ded 100644 --- a/src/routes/safe/container/actions.js +++ b/src/routes/safe/container/actions.js @@ -6,7 +6,7 @@ import fetchTokenBalances from '~/routes/safe/store/actions/fetchTokenBalances' export type Actions = { fetchSafe: typeof fetchSafe, loadActiveTokens: typeof loadActiveTokens, - fetchTokenBalances: typeof fetchTokenBalances + fetchTokenBalances: typeof fetchTokenBalances, } export default { diff --git a/src/routes/safe/store/actions/addSafe.js b/src/routes/safe/store/actions/addSafe.js index 23f0d04f..c6d237ea 100644 --- a/src/routes/safe/store/actions/addSafe.js +++ b/src/routes/safe/store/actions/addSafe.js @@ -1,11 +1,11 @@ // @flow import { List } from 'immutable' import { createAction } from 'redux-actions' -import SafeRecord, { type Safe } from '~/routes/safe/store/models/safe' -import { saveSafes, setOwners } from '~/logic/safe/utils' -import { makeOwner, type Owner } from '~/routes/safe/store/models/owner' import type { Dispatch as ReduxDispatch, GetState } from 'redux' -import { type GlobalState } from '~/store/index' +import { type GlobalState } from '~/store' +import { saveSafes, setOwners } from '~/logic/safe/utils' +import SafeRecord, { type Safe } from '~/routes/safe/store/models/safe' +import { makeOwner, type Owner } from '~/routes/safe/store/models/owner' import { safesMapSelector } from '~/routes/safeList/store/selectors/index' export const ADD_SAFE = 'ADD_SAFE' @@ -20,7 +20,7 @@ type ActionReturn = { safe: Safe, } -export const addSafe = createAction( +export const addSafe = createAction( ADD_SAFE, (safe: Safe): ActionReturn => ({ safe, diff --git a/src/routes/safe/store/actions/updateActiveTokens.js b/src/routes/safe/store/actions/updateActiveTokens.js index d8a57afc..d9d19fad 100644 --- a/src/routes/safe/store/actions/updateActiveTokens.js +++ b/src/routes/safe/store/actions/updateActiveTokens.js @@ -1,7 +1,29 @@ // @flow -import updateSafe from './updateSafe' -import type { SafeToken, Token } from '~/logic/tokens/store/model' +import { createAction } from 'redux-actions' +import type { Dispatch as ReduxDispatch } from 'redux' +import { type GlobalState } from '~/store' +import type { SafeToken } from '~/routes/safe/store/models/safeToken' +import SafeTokenRecord from '~/routes/safe/store/models/safeToken' -const updateActiveTokens = (tokenAddress: string) => { - -} \ No newline at end of file +export const UPDATE_SAFE_TOKENS = 'UPDATE_SAFE_TOKENS' + +type ActionReturn = { + token: SafeToken, +} + +export const updateTokenAction = createAction( + UPDATE_SAFE_TOKENS, + (token: SafeToken): ActionReturn => ({ + token, + }), +) + +const updateActiveTokens = (safeAddress: string, tokenAddress: string) => async ( + dispatch: ReduxDispatch, +) => { + const token: SafeToken = SafeTokenRecord({ address: tokenAddress }) + + dispatch(updateTokenAction(token)) +} + +export default updateActiveTokens diff --git a/src/routes/safe/store/models/safe.js b/src/routes/safe/store/models/safe.js index f8b523ca..32bfdcd6 100644 --- a/src/routes/safe/store/models/safe.js +++ b/src/routes/safe/store/models/safe.js @@ -8,9 +8,9 @@ export type SafeProps = { name: string, address: string, threshold: number, - ethBalance: string, owners: List, tokens?: List, + ethBalance?: string, } const SafeRecord: RecordFactory = Record({