forked from InsurNiffy/niff-Stellar-shurance
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhorizon-transaction.dto.ts
More file actions
68 lines (66 loc) · 3.02 KB
/
Copy pathhorizon-transaction.dto.ts
File metadata and controls
68 lines (66 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* Horizon Transaction DTOs
*
* Fields forwarded from Horizon and why:
*
* FORWARDED:
* id — unique operation identifier; used by frontend for deduplication
* paging_token — cursor for paginated fetches
* type — operation type string (e.g. "payment", "change_trust")
* type_int — numeric type; easier for frontend switch/case
* created_at — ISO timestamp of the ledger close containing this operation
* transaction_hash — links operation to its parent transaction; shown in explorer links
* transaction_successful — guards UI from displaying failed operations as completed
* source_account — sender address
* asset_type — "native" | "credit_alphanum4" | "credit_alphanum12"
* asset_code — token ticker (undefined for XLM)
* asset_issuer — issuer address (undefined for XLM)
* amount — transfer amount as string (Stellar uses string to avoid float loss)
* from / to — payment parties
*
* STRIPPED:
* _links — Horizon HAL links; internal navigation not needed by frontend
* records[].links — same reason
* funder / account — create_account-specific; not used in payment history view
* starting_balance — create_account-specific
* offer_id — DEX offer internals; not relevant to policy-payment history
* price / price_r — DEX pricing fields
* buying_* / selling_* — DEX asset pair fields
* claimable_balance_id — claimable-balance internals
* sponsor — reserve-sponsoring; not displayed in current UI
* bump_to — bump_sequence internals
* authorize* — change_trust flag fields
* limit — change_trust limit; not shown
* set_flags* / clear_flags* — account flags
* home_domain / thresholds / signers / inflation_dest — account meta changes
*
* HORIZON FINALITY LAG:
* Stellar closes a ledger approximately every 5 seconds. The `created_at` field
* reflects ledger close time, not submission time. Operations are final once
* included in a closed ledger — there is no probabilistic finality.
* However, Horizon ingestion may lag 1–3 ledgers (~5–15 seconds) behind the
* network tip. The frontend should show a "transactions may take up to 15 seconds
* to appear" notice and avoid treating a missing transaction as definitively
* failed until at least 30 seconds have elapsed.
*/
export interface HorizonOperationRecord {
id: string;
paging_token: string;
type: string;
type_int: number;
created_at: string;
transaction_hash: string;
transaction_successful: boolean;
source_account: string;
// Payment / path-payment fields (optional — only present on relevant types)
asset_type?: string;
asset_code?: string;
asset_issuer?: string;
amount?: string;
from?: string;
to?: string;
}
export interface HorizonTransactionResponse {
records: HorizonOperationRecord[];
next_cursor?: string;
}