gorippled

package module
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: MIT Imports: 8 Imported by: 3

README

Go Rippled

Build Status Go Report Card Docs License

This package is designed to providerippled server utilities including:

  1. API Method and Category information
  2. API example request and response JSON objects (data folder)
  3. Simple JSON RPC request handling

API Method and Category Information

Method and Category information is provided programmatically.

See:

Example Requests and Responses

Request and response samples are provided in the data folder and available programmatically.

Test Client

A test API client is provided that executes the requests on XRPL.org.

Display example request:

$ cd cmd/rippledapiexample
$ go run main.go --method account_info

Display example request and response:

$ cd cmd/rippledapiexample
$ go run main.go --method account_info --exec

Models

Documentation

Index

Constants

View Source
const (
	CategoryAccount                  = "account"
	CategoryLedger                   = "ledger"
	CategoryTransaction              = "transaction"
	CategoryPathAndOrderBook         = "path_and_order_book"
	CategoryPaymentChannel           = "payment_channel"
	CategorySubscription             = "subscription"
	CategoryServerInfo               = "server_info"
	CategoryUtility                  = "utility"
	CategoryKeyGeneration            = "key_generation"
	CategoryLoggingAndDataManagement = "logging_and_data_management"
	CategoryServerControl            = "server_control"
	CategoryPeerManagement           = "peer_management"
	CategoryStatusAndDebugging       = "status_and_debugging"

	TypePublic = "public"
	TypeAdmin  = "admin"
)
View Source
const (
	MethodAccountChannels   = "account_channels"
	MethodAccountCurrencies = "account_currencies"
	MethodAccountInfo       = "account_info"
	MethodAccountLines      = "account_lines"
	MethodAccountObjects    = "account_objects"
	MethodAccountOffers     = "account_offers"
	MethodAccountTx         = "account_tx"
	MethodGatewayBalances   = "gateway_balances"
	MethodNorippleCheck     = "noripple_check"
	MethodLedger            = "ledger"
	MethodLedgerClosed      = "ledger_closed"
	MethodLedgerCurrent     = "ledger_current"
	MethodLedgerData        = "ledger_data"
	MethodLedgerEntry       = "ledger_entry"
	MethodSign              = "sign"
	MethodSignFor           = "sign_for"
	MethodSubmit            = "submit"
	MethodSubmitMultisigned = "submit_multisigned"
	MethodTransactionEntry  = "transaction_entry"
	MethodTx                = "tx"
	MethodTxHistory         = "tx_history"
	MethodBookOffers        = "book_offers"
	MethodDepositAuthorized = "deposit_authorized"
	MethodPathFind          = "path_find"
	MethodRipplePathFind    = "ripple_path_find"
	MethodChannelAuthorize  = "channel_authorize"
	MethodChannelVerify     = "channel_verify"
	MethodSubscribe         = "subscribe"
	MethodUnsubscribe       = "unsubscribe"
	MethodFee               = "fee"
	MethodManifest          = "manifest"
	MethodServerInfo        = "server_info"
	MethodServerState       = "server_state"
	MethodJSON              = "json"
	MethodPing              = "ping"
	MethodRandom            = "random"

	MethodValidationCreate     = "validation_create"
	MethodWalletPropose        = "wallet_propose"
	MethodCanDelete            = "can_delete"
	MethodCrawlShards          = "crawl_shards"
	MethodDownloadShard        = "download_shard"
	MethodLedgerCleaner        = "ledger_cleaner"
	MethodLedgerRequest        = "ledger_request"
	MethodLogLevel             = "log_level"
	MethodLogrotate            = "logrotate"
	MethodLedgerAccept         = "ledger_accept"
	MethodStop                 = "stop"
	MethodValidationSeed       = "validation_seed"
	MethodConnect              = "connect"
	MethodPeerReservationsAdd  = "peer_reservations_add"
	MethodPeerReservationsDel  = "peer_reservations_del"
	MethodPeerReservationsList = "peer_reservations_list"
	MethodPeers                = "peers"
	MethodConsensusInfo        = "consensus_info"
	MethodFeature              = "feature"
	MethodFetchInfo            = "fetch_info"
	MethodGetCounts            = "get_counts"
	MethodPrint                = "print"
	MethodValidatorInfo        = "validator_info"
	MethodValidatorListSites   = "validator_list_sites"
	MethodValidators           = "validators"
)
View Source
const (
	StatusError   = "error"
	StatusSuccess = "success"
)
View Source
const JsonRpcUrlDefault = "https://xrpl.ws/"

Variables

This section is empty.

Functions

func DoApiJsonRpc

func DoApiJsonRpc(jrpcURL string, reqBody interface{}) (*http.Response, error)

DoApiJsonRpc sends a JSON RPC API request to the specified `rippled` server using an API method and request params.

func DoApiJsonRpcSplit

func DoApiJsonRpcSplit(jrpcURL, rippledMethod string, paramsBodyBytes []byte) (*http.Response, error)

DoApiJsonRpcSplit sends a JSON RPC API request to the specified `rippled` server using an API method and request params.

func MethodToCategory added in v0.2.3

func MethodToCategory(methodName string) (string, error)

func MethodsPlus

func MethodsPlus() []string

func MethodsPlusToAccount

func MethodsPlusToAccount() map[string]string

func TransferFeeDecimal added in v0.4.1

func TransferFeeDecimal(transferRate int64) float64

TransferFeeDecimal calculates a transfer fee using the transfer rate from the Account Root object.

