Merge branch 'development' into release-2.11.0

This commit is contained in:
nicosampler 2020-08-28 16:23:43 -03:00
commit f04ec4c169
5 changed files with 24 additions and 23 deletions

View File

@ -4,9 +4,9 @@ export enum TxConstants {
}
export enum Operation {
CALL = 'CALL',
DELEGATE_CALL = 'DELEGATE_CALL',
CREATE = 'CREATE',
CALL,
DELEGATE_CALL,
CREATE,
}
// types comes from: https://github.com/gnosis/safe-client-gateway/blob/752e76b6d1d475791dbd7917b174bb41d2d9d8be/src/utils.rs
@ -35,12 +35,12 @@ export enum SettingsChangeMethods {
// note: this extends SAFE_METHODS_NAMES in /logic/contracts/methodIds.ts, we need to figure out which one we are going to use
export type DataDecodedMethod = TransferMethods | SettingsChangeMethods | string
export interface DecodedValue {
export interface ValueDecoded {
operation: Operation
to: string
value: number
data: string
decodedData: DataDecoded
dataDecoded: DataDecoded
}
export interface SingleTransactionMethodParameter {
@ -50,7 +50,7 @@ export interface SingleTransactionMethodParameter {
}
export interface MultiSendMethodParameter extends SingleTransactionMethodParameter {
decodedValue: DecodedValue[]
valueDecoded: ValueDecoded[]
}
export type Parameter = MultiSendMethodParameter | SingleTransactionMethodParameter

View File

@ -8,7 +8,7 @@ import Value from './Value'
import Block from 'src/components/layout/Block'
import {
extractMultiSendDecodedData,
extractMultiSendDataDecoded,
MultiSendDetails,
} from 'src/routes/safe/store/actions/transactions/utils/multiSendDecodedDetails'
import Bold from 'src/components/layout/Bold'
@ -198,7 +198,7 @@ interface CustomDescriptionProps {
}
const CustomDescription = ({ amount, data, recipient, storedTx }: CustomDescriptionProps): React.ReactElement => {
const txDetails = (storedTx.multiSendTx && extractMultiSendDecodedData(storedTx).txDetails) ?? undefined
const txDetails = (storedTx.multiSendTx && extractMultiSendDataDecoded(storedTx).txDetails) ?? undefined
return txDetails ? (
<MultiSendCustomData txDetails={txDetails} />

View File

@ -17,13 +17,13 @@ import { isMultiSendParameter } from './newTransactionHelpers'
import { Transaction } from 'src/logic/safe/store/models/types/transaction'
export type MultiSendDetails = {
operation: keyof typeof Operation
operation: Operation
to: string
data: DataDecoded | null
value: number
}
export type MultiSendDecodedData = {
export type MultiSendDataDecoded = {
txDetails?: MultiSendDetails[]
transfersDetails?: TransferDetails[]
}
@ -43,18 +43,18 @@ export const extractTransferDetails = (transfer: Transfer): TransferDetails => {
export const extractMultiSendDetails = (parameter: Parameter): MultiSendDetails[] | undefined => {
if (isMultiSendParameter(parameter)) {
return parameter.decodedValue.map((decodedValue) => {
return parameter.valueDecoded.map((valueDecoded) => {
return {
operation: decodedValue.operation,
to: decodedValue.to,
value: decodedValue.value,
data: decodedValue?.decodedData ?? null,
operation: valueDecoded.operation,
to: valueDecoded.to,
value: valueDecoded.value,
data: valueDecoded?.dataDecoded ?? null,
}
})
}
}
export const extractMultiSendDecodedData = (tx: Transaction): MultiSendDecodedData => {
export const extractMultiSendDataDecoded = (tx: Transaction): MultiSendDataDecoded => {
const transfersDetails = tx.transfers?.map(extractTransferDetails)
const txDetails = extractMultiSendDetails(tx.dataDecoded?.parameters[0])

View File

@ -21,5 +21,5 @@ export const isEthereumTx = (tx: Transaction): tx is EthereumTransaction => {
}
export const isMultiSendParameter = (parameter: Parameter): parameter is MultiSendMethodParameter => {
return !!(parameter as MultiSendMethodParameter)?.decodedValue
return !!(parameter as MultiSendMethodParameter)?.valueDecoded
}

View File

@ -1,12 +1,13 @@
// TODO this file is duplicated with src/logic/safe/store/model/types/transaction.d.ts, we should remove it
export enum TxConstants {
MULTI_SEND = 'multiSend',
UNKNOWN = 'UNKNOWN',
}
export enum Operation {
CALL = 'CALL',
DELEGATE_CALL = 'DELEGATE_CALL',
CREATE = 'CREATE',
CALL,
DELEGATE_CALL,
CREATE,
}
// types comes from: https://github.com/gnosis/safe-client-gateway/blob/752e76b6d1d475791dbd7917b174bb41d2d9d8be/src/utils.rs
@ -35,12 +36,12 @@ export enum SettingsChangeMethods {
// note: this extends SAFE_METHODS_NAMES in /logic/contracts/methodIds.ts, we need to figure out which one we are going to use
export type DataDecodedMethod = TransferMethods | SettingsChangeMethods | string
export interface DecodedValue {
export interface ValueDecoded {
operation: Operation
to: string
value: number
data: string
decodedData: DataDecoded
dataDecoded: DataDecoded
}
export interface SingleTransactionMethodParameter {
@ -50,7 +51,7 @@ export interface SingleTransactionMethodParameter {
}
export interface MultiSendMethodParameter extends SingleTransactionMethodParameter {
decodedValue: DecodedValue[]
valueDecoded: ValueDecoded[]
}
export type Parameter = MultiSendMethodParameter | SingleTransactionMethodParameter