Types
TypeScript type definitions for the Iagon Insight API.
Response Wrapper
typescript
interface IApiResponse<T> {
success: true;
data: T;
}
interface IApiError {
success: false;
error: string;
}UTXOs
typescript
interface IUtxo {
transaction_id: string;
output_index: number;
address: string;
value: IUtxoValue;
datum_hash: string | null;
datum_type: string | null;
script_hash: string | null;
created_at: ISlotReference;
}
interface IUtxoValue {
lovelace: number;
assets?: Record<string, number>;
}
interface ISlotReference {
slot_no: number;
header_hash: string;
}Usage:
typescript
type IGetUtxosResponse = IApiResponse<IUtxo[]>;Transactions
typescript
interface ITransactionSubmitRequest {
tx: string;
skipValidation?: boolean;
}
interface ITransactionSubmitData {
txHash: string;
}
interface ITransaction {
tx_hash: string;
block_hash: string;
slot_no: number;
block_no: number;
block_time: string;
fee: number;
size: number;
inputs: ITransactionInput[];
outputs: ITransactionOutput[];
}
interface ITransactionInput {
tx_hash: string;
output_index: number;
address: string;
value: IUtxoValue;
}
interface ITransactionOutput {
output_index: number;
address: string;
value: IUtxoValue;
}
interface ITransactionSummary {
tx_hash: string;
block_hash: string;
slot_no: number;
block_no: number;
block_time: string;
}
interface IPagination {
limit: number;
offset: number;
total: number;
hasMore: boolean;
next_cursor?: number;
}
interface ILastUpdated {
slot_no: number;
block_hash: string;
block_time: string;
}
interface IPaginatedResponse<T> {
success: true;
data: T[];
pagination: IPagination;
last_updated: ILastUpdated;
}Usage:
typescript
type ITransactionSubmitResponse = IApiResponse<ITransactionSubmitData>;
type ITransactionResponse = IApiResponse<ITransaction>;
type ITransactionsResponse = IPaginatedResponse<ITransaction>;
type ITransactionHistoryResponse = IPaginatedResponse<ITransactionSummary>;Health
typescript
interface IHealthData {
status: "healthy";
timestamp: string;
}Usage:
typescript
type IHealthResponse = IApiResponse<IHealthData>;Full Type Definitions
Copy this file to use in your project:
typescript
// Response types
interface IApiResponse<T> {
success: true;
data: T;
}
interface IApiError {
success: false;
error: string;
}
// UTXO types
interface IUtxo {
transaction_id: string;
output_index: number;
address: string;
value: IUtxoValue;
datum_hash: string | null;
datum_type: string | null;
script_hash: string | null;
created_at: ISlotReference;
}
interface IUtxoValue {
lovelace: number;
assets?: Record<string, number>;
}
interface ISlotReference {
slot_no: number;
header_hash: string;
}
// Transaction types
interface ITransactionSubmitRequest {
tx: string;
skipValidation?: boolean;
}
interface ITransactionSubmitData {
txHash: string;
}
interface ITransaction {
tx_hash: string;
block_hash: string;
slot_no: number;
block_no: number;
block_time: string;
fee: number;
size: number;
inputs: ITransactionInput[];
outputs: ITransactionOutput[];
}
interface ITransactionInput {
tx_hash: string;
output_index: number;
address: string;
value: IUtxoValue;
}
interface ITransactionOutput {
output_index: number;
address: string;
value: IUtxoValue;
}
interface ITransactionSummary {
tx_hash: string;
block_hash: string;
slot_no: number;
block_no: number;
block_time: string;
}
interface IPagination {
limit: number;
offset: number;
total: number;
hasMore: boolean;
next_cursor?: number;
}
interface ILastUpdated {
slot_no: number;
block_hash: string;
block_time: string;
}
interface IPaginatedResponse<T> {
success: true;
data: T[];
pagination: IPagination;
last_updated: ILastUpdated;
}
// Health types
interface IHealthData {
status: "healthy";
timestamp: string;
}
// Response type aliases
type IGetUtxosResponse = IApiResponse<IUtxo[]>;
type ITransactionSubmitResponse = IApiResponse<ITransactionSubmitData>;
type ITransactionResponse = IApiResponse<ITransaction>;
type ITransactionsResponse = IPaginatedResponse<ITransaction>;
type ITransactionHistoryResponse = IPaginatedResponse<ITransactionSummary>;
type IHealthResponse = IApiResponse<IHealthData>;