actions

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0, Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Package actions provides the infrastructure for defining and executing actions (code that is triggered in response to an client request) on aurora. At present it allows for defining actions that can respond using JSON or SSE.

Index

Constants

View Source
const (
	// ParamCursor is a query string param name
	ParamCursor = "cursor"
	// ParamOrder is a query string param name
	ParamOrder = "order"
	// ParamLimit is a query string param name
	ParamLimit = "limit"
	// LastLedgerHeaderName is the header which is set on all endpoints
	LastLedgerHeaderName = "Latest-Ledger"
)

TODO: move these constants to urlparam.go as we should parse the params with http handlers in the upper level package.

Variables

View Source
var DestinationAssetsOrDestinationAccountProblem = problem.P{
	Type:   "bad_request",
	Title:  "Bad Request",
	Status: http.StatusBadRequest,
	Detail: "The request requires either a list of destination assets or a destination account. " +
		"Both fields cannot be present.",
}

DestinationAssetsOrDestinationAccountProblem custom error where destination asserts or accounts are required

View Source
var SourceAssetsOrSourceAccountProblem = problem.P{
	Type:   "bad_request",
	Title:  "Bad Request",
	Status: http.StatusBadRequest,
	Detail: "The request requires either a list of source assets or a source account. " +
		"Both fields cannot be present.",
}

SourceAssetsOrSourceAccountProblem custom error where source assets or account is required

Functions

func AccountInfo

func AccountInfo(ctx context.Context, hq *history.Q, addr string) (*protocol.Account, error)

AccountInfo returns the information about an account identified by addr.

func FullURL added in v1.11.1

func FullURL(ctx context.Context) *url.URL

FullURL returns a URL containing the information regarding the original request stored in the context.

func GetPageQuery added in v1.11.1

func GetPageQuery(ledgerState *ledger.State, r *http.Request, opts ...Opt) (db2.PageQuery, error)

GetPageQuery is a helper that returns a new db.PageQuery struct initialized using the results from a call to GetPagingParams()

func GetTransactionID added in v1.11.1

func GetTransactionID(r *http.Request, name string) (string, error)

GetTransactionID retireves a transaction identifier by attempting to decode an hex-encoded, 64-digit lowercase string at the provided name.

func SetLastLedgerHeader added in v1.11.1

func SetLastLedgerHeader(w HeaderWriter, lastLedger uint32)

SetLastLedgerHeader sets the Latest-Ledger header

Types

type Account added in v1.11.1

type Account protocol.Account

func (Account) Equals added in v1.11.1

func (a Account) Equals(other StreamableObjectResponse) bool

type AccountByIDQuery added in v1.11.1

type AccountByIDQuery struct {
	AccountID string `schema:"account_id" valid:"accountID,optional"`
}

AccountByIDQuery query struct for accounts/{account_id} end-point

type AccountDataQuery added in v1.11.1

type AccountDataQuery struct {
	AccountID string `schema:"account_id" valid:"accountID"`
	Key       string `schema:"key" valid:"length(1|64)"`
}

AccountDataQuery query struct for account data end-point

type AccountOffersQuery added in v1.11.1

type AccountOffersQuery struct {
	AccountID string `schema:"account_id" valid:"accountID,required"`
}

AccountOffersQuery query struct for offers end-point

type AccountsQuery added in v1.11.1

type AccountsQuery struct {
	Signer        string `schema:"signer" valid:"accountID,optional"`
	Sponsor       string `schema:"sponsor" valid:"accountID,optional"`
	AssetFilter   string `schema:"asset" valid:"asset,optional"`
	LiquidityPool string `schema:"liquidity_pool" valid:"sha256,optional"`
}

AccountsQuery query struct for accounts end-point

func (AccountsQuery) Asset added in v1.11.1

func (q AccountsQuery) Asset() *xdr.Asset

Asset returns an xdr.Asset representing the Asset we want to find the trustees by.

