From f107d14bddc2c19a45ab8d60166c675a27556ed2 Mon Sep 17 00:00:00 2001 From: CJ Cobb Date: Mon, 14 Dec 2020 21:39:44 -0500 Subject: [PATCH] rippled grpc --- CMakeLists.txt | 5 +- proto/message.proto | 5 - proto/message2.proto | 5 - proto/org/xrpl/rpc/v1/README.md | 80 +++ proto/org/xrpl/rpc/v1/account.proto | 14 + proto/org/xrpl/rpc/v1/amount.proto | 48 ++ proto/org/xrpl/rpc/v1/common.proto | 515 ++++++++++++++++++ proto/org/xrpl/rpc/v1/get_account_info.proto | 93 ++++ .../v1/get_account_transaction_history.proto | 75 +++ proto/org/xrpl/rpc/v1/get_fee.proto | 58 ++ proto/org/xrpl/rpc/v1/get_ledger.proto | 78 +++ proto/org/xrpl/rpc/v1/get_ledger_data.proto | 53 ++ proto/org/xrpl/rpc/v1/get_ledger_diff.proto | 32 ++ proto/org/xrpl/rpc/v1/get_ledger_entry.proto | 31 ++ proto/org/xrpl/rpc/v1/get_transaction.proto | 62 +++ proto/org/xrpl/rpc/v1/ledger.proto | 54 ++ proto/org/xrpl/rpc/v1/ledger_objects.proto | 366 +++++++++++++ proto/org/xrpl/rpc/v1/meta.proto | 116 ++++ proto/org/xrpl/rpc/v1/submit.proto | 37 ++ proto/org/xrpl/rpc/v1/transaction.proto | 328 +++++++++++ proto/org/xrpl/rpc/v1/xrp_ledger.proto | 54 ++ 21 files changed, 2097 insertions(+), 12 deletions(-) delete mode 100644 proto/message.proto delete mode 100644 proto/message2.proto create mode 100644 proto/org/xrpl/rpc/v1/README.md create mode 100644 proto/org/xrpl/rpc/v1/account.proto create mode 100644 proto/org/xrpl/rpc/v1/amount.proto create mode 100644 proto/org/xrpl/rpc/v1/common.proto create mode 100644 proto/org/xrpl/rpc/v1/get_account_info.proto create mode 100644 proto/org/xrpl/rpc/v1/get_account_transaction_history.proto create mode 100644 proto/org/xrpl/rpc/v1/get_fee.proto create mode 100644 proto/org/xrpl/rpc/v1/get_ledger.proto create mode 100644 proto/org/xrpl/rpc/v1/get_ledger_data.proto create mode 100644 proto/org/xrpl/rpc/v1/get_ledger_diff.proto create mode 100644 proto/org/xrpl/rpc/v1/get_ledger_entry.proto create mode 100644 proto/org/xrpl/rpc/v1/get_transaction.proto create mode 100644 proto/org/xrpl/rpc/v1/ledger.proto create mode 100644 proto/org/xrpl/rpc/v1/ledger_objects.proto create mode 100644 proto/org/xrpl/rpc/v1/meta.proto create mode 100644 proto/org/xrpl/rpc/v1/submit.proto create mode 100644 proto/org/xrpl/rpc/v1/transaction.proto create mode 100644 proto/org/xrpl/rpc/v1/xrp_ledger.proto diff --git a/CMakeLists.txt b/CMakeLists.txt index e1fdd069..6596346a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ set (GRPC_GEN_DIR "${CMAKE_BINARY_DIR}/proto_gen_grpc") file (MAKE_DIRECTORY ${GRPC_GEN_DIR}) set (GRPC_PROTO_SRCS) set (GRPC_PROTO_HDRS) -set (GRPC_PROTO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/proto") +set (GRPC_PROTO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/proto/org") file(GLOB_RECURSE GRPC_DEFINITION_FILES LIST_DIRECTORIES false "${GRPC_PROTO_ROOT}/*.proto") foreach(file ${GRPC_DEFINITION_FILES}) get_filename_component(_abs_file ${file} ABSOLUTE) @@ -64,7 +64,8 @@ foreach(file ${GRPC_DEFINITION_FILES}) --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}" -I ${_proto_inc} -I ${_rel_dir} ${_abs_file} - DEPENDS ${_abs_file}) + DEPENDS ${_abs_file} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) set_source_files_properties(${src_1} ${src_2} ${hdr_1} ${hdr_2} PROPERTIES GENERATED TRUE) list(APPEND GRPC_PROTO_SRCS ${src_1} ${src_2}) list(APPEND GRPC_PROTO_HDRS ${hdr_1} ${hdr_2}) diff --git a/proto/message.proto b/proto/message.proto deleted file mode 100644 index 9fa18a60..00000000 --- a/proto/message.proto +++ /dev/null @@ -1,5 +0,0 @@ -package message; - -message Message { - repeated int32 id = 1; -} diff --git a/proto/message2.proto b/proto/message2.proto deleted file mode 100644 index 68e94a7d..00000000 --- a/proto/message2.proto +++ /dev/null @@ -1,5 +0,0 @@ -package message; - -message Message2 { - repeated int32 id = 1; -} diff --git a/proto/org/xrpl/rpc/v1/README.md b/proto/org/xrpl/rpc/v1/README.md new file mode 100644 index 00000000..c5000104 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/README.md @@ -0,0 +1,80 @@ +This folder contains the protocol buffer definitions used by the rippled gRPC API. +The gRPC API attempts to mimic the JSON/Websocket API as much as possible. +As of April 2020, the gRPC API supports a subset of the full rippled API: +tx, account_tx, account_info, fee and submit. + +### Making Changes + +#### Wire Format and Backwards Compatibility + +When making changes to the protocol buffer definitions in this folder, care must +be taken to ensure the changes do not break the wire format, which would break +backwards compatibility. At a high level, do not change any existing fields. +This includes the field's name, type and field number. Do not remove any +existing fields. It is always safe to add fields; just remember to give each of +the new fields a unique field number. The field numbers don't have to be in any +particular order and there can be gaps. More info about what changes break the +wire format can be found +[here](https://developers.google.com/protocol-buffers/docs/proto3#updating). + +#### Conventions + +For fields that are reused across different message types, we define the field as a unique +message type in common.proto. The name of the message type is the same as the +field name, with the exception that the field name itself is snake case, whereas +the message type is in Pascal case. The message type has one field, called +`value`. This pattern does not need to be strictly followed across the entire API, +but should be followed for transactions and ledger objects, since there is a high rate +of field reuse across different transactions and ledger objects. +The motivation for this pattern is two-fold. First, we ensure the field has the +same type everywhere that the field is used. Second, wrapping primitive types in +their own message type prevents default initialization of those primitive types. +For example, `uint32` is initialized to `0` if not explicitly set; +there is no way to tell if the client or server set the field to `0` (which may be +a valid value for the field) or the field was default initialized. + +#### Name Collisions + +Each message type must have a unique name. To resolve collisions, add a suffix +to one or more message types. For instance, ledger objects and transaction types +often have the same name (`DepositPreauth` for example). To resolve this, the +`DepositPreauth` ledger object is named `DepositPreauthObject`. + +#### To add a field or message type + +To add a field to a message, define the fields type, name and unique index. +To add a new message type, give the message type a unique name. +Then, add the appropriate C++ code in GRPCHelpers.cpp, or in the handler itself, +to serialize/deserialize the new field or message type. + +#### To add a new gRPC method + +To add a new gRPC method, add the gRPC method in xrp_ledger.proto. The method name +should begin with a verb. Define the request and response types in their own +file. The name of the request type should be the method name suffixed with `Request`, and +the response type name should be the method name suffixed with `Response`. For +example, the `GetAccountInfo` method has request type `GetAccountInfoRequest` and +response type `GetAccountInfoResponse`. + +After defining the protobuf messages for the new method, add an instantiation of the +templated `CallData` class in GRPCServerImpl::setupListeners(). The template +parameters should be the request type and the response type. + +Finally, define the handler itself in the appropriate file under the +src/ripple/rpc/handlers folder. If the method already has a JSON/Websocket +equivalent, write the gRPC handler in the same file, and abstract common logic +into helper functions (see Tx.cpp or AccountTx.cpp for an example). + +#### Testing + +When modifying an existing gRPC method, be sure to test that modification in the +corresponding, existing unit test. When creating a new gRPC method, implement a class that +derives from GRPCTestClientBase, and use the newly created class to call the new +method. See the class `GrpcTxClient` in the file Tx_test.cpp for an example. +The gRPC tests are paired with their JSON counterpart, and the tests should +mirror the JSON test as much as possible. + +Refer to the Protocol Buffers [language +guide](https://developers.google.com/protocol-buffers/docs/proto3) +for more detailed information about Protocol Buffers. + diff --git a/proto/org/xrpl/rpc/v1/account.proto b/proto/org/xrpl/rpc/v1/account.proto new file mode 100644 index 00000000..40e9a7a4 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/account.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +// A representation of an account address +// Next field: 2 +message AccountAddress +{ + // base58 encoding of an account + string address = 1; +} + diff --git a/proto/org/xrpl/rpc/v1/amount.proto b/proto/org/xrpl/rpc/v1/amount.proto new file mode 100644 index 00000000..64ea2f64 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/amount.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/account.proto"; + +// Next field: 3 +message CurrencyAmount +{ + oneof amount + { + XRPDropsAmount xrp_amount = 1; + IssuedCurrencyAmount issued_currency_amount = 2; + } +} + +// A representation of an amount of XRP. +// Next field: 2 +message XRPDropsAmount +{ + uint64 drops = 1 [jstype=JS_STRING]; +} + +// A representation of an amount of issued currency. +// Next field: 4 +message IssuedCurrencyAmount +{ + // The currency used to value the amount. + Currency currency = 1; + + // The value of the amount. 8 bytes + string value = 2; + + // Unique account address of the entity issuing the currency. + AccountAddress issuer = 3; +} + +// Next field: 3 +message Currency +{ + // 3 character ASCII code + string name = 1; + + // 160 bit currency code. 20 bytes + bytes code = 2; +} diff --git a/proto/org/xrpl/rpc/v1/common.proto b/proto/org/xrpl/rpc/v1/common.proto new file mode 100644 index 00000000..5eb4cc8c --- /dev/null +++ b/proto/org/xrpl/rpc/v1/common.proto @@ -0,0 +1,515 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/amount.proto"; +import "org/xrpl/rpc/v1/account.proto"; + +// These fields are used in many different message types. They can be present +// in one or more transactions, as well as metadata of one or more transactions. +// Each is defined as its own message type with a single field "value", to +// ensure the field is the correct type everywhere it's used + + +// *** Messages wrapping uint32 *** + +message CancelAfter +{ + // time in seconds since Ripple epoch + uint32 value = 1; +} + +message ClearFlag +{ + uint32 value = 1; +} + +message CloseTime +{ + // time in seconds since Ripple epoch + uint32 value = 1; +} + +message Date +{ + // time in seconds since Ripple epoch + uint32 value = 1; +} + +message DestinationTag +{ + uint32 value = 1; +} + +message Expiration +{ + // time in seconds since Ripple epoch + uint32 value = 1; +} + +message FinishAfter +{ + // time in seconds since Ripple epoch + uint32 value = 1; +} + +message Flags +{ + uint32 value = 1; +} + +message HighQualityIn +{ + uint32 value = 1; +} + +message HighQualityOut +{ + uint32 value = 1; +} + +message FirstLedgerSequence +{ + uint32 value = 1; +} + +message LastLedgerSequence +{ + uint32 value = 1; +} + +message LowQualityIn +{ + uint32 value = 1; +} + +message LowQualityOut +{ + uint32 value = 1; +} + +message OfferSequence +{ + uint32 value = 1; +} + +message OwnerCount +{ + uint32 value = 1; +} + +message PreviousTransactionLedgerSequence +{ + uint32 value = 1; +} + +message QualityIn +{ + uint32 value = 1; +} + +message QualityOut +{ + uint32 value = 1; +} + +message ReferenceFeeUnits +{ + uint32 value = 1; +} + +message ReserveBase +{ + // in drops + uint32 value = 1; +} + +message ReserveIncrement +{ + // in drops + uint32 value = 1; +} + +message Sequence +{ + uint32 value = 1; +} + +message SetFlag +{ + uint32 value = 1; +} + +message SettleDelay +{ + uint32 value = 1; +} + +message SignerListID +{ + uint32 value = 1; +} + +message SignerQuorum +{ + uint32 value = 1; +} + +message SignerWeight +{ + // is actually uint16 + uint32 value = 1; +} + +message SourceTag +{ + uint32 value = 1; +} + +message TickSize +{ + // is actually uint8 + uint32 value = 1; +} + +message Ticket +{ + uint32 value = 1; +} + +message TicketCount +{ + uint32 value = 1; +} + +message TicketSequence +{ + uint32 value = 1; +} + +message TransferRate +{ + uint32 value = 1; +} + + +// *** Messages wrapping uint64 *** + +message BaseFee +{ + // in drops + uint64 value = 1 [jstype=JS_STRING]; +} + +message BookNode +{ + uint64 value = 1 [jstype=JS_STRING]; +} + +message DestinationNode +{ + uint64 value = 1 [jstype=JS_STRING]; +} + +message HighNode +{ + uint64 value = 1 [jstype=JS_STRING]; +} + +message IndexNext +{ + uint64 value = 1 [jstype=JS_STRING]; +} + +message IndexPrevious +{ + uint64 value = 1 [jstype=JS_STRING]; +} + +message LowNode +{ + uint64 value = 1 [jstype=JS_STRING]; +} + +message OwnerNode +{ + uint64 value = 1 [jstype=JS_STRING]; +} + + +// *** Messages wrapping 16 bytes *** + +message EmailHash +{ + bytes value = 1; +} + + +// *** Messages wrapping 20 bytes *** + +message TakerGetsIssuer +{ + // 20 bytes + bytes value = 1; +} + +message TakerPaysIssuer +{ + // 20 bytes + bytes value = 1; +} + + +// *** Messages wrapping 32 bytes *** + +message AccountTransactionID +{ + // 32 bytes + bytes value = 1; +} + +message BookDirectory +{ + // 32 btes + bytes value = 1; +} + +message Channel +{ + // 32 bytes + bytes value = 1; +} + +message CheckID +{ + // 32 bytes + bytes value = 1; +} + +message Hash +{ + // 32 bytes + bytes value = 1; +} + +message Index +{ + // 32 bytes + bytes value = 1; +} + +message InvoiceID +{ + // 32 bytes + bytes value = 1; +} + +message PreviousTransactionID +{ + // 32 bytes + bytes value = 1; +} + +message RootIndex +{ + // 32 bytes + bytes value = 1; +} + + +// *** Messages wrapping variable length byte arrays *** + +message Condition +{ + bytes value = 1; +} + +message Fulfillment +{ + bytes value = 1; +} + +message MemoData +{ + bytes value = 1; +} + +message MemoFormat +{ + bytes value = 1; +} + +message MemoType +{ + bytes value = 1; +} + +message MessageKey +{ + bytes value = 1; +} + +message PublicKey +{ + bytes value = 1; +} + +message PaymentChannelSignature +{ + bytes value = 1; +} + +message SigningPublicKey +{ + bytes value = 1; +} + +message TransactionSignature +{ + bytes value = 1; +} + +message ValidatorToDisable +{ + bytes value = 1; +} + +message ValidatorToReEnable +{ + bytes value = 1; +} + +// *** Messages wrapping a Currency value *** +// +// TODO: if there's a V2 of the API, fix this misspelling. +message TakerGetsCurreny +{ + Currency value = 1; +} + +message TakerPaysCurrency +{ + Currency value = 1; +} + + +// *** Messages wrapping a CurrencyAmount *** + +message Amount +{ + // Note, CurrencyAmount is a oneof, that can represent an XRP drops amount + // or an Issued Currency amount. However, in some transaction types/ledger + // objects, this value can only be in drops. For instance, the Amount field + // of a Payment transaction can be specified in XRP drops or an Issued + // Currency amount, but the Amount field of a PaymentChannelClaim + // transaction can only be an XRP drops amount. + CurrencyAmount value = 1; +} + +message Balance +{ + CurrencyAmount value = 1; +} + +message DeliverMin +{ + CurrencyAmount value = 1; +} + +message DeliveredAmount +{ + CurrencyAmount value = 1; +} + +message HighLimit +{ + CurrencyAmount value = 1; +} + +message LimitAmount +{ + CurrencyAmount value = 1; +} + +message LowLimit +{ + CurrencyAmount value = 1; +} + +message SendMax +{ + CurrencyAmount value = 1; +} + +message TakerGets +{ + CurrencyAmount value = 1; +} + +message TakerPays +{ + CurrencyAmount value = 1; +} + + +// *** Messages wrapping an AccountAddress *** + +message Account +{ + AccountAddress value = 1; +} + +message Authorize +{ + AccountAddress value = 1; +} + +message Destination +{ + AccountAddress value = 1; +} + +message Owner +{ + AccountAddress value = 1; +} + +message RegularKey +{ + AccountAddress value = 1; +} + +message Unauthorize +{ + AccountAddress value = 1; +} + + +// *** Messages wrapping a string *** + +message Domain +{ + string value = 1; +} + + +// *** Aggregate type messages + +// Next field: 3 +message SignerEntry +{ + Account account = 1; + + SignerWeight signer_weight = 2; +} + +// Next field: 3 +message DisabledValidator +{ + PublicKey public_key = 1; + + FirstLedgerSequence ledger_sequence = 2; +} + diff --git a/proto/org/xrpl/rpc/v1/get_account_info.proto b/proto/org/xrpl/rpc/v1/get_account_info.proto new file mode 100644 index 00000000..bc23a8c6 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/get_account_info.proto @@ -0,0 +1,93 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/ledger_objects.proto"; +import "org/xrpl/rpc/v1/amount.proto"; +import "org/xrpl/rpc/v1/account.proto"; +import "org/xrpl/rpc/v1/ledger.proto"; +import "org/xrpl/rpc/v1/common.proto"; + +// A request to get info about an account. +// Next field: 6 +message GetAccountInfoRequest +{ + // The address to get info about. + AccountAddress account = 1; + + bool strict = 2; + + // Which ledger to use to retrieve data. + // If this field is not set, the server will use the open ledger. + // The open ledger includes data that is not validated or final. + // To retrieve the most up to date and validated data, use + // SHORTCUT_VALIDATED + LedgerSpecifier ledger = 3; + + bool queue = 4; + + bool signer_lists = 5; + + string client_ip = 6; +} + +// Response to GetAccountInfo RPC +// Next field: 6 +message GetAccountInfoResponse +{ + AccountRoot account_data = 1; + + SignerList signer_list = 2; + + uint32 ledger_index = 3; + + QueueData queue_data = 4; + + bool validated = 5; +} + +// Aggregate data about queued transactions +// Next field: 11 +message QueueData +{ + uint32 txn_count = 1; + + bool auth_change_queued = 2; + + uint32 lowest_sequence = 3; + + uint32 highest_sequence = 4; + + XRPDropsAmount max_spend_drops_total = 5; + + repeated QueuedTransaction transactions = 6; + + uint32 lowest_ticket = 7; + + uint32 highest_ticket = 8; + + uint32 sequence_count = 9; + + uint32 ticket_count = 10; +} + +// Data about a single queued transaction +// Next field: 8 +message QueuedTransaction +{ + bool auth_change = 1; + + XRPDropsAmount fee = 2; + + uint64 fee_level = 3 [jstype=JS_STRING]; + + XRPDropsAmount max_spend_drops = 4; + + Sequence sequence = 5; + + LastLedgerSequence last_ledger_sequence = 6; + + Ticket ticket = 7; +} diff --git a/proto/org/xrpl/rpc/v1/get_account_transaction_history.proto b/proto/org/xrpl/rpc/v1/get_account_transaction_history.proto new file mode 100644 index 00000000..c4889a6b --- /dev/null +++ b/proto/org/xrpl/rpc/v1/get_account_transaction_history.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; + +import "org/xrpl/rpc/v1/get_transaction.proto"; +import "org/xrpl/rpc/v1/account.proto"; +import "org/xrpl/rpc/v1/ledger.proto"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +// Next field: 8 +message GetAccountTransactionHistoryRequest +{ + AccountAddress account = 1; + + // What ledger to include results from. Specifying a not yet validated + // ledger results in an error. Not specifying a ledger uses the entire + // range of validated ledgers available to the server. + // Note, this parameter acts as a filter, and can only reduce the number of + // results. Specifying a single ledger will return only transactions from + // that ledger. This includes specifying a ledger with a Shortcut. For + // example, specifying SHORTCUT_VALIDATED will result in only transactions + // that were part of the most recently validated ledger being returned. + // Specifying a range of ledgers results in only transactions that were + // included in a ledger within the specified range being returned. + oneof ledger + { + LedgerSpecifier ledger_specifier = 2; + LedgerRange ledger_range = 3; + }; + + // Return results as binary blobs. Defaults to false. + bool binary = 4; + + // If set to true, returns values indexed by older ledger first. + // Default to false. + bool forward = 5; + + // Limit the number of results. Server may choose a lower limit. + // If this value is 0, the limit is ignored and the number of results + // returned is determined by the server + uint32 limit = 6; + + // Marker to resume where previous request left off + // Used for pagination + Marker marker = 7; +} + + +// Next field: 8 +message GetAccountTransactionHistoryResponse +{ + AccountAddress account = 1; + + uint32 ledger_index_min = 2; + + uint32 ledger_index_max = 3; + + uint32 limit = 4; + + Marker marker = 5; + + repeated GetTransactionResponse transactions = 6; + + bool validated = 7; +} + +// Next field: 3 +message Marker +{ + uint32 ledger_index = 1; + + uint32 account_sequence = 2; +} + diff --git a/proto/org/xrpl/rpc/v1/get_fee.proto b/proto/org/xrpl/rpc/v1/get_fee.proto new file mode 100644 index 00000000..aec3f241 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/get_fee.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/amount.proto"; + +// A request for the current transaction fee on the ledger. +// Next field: 1 +message GetFeeRequest +{ + string client_ip = 1; +} + +// Response to a GetFee RPC +// Next field: 8 +message GetFeeResponse +{ + uint64 current_ledger_size = 1 [jstype=JS_STRING]; + + uint64 current_queue_size = 2 [jstype=JS_STRING]; + + Fee fee = 3; + + uint64 expected_ledger_size = 4 [jstype=JS_STRING]; + + uint32 ledger_current_index = 5; + + FeeLevels levels = 6; + + uint64 max_queue_size = 7 [jstype=JS_STRING]; + +} + +// Next field: 5 +message Fee +{ + XRPDropsAmount base_fee = 1; + + XRPDropsAmount median_fee = 2; + + XRPDropsAmount minimum_fee = 3; + + XRPDropsAmount open_ledger_fee = 4; +} + +// Next field: 5 +message FeeLevels +{ + uint64 median_level = 1 [jstype=JS_STRING]; + + uint64 minimum_level = 2 [jstype=JS_STRING]; + + uint64 open_ledger_level = 3 [jstype=JS_STRING]; + + uint64 reference_level = 4 [jstype=JS_STRING]; +} diff --git a/proto/org/xrpl/rpc/v1/get_ledger.proto b/proto/org/xrpl/rpc/v1/get_ledger.proto new file mode 100644 index 00000000..c3147b1f --- /dev/null +++ b/proto/org/xrpl/rpc/v1/get_ledger.proto @@ -0,0 +1,78 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/ledger.proto"; + +message GetLedgerRequest +{ + + LedgerSpecifier ledger = 1; + + // If true, include transactions contained in this ledger + bool transactions = 2; + + // If true and transactions, include full transactions and metadata + // If false and transactions, include only transaction hashes + bool expand = 3; + + // If true, include state map difference between this ledger and the + // previous ledger. This includes all added, modified or deleted ledger + // objects + bool get_objects = 4; + + // If the request needs to be forwarded from a reporting node to a p2p node, + // the reporting node will set this field. Clients should not set this + // field. + string client_ip = 5; + + // Identifying string. If user is set, client_ip is not set, and request is + // coming from a secure_gateway host, then the client is not subject to + // resource controls + string user = 6; +} + +message GetLedgerResponse +{ + bytes ledger_header = 1; + + oneof transactions + { + // Just the hashes + TransactionHashList hashes_list = 2; + + // Full transactions and metadata + TransactionAndMetadataList transactions_list = 3; + } + + // True if the ledger has been validated + bool validated = 4; + + // State map difference between this ledger and the previous ledger + RawLedgerObjects ledger_objects = 5; + + // True if the skiplist object is included in ledger_objects + bool skiplist_included = 6; + + // True if request was exempt from resource controls + bool is_unlimited = 7; +} + +message TransactionHashList +{ + repeated bytes hashes = 1; +} + +message TransactionAndMetadata +{ + bytes transaction_blob = 1; + + bytes metadata_blob = 2; +} + +message TransactionAndMetadataList +{ + repeated TransactionAndMetadata transactions = 1; +} diff --git a/proto/org/xrpl/rpc/v1/get_ledger_data.proto b/proto/org/xrpl/rpc/v1/get_ledger_data.proto new file mode 100644 index 00000000..c311994a --- /dev/null +++ b/proto/org/xrpl/rpc/v1/get_ledger_data.proto @@ -0,0 +1,53 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/ledger.proto"; + +// Get ledger objects for a specific ledger. You can iterate through several +// calls to retrieve the entire contents of a single ledger version. +message GetLedgerDataRequest +{ + // If set, only objects with a key greater than marker are returned. + // This can be used to pick up where a previous call left off. + // Set marker to the value of marker in the previous response. + bytes marker = 1; + + LedgerSpecifier ledger = 2; + + // If set, only objects with a key less than end_marker are returned + bytes end_marker = 3; + + // If the request needs to be forwarded from a reporting node to a p2p node, + // the reporting node will set this field. Clients should not set this + // field. + string client_ip = 4; + + // Identifying string. If user is set, client_ip is not set, and request is + // coming from a secure_gateway host, then the client is not subject to + // resource controls + string user = 6; +} + +message GetLedgerDataResponse +{ + // Sequence of the ledger containing the returned ledger objects + uint32 ledger_index = 1; + + // Hash of the ledger containing the returned ledger objects + bytes ledger_hash = 2; + + // Ledger objects + RawLedgerObjects ledger_objects = 3; + + // Key to be passed into a subsequent call to continue iteration. If not + // set, there are no more objects left in the ledger, or no more objects + // with key less than end_marker (if end_marker was set in the request) + bytes marker = 4; + + // True if request was exempt from resource controls + bool is_unlimited = 7; +} + diff --git a/proto/org/xrpl/rpc/v1/get_ledger_diff.proto b/proto/org/xrpl/rpc/v1/get_ledger_diff.proto new file mode 100644 index 00000000..218cbeb6 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/get_ledger_diff.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/ledger.proto"; + + +// Get the state map difference between the two specified ledgers +message GetLedgerDiffRequest +{ + LedgerSpecifier base_ledger = 1; + + LedgerSpecifier desired_ledger = 2; + + // If true, include the full ledger object. If false, only keys are included. + bool include_blobs = 3; + + // If the request needs to be forwarded from a reporting node to a p2p node, + // the reporting node will set this field. Clients should not set this + // field. + string client_ip = 4; +} + +message GetLedgerDiffResponse +{ + // All ledger objects that were added, modified or deleted between + // base_ledger and desired_ledger + RawLedgerObjects ledger_objects = 1; +} + diff --git a/proto/org/xrpl/rpc/v1/get_ledger_entry.proto b/proto/org/xrpl/rpc/v1/get_ledger_entry.proto new file mode 100644 index 00000000..a894c772 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/get_ledger_entry.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/ledger.proto"; + +// Get a single ledger object +message GetLedgerEntryRequest +{ + // Key of the desired object + bytes key = 1; + + // Ledger containing the object + LedgerSpecifier ledger = 2; + + // If the request needs to be forwarded from a reporting node to a p2p node, + // the reporting node will set this field. Clients should not set this + // field. + string client_ip = 3; +} + +message GetLedgerEntryResponse +{ + RawLedgerObject ledger_object = 1; + + // Ledger containing the object. Will match the value specified in the + // request. + LedgerSpecifier ledger = 2; +} diff --git a/proto/org/xrpl/rpc/v1/get_transaction.proto b/proto/org/xrpl/rpc/v1/get_transaction.proto new file mode 100644 index 00000000..93ba48a1 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/get_transaction.proto @@ -0,0 +1,62 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/meta.proto"; +import "org/xrpl/rpc/v1/ledger.proto"; +import "org/xrpl/rpc/v1/transaction.proto"; +import "org/xrpl/rpc/v1/common.proto"; + +// Next field: 4 +message GetTransactionRequest { + + // hash of the transaction. 32 bytes + // ATTN: this is in binary, not hex. The JSON API accepts a hex string for + // a transaction hash, but here we need that hex string converted into its + // binary form. Each pair of hex characters should be converted into its + // corresponding byte. For example, the 4 character hex string "00FF" + // should be converted to a 2 byte array: [0, 255] + bytes hash = 1; + + // if true, return data in binary format. defaults to false + bool binary = 2; + + // If the transaction was not found, server will report whether the entire + // specified range was searched. The value is contained in the error message. + // The error message is of the form: + // "txn not found. searched_all = [true,false]" + // If the transaction was found, this parameter is ignored. + LedgerRange ledger_range = 3; + + string client_ip = 4; +} + +// Next field: 9 +message GetTransactionResponse { + + oneof serialized_transaction { + + Transaction transaction = 1; + // Variable length + bytes transaction_binary = 2; + }; + // Sequence number of ledger that contains this transaction + uint32 ledger_index = 3; + + // 32 bytes + bytes hash = 4; + + // whether the ledger has been validated + bool validated = 5; + + // metadata about the transaction + oneof serialized_meta { + Meta meta = 6; + // Variable length + bytes meta_binary = 7; + } + + Date date = 8; +} diff --git a/proto/org/xrpl/rpc/v1/ledger.proto b/proto/org/xrpl/rpc/v1/ledger.proto new file mode 100644 index 00000000..f527ce45 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/ledger.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +// Next field: 4 +message LedgerSpecifier +{ + // Next field: 4 + enum Shortcut + { + SHORTCUT_UNSPECIFIED = 0; + SHORTCUT_VALIDATED = 1; + SHORTCUT_CLOSED = 2; + SHORTCUT_CURRENT = 3; + } + + oneof ledger + { + Shortcut shortcut = 1; + uint32 sequence = 2; + // 32 bytes + bytes hash = 3; + } +} + +// Next field: 3 +message LedgerRange +{ + uint32 ledger_index_min = 1; + + // Note, if ledger_index_min is non-zero and ledger_index_max is 0, the + // software will use the max validated ledger in place of ledger_index_max + uint32 ledger_index_max = 2; +}; + + +// Next field: 3 +message RawLedgerObject +{ + // Raw data of the ledger object. In GetLedgerResponse and + // GetLedgerDiffResponse, data will be empty if the object was deleted. + bytes data = 1; + + // Key of the ledger object + bytes key = 2; +} + +message RawLedgerObjects +{ + repeated RawLedgerObject objects = 1; +} + diff --git a/proto/org/xrpl/rpc/v1/ledger_objects.proto b/proto/org/xrpl/rpc/v1/ledger_objects.proto new file mode 100644 index 00000000..a2666345 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/ledger_objects.proto @@ -0,0 +1,366 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/common.proto"; + +// Next field: 15 +message LedgerObject +{ + oneof object + { + AccountRoot account_root = 1; + Amendments amendments = 2; + Check check = 3; + DepositPreauthObject deposit_preauth = 4; + DirectoryNode directory_node = 5; + Escrow escrow = 6; + FeeSettings fee_settings = 7; + LedgerHashes ledger_hashes = 8; + Offer offer = 9; + PayChannel pay_channel = 10; + RippleState ripple_state = 11; + SignerList signer_list = 12; + NegativeUNL negative_unl = 13; + TicketObject ticket = 14; + } +} + +// Next field: 15 +enum LedgerEntryType +{ + LEDGER_ENTRY_TYPE_UNSPECIFIED = 0; + LEDGER_ENTRY_TYPE_ACCOUNT_ROOT = 1; + LEDGER_ENTRY_TYPE_AMENDMENTS = 2; + LEDGER_ENTRY_TYPE_CHECK = 3; + LEDGER_ENTRY_TYPE_DEPOSIT_PREAUTH = 4; + LEDGER_ENTRY_TYPE_DIRECTORY_NODE = 5; + LEDGER_ENTRY_TYPE_ESCROW = 6; + LEDGER_ENTRY_TYPE_FEE_SETTINGS = 7; + LEDGER_ENTRY_TYPE_LEDGER_HASHES = 8; + LEDGER_ENTRY_TYPE_OFFER = 9; + LEDGER_ENTRY_TYPE_PAY_CHANNEL = 10; + LEDGER_ENTRY_TYPE_RIPPLE_STATE = 11; + LEDGER_ENTRY_TYPE_SIGNER_LIST = 12; + LEDGER_ENTRY_TYPE_NEGATIVE_UNL = 13; + LEDGER_ENTRY_TYPE_TICKET = 14; +} + +// Next field: 16 +message AccountRoot +{ + Account account = 1; + + Balance balance = 2; + + Sequence sequence = 3; + + Flags flags = 4; + + OwnerCount owner_count = 5; + + PreviousTransactionID previous_transaction_id = 6; + + PreviousTransactionLedgerSequence previous_transaction_ledger_sequence = 7; + + AccountTransactionID account_transaction_id = 8; + + Domain domain = 9; + + EmailHash email_hash = 10; + + MessageKey message_key = 11; + + RegularKey regular_key = 12; + + TickSize tick_size = 13; + + TransferRate transfer_rate = 14; + + TicketCount ticket_count = 15; +} + +// Next field: 4 +message Amendments +{ + // Next field: 2 + message Amendment + { + // 32 bytes + bytes value = 1; + } + + // Next field: 3 + message Majority + { + Amendment amendment = 1; + + CloseTime close_time = 2; + } + + repeated Amendment amendments = 1; + + repeated Majority majorities = 2; + + Flags flags = 3; +} + +// Next field: 14 +message Check +{ + Account account = 1; + + Destination destination = 2; + + Flags flags = 3; + + OwnerNode owner_node = 4; + + PreviousTransactionID previous_transaction_id = 5; + + PreviousTransactionLedgerSequence previous_transaction_ledger_sequence = 6; + + SendMax send_max = 7; + + Sequence sequence = 8; + + DestinationNode destination_node = 9; + + DestinationTag destination_tag = 10; + + Expiration expiration = 11; + + InvoiceID invoice_id = 12; + + SourceTag source_tag = 13; +} + +// Next field: 7 +message DepositPreauthObject +{ + Account account = 1; + + Authorize authorize = 2; + + Flags flags = 3; + + OwnerNode owner_node = 4; + + PreviousTransactionID previous_transaction_id = 5; + + PreviousTransactionLedgerSequence previous_transaction_ledger_sequence = 6; +} + +// Next field: 11 +message DirectoryNode +{ + Flags flags = 1; + + RootIndex root_index = 2; + + repeated Index indexes = 3; + + IndexNext index_next = 4; + + IndexPrevious index_previous = 5; + + Owner owner = 6; + + TakerPaysCurrency taker_pays_currency = 7; + + TakerPaysIssuer taker_pays_issuer = 8; + + TakerGetsCurreny taker_gets_currency = 9; + + TakerGetsIssuer taker_gets_issuer = 10; +} + +// Next field: 14 +message Escrow +{ + Account account = 1; + + Destination destination = 2; + + Amount amount = 3; + + Condition condition = 4; + + CancelAfter cancel_after = 5; + + FinishAfter finish_after = 6; + + Flags flags = 7; + + SourceTag source_tag = 8; + + DestinationTag destination_tag = 9; + + OwnerNode owner_node = 10; + + DestinationNode destination_node = 11; + + PreviousTransactionID previous_transaction_id = 12; + + PreviousTransactionLedgerSequence previous_transaction_ledger_sequence = 13; +} + +// Next field: 6 +message FeeSettings +{ + BaseFee base_fee = 1; + + ReferenceFeeUnits reference_fee_units = 2; + + ReserveBase reserve_base = 3; + + ReserveIncrement reserve_increment = 4; + + Flags flags = 5; +} + +// Next field: 4 +message LedgerHashes +{ + LastLedgerSequence last_ledger_sequence = 1; + + repeated Hash hashes = 2; + + Flags flags = 3; +} + +// Next field: 12 +message Offer +{ + Account account = 1; + + Sequence sequence = 2; + + Flags flags = 3; + + TakerPays taker_pays = 4; + + TakerGets taker_gets = 5; + + BookDirectory book_directory = 6; + + BookNode book_node = 7; + + OwnerNode owner_node = 8; + + Expiration expiration = 9; + + PreviousTransactionID previous_transaction_id = 10; + + PreviousTransactionLedgerSequence previous_transaction_ledger_sequence = 11; +} + +// Next field: 13 +message PayChannel +{ + Account account = 1; + + Destination destination = 2; + + Amount amount = 3; + + Balance balance = 4; + + PublicKey public_key = 5; + + SettleDelay settle_delay = 6; + + OwnerNode owner_node = 7; + + PreviousTransactionID previous_transaction_id = 8; + + PreviousTransactionLedgerSequence previous_transaction_ledger_sequence = 9; + + Flags flags = 10; + + Expiration expiration = 11; + + CancelAfter cancel_after = 12; + + SourceTag source_tag = 13; + + DestinationTag destination_tag = 14; + + DestinationNode destination_node = 15; +} + +// Next field: 13 +message RippleState +{ + Balance balance = 1; + + Flags flags = 2; + + LowLimit low_limit = 3; + + HighLimit high_limit = 4; + + LowNode low_node = 5; + + HighNode high_node = 6; + + LowQualityIn low_quality_in = 7; + + LowQualityOut low_quality_out = 8; + + HighQualityIn high_quality_in = 9; + + HighQualityOut high_quality_out = 10; + + PreviousTransactionID previous_transaction_id = 11; + + PreviousTransactionLedgerSequence previous_transaction_ledger_sequence = 12; +} + +// Next field: 8 +message SignerList +{ + Flags flags = 1; + + PreviousTransactionID previous_transaction_id = 2; + + PreviousTransactionLedgerSequence previous_transaction_ledger_sequence = 3; + + OwnerNode owner_node = 4; + + repeated SignerEntry signer_entries = 5; + + SignerListID signer_list_id = 6; + + SignerQuorum signer_quorum = 7; +} + +// Next field: 7 +message TicketObject +{ + Flags flags = 1; + + Account account = 2; + + OwnerNode owner_node = 3; + + PreviousTransactionID previous_transaction_id = 4; + + PreviousTransactionLedgerSequence previous_transaction_ledger_sequence = 5; + + TicketSequence ticket_sequence = 6; +} + +// Next field: 5 +message NegativeUNL +{ + repeated DisabledValidator disabled_validators = 1; + + ValidatorToDisable validator_to_disable = 2; + + ValidatorToReEnable validator_to_re_enable = 3; + + Flags flags = 4; +} diff --git a/proto/org/xrpl/rpc/v1/meta.proto b/proto/org/xrpl/rpc/v1/meta.proto new file mode 100644 index 00000000..35660b3d --- /dev/null +++ b/proto/org/xrpl/rpc/v1/meta.proto @@ -0,0 +1,116 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/ledger_objects.proto"; +import "org/xrpl/rpc/v1/common.proto"; + +message SubmitMetadataRequest +{ + + repeated AffectedNode affected_nodes = 1; + uint32 ledger_sequence = 2; +} + +message SubmitMetadataResponse +{ + bool success = 1; + + string msg = 2; +} + +message PrepareLedgerRequest +{ + uint32 ledger_index = 1; +} + +message PrepareLedgerResponse +{ + bool success = 1; + + string msg = 2; +} + +// Next field: 5 +message Meta +{ + // index in ledger + uint64 transaction_index = 1 [jstype=JS_STRING]; + + // result code indicating whether the transaction succeeded or failed + TransactionResult transaction_result = 2; + + repeated AffectedNode affected_nodes = 3; + + DeliveredAmount delivered_amount = 4; +} + +// Next field: 3 +message TransactionResult +{ + // Next field: 7 + enum ResultType + { + RESULT_TYPE_UNSPECIFIED = 0; + // Claimed cost only + RESULT_TYPE_TEC = 1; + // Failure + RESULT_TYPE_TEF = 2; + // Local error + RESULT_TYPE_TEL = 3; + // Malformed transaction + RESULT_TYPE_TEM = 4; + // Retry + RESULT_TYPE_TER = 5; + // Success + RESULT_TYPE_TES = 6; + } + + // category of the transaction result + ResultType result_type = 1; + + // full result string, i.e. tesSUCCESS + string result = 2; +} + +// Next field: 6 +message AffectedNode +{ + LedgerEntryType ledger_entry_type = 1; + + // 32 bytes + bytes ledger_index = 2; + + oneof node + { + CreatedNode created_node = 3; + DeletedNode deleted_node = 4; + ModifiedNode modified_node = 5; + } +} + +// Next field: 2 +message CreatedNode +{ + LedgerObject new_fields = 1; +} + +// Next field: 2 +message DeletedNode +{ + LedgerObject final_fields = 1; +} + +// Next field: 5 +message ModifiedNode { + + LedgerObject final_fields = 1; + + LedgerObject previous_fields = 2; + + PreviousTransactionID previous_transaction_id = 3; + + PreviousTransactionLedgerSequence previous_transaction_ledger_sequence = 4; +} diff --git a/proto/org/xrpl/rpc/v1/submit.proto b/proto/org/xrpl/rpc/v1/submit.proto new file mode 100644 index 00000000..f8b0a827 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/submit.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/meta.proto"; + +// A request to submit the signed transaction to the ledger. +// Next field: 3 +message SubmitTransactionRequest +{ + // The signed transaction to submit. + bytes signed_transaction = 1; + + bool fail_hard = 2; + + string client_ip = 3; +} + +// A response when a signed transaction is submitted to the ledger. +// Next field: 5 +message SubmitTransactionResponse +{ + // Code indicating the preliminary result of the transaction. + TransactionResult engine_result = 1; + + // Numeric code indicating the preliminary result of the transaction, + // directly correlated to engine_result. + int64 engine_result_code = 2; + + // Human-readable explanation of the transaction's preliminary result. + string engine_result_message = 3; + + // 32 bytes + bytes hash = 4; +} diff --git a/proto/org/xrpl/rpc/v1/transaction.proto b/proto/org/xrpl/rpc/v1/transaction.proto new file mode 100644 index 00000000..081f22e9 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/transaction.proto @@ -0,0 +1,328 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/common.proto"; +import "org/xrpl/rpc/v1/amount.proto"; +import "org/xrpl/rpc/v1/account.proto"; + +// A message encompassing all transaction types +// Next field: 32 +message Transaction +{ + Account account = 1; + + XRPDropsAmount fee = 2; + + Sequence sequence = 3; + + // Data specific to the type of transaction + oneof transaction_data + { + Payment payment = 4; + + AccountSet account_set = 13; + + AccountDelete account_delete = 14; + + CheckCancel check_cancel = 15; + + CheckCash check_cash = 16; + + CheckCreate check_create = 17; + + DepositPreauth deposit_preauth = 18; + + EscrowCancel escrow_cancel = 19; + + EscrowCreate escrow_create = 20; + + EscrowFinish escrow_finish = 21; + + OfferCancel offer_cancel = 22; + + OfferCreate offer_create = 23; + + PaymentChannelClaim payment_channel_claim = 24; + + PaymentChannelCreate payment_channel_create= 25; + + PaymentChannelFund payment_channel_fund = 26; + + SetRegularKey set_regular_key = 27; + + SignerListSet signer_list_set = 28; + + TicketCreate ticket_create = 30; + + TrustSet trust_set = 29; + } + + SigningPublicKey signing_public_key = 5; + + TransactionSignature transaction_signature = 6; + + Flags flags = 7; + + LastLedgerSequence last_ledger_sequence = 8; + + SourceTag source_tag = 9; + + repeated Memo memos = 10; + + repeated Signer signers = 11; + + AccountTransactionID account_transaction_id = 12; + + TicketSequence ticket_sequence = 31; +} + +// Next field: 4 +message Memo +{ + MemoData memo_data = 1; + + MemoFormat memo_format = 2; + + MemoType memo_type = 3; +} + +// Next field: 4 +message Signer +{ + Account account = 1; + + TransactionSignature transaction_signature = 2; + + SigningPublicKey signing_public_key = 3; +} + +// Next field: 8 +message AccountSet +{ + ClearFlag clear_flag = 1; + + Domain domain = 2; + + EmailHash email_hash = 3; + + MessageKey message_key = 4; + + SetFlag set_flag = 5; + + TransferRate transfer_rate = 6; + + TickSize tick_size = 7; +} + +// Next field: 3 +message AccountDelete +{ + Destination destination = 1; + + DestinationTag destination_tag = 2; +} + +// Next field: 2 +message CheckCancel +{ + CheckID check_id = 1; +} + +// Next field: 4 +message CheckCash +{ + CheckID check_id = 1; + + oneof amount_oneof + { + Amount amount = 2; + + DeliverMin deliver_min = 3; + } +} + +// Next field: 6 +message CheckCreate +{ + Destination destination = 1; + + SendMax send_max = 2; + + DestinationTag destination_tag = 3; + + Expiration expiration = 4; + + InvoiceID invoice_id = 5; +} + +// Next field: 3 +message DepositPreauth +{ + oneof authorization_oneof + { + Authorize authorize = 1; + + Unauthorize unauthorize = 2; + } +} + +// Next field: 3 +message EscrowCancel +{ + Owner owner = 1; + + OfferSequence offer_sequence = 2; +} + +// Next field: 7 +message EscrowCreate +{ + Amount amount = 1; + + Destination destination = 2; + + CancelAfter cancel_after = 3; + + FinishAfter finish_after = 4; + + Condition condition = 5; + + DestinationTag destination_tag = 6; +} + +// Next field: 5 +message EscrowFinish +{ + Owner owner = 1; + + OfferSequence offer_sequence = 2; + + Condition condition = 3; + + Fulfillment fulfillment = 4; +} + +// Next field: 2 +message OfferCancel +{ + OfferSequence offer_sequence = 1; +} + +// Next field: 5 +message OfferCreate +{ + Expiration expiration = 1; + + OfferSequence offer_sequence = 2; + + TakerGets taker_gets = 3; + + TakerPays taker_pays = 4; +} + +// Next field: 8 +message Payment +{ + // Next field: 4 + message PathElement + { + AccountAddress account = 1; + + Currency currency = 2; + + AccountAddress issuer = 3; + } + + // Next field: 2 + message Path + { + repeated PathElement elements = 1; + } + + Amount amount = 1; + + Destination destination = 2; + + DestinationTag destination_tag = 3; + + InvoiceID invoice_id = 4; + + repeated Path paths = 5; + + SendMax send_max = 6; + + DeliverMin deliver_min = 7; +} + +// Next field: 6 +message PaymentChannelClaim +{ + Channel channel = 1; + + Balance balance = 2; + + Amount amount = 3; + + PaymentChannelSignature payment_channel_signature = 4; + + PublicKey public_key = 5; +} + +// Next field: 7 +message PaymentChannelCreate +{ + Amount amount = 1; + + Destination destination = 2; + + SettleDelay settle_delay = 3; + + PublicKey public_key = 4; + + CancelAfter cancel_after = 5; + + DestinationTag destination_tag = 6; +} + +// Next field: 4 +message PaymentChannelFund +{ + Channel channel = 1; + + Amount amount = 2; + + Expiration expiration = 3; +} + +// Next field: 2 +message SetRegularKey +{ + RegularKey regular_key = 1; +} + +// Next field: 3 +message SignerListSet +{ + SignerQuorum signer_quorum = 1; + + repeated SignerEntry signer_entries = 2; +} + +// Next field: 2 +message TicketCreate +{ + TicketCount count = 1; +} + +// Next field: 4 +message TrustSet +{ + LimitAmount limit_amount = 1; + + QualityIn quality_in = 2; + + QualityOut quality_out = 3; +} diff --git a/proto/org/xrpl/rpc/v1/xrp_ledger.proto b/proto/org/xrpl/rpc/v1/xrp_ledger.proto new file mode 100644 index 00000000..6f48d486 --- /dev/null +++ b/proto/org/xrpl/rpc/v1/xrp_ledger.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; + +package org.xrpl.rpc.v1; +option java_package = "org.xrpl.rpc.v1"; +option java_multiple_files = true; + +import "org/xrpl/rpc/v1/get_account_info.proto"; +import "org/xrpl/rpc/v1/get_fee.proto"; +import "org/xrpl/rpc/v1/submit.proto"; +import "org/xrpl/rpc/v1/get_transaction.proto"; +import "org/xrpl/rpc/v1/get_account_transaction_history.proto"; +import "org/xrpl/rpc/v1/get_ledger.proto"; +import "org/xrpl/rpc/v1/get_ledger_entry.proto"; +import "org/xrpl/rpc/v1/get_ledger_data.proto"; +import "org/xrpl/rpc/v1/get_ledger_diff.proto"; + + +// RPCs available to interact with the XRP Ledger. +// The gRPC API mimics the JSON API. Refer to xrpl.org for documentation +service XRPLedgerAPIService { + + // Get account info for an account on the XRP Ledger. + rpc GetAccountInfo (GetAccountInfoRequest) returns (GetAccountInfoResponse); + + // Get the fee for a transaction on the XRP Ledger. + rpc GetFee (GetFeeRequest) returns (GetFeeResponse); + + // Submit a signed transaction to the XRP Ledger. + rpc SubmitTransaction (SubmitTransactionRequest) returns (SubmitTransactionResponse); + + // Get the status of a transaction + rpc GetTransaction(GetTransactionRequest) returns (GetTransactionResponse); + + // Get all validated transactions associated with a given account + rpc GetAccountTransactionHistory(GetAccountTransactionHistoryRequest) returns (GetAccountTransactionHistoryResponse); + + ///////////////////////////////////////////////////////////////////////////// + // The below methods do not mimic the JSON API exactly, and are mostly binary + + // Get a specific ledger, optionally including transactions and any modified, + // added or deleted ledger objects + rpc GetLedger(GetLedgerRequest) returns (GetLedgerResponse); + + // Get a specific ledger object from a specific ledger + rpc GetLedgerEntry(GetLedgerEntryRequest) returns (GetLedgerEntryResponse); + + // Iterate through all ledger objects in a specific ledger + rpc GetLedgerData(GetLedgerDataRequest) returns (GetLedgerDataResponse); + + // Get all ledger objects that are different between the two specified + // ledgers. Note, this method has no JSON equivalent. + rpc GetLedgerDiff(GetLedgerDiffRequest) returns (GetLedgerDiffResponse); + +}