|
| 1 | +import type { Address, Hex } from "thirdweb"; |
| 2 | + |
| 3 | +// Revert data type (referenced but not defined in the provided code) |
| 4 | +export type RevertDataSerialized = { |
| 5 | + revertReason?: string; |
| 6 | + decodedError?: { |
| 7 | + name: string; |
| 8 | + signature: string; |
| 9 | + args: string[]; |
| 10 | + }; |
| 11 | +}; |
| 12 | + |
| 13 | +// Transaction parameters |
| 14 | +export type TransactionParamsSerialized = { |
| 15 | + to: Address; |
| 16 | + data: Hex; |
| 17 | + value: string; |
| 18 | +}; |
| 19 | + |
| 20 | +// Execution parameters |
| 21 | +export type ExecutionParams4337Serialized = { |
| 22 | + type: "AA"; |
| 23 | + entrypointAddress: string; |
| 24 | + smartAccountAddress: string; |
| 25 | + signerAddress: string; |
| 26 | +}; |
| 27 | + |
| 28 | +export type ExecutionParamsSerialized = ExecutionParams4337Serialized; |
| 29 | + |
| 30 | +// Execution result |
| 31 | +export type ExecutionResult4337Serialized = |
| 32 | + | { |
| 33 | + status: "QUEUED"; |
| 34 | + } |
| 35 | + | { |
| 36 | + status: "SUBMITTED"; |
| 37 | + monitoringStatus: "WILL_MONITOR" | "CANNOT_MONITOR"; |
| 38 | + userOpHash: string; |
| 39 | + } |
| 40 | + | ({ |
| 41 | + status: "CONFIRMED"; |
| 42 | + userOpHash: Hex; |
| 43 | + transactionHash: Hex; |
| 44 | + actualGasCost: string; |
| 45 | + actualGasUsed: string; |
| 46 | + nonce: string; |
| 47 | + } & ( |
| 48 | + | { |
| 49 | + onchainStatus: "SUCCESS"; |
| 50 | + } |
| 51 | + | { |
| 52 | + onchainStatus: "REVERTED"; |
| 53 | + revertData?: RevertDataSerialized; |
| 54 | + } |
| 55 | + )); |
| 56 | + |
| 57 | +export type ExecutionResultSerialized = ExecutionResult4337Serialized; |
| 58 | + |
| 59 | +// Enriched data type (not fully defined in the provided code) |
| 60 | +export type EnrichedDataItem = { |
| 61 | + type: string; |
| 62 | + // data: any; |
| 63 | +}; |
| 64 | + |
| 65 | +// Main Transaction type from database |
| 66 | +export type Transaction = { |
| 67 | + id: string; |
| 68 | + batchIndex: number; |
| 69 | + chainId: string; |
| 70 | + from: Address | null; |
| 71 | + transactionParams: TransactionParamsSerialized[]; |
| 72 | + transactionHash: Hex | null; |
| 73 | + confirmedAt: Date | null; |
| 74 | + confirmedAtBlockNumber: string | null; |
| 75 | + // enrichedData: EnrichedDataItem[]; |
| 76 | + executionParams: ExecutionParamsSerialized; |
| 77 | + executionResult: ExecutionResultSerialized | null; |
| 78 | + createdAt: Date; |
| 79 | + errorMessage: string | null; |
| 80 | + cancelledAt: Date | null; |
| 81 | +}; |
| 82 | + |
| 83 | +export type TransactionStatus = ExecutionResultSerialized["status"]; |
| 84 | + |
| 85 | +export type TransactionsResponse = { |
| 86 | + transactions: Transaction[]; |
| 87 | + pagination: { |
| 88 | + limit: number; |
| 89 | + page: number; |
| 90 | + totalCount: number; |
| 91 | + }; |
| 92 | +}; |
0 commit comments