func (AccountsQuery) URITemplate added in v1.11.1

func (q AccountsQuery) URITemplate() string

URITemplate returns a rfc6570 URI template the query struct

func (AccountsQuery) Validate added in v1.11.1

func (q AccountsQuery) Validate() error

Validate runs custom validations.

type AssetStatsHandler added in v1.11.1

type AssetStatsHandler struct {
	LedgerState *ledger.State
}

AssetStatsHandler is the action handler for the /asset endpoint

func (AssetStatsHandler) GetResourcePage added in v1.11.1

func (handler AssetStatsHandler) GetResourcePage(
	w HeaderWriter,
	r *http.Request,
) ([]hal.Pageable, error)

GetResourcePage returns a page of offers.

type AsyncSubmitTransactionHandler added in v1.11.1

type AsyncSubmitTransactionHandler struct {
	NetworkPassphrase string
	DisableTxSub      bool
	ClientWithMetrics coreClient
	CoreStateGetter
}

func (AsyncSubmitTransactionHandler) GetResource added in v1.11.1

func (handler AsyncSubmitTransactionHandler) GetResource(_ HeaderWriter, r *http.Request) (interface{}, error)

type ClaimableBalanceQuery added in v1.11.1

type ClaimableBalanceQuery struct {
	ID string `schema:"id" valid:"claimableBalanceID,required"`
}

ClaimableBalanceQuery query struct for claimables_balances/id end-point

type ClaimableBalancesQuery added in v1.11.1

type ClaimableBalancesQuery struct {
	AssetFilter    string `schema:"asset" valid:"asset,optional"`
	SponsorFilter  string `schema:"sponsor" valid:"accountID,optional"`
	ClaimantFilter string `schema:"claimant" valid:"accountID,optional"`
}

ClaimableBalancesQuery query struct for claimable_balances end-point

func (ClaimableBalancesQuery) URITemplate added in v1.11.1

func (q ClaimableBalancesQuery) URITemplate() string

URITemplate returns a rfc6570 URI template the query struct

type CoreStateGetter added in v1.11.1

type CoreStateGetter interface {
	GetCoreState() corestate.State
}

type EffectsQuery added in v1.11.1

type EffectsQuery struct {
	AccountID       string `schema:"account_id" valid:"accountID,optional"`
	OperationID     uint64 `schema:"op_id" valid:"-"`
	LiquidityPoolID string `schema:"liquidity_pool_id" valid:"sha256,optional"`
	TxHash          string `schema:"tx_id" valid:"transactionHash,optional"`
	LedgerID        uint32 `schema:"ledger_id" valid:"-"`
}

EffectsQuery query struct for effects end-points

func (EffectsQuery) Validate added in v1.11.1

func (qp EffectsQuery) Validate() error

Validate runs extra validations on query parameters

type FeeStatsHandler added in v1.11.1

type FeeStatsHandler struct {
}

FeeStatsHandler is the action handler for the /fee_stats endpoint

func (FeeStatsHandler) GetResource added in v1.11.1

func (handler FeeStatsHandler) GetResource(w HeaderWriter, r *http.Request) (interface{}, error)

GetResource fee stats resource

type FilterConfigHandler added in v1.11.1

type FilterConfigHandler struct{}

these admin HTTP endpoints are documented in services/aurora/internal/httpx/static/admin_oapi.yml

func (FilterConfigHandler) GetAccountConfig added in v1.11.1

func (handler FilterConfigHandler) GetAccountConfig(w http.ResponseWriter, r *http.Request)

func (FilterConfigHandler) GetAssetConfig added in v1.11.1

func (handler FilterConfigHandler) GetAssetConfig(w http.ResponseWriter, r *http.Request)

func (FilterConfigHandler) UpdateAccountConfig added in v1.11.1

func (handler FilterConfigHandler) UpdateAccountConfig(w http.ResponseWriter, r *http.Request)

