package
0.0.0-20230925091837-55f7a6b23beb
Repository: https://github.com/xdbfoundation/go.git
Documentation: pkg.go.dev

# README

frontierclient

frontierclient is a DigitalBits Go SDK package that provides client access to a frontier server. It supports all endpoints exposed by the frontier API.

This project is maintained by the XDB Foundation.

Getting Started

This library is aimed at developers building Go applications that interact with the DigitalBits network. It allows users to query the network and submit transactions to the network. The recommended transaction builder for Go programmers is txnbuild. Together, these two libraries provide a complete DigitalBits SDK.

Prerequisites

  • Go 1.14 or greater
  • Modules to manage dependencies

Installing

  • go get github.com/xdbfoundation/go/clients/frontierclient

Usage

    ...
    import hClient "github.com/xdbfoundation/go/clients/frontierclient"
    ...

    // Use the default pubnet client
    client := hClient.DefaultPublicNetClient

    // Create an account request
    accountRequest := hClient.AccountRequest{AccountID: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU"}

    // Load the account detail from the network
    account, err := client.AccountDetail(accountRequest)
    if err != nil {
        fmt.Println(err)
        return
    }
    // Account contains information about the digitalbits account
    fmt.Print(account)

For more examples, refer to the documentation.

Running the tests

Run the unit tests from the package directory: go test

Contributing

Please read Code of Conduct to understand this project's communication rules.

To submit improvements and fixes to this library, please see CONTRIBUTING.

License

This project is licensed under the Apache License - see the LICENSE file for details.

# Functions

GetError returns an error that can be interpreted as a frontier-specific error.
IsNotFoundError returns true if the error is a frontierclient.Error with a not_found problem indicating that the resource is not found on Frontier.
port - the frontier admin port, zero value defaults to 4200 host - the host interface name that frontier 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.

# Constants

AssetType12 represents an asset type that is 12 characters long.
AssetType4 represents an asset type that is 4 characters long.
AssetTypeNative represents the asset type for DigitalBits Nibbs (XDB).
OrderAsc represents an ascending order parameter.
OrderDesc represents an descending order parameter.

# Variables

DayResolution represents 1 day used as `resolution` parameter in trade aggregation.
DefaultDevNetClient is a default client to connect to dev network (for dev team only).
DefaultPublicNetClient is a default client to connect to public network.
DefaultTestNetClient is a default client to connect to test network.
ErrAccountRequiresMemo is the error returned from a call to checkMemoRequired when any of the destination accounts required a memo in the transaction.
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.
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.
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.
FifteenMinuteResolution represents 15 minutes used as `resolution` parameter in trade aggregation.
FiveMinuteResolution represents 5 minutes used as `resolution` parameter in trade aggregation.
FrontierTimeout is the default number of nanoseconds before a request to frontier times out.
HourResolution represents 1 hour used as `resolution` parameter in trade aggregation.
MinuteResolution represents 1 minute used as `resolution` parameter in trade aggregation.
ServerTimeMap holds the ServerTimeRecord for different frontier instances.
WeekResolution represents 1 week used as `resolution` parameter in trade aggregation.

# Structs

AccountRequest struct contains data for making requests to the show account endpoint of a frontier server.
AccountsRequest struct contains data for making requests to the accounts endpoint of a frontier server.
No description provided by the author
AssetRequest struct contains data for getting asset details from a frontier server.
ClaimableBalanceRequest contains data about claimable balances.
Client struct contains data for creating a frontier client that connects to the digitalbits network.
EffectRequest struct contains data for getting effects from a frontier server.
Error struct contains the problem returned by Frontier.
LedgerRequest struct contains data for getting ledger details from a frontier server.
LiquidityPoolRequest struct contains data for getting liquidity pool details from a frontier server.
LiquidityPoolsRequest struct contains data for getting pool details from a frontier server.
No description provided by the author
MockClient is a mockable frontier client.
OfferRequest struct contains data for getting offers made by an account from a frontier server.
OperationRequest struct contains data for getting operation details from a frontier server.
OrderBookRequest struct contains data for getting the orderbook for an asset pair from a frontier server.
PathsRequest struct contains data for getting available strict receive path payments from a frontier server.
ServerTimeRecord contains data for the current unix time of a frontier server instance, and the local time when it was recorded.
StrictSendPathsRequest struct contains data for getting available strict send path payments from a frontier server.
SubmitTxOpts represents the submit transaction options.
TradeAggregationRequest struct contains data for getting trade aggregations from a frontier server.
TradeRequest struct contains data for getting trade details from a frontier server.
TransactionRequest struct contains data for getting transaction details from a frontier server.

# Interfaces

No description provided by the author
ClientInterface contains methods implemented by the frontier client.
FrontierRequest contains methods implemented by request structs for frontier endpoints.
HTTP represents the HTTP client that a frontier client uses to communicate.

# Type aliases

AssetType represents `asset_type` param in queries.
EffectHandler is a function that is called when a new effect is received.
LedgerHandler is a function that is called when a new ledger is received.
OfferHandler is a function that is called when a new offer is received.
OperationHandler is a function that is called when a new operation is received.
Order represents `order` param in queries.
OrderBookHandler is a function that is called when a new order summary is received.
TradeHandler is a function that is called when a new trade is received.
TransactionHandler is a function that is called when a new transaction is received.
UniversalTimeHandler is a function that is called to return the UTC unix time in seconds.