horizon

package
v0.0.0-...-9f7f9c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0, Apache-2.0 Imports: 12 Imported by: 188

README

Horizon Protocol Changelog

Any changes to the Horizon Public API should be included in this doc.

SDK support

We started tracking SDK support at version 0.12.3. Support for 0.12.3 means that SDK can correctly:

  • Send requests using all available query params / POST params / headers,
  • Parse all fields in responses structs and headers.

For each new version we will only track changes from the previous version.

Changes

Unreleased
Changes
  • In "Transaction", result_meta_xdr field is now nullable, and will be null when Horizon has SKIP_TXMETA=true set, otherwise if Horizon is configured with SKIP_TXMETA=false which is default, then result_meta_xdr will be the same value of base64 encoded xdr.
  • Operations responses may include a transaction field which represents the transaction that created the operation.
0.15.0
SDKs with full support
Changes
  • Assets stats are disabled by default. This can be changed using an environment variable (ENABLE_ASSET_STATS=true) or CLI parameter (--enable-asset-stats=true). Please note that it has a negative impact on a DB and ingestion time.
  • In "Offers for Account", last_modified_time field endpoint can be null when ledger data is not available (has not been ingested yet).
  • "Trades for Offer" endpoint will query for trades that match the given offer on either side of trades, rather than just the "sell" offer. Offer IDs are now synthetic.
  • New /operation_fee_stats endpoint includes fee stats for the last 5 ledgers.
  • "Trades" endpoint can now be streamed.
  • In "Trade Aggregations" endpoint, offset parameter has been added.
  • Account flags now display auth_immutable value.
  • Rate limiting in streams has been changed to be more fair. Now 1 credit has to be paid every time there's a new ledger instead of per request.
Resource Changes Go SDK 1 JS SDK Java SDK
GET /assets Disabled by default. + 0.10.2 0.4.0
GET /accounts/{account_id}/offers last_modified_time field can be null - 0.10.2 0.4.0
GET /offers/{offer_id}/trades Query fields and syntetic IDs - 0.10.2 0.4.0
GET /trades SSE Can be streamed - - 0.4.0
GET /operation_fee_stats New endpoint - - 0.4.0
GET /trade_aggregations New offset parameter - - 0.4.0
GET /accounts/{account_id} Displaying auth_immutable flag - 0.10.2 0.4.0
0.14.0
SDKs with full support
Changes
  • New bump_sequence operation.
  • New sequence_bumped effect.
  • New fields in Account > Balances collection: buying_liabilities and selling_liabilities.
  • Offer resource last_modified field removed, replaced by last_modified_ledger and last_modified_time.
  • Trade aggregations endpoint accepts only specific time ranges now (1/5/15 minutes, 1 hour, 1 day, 1 week).
  • Horizon now sends Cache-Control: no-cache, no-store, max-age=0 HTTP header for all responses.
Resource Changes Go SDK 1 JS SDK Java SDK
GET /accounts/{account_id} Liabilities fields in Balances collection. + 0.10.2 0.3.1
GET /accounts/{account_id}/effects sequence_bumped effect - 0.10.2 0.3.1
GET /accounts/{account_id}/effects SSE sequence_bumped effect - 0.10.2 0.3.1
GET /accounts/{account_id}/offers last_modified field removed - 0.10.2 0.3.1
GET /accounts/{account_id}/operations bump_sequence operation - 0.10.2 0.3.1
GET /accounts/{account_id}/operations SSE bump_sequence operation - 0.10.2 0.3.1
GET /effects sequence_bumped effect - 0.10.2 0.3.1
GET /effects SSE sequence_bumped effect - 0.10.2 0.3.1
GET /ledgers/{ledger_id}/operations bump_sequence operation - 0.10.2 0.3.1
GET /ledgers/{ledger_id}/operations SSE bump_sequence operation - 0.10.2 0.3.1
GET /ledgers/{ledger_id}/effects sequence_bumped effect - 0.10.2 0.3.1
GET /ledgers/{ledger_id}/effects SSE sequence_bumped effect - 0.10.2 0.3.1
GET /operations bump_sequence operation - 0.10.2 0.3.1
GET /operations SSE bump_sequence operation - 0.10.2 0.3.1
GET /operations/{op_id} bump_sequence operation + 0.10.2 0.3.1
GET /trades_aggregations Only specific time ranges allowed + 0.10.2 0.3.1
GET /transactions/{tx_id}/operations bump_sequence operation - 0.10.2 0.3.1
GET /transactions/{tx_id}/operations SSE bump_sequence operation - 0.10.2 0.3.1
GET /transactions/{tx_id}/effects sequence_bumped effect - 0.10.2 0.3.1
GET /transactions/{tx_id}/effects SSE sequence_bumped effect - 0.10.2 0.3.1
0.13.0
SDKs with full support
Changes
  • amount field in /assets is now a String (to support Stellar amounts larger than int64).
  • Effect resource contains a new created_at field.
