Merge branch 'development' of github.com:gnosis/safe-react into feature/#512-network-switching
This commit is contained in:
commit
096938ad59
54
readme.md
54
readme.md
|
@ -21,13 +21,20 @@ These instructions will get you a copy of the project up and running on your loc
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
What you need to install globally:
|
We use [yarn](https://yarnpkg.com) in our infrastructure, so we decided to go with yarn in the README.
|
||||||
|
Please install yarn globally if you haven't already.
|
||||||
|
|
||||||
|
### Environment variables
|
||||||
|
The app grabs environment variables from the `.env` file. Copy our template to your own local file:
|
||||||
```
|
```
|
||||||
yarn global add truffle ganache-cli
|
cp .env.example .env
|
||||||
```
|
```
|
||||||
|
|
||||||
We use [yarn](https://yarnpkg.com) in our infrastructure, so we decided to go with yarn in the README
|
To execute transactions, you'll need to create an [Infura](https://infura.io) project and set the project ID in the `.env` you've just created:
|
||||||
|
```
|
||||||
|
REACT_APP_INFURA_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||||
|
```
|
||||||
|
Once done, you'll need to restart the app if it's already running.
|
||||||
|
|
||||||
### Installing and running
|
### Installing and running
|
||||||
|
|
||||||
|
@ -46,18 +53,6 @@ If you prefer using the Mainnet ones:
|
||||||
yarn start-mainnet
|
yarn start-mainnet
|
||||||
```
|
```
|
||||||
|
|
||||||
### Environment variables
|
|
||||||
The app grabs environment variables from the `.env` file. Copy our template to your own local file:
|
|
||||||
```
|
|
||||||
cp .env.example .env
|
|
||||||
```
|
|
||||||
|
|
||||||
To execute transactions, you'll need to create an [Infura](https://infura.io) project and set the project ID in the `.env` you've just created:
|
|
||||||
```
|
|
||||||
REACT_APP_INFURA_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
||||||
```
|
|
||||||
Once done, you'll need to restart the app.
|
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
For Rinkeby:
|
For Rinkeby:
|
||||||
```
|
```
|
||||||
|
@ -72,31 +67,7 @@ yarn build-mainnet
|
||||||
|
|
||||||
## Running the tests
|
## Running the tests
|
||||||
|
|
||||||
1. Run `transaction-history-service`
|
To run the tests:
|
||||||
```
|
|
||||||
git clone https://github.com/gnosis/safe-transaction-service.git
|
|
||||||
cd safe-transaction-service
|
|
||||||
git checkout develop
|
|
||||||
docker-compose build
|
|
||||||
# it comes enabled by default in docker-compose
|
|
||||||
sudo service postgresql stop
|
|
||||||
docker-compose up -d
|
|
||||||
```
|
|
||||||
Check that the service is running at https://localhost:8000
|
|
||||||
|
|
||||||
2. Migrate Safe Contracts:
|
|
||||||
```
|
|
||||||
git clone https://github.com/gnosis/safe-contracts.git
|
|
||||||
cd safe-contracts
|
|
||||||
yarn
|
|
||||||
npx truffle migrate
|
|
||||||
```
|
|
||||||
3. Migrate Token Contracts for the tests:
|
|
||||||
Inside `safe-react` directory
|
|
||||||
```
|
|
||||||
npx truffle migrate
|
|
||||||
```
|
|
||||||
4. Run the tests:
|
|
||||||
```
|
```
|
||||||
yarn test
|
yarn test
|
||||||
```
|
```
|
||||||
|
@ -105,7 +76,6 @@ yarn test
|
||||||
|
|
||||||
ESLint will be run automatically before you commit. To run it manually:
|
ESLint will be run automatically before you commit. To run it manually:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
yarn lint:fix
|
yarn lint:fix
|
||||||
```
|
```
|
||||||
|
@ -134,8 +104,6 @@ We prepare a new release every sprint. Sprints are two weeks long.
|
||||||
|
|
||||||
## Built With
|
## Built With
|
||||||
|
|
||||||
* [Truffle React Box](https://github.com/truffle-box/react-box) - The web framework used
|
|
||||||
* [Ganache](https://github.com/trufflesuite/ganache-cli) - Fast Ethereum RPC client
|
|
||||||
* [React](https://reactjs.org/) - A JS library for building user interfaces
|
* [React](https://reactjs.org/) - A JS library for building user interfaces
|
||||||
* [Material UI 4.X](https://material-ui.com/) - React components that implement Google's Material Design
|
* [Material UI 4.X](https://material-ui.com/) - React components that implement Google's Material Design
|
||||||
* [redux, immutable, reselect, final-form](https://redux.js.org/) - React ecosystem libraries
|
* [redux, immutable, reselect, final-form](https://redux.js.org/) - React ecosystem libraries
|
||||||
|
|
|
@ -142,14 +142,17 @@ class GnoTable extends React.Component<any, any> {
|
||||||
const orderParam = order || defaultOrder
|
const orderParam = order || defaultOrder
|
||||||
const displayRows = rowsPerPage || defaultRowsPerPage
|
const displayRows = rowsPerPage || defaultRowsPerPage
|
||||||
const fixedParam = typeof fixed !== 'undefined' ? fixed : !!defaultFixed
|
const fixedParam = typeof fixed !== 'undefined' ? fixed : !!defaultFixed
|
||||||
|
|
||||||
const paginationClasses = {
|
const paginationClasses = {
|
||||||
selectRoot: classes.selectRoot,
|
selectRoot: classes.selectRoot,
|
||||||
root: !noBorder && classes.paginationRoot,
|
root: !noBorder && classes.paginationRoot,
|
||||||
input: classes.white,
|
input: classes.white,
|
||||||
}
|
}
|
||||||
|
const columnSort = columns.find((column) => column.id === orderByParam)
|
||||||
let sortedData = stableSort(data, getSorting(orderParam, orderByParam, orderProp), fixedParam)
|
let sortedData = stableSort(
|
||||||
|
data,
|
||||||
|
getSorting(orderParam, orderByParam, orderProp, columnSort?.formatTypeSort),
|
||||||
|
fixedParam,
|
||||||
|
)
|
||||||
|
|
||||||
if (!disablePagination) {
|
if (!disablePagination) {
|
||||||
sortedData = sortedData.slice(page * displayRows, page * displayRows + displayRows)
|
sortedData = sortedData.slice(page * displayRows, page * displayRows + displayRows)
|
||||||
|
|
|
@ -4,13 +4,19 @@ export const FIXED = 'fixed'
|
||||||
|
|
||||||
export const buildOrderFieldFrom = (attr: string): string => `${attr}Order`
|
export const buildOrderFieldFrom = (attr: string): string => `${attr}Order`
|
||||||
|
|
||||||
const desc = (a: string, b: string, orderBy: string, orderProp: boolean): number => {
|
const desc = (
|
||||||
|
a: string,
|
||||||
|
b: string,
|
||||||
|
orderBy: string,
|
||||||
|
orderProp: boolean,
|
||||||
|
format: (value: string | number) => string | number,
|
||||||
|
): number => {
|
||||||
const order = orderProp ? buildOrderFieldFrom(orderBy) : orderBy
|
const order = orderProp ? buildOrderFieldFrom(orderBy) : orderBy
|
||||||
|
|
||||||
if (b[order] < a[order]) {
|
if (format(b[order]) < format(a[order])) {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
if (b[order] > a[order]) {
|
if (format(b[order]) > format(a[order])) {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,5 +48,8 @@ export const getSorting = (
|
||||||
order: 'desc' | 'asc',
|
order: 'desc' | 'asc',
|
||||||
orderBy: string,
|
orderBy: string,
|
||||||
orderProp: boolean,
|
orderProp: boolean,
|
||||||
|
format: (value: string | number) => string | number = (value) => value,
|
||||||
): ((a: string, b: string) => number) =>
|
): ((a: string, b: string) => number) =>
|
||||||
order === 'desc' ? (a, b) => desc(a, b, orderBy, orderProp) : (a, b) => -desc(a, b, orderBy, orderProp)
|
order === 'desc'
|
||||||
|
? (a, b) => desc(a, b, orderBy, orderProp, format)
|
||||||
|
: (a, b) => -desc(a, b, orderBy, orderProp, format)
|
||||||
|
|
|
@ -7,5 +7,6 @@ export interface TableColumn {
|
||||||
order: boolean
|
order: boolean
|
||||||
static?: boolean
|
static?: boolean
|
||||||
style?: any
|
style?: any
|
||||||
|
formatTypeSort?: (value: string | number) => string | number
|
||||||
width?: number
|
width?: number
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ export const generateColumns = (): List<TableColumn> => {
|
||||||
const nameColumn: TableColumn = {
|
const nameColumn: TableColumn = {
|
||||||
id: OWNERS_TABLE_NAME_ID,
|
id: OWNERS_TABLE_NAME_ID,
|
||||||
order: false,
|
order: false,
|
||||||
|
formatTypeSort: (value: string) => value.toLowerCase(),
|
||||||
disablePadding: false,
|
disablePadding: false,
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
width: 150,
|
width: 150,
|
||||||
|
|
|
@ -24,8 +24,6 @@ export const COLLECTIBLES_SOURCE = process.env.REACT_APP_COLLECTIBLES_SOURCE ||
|
||||||
export const TIMEOUT = process.env.NODE_ENV === 'test' ? 1500 : 5000
|
export const TIMEOUT = process.env.NODE_ENV === 'test' ? 1500 : 5000
|
||||||
export const ETHERSCAN_API_KEY = process.env.REACT_APP_ETHERSCAN_API_KEY
|
export const ETHERSCAN_API_KEY = process.env.REACT_APP_ETHERSCAN_API_KEY
|
||||||
export const ETHGASSTATION_API_KEY = process.env.REACT_APP_ETHGASSTATION_API_KEY
|
export const ETHGASSTATION_API_KEY = process.env.REACT_APP_ETHGASSTATION_API_KEY
|
||||||
export const EXCHANGE_RATE_URL = 'https://api.exchangeratesapi.io/latest'
|
|
||||||
export const EXCHANGE_RATE_URL_FALLBACK = 'https://api.coinbase.com/v2/exchange-rates'
|
|
||||||
export const SAFE_APPS_LIST_URL =
|
export const SAFE_APPS_LIST_URL =
|
||||||
process.env.REACT_APP_SAFE_APPS_LIST_URL ||
|
process.env.REACT_APP_SAFE_APPS_LIST_URL ||
|
||||||
'https://raw.githubusercontent.com/gnosis/safe-apps-list/main/public/gnosis-default.applist.json'
|
'https://raw.githubusercontent.com/gnosis/safe-apps-list/main/public/gnosis-default.applist.json'
|
||||||
|
|
16
truffle.js
16
truffle.js
|
@ -1,16 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
migrations_directory: './migrations',
|
|
||||||
networks: {
|
|
||||||
development: {
|
|
||||||
host: 'localhost',
|
|
||||||
port: 8545,
|
|
||||||
network_id: '*', //* Match any network id
|
|
||||||
},
|
|
||||||
},
|
|
||||||
solc: {
|
|
||||||
optimizer: {
|
|
||||||
enabled: true,
|
|
||||||
runs: 500,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
Loading…
Reference in New Issue