From ee5d7f270b019c0d848a04a281d5ac2916a6d2b8 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Thu, 13 Jun 2019 18:24:58 +0400 Subject: [PATCH] tx list wip, add TransactionsNew folder and skeleton for an api call to save tx --- src/config/development.js | 2 +- src/logic/safe/api/index.js | 1 + src/logic/safe/api/saveTxViaService.js | 18 ++++++++++++++++ src/routes/safe/components/Layout.jsx | 2 ++ .../TransactionsNew/NoTransactions/index.jsx | 18 ++++++++++++++++ .../safe/components/TransactionsNew/index.jsx | 21 +++++++++++++++++++ 6 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 src/logic/safe/api/saveTxViaService.js create mode 100644 src/routes/safe/components/TransactionsNew/NoTransactions/index.jsx create mode 100644 src/routes/safe/components/TransactionsNew/index.jsx diff --git a/src/config/development.js b/src/config/development.js index 0f222de7..444b0014 100644 --- a/src/config/development.js +++ b/src/config/development.js @@ -7,7 +7,7 @@ import { } from '~/config/names' const devConfig = { - [TX_SERVICE_HOST]: 'http://localhost:8000/api/v1/', + [TX_SERVICE_HOST]: 'https://safe-transaction-history.dev.gnosisdev.com/api/v1/', [ENABLED_TX_SERVICE_REMOVAL_SENDER]: false, [SIGNATURES_VIA_METAMASK]: false, [RELAY_API_URL]: 'https://safe-relay.staging.gnosisdev.com/api/v1', diff --git a/src/logic/safe/api/index.js b/src/logic/safe/api/index.js index 84217f7b..5d04edda 100644 --- a/src/logic/safe/api/index.js +++ b/src/logic/safe/api/index.js @@ -1,3 +1,4 @@ // @flow export * from './estimateTxGas' +export * from './saveTxViaService' \ No newline at end of file diff --git a/src/logic/safe/api/saveTxViaService.js b/src/logic/safe/api/saveTxViaService.js new file mode 100644 index 00000000..1ed2b845 --- /dev/null +++ b/src/logic/safe/api/saveTxViaService.js @@ -0,0 +1,18 @@ +// @flow +import axios from 'axios' +import { getTxServiceUriFrom, getTxServiceHost } from '~/config/index' + +export const saveTxViaService = (safeAddress: string, to: string, value: string, data, operation = 0) => { + const txServiceHost = getTxServiceHost() + const txServiceUri = getTxServiceUriFrom(safeAddress) + const url = `${txServiceHost}${txServiceUri}` + // const estimationValue = isTokenTransfer(tx.data) ? '0' : value.toString(10) + + return axios.post(url, { + safe: safeAddress, + to, + data: '0x', + value, + operation, + }) +} diff --git a/src/routes/safe/components/Layout.jsx b/src/routes/safe/components/Layout.jsx index 4383a63f..055b03be 100644 --- a/src/routes/safe/components/Layout.jsx +++ b/src/routes/safe/components/Layout.jsx @@ -19,6 +19,7 @@ import { } from '~/theme/variables' import { copyToClipboard } from '~/utils/clipboard' import Balances from './Balances' +import Transactions from './TransactionsNew' type Props = SelectorProps & { classes: Object, @@ -141,6 +142,7 @@ class Layout extends React.Component { createTransaction={createTransaction} /> )} + {tabIndex === 1 && } ) } diff --git a/src/routes/safe/components/TransactionsNew/NoTransactions/index.jsx b/src/routes/safe/components/TransactionsNew/NoTransactions/index.jsx new file mode 100644 index 00000000..f6e99d08 --- /dev/null +++ b/src/routes/safe/components/TransactionsNew/NoTransactions/index.jsx @@ -0,0 +1,18 @@ +// @flow +import * as React from 'react' +import Bold from '~/components/layout/Bold' +import Col from '~/components/layout/Col' +import Row from '~/components/layout/Row' +import Paragraph from '~/components/layout/Paragraph/index' + +const NoRights = () => ( + + + + No transactions found for this safe + + + +) + +export default NoRights diff --git a/src/routes/safe/components/TransactionsNew/index.jsx b/src/routes/safe/components/TransactionsNew/index.jsx new file mode 100644 index 00000000..1e979ebc --- /dev/null +++ b/src/routes/safe/components/TransactionsNew/index.jsx @@ -0,0 +1,21 @@ +// @flow +import * as React from 'react' +import { List } from 'immutable' +import NoTransactions from '~/routes/safe/components/Transactions/NoTransactions' + +type Props = SelectorProps & + Actions & { + safeName: string, + safeAddress: string, + threshold: number, + } +class Transactions extends React.Component { + render() { + const { transactions = List(), safeName, threshold } = this.props + const hasTransactions = false + + return {hasTransactions ?
: } + } +} + +export default Transactions