Resource Changes Go SDK 1 JS SDK Java SDK
GET /assets amount can be larger than MAX_INT64/10^7 + 0.8.2 2 0.2.0
GET /ledgers/{ledger_id}/effects created_at field added + 0.8.2 2 0.2.1
GET /ledgers/{ledger_id}/effects SSE created_at field added + 0.8.2 2 0.2.1
GET /accounts/{account_id}/effects created_at field added + 0.8.2 2 0.2.1
GET /accounts/{account_id}/effects SSE created_at field added + 0.8.2 2 0.2.1
GET /transactions/{tx_id}/effects created_at field added + 0.8.2 2 0.2.1
GET /transactions/{tx_id}/effects SSE created_at field added + 0.8.2 2 0.2.1
GET /operations/{op_id}/effects created_at field added + 0.8.2 2 0.2.1
GET /operations/{op_id}/effects SSE created_at field added + 0.8.2 2 0.2.1
GET /effects created_at field added + 0.8.2 2 0.2.1
GET /effects SSE created_at field added + 0.8.2 2 0.2.1
0.12.3
SDKs with full support
Changes
Resource Go SDK 1 JS SDK Java SDK
GET / +
(some _links missing)
- 0.2.1
GET /metrics - - -
GET /ledgers - 0.8.2 0.2.0
GET /ledgers SSE + 0.8.2 0.2.0
GET /ledgers/{ledger_id} - 0.8.2 0.2.0
GET /ledgers/{ledger_id}/transactions - 0.8.2 0.2.0
GET /ledgers/{ledger_id}/transactions SSE - 0.8.2 0.2.0
GET /ledgers/{ledger_id}/operations - 0.8.2 0.2.0
GET /ledgers/{ledger_id}/operations SSE - 0.8.2 0.2.1
GET /ledgers/{ledger_id}/payments - 0.8.2 0.2.0
GET /ledgers/{ledger_id}/payments SSE - 0.8.2 0.2.0
GET /ledgers/{ledger_id}/effects - 0.8.2 0.2.0
(no support for data, inflation types)
GET /ledgers/{ledger_id}/effects SSE - 0.8.2 0.2.0
(no support for data, inflation types)
GET /accounts/{account_id} + 0.8.2 0.2.0
GET /accounts/{account_id}/transactions - 0.8.2 0.2.0
GET /accounts/{account_id}/transactions SSE - 0.8.2 0.2.0
GET /accounts/{account_id}/operations - 0.8.2 0.2.0
GET /accounts/{account_id}/operations SSE - 0.8.2 0.2.1
GET /accounts/{account_id}/payments - 0.8.2 0.2.0
GET /accounts/{account_id}/payments SSE - 0.8.2 0.2.0
GET /accounts/{account_id}/effects - 0.8.2 0.2.0
(no support for data, inflation types)
GET /accounts/{account_id}/effects SSE - 0.8.2 0.2.0
(no support for data, inflation types)
GET /accounts/{account_id}/offers + 0.8.2 0.2.0
GET /accounts/{account_id}/trades - 0.8.2 0.2.1
GET /accounts/{account_id}/data/{key} - - -
POST /transactions - 0.8.2 0.2.0
GET /transactions + 0.8.2 0.2.0
GET /transactions SSE + 0.8.2 0.2.0
GET /transactions/{tx_id} + 0.8.2 0.2.0
GET /transactions/{tx_id}/operations - 0.8.2 0.2.0
GET /transactions/{tx_id}/operations SSE - 0.8.2 0.2.1
GET /transactions/{tx_id}/payments - 0.8.2 0.2.0
GET /transactions/{tx_id}/payments SSE - 0.8.2 0.2.0
GET /transactions/{tx_id}/effects - 0.8.2 0.2.0
(no support for data, inflation types)
GET /transactions/{tx_id}/effects SSE - 0.8.2 0.2.0
(no support for data, inflation types)
GET /operations - 0.8.2 0.2.0
GET /operations SSE - 0.8.2 0.2.1
GET /operations/{op_id} - 0.8.2 0.2.0
GET /operations/{op_id}/effects - 0.8.2 0.2.0
(no support for data, inflation types)
GET /operations/{op_id}/effects SSE - 0.8.2 0.2.0
(no support for data, inflation types)
GET /payments - 0.8.2 0.2.0
GET /payments SSE + 0.8.2 0.2.0
GET /effects - 0.8.2 0.2.0
(no support for data, inflation types)
GET /effects SSE - 0.8.2 0.2.0
(no support for data, inflation types)
GET /trades + 0.8.2 0.2.0
(no price field)
GET /trades_aggregations + 0.8.2 0.2.0
GET /offers/{offer_id}/trades - 0.8.2 0.2.1
GET /order_book + 0.8.2 0.2.0
GET /order_book SSE - 0.8.2 0.2.1
GET /paths - 0.8.2 0.2.0
GET /assets - 0.8.2 0.2.0

1 We don't do proper versioning for GO SDK yet. + means implemented in master branch.

2 Native JSON support in JS, no changes needed.

Documentation

Overview

Package horizon contains the type definitions for all of horizon's response resources.

Index

Constants

This section is empty.

Variables

