import { Asset, AssetType } from "npci-payment-xdr-base"; import { Omit } from "utility-types"; import { Horizon } from "./horizon_api"; export declare namespace ServerApi { interface CollectionPage { records: T[]; next: () => Promise>; prev: () => Promise>; } interface CallFunctionTemplateOptions { cursor?: string | number; limit?: number; order?: "asc" | "desc"; } type CallFunction = () => Promise; type CallCollectionFunction = (options?: CallFunctionTemplateOptions) => Promise>; interface AccountRecordSigners { key: string; weight: number; type: string; } interface AccountRecord extends Horizon.BaseResponse { id: string; paging_token: string; account_id: string; sequence: string; subentry_count: number; home_domain?: string; inflation_destination?: string; last_modified_ledger: number; thresholds: Horizon.AccountThresholds; flags: Horizon.Flags; balances: Horizon.BalanceLine[]; signers: AccountRecordSigners[]; data: (options: { value: string; }) => Promise<{ value: string; }>; data_attr: { [key: string]: string; }; effects: CallCollectionFunction; offers: CallCollectionFunction; operations: CallCollectionFunction; payments: CallCollectionFunction; trades: CallCollectionFunction; } interface EffectRecord extends Horizon.BaseResponse { account: string; paging_token: string; type_i: string; type: string; created_at: string; id: string; amount?: any; asset_type?: string; asset_code?: string; asset_issuer?: string; limit?: string; public_key?: string; offer_id?: number | string; bought_amount?: string; bought_asset_type?: string; bought_asset_code?: string; bought_asset_issuer?: string; sold_amount?: string; sold_asset_type?: string; sold_asset_code?: string; sold_asset_issuer?: string; starting_balance?: string; low_threshold?: number; med_threshold?: number; high_threshold?: number; home_domain?: string; auth_required_flag?: boolean; auth_revokable_flag?: boolean; new_seq?: number | string; weight?: number; key?: string; trustor?: string; operation?: CallFunction; precedes?: CallFunction; succeeds?: CallFunction; } interface LedgerRecord extends Horizon.BaseResponse { id: string; paging_token: string; hash: string; prev_hash: string; sequence: number; transaction_count: number; operation_count: number; closed_at: string; total_coins: string; fee_pool: string; base_fee: number; base_reserve: string; max_tx_set_size: number; protocol_version: number; header_xdr: string; base_fee_in_stroops: number; base_reserve_in_stroops: number; effects: CallCollectionFunction; operations: CallCollectionFunction; self: CallFunction; transactions: CallCollectionFunction; } interface OfferAsset { asset_type: AssetType; asset_code?: string; asset_issuer?: string; } interface OfferRecord extends Horizon.BaseResponse { id: number | string; paging_token: string; seller: string; selling: OfferAsset; buying: OfferAsset; amount: string; price_r: Horizon.PriceRShorthand; price: string; last_modified_ledger: number; last_modified_time: string; } import OperationResponseType = Horizon.OperationResponseType; import OperationResponseTypeI = Horizon.OperationResponseTypeI; interface BaseOperationRecord extends Horizon.BaseOperationResponse { self: CallFunction; succeeds: CallFunction; precedes: CallFunction; effects: CallCollectionFunction; transaction: CallFunction; } interface CreateAccountOperationRecord extends BaseOperationRecord, Horizon.CreateAccountOperationResponse { } interface PaymentOperationRecord extends BaseOperationRecord, Horizon.PaymentOperationResponse { sender: CallFunction; receiver: CallFunction; } interface PathPaymentOperationRecord extends BaseOperationRecord, Horizon.PathPaymentOperationResponse { } interface ManageOfferOperationRecord extends BaseOperationRecord, Horizon.ManageOfferOperationResponse { } interface PassiveOfferOperationRecord extends BaseOperationRecord, Horizon.PassiveOfferOperationResponse { } interface SetOptionsOperationRecord extends BaseOperationRecord, Horizon.SetOptionsOperationResponse { } interface ChangeTrustOperationRecord extends BaseOperationRecord, Horizon.ChangeTrustOperationResponse { } interface AllowTrustOperationRecord extends BaseOperationRecord, Horizon.AllowTrustOperationResponse { } interface AccountMergeOperationRecord extends BaseOperationRecord, Horizon.AccountMergeOperationResponse { } interface InflationOperationRecord extends BaseOperationRecord, Horizon.InflationOperationResponse { } interface ManageDataOperationRecord extends BaseOperationRecord, Horizon.ManageDataOperationResponse { } interface BumpSequenceOperationRecord extends BaseOperationRecord, Horizon.BumpSequenceOperationResponse { } type OperationRecord = CreateAccountOperationRecord | PaymentOperationRecord | PathPaymentOperationRecord | ManageOfferOperationRecord | PassiveOfferOperationRecord | SetOptionsOperationRecord | ChangeTrustOperationRecord | AllowTrustOperationRecord | AccountMergeOperationRecord | InflationOperationRecord | ManageDataOperationRecord | BumpSequenceOperationRecord; interface TradeRecord extends Horizon.BaseResponse { id: string; paging_token: string; ledger_close_time: string; offer_id: string; base_offer_id: string; base_account: string; base_amount: string; base_asset_type: string; base_asset_code?: string; base_asset_issuer?: string; counter_offer_id: string; counter_account: string; counter_amount: string; counter_asset_type: string; counter_asset_code?: string; counter_asset_issuer?: string; base_is_seller: boolean; base: CallFunction; counter: CallFunction; operation: CallFunction; } interface TransactionRecord extends Omit { ledger_attr: Horizon.TransactionResponse["ledger"]; account: CallFunction; effects: CallCollectionFunction; ledger: CallFunction; operations: CallCollectionFunction; precedes: CallFunction; self: CallFunction; succeeds: CallFunction; } interface AssetRecord extends Horizon.BaseResponse { asset_type: AssetType.credit4 | AssetType.credit12; asset_code: string; asset_issuer: string; paging_token: string; amount: string; num_accounts: number; flags: Horizon.Flags; } interface OrderbookRecord extends Horizon.BaseResponse { bids: Array<{ price_r: { d: number; n: number; }; price: string; amount: string; }>; asks: Array<{ price_r: { d: number; n: number; }; price: string; amount: string; }>; base: Asset; counter: Asset; } interface PaymentPathRecord extends Horizon.BaseResponse { path: Array<{ asset_code: string; asset_issuer: string; asset_type: string; }>; source_amount: string; source_asset_type: string; source_asset_code: string; source_asset_issuer: string; destination_amount: string; destination_asset_type: string; destination_asset_code: string; destination_asset_issuer: string; } }