rpc

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncorrectID                           = errors.New("incorrect id")
	ErrMissingTxSignatureOrSigningPubKey     = errors.New("transaction must have a TxSignature or SigningPubKey set")
	ErrSignerDataIsEmpty                     = errors.New("signer data is empty")
	ErrCannotFundWalletWithoutClassicAddress = errors.New("cannot fund wallet without classic address")
)

Static errors

View Source
var ErrEmptyURL = errors.New("empty port and IP provided")

Functions

This section is empty.

Types

type APIVersionRequest added in v0.1.3

type APIVersionRequest interface {
	APIVersion() int
	SetAPIVersion(apiVersion int)
}

type APIWarning

type APIWarning struct {
	ID      int         `json:"id"`
	Message string      `json:"message"`
	Details interface{} `json:"details,omitempty"`
}

type Client

type Client struct {
	NetworkID uint32
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg *Config) *Client

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) 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

func (c *Client) FundWallet(wallet *wallet.Wallet) 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) 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) GetLedger

func (c *Client) GetLedger(req *ledger.Request) (*ledger.Response, error)

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

func (c *Client) GetXrpBalance(address types.Address) (string, error)

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) 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(reqParams XRPLRequest) (XRPLResponse, error)

Request sends a request to the XRPL server and returns the response and any error encountered.

func (*Client) Submit

func (c *Client) Submit(txBlob string, failHard bool) (*requests.SubmitResponse, error)

func (*Client) SubmitAndWait

func (c *Client) SubmitAndWait(txBlob string, failHard bool) (*requests.TxResponse, error)

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)

type ClientError

type ClientError struct {
	ErrorString string
}

func (*ClientError) Error

func (e *ClientError) Error() string

type Config

type Config struct {
	HTTPClient HTTPClient
	URL        string
	Headers    map[string][]string
	// contains filtered or unexported fields
}

func NewClientConfig

func NewClientConfig(url string, opts ...ConfigOpt) (*Config, error)

type ConfigOpt

type ConfigOpt func(c *Config)

func WithFaucetProvider

func WithFaucetProvider(fp common.FaucetProvider) ConfigOpt

func WithFeeCushion

func WithFeeCushion(feeCushion float32) ConfigOpt

func WithHTTPClient

func WithHTTPClient(cl HTTPClient) ConfigOpt

func WithMaxFeeXRP

func WithMaxFeeXRP(maxFeeXRP float32) ConfigOpt

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Request

type Request struct {
	Method string         `json:"method"`
	Params [1]interface{} `json:"params,omitempty"`
}

type Response

type Response struct {
	Result    AnyJSON               `json:"result"`
	Warning   string                `json:"warning,omitempty"`
	Warnings  []XRPLResponseWarning `json:"warnings,omitempty"`
	Forwarded bool                  `json:"forwarded,omitempty"`
}

func (Response) GetResult

func (r Response) GetResult(v any) error

type XRPLRequest

type XRPLRequest interface {
	APIVersionRequest
	Method() string
	Validate() error
}

type XRPLResponse

type XRPLResponse interface {
	GetResult(v any) error
}

type XRPLResponseWarning

type XRPLResponseWarning struct {
	ID      int    `json:"id"`
	Message string `json:"message"`
	Details any    `json:"details,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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