1
- import { formatDistanceToNowStrict , parseISO } from "date-fns" ;
1
+ import { formatDistanceToNowStrict , toDate } from "date-fns" ;
2
2
import { useMultisigTransactions } from "@/utils/hooks/Safe/SafeHooks" ;
3
3
import SearchableComboBox , {
4
4
Option ,
5
5
} from "@/components/common/SearchableComboBox" ;
6
- import { SafeMultisigTransactionListResponse } from "@safe-global/api-kit" ;
7
- import { RevisedSafeMultisigTransactionResponse } from "@/models/SafeTypes" ;
6
+ import {
7
+ SafeTransactionsResponse ,
8
+ SafetransactionsResponseResult ,
9
+ } from "@/models/SafeTypes" ;
8
10
import { useQueryParams , withDefault , StringParam } from "next-query-params" ;
9
11
import { useEffect } from "react" ;
10
12
11
- export type TxOption = Option & { tx : RevisedSafeMultisigTransactionResponse } ;
13
+ export type TxOption = Option & { tx : SafetransactionsResponseResult } ;
12
14
export type AddressMap = { [ address : string ] : string } ;
13
15
14
16
export function SafeTransactionSelector ( {
@@ -29,21 +31,24 @@ export function SafeTransactionSelector({
29
31
const { data : txns , isLoading } = useMultisigTransactions ( safeAddress , 20 ) ;
30
32
31
33
const convertToOptions = (
32
- res : SafeMultisigTransactionListResponse | undefined ,
33
- status : boolean ,
34
+ res : SafeTransactionsResponse | undefined ,
35
+ status : boolean
34
36
) => {
35
37
if ( ! res ) return [ ] ;
36
- return res . results . map ( ( _tx ) => {
37
- const tx = _tx as any as RevisedSafeMultisigTransactionResponse ;
38
- const addressLabel = addressMap [ tx . to ] ? `${ addressMap [ tx . to ] } .` : "" ;
38
+ return res . results . map ( ( tx ) => {
39
+ const txTo = tx . transaction . txInfo . to . value ;
40
+ const addressLabel = addressMap [ txTo ] ? `${ addressMap [ txTo ] } .` : "" ;
39
41
return {
40
- id : tx . safeTxHash ,
41
- label : `Tx ${ tx . nonce } ${ addressLabel } ${
42
- tx . dataDecoded ? tx . dataDecoded . method : "unknown"
42
+ id : tx . transaction . id ,
43
+ label : `Tx ${ tx . transaction . executionInfo . nonce } ${ addressLabel } ${
44
+ tx . transaction . txInfo . methodName || "unknown"
43
45
} `,
44
- extraLabel : formatDistanceToNowStrict ( parseISO ( tx . submissionDate ) , {
45
- addSuffix : true ,
46
- } ) ,
46
+ extraLabel : formatDistanceToNowStrict (
47
+ toDate ( tx . transaction . timestamp ) ,
48
+ {
49
+ addSuffix : true ,
50
+ }
51
+ ) ,
47
52
status,
48
53
tx : tx ,
49
54
} ;
0 commit comments