View Source
var KeyTypeNames = map[strkey.VersionByte]string{
	strkey.VersionByteAccountID:     "ed25519_public_key",
	strkey.VersionByteSeed:          "ed25519_secret_seed",
	strkey.VersionByteMuxedAccount:  "muxed_account",
	strkey.VersionByteHashTx:        "preauth_tx",
	strkey.VersionByteHashX:         "sha256_hash",
	strkey.VersionByteSignedPayload: "ed25519_signed_payload",
}

KeyTypeNames maps from strkey version bytes into json string values to use in horizon responses.

Functions

func KeyTypeFromAddress

func KeyTypeFromAddress(address string) (string, error)

KeyTypeFromAddress converts the version byte of the provided strkey encoded value (for example an account id or a signer key) and returns the appropriate horizon-specific type name.

func MustKeyTypeFromAddress

func MustKeyTypeFromAddress(address string) string

MustKeyTypeFromAddress is the panicking variant of KeyTypeFromAddress.

Types

type Account

type Account struct {
	Links struct {
		Self         hal.Link `json:"self"`
		Transactions hal.Link `json:"transactions"`
		Operations   hal.Link `json:"operations"`
		Payments     hal.Link `json:"payments"`
		Effects      hal.Link `json:"effects"`
		Offers       hal.Link `json:"offers"`
		Trades       hal.Link `json:"trades"`
		Data         hal.Link `json:"data"`
	} `json:"_links"`

	ID                   string            `json:"id"`
	AccountID            string            `json:"account_id"`
	Sequence             int64             `json:"sequence,string"`
	SequenceLedger       uint32            `json:"sequence_ledger,omitempty"`
	SequenceTime         string            `json:"sequence_time,omitempty"`
	SubentryCount        int32             `json:"subentry_count"`
	InflationDestination string            `json:"inflation_destination,omitempty"`
	HomeDomain           string            `json:"home_domain,omitempty"`
	LastModifiedLedger   uint32            `json:"last_modified_ledger"`
	LastModifiedTime     *time.Time        `json:"last_modified_time"`
	Thresholds           AccountThresholds `json:"thresholds"`
	Flags                AccountFlags      `json:"flags"`
	Balances             []Balance         `json:"balances"`
	Signers              []Signer          `json:"signers"`
	Data                 map[string]string `json:"data"`
	NumSponsoring        uint32            `json:"num_sponsoring"`
	NumSponsored         uint32            `json:"num_sponsored"`
	Sponsor              string            `json:"sponsor,omitempty"`
	PT                   string            `json:"paging_token"`
}

Account is the summary of an account

func (Account) GetAccountID

func (a Account) GetAccountID() string

GetAccountID returns the Stellar account ID. This is to satisfy the Account interface of txnbuild.

func (Account) GetCreditBalance

func (a Account) GetCreditBalance(code string, issuer string) string

GetCreditBalance returns the balance for given code and issuer

func (*Account) GetData

func (a *Account) GetData(key string) ([]byte, error)

GetData returns decoded value for a given key. If the key does not exist, empty slice will be returned.

func (Account) GetNativeBalance

func (a Account) GetNativeBalance() (string, error)

GetNativeBalance returns the native balance of the account

func (Account) GetSequenceNumber

func (a Account) GetSequenceNumber() (int64, error)

GetSequenceNumber returns the sequence number of the account, and returns it as a 64-bit integer. TODO: since Account.Sequence was changed to int64, error is no longer needed.

func (*Account) IncrementSequenceNumber

func (a *Account) IncrementSequenceNumber() (int64, error)

IncrementSequenceNumber increments the internal record of the account's sequence number by 1. This is typically used after a transaction build so that the next transaction to be built will be valid.

func (*Account) MustGetData

func (a *Account) MustGetData(key string) []byte

MustGetData returns decoded value for a given key. If the key does not exist, empty slice will be returned. If there is an error decoding a value, it will panic.

func (Account) PagingToken

func (res Account) PagingToken() string

PagingToken implementation for hal.Pageable

func (*Account) SignerSummary

func (a *Account) SignerSummary() map[string]int32

SignerSummary returns a map of signer's keys to weights.

type AccountData

type AccountData struct {
	Value   string `json:"value"`
	Sponsor string `json:"sponsor,omitempty"`
}

AccountData represents a single data object stored on by an account

type AccountFilterConfig

type AccountFilterConfig struct {
	Whitelist    []string `json:"whitelist"`
	Enabled      *bool    `json:"enabled"`
	LastModified int64    `json:"last_modified,omitempty"`
}

func (*AccountFilterConfig) UnmarshalJSON

func (f *AccountFilterConfig) UnmarshalJSON(data []byte) error

type AccountFlags

type AccountFlags struct {
	AuthRequired        bool `json:"auth_required"`
	AuthRevocable       bool `json:"auth_revocable"`
	AuthImmutable       bool `json:"auth_immutable"`
	AuthClawbackEnabled bool `json:"auth_clawback_enabled"`
}

AccountFlags represents the state of an account's flags

type AccountThresholds

