add decodedParams to transaction model
This commit is contained in:
parent
d7ef87b0bf
commit
ff49f3c6c2
|
@ -62,33 +62,34 @@ const buildTransactionFrom = async (safeAddress: string, tx: TxServiceModel, saf
|
||||||
}
|
}
|
||||||
|
|
||||||
let symbol = 'ETH'
|
let symbol = 'ETH'
|
||||||
let recipient = tx.to
|
let decodedParams
|
||||||
let value = tx.value.toString()
|
|
||||||
if (isToken) {
|
if (isToken) {
|
||||||
const tokenContract = await getHumanFriendlyToken()
|
const tokenContract = await getHumanFriendlyToken()
|
||||||
const tokenInstance = await tokenContract.at(tx.to)
|
const tokenInstance = await tokenContract.at(tx.to)
|
||||||
symbol = await tokenInstance.symbol()
|
symbol = await tokenInstance.symbol()
|
||||||
|
|
||||||
const decodedParams = web3.eth.abi.decodeParameters(['address', 'uint256'], tx.data.slice(10))
|
const params = web3.eth.abi.decodeParameters(['address', 'uint256'], tx.data.slice(10))
|
||||||
/* eslint-disable */
|
decodedParams = {
|
||||||
recipient = decodedParams[0]
|
recipient: params[0],
|
||||||
value = decodedParams[1]
|
value: params[1],
|
||||||
/* eslint-enable */
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return makeTransaction({
|
return makeTransaction({
|
||||||
name,
|
name,
|
||||||
symbol,
|
symbol,
|
||||||
nonce: tx.nonce,
|
nonce: tx.nonce,
|
||||||
value,
|
value: tx.value.toString(),
|
||||||
confirmations,
|
confirmations,
|
||||||
recipient,
|
recipient: tx.to,
|
||||||
data: tx.data ? tx.data : EMPTY_DATA,
|
data: tx.data ? tx.data : EMPTY_DATA,
|
||||||
isExecuted: tx.isExecuted,
|
isExecuted: tx.isExecuted,
|
||||||
submissionDate: tx.submissionDate,
|
submissionDate: tx.submissionDate,
|
||||||
executionDate: tx.executionDate,
|
executionDate: tx.executionDate,
|
||||||
executionTxHash,
|
executionTxHash,
|
||||||
creationTxHash,
|
creationTxHash,
|
||||||
|
isToken,
|
||||||
|
decodedParams,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ export type TransactionProps = {
|
||||||
executionTxHash?: string,
|
executionTxHash?: string,
|
||||||
cancelled?: boolean,
|
cancelled?: boolean,
|
||||||
status?: TransactionStatus,
|
status?: TransactionStatus,
|
||||||
|
isToken: boolean,
|
||||||
|
decodedParams?: Object,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const makeTransaction: RecordFactory<TransactionProps> = Record({
|
export const makeTransaction: RecordFactory<TransactionProps> = Record({
|
||||||
|
@ -37,6 +39,8 @@ export const makeTransaction: RecordFactory<TransactionProps> = Record({
|
||||||
creationTxHash: '',
|
creationTxHash: '',
|
||||||
cancelled: false,
|
cancelled: false,
|
||||||
status: 'awaiting',
|
status: 'awaiting',
|
||||||
|
isToken: false,
|
||||||
|
decodedParams: {},
|
||||||
})
|
})
|
||||||
|
|
||||||
export type Transaction = RecordOf<TransactionProps>
|
export type Transaction = RecordOf<TransactionProps>
|
||||||
|
|
Loading…
Reference in New Issue