Types

type AccountCurrenciesResponse added in v0.8.0

type AccountCurrenciesResponse struct {
	Result AccountCurrenciesResult `json:"result"`
}

type AccountCurrenciesResult added in v0.8.0

type AccountCurrenciesResult struct {
	LedgerHash        string   `json:"ledger_hash"`
	LedgerIndex       int64    `json:"ledger_index"`
	ReceiveCurrencies []string `json:"receive_currencies"`
	SendCurrencies    []string `json:"send_currencies"`
	Status            string   `json:"status"`
	Validated         bool     `json:"validated"`
}

type AccountInfoResponse added in v0.6.0

type AccountInfoResponse struct {
	Result AccountInfoResult `json:"result"`
}

type AccountInfoResult added in v0.6.0

type AccountInfoResult struct {
	AccountData        AccountRoot `json:"account_data"`
	LedgerCurrentIndex int64       `json:"ledger_current_index"`
	Status             string      `json:"status"`
	Validated          bool        `json:"validated"`
}

type AccountRoot added in v0.6.0

type AccountRoot struct {
	Account           string
	AccountTxnID      string `json:"AccountTxnID,omitempty"`
	Balance           string
	Domain            string `json:"Domain,omitempty"`
	EmailHash         string `json:"EmailHash,omitempty"`
	Flags             uint32
	LedgerEntryType   string
	MessageKey        string `json:"MessageKey,omitempty"`
	OwnerCount        uint32
	PreviousTxnID     string
	PreviousTxnLgrSeq uint32
	RegularKey        string `json:"RegularKey,omitempty"`
	Sequence          uint32
	TicketCount       uint32 `json:"TicketCount,omitempty"`
	TickSize          uint8  `json:"TickSize,omitempty"`
	TransferRate      uint32 `json:"TransferRate,omitempty"`
	WalletLocator     string `json:"WalletLocator,omitempty"`
	WalletSize        uint32 `json:"WalletSize,omitempty"`
	Index             string `json:"index"`
	Urlgravatar       string `json:"urlgravatar"`
}

type Category

type Category struct {
	Name        string
	DisplayName string
	Type        string
	Description string
	IsReadOnly  bool
}

func AdminCategories added in v0.4.0

func AdminCategories() []Category

func Categories

func Categories() []Category

func GetCategory

func GetCategory(categoryName string) (Category, error)

func PublicCategories added in v0.4.0

func PublicCategories() []Category

func (*Category) APIReferenceURL added in v0.2.4

func (cat *Category) APIReferenceURL() string

type JsonRpcRequest

type JsonRpcRequest struct {
	Method string                   `json:"method"`
	Params []map[string]interface{} `json:"params"`
}

func AccountCurrenciesRequestSimple added in v0.8.0

func AccountCurrenciesRequestSimple(account string) JsonRpcRequest

func AccountInfoRequestSimple added in v0.8.0

func AccountInfoRequestSimple(account string) JsonRpcRequest

func BuildJsonRpcRequestBody

func BuildJsonRpcRequestBody(rippledMethod string, paramsBodyBytes []byte) (JsonRpcRequest, error)

BuildJsonRpcRequestBody merges a `rippled` API methid with JSON RPC API request params.

type JsonRpcResponseError

type JsonRpcResponseError struct {
	Result JsonRpcResponseErrorResult `json:"result"`
}

type JsonRpcResponseErrorResult

type JsonRpcResponseErrorResult struct {
	Error  string `json:"error"`
	Status string `json:"status"`
}

type Method

type Method struct {
	Name              string
	ExampleName       string
	ExampleSlug       string
	Category          Category
	Type              string
	Summary           string
	Description       string
	FunctionType      string
	IsOneOf           bool
	IsDeprecated      bool
	HasApiCli         bool
	HasApiJsonRpc     bool
	HasApiWebsocket   bool
	VersionIntroduced string
}

func AccountMethods added in v0.2.1

func AccountMethods() []Method

func GetCategoryMethods added in v0.2.1

func GetCategoryMethods(categoryName string) ([]Method, error)

func KeyGenerationMethods added in v0.8.1

func KeyGenerationMethods() []Method

func LedgerMethods added in v0.2.1

func LedgerMethods() []Method

func Methods

func Methods() []Method

func PathAndOrderBookMethods added in v0.2.1

func PathAndOrderBookMethods() []Method

func PaymentChannelMethods added in v0.2.1

func PaymentChannelMethods() []Method

func ServerInfoMethods added in v0.2.1

func ServerInfoMethods() []Method

func StatusAndDebuggingMethods added in v0.4.0

func StatusAndDebuggingMethods() []Method

func SubscriptionMethods added in v0.2.1

func SubscriptionMethods() []Method

func TransactionMethods added in v0.2.1

func TransactionMethods() []Method

func UtilityMethods added in v0.2.1

func UtilityMethods() []Method

func (*Method) APIReferenceURL

func (m *Method) APIReferenceURL() string

type MethodsSet added in v0.2.0

type MethodsSet struct {
	// contains filtered or unexported fields
}

func NewMethodsSet added in v0.2.0

func NewMethodsSet() MethodsSet

func (*MethodsSet) GetMethod added in v0.2.0

func (set *MethodsSet) GetMethod(methodName string) (Method, error)

Directories

Path Synopsis
cmd
Code generated for package data by go-bindata DO NOT EDIT.
Code generated for package data by go-bindata DO NOT EDIT.

Jump to

Keyboard shortcuts

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