type AccountThresholds struct {
	LowThreshold  byte `json:"low_threshold"`
	MedThreshold  byte `json:"med_threshold"`
	HighThreshold byte `json:"high_threshold"`
}

AccountThresholds represents an accounts "thresholds", the numerical values needed to satisfy the authorization of a given operation.

type AccountsPage

type AccountsPage struct {
	Links    hal.Links `json:"_links"`
	Embedded struct {
		Records []Account `json:"records"`
	} `json:"_embedded"`
}

AccountsPage returns a list of account records

type Asset

type Asset base.Asset

Asset represents a single asset

type AssetFilterConfig

type AssetFilterConfig struct {
	Whitelist    []string `json:"whitelist"`
	Enabled      *bool    `json:"enabled"`
	LastModified int64    `json:"last_modified,omitempty"`
}

func (*AssetFilterConfig) UnmarshalJSON

func (f *AssetFilterConfig) UnmarshalJSON(data []byte) error

type AssetStat

type AssetStat struct {
	Links struct {
		Toml hal.Link `json:"toml"`
	} `json:"_links"`

	base.Asset
	PT         string `json:"paging_token"`
	ContractID string `json:"contract_id,omitempty"`
	// Action needed in release: horizon-v3.0.0: deprecated field
	NumAccounts          int32 `json:"num_accounts"`
	NumClaimableBalances int32 `json:"num_claimable_balances"`
	NumLiquidityPools    int32 `json:"num_liquidity_pools"`
	NumContracts         int32 `json:"num_contracts"`
	NumArchivedContracts int32 `json:"num_archived_contracts"`
	// Action needed in release: horizon-v3.0.0: deprecated field
	Amount                  string            `json:"amount"`
	Accounts                AssetStatAccounts `json:"accounts"`
	ClaimableBalancesAmount string            `json:"claimable_balances_amount"`
	LiquidityPoolsAmount    string            `json:"liquidity_pools_amount"`
	ContractsAmount         string            `json:"contracts_amount"`
	ArchivedContractsAmount string            `json:"archived_contracts_amount"`
	Balances                AssetStatBalances `json:"balances"`
	Flags                   AccountFlags      `json:"flags"`
}

AssetStat represents the statistics for a single Asset

func (AssetStat) PagingToken

func (res AssetStat) PagingToken() string

PagingToken implementation for hal.Pageable

type AssetStatAccounts

type AssetStatAccounts struct {
	Authorized                      int32 `json:"authorized"`
	AuthorizedToMaintainLiabilities int32 `json:"authorized_to_maintain_liabilities"`
	Unauthorized                    int32 `json:"unauthorized"`
}

AssetStatAccounts represents the summarized acount numbers for a single Asset

type AssetStatBalances

type AssetStatBalances struct {
	Authorized                      string `json:"authorized"`
	AuthorizedToMaintainLiabilities string `json:"authorized_to_maintain_liabilities"`
	Unauthorized                    string `json:"unauthorized"`
}

AssetStatBalances represents the summarized balances for a single Asset

type AssetsPage

type AssetsPage struct {
	Links    hal.Links `json:"_links"`
	Embedded struct {
		Records []AssetStat
	} `json:"_embedded"`
}

AssetsPage contains page of assets returned by Horizon.

type Balance

type Balance struct {
	Balance                           string `json:"balance"`
	LiquidityPoolId                   string `json:"liquidity_pool_id,omitempty"`
	Limit                             string `json:"limit,omitempty"`
	BuyingLiabilities                 string `json:"buying_liabilities,omitempty"`
	SellingLiabilities                string `json:"selling_liabilities,omitempty"`
	Sponsor                           string `json:"sponsor,omitempty"`
	LastModifiedLedger                uint32 `json:"last_modified_ledger,omitempty"`
	IsAuthorized                      *bool  `json:"is_authorized,omitempty"`
	IsAuthorizedToMaintainLiabilities *bool  `json:"is_authorized_to_maintain_liabilities,omitempty"`
	IsClawbackEnabled                 *bool  `json:"is_clawback_enabled,omitempty"`
	base.Asset
}

Balance represents an account's holdings for either a single currency type or shares in a liquidity pool.

type ClaimableBalance

type ClaimableBalance struct {
	Links struct {
		Self         hal.Link `json:"self"`
		Transactions hal.Link `json:"transactions"`
		Operations   hal.Link `json:"operations"`
	} `json:"_links"`

	BalanceID          string                `json:"id"`
	Asset              string                `json:"asset"`
	Amount             string                `json:"amount"`
	Sponsor            string                `json:"sponsor,omitempty"`
	LastModifiedLedger uint32                `json:"last_modified_ledger"`
	LastModifiedTime   *time.Time            `json:"last_modified_time"`
	Claimants          []Claimant            `json:"claimants"`
	Flags              ClaimableBalanceFlags `json:"flags"`
	PT                 string                `json:"paging_token"`
}

ClaimableBalance represents a claimable balance

func (ClaimableBalance) PagingToken

func (res ClaimableBalance) PagingToken() string

PagingToken implementation for hal.Pageable

type ClaimableBalanceFlags

