|
1 | 1 | import { THIRDWEB_ENGINE_CLOUD_URL } from "@/constants/env"; |
2 | 2 | import type { TransactionStats } from "../../../../../../../../types/analytics"; |
3 | 3 | import { getAuthToken } from "../../../../../../api/lib/getAuthToken"; |
4 | | -import type { Address, Hex } from "thirdweb"; |
| 4 | +import type { |
| 5 | + Transaction, |
| 6 | + TransactionsResponse, |
| 7 | +} from "../analytics/tx-table/types"; |
5 | 8 |
|
6 | 9 | // Define the structure of the data we expect back from our fetch function |
7 | 10 | export type TransactionSummaryData = { |
@@ -147,53 +150,6 @@ export async function getTransactionsChart({ |
147 | 150 | })); |
148 | 151 | } |
149 | 152 |
|
150 | | -type TransactionParam = { |
151 | | - to: Address; |
152 | | - data: Hex; |
153 | | - value: string; |
154 | | -}; |
155 | | - |
156 | | -type ExecutionParams = { |
157 | | - type: string; |
158 | | - signerAddress: string; |
159 | | - entrypointAddress: string; |
160 | | - smartAccountAddress: string; |
161 | | -}; |
162 | | - |
163 | | -type ExecutionResult = { |
164 | | - status: string; |
165 | | -}; |
166 | | - |
167 | | -type Transaction = { |
168 | | - id: string; |
169 | | - batchIndex: number; |
170 | | - chainId: string; |
171 | | - from: Address; |
172 | | - transactionParams: TransactionParam[]; |
173 | | - transactionHash: Hex | null; |
174 | | - confirmedAt: string | null; |
175 | | - confirmedAtBlockNumber: number | null; |
176 | | - enrichedData: unknown[]; |
177 | | - executionParams: ExecutionParams; |
178 | | - executionResult: ExecutionResult; |
179 | | - createdAt: string; |
180 | | - errorMessage: string | null; |
181 | | - cancelledAt: string | null; |
182 | | -}; |
183 | | - |
184 | | -type Pagination = { |
185 | | - totalCount: string; |
186 | | - page: number; |
187 | | - limit: number; |
188 | | -}; |
189 | | - |
190 | | -type TransactionsSearchResponse = { |
191 | | - result: { |
192 | | - transactions: Transaction[]; |
193 | | - pagination: Pagination; |
194 | | - }; |
195 | | -}; |
196 | | - |
197 | 153 | export async function getSingleTransaction({ |
198 | 154 | teamId, |
199 | 155 | clientId, |
@@ -240,7 +196,7 @@ export async function getSingleTransaction({ |
240 | 196 | ); |
241 | 197 | } |
242 | 198 |
|
243 | | - const data = (await response.json()) as TransactionsSearchResponse; |
| 199 | + const data = (await response.json()).result as TransactionsResponse; |
244 | 200 |
|
245 | | - return data.result.transactions[0]; |
| 201 | + return data.transactions[0]; |
246 | 202 | } |
0 commit comments