mirror of
https://github.com/status-im/safe-react.git
synced 2025-02-17 03:57:04 +00:00
Merge branch 'development' into release-2.11.0
This commit is contained in:
commit
f04ec4c169
@ -4,9 +4,9 @@ export enum TxConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum Operation {
|
export enum Operation {
|
||||||
CALL = 'CALL',
|
CALL,
|
||||||
DELEGATE_CALL = 'DELEGATE_CALL',
|
DELEGATE_CALL,
|
||||||
CREATE = 'CREATE',
|
CREATE,
|
||||||
}
|
}
|
||||||
|
|
||||||
// types comes from: https://github.com/gnosis/safe-client-gateway/blob/752e76b6d1d475791dbd7917b174bb41d2d9d8be/src/utils.rs
|
// 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
|
// 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 type DataDecodedMethod = TransferMethods | SettingsChangeMethods | string
|
||||||
|
|
||||||
export interface DecodedValue {
|
export interface ValueDecoded {
|
||||||
operation: Operation
|
operation: Operation
|
||||||
to: string
|
to: string
|
||||||
value: number
|
value: number
|
||||||
data: string
|
data: string
|
||||||
decodedData: DataDecoded
|
dataDecoded: DataDecoded
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SingleTransactionMethodParameter {
|
export interface SingleTransactionMethodParameter {
|
||||||
@ -50,7 +50,7 @@ export interface SingleTransactionMethodParameter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface MultiSendMethodParameter extends SingleTransactionMethodParameter {
|
export interface MultiSendMethodParameter extends SingleTransactionMethodParameter {
|
||||||
decodedValue: DecodedValue[]
|
valueDecoded: ValueDecoded[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Parameter = MultiSendMethodParameter | SingleTransactionMethodParameter
|
export type Parameter = MultiSendMethodParameter | SingleTransactionMethodParameter
|
||||||
|
@ -8,7 +8,7 @@ import Value from './Value'
|
|||||||
|
|
||||||
import Block from 'src/components/layout/Block'
|
import Block from 'src/components/layout/Block'
|
||||||
import {
|
import {
|
||||||
extractMultiSendDecodedData,
|
extractMultiSendDataDecoded,
|
||||||
MultiSendDetails,
|
MultiSendDetails,
|
||||||
} from 'src/routes/safe/store/actions/transactions/utils/multiSendDecodedDetails'
|
} from 'src/routes/safe/store/actions/transactions/utils/multiSendDecodedDetails'
|
||||||
import Bold from 'src/components/layout/Bold'
|
import Bold from 'src/components/layout/Bold'
|
||||||
@ -198,7 +198,7 @@ interface CustomDescriptionProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const CustomDescription = ({ amount, data, recipient, storedTx }: CustomDescriptionProps): React.ReactElement => {
|
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 ? (
|
return txDetails ? (
|
||||||
<MultiSendCustomData txDetails={txDetails} />
|
<MultiSendCustomData txDetails={txDetails} />
|
||||||
|
@ -17,13 +17,13 @@ import { isMultiSendParameter } from './newTransactionHelpers'
|
|||||||
import { Transaction } from 'src/logic/safe/store/models/types/transaction'
|
import { Transaction } from 'src/logic/safe/store/models/types/transaction'
|
||||||
|
|
||||||
export type MultiSendDetails = {
|
export type MultiSendDetails = {
|
||||||
operation: keyof typeof Operation
|
operation: Operation
|
||||||
to: string
|
to: string
|
||||||
data: DataDecoded | null
|
data: DataDecoded | null
|
||||||
value: number
|
value: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MultiSendDecodedData = {
|
export type MultiSendDataDecoded = {
|
||||||
txDetails?: MultiSendDetails[]
|
txDetails?: MultiSendDetails[]
|
||||||
transfersDetails?: TransferDetails[]
|
transfersDetails?: TransferDetails[]
|
||||||
}
|
}
|
||||||
@ -43,18 +43,18 @@ export const extractTransferDetails = (transfer: Transfer): TransferDetails => {
|
|||||||
|
|
||||||
export const extractMultiSendDetails = (parameter: Parameter): MultiSendDetails[] | undefined => {
|
export const extractMultiSendDetails = (parameter: Parameter): MultiSendDetails[] | undefined => {
|
||||||
if (isMultiSendParameter(parameter)) {
|
if (isMultiSendParameter(parameter)) {
|
||||||
return parameter.decodedValue.map((decodedValue) => {
|
return parameter.valueDecoded.map((valueDecoded) => {
|
||||||
return {
|
return {
|
||||||
operation: decodedValue.operation,
|
operation: valueDecoded.operation,
|
||||||
to: decodedValue.to,
|
to: valueDecoded.to,
|
||||||
value: decodedValue.value,
|
value: valueDecoded.value,
|
||||||
data: decodedValue?.decodedData ?? null,
|
data: valueDecoded?.dataDecoded ?? null,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const extractMultiSendDecodedData = (tx: Transaction): MultiSendDecodedData => {
|
export const extractMultiSendDataDecoded = (tx: Transaction): MultiSendDataDecoded => {
|
||||||
const transfersDetails = tx.transfers?.map(extractTransferDetails)
|
const transfersDetails = tx.transfers?.map(extractTransferDetails)
|
||||||
const txDetails = extractMultiSendDetails(tx.dataDecoded?.parameters[0])
|
const txDetails = extractMultiSendDetails(tx.dataDecoded?.parameters[0])
|
||||||
|
|
||||||
|
@ -21,5 +21,5 @@ export const isEthereumTx = (tx: Transaction): tx is EthereumTransaction => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const isMultiSendParameter = (parameter: Parameter): parameter is MultiSendMethodParameter => {
|
export const isMultiSendParameter = (parameter: Parameter): parameter is MultiSendMethodParameter => {
|
||||||
return !!(parameter as MultiSendMethodParameter)?.decodedValue
|
return !!(parameter as MultiSendMethodParameter)?.valueDecoded
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
export enum TxConstants {
|
||||||
MULTI_SEND = 'multiSend',
|
MULTI_SEND = 'multiSend',
|
||||||
UNKNOWN = 'UNKNOWN',
|
UNKNOWN = 'UNKNOWN',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Operation {
|
export enum Operation {
|
||||||
CALL = 'CALL',
|
CALL,
|
||||||
DELEGATE_CALL = 'DELEGATE_CALL',
|
DELEGATE_CALL,
|
||||||
CREATE = 'CREATE',
|
CREATE,
|
||||||
}
|
}
|
||||||
|
|
||||||
// types comes from: https://github.com/gnosis/safe-client-gateway/blob/752e76b6d1d475791dbd7917b174bb41d2d9d8be/src/utils.rs
|
// 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
|
// 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 type DataDecodedMethod = TransferMethods | SettingsChangeMethods | string
|
||||||
|
|
||||||
export interface DecodedValue {
|
export interface ValueDecoded {
|
||||||
operation: Operation
|
operation: Operation
|
||||||
to: string
|
to: string
|
||||||
value: number
|
value: number
|
||||||
data: string
|
data: string
|
||||||
decodedData: DataDecoded
|
dataDecoded: DataDecoded
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SingleTransactionMethodParameter {
|
export interface SingleTransactionMethodParameter {
|
||||||
@ -50,7 +51,7 @@ export interface SingleTransactionMethodParameter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface MultiSendMethodParameter extends SingleTransactionMethodParameter {
|
export interface MultiSendMethodParameter extends SingleTransactionMethodParameter {
|
||||||
decodedValue: DecodedValue[]
|
valueDecoded: ValueDecoded[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Parameter = MultiSendMethodParameter | SingleTransactionMethodParameter
|
export type Parameter = MultiSendMethodParameter | SingleTransactionMethodParameter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user