type ClaimableBalanceFlags struct {
	ClawbackEnabled bool `json:"clawback_enabled"`
}

ClaimableBalanceFlags represents the state of a claimable balance's flags

type ClaimableBalances

type ClaimableBalances struct {
	Links struct {
		Self hal.Link `json:"self"`
	} `json:"_links"`

	Embedded struct {
		Records []ClaimableBalance `json:"records"`
	} `json:"_embedded"`
}

type Claimant

type Claimant struct {
	Destination string             `json:"destination"`
	Predicate   xdr.ClaimPredicate `json:"predicate"`
}

Claimant represents a claimable balance claimant

type FeeBumpTransaction

type FeeBumpTransaction struct {
	Hash       string   `json:"hash"`
	Signatures []string `json:"signatures"`
}

FeeBumpTransaction contains information about a fee bump transaction

type FeeDistribution

type FeeDistribution struct {
	Max  int64 `json:"max,string"`
	Min  int64 `json:"min,string"`
	Mode int64 `json:"mode,string"`
	P10  int64 `json:"p10,string"`
	P20  int64 `json:"p20,string"`
	P30  int64 `json:"p30,string"`
	P40  int64 `json:"p40,string"`
	P50  int64 `json:"p50,string"`
	P60  int64 `json:"p60,string"`
	P70  int64 `json:"p70,string"`
	P80  int64 `json:"p80,string"`
	P90  int64 `json:"p90,string"`
	P95  int64 `json:"p95,string"`
	P99  int64 `json:"p99,string"`
}

type FeeStats

type FeeStats struct {
	LastLedger          uint32  `json:"last_ledger,string"`
	LastLedgerBaseFee   int64   `json:"last_ledger_base_fee,string"`
	LedgerCapacityUsage float64 `json:"ledger_capacity_usage,string"`

	FeeCharged FeeDistribution `json:"fee_charged"`
	MaxFee     FeeDistribution `json:"max_fee"`
}

FeeStats represents a response of fees from horizon To do: implement fee suggestions if agreement is reached in https://github.com/stellar/go/issues/926

type InnerTransaction

type InnerTransaction struct {
	Hash       string   `json:"hash"`
	Signatures []string `json:"signatures"`
	MaxFee     int64    `json:"max_fee,string"`
}

InnerTransaction contains information about the inner transaction contained within a fee bump transaction

type Ledger

type Ledger struct {
	Links struct {
		Self         hal.Link `json:"self"`
		Transactions hal.Link `json:"transactions"`
		Operations   hal.Link `json:"operations"`
		Payments     hal.Link `json:"payments"`
		Effects      hal.Link `json:"effects"`
	} `json:"_links"`
	ID                         string    `json:"id"`
	PT                         string    `json:"paging_token"`
	Hash                       string    `json:"hash"`
	PrevHash                   string    `json:"prev_hash,omitempty"`
	Sequence                   int32     `json:"sequence"`
	SuccessfulTransactionCount int32     `json:"successful_transaction_count"`
	FailedTransactionCount     *int32    `json:"failed_transaction_count"`
	OperationCount             int32     `json:"operation_count"`
	TxSetOperationCount        *int32    `json:"tx_set_operation_count"`
	ClosedAt                   time.Time `json:"closed_at"`
	TotalCoins                 string    `json:"total_coins"`
	FeePool                    string    `json:"fee_pool"`
	BaseFee                    int32     `json:"base_fee_in_stroops"`
	BaseReserve                int32     `json:"base_reserve_in_stroops"`
	MaxTxSetSize               int32     `json:"max_tx_set_size"`
	ProtocolVersion            int32     `json:"protocol_version"`
	HeaderXDR                  string    `json:"header_xdr"`
}

Ledger represents a single closed ledger

func (Ledger) PagingToken

func (l Ledger) PagingToken() string

type LedgersPage

type LedgersPage struct {
	Links    hal.Links `json:"_links"`
	Embedded struct {
		Records []Ledger
	} `json:"_embedded"`
}

LedgersPage contains page of ledger information returned by Horizon

type LiquidityPool

type LiquidityPool struct {
	Links struct {
		Self         hal.Link `json:"self"`
		Transactions hal.Link `json:"transactions"`
		Operations   hal.Link `json:"operations"`
	} `json:"_links"`

	ID                 string                 `json:"id"`
	PT                 string                 `json:"paging_token"`
	FeeBP              uint32                 `json:"fee_bp"`
	Type               string                 `json:"type"`
	TotalTrustlines    uint64                 `json:"total_trustlines,string"`
	TotalShares        string                 `json:"total_shares"`
	Reserves           []LiquidityPoolReserve `json:"reserves"`
	LastModifiedLedger uint32                 `json:"last_modified_ledger"`
	LastModifiedTime   *time.Time             `json:"last_modified_time"`
}

LiquidityPool represents a liquidity pool

func (LiquidityPool) PagingToken

func (res LiquidityPool) PagingToken() string

PagingToken implementation for hal.Pageable

type LiquidityPoolReserve

type LiquidityPoolReserve struct {
	Asset  string `json:"asset"`
	Amount string `json:"amount"`
}

