From 57ddfad2b0112cef5609ac15c9bfa217ab2da40a Mon Sep 17 00:00:00 2001 From: mmv Date: Thu, 20 Jun 2019 15:04:52 +0400 Subject: [PATCH] update tx service history endpoint --- src/config/development.js | 2 +- src/config/production.js | 2 +- src/logic/safe/transactions/send.js | 2 +- src/logic/safe/transactions/txHistory.js | 6 +++--- src/logic/safe/utils/safeStorage.js | 2 +- src/routes/safe/store/actions/createTransaction.js | 2 +- src/routes/safe/store/actions/fetchTransactions.js | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/config/development.js b/src/config/development.js index 6c72b86c..e8b284ab 100644 --- a/src/config/development.js +++ b/src/config/development.js @@ -7,7 +7,7 @@ import { } from '~/config/names' const devConfig = { - [TX_SERVICE_HOST]: 'https://safe-transaction-history.dev.gnosisdev.com/api/v1/', + [TX_SERVICE_HOST]: 'https://safe-transaction-service.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/config/production.js b/src/config/production.js index 5e880d1a..6dc2ebf8 100644 --- a/src/config/production.js +++ b/src/config/production.js @@ -7,7 +7,7 @@ import { } from '~/config/names' const prodConfig = { - [TX_SERVICE_HOST]: 'https://safe-transaction-history.dev.gnosisdev.com/api/v1/', + [TX_SERVICE_HOST]: 'https://safe-transaction-service.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/transactions/send.js b/src/logic/safe/transactions/send.js index c0a16a05..2afc3c69 100644 --- a/src/logic/safe/transactions/send.js +++ b/src/logic/safe/transactions/send.js @@ -66,7 +66,7 @@ export const createTransaction = async (safeAddress: string, to: string, valueIn const web3 = getWeb3() const from = web3.currentProvider.selectedAddress const threshold = await safeInstance.getThreshold() - const nonce = await safeInstance.nonce() + const nonce = (await safeInstance.nonce()).toString() const valueInWei = web3.utils.toWei(valueInEth, 'ether') const isExecution = threshold.toNumber() === 1 diff --git a/src/logic/safe/transactions/txHistory.js b/src/logic/safe/transactions/txHistory.js index d1fc04e3..a4f642fd 100644 --- a/src/logic/safe/transactions/txHistory.js +++ b/src/logic/safe/transactions/txHistory.js @@ -16,7 +16,7 @@ const calculateBodyFrom = async ( nonce: string | number, transactionHash: string, sender: string, - type: TxServiceType, + confirmationType: TxServiceType, ) => { const contractTransactionHash = await safeInstance.getTransactionHash( to, @@ -38,14 +38,14 @@ const calculateBodyFrom = async ( operation, nonce, safeTxGas: 0, - dataGas: 0, + baseGas: 0, gasPrice: 0, gasToken: ZERO_ADDRESS, refundReceiver: ZERO_ADDRESS, contractTransactionHash, transactionHash, sender: getWeb3().utils.toChecksumAddress(sender), - type, + confirmationType, } } diff --git a/src/logic/safe/utils/safeStorage.js b/src/logic/safe/utils/safeStorage.js index 2fdfef40..3a5ad40e 100644 --- a/src/logic/safe/utils/safeStorage.js +++ b/src/logic/safe/utils/safeStorage.js @@ -38,7 +38,7 @@ export const setOwners = async (safeAddress: string, owners: List) => { export const getOwners = async (safeAddress: string): Map => { const data: Object = await loadFromStorage(`${OWNERS_KEY}-${safeAddress}`) - console.log(data) + return data ? Map(data) : Map() } diff --git a/src/routes/safe/store/actions/createTransaction.js b/src/routes/safe/store/actions/createTransaction.js index ecc4634e..b3cd9de0 100644 --- a/src/routes/safe/store/actions/createTransaction.js +++ b/src/routes/safe/store/actions/createTransaction.js @@ -19,7 +19,7 @@ const createTransaction = ( const safeInstance = await getGnosisSafeInstanceAt(safeAddress) const from = userAccountSelector(state) const threshold = await safeInstance.getThreshold() - const nonce = await safeInstance.nonce() + const nonce = (await safeInstance.nonce()).toString() const isExecution = threshold.toNumber() === 1 let txHash diff --git a/src/routes/safe/store/actions/fetchTransactions.js b/src/routes/safe/store/actions/fetchTransactions.js index d26d7ec2..f635ddda 100644 --- a/src/routes/safe/store/actions/fetchTransactions.js +++ b/src/routes/safe/store/actions/fetchTransactions.js @@ -15,7 +15,7 @@ import { addTransactions } from './addTransactions' type ConfirmationServiceModel = { owner: string, submissionDate: Date, - type: string, + confirmationType: string, transactionHash: string, } @@ -40,7 +40,7 @@ const buildTransactionFrom = async (safeAddress: string, tx: TxServiceModel, saf return makeConfirmation({ owner: makeOwner({ address: conf.owner, name: ownerName }), - type: ((conf.type.toLowerCase(): any): TxServiceType), + type: ((conf.confirmationType.toLowerCase(): any): TxServiceType), hash: conf.transactionHash, }) }),