func (FilterConfigHandler) UpdateAssetConfig added in v1.11.1

func (handler FilterConfigHandler) UpdateAssetConfig(w http.ResponseWriter, r *http.Request)

type FindFixedPathsHandler added in v1.11.1

type FindFixedPathsHandler struct {
	MaxPathLength        uint
	MaxAssetsParamLength int
	SetLastLedgerHeader  bool
	PathFinder           paths.Finder
}

FindFixedPathsHandler is the http handler for the find fixed payment paths endpoint Fixed payment paths are payment paths where both the source and destination asset are fixed

func (FindFixedPathsHandler) GetResource added in v1.11.1

func (handler FindFixedPathsHandler) GetResource(w HeaderWriter, r *http.Request) (interface{}, error)

GetResource returns a list of strict send paths

type FindFixedPathsQuery added in v1.11.1

type FindFixedPathsQuery struct {
	DestinationAccount string `schema:"destination_account" valid:"accountID,optional"`
	DestinationAssets  string `schema:"destination_assets" valid:"-"`
	SourceAssetType    string `schema:"source_asset_type" valid:"assetType"`
	SourceAssetIssuer  string `schema:"source_asset_issuer" valid:"accountID,optional"`
	SourceAssetCode    string `schema:"source_asset_code" valid:"-"`
	SourceAmount       string `schema:"source_amount" valid:"amount"`
}

FindFixedPathsQuery query struct for paths/strict-send end-point

func (FindFixedPathsQuery) Amount added in v1.11.1

func (q FindFixedPathsQuery) Amount() xdr.Int64

Amount returns source amount

func (FindFixedPathsQuery) Assets added in v1.11.1

func (q FindFixedPathsQuery) Assets() ([]xdr.Asset, error)

Assets returns a list of xdr.Asset

func (FindFixedPathsQuery) SourceAsset added in v1.11.1

func (q FindFixedPathsQuery) SourceAsset() xdr.Asset

SourceAsset returns an xdr.Asset

func (FindFixedPathsQuery) URITemplate added in v1.11.1

func (q FindFixedPathsQuery) URITemplate() string

URITemplate returns a rfc6570 URI template for the query struct

func (FindFixedPathsQuery) Validate added in v1.11.1

func (q FindFixedPathsQuery) Validate() error

Validate runs custom validations.

type FindPathsHandler added in v1.11.1

type FindPathsHandler struct {
	StaleThreshold       uint
	MaxPathLength        uint
	SetLastLedgerHeader  bool
	MaxAssetsParamLength int
	PathFinder           paths.Finder
}

FindPathsHandler is the http handler for the find payment paths endpoint

func (FindPathsHandler) GetResource added in v1.11.1

func (handler FindPathsHandler) GetResource(w HeaderWriter, r *http.Request) (interface{}, error)

GetResource finds a list of strict receive paths

type GetAccountByIDHandler added in v1.11.1

type GetAccountByIDHandler struct{}

GetAccountByIDHandler is the action handler for the /accounts/{account_id} endpoint

func (GetAccountByIDHandler) GetResource added in v1.11.1

type GetAccountDataHandler added in v1.11.1

type GetAccountDataHandler struct{}

func (GetAccountDataHandler) GetResource added in v1.11.1

func (GetAccountDataHandler) WriteRawResponse added in v1.11.1

func (handler GetAccountDataHandler) WriteRawResponse(w io.Writer, r *http.Request) error

type GetAccountOffersHandler added in v1.11.1

type GetAccountOffersHandler struct {
	LedgerState *ledger.State
}

GetAccountOffersHandler is the action handler for the `/accounts/{account_id}/offers` endpoint when using experimental ingestion.

func (GetAccountOffersHandler) GetResourcePage added in v1.11.1

func (handler GetAccountOffersHandler) GetResourcePage(
	w HeaderWriter,
	r *http.Request,
) ([]hal.Pageable, error)

GetResourcePage returns a page of offers for a given account.