LiquidityPoolReserve represents a liquidity pool asset reserve

type LiquidityPoolsPage

type LiquidityPoolsPage struct {
	Links    hal.Links `json:"_links"`
	Embedded struct {
		Records []LiquidityPool `json:"records"`
	} `json:"_embedded"`
}

LiquidityPoolsPage returns a list of liquidity pool records

type Offer

type Offer struct {
	Links struct {
		Self       hal.Link `json:"self"`
		OfferMaker hal.Link `json:"offer_maker"`
	} `json:"_links"`

	ID                 int64      `json:"id,string"`
	PT                 string     `json:"paging_token"`
	Seller             string     `json:"seller"`
	Selling            Asset      `json:"selling"`
	Buying             Asset      `json:"buying"`
	Amount             string     `json:"amount"`
	PriceR             Price      `json:"price_r"`
	Price              string     `json:"price"`
	LastModifiedLedger int32      `json:"last_modified_ledger"`
	LastModifiedTime   *time.Time `json:"last_modified_time"`
	Sponsor            string     `json:"sponsor,omitempty"`
}

Offer is the display form of an offer to trade currency.

func (Offer) PagingToken

func (o Offer) PagingToken() string

type OffersPage

type OffersPage struct {
	Links    hal.Links `json:"_links"`
	Embedded struct {
		Records []Offer `json:"records"`
	} `json:"_embedded"`
}

OffersPage returns a list of offers

type OrderBookSummary

type OrderBookSummary struct {
	Bids    []PriceLevel `json:"bids"`
	Asks    []PriceLevel `json:"asks"`
	Selling Asset        `json:"base"`
	Buying  Asset        `json:"counter"`
}

OrderBookSummary represents a snapshot summary of a given order book

type Path

type Path struct {
	SourceAssetType        string  `json:"source_asset_type"`
	SourceAssetCode        string  `json:"source_asset_code,omitempty"`
	SourceAssetIssuer      string  `json:"source_asset_issuer,omitempty"`
	SourceAmount           string  `json:"source_amount"`
	DestinationAssetType   string  `json:"destination_asset_type"`
	DestinationAssetCode   string  `json:"destination_asset_code,omitempty"`
	DestinationAssetIssuer string  `json:"destination_asset_issuer,omitempty"`
	DestinationAmount      string  `json:"destination_amount"`
	Path                   []Asset `json:"path"`
}

Path represents a single payment path.

func (Path) PagingToken

func (p Path) PagingToken() string

stub implementation to satisfy pageable interface

type PathsPage

type PathsPage struct {
	Links    hal.Links `json:"_links"`
	Embedded struct {
		Records []Path
	} `json:"_embedded"`
}

PathsPage contains records of payment paths found by horizon

type Price

type Price base.Price

Price represents a price for an offer

type PriceLevel

type PriceLevel struct {
	PriceR Price  `json:"price_r"`
	Price  string `json:"price"`
	Amount string `json:"amount"`
}

PriceLevel represents an aggregation of offers that share a given price

type Root

type Root struct {
	Links struct {
		Account             hal.Link  `json:"account"`
		Accounts            *hal.Link `json:"accounts,omitempty"`
		AccountTransactions hal.Link  `json:"account_transactions"`
		ClaimableBalances   *hal.Link `json:"claimable_balances"`
		Assets              hal.Link  `json:"assets"`
		Effects             hal.Link  `json:"effects"`
		FeeStats            hal.Link  `json:"fee_stats"`
		Friendbot           *hal.Link `json:"friendbot,omitempty"`
		Ledger              hal.Link  `json:"ledger"`
		Ledgers             hal.Link  `json:"ledgers"`
		LiquidityPools      *hal.Link `json:"liquidity_pools"`
		Offer               *hal.Link `json:"offer,omitempty"`
		Offers              *hal.Link `json:"offers,omitempty"`
		Operation           hal.Link  `json:"operation"`
		Operations          hal.Link  `json:"operations"`
		OrderBook           hal.Link  `json:"order_book"`
		Payments            hal.Link  `json:"payments"`
		Self                hal.Link  `json:"self"`
		StrictReceivePaths  *hal.Link `json:"strict_receive_paths"`
		StrictSendPaths     *hal.Link `json:"strict_send_paths"`
		TradeAggregations   hal.Link  `json:"trade_aggregations"`
		Trades              hal.Link  `json:"trades"`
		Transaction         hal.Link  `json:"transaction"`
		Transactions        hal.Link  `json:"transactions"`
	} `json:"_links"`

	HorizonVersion               string    `json:"horizon_version"`
	StellarCoreVersion           string    `json:"core_version"`
	IngestSequence               uint32    `json:"ingest_latest_ledger"`
	HorizonSequence              int32     `json:"history_latest_ledger"`
	HorizonLatestClosedAt        time.Time `json:"history_latest_ledger_closed_at"`
	HistoryElderSequence         int32     `json:"history_elder_ledger"`
	CoreSequence                 int32     `json:"core_latest_ledger"`
	NetworkPassphrase            string    `json:"network_passphrase"`
	CurrentProtocolVersion       int32     `json:"current_protocol_version"`
	SupportedProtocolVersion     uint32    `json:"supported_protocol_version"`
	CoreSupportedProtocolVersion int32     `json:"core_supported_protocol_version"`
}

