UNPKG

0xtrails

Version:

SDK for Trails

151 lines 4.77 kB
import { GuestModuleEvent, TrailsTokenSweeperEvent } from './decoders.js'; export type TransactionStateStatus = "pending" | "failed" | "confirmed" | "aborted"; export type TransactionState = { transactionHash: string; explorerUrl: string; blockNumber?: number; chainId: number; state: TransactionStateStatus; label: string; decodedTrailsTokenSweeperEvents?: TrailsTokenSweeperEvent[]; decodedGuestModuleEvents?: GuestModuleEvent[]; refunded?: boolean; }; export type TransferType = "SEND" | "RECEIVE"; export type ContractType = "ERC20" | "ERC721" | "ERC1155" | "NATIVE"; export type ContractInfo = { chainId: number; address: string; source: string; name: string; type: ContractType; symbol: string; decimals: number; logoURI: string; deployed: boolean; bytecodeHash: string; extensions: { link: string; description: string; ogImage: string; ogName: string; originChainId: number; originAddress: string; verified: boolean; verifiedBy: string; }; updatedAt: string; queuedAt: string; status: string; }; export type Transfer = { transferType: TransferType; contractAddress: string; contractType: ContractType; from: string; to: string; tokenIds: string[]; amounts: string[]; logIndex: number; contractInfo: ContractInfo; }; export type TransactionHistoryItemFromAPI = { txnHash: string; blockNumber: number; blockHash: string; chainId: number; metaTxnID: string | null; transfers: Transfer[]; timestamp: string; }; export type TransactionHistoryItem = TransactionHistoryItemFromAPI & { explorerUrl?: string; chainName?: string; }; export type TransactionHistoryResponse = { page: { column: string; pageSize: number; more: boolean; }; transactions: TransactionHistoryItem[]; }; export type GetAccountTransactionHistoryParams = { chainId: number; accountAddress: string; pageSize?: number; includeMetadata?: boolean; page?: number; }; export declare function getTxTimeDiff(firstTx?: TransactionState, lastTx?: TransactionState): Promise<number>; export declare function getIndexerUrlFromChainSlug(chainSlug: string): string; export declare function getAccountTransactionHistory({ chainId, accountAddress, pageSize, page, includeMetadata, }: GetAccountTransactionHistoryParams): Promise<TransactionHistoryResponse>; export type IntentTransaction = { originIntentAddress: string; destinationIntentAddress: string; mainSigner: string; metaTxnId?: string; txnHash?: string; executionStatus?: string; originChainId?: number; destinationChainId?: number; originTokenAddress?: string; originTokenAmount?: string; destinationTokenAddress?: string; destinationTokenAmount?: string; destinationToAddress?: string; createdAt?: string; originToken?: { symbol: string; name: string; decimals: number; imageUrl: string; chainId: number; }; destinationToken?: { symbol: string; name: string; decimals: number; imageUrl: string; chainId: number; }; }; export type IntentTransactionHistoryResponse = { page?: { page?: number; pageSize?: number; more?: boolean; }; transactions: IntentTransaction[]; }; export type GetIntentTransactionHistoryParams = { accountAddress: string; pageSize?: number; page?: number; }; export declare function getIntentTransactionHistory({ accountAddress, pageSize, page, }: GetIntentTransactionHistoryParams): Promise<IntentTransactionHistoryResponse>; export type UseAccountTransactionHistoryParams = { chainId?: number | null; accountAddress?: string | null; pageSize?: number; page?: number; includeMetadata?: boolean; }; export type UseAccountTransactionHistoryReturn = { data: TransactionHistoryResponse | undefined; isLoading: boolean; error: Error | null; }; export declare function useAccountTransactionHistory({ chainId, accountAddress, pageSize, page, includeMetadata, }: UseAccountTransactionHistoryParams): UseAccountTransactionHistoryReturn; export type UseIntentTransactionHistoryParams = { accountAddress?: string | null; pageSize?: number; page?: number; }; export type UseIntentTransactionHistoryReturn = { data: IntentTransactionHistoryResponse | undefined; isLoading: boolean; error: Error | null; }; export declare function useIntentTransactionHistory({ accountAddress, pageSize, page, }: UseIntentTransactionHistoryParams): UseIntentTransactionHistoryReturn; //# sourceMappingURL=transactions.d.ts.map