type GetAccountsHandler added in v1.11.1

type GetAccountsHandler struct {
	LedgerState *ledger.State
}

GetAccountsHandler is the action handler for the /accounts endpoint

func (GetAccountsHandler) GetResourcePage added in v1.11.1

func (handler GetAccountsHandler) GetResourcePage(
	w HeaderWriter,
	r *http.Request,
) ([]hal.Pageable, error)

GetResourcePage returns a page containing the account records that have `signer` as a signer, `sponsor` as a sponsor, a trustline to the given `asset`, or participate in a particular `liquidity_pool`.

type GetClaimableBalanceByIDHandler added in v1.11.1

type GetClaimableBalanceByIDHandler struct{}

GetClaimableBalanceByIDHandler is the action handler for all end-points returning a claimable balance.

func (GetClaimableBalanceByIDHandler) GetResource added in v1.11.1

func (handler GetClaimableBalanceByIDHandler) GetResource(w HeaderWriter, r *http.Request) (interface{}, error)

GetResource returns an claimable balance page.

type GetClaimableBalancesHandler added in v1.11.1

type GetClaimableBalancesHandler struct {
	LedgerState *ledger.State
}

func (GetClaimableBalancesHandler) GetResourcePage added in v1.11.1

func (handler GetClaimableBalancesHandler) GetResourcePage(
	w HeaderWriter,
	r *http.Request,
) ([]hal.Pageable, error)

GetResourcePage returns a page of claimable balances.

type GetEffectsHandler added in v1.11.1

type GetEffectsHandler struct {
	LedgerState *ledger.State
}

func (GetEffectsHandler) GetResourcePage added in v1.11.1

func (handler GetEffectsHandler) GetResourcePage(w HeaderWriter, r *http.Request) ([]hal.Pageable, error)

type GetLedgerByIDHandler added in v1.11.1

type GetLedgerByIDHandler struct {
	LedgerState *ledger.State
}

func (GetLedgerByIDHandler) GetResource added in v1.11.1

func (handler GetLedgerByIDHandler) GetResource(w HeaderWriter, r *http.Request) (interface{}, error)

type GetLedgersHandler added in v1.11.1

type GetLedgersHandler struct {
	LedgerState *ledger.State
}

func (GetLedgersHandler) GetResourcePage added in v1.11.1

func (handler GetLedgersHandler) GetResourcePage(w HeaderWriter, r *http.Request) ([]hal.Pageable, error)

type GetLiquidityPoolByIDHandler added in v1.11.1

type GetLiquidityPoolByIDHandler struct{}

GetLiquidityPoolByIDHandler is the action handler for all end-points returning a liquidity pool.

func (GetLiquidityPoolByIDHandler) GetResource added in v1.11.1

func (handler GetLiquidityPoolByIDHandler) GetResource(w HeaderWriter, r *http.Request) (interface{}, error)

GetResource returns an claimable balance page.

type GetLiquidityPoolsHandler added in v1.11.1

type GetLiquidityPoolsHandler struct {
	LedgerState *ledger.State
}

func (GetLiquidityPoolsHandler) GetResourcePage added in v1.11.1

func (handler GetLiquidityPoolsHandler) GetResourcePage(w HeaderWriter, r *http.Request) ([]hal.Pageable, error)

GetResourcePage returns a page of liquidity pools.

type GetOfferByID added in v1.11.1

type GetOfferByID struct{}

GetOfferByID is the action handler for the /offers/{id} endpoint

func (GetOfferByID) GetResource added in v1.11.1

func (handler GetOfferByID) GetResource(w HeaderWriter, r *http.Request) (interface{}, error)

GetResource returns an offer by id.

type GetOffersHandler added in v1.11.1

type GetOffersHandler struct {
	LedgerState *ledger.State
}

GetOffersHandler is the action handler for the /offers endpoint

func (GetOffersHandler) GetResourcePage added in v1.11.1