Root is the initial map of links into the api.

type Signer

type Signer struct {
	Weight  int32  `json:"weight"`
	Key     string `json:"key"`
	Type    string `json:"type"`
	Sponsor string `json:"sponsor,omitempty"`
}

Signer represents one of an account's signers.

type Trade

type Trade struct {
	Links struct {
		Self      hal.Link `json:"self"`
		Base      hal.Link `json:"base"`
		Counter   hal.Link `json:"counter"`
		Operation hal.Link `json:"operation"`
	} `json:"_links"`

	ID                     string     `json:"id"`
	PT                     string     `json:"paging_token"`
	LedgerCloseTime        time.Time  `json:"ledger_close_time"`
	OfferID                string     `json:"offer_id,omitempty"`
	TradeType              string     `json:"trade_type"`
	LiquidityPoolFeeBP     uint32     `json:"liquidity_pool_fee_bp,omitempty"`
	BaseLiquidityPoolID    string     `json:"base_liquidity_pool_id,omitempty"`
	BaseOfferID            string     `json:"base_offer_id,omitempty"`
	BaseAccount            string     `json:"base_account,omitempty"`
	BaseAmount             string     `json:"base_amount"`
	BaseAssetType          string     `json:"base_asset_type"`
	BaseAssetCode          string     `json:"base_asset_code,omitempty"`
	BaseAssetIssuer        string     `json:"base_asset_issuer,omitempty"`
	CounterLiquidityPoolID string     `json:"counter_liquidity_pool_id,omitempty"`
	CounterOfferID         string     `json:"counter_offer_id,omitempty"`
	CounterAccount         string     `json:"counter_account,omitempty"`
	CounterAmount          string     `json:"counter_amount"`
	CounterAssetType       string     `json:"counter_asset_type"`
	CounterAssetCode       string     `json:"counter_asset_code,omitempty"`
	CounterAssetIssuer     string     `json:"counter_asset_issuer,omitempty"`
	BaseIsSeller           bool       `json:"base_is_seller"`
	Price                  TradePrice `json:"price,omitempty"`
}

Trade represents a horizon digested trade

func (Trade) PagingToken

func (res Trade) PagingToken() string

PagingToken implementation for hal.Pageable

type TradeAggregation

type TradeAggregation struct {
	Timestamp     int64      `json:"timestamp,string"`
	TradeCount    int64      `json:"trade_count,string"`
	BaseVolume    string     `json:"base_volume"`
	CounterVolume string     `json:"counter_volume"`
	Average       string     `json:"avg"`
	High          string     `json:"high"`
	HighR         TradePrice `json:"high_r"`
	Low           string     `json:"low"`
	LowR          TradePrice `json:"low_r"`
	Open          string     `json:"open"`
	OpenR         TradePrice `json:"open_r"`
	Close         string     `json:"close"`
	CloseR        TradePrice `json:"close_r"`
}

TradeAggregation represents trade data aggregation over a period of time

func (TradeAggregation) PagingToken

func (res TradeAggregation) PagingToken() string

PagingToken implementation for hal.Pageable. Not actually used

type TradeAggregationsPage

type TradeAggregationsPage struct {
	Links    hal.Links `json:"_links"`
	Embedded struct {
		Records []TradeAggregation `json:"records"`
	} `json:"_embedded"`
}

TradeAggregationsPage returns a list of aggregated trade records, aggregated by resolution

type TradeEffect

type TradeEffect struct {
	Links struct {
		Self      hal.Link `json:"self"`
		Seller    hal.Link `json:"seller"`
		Buyer     hal.Link `json:"buyer"`
		Operation hal.Link `json:"operation"`
	} `json:"_links"`

	ID                string    `json:"id"`
	PT                string    `json:"paging_token"`
	OfferID           string    `json:"offer_id"`
	Seller            string    `json:"seller"`
	SoldAmount        string    `json:"sold_amount"`
	SoldAssetType     string    `json:"sold_asset_type"`
	SoldAssetCode     string    `json:"sold_asset_code,omitempty"`
	SoldAssetIssuer   string    `json:"sold_asset_issuer,omitempty"`
	Buyer             string    `json:"buyer"`
	BoughtAmount      string    `json:"bought_amount"`
	BoughtAssetType   string    `json:"bought_asset_type"`
	BoughtAssetCode   string    `json:"bought_asset_code,omitempty"`
	BoughtAssetIssuer string    `json:"bought_asset_issuer,omitempty"`
	LedgerCloseTime   time.Time `json:"created_at"`
}

TradeEffect represents a trade effect resource.

type TradePrice

type TradePrice struct {
	N int64 `json:"n,string"`
	D int64 `json:"d,string"`
}

TradePrice represents a price for a trade

func (TradePrice) String

func (p TradePrice) String() string

String returns a string representation of the trade price

func (*TradePrice) UnmarshalJSON

