Documentation ¶
Overview ¶
Package core contains database record definitions useable for reading rows from a Stellar Core db
Index ¶
- func AssetFromDB(typ xdr.AssetType, code string, issuer string) (result xdr.Asset, err error)
- type Account
- type AccountData
- type LedgerHeader
- type Offer
- type Q
- func (q *Q) AccountByAddress(dest *Account, addy string) error
- func (q *Q) AccountDataByKey(dest *AccountData, addy string, key string) error
- func (q *Q) AllAssets(dest interface{}) error
- func (q *Q) AllDataByAddress(dest interface{}, addy string) error
- func (q *Q) AssetsForAddress(addy string) ([]xdr.Asset, []xdr.Int64, error)
- func (q *Q) BalancesForAsset(assetType int32, assetCode string, assetIssuer string) (int32, string, error)
- func (q *Q) ConnectedAssets(dest interface{}, selling xdr.Asset) error
- func (q *Q) ElderLedger(dest *int32) error
- func (q *Q) LatestLedger(dest interface{}) error
- func (q *Q) LedgerHeaderBySequence(dest interface{}, seq int32) error
- func (q *Q) OffersByAddress(dest interface{}, addy string, pq db2.PageQuery) error
- func (q *Q) SchemaVersion() (int, error)
- func (q *Q) SignersByAddress(dest interface{}, addy string) error
- func (q *Q) TransactionByHashAfterLedger(dest interface{}, hash string, ledger int32) error
- func (q *Q) TransactionFeesByLedger(dest interface{}, seq int32) error
- func (q *Q) TransactionsByLedger(dest interface{}, seq int32) error
- func (q *Q) TrustlinesByAddress(dest interface{}, addy string) error
- type Signer
- type Transaction
- func (tx *Transaction) Base64Signatures() []string
- func (tx *Transaction) EnvelopeXDR() string
- func (tx *Transaction) FeeCharged() int32
- func (tx *Transaction) IsSuccessful() bool
- func (tx *Transaction) MaxFee() int32
- func (tx *Transaction) Memo() null.String
- func (tx *Transaction) MemoType() string
- func (tx *Transaction) ResultMetaXDR() string
- func (tx *Transaction) ResultXDR() string
- func (tx *Transaction) Sequence() int64
- func (tx *Transaction) SourceAddress() string
- type TransactionFee
- type Trustline
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct { Accountid string Balance xdr.Int64 Seqnum string Numsubentries int32 Inflationdest null.String HomeDomain null.String Thresholds xdr.Thresholds Flags xdr.AccountFlags LastModified uint32 BuyingLiabilities xdr.Int64 `db:"buyingliabilities"` SellingLiabilities xdr.Int64 `db:"sellingliabilities"` }
Account is a row of data from the `accounts` table
func (Account) IsAuthImmutable ¶
IsAuthImmutable returns true if the account has the "AUTH_IMMUTABLE" option turned on.
func (Account) IsAuthRequired ¶
IsAuthRequired returns true if the account has the "AUTH_REQUIRED" option turned on.
func (Account) IsAuthRevocable ¶
IsAuthRevocable returns true if the account has the "AUTH_REVOCABLE" option turned on.
type AccountData ¶
type AccountData struct { Accountid string Key string `db:"dataname"` Value string `db:"datavalue"` }
AccountData is a row of data from the `accountdata` table
func (AccountData) Raw ¶
func (ad AccountData) Raw() ([]byte, error)
Raw returns the decoded, raw value of the account data
type LedgerHeader ¶
type LedgerHeader struct { LedgerHash string `db:"ledgerhash"` PrevHash string `db:"prevhash"` BucketListHash string `db:"bucketlisthash"` CloseTime int64 `db:"closetime"` Sequence uint32 `db:"ledgerseq"` Data xdr.LedgerHeader `db:"data"` }
LedgerHeader is row of data from the `ledgerheaders` table
func (*LedgerHeader) DataXDR ¶
func (lh *LedgerHeader) DataXDR() string
DataXDR returns the base64 encoded ledger header
type Offer ¶
type Offer struct { SellerID string `db:"sellerid"` OfferID int64 `db:"offerid"` SellingAsset xdr.Asset `db:"sellingasset"` BuyingAsset xdr.Asset `db:"buyingasset"` Amount xdr.Int64 `db:"amount"` Pricen int32 `db:"pricen"` Priced int32 `db:"priced"` Price float64 `db:"price"` Flags int32 `db:"flags"` Lastmodified int32 `db:"lastmodified"` }
Offer is row of data from the `offers` table from stellar-core
func (Offer) PagingToken ¶
PagingToken returns a suitable paging token for the Offer
func (Offer) PriceAsString ¶
PriceAsString return the price fraction as a floating point approximate.
type Q ¶
Q is a helper struct on which to hang common queries against a stellar core database.
func (*Q) AccountByAddress ¶
AccountByAddress loads a row from `accounts`, by address
func (*Q) AccountDataByKey ¶
func (q *Q) AccountDataByKey(dest *AccountData, addy string, key string) error
AccountDataByKey loads a row from `accountdata`, by key
func (*Q) AllDataByAddress ¶
AllDataByAddress loads all data for `addy`
func (*Q) AssetsForAddress ¶
AssetsForAddress returns a list of assets and balances for those assets held by a given address.
func (*Q) BalancesForAsset ¶
func (q *Q) BalancesForAsset( assetType int32, assetCode string, assetIssuer string, ) (int32, string, error)
BalancesForAsset returns all the balances by asset type, code, issuer
func (*Q) ConnectedAssets ¶
ConnectedAssets loads xdr.Asset records for the purposes of path finding. Given the input asset type, a list of xdr.Assets is returned that each have some available trades for the input asset.
func (*Q) ElderLedger ¶
ElderLedger represents the oldest "ingestable" ledger known to the stellar-core database this ingestion system is communicating with. Horizon, which wants to operate on a contiguous range of ledger data (i.e. free from gaps) uses the elder ledger to start importing in the case of an empty database. NOTE: This current query used is correct, but slow. Please keep this query out of latency sensitive or frequently trafficked code paths.
func (*Q) LatestLedger ¶
LatestLedger loads the latest known ledger
func (*Q) LedgerHeaderBySequence ¶
LedgerHeaderBySequence is a query that loads a single row from the `ledgerheaders` table.
func (*Q) OffersByAddress ¶
OffersByAddress loads a page of active offers for the given address.
func (*Q) SchemaVersion ¶
SchemaVersion returns Core DB schema version
func (*Q) SignersByAddress ¶
SignersByAddress loads all signer rows for `addy`
func (*Q) TransactionByHashAfterLedger ¶
TransactionByHashAfterLedger is a query that loads a single row from the `txhistory`.
func (*Q) TransactionFeesByLedger ¶
TransactionFeesByLedger is a query that loads all rows from `txfeehistory` where ledgerseq matches `Sequence.`
func (*Q) TransactionsByLedger ¶
TransactionsByLedger is a query that loads all rows from `txhistory` where ledgerseq matches `Sequence.`
func (*Q) TrustlinesByAddress ¶
TrustlinesByAddress loads all trustlines for `addy`
type Transaction ¶
type Transaction struct { TransactionHash string `db:"txid"` LedgerSequence int32 `db:"ledgerseq"` Index int32 `db:"txindex"` Envelope xdr.TransactionEnvelope `db:"txbody"` Result xdr.TransactionResultPair `db:"txresult"` ResultMeta xdr.TransactionMeta `db:"txmeta"` }
Transaction is row of data from the `txhistory` table from stellar-core
func (*Transaction) Base64Signatures ¶
func (tx *Transaction) Base64Signatures() []string
Base64Signatures returns a slice of strings where each element is a base64 encoded representation of a signature attached to this transaction.
func (*Transaction) EnvelopeXDR ¶
func (tx *Transaction) EnvelopeXDR() string
EnvelopeXDR returns the XDR encoded envelope for this transaction
func (*Transaction) FeeCharged ¶
func (tx *Transaction) FeeCharged() int32
FeeCharged returns the fee that was actually charged for `tx`
func (*Transaction) IsSuccessful ¶
func (tx *Transaction) IsSuccessful() bool
IsSuccessful returns true when the transaction was successful.
func (*Transaction) MaxFee ¶
func (tx *Transaction) MaxFee() int32
Fee returns the max fee that was set for `tx`
func (*Transaction) Memo ¶
func (tx *Transaction) Memo() null.String
Memo returns the memo for this transaction, if there is one.
func (*Transaction) MemoType ¶
func (tx *Transaction) MemoType() string
MemoType returns the memo type for this transaction
func (*Transaction) ResultMetaXDR ¶
func (tx *Transaction) ResultMetaXDR() string
ResultMetaXDR returns the XDR encoded result meta for this transaction
func (*Transaction) ResultXDR ¶
func (tx *Transaction) ResultXDR() string
ResultXDR returns the XDR encoded result for this transaction
func (*Transaction) Sequence ¶
func (tx *Transaction) Sequence() int64
Sequence returns the sequence number for `tx`
func (*Transaction) SourceAddress ¶
func (tx *Transaction) SourceAddress() string
SourceAddress returns the strkey-encoded account id that paid the fee for `tx`.
type TransactionFee ¶
type TransactionFee struct { TransactionHash string `db:"txid"` LedgerSequence int32 `db:"ledgerseq"` Index int32 `db:"txindex"` Changes xdr.LedgerEntryChanges `db:"txchanges"` }
TransactionFee is row of data from the `txfeehistory` table from stellar-core
func (*TransactionFee) ChangesXDR ¶
func (fee *TransactionFee) ChangesXDR() string
ChangesXDR returns the XDR encoded changes for this transaction fee
type Trustline ¶
type Trustline struct { Accountid string Assettype xdr.AssetType Issuer string Assetcode string Tlimit xdr.Int64 Balance xdr.Int64 Flags int32 LastModified uint32 BuyingLiabilities xdr.Int64 `db:"buyingliabilities"` SellingLiabilities xdr.Int64 `db:"sellingliabilities"` }
Trustline is a row of data from the `trustlines` table from stellar-core