func (handler GetOffersHandler) GetResourcePage(
	w HeaderWriter,
	r *http.Request,
) ([]hal.Pageable, error)

GetResourcePage returns a page of offers.

type GetOperationByIDHandler added in v1.11.1

type GetOperationByIDHandler struct {
	LedgerState *ledger.State
	SkipTxMeta  bool
}

GetOperationByIDHandler is the action handler for all end-points returning a list of operations.

func (GetOperationByIDHandler) GetResource added in v1.11.1

func (handler GetOperationByIDHandler) GetResource(w HeaderWriter, r *http.Request) (interface{}, error)

GetResource returns an operation page.

type GetOperationsHandler added in v1.11.1

type GetOperationsHandler struct {
	LedgerState  *ledger.State
	OnlyPayments bool
	SkipTxMeta   bool
}

GetOperationsHandler is the action handler for all end-points returning a list of operations.

func (GetOperationsHandler) GetResourcePage added in v1.11.1

func (handler GetOperationsHandler) GetResourcePage(w HeaderWriter, r *http.Request) ([]hal.Pageable, error)

GetResourcePage returns a page of operations.

type GetOrderbookHandler added in v1.11.1

type GetOrderbookHandler struct {
}

GetOrderbookHandler is the action handler for the /order_book endpoint

func (GetOrderbookHandler) GetResource added in v1.11.1

GetResource implements the /order_book endpoint

type GetRootHandler added in v1.11.1

type GetRootHandler struct {
	LedgerState *ledger.State
	CoreStateGetter
	NetworkPassphrase string
	FriendbotURL      *url.URL
	AuroraVersion     string
}

func (GetRootHandler) GetResource added in v1.11.1

func (handler GetRootHandler) GetResource(w HeaderWriter, r *http.Request) (interface{}, error)

type GetTradeAggregationsHandler added in v1.11.1

type GetTradeAggregationsHandler struct {
	LedgerState *ledger.State
	CoreStateGetter
}

GetTradeAggregationsHandler is the action handler for trade_aggregations

func (GetTradeAggregationsHandler) GetResource added in v1.11.1

func (handler GetTradeAggregationsHandler) GetResource(w HeaderWriter, r *http.Request) (interface{}, error)

GetResource returns a page of trade aggregations

type GetTradesHandler added in v1.11.1

type GetTradesHandler struct {
	LedgerState *ledger.State
	CoreStateGetter
}

GetTradesHandler is the action handler for all end-points returning a list of trades.

func (GetTradesHandler) GetResourcePage added in v1.11.1

func (handler GetTradesHandler) GetResourcePage(w HeaderWriter, r *http.Request) ([]hal.Pageable, error)

GetResourcePage returns a page of trades.

type GetTransactionByHashHandler added in v1.11.1

type GetTransactionByHashHandler struct {
	SkipTxMeta bool
}

GetTransactionByHashHandler is the action handler for the end-point returning a transaction.

func (GetTransactionByHashHandler) GetResource added in v1.11.1

func (handler GetTransactionByHashHandler) GetResource(w HeaderWriter, r *http.Request) (interface{}, error)

GetResource returns a transaction page.

type GetTransactionsHandler added in v1.11.1

type GetTransactionsHandler struct {
	LedgerState *ledger.State
	SkipTxMeta  bool
}

GetTransactionsHandler is the action handler for all end-points returning a list of transactions.

func (GetTransactionsHandler) GetResourcePage added in v1.11.1

func (handler GetTransactionsHandler) GetResourcePage(w HeaderWriter, r *http.Request) ([]hal.Pageable, error)

GetResourcePage returns a page of transactions.

type HeaderWriter added in v1.11.1

type HeaderWriter interface {
	Header() http.Header
}

HeaderWriter is an interface for setting HTTP response headers

type Joinable added in v1.11.1

type Joinable struct {
	Join string `schema:"join" valid:"in(transactions)~Accepted values: transactions,optional"`
}

Joinable query struct for join query parameter

func (Joinable) IncludeTransactions added in v1.11.1

func (qp Joinable) IncludeTransactions() bool

IncludeTransactions returns extra fields to include in the response

type LedgerByIDQuery added in v1.11.1

type LedgerByIDQuery struct {
	LedgerID uint32 `schema:"ledger_id" valid:"-"`
}

LedgerByIDQuery query struct for the ledger/{id} endpoint

type LiquidityPoolQuery added in v1.11.1

type LiquidityPoolQuery struct {
	ID string `schema:"liquidity_pool_id" valid:"sha256"`
}

LiquidityPoolQuery query struct for liquidity_pools/id endpoint

type LiquidityPoolsQuery added in v1.11.1

type LiquidityPoolsQuery struct {
	Reserves string `schema:"reserves" valid:"optional"`
	Account  string `schema:"account" valid:"optional"`
	// contains filtered or unexported fields
}

LiquidityPoolsQuery query struct for liquidity_pools end-point

func (LiquidityPoolsQuery) URITemplate added in v1.11.1

func (q LiquidityPoolsQuery) URITemplate() string

URITemplate returns a rfc6570 URI template the query struct

func (*LiquidityPoolsQuery) Validate added in v1.11.1

func (q *LiquidityPoolsQuery) Validate() error

Validate validates and parses the query

type NetworkSubmitter added in v1.11.1

type NetworkSubmitter interface {
	Submit(ctx context.Context, rawTx string, envelope xdr.TransactionEnvelope, hash string) <-chan txsub.Result
}

type OfferByIDQuery added in v1.11.1

type OfferByIDQuery struct {
	OfferID uint64 `schema:"offer_id" valid:"-"`
}

AccountOffersQuery query struct for offers end-point

type OffersQuery added in v1.11.1

type OffersQuery struct {
	SellingBuyingAssetQueryParams `valid:"-"`
	Seller                        string `schema:"seller" valid:"accountID,optional"`
	Sponsor                       string `schema:"sponsor" valid:"accountID,optional"`
}

OffersQuery query struct for offers end-point

func (OffersQuery) URITemplate added in v1.11.1

func (q OffersQuery) URITemplate() string

URITemplate returns a rfc6570 URI template the query struct

func (OffersQuery) Validate added in v1.11.1

func (q OffersQuery) Validate() error

Validate runs custom validations.

type OperationQuery added in v1.11.1

type OperationQuery struct {
	LedgerState *ledger.State `valid:"-"`
	Joinable    `valid:"optional"`
	ID          uint64 `schema:"id" valid:"-"`
}

OperationQuery query struct for operation/id end-point

func (OperationQuery) Validate added in v1.11.1

func (qp OperationQuery) Validate() error

Validate runs extra validations on query parameters

type OperationsQuery added in v1.11.1

type OperationsQuery struct {
	Joinable                  `valid:"optional"`
	AccountID                 string `schema:"account_id" valid:"accountID,optional"`
	ClaimableBalanceID        string `schema:"claimable_balance_id" valid:"claimableBalanceID,optional"`
	LiquidityPoolID           string `schema:"liquidity_pool_id" valid:"sha256,optional"`
	TransactionHash           string `schema:"tx_id" valid:"transactionHash,optional"`
	IncludeFailedTransactions bool   `schema:"include_failed" valid:"-"`
	LedgerID                  uint32 `schema:"ledger_id" valid:"-"`
}

OperationsQuery query struct for operations end-points

func (OperationsQuery) Validate added in v1.11.1

func (qp OperationsQuery) Validate() error

Validate runs extra validations on query parameters

type Opt

type Opt int
const (
	// DisableCursorValidation disables cursor validation in GetPageQuery
	DisableCursorValidation Opt = iota
)

type OrderBookResponse added in v1.11.1

type OrderBookResponse struct {
	protocol.OrderBookSummary
}

OrderBookResponse is the response for the /order_book endpoint OrderBookResponse implements StreamableObjectResponse

func (OrderBookResponse) Equals added in v1.11.1

Equals returns true if the OrderBookResponse is equal to `other`

type SellingBuyingAssetQueryParams added in v1.11.1

type SellingBuyingAssetQueryParams struct {
	SellingAssetType   string `schema:"selling_asset_type" valid:"assetType,optional"`
	SellingAssetIssuer string `schema:"selling_asset_issuer" valid:"accountID,optional"`
	SellingAssetCode   string `schema:"selling_asset_code" valid:"-"`
	BuyingAssetType    string `schema:"buying_asset_type" valid:"assetType,optional"`
	BuyingAssetIssuer  string `schema:"buying_asset_issuer" valid:"accountID,optional"`
	BuyingAssetCode    string `schema:"buying_asset_code" valid:"-"`

	// allow selling and buying using an asset's canonical representation. We
	// are keeping the former selling_* and buying_* for backwards compatibility
	// but it should not be documented.
	SellingAsset string `schema:"selling" valid:"asset,optional"`
	BuyingAsset  string `schema:"buying" valid:"asset,optional"`
}

SellingBuyingAssetQueryParams query struct for end-points requiring a selling and buying asset

func (SellingBuyingAssetQueryParams) Buying added in v1.11.1

Buying returns an *xdr.Asset representing the buying side of the offer.

func (SellingBuyingAssetQueryParams) Selling added in v1.11.1

func (q SellingBuyingAssetQueryParams) Selling() (*xdr.Asset, error)

Selling returns an xdr.Asset representing the selling side of the offer.

func (SellingBuyingAssetQueryParams) Validate added in v1.11.1

func (q SellingBuyingAssetQueryParams) Validate() error

Validate runs custom validations buying and selling

type StreamableObjectResponse added in v1.11.1

type StreamableObjectResponse interface {
	Equals(other StreamableObjectResponse) bool
}

StreamableObjectResponse is an interface for objects returned by streamable object endpoints A streamable object endpoint is an SSE endpoint which returns a single JSON object response instead of a page of items.

type StrictReceivePathsQuery added in v1.11.1

type StrictReceivePathsQuery struct {
	SourceAssets           string `schema:"source_assets" valid:"-"`
	SourceAccount          string `schema:"source_account" valid:"accountID,optional"`
	DestinationAccount     string `schema:"destination_account" valid:"accountID,optional"`
	DestinationAssetType   string `schema:"destination_asset_type" valid:"assetType"`
	DestinationAssetIssuer string `schema:"destination_asset_issuer" valid:"accountID,optional"`
	DestinationAssetCode   string `schema:"destination_asset_code" valid:"-"`
	DestinationAmount      string `schema:"destination_amount" valid:"amount"`
}

StrictReceivePathsQuery query struct for paths/strict-send end-point

func (StrictReceivePathsQuery) Amount added in v1.11.1

func (q StrictReceivePathsQuery) Amount() xdr.Int64

Amount returns source amount

func (StrictReceivePathsQuery) Assets added in v1.11.1

func (q StrictReceivePathsQuery) Assets() ([]xdr.Asset, error)

Assets returns a list of xdr.Asset

func (StrictReceivePathsQuery) DestinationAsset added in v1.11.1

func (q StrictReceivePathsQuery) DestinationAsset() xdr.Asset

DestinationAsset returns an xdr.Asset

func (StrictReceivePathsQuery) URITemplate added in v1.11.1

func (q StrictReceivePathsQuery) URITemplate() string

URITemplate returns a rfc6570 URI template for the query struct

func (StrictReceivePathsQuery) Validate added in v1.11.1

func (q StrictReceivePathsQuery) Validate() error

Validate runs custom validations.

type SubmitTransactionHandler added in v1.11.1