func (p *TradePrice) UnmarshalJSON(data []byte) error

UnmarshalJSON implements a custom unmarshaler for TradePrice which can handle a numerator and denominator fields which can be a string or int

type TradesPage

type TradesPage struct {
	Links    hal.Links `json:"_links"`
	Embedded struct {
		Records []Trade `json:"records"`
	} `json:"_embedded"`
}

TradesPage returns a list of trade records

type Transaction

type Transaction struct {
	Links struct {
		Self       hal.Link `json:"self"`
		Account    hal.Link `json:"account"`
		Ledger     hal.Link `json:"ledger"`
		Operations hal.Link `json:"operations"`
		Effects    hal.Link `json:"effects"`
		Precedes   hal.Link `json:"precedes"`
		Succeeds   hal.Link `json:"succeeds"`
		// Temporarily include Transaction as a link so that Transaction
		// can be fully compatible with TransactionSuccess
		// When TransactionSuccess is removed from the SDKs we can remove this HAL link
		Transaction hal.Link `json:"transaction"`
	} `json:"_links"`
	ID                string    `json:"id"`
	PT                string    `json:"paging_token"`
	Successful        bool      `json:"successful"`
	Hash              string    `json:"hash"`
	Ledger            int32     `json:"ledger"`
	LedgerCloseTime   time.Time `json:"created_at"`
	Account           string    `json:"source_account"`
	AccountMuxed      string    `json:"account_muxed,omitempty"`
	AccountMuxedID    uint64    `json:"account_muxed_id,omitempty,string"`
	AccountSequence   int64     `json:"source_account_sequence,string"`
	FeeAccount        string    `json:"fee_account"`
	FeeAccountMuxed   string    `json:"fee_account_muxed,omitempty"`
	FeeAccountMuxedID uint64    `json:"fee_account_muxed_id,omitempty,string"`
	FeeCharged        int64     `json:"fee_charged,string"`
	MaxFee            int64     `json:"max_fee,string"`
	OperationCount    int32     `json:"operation_count"`
	EnvelopeXdr       string    `json:"envelope_xdr"`
	ResultXdr         string    `json:"result_xdr"`
	ResultMetaXdr     string    `json:"result_meta_xdr,omitempty"`
	FeeMetaXdr        string    `json:"fee_meta_xdr"`
	MemoType          string    `json:"memo_type"`
	MemoBytes         string    `json:"memo_bytes,omitempty"`
	Memo              string    `json:"memo,omitempty"`
	Signatures        []string  `json:"signatures"`
	// Action needed in release: horizon-v3.0.0: remove valid_(after|before)
	ValidAfter         string                    `json:"valid_after,omitempty"`
	ValidBefore        string                    `json:"valid_before,omitempty"`
	Preconditions      *TransactionPreconditions `json:"preconditions,omitempty"`
	FeeBumpTransaction *FeeBumpTransaction       `json:"fee_bump_transaction,omitempty"`
	InnerTransaction   *InnerTransaction         `json:"inner_transaction,omitempty"`
}

Transaction represents a single, successful transaction

func (Transaction) MarshalJSON

func (t Transaction) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom marshaler for Transaction. The memo field should be omitted if and only if the memo_type is "none".

func (Transaction) PagingToken

func (t Transaction) PagingToken() string

PagingToken implementation for hal.Pageable

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(data []byte) error

UnmarshalJSON implements a custom unmarshaler for Transaction which can handle a max_fee field which can be a string or int

type TransactionPreconditions

type TransactionPreconditions struct {
	TimeBounds   *TransactionPreconditionsTimebounds   `json:"timebounds,omitempty"`
	LedgerBounds *TransactionPreconditionsLedgerbounds `json:"ledgerbounds,omitempty"`

	MinAccountSequence          string `json:"min_account_sequence,omitempty"`
	MinAccountSequenceAge       string `json:"min_account_sequence_age,omitempty"`
	MinAccountSequenceLedgerGap uint32 `json:"min_account_sequence_ledger_gap,omitempty"`

	ExtraSigners []string `json:"extra_signers,omitempty"`
}

type TransactionPreconditionsLedgerbounds

type TransactionPreconditionsLedgerbounds struct {
	MinLedger uint32 `json:"min_ledger"`
	MaxLedger uint32 `json:"max_ledger,omitempty"`
}

type TransactionPreconditionsTimebounds

type TransactionPreconditionsTimebounds struct {
	MinTime string `json:"min_time,omitempty"`
	MaxTime string `json:"max_time,omitempty"`
}

type TransactionResultCodes

type TransactionResultCodes struct {
	TransactionCode      string   `json:"transaction"`
	InnerTransactionCode string   `json:"inner_transaction,omitempty"`
	OperationCodes       []string `json:"operations,omitempty"`
}

TransactionResultCodes represent a summary of result codes returned from a single xdr TransactionResult

type TransactionsPage

type TransactionsPage struct {
	Links    hal.Links `json:"_links"`
	Embedded struct {
		Records []Transaction
	} `json:"_embedded"`
}

TransactionsPage contains records of transaction information returned by Horizon

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL