Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Autofill(tx *transaction.FlatTransaction) error
- func (c *Client) AutofillMultisigned(tx *transaction.FlatTransaction, nSigners uint64) error
- func (c *Client) Conn() *websocket.Conn
- func (c *Client) Connect() error
- func (c *Client) Disconnect()
- func (c *Client) FindPathClose(req *path.FindCloseRequest) (*path.FindResponse, error)
- func (c *Client) FindPathCreate(req *path.FindCreateRequest) (*path.FindResponse, error)
- func (c *Client) FindPathStatus(req *path.FindStatusRequest) (*path.FindResponse, error)
- func (c *Client) FundWallet(wallet *wallet.Wallet) error
- func (c *Client) GetAccountChannels(req *account.ChannelsRequest) (*account.ChannelsResponse, error)
- func (c *Client) GetAccountCurrencies(req *account.CurrenciesRequest) (*account.CurrenciesResponse, error)
- func (c *Client) GetAccountInfo(req *account.InfoRequest) (*account.InfoResponse, error)
- func (c *Client) GetAccountLines(req *account.LinesRequest) (*account.LinesResponse, error)
- func (c *Client) GetAccountNFTs(req *account.NFTsRequest) (*account.NFTsResponse, error)
- func (c *Client) GetAccountObjects(req *account.ObjectsRequest) (*account.ObjectsResponse, error)
- func (c *Client) GetAccountOffers(req *account.OffersRequest) (*account.OffersResponse, error)
- func (c *Client) GetAccountTransactions(req *account.TransactionsRequest) (*account.TransactionsResponse, error)
- func (c *Client) GetAggregatePrice(req *oracle.GetAggregatePriceRequest) (*oracle.GetAggregatePriceResponse, error)
- func (c *Client) GetAllFeatures(req *server.FeatureAllRequest) (*server.FeatureAllResponse, error)
- func (c *Client) GetBookOffers(req *path.BookOffersRequest) (*path.BookOffersResponse, error)
- func (c *Client) GetChannelVerify(req *channel.VerifyRequest) (*channel.VerifyResponse, error)
- func (c *Client) GetClosedLedger() (*ledger.ClosedResponse, error)
- func (c *Client) GetCurrentLedger() (*ledger.CurrentResponse, error)
- func (c *Client) GetDepositAuthorized(req *path.DepositAuthorizedRequest) (*path.DepositAuthorizedResponse, error)
- func (c *Client) GetFeature(req *server.FeatureOneRequest) (*server.FeatureResponse, error)
- func (c *Client) GetFee(req *server.FeeRequest) (*server.FeeResponse, error)
- func (c *Client) GetGatewayBalances(req *account.GatewayBalancesRequest) (*account.GatewayBalancesResponse, error)
- func (c *Client) GetLedger(req *ledger.Request) (*ledger.Response, error)
- func (c *Client) GetLedgerData(req *ledger.DataRequest) (*ledger.DataResponse, error)
- func (c *Client) GetLedgerIndex() (common.LedgerIndex, error)
- func (c *Client) GetManifest(req *server.ManifestRequest) (*server.ManifestResponse, error)
- func (c *Client) GetNFTBuyOffers(req *nft.NFTokenBuyOffersRequest) (*nft.NFTokenBuyOffersResponse, error)
- func (c *Client) GetNFTSellOffers(req *nft.NFTokenSellOffersRequest) (*nft.NFTokenSellOffersResponse, error)
- func (c *Client) GetRandom(req *utility.RandomRequest) (*utility.RandomResponse, error)
- func (c *Client) GetRipplePathFind(req *path.RipplePathFindRequest) (*path.RipplePathFindResponse, error)
- func (c *Client) GetServerInfo(req *server.InfoRequest) (*server.InfoResponse, error)
- func (c *Client) GetServerState(req *server.StateRequest) (*server.StateResponse, error)
- func (c *Client) GetXrpBalance(address types.Address) (string, error)
- func (c *Client) IsConnected() bool
- func (c *Client) Ping(req *utility.PingRequest) (*utility.PingResponse, error)
- func (c *Client) Request(req interfaces.Request) (*ClientResponse, error)
- func (c *Client) Submit(txBlob string, failHard bool) (*requests.SubmitResponse, error)
- func (c *Client) SubmitAndWait(txBlob string, failHard bool) (*requests.TxResponse, error)
- func (c *Client) SubmitMultisigned(txBlob string, failHard bool) (*requests.SubmitMultisignedResponse, error)
- type ClientConfig
- func (wc ClientConfig) WithFaucetProvider(fp common.FaucetProvider) ClientConfig
- func (wc ClientConfig) WithFeeCushion(feeCushion float32) ClientConfig
- func (wc ClientConfig) WithHost(host string) ClientConfig
- func (wc ClientConfig) WithMaxFeeXRP(maxFeeXrp float32) ClientConfig
- func (wc ClientConfig) WithMaxRetries(maxRetries int) ClientConfig
- func (wc ClientConfig) WithRetryDelay(retryDelay time.Duration) ClientConfig
- type ClientResponse
- type ErrorWebsocketClientXrplResponse
- type ResponseWarning
Constants ¶
const ( DefaultFeeCushion float32 = 1.2 DefaultMaxFeeXRP float32 = 2 )
Variables ¶
var ( ErrIncorrectID = errors.New("incorrect id") ErrNotConnectedToServer = errors.New("not connected to server") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { NetworkID uint32 // contains filtered or unexported fields }
func NewClient ¶
func NewClient(cfg ClientConfig) *Client
Creates a new websocket client with cfg. This client will open and close a websocket connection for each request.
func (*Client) Autofill ¶
func (c *Client) Autofill(tx *transaction.FlatTransaction) error
Autofill fills in the missing fields in a transaction.
func (*Client) AutofillMultisigned ¶
func (c *Client) AutofillMultisigned(tx *transaction.FlatTransaction, nSigners uint64) error
AutofillMultisigned fills in the missing fields in a multisigned transaction. This function is used to fill in the missing fields in a multisigned transaction. It fills in the missing fields in the transaction and calculates the fee per number of signers.
func (*Client) Disconnect ¶
func (c *Client) Disconnect()
Disconnect closes the websocket connection.
func (*Client) FindPathClose ¶
func (c *Client) FindPathClose(req *path.FindCloseRequest) (*path.FindResponse, error)
FindPathClose closes an existing path finding request. It takes a FindCloseRequest as input and returns a FindResponse, along with any error encountered.
func (*Client) FindPathCreate ¶
func (c *Client) FindPathCreate(req *path.FindCreateRequest) (*path.FindResponse, error)
FindPathCreate creates a path finding request that will be monitored until it expires or is closed. It takes a FindCreateRequest as input and returns a FindResponse, along with any error encountered.
func (*Client) FindPathStatus ¶
func (c *Client) FindPathStatus(req *path.FindStatusRequest) (*path.FindResponse, error)
FindPathStatus checks the status of an existing path finding request. It takes a FindStatusRequest as input and returns a FindResponse, along with any error encountered.
func (*Client) FundWallet ¶
FundWallet funds a wallet with XRP from the faucet. If the wallet does not have a classic address, it will return an error.
func (*Client) GetAccountChannels ¶
func (c *Client) GetAccountChannels(req *account.ChannelsRequest) (*account.ChannelsResponse, error)
GetAccountChannels retrieves a list of payment channels associated with an account. It takes an AccountChannelsRequest as input and returns an AccountChannelsResponse, along with any error encountered.
func (*Client) GetAccountCurrencies ¶
func (c *Client) GetAccountCurrencies(req *account.CurrenciesRequest) (*account.CurrenciesResponse, error)
GetAccountCurrencies retrieves a list of currencies that an account can send or receive. It takes an AccountCurrenciesRequest as input and returns an AccountCurrenciesResponse, along with any error encountered.
func (*Client) GetAccountInfo ¶
func (c *Client) GetAccountInfo(req *account.InfoRequest) (*account.InfoResponse, error)
GetAccountInfo retrieves information about an account on the XRP Ledger. It takes an AccountInfoRequest as input and returns an AccountInfoResponse, along with the raw XRPL response and any error encountered.
func (*Client) GetAccountLines ¶
func (c *Client) GetAccountLines(req *account.LinesRequest) (*account.LinesResponse, error)
GetAccountLines retrieves the lines associated with an account on the XRP Ledger. It takes an AccountLinesRequest as input and returns an AccountLinesResponse, along with any error encountered.
func (*Client) GetAccountNFTs ¶
func (c *Client) GetAccountNFTs(req *account.NFTsRequest) (*account.NFTsResponse, error)
GetAccountNFTs retrieves a list of NFTs owned by an account on the XRP Ledger. It takes an AccountNFTsRequest as input and returns an AccountNFTsResponse, along with any error encountered.
func (*Client) GetAccountObjects ¶
func (c *Client) GetAccountObjects(req *account.ObjectsRequest) (*account.ObjectsResponse, error)
GetAccountObjects retrieves a list of objects owned by an account on the XRP Ledger. It takes an AccountObjectsRequest as input and returns an AccountObjectsResponse, along with any error encountered.
func (*Client) GetAccountOffers ¶
func (c *Client) GetAccountOffers(req *account.OffersRequest) (*account.OffersResponse, error)
GetAccountOffers retrieves a list of offers made by an account that are currently active in the XRP Ledger's decentralized exchange. It takes an AccountOffersRequest as input and returns an AccountOffersResponse, along with any error encountered.
func (*Client) GetAccountTransactions ¶
func (c *Client) GetAccountTransactions(req *account.TransactionsRequest) (*account.TransactionsResponse, error)
GetAccountTransactions retrieves a list of transactions that involved a specific account. It takes an AccountTransactionsRequest as input and returns an AccountTransactionsResponse, along with any error encountered.
func (*Client) GetAggregatePrice ¶ added in v0.1.4
func (c *Client) GetAggregatePrice(req *oracle.GetAggregatePriceRequest) (*oracle.GetAggregatePriceResponse, error)
GetAggregatePrice retrieves the aggregate price of an asset. It takes a GetAggregatePriceRequest as input and returns a GetAggregatePriceResponse, along with any error encountered.
func (*Client) GetAllFeatures ¶
func (c *Client) GetAllFeatures(req *server.FeatureAllRequest) (*server.FeatureAllResponse, error)
GetAllFeatures retrieves information about all features supported by the server. It takes a FeatureAllRequest as input and returns a FeatureAllResponse, along with any error encountered.
func (*Client) GetBookOffers ¶
func (c *Client) GetBookOffers(req *path.BookOffersRequest) (*path.BookOffersResponse, error)
GetBookOffers retrieves a list of offers between two currencies. It takes a BookOffersRequest as input and returns a BookOffersResponse, along with any error encountered.
func (*Client) GetChannelVerify ¶
func (c *Client) GetChannelVerify(req *channel.VerifyRequest) (*channel.VerifyResponse, error)
GetChannelVerify verifies the signature of a payment channel claim. It takes a ChannelVerifyRequest as input and returns a ChannelVerifyResponse, along with any error encountered.
func (*Client) GetClosedLedger ¶
func (c *Client) GetClosedLedger() (*ledger.ClosedResponse, error)
GetClosedLedger retrieves information about the last closed ledger. It returns a ClosedResponse containing the ledger information and any error encountered.
func (*Client) GetCurrentLedger ¶
func (c *Client) GetCurrentLedger() (*ledger.CurrentResponse, error)
GetCurrentLedger retrieves information about the current working ledger. It returns a CurrentResponse containing the ledger information and any error encountered.
func (*Client) GetDepositAuthorized ¶
func (c *Client) GetDepositAuthorized(req *path.DepositAuthorizedRequest) (*path.DepositAuthorizedResponse, error)
GetDepositAuthorized checks whether one account is authorized to send payments directly to another. It takes a DepositAuthorizedRequest as input and returns a DepositAuthorizedResponse, along with any error encountered.
func (*Client) GetFeature ¶
func (c *Client) GetFeature(req *server.FeatureOneRequest) (*server.FeatureResponse, error)
GetFeature retrieves information about a specific feature supported by the server. It takes a FeatureOneRequest as input and returns a FeatureResponse, along with any error encountered.
func (*Client) GetFee ¶
func (c *Client) GetFee(req *server.FeeRequest) (*server.FeeResponse, error)
GetFee retrieves the current transaction fee settings from the server. It takes a FeeRequest as input and returns a FeeResponse, along with any error encountered.
func (*Client) GetGatewayBalances ¶ added in v0.1.4
func (c *Client) GetGatewayBalances(req *account.GatewayBalancesRequest) (*account.GatewayBalancesResponse, error)
GetGatewayBalances retrieves the gateway balances for an account. It takes a GatewayBalancesRequest as input and returns a GatewayBalancesResponse, along with any error encountered.
func (*Client) GetLedger ¶
GetLedger retrieves information about a specific ledger version. It takes a Request as input and returns a Response containing the ledger information, along with any error encountered.
func (*Client) GetLedgerData ¶
func (c *Client) GetLedgerData(req *ledger.DataRequest) (*ledger.DataResponse, error)
GetLedgerData retrieves contents of a ledger. It takes a DataRequest as input and returns a DataResponse containing the ledger data, along with any error encountered.
func (*Client) GetLedgerIndex ¶
func (c *Client) GetLedgerIndex() (common.LedgerIndex, error)
GetLedgerIndex returns the index of the most recently validated ledger. It returns the ledger index as a LedgerIndex type and any error encountered.
func (*Client) GetManifest ¶
func (c *Client) GetManifest(req *server.ManifestRequest) (*server.ManifestResponse, error)
GetManifest retrieves public information about a known validator. It takes a ManifestRequest as input and returns a ManifestResponse, along with any error encountered.
func (*Client) GetNFTBuyOffers ¶
func (c *Client) GetNFTBuyOffers(req *nft.NFTokenBuyOffersRequest) (*nft.NFTokenBuyOffersResponse, error)
GetNFTBuyOffers retrieves all buy offers for a specific NFT. It takes an NFTokenBuyOffersRequest as input and returns an NFTokenBuyOffersResponse, along with any error encountered.
func (*Client) GetNFTSellOffers ¶
func (c *Client) GetNFTSellOffers(req *nft.NFTokenSellOffersRequest) (*nft.NFTokenSellOffersResponse, error)
GetNFTSellOffers retrieves all sell offers for a specific NFT. It takes an NFTokenSellOffersRequest as input and returns an NFTokenSellOffersResponse, along with any error encountered.
func (*Client) GetRandom ¶
func (c *Client) GetRandom(req *utility.RandomRequest) (*utility.RandomResponse, error)
GetRandom provides a random number from the server. It takes a RandomRequest as input and returns a RandomResponse, along with any error encountered.
func (*Client) GetRipplePathFind ¶
func (c *Client) GetRipplePathFind(req *path.RipplePathFindRequest) (*path.RipplePathFindResponse, error)
GetRipplePathFind finds paths for a payment between two accounts. It takes a RipplePathFindRequest as input and returns a RipplePathFindResponse, along with any error encountered.
func (*Client) GetServerInfo ¶
func (c *Client) GetServerInfo(req *server.InfoRequest) (*server.InfoResponse, error)
GetServerInfo retrieves information about the server. It takes a ServerInfoRequest as input and returns a ServerInfoResponse, along with any error encountered.
func (*Client) GetServerState ¶
func (c *Client) GetServerState(req *server.StateRequest) (*server.StateResponse, error)
GetServerState retrieves information about the current state of the server. It takes a StateRequest as input and returns a StateResponse, along with any error encountered.
func (*Client) GetXrpBalance ¶
GetXrpBalance retrieves the XRP balance of a given account address. It returns the balance as a string in XRP (not drops) and any error encountered.
func (*Client) IsConnected ¶
IsConnected returns true if the client is connected to the server.
func (*Client) Ping ¶
func (c *Client) Ping(req *utility.PingRequest) (*utility.PingResponse, error)
Ping tests the connection to the server. It takes a PingRequest as input and returns a PingResponse, along with any error encountered.
func (*Client) Request ¶
func (c *Client) Request(req interfaces.Request) (*ClientResponse, error)
Request sends a request to the server and returns the response. This function is used to send requests to the server. It returns the response from the server.
func (*Client) Submit ¶
Submit sends a transaction to the server and returns the response. This function is used to send transactions to the server. It returns the response from the server.
func (*Client) SubmitAndWait ¶
SubmitAndWait sends a transaction to the server and waits for it to be included in a ledger. This function is used to send transactions to the server and wait for them to be included in a ledger. It returns the transaction response from the server.
func (*Client) SubmitMultisigned ¶
func (c *Client) SubmitMultisigned(txBlob string, failHard bool) (*requests.SubmitMultisignedResponse, error)
SubmitMultisigned sends a multisigned transaction to the server and returns the response. This function is used to send multisigned transactions to the server. It returns the response from the server.
type ClientConfig ¶
type ClientConfig struct {
// contains filtered or unexported fields
}
func NewClientConfig ¶
func NewClientConfig() *ClientConfig
func (ClientConfig) WithFaucetProvider ¶
func (wc ClientConfig) WithFaucetProvider(fp common.FaucetProvider) ClientConfig
WithFaucetProvider sets the faucet provider of the websocket client. Default: faucet.NewLocalFaucetProvider()
func (ClientConfig) WithFeeCushion ¶
func (wc ClientConfig) WithFeeCushion(feeCushion float32) ClientConfig
WithFeeCushion sets the fee cushion of the websocket client. Default: 1.2
func (ClientConfig) WithHost ¶
func (wc ClientConfig) WithHost(host string) ClientConfig
WithHost sets the host of the websocket client. Default: "localhost"
func (ClientConfig) WithMaxFeeXRP ¶
func (wc ClientConfig) WithMaxFeeXRP(maxFeeXrp float32) ClientConfig
WithMaxFeeXRP sets the maximum fee in XRP that the websocket client will use. Default: 2
func (ClientConfig) WithMaxRetries ¶
func (wc ClientConfig) WithMaxRetries(maxRetries int) ClientConfig
WithMaxRetries sets the maximum number of retries for a transaction. Default: 10
func (ClientConfig) WithRetryDelay ¶
func (wc ClientConfig) WithRetryDelay(retryDelay time.Duration) ClientConfig
WithRetryDelay sets the delay between retries for a transaction. Default: 1 second
type ClientResponse ¶
type ClientResponse struct { ID int `json:"id"` Status string `json:"status"` Type string `json:"type"` Error string `json:"error,omitempty"` Result map[string]any `json:"result,omitempty"` Value map[string]any `json:"value,omitempty"` Warning string `json:"warning,omitempty"` Warnings []ResponseWarning `json:"warnings,omitempty"` Forwarded bool `json:"forwarded,omitempty"` }
func (*ClientResponse) CheckError ¶
func (r *ClientResponse) CheckError() error
func (*ClientResponse) GetResult ¶
func (r *ClientResponse) GetResult(v any) error
type ErrorWebsocketClientXrplResponse ¶
func (*ErrorWebsocketClientXrplResponse) Error ¶
func (e *ErrorWebsocketClientXrplResponse) Error() string