type SubmitTransactionHandler struct {
	Submitter         NetworkSubmitter
	NetworkPassphrase string
	DisableTxSub      bool
	CoreStateGetter
	SkipTxMeta bool
}

func (SubmitTransactionHandler) GetResource added in v1.11.1

func (handler SubmitTransactionHandler) GetResource(w HeaderWriter, r *http.Request) (interface{}, error)

type TradeAggregationsQuery added in v1.11.1

type TradeAggregationsQuery struct {
	OffsetFilter           uint64      `schema:"offset" valid:"-"`
	StartTimeFilter        time.Millis `schema:"start_time" valid:"-"`
	EndTimeFilter          time.Millis `schema:"end_time" valid:"-"`
	ResolutionFilter       uint64      `schema:"resolution" valid:"-"`
	TradeAssetsQueryParams `valid:"optional"`
}

TradeAggregationsQuery query struct for trade_aggregations end-point

func (TradeAggregationsQuery) Validate added in v1.11.1

func (q TradeAggregationsQuery) Validate() error

Validate runs validations on tradeAggregationsQuery

type TradeAssetsQueryParams added in v1.11.1

type TradeAssetsQueryParams struct {
	BaseAssetType      string `schema:"base_asset_type" valid:"assetType,optional"`
	BaseAssetIssuer    string `schema:"base_asset_issuer" valid:"accountID,optional"`
	BaseAssetCode      string `schema:"base_asset_code" valid:"-"`
	CounterAssetType   string `schema:"counter_asset_type" valid:"assetType,optional"`
	CounterAssetIssuer string `schema:"counter_asset_issuer" valid:"accountID,optional"`
	CounterAssetCode   string `schema:"counter_asset_code" valid:"-"`
}

TradeAssetsQueryParams represents the base and counter assets on trade related end-points.

func (TradeAssetsQueryParams) Base added in v1.11.1

func (q TradeAssetsQueryParams) Base() (*xdr.Asset, error)

Base returns an xdr.Asset representing the base side of the trade.

func (TradeAssetsQueryParams) Counter added in v1.11.1

func (q TradeAssetsQueryParams) Counter() (*xdr.Asset, error)

Counter returns an *xdr.Asset representing the counter asset side of the trade.

type TradesQuery added in v1.11.1

type TradesQuery struct {
	AccountID              string `schema:"account_id" valid:"accountID,optional"`
	OfferID                uint64 `schema:"offer_id" valid:"-"`
	PoolID                 string `schema:"liquidity_pool_id" valid:"sha256,optional"`
	TradeType              string `schema:"trade_type" valid:"tradeType,optional"`
	TradeAssetsQueryParams `valid:"optional"`
}

TradesQuery query struct for trades end-points

func (TradesQuery) Validate added in v1.11.1

func (q TradesQuery) Validate() error

Validate runs custom validations base and counter

type TransactionQuery added in v1.11.1

type TransactionQuery struct {
	TransactionHash string `schema:"tx_id" valid:"transactionHash,optional"`
}

TransactionQuery query struct for transactions/id end-point

type TransactionsQuery added in v1.11.1

type TransactionsQuery struct {
	AccountID                 string `schema:"account_id" valid:"accountID,optional"`
	ClaimableBalanceID        string `schema:"claimable_balance_id" valid:"claimableBalanceID,optional"`
	LiquidityPoolID           string `schema:"liquidity_pool_id" valid:"sha256,optional"`
	IncludeFailedTransactions bool   `schema:"include_failed" valid:"-"`
	LedgerID                  uint32 `schema:"ledger_id" valid:"-"`
}

TransactionsQuery query struct for transactions end-points

func (TransactionsQuery) Validate added in v1.11.1

func (qp TransactionsQuery) Validate() error

Validate runs extra validations on query parameters

type Validateable added in v1.11.1

type Validateable interface {
	Validate() error
}

Validateable allow structs to define their own custom validations.

Jump to

Keyboard shortcuts

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