Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/logic/contracts/generateBatchRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,18 @@ const generateBatchRequests = ({ abi, address, batch, context, methods }: any):
request = contractInstance.methods[method](...args).call.request(resolver)
}

// If batch was provided add to external batch
batch ? batch.add(request) : localBatch.add(request)
} catch (e) {
resolve(null)
}
})
})

// TODO fix this so all batch.execute() are handled here
// If batch was created locally we can already execute it
// If batch was provided we should execute once we finish to generate the batch,
// in the outside function where the batch object is created.
!batch && localBatch.execute()

const returnValues = context ? [context, ...values] : values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ const batchIncomingTxsTokenDataRequest = (txs: IncomingTxServiceModel[]) => {
const batch = new web3ReadOnly.BatchRequest()

const whenTxsValues = txs.map((tx) => {
const methods = ['symbol', 'decimals', { method: 'getTransaction', args: [tx.transactionHash], type: 'eth' }]
const methods = [
'symbol',
'decimals',
{ method: 'getTransaction', args: [tx.transactionHash], type: 'eth' },
{ method: 'getTransactionReceipt', args: [tx.transactionHash], type: 'eth' },
]

return generateBatchRequests({
abi: ALTERNATIVE_TOKEN_ABI,
Expand All @@ -59,11 +64,11 @@ const batchIncomingTxsTokenDataRequest = (txs: IncomingTxServiceModel[]) => {
batch.execute()

return Promise.all(whenTxsValues).then((txsValues) =>
txsValues.map(([tx, symbol, decimals, { gas, gasPrice }]) => [
txsValues.map(([tx, symbol, decimals, { gasPrice }, { gasUsed }]) => [
tx,
symbol === null ? 'ETH' : symbol,
decimals === null ? '18' : decimals,
new bn(gas).div(gasPrice).toFixed(),
new bn(gasPrice).times(gasUsed),
]),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ export const buildTx = async ({
executionDate: tx.executionDate,
executionTxHash: tx.transactionHash,
executor: tx.executor,
fee: tx.fee,
gasPrice: tx.gasPrice,
gasToken: tx.gasToken || ZERO_ADDRESS,
isCancellationTx,
Expand Down
2 changes: 1 addition & 1 deletion src/logic/safe/transactions/incomingTxHistory.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getIncomingTxServiceUriTo, getTxServiceHost } from 'src/config'
import { checksumAddress } from 'src/utils/checksumAddress'

export const buildIncomingTxServiceUrl = (safeAddress) => {
export const buildIncomingTxServiceUrl = (safeAddress: string): string => {
const host = getTxServiceHost()
const address = checksumAddress(safeAddress)
const base = getIncomingTxServiceUriTo(address)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Hairline from 'src/components/layout/Hairline'
import Paragraph from 'src/components/layout/Paragraph'
import Row from 'src/components/layout/Row'
import Span from 'src/components/layout/Span'
import { getWeb3 } from 'src/logic/wallets/getWeb3'
import { INCOMING_TX_TYPES } from 'src/logic/safe/store/models/incomingTransaction'
import { safeNonceSelector, safeThresholdSelector } from 'src/logic/safe/store/selectors'
import { Transaction, TransactionTypes } from 'src/logic/safe/store/models/types/transaction'
Expand All @@ -34,6 +35,8 @@ interface ExpandedTxProps {
}

const ExpandedTx = ({ cancelTx, tx }: ExpandedTxProps): React.ReactElement => {
const { fromWei, toBN } = getWeb3().utils

const classes = useStyles()
const nonce = useSelector(safeNonceSelector)
const threshold = useSelector(safeThresholdSelector) as number
Expand Down Expand Up @@ -85,7 +88,7 @@ const ExpandedTx = ({ cancelTx, tx }: ExpandedTxProps): React.ReactElement => {
{!isCreationTx ? (
<Paragraph noMargin>
<Bold>Fee: </Bold>
{tx.fee ? tx.fee : 'n/a'}
{tx.fee ? fromWei(toBN(tx.fee)) + ' ETH' : 'n/a'}
</Paragraph>
) : null}
<CreationTx tx={tx} />
Expand Down