Documentation ¶
Overview ¶
Package auroraclient provides client access to a Aurora server, allowing an application to post transactions and look up ledger information.
This library provides an interface to the Hcnet Aurora service. It supports the building of Go applications on top of the Hcnet network (https://www.hcnet.org/). Transactions may be constructed using the sister package to this one, txnbuild (https://github.com/HashCash-Consultants/go/tree/master/txnbuild), and then submitted with this client to any Aurora instance for processing onto the ledger. Together, these two libraries provide a complete Hcnet SDK.
For more information and further examples, see https://github.com/HashCash-Consultants/go/blob/master/docs/reference/readme.md
Index ¶
- Constants
- Variables
- func IsNotFoundError(err error) bool
- type AccountRequest
- type AccountsRequest
- type AdminClient
- func (c *AdminClient) GetIngestionAccountFilter() (hProtocol.AccountFilterConfig, error)
- func (c *AdminClient) GetIngestionAssetFilter() (hProtocol.AssetFilterConfig, error)
- func (c *AdminClient) SetIngestionAccountFilter(filter hProtocol.AccountFilterConfig) error
- func (c *AdminClient) SetIngestionAssetFilter(filter hProtocol.AssetFilterConfig) error
- type AdminClientInterface
- type AssetRequest
- type AssetType
- type AuroraRequest
- type ClaimableBalanceRequest
- type Client
- func (c *Client) AccountData(request AccountRequest) (accountData hProtocol.AccountData, err error)
- func (c *Client) AccountDetail(request AccountRequest) (account hProtocol.Account, err error)
- func (c *Client) Accounts(request AccountsRequest) (accounts hProtocol.AccountsPage, err error)
- func (c *Client) Assets(request AssetRequest) (assets hProtocol.AssetsPage, err error)
- func (c *Client) AsyncSubmitFeeBumpTransaction(transaction *txnbuild.FeeBumpTransaction) (txResp hProtocol.AsyncTransactionSubmissionResponse, err error)
- func (c *Client) AsyncSubmitFeeBumpTransactionWithOptions(transaction *txnbuild.FeeBumpTransaction, opts SubmitTxOpts) (txResp hProtocol.AsyncTransactionSubmissionResponse, err error)
- func (c *Client) AsyncSubmitTransaction(transaction *txnbuild.Transaction) (txResp hProtocol.AsyncTransactionSubmissionResponse, err error)
- func (c *Client) AsyncSubmitTransactionWithOptions(transaction *txnbuild.Transaction, opts SubmitTxOpts) (txResp hProtocol.AsyncTransactionSubmissionResponse, err error)
- func (c *Client) AsyncSubmitTransactionXDR(transactionXdr string) (txResp hProtocol.AsyncTransactionSubmissionResponse, err error)
- func (c *Client) AuroraTimeout() time.Duration
- func (c *Client) ClaimableBalance(id string) (cb hProtocol.ClaimableBalance, err error)
- func (c *Client) ClaimableBalances(cbr ClaimableBalanceRequest) (cb hProtocol.ClaimableBalances, err error)
- func (c *Client) Effects(request EffectRequest) (effects effects.EffectsPage, err error)
- func (c *Client) FeeStats() (feestats hProtocol.FeeStats, err error)
- func (c *Client) FetchTimebounds(seconds int64) (txnbuild.TimeBounds, error)
- func (c *Client) Fund(addr string) (tx hProtocol.Transaction, err error)
- func (c *Client) HomeDomainForAccount(aid string) (string, error)
- func (c *Client) LedgerDetail(sequence uint32) (ledger hProtocol.Ledger, err error)
- func (c *Client) Ledgers(request LedgerRequest) (ledgers hProtocol.LedgersPage, err error)
- func (c *Client) LiquidityPoolDetail(request LiquidityPoolRequest) (lp hProtocol.LiquidityPool, err error)
- func (c *Client) LiquidityPools(request LiquidityPoolsRequest) (lp hProtocol.LiquidityPoolsPage, err error)
- func (c *Client) NextAccountsPage(page hProtocol.AccountsPage) (accounts hProtocol.AccountsPage, err error)
- func (c *Client) NextAssetsPage(page hProtocol.AssetsPage) (assets hProtocol.AssetsPage, err error)
- func (c *Client) NextEffectsPage(page effects.EffectsPage) (efp effects.EffectsPage, err error)
- func (c *Client) NextLedgersPage(page hProtocol.LedgersPage) (ledgers hProtocol.LedgersPage, err error)
- func (c *Client) NextLiquidityPoolsPage(page hProtocol.LiquidityPoolsPage) (lp hProtocol.LiquidityPoolsPage, err error)
- func (c *Client) NextOffersPage(page hProtocol.OffersPage) (offers hProtocol.OffersPage, err error)
- func (c *Client) NextOperationsPage(page operations.OperationsPage) (operations operations.OperationsPage, err error)
- func (c *Client) NextPaymentsPage(page operations.OperationsPage) (operations.OperationsPage, error)
- func (c *Client) NextTradeAggregationsPage(page hProtocol.TradeAggregationsPage) (ta hProtocol.TradeAggregationsPage, err error)
- func (c *Client) NextTradesPage(page hProtocol.TradesPage) (trades hProtocol.TradesPage, err error)
- func (c *Client) NextTransactionsPage(page hProtocol.TransactionsPage) (transactions hProtocol.TransactionsPage, err error)
- func (c *Client) OfferDetails(offerID string) (offer hProtocol.Offer, err error)
- func (c *Client) Offers(request OfferRequest) (offers hProtocol.OffersPage, err error)
- func (c *Client) OperationDetail(id string) (ops operations.Operation, err error)
- func (c *Client) Operations(request OperationRequest) (ops operations.OperationsPage, err error)
- func (c *Client) OrderBook(request OrderBookRequest) (obs hProtocol.OrderBookSummary, err error)
- func (c *Client) Paths(request PathsRequest) (paths hProtocol.PathsPage, err error)
- func (c *Client) Payments(request OperationRequest) (ops operations.OperationsPage, err error)
- func (c *Client) PrevAssetsPage(page hProtocol.AssetsPage) (assets hProtocol.AssetsPage, err error)
- func (c *Client) PrevEffectsPage(page effects.EffectsPage) (efp effects.EffectsPage, err error)
- func (c *Client) PrevLedgersPage(page hProtocol.LedgersPage) (ledgers hProtocol.LedgersPage, err error)
- func (c *Client) PrevLiquidityPoolsPage(page hProtocol.LiquidityPoolsPage) (lp hProtocol.LiquidityPoolsPage, err error)
- func (c *Client) PrevOffersPage(page hProtocol.OffersPage) (offers hProtocol.OffersPage, err error)
- func (c *Client) PrevOperationsPage(page operations.OperationsPage) (operations operations.OperationsPage, err error)
- func (c *Client) PrevPaymentsPage(page operations.OperationsPage) (operations.OperationsPage, error)
- func (c *Client) PrevTradeAggregationsPage(page hProtocol.TradeAggregationsPage) (ta hProtocol.TradeAggregationsPage, err error)
- func (c *Client) PrevTradesPage(page hProtocol.TradesPage) (trades hProtocol.TradesPage, err error)
- func (c *Client) PrevTransactionsPage(page hProtocol.TransactionsPage) (transactions hProtocol.TransactionsPage, err error)
- func (c *Client) Root() (root hProtocol.Root, err error)
- func (c *Client) SetAuroraTimeout(t time.Duration) *Client
- func (c *Client) StreamEffects(ctx context.Context, request EffectRequest, handler EffectHandler) error
- func (c *Client) StreamLedgers(ctx context.Context, request LedgerRequest, handler LedgerHandler) error
- func (c *Client) StreamOffers(ctx context.Context, request OfferRequest, handler OfferHandler) error
- func (c *Client) StreamOperations(ctx context.Context, request OperationRequest, handler OperationHandler) error
- func (c *Client) StreamOrderBooks(ctx context.Context, request OrderBookRequest, handler OrderBookHandler) error
- func (c *Client) StreamPayments(ctx context.Context, request OperationRequest, handler OperationHandler) error
- func (c *Client) StreamTrades(ctx context.Context, request TradeRequest, handler TradeHandler) (err error)
- func (c *Client) StreamTransactions(ctx context.Context, request TransactionRequest, handler TransactionHandler) error
- func (c *Client) StrictReceivePaths(request PathsRequest) (paths hProtocol.PathsPage, err error)
- func (c *Client) StrictSendPaths(request StrictSendPathsRequest) (paths hProtocol.PathsPage, err error)
- func (c *Client) SubmitFeeBumpTransaction(transaction *txnbuild.FeeBumpTransaction) (tx hProtocol.Transaction, err error)
- func (c *Client) SubmitFeeBumpTransactionWithOptions(transaction *txnbuild.FeeBumpTransaction, opts SubmitTxOpts) (tx hProtocol.Transaction, err error)
- func (c *Client) SubmitTransaction(transaction *txnbuild.Transaction) (tx hProtocol.Transaction, err error)
- func (c *Client) SubmitTransactionWithOptions(transaction *txnbuild.Transaction, opts SubmitTxOpts) (tx hProtocol.Transaction, err error)
- func (c *Client) SubmitTransactionXDR(transactionXdr string) (tx hProtocol.Transaction, err error)
- func (c *Client) TradeAggregations(request TradeAggregationRequest) (tds hProtocol.TradeAggregationsPage, err error)
- func (c *Client) Trades(request TradeRequest) (tds hProtocol.TradesPage, err error)
- func (c *Client) TransactionDetail(txHash string) (tx hProtocol.Transaction, err error)
- func (c *Client) Transactions(request TransactionRequest) (txs hProtocol.TransactionsPage, err error)
- func (c *Client) Version() string
- type ClientInterface
- type EffectHandler
- type EffectRequest
- type Error
- type HTTP
- type LedgerHandler
- type LedgerRequest
- type LiquidityPoolRequest
- type LiquidityPoolsRequest
- type MockAdminClient
- func (m *MockAdminClient) GetIngestionAccountFilter() (hProtocol.AccountFilterConfig, error)
- func (m *MockAdminClient) GetIngestionAssetFilter() (hProtocol.AssetFilterConfig, error)
- func (m *MockAdminClient) SetIngestionAccountFilter(resource hProtocol.AccountFilterConfig) error
- func (m *MockAdminClient) SetIngestionAssetFilter(resource hProtocol.AssetFilterConfig) error
- type MockClient
- func (m *MockClient) AccountData(request AccountRequest) (hProtocol.AccountData, error)
- func (m *MockClient) AccountDetail(request AccountRequest) (hProtocol.Account, error)
- func (m *MockClient) Accounts(request AccountsRequest) (hProtocol.AccountsPage, error)
- func (m *MockClient) Assets(request AssetRequest) (hProtocol.AssetsPage, error)
- func (m *MockClient) AsyncSubmitFeeBumpTransaction(transaction *txnbuild.FeeBumpTransaction) (hProtocol.AsyncTransactionSubmissionResponse, error)
- func (m *MockClient) AsyncSubmitFeeBumpTransactionWithOptions(transaction *txnbuild.FeeBumpTransaction, opts SubmitTxOpts) (hProtocol.AsyncTransactionSubmissionResponse, error)
- func (m *MockClient) AsyncSubmitTransaction(transaction *txnbuild.Transaction) (hProtocol.AsyncTransactionSubmissionResponse, error)
- func (m *MockClient) AsyncSubmitTransactionWithOptions(transaction *txnbuild.Transaction, opts SubmitTxOpts) (hProtocol.AsyncTransactionSubmissionResponse, error)
- func (m *MockClient) AsyncSubmitTransactionXDR(transactionXdr string) (hProtocol.AsyncTransactionSubmissionResponse, error)
- func (m *MockClient) Effects(request EffectRequest) (effects.EffectsPage, error)
- func (m *MockClient) FeeStats() (hProtocol.FeeStats, error)
- func (m *MockClient) Fund(addr string) (hProtocol.Transaction, error)
- func (m *MockClient) HomeDomainForAccount(aid string) (string, error)
- func (m *MockClient) LedgerDetail(sequence uint32) (hProtocol.Ledger, error)
- func (m *MockClient) Ledgers(request LedgerRequest) (hProtocol.LedgersPage, error)
- func (m *MockClient) LiquidityPoolDetail(request LiquidityPoolRequest) (hProtocol.LiquidityPool, error)
- func (m *MockClient) LiquidityPools(request LiquidityPoolsRequest) (hProtocol.LiquidityPoolsPage, error)
- func (m *MockClient) NextAccountsPage(page hProtocol.AccountsPage) (hProtocol.AccountsPage, error)
- func (m *MockClient) NextAssetsPage(page hProtocol.AssetsPage) (hProtocol.AssetsPage, error)
- func (m *MockClient) NextEffectsPage(page effects.EffectsPage) (effects.EffectsPage, error)
- func (m *MockClient) NextLedgersPage(page hProtocol.LedgersPage) (hProtocol.LedgersPage, error)
- func (m *MockClient) NextLiquidityPoolsPage(page hProtocol.LiquidityPoolsPage) (hProtocol.LiquidityPoolsPage, error)
- func (m *MockClient) NextOffersPage(page hProtocol.OffersPage) (hProtocol.OffersPage, error)
- func (m *MockClient) NextOperationsPage(page operations.OperationsPage) (operations.OperationsPage, error)
- func (m *MockClient) NextPaymentsPage(page operations.OperationsPage) (operations.OperationsPage, error)
- func (m *MockClient) NextTradeAggregationsPage(page hProtocol.TradeAggregationsPage) (hProtocol.TradeAggregationsPage, error)
- func (m *MockClient) NextTradesPage(page hProtocol.TradesPage) (hProtocol.TradesPage, error)
- func (m *MockClient) NextTransactionsPage(page hProtocol.TransactionsPage) (hProtocol.TransactionsPage, error)
- func (m *MockClient) OfferDetails(offerID string) (hProtocol.Offer, error)
- func (m *MockClient) Offers(request OfferRequest) (hProtocol.OffersPage, error)
- func (m *MockClient) OperationDetail(id string) (operations.Operation, error)
- func (m *MockClient) Operations(request OperationRequest) (operations.OperationsPage, error)
- func (m *MockClient) OrderBook(request OrderBookRequest) (hProtocol.OrderBookSummary, error)
- func (m *MockClient) Paths(request PathsRequest) (hProtocol.PathsPage, error)
- func (m *MockClient) Payments(request OperationRequest) (operations.OperationsPage, error)
- func (m *MockClient) PrevAssetsPage(page hProtocol.AssetsPage) (hProtocol.AssetsPage, error)
- func (m *MockClient) PrevEffectsPage(page effects.EffectsPage) (effects.EffectsPage, error)
- func (m *MockClient) PrevLedgersPage(page hProtocol.LedgersPage) (hProtocol.LedgersPage, error)
- func (m *MockClient) PrevLiquidityPoolsPage(page hProtocol.LiquidityPoolsPage) (hProtocol.LiquidityPoolsPage, error)
- func (m *MockClient) PrevOffersPage(page hProtocol.OffersPage) (hProtocol.OffersPage, error)
- func (m *MockClient) PrevOperationsPage(page operations.OperationsPage) (operations.OperationsPage, error)
- func (m *MockClient) PrevPaymentsPage(page operations.OperationsPage) (operations.OperationsPage, error)
- func (m *MockClient) PrevTradeAggregationsPage(page hProtocol.TradeAggregationsPage) (hProtocol.TradeAggregationsPage, error)
- func (m *MockClient) PrevTradesPage(page hProtocol.TradesPage) (hProtocol.TradesPage, error)
- func (m *MockClient) PrevTransactionsPage(page hProtocol.TransactionsPage) (hProtocol.TransactionsPage, error)
- func (m *MockClient) Root() (hProtocol.Root, error)
- func (m *MockClient) StreamEffects(ctx context.Context, request EffectRequest, handler EffectHandler) error
- func (m *MockClient) StreamLedgers(ctx context.Context, request LedgerRequest, handler LedgerHandler) error
- func (m *MockClient) StreamOffers(ctx context.Context, request OfferRequest, handler OfferHandler) error
- func (m *MockClient) StreamOperations(ctx context.Context, request OperationRequest, handler OperationHandler) error
- func (m *MockClient) StreamOrderBooks(ctx context.Context, request OrderBookRequest, handler OrderBookHandler) error
- func (m *MockClient) StreamPayments(ctx context.Context, request OperationRequest, handler OperationHandler) error
- func (m *MockClient) StreamTrades(ctx context.Context, request TradeRequest, handler TradeHandler) error
- func (m *MockClient) StreamTransactions(ctx context.Context, request TransactionRequest, handler TransactionHandler) error
- func (m *MockClient) SubmitFeeBumpTransaction(transaction *txnbuild.FeeBumpTransaction) (hProtocol.Transaction, error)
- func (m *MockClient) SubmitFeeBumpTransactionWithOptions(transaction *txnbuild.FeeBumpTransaction, opts SubmitTxOpts) (hProtocol.Transaction, error)
- func (m *MockClient) SubmitTransaction(transaction *txnbuild.Transaction) (hProtocol.Transaction, error)
- func (m *MockClient) SubmitTransactionWithOptions(transaction *txnbuild.Transaction, opts SubmitTxOpts) (hProtocol.Transaction, error)
- func (m *MockClient) SubmitTransactionXDR(transactionXdr string) (hProtocol.Transaction, error)
- func (m *MockClient) TradeAggregations(request TradeAggregationRequest) (hProtocol.TradeAggregationsPage, error)
- func (m *MockClient) Trades(request TradeRequest) (hProtocol.TradesPage, error)
- func (m *MockClient) TransactionDetail(txHash string) (hProtocol.Transaction, error)
- func (m *MockClient) Transactions(request TransactionRequest) (hProtocol.TransactionsPage, error)
- type OfferHandler
- type OfferRequest
- type OperationHandler
- type OperationRequest
- func (op OperationRequest) BuildURL() (endpoint string, err error)
- func (op OperationRequest) HTTPRequest(auroraURL string) (*http.Request, error)
- func (op *OperationRequest) SetOperationsEndpoint() *OperationRequest
- func (op *OperationRequest) SetPaymentsEndpoint() *OperationRequest
- func (op OperationRequest) StreamOperations(ctx context.Context, client *Client, handler OperationHandler) error
- type Order
- type OrderBookHandler
- type OrderBookRequest
- type PathsRequest
- type ServerTimeRecord
- type StrictSendPathsRequest
- type SubmitTxOpts
- type TradeAggregationRequest
- type TradeHandler
- type TradeRequest
- type TransactionHandler
- type TransactionRequest
- type UniversalTimeHandler
Examples ¶
- Client.AccountDetail
- Client.Accounts
- Client.Assets
- Client.Effects
- Client.FeeStats
- Client.Fund
- Client.LedgerDetail
- Client.NextAccountsPage
- Client.NextAssetsPage
- Client.NextEffectsPage
- Client.NextLedgersPage
- Client.NextOffersPage
- Client.NextOperationsPage
- Client.NextTradeAggregationsPage
- Client.NextTradesPage
- Client.NextTransactionsPage
- Client.OfferDetails
- Client.Offers
- Client.OperationDetail
- Client.Operations
- Client.OrderBook
- Client.Paths
- Client.Payments
- Client.PrevAssetsPage
- Client.PrevEffectsPage
- Client.PrevLedgersPage
- Client.PrevOffersPage
- Client.PrevOperationsPage
- Client.PrevTradeAggregationsPage
- Client.PrevTradesPage
- Client.PrevTransactionsPage
- Client.Root
- Client.SetAuroraTimeout
- Client.StreamEffects
- Client.StreamLedgers
- Client.StreamOffers
- Client.StreamOperations
- Client.StreamOrderBooks
- Client.StreamPayments
- Client.StreamTrades
- Client.StreamTransactions
- Client.StrictSendPaths
- Client.SubmitFeeBumpTransaction
- Client.SubmitFeeBumpTransactionWithOptions
- Client.SubmitTransaction
- Client.SubmitTransactionWithOptions
- Client.SubmitTransactionWithOptions (Skip_memo_required_check)
- Client.SubmitTransactionXDR
- Client.TradeAggregations
- Client.Trades
- Client.Transactions
Constants ¶
const ( // OrderAsc represents an ascending order parameter OrderAsc Order = "asc" // OrderDesc represents an descending order parameter OrderDesc Order = "desc" // AssetType4 represents an asset type that is 4 characters long AssetType4 AssetType = "credit_alphanum4" // AssetType12 represents an asset type that is 12 characters long AssetType12 AssetType = "credit_alphanum12" // AssetTypeNative represents the asset type for Hcnet Lumens (XLM) AssetTypeNative AssetType = "native" )
Variables ¶
var ( // ErrResultCodesNotPopulated is the error returned from a call to // ResultCodes() against a `Problem` value that doesn't have the // "result_codes" extra field populated when it is expected to be. ErrResultCodesNotPopulated = errors.New("result_codes not populated") // ErrEnvelopeNotPopulated is the error returned from a call to // Envelope() against a `Problem` value that doesn't have the // "envelope_xdr" extra field populated when it is expected to be. ErrEnvelopeNotPopulated = errors.New("envelope_xdr not populated") // ErrResultNotPopulated is the error returned from a call to // Result() against a `Problem` value that doesn't have the // "result_xdr" extra field populated when it is expected to be. ErrResultNotPopulated = errors.New("result_xdr not populated") // ErrAccountRequiresMemo is the error returned from a call to checkMemoRequired // when any of the destination accounts required a memo in the transaction. ErrAccountRequiresMemo = errors.New("destination account requires a memo in the transaction") // AuroraTimeout is the default number of nanoseconds before a request to aurora times out. AuroraTimeout = 60 * time.Second // MinuteResolution represents 1 minute used as `resolution` parameter in trade aggregation MinuteResolution = time.Duration(1 * time.Minute) // FiveMinuteResolution represents 5 minutes used as `resolution` parameter in trade aggregation FiveMinuteResolution = time.Duration(5 * time.Minute) // FifteenMinuteResolution represents 15 minutes used as `resolution` parameter in trade aggregation FifteenMinuteResolution = time.Duration(15 * time.Minute) // HourResolution represents 1 hour used as `resolution` parameter in trade aggregation HourResolution = time.Duration(1 * time.Hour) // DayResolution represents 1 day used as `resolution` parameter in trade aggregation DayResolution = time.Duration(24 * time.Hour) // WeekResolution represents 1 week used as `resolution` parameter in trade aggregation WeekResolution = time.Duration(168 * time.Hour) )
var DefaultPublicNetClient = &Client{ AuroraURL: "https://aurora.hcnet.org/", HTTP: http.DefaultClient, auroraTimeout: AuroraTimeout, }
DefaultPublicNetClient is a default client to connect to public network.
var DefaultTestNetClient = &Client{ AuroraURL: "https://aurora-testnet.hcnet.org/", HTTP: http.DefaultClient, auroraTimeout: AuroraTimeout, }
DefaultTestNetClient is a default client to connect to test network.
var ServerTimeMap = make(map[string]ServerTimeRecord)
ServerTimeMap holds the ServerTimeRecord for different aurora instances.
Functions ¶
func IsNotFoundError ¶ added in v1.11.1
IsNotFoundError returns true if the error is a auroraclient.Error with a not_found problem indicating that the resource is not found on Aurora.
Types ¶
type AccountRequest ¶
AccountRequest struct contains data for making requests to the show account endpoint of a aurora server. "AccountID" and "DataKey" fields should both be set when retrieving AccountData. When getting the AccountDetail, only "AccountID" needs to be set.
func (AccountRequest) BuildURL ¶
func (ar AccountRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the AccountRequest struct. If only AccountID is present, then the endpoint for account details is returned. If both AccounId and DataKey are present, then the endpoint for getting account data is returned
func (AccountRequest) HTTPRequest ¶ added in v1.11.1
func (ar AccountRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the account endpoint
type AccountsRequest ¶ added in v1.11.1
type AccountsRequest struct { Signer string Asset string Sponsor string LiquidityPool string Order Order Cursor string Limit uint }
AccountsRequest struct contains data for making requests to the accounts endpoint of a aurora server. Either "Signer" or "Asset" fields should be set when retrieving Accounts. At the moment, you can't use both filters at the same time.
func (AccountsRequest) BuildURL ¶ added in v1.11.1
func (r AccountsRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the AccountsRequest struct. Either "Signer" or "Asset" fields should be set when retrieving Accounts. At the moment, you can't use both filters at the same time.
func (AccountsRequest) HTTPRequest ¶ added in v1.11.1
func (r AccountsRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the accounts endpoint
type AdminClient ¶ added in v1.11.1
type AdminClient struct {
// contains filtered or unexported fields
}
func NewAdminClient ¶ added in v1.11.1
port - the aurora admin port, zero value defaults to 4200 host - the host interface name that aurora has bound admin web service, zero value defaults to 'localhost' timeout - the length of time for the http client to wait on responses from admin web service
func (*AdminClient) GetIngestionAccountFilter ¶ added in v1.11.1
func (c *AdminClient) GetIngestionAccountFilter() (hProtocol.AccountFilterConfig, error)
func (*AdminClient) GetIngestionAssetFilter ¶ added in v1.11.1
func (c *AdminClient) GetIngestionAssetFilter() (hProtocol.AssetFilterConfig, error)
func (*AdminClient) SetIngestionAccountFilter ¶ added in v1.11.1
func (c *AdminClient) SetIngestionAccountFilter(filter hProtocol.AccountFilterConfig) error
func (*AdminClient) SetIngestionAssetFilter ¶ added in v1.11.1
func (c *AdminClient) SetIngestionAssetFilter(filter hProtocol.AssetFilterConfig) error
type AdminClientInterface ¶ added in v1.11.1
type AdminClientInterface interface { GetIngestionAccountFilter() (hProtocol.AccountFilterConfig, error) GetIngestionAssetFilter() (hProtocol.AssetFilterConfig, error) SetIngestionAccountFilter(hProtocol.AccountFilterConfig) error SetIngestionAssetFilter(hProtocol.AssetFilterConfig) error }
type AssetRequest ¶
type AssetRequest struct { ForAssetCode string ForAssetIssuer string Order Order Cursor string Limit uint }
AssetRequest struct contains data for getting asset details from a aurora server. If "ForAssetCode" and "ForAssetIssuer" are not set, it returns all assets. The query parameters (Order, Cursor and Limit) are optional. All or none can be set.
func (AssetRequest) BuildURL ¶
func (ar AssetRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the AssetRequest struct. If no data is set, it defaults to the build the URL for all assets
func (AssetRequest) HTTPRequest ¶ added in v1.11.1
func (ar AssetRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the assets endpoint
type AuroraRequest ¶
type AuroraRequest interface { BuildURL() (string, error) HTTPRequest(auroraURL string) (*http.Request, error) }
AuroraRequest contains methods implemented by request structs for aurora endpoints. Action needed in release: auroraclient-v8.0.0: remove BuildURL()
type ClaimableBalanceRequest ¶ added in v1.11.1
type ClaimableBalanceRequest struct { ID string Asset string Sponsor string Claimant string Cursor string Limit uint }
ClaimableBalanceRequest contains data about claimable balances. The filters are optional (all added except Asset)
func (ClaimableBalanceRequest) BuildURL ¶ added in v1.11.1
func (cbr ClaimableBalanceRequest) BuildURL() (endpoint string, err error)
Creates the URL to either request a specific claimable balance (CB) by ID, or request all CBs, possibly filtered by asset, claimant, or sponsor.
func (ClaimableBalanceRequest) HTTPRequest ¶ added in v1.11.1
func (cbr ClaimableBalanceRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the claimable balances endpoint
type Client ¶
type Client struct { // URL of Aurora server to connect AuroraURL string // HTTP client to make requests with HTTP HTTP // AppName is the name of the application using the auroraclient package AppName string // AppVersion is the version of the application using the auroraclient package AppVersion string // Headers allows specifying additional HTTP headers for requests made by the client. Headers map[string]string // contains filtered or unexported fields }
Client struct contains data for creating a aurora client that connects to the hcnet network.
func (*Client) AccountData ¶
func (c *Client) AccountData(request AccountRequest) (accountData hProtocol.AccountData, err error)
AccountData returns a single data associated with a given account See https://developers.hcnet.org/api/resources/accounts/data/
func (*Client) AccountDetail ¶
func (c *Client) AccountDetail(request AccountRequest) (account hProtocol.Account, err error)
AccountDetail returns information for a single account. See https://developers.hcnet.org/api/resources/accounts/single/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient accountRequest := auroraclient.AccountRequest{AccountID: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU"} account, err := client.AccountDetail(accountRequest) if err != nil { fmt.Println(err) return } fmt.Print(account) }
Output:
func (*Client) Accounts ¶ added in v1.11.1
func (c *Client) Accounts(request AccountsRequest) (accounts hProtocol.AccountsPage, err error)
Accounts returns accounts who have a given signer or have a trustline to an asset. See https://developers.hcnet.org/api/resources/accounts/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient accountsRequest := auroraclient.AccountsRequest{Signer: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU"} account, err := client.Accounts(accountsRequest) if err != nil { fmt.Println(err) return } fmt.Print(account) }
Output:
func (*Client) Assets ¶
func (c *Client) Assets(request AssetRequest) (assets hProtocol.AssetsPage, err error)
Assets returns asset information. See https://developers.hcnet.org/api/resources/assets/list/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // assets for asset issuer assetRequest := auroraclient.AssetRequest{ForAssetIssuer: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU"} asset, err := client.Assets(assetRequest) if err != nil { fmt.Println(err) return } fmt.Print(asset) // all assets assetRequest = auroraclient.AssetRequest{} asset, err = client.Assets(assetRequest) if err != nil { fmt.Println(err) return } fmt.Print(asset) }
Output:
func (*Client) AsyncSubmitFeeBumpTransaction ¶ added in v1.11.1
func (c *Client) AsyncSubmitFeeBumpTransaction(transaction *txnbuild.FeeBumpTransaction) (txResp hProtocol.AsyncTransactionSubmissionResponse, err error)
AsyncSubmitFeeBumpTransaction submits an async fee bump transaction to the network. err can be either an error object or a aurora.Error object.
This function will always check if the destination account requires a memo in the transaction as defined in SEP0029: https://github.com/HashCash-Consultants/hcnet-protocol/blob/master/ecosystem/sep-0029.md
If you want to skip this check, use SubmitTransactionWithOptions.
func (*Client) AsyncSubmitFeeBumpTransactionWithOptions ¶ added in v1.11.1
func (c *Client) AsyncSubmitFeeBumpTransactionWithOptions(transaction *txnbuild.FeeBumpTransaction, opts SubmitTxOpts) (txResp hProtocol.AsyncTransactionSubmissionResponse, err error)
AsyncSubmitFeeBumpTransactionWithOptions submits an async fee bump transaction to the network, allowing you to pass SubmitTxOpts. err can be either an error object or a aurora.Error object.
func (*Client) AsyncSubmitTransaction ¶ added in v1.11.1
func (c *Client) AsyncSubmitTransaction(transaction *txnbuild.Transaction) (txResp hProtocol.AsyncTransactionSubmissionResponse, err error)
AsyncSubmitTransaction submits an async transaction to the network. err can be either an error object or a aurora.Error object.
This function will always check if the destination account requires a memo in the transaction as defined in SEP0029: https://github.com/HashCash-Consultants/hcnet-protocol/blob/master/ecosystem/sep-0029.md
If you want to skip this check, use SubmitTransactionWithOptions.
func (*Client) AsyncSubmitTransactionWithOptions ¶ added in v1.11.1
func (c *Client) AsyncSubmitTransactionWithOptions(transaction *txnbuild.Transaction, opts SubmitTxOpts) (txResp hProtocol.AsyncTransactionSubmissionResponse, err error)
AsyncSubmitTransactionWithOptions submits an async transaction to the network, allowing you to pass SubmitTxOpts. err can be either an error object or a aurora.Error object.
func (*Client) AsyncSubmitTransactionXDR ¶ added in v1.11.1
func (c *Client) AsyncSubmitTransactionXDR(transactionXdr string) (txResp hProtocol.AsyncTransactionSubmissionResponse, err error)
AsyncSubmitTransactionXDR submits a base64 XDR transaction using the transactions_async endpoint. err can be either error object or aurora.Error object.
func (*Client) AuroraTimeout ¶ added in v1.11.1
AuroraTimeout returns the current timeout for a aurora client
func (*Client) ClaimableBalance ¶ added in v1.11.1
func (c *Client) ClaimableBalance(id string) (cb hProtocol.ClaimableBalance, err error)
ClaimableBalance returns details about a *specific*, unique claimable balance.
func (*Client) ClaimableBalances ¶ added in v1.11.1
func (c *Client) ClaimableBalances(cbr ClaimableBalanceRequest) (cb hProtocol.ClaimableBalances, err error)
ClaimableBalances returns details about available claimable balances, possibly filtered to a specific sponsor or other parameters.
func (*Client) Effects ¶
func (c *Client) Effects(request EffectRequest) (effects effects.EffectsPage, err error)
Effects returns effects (https://developers.hcnet.org/api/resources/effects/) It can be used to return effects for an account, a ledger, an operation, a transaction and all effects on the network.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" "github.com/HashCash-Consultants/go/protocols/aurora/effects" ) func main() { client := auroraclient.DefaultPublicNetClient // effects for an account effectRequest := auroraclient.EffectRequest{ForAccount: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU"} effect, err := client.Effects(effectRequest) if err != nil { fmt.Println(err) return } fmt.Print(effect) // all effects effectRequest = auroraclient.EffectRequest{} effect, err = client.Effects(effectRequest) if err != nil { fmt.Println(err) return } records := effect.Embedded.Records if records[0].GetType() == "account_created" { acc, ok := records[0].(effects.AccountCreated) if ok { fmt.Print(acc.Account) fmt.Print(acc.StartingBalance) } } }
Output:
func (*Client) FeeStats ¶
FeeStats returns information about fees in the last 5 ledgers. See https://developers.hcnet.org/api/aggregations/fee-stats/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // aurora fees fees, err := client.FeeStats() if err != nil { fmt.Println(err) return } fmt.Print(fees) }
Output:
func (*Client) FetchTimebounds ¶
func (c *Client) FetchTimebounds(seconds int64) (txnbuild.TimeBounds, error)
FetchTimebounds provides timebounds for N seconds from now using the server time of the aurora instance. It defaults to localtime when the server time is not available. Note that this will generate your timebounds when you init the transaction, not when you build or submit the transaction! So give yourself enough time to get the transaction built and signed before submitting.
func (*Client) Fund ¶
func (c *Client) Fund(addr string) (tx hProtocol.Transaction, err error)
Fund creates a new account funded from friendbot. It only works on test networks. See https://developers.hcnet.org/docs/tutorials/create-account/ for more information.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultTestNetClient // fund an account resp, err := client.Fund("GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU") if err != nil { fmt.Println(err) return } fmt.Print(resp) }
Output:
func (*Client) HomeDomainForAccount ¶
HomeDomainForAccount returns the home domain for a single account.
func (*Client) LedgerDetail ¶
LedgerDetail returns information about a particular ledger for a given sequence number See https://developers.hcnet.org/api/resources/ledgers/single/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // details for a ledger sequence := uint32(12345) ledger, err := client.LedgerDetail(sequence) if err != nil { fmt.Println(err) return } fmt.Print(ledger) }
Output:
func (*Client) Ledgers ¶
func (c *Client) Ledgers(request LedgerRequest) (ledgers hProtocol.LedgersPage, err error)
Ledgers returns information about all ledgers. See https://developers.hcnet.org/api/resources/ledgers/list/
func (*Client) LiquidityPoolDetail ¶ added in v1.11.1
func (c *Client) LiquidityPoolDetail(request LiquidityPoolRequest) (lp hProtocol.LiquidityPool, err error)
func (*Client) LiquidityPools ¶ added in v1.11.1
func (c *Client) LiquidityPools(request LiquidityPoolsRequest) (lp hProtocol.LiquidityPoolsPage, err error)
func (*Client) NextAccountsPage ¶ added in v1.11.1
func (c *Client) NextAccountsPage(page hProtocol.AccountsPage) (accounts hProtocol.AccountsPage, err error)
NextAccountsPage returns the next page of accounts.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // accounts with signer accountsRequest := auroraclient.AccountsRequest{Signer: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU", Limit: 20} accounts, err := client.Accounts(accountsRequest) if err != nil { fmt.Println(err) return } fmt.Println("Page 1:") for _, a := range accounts.Embedded.Records { fmt.Println(a.ID) } // next page accounts2, err := client.NextAccountsPage(accounts) if err != nil { fmt.Println(err) return } fmt.Println("Page 2:") for _, a := range accounts2.Embedded.Records { fmt.Println(a.ID) } }
Output:
func (*Client) NextAssetsPage ¶
func (c *Client) NextAssetsPage(page hProtocol.AssetsPage) (assets hProtocol.AssetsPage, err error)
NextAssetsPage returns the next page of assets.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // assets for asset issuer assetRequest := auroraclient.AssetRequest{ForAssetIssuer: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU", Limit: 20} asset, err := client.Assets(assetRequest) if err != nil { fmt.Println(err) return } fmt.Print(asset) // all assets assetRequest = auroraclient.AssetRequest{} asset, err = client.Assets(assetRequest) if err != nil { fmt.Println(err) return } // next page nextPage, err := client.NextAssetsPage(asset) if err != nil { fmt.Println(err) return } fmt.Println(nextPage) }
Output:
func (*Client) NextEffectsPage ¶
func (c *Client) NextEffectsPage(page effects.EffectsPage) (efp effects.EffectsPage, err error)
NextEffectsPage returns the next page of effects.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // all effects effectRequest := auroraclient.EffectRequest{Limit: 20} efp, err := client.Effects(effectRequest) if err != nil { fmt.Println(err) return } fmt.Print(efp) // get next pages. recordsFound := false if len(efp.Embedded.Records) > 0 { recordsFound = true } page := efp // get the next page of records if recordsFound is true for recordsFound { // next page nextPage, err := client.NextEffectsPage(page) if err != nil { fmt.Println(err) return } page = nextPage if len(nextPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(nextPage) } }
Output:
func (*Client) NextLedgersPage ¶
func (c *Client) NextLedgersPage(page hProtocol.LedgersPage) (ledgers hProtocol.LedgersPage, err error)
NextLedgersPage returns the next page of ledgers.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // all ledgers ledgerRequest := auroraclient.LedgerRequest{Limit: 20} ledgers, err := client.Ledgers(ledgerRequest) if err != nil { fmt.Println(err) return } fmt.Print(ledgers) // get next pages. recordsFound := false if len(ledgers.Embedded.Records) > 0 { recordsFound = true } page := ledgers // get the next page of records if recordsFound is true for recordsFound { // next page nextPage, err := client.NextLedgersPage(page) if err != nil { fmt.Println(err) return } page = nextPage if len(nextPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(nextPage) } }
Output:
func (*Client) NextLiquidityPoolsPage ¶ added in v1.11.1
func (c *Client) NextLiquidityPoolsPage(page hProtocol.LiquidityPoolsPage) (lp hProtocol.LiquidityPoolsPage, err error)
func (*Client) NextOffersPage ¶
func (c *Client) NextOffersPage(page hProtocol.OffersPage) (offers hProtocol.OffersPage, err error)
NextOffersPage returns the next page of offers.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // all offers offerRequest := auroraclient.OfferRequest{ForAccount: "GAQHWQYBBW272OOXNQMMLCA5WY2XAZPODGB7Q3S5OKKIXVESKO55ZQ7C", Limit: 20} offers, err := client.Offers(offerRequest) if err != nil { fmt.Println(err) return } fmt.Print(offers) // get next pages. recordsFound := false if len(offers.Embedded.Records) > 0 { recordsFound = true } page := offers // get the next page of records if recordsFound is true for recordsFound { // next page nextPage, err := client.NextOffersPage(page) if err != nil { fmt.Println(err) return } page = nextPage if len(nextPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(nextPage) } }
Output:
func (*Client) NextOperationsPage ¶
func (c *Client) NextOperationsPage(page operations.OperationsPage) (operations operations.OperationsPage, err error)
NextOperationsPage returns the next page of operations.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // all operations operationRequest := auroraclient.OperationRequest{Limit: 20} ops, err := client.Operations(operationRequest) if err != nil { fmt.Println(err) return } fmt.Print(ops) // get next pages. recordsFound := false if len(ops.Embedded.Records) > 0 { recordsFound = true } page := ops // get the next page of records if recordsFound is true for recordsFound { // next page nextPage, err := client.NextOperationsPage(page) if err != nil { fmt.Println(err) return } page = nextPage if len(nextPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(nextPage) } }
Output:
func (*Client) NextPaymentsPage ¶
func (c *Client) NextPaymentsPage(page operations.OperationsPage) (operations.OperationsPage, error)
NextPaymentsPage returns the next page of payments.
func (*Client) NextTradeAggregationsPage ¶ added in v1.11.1
func (c *Client) NextTradeAggregationsPage(page hProtocol.TradeAggregationsPage) (ta hProtocol.TradeAggregationsPage, err error)
NextTradeAggregationsPage returns the next page of trade aggregations from the current trade aggregations response.
Example ¶
package main import ( "fmt" "time" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient testTime := time.Unix(int64(1517521726), int64(0)) // Find trade aggregations ta := auroraclient.TradeAggregationRequest{ StartTime: testTime, EndTime: testTime, Resolution: auroraclient.FiveMinuteResolution, BaseAssetType: auroraclient.AssetTypeNative, CounterAssetType: auroraclient.AssetType4, CounterAssetCode: "SLT", CounterAssetIssuer: "GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP", Order: auroraclient.OrderDesc, } tradeAggs, err := client.TradeAggregations(ta) if err != nil { fmt.Println(err) return } fmt.Print(tradeAggs) // get next pages. recordsFound := false if len(tradeAggs.Embedded.Records) > 0 { recordsFound = true } page := tradeAggs // get the next page of records if recordsFound is true for recordsFound { // next page nextPage, err := client.NextTradeAggregationsPage(page) if err != nil { fmt.Println(err) return } page = nextPage if len(nextPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(nextPage) } }
Output:
func (*Client) NextTradesPage ¶
func (c *Client) NextTradesPage(page hProtocol.TradesPage) (trades hProtocol.TradesPage, err error)
NextTradesPage returns the next page of trades.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // all trades tradeRequest := auroraclient.TradeRequest{Cursor: "123456", Limit: 30, Order: auroraclient.OrderAsc} trades, err := client.Trades(tradeRequest) if err != nil { fmt.Println(err) return } fmt.Print(trades) // get next pages. recordsFound := false if len(trades.Embedded.Records) > 0 { recordsFound = true } page := trades // get the next page of records if recordsFound is true for recordsFound { // next page nextPage, err := client.NextTradesPage(page) if err != nil { fmt.Println(err) return } page = nextPage if len(nextPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(nextPage) } }
Output:
func (*Client) NextTransactionsPage ¶
func (c *Client) NextTransactionsPage(page hProtocol.TransactionsPage) (transactions hProtocol.TransactionsPage, err error)
NextTransactionsPage returns the next page of transactions.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // all transactions transactionRequest := auroraclient.TransactionRequest{Limit: 20} transactions, err := client.Transactions(transactionRequest) if err != nil { fmt.Println(err) return } fmt.Print(transactions) // get next pages. recordsFound := false if len(transactions.Embedded.Records) > 0 { recordsFound = true } page := transactions // get the next page of records if recordsFound is true for recordsFound { // next page nextPage, err := client.NextTransactionsPage(page) if err != nil { fmt.Println(err) return } page = nextPage if len(nextPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(nextPage) } }
Output:
func (*Client) OfferDetails ¶ added in v1.11.1
OfferDetails returns information for a single offer. See https://developers.hcnet.org/api/resources/offers/single/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient offer, err := client.OfferDetails("2") if err != nil { fmt.Println(err) return } fmt.Print(offer) }
Output:
func (*Client) Offers ¶
func (c *Client) Offers(request OfferRequest) (offers hProtocol.OffersPage, err error)
Offers returns information about offers made on the SDEX. See https://developers.hcnet.org/api/resources/offers/list/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient offerRequest := auroraclient.OfferRequest{ ForAccount: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU", Cursor: "now", Order: auroraclient.OrderDesc, } offers, err := client.Offers(offerRequest) if err != nil { fmt.Println(err) return } fmt.Print(offers) offerRequest = auroraclient.OfferRequest{ Seller: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU", Selling: "COP:GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU", Buying: "EUR:GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU", Order: auroraclient.OrderDesc, } offers, err = client.Offers(offerRequest) if err != nil { fmt.Println(err) return } fmt.Print(offers) }
Output:
func (*Client) OperationDetail ¶
func (c *Client) OperationDetail(id string) (ops operations.Operation, err error)
OperationDetail returns a single hcnet operation for a given operation id See https://developers.hcnet.org/api/resources/operations/single/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient opID := "123456" // operation details for an id ops, err := client.OperationDetail(opID) if err != nil { fmt.Println(err) return } fmt.Print(ops) }
Output:
func (*Client) Operations ¶
func (c *Client) Operations(request OperationRequest) (ops operations.OperationsPage, err error)
Operations returns hcnet operations (https://developers.hcnet.org/api/resources/operations/list/) It can be used to return operations for an account, a ledger, a transaction and all operations on the network.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" "github.com/HashCash-Consultants/go/protocols/aurora/operations" ) func main() { client := auroraclient.DefaultPublicNetClient // operations for an account opRequest := auroraclient.OperationRequest{ForAccount: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU"} ops, err := client.Operations(opRequest) if err != nil { fmt.Println(err) return } fmt.Print(ops) // all operations opRequest = auroraclient.OperationRequest{Cursor: "now"} ops, err = client.Operations(opRequest) if err != nil { fmt.Println(err) return } fmt.Print(ops) records := ops.Embedded.Records for _, value := range records { // prints the type fmt.Print(value.GetType()) // for example if the type is change_trust c, ok := value.(operations.ChangeTrust) if ok { // access ChangeTrust fields fmt.Print(c.Trustee) } } }
Output:
func (*Client) OrderBook ¶
func (c *Client) OrderBook(request OrderBookRequest) (obs hProtocol.OrderBookSummary, err error)
OrderBook returns the orderbook for an asset pair (https://developers.hcnet.org/api/aggregations/order-books/single/)
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // orderbook for an asset pair, e.g XLM/NGN obRequest := auroraclient.OrderBookRequest{ BuyingAssetType: auroraclient.AssetTypeNative, SellingAssetCode: "USD", SellingAssetType: auroraclient.AssetType4, SellingAssetIssuer: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU", } obs, err := client.OrderBook(obRequest) if err != nil { fmt.Println(err) return } fmt.Print(obs) }
Output:
func (*Client) Paths ¶
func (c *Client) Paths(request PathsRequest) (paths hProtocol.PathsPage, err error)
Paths returns the available paths to make a strict receive path payment. See https://developers.hcnet.org/api/aggregations/paths/strict-receive/ This function is an alias for `client.StrictReceivePaths` and will be deprecated, use `client.StrictReceivePaths` instead.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // Find paths for XLM->NGN pr := auroraclient.PathsRequest{ DestinationAccount: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU", DestinationAmount: "100", DestinationAssetCode: "NGN", DestinationAssetIssuer: "GDZST3XVCDTUJ76ZAV2HA72KYQODXXZ5PTMAPZGDHZ6CS7RO7MGG3DBM", DestinationAssetType: auroraclient.AssetType4, SourceAccount: "GDZST3XVCDTUJ76ZAV2HA72KYQODXXZ5PTMAPZGDHZ6CS7RO7MGG3DBM", } paths, err := client.StrictReceivePaths(pr) if err != nil { fmt.Println(err) return } fmt.Print(paths) }
Output:
func (*Client) Payments ¶
func (c *Client) Payments(request OperationRequest) (ops operations.OperationsPage, err error)
Payments returns hcnet account_merge, create_account, path payment and payment operations. It can be used to return payments for an account, a ledger, a transaction and all payments on the network.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" "github.com/HashCash-Consultants/go/protocols/aurora/operations" ) func main() { client := auroraclient.DefaultPublicNetClient // payments for an account opRequest := auroraclient.OperationRequest{ForAccount: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU"} ops, err := client.Payments(opRequest) if err != nil { fmt.Println(err) return } fmt.Print(ops) // all payments opRequest = auroraclient.OperationRequest{Cursor: "now"} ops, err = client.Payments(opRequest) if err != nil { fmt.Println(err) return } fmt.Print(ops) records := ops.Embedded.Records for _, value := range records { // prints the type fmt.Print(value.GetType()) // for example if the type is create_account c, ok := value.(operations.CreateAccount) if ok { // access create_account fields fmt.Print(c.StartingBalance) } } }
Output:
func (*Client) PrevAssetsPage ¶
func (c *Client) PrevAssetsPage(page hProtocol.AssetsPage) (assets hProtocol.AssetsPage, err error)
PrevAssetsPage returns the previous page of assets.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // assets for asset issuer assetRequest := auroraclient.AssetRequest{ForAssetIssuer: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU", Limit: 20} asset, err := client.Assets(assetRequest) if err != nil { fmt.Println(err) return } fmt.Print(asset) // all assets assetRequest = auroraclient.AssetRequest{} asset, err = client.Assets(assetRequest) if err != nil { fmt.Println(err) return } // next page prevPage, err := client.PrevAssetsPage(asset) if err != nil { fmt.Println(err) return } fmt.Println(prevPage) }
Output:
func (*Client) PrevEffectsPage ¶
func (c *Client) PrevEffectsPage(page effects.EffectsPage) (efp effects.EffectsPage, err error)
PrevEffectsPage returns the previous page of effects.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // all effects effectRequest := auroraclient.EffectRequest{Limit: 20} efp, err := client.Effects(effectRequest) if err != nil { fmt.Println(err) return } fmt.Print(efp) // get prev pages. recordsFound := false if len(efp.Embedded.Records) > 0 { recordsFound = true } page := efp // get the prev page of records if recordsFound is true for recordsFound { // prev page prevPage, err := client.PrevEffectsPage(page) if err != nil { fmt.Println(err) return } page = prevPage if len(prevPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(prevPage) } }
Output:
func (*Client) PrevLedgersPage ¶
func (c *Client) PrevLedgersPage(page hProtocol.LedgersPage) (ledgers hProtocol.LedgersPage, err error)
PrevLedgersPage returns the previous page of ledgers.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // all ledgers ledgerRequest := auroraclient.LedgerRequest{Limit: 20} ledgers, err := client.Ledgers(ledgerRequest) if err != nil { fmt.Println(err) return } fmt.Print(ledgers) // get prev pages. recordsFound := false if len(ledgers.Embedded.Records) > 0 { recordsFound = true } page := ledgers // get the prev page of records if recordsFound is true for recordsFound { // prev page prevPage, err := client.PrevLedgersPage(page) if err != nil { fmt.Println(err) return } page = prevPage if len(prevPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(prevPage) } }
Output:
func (*Client) PrevLiquidityPoolsPage ¶ added in v1.11.1
func (c *Client) PrevLiquidityPoolsPage(page hProtocol.LiquidityPoolsPage) (lp hProtocol.LiquidityPoolsPage, err error)
func (*Client) PrevOffersPage ¶
func (c *Client) PrevOffersPage(page hProtocol.OffersPage) (offers hProtocol.OffersPage, err error)
PrevOffersPage returns the previous page of offers.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // all offers offerRequest := auroraclient.OfferRequest{ForAccount: "GAQHWQYBBW272OOXNQMMLCA5WY2XAZPODGB7Q3S5OKKIXVESKO55ZQ7C", Limit: 20} offers, err := client.Offers(offerRequest) if err != nil { fmt.Println(err) return } fmt.Print(offers) // get prev pages. recordsFound := false if len(offers.Embedded.Records) > 0 { recordsFound = true } page := offers // get the prev page of records if recordsFound is true for recordsFound { // prev page prevPage, err := client.PrevOffersPage(page) if err != nil { fmt.Println(err) return } page = prevPage if len(prevPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(prevPage) } }
Output:
func (*Client) PrevOperationsPage ¶
func (c *Client) PrevOperationsPage(page operations.OperationsPage) (operations operations.OperationsPage, err error)
PrevOperationsPage returns the previous page of operations.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // all operations operationRequest := auroraclient.OperationRequest{Limit: 20} ops, err := client.Operations(operationRequest) if err != nil { fmt.Println(err) return } fmt.Print(ops) // get prev pages. recordsFound := false if len(ops.Embedded.Records) > 0 { recordsFound = true } page := ops // get the prev page of records if recordsFound is true for recordsFound { // prev page prevPage, err := client.PrevOperationsPage(page) if err != nil { fmt.Println(err) return } page = prevPage if len(prevPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(prevPage) } }
Output:
func (*Client) PrevPaymentsPage ¶
func (c *Client) PrevPaymentsPage(page operations.OperationsPage) (operations.OperationsPage, error)
PrevPaymentsPage returns the previous page of payments.
func (*Client) PrevTradeAggregationsPage ¶ added in v1.11.1
func (c *Client) PrevTradeAggregationsPage(page hProtocol.TradeAggregationsPage) (ta hProtocol.TradeAggregationsPage, err error)
PrevTradeAggregationsPage returns the previous page of trade aggregations from the current trade aggregations response.
Example ¶
package main import ( "fmt" "time" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient testTime := time.Unix(int64(1517521726), int64(0)) // Find trade aggregations ta := auroraclient.TradeAggregationRequest{ StartTime: testTime, EndTime: testTime, Resolution: auroraclient.FiveMinuteResolution, BaseAssetType: auroraclient.AssetTypeNative, CounterAssetType: auroraclient.AssetType4, CounterAssetCode: "SLT", CounterAssetIssuer: "GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP", Order: auroraclient.OrderDesc, } tradeAggs, err := client.TradeAggregations(ta) if err != nil { fmt.Println(err) return } fmt.Print(tradeAggs) // get prev pages. recordsFound := false if len(tradeAggs.Embedded.Records) > 0 { recordsFound = true } page := tradeAggs // get the prev page of records if recordsFound is true for recordsFound { // prev page prevPage, err := client.PrevTradeAggregationsPage(page) if err != nil { fmt.Println(err) return } page = prevPage if len(prevPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(prevPage) } }
Output:
func (*Client) PrevTradesPage ¶
func (c *Client) PrevTradesPage(page hProtocol.TradesPage) (trades hProtocol.TradesPage, err error)
PrevTradesPage returns the previous page of trades.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // all trades tradeRequest := auroraclient.TradeRequest{Cursor: "123456", Limit: 30, Order: auroraclient.OrderAsc} trades, err := client.Trades(tradeRequest) if err != nil { fmt.Println(err) return } fmt.Print(trades) // get prev pages. recordsFound := false if len(trades.Embedded.Records) > 0 { recordsFound = true } page := trades // get the prev page of records if recordsFound is true for recordsFound { // prev page prevPage, err := client.PrevTradesPage(page) if err != nil { fmt.Println(err) return } page = prevPage if len(prevPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(prevPage) } }
Output:
func (*Client) PrevTransactionsPage ¶
func (c *Client) PrevTransactionsPage(page hProtocol.TransactionsPage) (transactions hProtocol.TransactionsPage, err error)
PrevTransactionsPage returns the previous page of transactions.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // all transactions transactionRequest := auroraclient.TransactionRequest{Limit: 20} transactions, err := client.Transactions(transactionRequest) if err != nil { fmt.Println(err) return } fmt.Print(transactions) // get prev pages. recordsFound := false if len(transactions.Embedded.Records) > 0 { recordsFound = true } page := transactions // get the prev page of records if recordsFound is true for recordsFound { // prev page prevPage, err := client.PrevTransactionsPage(page) if err != nil { fmt.Println(err) return } page = prevPage if len(prevPage.Embedded.Records) == 0 { recordsFound = false } fmt.Println(prevPage) } }
Output:
func (*Client) Root ¶
Root loads the root endpoint of aurora
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultTestNetClient root, err := client.Root() if err != nil { fmt.Println(err) return } fmt.Print(root) }
Output:
func (*Client) SetAuroraTimeout ¶ added in v1.11.1
SetAuroraTimeout allows users to set the timeout before a aurora request is canceled. The timeout is specified as a time.Duration which is in nanoseconds.
Example ¶
package main import ( "fmt" "time" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultTestNetClient // https://www.hcnet.org/laboratory/#xdr-viewer?input=AAAAABB90WssODNIgi6BHveqzxTRmIpvAFRyVNM%2BHm2GVuCcAAAAZAAABD0AAuV%2FAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAyTBGxOgfSApppsTnb%2FYRr6gOR8WT0LZNrhLh4y3FCgoAAAAXSHboAAAAAAAAAAABhlbgnAAAAEAivKe977CQCxMOKTuj%2BcWTFqc2OOJU8qGr9afrgu2zDmQaX5Q0cNshc3PiBwe0qw%2F%2BD%2FqJk5QqM5dYeSUGeDQP&type=TransactionEnvelope&network=test txXdr := `AAAAABB90WssODNIgi6BHveqzxTRmIpvAFRyVNM+Hm2GVuCcAAAAZAAABD0AAuV/AAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAyTBGxOgfSApppsTnb/YRr6gOR8WT0LZNrhLh4y3FCgoAAAAXSHboAAAAAAAAAAABhlbgnAAAAEAivKe977CQCxMOKTuj+cWTFqc2OOJU8qGr9afrgu2zDmQaX5Q0cNshc3PiBwe0qw/+D/qJk5QqM5dYeSUGeDQP` // test user timeout client = client.SetAuroraTimeout(30 * time.Second) resp, err := client.SubmitTransactionXDR(txXdr) if err != nil { fmt.Println(err) return } fmt.Print(resp) }
Output:
func (*Client) StreamEffects ¶
func (c *Client) StreamEffects(ctx context.Context, request EffectRequest, handler EffectHandler) error
StreamEffects streams aurora effects. It can be used to stream all effects or account specific effects. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. EffectHandler is a user-supplied function that is executed for each streamed transaction received.
Example ¶
package main import ( "context" "fmt" "time" "github.com/HashCash-Consultants/go/clients/auroraclient" "github.com/HashCash-Consultants/go/protocols/aurora/effects" ) func main() { client := auroraclient.DefaultTestNetClient // all effects effectRequest := auroraclient.EffectRequest{Cursor: "760209215489"} ctx, cancel := context.WithCancel(context.Background()) go func() { // Stop streaming after 60 seconds. time.Sleep(60 * time.Second) cancel() }() printHandler := func(e effects.Effect) { fmt.Println(e) } err := client.StreamEffects(ctx, effectRequest, printHandler) if err != nil { fmt.Println(err) } }
Output:
func (*Client) StreamLedgers ¶
func (c *Client) StreamLedgers(ctx context.Context, request LedgerRequest, handler LedgerHandler) error
StreamLedgers streams hcnet ledgers. It can be used to stream all ledgers. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. LedgerHandler is a user-supplied function that is executed for each streamed ledger received.
Example ¶
package main import ( "context" "fmt" "time" "github.com/HashCash-Consultants/go/clients/auroraclient" hProtocol "github.com/HashCash-Consultants/go/protocols/aurora" ) func main() { client := auroraclient.DefaultTestNetClient // all ledgers from now ledgerRequest := auroraclient.LedgerRequest{} ctx, cancel := context.WithCancel(context.Background()) go func() { // Stop streaming after 60 seconds. time.Sleep(60 * time.Second) cancel() }() printHandler := func(ledger hProtocol.Ledger) { fmt.Println(ledger) } err := client.StreamLedgers(ctx, ledgerRequest, printHandler) if err != nil { fmt.Println(err) } }
Output:
func (*Client) StreamOffers ¶
func (c *Client) StreamOffers(ctx context.Context, request OfferRequest, handler OfferHandler) error
StreamOffers streams offers processed by the Hcnet network for an account. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. OfferHandler is a user-supplied function that is executed for each streamed offer received.
Example ¶
package main import ( "context" "fmt" "time" "github.com/HashCash-Consultants/go/clients/auroraclient" hProtocol "github.com/HashCash-Consultants/go/protocols/aurora" ) func main() { client := auroraclient.DefaultTestNetClient // offers for account offerRequest := auroraclient.OfferRequest{ForAccount: "GAQHWQYBBW272OOXNQMMLCA5WY2XAZPODGB7Q3S5OKKIXVESKO55ZQ7C", Cursor: "1"} ctx, cancel := context.WithCancel(context.Background()) go func() { // Stop streaming after 60 seconds. time.Sleep(60 * time.Second) cancel() }() printHandler := func(offer hProtocol.Offer) { fmt.Println(offer) } err := client.StreamOffers(ctx, offerRequest, printHandler) if err != nil { fmt.Println(err) } }
Output:
func (*Client) StreamOperations ¶
func (c *Client) StreamOperations(ctx context.Context, request OperationRequest, handler OperationHandler) error
StreamOperations streams hcnet operations. It can be used to stream all operations or operations for an account. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. OperationHandler is a user-supplied function that is executed for each streamed operation received.
Example ¶
package main import ( "context" "fmt" "time" "github.com/HashCash-Consultants/go/clients/auroraclient" "github.com/HashCash-Consultants/go/protocols/aurora/operations" ) func main() { client := auroraclient.DefaultTestNetClient // operations for an account opRequest := auroraclient.OperationRequest{ForAccount: "GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR", Cursor: "760209215489"} ctx, cancel := context.WithCancel(context.Background()) go func() { // Stop streaming after 60 seconds. time.Sleep(60 * time.Second) cancel() }() printHandler := func(op operations.Operation) { fmt.Println(op) } err := client.StreamOperations(ctx, opRequest, printHandler) if err != nil { fmt.Println(err) } }
Output:
func (*Client) StreamOrderBooks ¶
func (c *Client) StreamOrderBooks(ctx context.Context, request OrderBookRequest, handler OrderBookHandler) error
StreamOrderBooks streams the orderbook for a given asset pair. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. OrderBookHandler is a user-supplied function that is executed for each streamed order received.
Example ¶
package main import ( "context" "fmt" "time" "github.com/HashCash-Consultants/go/clients/auroraclient" hProtocol "github.com/HashCash-Consultants/go/protocols/aurora" ) func main() { client := auroraclient.DefaultTestNetClient orderbookRequest := auroraclient.OrderBookRequest{ SellingAssetType: auroraclient.AssetTypeNative, BuyingAssetType: auroraclient.AssetType4, BuyingAssetCode: "ABC", BuyingAssetIssuer: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU", } ctx, cancel := context.WithCancel(context.Background()) go func() { // Stop streaming after 60 seconds. time.Sleep(60 * time.Second) cancel() }() printHandler := func(orderbook hProtocol.OrderBookSummary) { fmt.Println(orderbook) } err := client.StreamOrderBooks(ctx, orderbookRequest, printHandler) if err != nil { fmt.Println(err) } }
Output:
func (*Client) StreamPayments ¶
func (c *Client) StreamPayments(ctx context.Context, request OperationRequest, handler OperationHandler) error
StreamPayments streams hcnet payments. It can be used to stream all payments or payments for an account. Payments include create_account, payment, path_payment and account_merge operations. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. OperationHandler is a user-supplied function that is executed for each streamed operation received.
Example ¶
package main import ( "context" "fmt" "time" "github.com/HashCash-Consultants/go/clients/auroraclient" "github.com/HashCash-Consultants/go/protocols/aurora/operations" ) func main() { client := auroraclient.DefaultTestNetClient // all payments opRequest := auroraclient.OperationRequest{Cursor: "760209215489"} ctx, cancel := context.WithCancel(context.Background()) go func() { // Stop streaming after 60 seconds. time.Sleep(60 * time.Second) cancel() }() printHandler := func(op operations.Operation) { fmt.Println(op) } err := client.StreamPayments(ctx, opRequest, printHandler) if err != nil { fmt.Println(err) } }
Output:
func (*Client) StreamTrades ¶
func (c *Client) StreamTrades(ctx context.Context, request TradeRequest, handler TradeHandler) (err error)
StreamTrades streams executed trades. It can be used to stream all trades, trades for an account and trades for an offer. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. TradeHandler is a user-supplied function that is executed for each streamed trade received.
Example ¶
package main import ( "context" "fmt" "time" "github.com/HashCash-Consultants/go/clients/auroraclient" hProtocol "github.com/HashCash-Consultants/go/protocols/aurora" ) func main() { client := auroraclient.DefaultTestNetClient // all trades tradeRequest := auroraclient.TradeRequest{Cursor: "760209215489"} ctx, cancel := context.WithCancel(context.Background()) go func() { // Stop streaming after 60 seconds. time.Sleep(60 * time.Second) cancel() }() printHandler := func(tr hProtocol.Trade) { fmt.Println(tr) } err := client.StreamTrades(ctx, tradeRequest, printHandler) if err != nil { fmt.Println(err) } }
Output:
func (*Client) StreamTransactions ¶
func (c *Client) StreamTransactions(ctx context.Context, request TransactionRequest, handler TransactionHandler) error
StreamTransactions streams processed transactions. It can be used to stream all transactions and transactions for an account. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. TransactionHandler is a user-supplied function that is executed for each streamed transaction received.
Example ¶
package main import ( "context" "fmt" "time" "github.com/HashCash-Consultants/go/clients/auroraclient" hProtocol "github.com/HashCash-Consultants/go/protocols/aurora" ) func main() { client := auroraclient.DefaultTestNetClient // all transactions transactionRequest := auroraclient.TransactionRequest{Cursor: "760209215489"} ctx, cancel := context.WithCancel(context.Background()) go func() { // Stop streaming after 60 seconds. time.Sleep(60 * time.Second) cancel() }() printHandler := func(tr hProtocol.Transaction) { fmt.Println(tr) } err := client.StreamTransactions(ctx, transactionRequest, printHandler) if err != nil { fmt.Println(err) } }
Output:
func (*Client) StrictReceivePaths ¶ added in v1.11.1
func (c *Client) StrictReceivePaths(request PathsRequest) (paths hProtocol.PathsPage, err error)
StrictReceivePaths returns the available paths to make a strict receive path payment. See https://developers.hcnet.org/api/aggregations/paths/strict-receive/
func (*Client) StrictSendPaths ¶ added in v1.11.1
func (c *Client) StrictSendPaths(request StrictSendPathsRequest) (paths hProtocol.PathsPage, err error)
StrictSendPaths returns the available paths to make a strict send path payment. See https://developers.hcnet.org/api/aggregations/paths/strict-send/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // Find paths for USD->EUR pr := auroraclient.StrictSendPathsRequest{ SourceAmount: "20", SourceAssetCode: "USD", SourceAssetIssuer: "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX", SourceAssetType: auroraclient.AssetType4, DestinationAssets: "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", } paths, err := client.StrictSendPaths(pr) if err != nil { fmt.Println(err) return } fmt.Print(paths) }
Output:
func (*Client) SubmitFeeBumpTransaction ¶ added in v1.11.1
func (c *Client) SubmitFeeBumpTransaction(transaction *txnbuild.FeeBumpTransaction) (tx hProtocol.Transaction, err error)
SubmitFeeBumpTransaction submits a fee bump transaction to the network. err can be either an error object or a aurora.Error object.
This function will always check if the destination account requires a memo in the transaction as defined in SEP0029: https://github.com/HashCash-Consultants/hcnet-protocol/blob/master/ecosystem/sep-0029.md
If you want to skip this check, use SubmitTransactionWithOptions.
See https://developers.hcnet.org/api/resources/transactions/post/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" "github.com/HashCash-Consultants/go/keypair" "github.com/HashCash-Consultants/go/network" "github.com/HashCash-Consultants/go/txnbuild" ) func main() { kp := keypair.MustParseFull("SDQQUZMIPUP5TSDWH3UJYAKUOP55IJ4KTBXTY7RCOMEFRQGYA6GIR3OD") client := auroraclient.DefaultTestNetClient ar := auroraclient.AccountRequest{AccountID: kp.Address()} sourceAccount, err := client.AccountDetail(ar) if err != nil { return } op := txnbuild.Payment{ Destination: kp.Address(), Amount: "1", Asset: txnbuild.NativeAsset{}, } tx, err := txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &sourceAccount, IncrementSequenceNum: false, Operations: []txnbuild.Operation{&op}, BaseFee: txnbuild.MinBaseFee, Preconditions: txnbuild.Preconditions{TimeBounds: txnbuild.NewInfiniteTimeout()}, // Use a real timeout in production! }, ) if err != nil { fmt.Println(err) return } tx, err = tx.Sign(network.TestNetworkPassphrase, kp) if err != nil { fmt.Println(err) return } feeBumpKP := keypair.MustParseFull("SA5ZEFDVFZ52GRU7YUGR6EDPBNRU2WLA6IQFQ7S2IH2DG3VFV3DOMV2Q") feeBumpTx, err := txnbuild.NewFeeBumpTransaction(txnbuild.FeeBumpTransactionParams{ Inner: tx, FeeAccount: feeBumpKP.Address(), BaseFee: txnbuild.MinBaseFee * 2, }) feeBumpTx, err = feeBumpTx.Sign(network.TestNetworkPassphrase, feeBumpKP) if err != nil { fmt.Println(err) return } result, err := client.SubmitFeeBumpTransaction(feeBumpTx) if err != nil { fmt.Println(err) } fmt.Println(result) }
Output:
func (*Client) SubmitFeeBumpTransactionWithOptions ¶ added in v1.11.1
func (c *Client) SubmitFeeBumpTransactionWithOptions(transaction *txnbuild.FeeBumpTransaction, opts SubmitTxOpts) (tx hProtocol.Transaction, err error)
SubmitFeeBumpTransactionWithOptions submits a fee bump transaction to the network, allowing you to pass SubmitTxOpts. err can be either an error object or a aurora.Error object.
See https://developers.hcnet.org/api/resources/transactions/post/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" "github.com/HashCash-Consultants/go/keypair" "github.com/HashCash-Consultants/go/network" "github.com/HashCash-Consultants/go/txnbuild" ) func main() { kp := keypair.MustParseFull("SDQQUZMIPUP5TSDWH3UJYAKUOP55IJ4KTBXTY7RCOMEFRQGYA6GIR3OD") client := auroraclient.DefaultTestNetClient ar := auroraclient.AccountRequest{AccountID: kp.Address()} sourceAccount, err := client.AccountDetail(ar) if err != nil { return } op := txnbuild.Payment{ Destination: kp.Address(), Amount: "1", Asset: txnbuild.NativeAsset{}, } tx, err := txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &sourceAccount, IncrementSequenceNum: false, Operations: []txnbuild.Operation{&op}, BaseFee: txnbuild.MinBaseFee, Preconditions: txnbuild.Preconditions{TimeBounds: txnbuild.NewInfiniteTimeout()}, // Use a real timeout in production! }, ) if err != nil { fmt.Println(err) return } tx, err = tx.Sign(network.TestNetworkPassphrase, kp) if err != nil { fmt.Println(err) return } feeBumpKP := keypair.MustParseFull("SA5ZEFDVFZ52GRU7YUGR6EDPBNRU2WLA6IQFQ7S2IH2DG3VFV3DOMV2Q") feeBumpTx, err := txnbuild.NewFeeBumpTransaction(txnbuild.FeeBumpTransactionParams{ Inner: tx, FeeAccount: feeBumpKP.Address(), BaseFee: txnbuild.MinBaseFee * 2, }) feeBumpTx, err = feeBumpTx.Sign(network.TestNetworkPassphrase, feeBumpKP) if err != nil { fmt.Println(err) return } result, err := client.SubmitFeeBumpTransactionWithOptions( feeBumpTx, auroraclient.SubmitTxOpts{SkipMemoRequiredCheck: true}, ) if err != nil { fmt.Println(err) } fmt.Println(result) }
Output:
func (*Client) SubmitTransaction ¶
func (c *Client) SubmitTransaction(transaction *txnbuild.Transaction) (tx hProtocol.Transaction, err error)
SubmitTransaction submits a transaction to the network. err can be either an error object or a aurora.Error object.
This function will always check if the destination account requires a memo in the transaction as defined in SEP0029: https://github.com/HashCash-Consultants/hcnet-protocol/blob/master/ecosystem/sep-0029.md
If you want to skip this check, use SubmitTransactionWithOptions.
See https://developers.hcnet.org/api/resources/transactions/post/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" "github.com/HashCash-Consultants/go/keypair" "github.com/HashCash-Consultants/go/network" "github.com/HashCash-Consultants/go/txnbuild" ) func main() { kp := keypair.MustParseFull("SDQQUZMIPUP5TSDWH3UJYAKUOP55IJ4KTBXTY7RCOMEFRQGYA6GIR3OD") client := auroraclient.DefaultTestNetClient ar := auroraclient.AccountRequest{AccountID: kp.Address()} sourceAccount, err := client.AccountDetail(ar) if err != nil { return } op := txnbuild.Payment{ Destination: kp.Address(), Amount: "1", Asset: txnbuild.NativeAsset{}, } tx, err := txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &sourceAccount, IncrementSequenceNum: false, Operations: []txnbuild.Operation{&op}, BaseFee: txnbuild.MinBaseFee, Preconditions: txnbuild.Preconditions{TimeBounds: txnbuild.NewInfiniteTimeout()}, // Use a real timeout in production! }, ) if err != nil { fmt.Println(err) return } tx, err = tx.Sign(network.TestNetworkPassphrase, kp) if err != nil { fmt.Println(err) return } result, err := client.SubmitTransaction(tx) if err != nil { fmt.Println(err) } fmt.Println(result) }
Output:
func (*Client) SubmitTransactionWithOptions ¶ added in v1.11.1
func (c *Client) SubmitTransactionWithOptions(transaction *txnbuild.Transaction, opts SubmitTxOpts) (tx hProtocol.Transaction, err error)
SubmitTransactionWithOptions submits a transaction to the network, allowing you to pass SubmitTxOpts. err can be either an error object or a aurora.Error object.
See https://developers.hcnet.org/api/resources/transactions/post/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" "github.com/HashCash-Consultants/go/keypair" "github.com/HashCash-Consultants/go/network" "github.com/HashCash-Consultants/go/txnbuild" ) func main() { kp := keypair.MustParseFull("SDQQUZMIPUP5TSDWH3UJYAKUOP55IJ4KTBXTY7RCOMEFRQGYA6GIR3OD") client := auroraclient.DefaultTestNetClient ar := auroraclient.AccountRequest{AccountID: kp.Address()} sourceAccount, err := client.AccountDetail(ar) if err != nil { return } op := txnbuild.Payment{ Destination: kp.Address(), Amount: "1", Asset: txnbuild.NativeAsset{}, } tx, err := txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &sourceAccount, IncrementSequenceNum: false, Operations: []txnbuild.Operation{&op}, BaseFee: txnbuild.MinBaseFee, Preconditions: txnbuild.Preconditions{TimeBounds: txnbuild.NewInfiniteTimeout()}, // Use a real timeout in production! }, ) if err != nil { fmt.Println(err) return } tx, err = tx.Sign(network.TestNetworkPassphrase, kp) if err != nil { fmt.Println(err) return } result, err := client.SubmitTransactionWithOptions(tx, auroraclient.SubmitTxOpts{SkipMemoRequiredCheck: true}) if err != nil { fmt.Println(err) } fmt.Println(result) }
Output:
Example (Skip_memo_required_check) ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" "github.com/HashCash-Consultants/go/keypair" "github.com/HashCash-Consultants/go/network" "github.com/HashCash-Consultants/go/txnbuild" ) func main() { kp := keypair.MustParseFull("SDQQUZMIPUP5TSDWH3UJYAKUOP55IJ4KTBXTY7RCOMEFRQGYA6GIR3OD") client := auroraclient.DefaultTestNetClient ar := auroraclient.AccountRequest{AccountID: kp.Address()} sourceAccount, err := client.AccountDetail(ar) if err != nil { return } op := txnbuild.Payment{ Destination: kp.Address(), Amount: "1", Asset: txnbuild.NativeAsset{}, } tx, err := txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &sourceAccount, IncrementSequenceNum: false, Operations: []txnbuild.Operation{&op}, BaseFee: txnbuild.MinBaseFee, Preconditions: txnbuild.Preconditions{TimeBounds: txnbuild.NewInfiniteTimeout()}, // Use a real timeout in production! }, ) if err != nil { fmt.Println(err) return } tx, err = tx.Sign(network.TestNetworkPassphrase, kp) if err != nil { fmt.Println(err) return } result, err := client.SubmitTransactionWithOptions(tx, auroraclient.SubmitTxOpts{ SkipMemoRequiredCheck: true, }) if err != nil { fmt.Println(err) } fmt.Println(result) }
Output:
func (*Client) SubmitTransactionXDR ¶
func (c *Client) SubmitTransactionXDR(transactionXdr string) (tx hProtocol.Transaction, err error)
SubmitTransactionXDR submits a transaction represented as a base64 XDR string to the network. err can be either error object or aurora.Error object. See https://developers.hcnet.org/api/resources/transactions/post/
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // https://www.hcnet.org/laboratory/#xdr-viewer?input=AAAAAOoS%2F5V%2BBiCPXRiVcz8YsnkDdODufq%2Bg7xdqTdIXN8vyAAAE4gFiW0YAAALxAAAAAQAAAAAAAAAAAAAAAFyuBUcAAAABAAAABzIyMjgyNDUAAAAAAQAAAAEAAAAALhsY%2FFdAHXllTmb025DtCVBw06WDSQjq6I9NrCQHOV8AAAABAAAAAHT8zKV7bRQzuGTpk9AO3gjWJ9jVxBXTgguFORkxHVIKAAAAAAAAAAAAOnDwAAAAAAAAAAIkBzlfAAAAQPefqlsOvni6xX1g3AqddvOp1GOM88JYzayGZodbzTfV5toyhxZvL1ZggY3prFsvrereugEpj1kyPJ67z6gcRg0XN8vyAAAAQGwmoTssW49gaze8iQkz%2FUA2E2N%2BBOo%2B6v7YdOSsvIcZnMc37KmXH920nLosKpDLqkNChVztSZFcbVUlHhjbQgA%3D&type=TransactionEnvelope&network=public txXdr := `AAAAAOoS/5V+BiCPXRiVcz8YsnkDdODufq+g7xdqTdIXN8vyAAAE4gFiW0YAAALxAAAAAQAAAAAAAAAAAAAAAFyuBUcAAAABAAAABzIyMjgyNDUAAAAAAQAAAAEAAAAALhsY/FdAHXllTmb025DtCVBw06WDSQjq6I9NrCQHOV8AAAABAAAAAHT8zKV7bRQzuGTpk9AO3gjWJ9jVxBXTgguFORkxHVIKAAAAAAAAAAAAOnDwAAAAAAAAAAIkBzlfAAAAQPefqlsOvni6xX1g3AqddvOp1GOM88JYzayGZodbzTfV5toyhxZvL1ZggY3prFsvrereugEpj1kyPJ67z6gcRg0XN8vyAAAAQGwmoTssW49gaze8iQkz/UA2E2N+BOo+6v7YdOSsvIcZnMc37KmXH920nLosKpDLqkNChVztSZFcbVUlHhjbQgA=` // submit transaction resp, err := client.SubmitTransactionXDR(txXdr) if err != nil { fmt.Println(err) return } fmt.Print(resp) }
Output:
func (*Client) TradeAggregations ¶
func (c *Client) TradeAggregations(request TradeAggregationRequest) (tds hProtocol.TradeAggregationsPage, err error)
TradeAggregations returns hcnet trade aggregations (https://developers.hcnet.org/api/aggregations/trade-aggregations/list/)
Example ¶
package main import ( "fmt" "time" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient testTime := time.Unix(int64(1517521726), int64(0)) // Find trade aggregations ta := auroraclient.TradeAggregationRequest{ StartTime: testTime, EndTime: testTime, Resolution: auroraclient.FiveMinuteResolution, BaseAssetType: auroraclient.AssetTypeNative, CounterAssetType: auroraclient.AssetType4, CounterAssetCode: "SLT", CounterAssetIssuer: "GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP", Order: auroraclient.OrderDesc, } tradeAggs, err := client.TradeAggregations(ta) if err != nil { fmt.Println(err) return } fmt.Print(tradeAggs) }
Output:
func (*Client) Trades ¶
func (c *Client) Trades(request TradeRequest) (tds hProtocol.TradesPage, err error)
Trades returns hcnet trades (https://developers.hcnet.org/api/resources/trades/list/) It can be used to return trades for an account, an offer and all trades on the network.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // Find all trades tr := auroraclient.TradeRequest{Cursor: "123456", Limit: 30, Order: auroraclient.OrderAsc} trades, err := client.Trades(tr) if err != nil { fmt.Println(err) return } fmt.Print(trades) }
Output:
func (*Client) TransactionDetail ¶
func (c *Client) TransactionDetail(txHash string) (tx hProtocol.Transaction, err error)
TransactionDetail returns information about a particular transaction for a given transaction hash See https://developers.hcnet.org/api/resources/transactions/single/
func (*Client) Transactions ¶
func (c *Client) Transactions(request TransactionRequest) (txs hProtocol.TransactionsPage, err error)
Transactions returns hcnet transactions (https://developers.hcnet.org/api/resources/transactions/list/) It can be used to return transactions for an account, a ledger,and all transactions on the network.
Example ¶
package main import ( "fmt" "github.com/HashCash-Consultants/go/clients/auroraclient" ) func main() { client := auroraclient.DefaultPublicNetClient // transactions for an account txRequest := auroraclient.TransactionRequest{ForAccount: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU"} txs, err := client.Transactions(txRequest) if err != nil { fmt.Println(err) return } fmt.Print(txs) // all transactions txRequest = auroraclient.TransactionRequest{Cursor: "now", Order: auroraclient.OrderDesc} txs, err = client.Transactions(txRequest) if err != nil { fmt.Println(err) return } fmt.Print(txs) records := txs.Embedded.Records for _, tx := range records { fmt.Print(tx) } }
Output:
type ClientInterface ¶
type ClientInterface interface { Accounts(request AccountsRequest) (hProtocol.AccountsPage, error) AccountDetail(request AccountRequest) (hProtocol.Account, error) AccountData(request AccountRequest) (hProtocol.AccountData, error) Effects(request EffectRequest) (effects.EffectsPage, error) Assets(request AssetRequest) (hProtocol.AssetsPage, error) Ledgers(request LedgerRequest) (hProtocol.LedgersPage, error) LedgerDetail(sequence uint32) (hProtocol.Ledger, error) FeeStats() (hProtocol.FeeStats, error) Offers(request OfferRequest) (hProtocol.OffersPage, error) OfferDetails(offerID string) (offer hProtocol.Offer, err error) Operations(request OperationRequest) (operations.OperationsPage, error) OperationDetail(id string) (operations.Operation, error) SubmitTransactionXDR(transactionXdr string) (hProtocol.Transaction, error) SubmitFeeBumpTransactionWithOptions(transaction *txnbuild.FeeBumpTransaction, opts SubmitTxOpts) (hProtocol.Transaction, error) SubmitTransactionWithOptions(transaction *txnbuild.Transaction, opts SubmitTxOpts) (hProtocol.Transaction, error) SubmitFeeBumpTransaction(transaction *txnbuild.FeeBumpTransaction) (hProtocol.Transaction, error) SubmitTransaction(transaction *txnbuild.Transaction) (hProtocol.Transaction, error) AsyncSubmitTransactionXDR(transactionXdr string) (hProtocol.AsyncTransactionSubmissionResponse, error) AsyncSubmitFeeBumpTransactionWithOptions(transaction *txnbuild.FeeBumpTransaction, opts SubmitTxOpts) (hProtocol.AsyncTransactionSubmissionResponse, error) AsyncSubmitTransactionWithOptions(transaction *txnbuild.Transaction, opts SubmitTxOpts) (hProtocol.AsyncTransactionSubmissionResponse, error) AsyncSubmitFeeBumpTransaction(transaction *txnbuild.FeeBumpTransaction) (hProtocol.AsyncTransactionSubmissionResponse, error) AsyncSubmitTransaction(transaction *txnbuild.Transaction) (hProtocol.AsyncTransactionSubmissionResponse, error) Transactions(request TransactionRequest) (hProtocol.TransactionsPage, error) TransactionDetail(txHash string) (hProtocol.Transaction, error) OrderBook(request OrderBookRequest) (hProtocol.OrderBookSummary, error) Paths(request PathsRequest) (hProtocol.PathsPage, error) Payments(request OperationRequest) (operations.OperationsPage, error) TradeAggregations(request TradeAggregationRequest) (hProtocol.TradeAggregationsPage, error) Trades(request TradeRequest) (hProtocol.TradesPage, error) Fund(addr string) (hProtocol.Transaction, error) StreamTransactions(ctx context.Context, request TransactionRequest, handler TransactionHandler) error StreamTrades(ctx context.Context, request TradeRequest, handler TradeHandler) error StreamEffects(ctx context.Context, request EffectRequest, handler EffectHandler) error StreamOperations(ctx context.Context, request OperationRequest, handler OperationHandler) error StreamPayments(ctx context.Context, request OperationRequest, handler OperationHandler) error StreamOffers(ctx context.Context, request OfferRequest, handler OfferHandler) error StreamLedgers(ctx context.Context, request LedgerRequest, handler LedgerHandler) error StreamOrderBooks(ctx context.Context, request OrderBookRequest, handler OrderBookHandler) error Root() (hProtocol.Root, error) NextAccountsPage(hProtocol.AccountsPage) (hProtocol.AccountsPage, error) NextAssetsPage(hProtocol.AssetsPage) (hProtocol.AssetsPage, error) PrevAssetsPage(hProtocol.AssetsPage) (hProtocol.AssetsPage, error) NextLedgersPage(hProtocol.LedgersPage) (hProtocol.LedgersPage, error) PrevLedgersPage(hProtocol.LedgersPage) (hProtocol.LedgersPage, error) NextEffectsPage(effects.EffectsPage) (effects.EffectsPage, error) PrevEffectsPage(effects.EffectsPage) (effects.EffectsPage, error) NextTransactionsPage(hProtocol.TransactionsPage) (hProtocol.TransactionsPage, error) PrevTransactionsPage(hProtocol.TransactionsPage) (hProtocol.TransactionsPage, error) NextOperationsPage(operations.OperationsPage) (operations.OperationsPage, error) PrevOperationsPage(operations.OperationsPage) (operations.OperationsPage, error) NextPaymentsPage(operations.OperationsPage) (operations.OperationsPage, error) PrevPaymentsPage(operations.OperationsPage) (operations.OperationsPage, error) NextOffersPage(hProtocol.OffersPage) (hProtocol.OffersPage, error) PrevOffersPage(hProtocol.OffersPage) (hProtocol.OffersPage, error) NextTradesPage(hProtocol.TradesPage) (hProtocol.TradesPage, error) PrevTradesPage(hProtocol.TradesPage) (hProtocol.TradesPage, error) HomeDomainForAccount(aid string) (string, error) NextTradeAggregationsPage(hProtocol.TradeAggregationsPage) (hProtocol.TradeAggregationsPage, error) PrevTradeAggregationsPage(hProtocol.TradeAggregationsPage) (hProtocol.TradeAggregationsPage, error) LiquidityPoolDetail(request LiquidityPoolRequest) (hProtocol.LiquidityPool, error) LiquidityPools(request LiquidityPoolsRequest) (hProtocol.LiquidityPoolsPage, error) NextLiquidityPoolsPage(hProtocol.LiquidityPoolsPage) (hProtocol.LiquidityPoolsPage, error) PrevLiquidityPoolsPage(hProtocol.LiquidityPoolsPage) (hProtocol.LiquidityPoolsPage, error) }
ClientInterface contains methods implemented by the aurora client
type EffectHandler ¶
EffectHandler is a function that is called when a new effect is received
type EffectRequest ¶
type EffectRequest struct { ForAccount string ForLedger string ForLiquidityPool string ForOperation string ForTransaction string Order Order Cursor string Limit uint }
EffectRequest struct contains data for getting effects from a aurora server. "ForAccount", "ForLedger", "ForOperation" and "ForTransaction": Not more than one of these can be set at a time. If none are set, the default is to return all effects. The query parameters (Order, Cursor and Limit) are optional. All or none can be set.
func (EffectRequest) BuildURL ¶
func (er EffectRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the EffectRequest struct. If no data is set, it defaults to the build the URL for all effects
func (EffectRequest) HTTPRequest ¶ added in v1.11.1
func (er EffectRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the effects endpoint
func (EffectRequest) StreamEffects ¶
func (er EffectRequest) StreamEffects(ctx context.Context, client *Client, handler EffectHandler) error
StreamEffects streams aurora effects. It can be used to stream all effects or account specific effects. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. EffectHandler is a user-supplied function that is executed for each streamed effect received.
type Error ¶
Error struct contains the problem returned by Aurora
func GetError ¶ added in v1.11.1
GetError returns an error that can be interpreted as a aurora-specific error. If err cannot be interpreted as a aurora-specific error, a nil error is returned. The caller should still check whether err is nil.
func (*Error) Envelope ¶
func (herr *Error) Envelope() (*xdr.TransactionEnvelope, error)
Envelope extracts the transaction envelope that triggered this error from the extra fields.
func (*Error) EnvelopeXDR ¶
EnvelopeXDR returns the base 64 serialised string representation of the XDR envelope. This can be stored, or decoded in the Hcnet Laboratory XDR viewer for example.
func (*Error) ResultCodes ¶
func (herr *Error) ResultCodes() (*hProtocol.TransactionResultCodes, error)
ResultCodes extracts a result code summary from the error, if possible.
func (*Error) ResultString ¶
ResultString extracts the transaction result as a string.
type HTTP ¶
type HTTP interface { Do(req *http.Request) (resp *http.Response, err error) Get(url string) (resp *http.Response, err error) PostForm(url string, data url.Values) (resp *http.Response, err error) }
HTTP represents the HTTP client that a aurora client uses to communicate
type LedgerHandler ¶
LedgerHandler is a function that is called when a new ledger is received
type LedgerRequest ¶
type LedgerRequest struct { Order Order Cursor string Limit uint // contains filtered or unexported fields }
LedgerRequest struct contains data for getting ledger details from a aurora server. The query parameters (Order, Cursor and Limit) are optional. All or none can be set.
func (LedgerRequest) BuildURL ¶
func (lr LedgerRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the LedgerRequest struct. If no data is set, it defaults to the build the URL for all ledgers
func (LedgerRequest) HTTPRequest ¶ added in v1.11.1
func (lr LedgerRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the ledger endpoint
func (LedgerRequest) StreamLedgers ¶
func (lr LedgerRequest) StreamLedgers(ctx context.Context, client *Client, handler LedgerHandler) (err error)
StreamLedgers streams hcnet ledgers. It can be used to stream all ledgers. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. LedgerHandler is a user-supplied function that is executed for each streamed ledger received.
type LiquidityPoolRequest ¶ added in v1.11.1
type LiquidityPoolRequest struct {
LiquidityPoolID string
}
LiquidityPoolRequest struct contains data for getting liquidity pool details from a aurora server.
func (LiquidityPoolRequest) BuildURL ¶ added in v1.11.1
func (r LiquidityPoolRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the LiquidityPoolRequest struct. If no data is set, it defaults to the build the URL for all assets
func (LiquidityPoolRequest) HTTPRequest ¶ added in v1.11.1
func (r LiquidityPoolRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the liquidity pool endpoint
type LiquidityPoolsRequest ¶ added in v1.11.1
LiquidityPoolsRequest struct contains data for getting pool details from a aurora server. If "Reserves" is not set, it returns all liquidity pools. The query parameters (Order, Cursor and Limit) are optional. All or none can be set.
func (LiquidityPoolsRequest) BuildURL ¶ added in v1.11.1
func (r LiquidityPoolsRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the LiquidityPoolRequest struct. If no data is set, it defaults to the build the URL for all assets
func (LiquidityPoolsRequest) HTTPRequest ¶ added in v1.11.1
func (r LiquidityPoolsRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the pool endpoint
type MockAdminClient ¶ added in v1.11.1
func (*MockAdminClient) GetIngestionAccountFilter ¶ added in v1.11.1
func (m *MockAdminClient) GetIngestionAccountFilter() (hProtocol.AccountFilterConfig, error)
func (*MockAdminClient) GetIngestionAssetFilter ¶ added in v1.11.1
func (m *MockAdminClient) GetIngestionAssetFilter() (hProtocol.AssetFilterConfig, error)
func (*MockAdminClient) SetIngestionAccountFilter ¶ added in v1.11.1
func (m *MockAdminClient) SetIngestionAccountFilter(resource hProtocol.AccountFilterConfig) error
func (*MockAdminClient) SetIngestionAssetFilter ¶ added in v1.11.1
func (m *MockAdminClient) SetIngestionAssetFilter(resource hProtocol.AssetFilterConfig) error
type MockClient ¶
MockClient is a mockable aurora client.
func (*MockClient) AccountData ¶
func (m *MockClient) AccountData(request AccountRequest) (hProtocol.AccountData, error)
AccountData is a mocking method
func (*MockClient) AccountDetail ¶
func (m *MockClient) AccountDetail(request AccountRequest) (hProtocol.Account, error)
AccountDetail is a mocking method
func (*MockClient) Accounts ¶ added in v1.11.1
func (m *MockClient) Accounts(request AccountsRequest) (hProtocol.AccountsPage, error)
Accounts is a mocking method
func (*MockClient) Assets ¶
func (m *MockClient) Assets(request AssetRequest) (hProtocol.AssetsPage, error)
Assets is a mocking method
func (*MockClient) AsyncSubmitFeeBumpTransaction ¶ added in v1.11.1
func (m *MockClient) AsyncSubmitFeeBumpTransaction(transaction *txnbuild.FeeBumpTransaction) (hProtocol.AsyncTransactionSubmissionResponse, error)
AsyncSubmitFeeBumpTransaction is a mocking method
func (*MockClient) AsyncSubmitFeeBumpTransactionWithOptions ¶ added in v1.11.1
func (m *MockClient) AsyncSubmitFeeBumpTransactionWithOptions(transaction *txnbuild.FeeBumpTransaction, opts SubmitTxOpts) (hProtocol.AsyncTransactionSubmissionResponse, error)
AsyncSubmitFeeBumpTransactionWithOptions is a mocking method
func (*MockClient) AsyncSubmitTransaction ¶ added in v1.11.1
func (m *MockClient) AsyncSubmitTransaction(transaction *txnbuild.Transaction) (hProtocol.AsyncTransactionSubmissionResponse, error)
AsyncSubmitTransaction is a mocking method
func (*MockClient) AsyncSubmitTransactionWithOptions ¶ added in v1.11.1
func (m *MockClient) AsyncSubmitTransactionWithOptions(transaction *txnbuild.Transaction, opts SubmitTxOpts) (hProtocol.AsyncTransactionSubmissionResponse, error)
AsyncSubmitTransactionWithOptions is a mocking method
func (*MockClient) AsyncSubmitTransactionXDR ¶ added in v1.11.1
func (m *MockClient) AsyncSubmitTransactionXDR(transactionXdr string) (hProtocol.AsyncTransactionSubmissionResponse, error)
AsyncSubmitTransactionXDR is a mocking method
func (*MockClient) Effects ¶
func (m *MockClient) Effects(request EffectRequest) (effects.EffectsPage, error)
Effects is a mocking method
func (*MockClient) FeeStats ¶
func (m *MockClient) FeeStats() (hProtocol.FeeStats, error)
FeeStats is a mocking method
func (*MockClient) Fund ¶
func (m *MockClient) Fund(addr string) (hProtocol.Transaction, error)
Fund is a mocking method
func (*MockClient) HomeDomainForAccount ¶
func (m *MockClient) HomeDomainForAccount(aid string) (string, error)
HomeDomainForAccount is a mocking method
func (*MockClient) LedgerDetail ¶
func (m *MockClient) LedgerDetail(sequence uint32) (hProtocol.Ledger, error)
LedgerDetail is a mocking method
func (*MockClient) Ledgers ¶
func (m *MockClient) Ledgers(request LedgerRequest) (hProtocol.LedgersPage, error)
Ledgers is a mocking method
func (*MockClient) LiquidityPoolDetail ¶ added in v1.11.1
func (m *MockClient) LiquidityPoolDetail(request LiquidityPoolRequest) (hProtocol.LiquidityPool, error)
func (*MockClient) LiquidityPools ¶ added in v1.11.1
func (m *MockClient) LiquidityPools(request LiquidityPoolsRequest) (hProtocol.LiquidityPoolsPage, error)
func (*MockClient) NextAccountsPage ¶ added in v1.11.1
func (m *MockClient) NextAccountsPage(page hProtocol.AccountsPage) (hProtocol.AccountsPage, error)
NextAccountsPage is a mocking method
func (*MockClient) NextAssetsPage ¶
func (m *MockClient) NextAssetsPage(page hProtocol.AssetsPage) (hProtocol.AssetsPage, error)
NextAssetsPage is a mocking method
func (*MockClient) NextEffectsPage ¶
func (m *MockClient) NextEffectsPage(page effects.EffectsPage) (effects.EffectsPage, error)
NextEffectsPage is a mocking method
func (*MockClient) NextLedgersPage ¶
func (m *MockClient) NextLedgersPage(page hProtocol.LedgersPage) (hProtocol.LedgersPage, error)
NextLedgersPage is a mocking method
func (*MockClient) NextLiquidityPoolsPage ¶ added in v1.11.1
func (m *MockClient) NextLiquidityPoolsPage(page hProtocol.LiquidityPoolsPage) (hProtocol.LiquidityPoolsPage, error)
func (*MockClient) NextOffersPage ¶
func (m *MockClient) NextOffersPage(page hProtocol.OffersPage) (hProtocol.OffersPage, error)
NextOffersPage is a mocking method
func (*MockClient) NextOperationsPage ¶
func (m *MockClient) NextOperationsPage(page operations.OperationsPage) (operations.OperationsPage, error)
NextOperationsPage is a mocking method
func (*MockClient) NextPaymentsPage ¶
func (m *MockClient) NextPaymentsPage(page operations.OperationsPage) (operations.OperationsPage, error)
NextPaymentsPage is a mocking method
func (*MockClient) NextTradeAggregationsPage ¶ added in v1.11.1
func (m *MockClient) NextTradeAggregationsPage(page hProtocol.TradeAggregationsPage) (hProtocol.TradeAggregationsPage, error)
NextTradeAggregationsPage is a mocking method
func (*MockClient) NextTradesPage ¶
func (m *MockClient) NextTradesPage(page hProtocol.TradesPage) (hProtocol.TradesPage, error)
NextTradesPage is a mocking method
func (*MockClient) NextTransactionsPage ¶
func (m *MockClient) NextTransactionsPage(page hProtocol.TransactionsPage) (hProtocol.TransactionsPage, error)
NextTransactionsPage is a mocking method
func (*MockClient) OfferDetails ¶ added in v1.11.1
func (m *MockClient) OfferDetails(offerID string) (hProtocol.Offer, error)
OfferDetail is a mocking method
func (*MockClient) Offers ¶
func (m *MockClient) Offers(request OfferRequest) (hProtocol.OffersPage, error)
Offers is a mocking method
func (*MockClient) OperationDetail ¶
func (m *MockClient) OperationDetail(id string) (operations.Operation, error)
OperationDetail is a mocking method
func (*MockClient) Operations ¶
func (m *MockClient) Operations(request OperationRequest) (operations.OperationsPage, error)
Operations is a mocking method
func (*MockClient) OrderBook ¶
func (m *MockClient) OrderBook(request OrderBookRequest) (hProtocol.OrderBookSummary, error)
OrderBook is a mocking method
func (*MockClient) Paths ¶
func (m *MockClient) Paths(request PathsRequest) (hProtocol.PathsPage, error)
Paths is a mocking method
func (*MockClient) Payments ¶
func (m *MockClient) Payments(request OperationRequest) (operations.OperationsPage, error)
Payments is a mocking method
func (*MockClient) PrevAssetsPage ¶
func (m *MockClient) PrevAssetsPage(page hProtocol.AssetsPage) (hProtocol.AssetsPage, error)
PrevAssetsPage is a mocking method
func (*MockClient) PrevEffectsPage ¶
func (m *MockClient) PrevEffectsPage(page effects.EffectsPage) (effects.EffectsPage, error)
PrevEffectsPage is a mocking method
func (*MockClient) PrevLedgersPage ¶
func (m *MockClient) PrevLedgersPage(page hProtocol.LedgersPage) (hProtocol.LedgersPage, error)
PrevLedgersPage is a mocking method
func (*MockClient) PrevLiquidityPoolsPage ¶ added in v1.11.1
func (m *MockClient) PrevLiquidityPoolsPage(page hProtocol.LiquidityPoolsPage) (hProtocol.LiquidityPoolsPage, error)
func (*MockClient) PrevOffersPage ¶
func (m *MockClient) PrevOffersPage(page hProtocol.OffersPage) (hProtocol.OffersPage, error)
PrevOffersPage is a mocking method
func (*MockClient) PrevOperationsPage ¶
func (m *MockClient) PrevOperationsPage(page operations.OperationsPage) (operations.OperationsPage, error)
PrevOperationsPage is a mocking method
func (*MockClient) PrevPaymentsPage ¶
func (m *MockClient) PrevPaymentsPage(page operations.OperationsPage) (operations.OperationsPage, error)
PrevPaymentsPage is a mocking method
func (*MockClient) PrevTradeAggregationsPage ¶ added in v1.11.1
func (m *MockClient) PrevTradeAggregationsPage(page hProtocol.TradeAggregationsPage) (hProtocol.TradeAggregationsPage, error)
PrevTradeAggregationsPage is a mocking method
func (*MockClient) PrevTradesPage ¶
func (m *MockClient) PrevTradesPage(page hProtocol.TradesPage) (hProtocol.TradesPage, error)
PrevTradesPage is a mocking method
func (*MockClient) PrevTransactionsPage ¶
func (m *MockClient) PrevTransactionsPage(page hProtocol.TransactionsPage) (hProtocol.TransactionsPage, error)
PrevTransactionsPage is a mocking method
func (*MockClient) Root ¶
func (m *MockClient) Root() (hProtocol.Root, error)
Root is a mocking method
func (*MockClient) StreamEffects ¶
func (m *MockClient) StreamEffects(ctx context.Context, request EffectRequest, handler EffectHandler) error
StreamEffects is a mocking method
func (*MockClient) StreamLedgers ¶
func (m *MockClient) StreamLedgers(ctx context.Context, request LedgerRequest, handler LedgerHandler) error
StreamLedgers is a mocking method
func (*MockClient) StreamOffers ¶
func (m *MockClient) StreamOffers(ctx context.Context, request OfferRequest, handler OfferHandler) error
StreamOffers is a mocking method
func (*MockClient) StreamOperations ¶
func (m *MockClient) StreamOperations(ctx context.Context, request OperationRequest, handler OperationHandler) error
StreamOperations is a mocking method
func (*MockClient) StreamOrderBooks ¶
func (m *MockClient) StreamOrderBooks(ctx context.Context, request OrderBookRequest, handler OrderBookHandler) error
StreamOrderBooks is a mocking method
func (*MockClient) StreamPayments ¶
func (m *MockClient) StreamPayments(ctx context.Context, request OperationRequest, handler OperationHandler) error
StreamPayments is a mocking method
func (*MockClient) StreamTrades ¶
func (m *MockClient) StreamTrades(ctx context.Context, request TradeRequest, handler TradeHandler) error
StreamTrades is a mocking method
func (*MockClient) StreamTransactions ¶
func (m *MockClient) StreamTransactions(ctx context.Context, request TransactionRequest, handler TransactionHandler) error
StreamTransactions is a mocking method
func (*MockClient) SubmitFeeBumpTransaction ¶ added in v1.11.1
func (m *MockClient) SubmitFeeBumpTransaction(transaction *txnbuild.FeeBumpTransaction) (hProtocol.Transaction, error)
SubmitFeeBumpTransaction is a mocking method
func (*MockClient) SubmitFeeBumpTransactionWithOptions ¶ added in v1.11.1
func (m *MockClient) SubmitFeeBumpTransactionWithOptions(transaction *txnbuild.FeeBumpTransaction, opts SubmitTxOpts) (hProtocol.Transaction, error)
SubmitFeeBumpTransactionWithOptions is a mocking method
func (*MockClient) SubmitTransaction ¶
func (m *MockClient) SubmitTransaction(transaction *txnbuild.Transaction) (hProtocol.Transaction, error)
SubmitTransaction is a mocking method
func (*MockClient) SubmitTransactionWithOptions ¶ added in v1.11.1
func (m *MockClient) SubmitTransactionWithOptions(transaction *txnbuild.Transaction, opts SubmitTxOpts) (hProtocol.Transaction, error)
SubmitTransactionWithOptions is a mocking method
func (*MockClient) SubmitTransactionXDR ¶
func (m *MockClient) SubmitTransactionXDR(transactionXdr string) (hProtocol.Transaction, error)
SubmitTransactionXDR is a mocking method
func (*MockClient) TradeAggregations ¶
func (m *MockClient) TradeAggregations(request TradeAggregationRequest) (hProtocol.TradeAggregationsPage, error)
TradeAggregations is a mocking method
func (*MockClient) Trades ¶
func (m *MockClient) Trades(request TradeRequest) (hProtocol.TradesPage, error)
Trades is a mocking method
func (*MockClient) TransactionDetail ¶
func (m *MockClient) TransactionDetail(txHash string) (hProtocol.Transaction, error)
TransactionDetail is a mocking method
func (*MockClient) Transactions ¶
func (m *MockClient) Transactions(request TransactionRequest) (hProtocol.TransactionsPage, error)
Transactions is a mocking method
type OfferHandler ¶
OfferHandler is a function that is called when a new offer is received
type OfferRequest ¶
type OfferRequest struct { OfferID string ForAccount string Selling string Seller string Buying string Order Order Cursor string Limit uint }
OfferRequest struct contains data for getting offers made by an account from a aurora server. The query parameters (Order, Cursor and Limit) are optional. All or none can be set.
func (OfferRequest) BuildURL ¶
func (or OfferRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the OfferRequest struct.
func (OfferRequest) HTTPRequest ¶ added in v1.11.1
func (or OfferRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the offers endpoint
func (OfferRequest) StreamOffers ¶
func (or OfferRequest) StreamOffers(ctx context.Context, client *Client, handler OfferHandler) (err error)
StreamOffers streams offers processed by the Hcnet network for an account. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. OfferHandler is a user-supplied function that is executed for each streamed offer received.
type OperationHandler ¶
type OperationHandler func(operations.Operation)
OperationHandler is a function that is called when a new operation is received
type OperationRequest ¶
type OperationRequest struct { ForAccount string ForClaimableBalance string ForLedger uint ForLiquidityPool string ForTransaction string Order Order Cursor string Limit uint IncludeFailed bool Join string // contains filtered or unexported fields }
OperationRequest struct contains data for getting operation details from a aurora server. "ForAccount", "ForLedger", "ForTransaction": Only one of these can be set at a time. If none are provided, the default is to return all operations. The query parameters (Order, Cursor, Limit and IncludeFailed) are optional. All or none can be set.
func (OperationRequest) BuildURL ¶
func (op OperationRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the OperationRequest struct. If no data is set, it defaults to the build the URL for all operations or all payments; depending on thevalue of `op.endpoint`
func (OperationRequest) HTTPRequest ¶ added in v1.11.1
func (op OperationRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the operations endpoint
func (*OperationRequest) SetOperationsEndpoint ¶
func (op *OperationRequest) SetOperationsEndpoint() *OperationRequest
SetOperationsEndpoint is a helper function that sets the `endpoint` for OperationRequests to `operations`
func (*OperationRequest) SetPaymentsEndpoint ¶
func (op *OperationRequest) SetPaymentsEndpoint() *OperationRequest
SetPaymentsEndpoint is a helper function that sets the `endpoint` for OperationRequests to `payments`
func (OperationRequest) StreamOperations ¶
func (op OperationRequest) StreamOperations(ctx context.Context, client *Client, handler OperationHandler) error
StreamOperations streams hcnet operations. It can be used to stream all operations or operations for and account. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. OperationHandler is a user-supplied function that is executed for each streamed operation received.
type OrderBookHandler ¶
type OrderBookHandler func(hProtocol.OrderBookSummary)
OrderBookHandler is a function that is called when a new order summary is received
type OrderBookRequest ¶
type OrderBookRequest struct { SellingAssetType AssetType SellingAssetCode string SellingAssetIssuer string BuyingAssetType AssetType BuyingAssetCode string BuyingAssetIssuer string Limit uint }
OrderBookRequest struct contains data for getting the orderbook for an asset pair from a aurora server. Limit is optional. All other parameters are required.
func (OrderBookRequest) BuildURL ¶
func (obr OrderBookRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the OrderBookRequest struct.
func (OrderBookRequest) HTTPRequest ¶ added in v1.11.1
func (obr OrderBookRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the order book endpoint
func (OrderBookRequest) StreamOrderBooks ¶
func (obr OrderBookRequest) StreamOrderBooks(ctx context.Context, client *Client, handler OrderBookHandler) error
StreamOrderBooks streams the orderbook for a given asset pair. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. OrderBookHandler is a user-supplied function that is executed for each streamed order received.
type PathsRequest ¶
type PathsRequest struct { DestinationAccount string DestinationAssetType AssetType DestinationAssetCode string DestinationAssetIssuer string DestinationAmount string SourceAccount string SourceAssets string }
PathsRequest struct contains data for getting available strict receive path payments from a aurora server. All the Destination related parameters are required and you need to include either SourceAccount or SourceAssets. See https://developers.hcnet.org/api/aggregations/paths/strict-receive/
func (PathsRequest) BuildURL ¶
func (pr PathsRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the PathsRequest struct.
func (PathsRequest) HTTPRequest ¶ added in v1.11.1
func (pr PathsRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the path payment endpoint
type ServerTimeRecord ¶
ServerTimeRecord contains data for the current unix time of a aurora server instance, and the local time when it was recorded.
type StrictSendPathsRequest ¶ added in v1.11.1
type StrictSendPathsRequest struct { DestinationAccount string DestinationAssets string SourceAssetType AssetType SourceAssetCode string SourceAssetIssuer string SourceAmount string }
StrictSendPathsRequest struct contains data for getting available strict send path payments from a aurora server. All the Source related parameters are required and you need to include either DestinationAccount or DestinationAssets. See https://developers.hcnet.org/api/aggregations/paths/strict-send/
func (StrictSendPathsRequest) BuildURL ¶ added in v1.11.1
func (pr StrictSendPathsRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the PathsRequest struct.
func (StrictSendPathsRequest) HTTPRequest ¶ added in v1.11.1
func (pr StrictSendPathsRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the strict send path payment endpoint
type SubmitTxOpts ¶ added in v1.11.1
type SubmitTxOpts struct {
SkipMemoRequiredCheck bool
}
SubmitTxOpts represents the submit transaction options
type TradeAggregationRequest ¶
type TradeAggregationRequest struct { StartTime time.Time EndTime time.Time Resolution time.Duration Offset time.Duration BaseAssetType AssetType BaseAssetCode string BaseAssetIssuer string CounterAssetType AssetType CounterAssetCode string CounterAssetIssuer string Order Order Limit uint }
TradeAggregationRequest struct contains data for getting trade aggregations from a aurora server. The query parameters (Order and Limit) are optional. All or none can be set. All other parameters are required.
func (TradeAggregationRequest) BuildURL ¶
func (ta TradeAggregationRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the TradeAggregationRequest struct.
func (TradeAggregationRequest) HTTPRequest ¶ added in v1.11.1
func (ta TradeAggregationRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the trade aggregations endpoint
type TradeHandler ¶
TradeHandler is a function that is called when a new trade is received
type TradeRequest ¶
type TradeRequest struct { ForOfferID string ForAccount string ForLiquidityPool string BaseAssetType AssetType BaseAssetCode string BaseAssetIssuer string CounterAssetType AssetType CounterAssetCode string CounterAssetIssuer string TradeType string Order Order Cursor string Limit uint }
TradeRequest struct contains data for getting trade details from a aurora server. "ForAccount", "ForOfferID": Only one of these can be set at a time. If none are provided, the default is to return all trades. All other query parameters are optional. All or none can be set.
func (TradeRequest) BuildURL ¶
func (tr TradeRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the TradeRequest struct. If no data is set, it defaults to the build the URL for all trades
func (TradeRequest) HTTPRequest ¶ added in v1.11.1
func (tr TradeRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the trades endpoint
func (TradeRequest) StreamTrades ¶
func (tr TradeRequest) StreamTrades(ctx context.Context, client *Client, handler TradeHandler) (err error)
StreamTrades streams executed trades. It can be used to stream all trades, trades for an account and trades for an offer. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. TradeHandler is a user-supplied function that is executed for each streamed trade received.
type TransactionHandler ¶
type TransactionHandler func(hProtocol.Transaction)
TransactionHandler is a function that is called when a new transaction is received
type TransactionRequest ¶
type TransactionRequest struct { ForAccount string ForClaimableBalance string ForLedger uint ForLiquidityPool string Order Order Cursor string Limit uint IncludeFailed bool // contains filtered or unexported fields }
TransactionRequest struct contains data for getting transaction details from a aurora server. "ForAccount", "ForClaimableBalance", "ForLedger": Only one of these can be set at a time. If none are provided, the default is to return all transactions. The query parameters (Order, Cursor, Limit and IncludeFailed) are optional. All or none can be set.
func (TransactionRequest) BuildURL ¶
func (tr TransactionRequest) BuildURL() (endpoint string, err error)
BuildURL creates the endpoint to be queried based on the data in the TransactionRequest struct. If no data is set, it defaults to the build the URL for all transactions
func (TransactionRequest) HTTPRequest ¶ added in v1.11.1
func (tr TransactionRequest) HTTPRequest(auroraURL string) (*http.Request, error)
HTTPRequest returns the http request for the transactions endpoint
func (TransactionRequest) StreamTransactions ¶
func (tr TransactionRequest) StreamTransactions(ctx context.Context, client *Client, handler TransactionHandler) (err error)
StreamTransactions streams executed transactions. It can be used to stream all transactions and transactions for an account. Use context.WithCancel to stop streaming or context.Background() if you want to stream indefinitely. TransactionHandler is a user-supplied function that is executed for each streamed transaction received.
type UniversalTimeHandler ¶ added in v1.11.1
type UniversalTimeHandler func() int64
UniversalTimeHandler is a function that is called to return the UTC unix time in seconds. This handler is used when getting the time from a aurora server, which can be used to calculate transaction timebounds.
Source Files ¶
- account_request.go
- accounts_request.go
- admin_client.go
- asset_request.go
- claimable_balance_request.go
- client.go
- effect_request.go
- error.go
- error_helpers.go
- fee_stats_request.go
- internal.go
- ledger_request.go
- liquidity_pool_request.go
- liquidity_pools_request.go
- main.go
- mocks.go
- offer_request.go
- operation_request.go
- order_book_request.go
- paths_request.go
- strict_send_paths_request.go
- submit_request.go
- trade_aggregation_request.go
- trade_request.go
- transaction_request.go
- version.go