From 95a753cbe593235abcdce7f39af44512e02ef597 Mon Sep 17 00:00:00 2001 From: fernandomg Date: Tue, 2 Jun 2020 10:50:32 -0300 Subject: [PATCH] fix 'non-empty-pattern' ts warning --- src/logic/contractInteraction/sources/ABIService/types.d.ts | 6 +++--- .../screens/ContractInteraction/MethodsDropdown/index.tsx | 5 +++-- .../SendModal/screens/ContractInteraction/index.tsx | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/logic/contractInteraction/sources/ABIService/types.d.ts b/src/logic/contractInteraction/sources/ABIService/types.d.ts index 5cd04f5d..b5b10065 100644 --- a/src/logic/contractInteraction/sources/ABIService/types.d.ts +++ b/src/logic/contractInteraction/sources/ABIService/types.d.ts @@ -4,7 +4,7 @@ export interface InterfaceParams { type: string } -export interface ContractInterface { +export interface MethodInterface { constant: boolean inputs: InterfaceParams[] name: string @@ -14,12 +14,12 @@ export interface ContractInterface { type: string } -export interface ExtendedContractInterface extends ContractInterface { +export interface ExtendedContractInterface extends MethodInterface { action: string methodSignature: string signatureHash: string } -export type ABI = ContractInterface[] +export type ABI = MethodInterface[] export type ExtendedABI = ExtendedContractInterface[] diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/MethodsDropdown/index.tsx b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/MethodsDropdown/index.tsx index 30da6a7f..be3a42ad 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/MethodsDropdown/index.tsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/MethodsDropdown/index.tsx @@ -16,11 +16,12 @@ import CheckIcon from 'src/routes/safe/components/CurrencyDropdown/img/check.svg import { useDropdownStyles } from 'src/routes/safe/components/CurrencyDropdown/style' import { DropdownListTheme } from 'src/theme/mui' import { extractUsefulMethods } from 'src/logic/contractInteraction/sources/ABIService' +import { MethodInterface } from 'src/logic/contractInteraction/sources/ABIService/types' const MENU_WIDTH = '452px' interface MethodsDropdownProps { - onChange: ({}) => void + onChange: (method: MethodInterface) => void } const MethodsDropdown = ({ onChange }: MethodsDropdownProps) => { @@ -60,7 +61,7 @@ const MethodsDropdown = ({ onChange }: MethodsDropdownProps) => { setAnchorEl(null) } - const onMethodSelectedChanged = (chosenMethod) => { + const onMethodSelectedChanged = (chosenMethod: MethodInterface) => { setSelectedMethod(chosenMethod) onChange(chosenMethod) handleClose() diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/index.tsx b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/index.tsx index b99c3a90..d767fd3a 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/index.tsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/index.tsx @@ -33,7 +33,7 @@ export interface ContractInteractionProps { contractAddress: string initialValues: { contractAddress?: string } onClose: () => void - onNext: ({}: CreatedTx) => void + onNext: (tx: CreatedTx) => void } const ContractInteraction = ({ contractAddress, initialValues, onClose, onNext }: ContractInteractionProps) => {