diff --git a/docs/docs/intro.md b/docs/docs/intro.md index 0fa730f6..0edb41a3 100644 --- a/docs/docs/intro.md +++ b/docs/docs/intro.md @@ -4,7 +4,7 @@ sidebar_position: 1 # Getting Started -This documentation englobes the `xrpl-go` project, a Go SDK for interacting with the XRP Ledger. +This documentation covers the `xrpl-go` project, a Go SDK for interacting with the XRP Ledger. ## What is the XRP Ledger? diff --git a/docs/docs/keypairs.md b/docs/docs/keypairs.md index f5810361..d81b1f22 100644 --- a/docs/docs/keypairs.md +++ b/docs/docs/keypairs.md @@ -1,10 +1,11 @@ --- sidebar_position: 5 +pagination_next: xrpl/currency --- # keypairs -## Introduction +## Introduction The keypairs package provides a set of functions for generating and managing cryptographic keypairs. It includes functionality for creating new keypairs, deriving public keys from private keys, and verifying signatures. @@ -27,9 +28,9 @@ Cryptographic algorithms supported by this package are: - ed25519 - secp256k1 - Every function in the package that requires a cryptographic algorithm will accept any type that satisfies the `KeypairCryptoAlg` interface. So, if desired, you can implement your own algorithm and use it in this package. +Every function in the package that requires a cryptographic algorithm will accept any type that satisfies the `KeypairCryptoAlg` interface. So, if desired, you can implement your own algorithm and use it in this package. - However, the library already exports both algorithm getters that satisfy the `KeypairCryptoAlg` and `NodeDerivationCryptoAlg` interfaces. They're available under the package `github.com/Peersyst/xrpl-go/pkg/crypto`, which exports both algorithm getters that satisfy the `KeypairCryptoAlg`, `NodeDerivationCryptoAlg` interfaces. +However, the library already exports both algorithm getters that satisfy the `KeypairCryptoAlg` and `NodeDerivationCryptoAlg` interfaces. They're available under the package `github.com/Peersyst/xrpl-go/pkg/crypto`, which exports both algorithm getters that satisfy the `KeypairCryptoAlg`, `NodeDerivationCryptoAlg` interfaces. ### crypto package @@ -73,7 +74,7 @@ They can be split into two groups: func GenerateSeed(entropy string, alg interfaces.KeypairCryptoAlg, r interfaces.Randomizer) (string, error) ``` -Generate a seed that can be used to generate keypairs. You can specify the entropy of the seed or let the function generate a random one (by passing an empty string as entropy and providing a randomizer) and use one of the supported algorithms to generate the seed. The result is a base58-encoded seed, which starts with the character `s`. +Generate a seed that can be used to generate keypairs. You can specify the entropy of the seed or let the function generate a random one (by passing an empty string as entropy and providing a randomizer) and use one of the supported algorithms to generate the seed. The result is a base58-encoded seed, which starts with the character `s`. :::info @@ -89,7 +90,6 @@ func DeriveKeypair(seed string, validator bool) (private, public string, err err Derives a keypair (private and public keys) from a seed. If the `validator` parameter is `true`, the keypair will be a validator keypair; otherwise, it will be a user keypair. The result for both the private and public keys is a 33-byte hexadecimal string. - #### DeriveClassicAddress ```go @@ -165,7 +165,6 @@ func main() { } ``` - ### How to generate a new keypair from entropy This example generates a new keypair using the `ED25519` algorithm and a provided entropy. Then, it derives the keypair and the address as the previous example. @@ -199,4 +198,4 @@ func main() { fmt.Println("Public Key: ", pubK) fmt.Println("Address: ", addr) } -``` \ No newline at end of file +``` diff --git a/docs/docs/xrpl/currency.md b/docs/docs/xrpl/currency.md index 6e0c5887..d27e814c 100644 --- a/docs/docs/xrpl/currency.md +++ b/docs/docs/xrpl/currency.md @@ -1,3 +1,7 @@ +--- +pagination_prev: keypairs +--- + # currency ## Overview @@ -32,4 +36,5 @@ func DropsToXrp(value string) (string, error) // Non-standard currency codes conversions func ConvertStringToHex(input string) string -func ConvertHexToString(input string) (string, error) \ No newline at end of file +func ConvertHexToString(input string) (string, error) +``` diff --git a/docs/docs/xrpl/hash.md b/docs/docs/xrpl/hash.md index b330c2ab..1d84dfe0 100644 --- a/docs/docs/xrpl/hash.md +++ b/docs/docs/xrpl/hash.md @@ -2,7 +2,11 @@ ## Overview -The `hash` package contains functions and types related to the XRPL hash types. Currently, it only contains the function `SignTxBlob` that hashes a signed transaction blob, which is mainly used for multisigning. +The `hash` package contains functions for hashing XRPL transactions. + +- `SignTxBlob`: Hashes a signed transaction blob. It accepts a signed transaction blob as input and returns the transaction's hash. This is mainly used for verifying transaction integrity, including multisigned transactions. + +- `SignTx`: Hashes a signed transaction provided as a decoded map object. Primarily used internally for batch transactions within the wallet. ## Usage @@ -14,6 +18,18 @@ import "github.com/Peersyst/xrpl-go/xrpl/hash" ## API +### SignTxBlob + +```go +func SignTxBlob(txBlob string) ([]byte, error) +``` + +Hashes a signed transaction blob and returns the transaction hash or an error if the blob is invalid. + +### SignTx + ```go -func SignTxBlob(blob []byte, secret string) ([]byte, error) -``` \ No newline at end of file +func SignTx(tx map[string]interface{}) (string, error) +``` + +Hashes a signed transaction provided as a decoded map and returns the transaction hash or an error if the transaction object is invalid. diff --git a/docs/docs/xrpl/ledger-entry-types.md b/docs/docs/xrpl/ledger-entry-types.md index d95d41b2..909e7eca 100644 --- a/docs/docs/xrpl/ledger-entry-types.md +++ b/docs/docs/xrpl/ledger-entry-types.md @@ -7,6 +7,8 @@ The `ledger-entry-types` package contains types and functions to handle ledger o - [`AccountRoot`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/accountroot) - [`Amendments`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/amendments) - [`AMM`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/amm) +- [`Credential`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/credential) +- `Delegate` - [`Bridge`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/bridge) - [`Check`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/check) - [`DepositPreauth`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/depositpreauth) @@ -21,6 +23,7 @@ The `ledger-entry-types` package contains types and functions to handle ledger o - [`Offer`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/offer) - [`Oracle`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/oracle) - [`PayChannel`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/paychannel) +- [`PermissionedDomain`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/permissioneddomain) - [`RippleState`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/ripplestate) - [`SignerList`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/signerlist) - [`Ticket`](https://xrpl.org/docs/references/protocol/ledger-data/ledger-entry-types/ticket) @@ -33,4 +36,4 @@ To import the package, you can use the following code: ```go import "github.com/Peersyst/xrpl-go/xrpl/ledger-entry-types" -``` \ No newline at end of file +``` diff --git a/docs/docs/xrpl/queries.md b/docs/docs/xrpl/queries.md index 67d099bf..578984f4 100644 --- a/docs/docs/xrpl/queries.md +++ b/docs/docs/xrpl/queries.md @@ -6,7 +6,7 @@ The `queries` package contains mainly request and response types for the [XRPL m :::info -As a developer, you may be interested in calling the queries using the [`websocket`](/docs/xrpl/websocket) or [`rpc`](/docs/xrpl/rpc) clients. Both clients expose methods to call each query exposed by the `queries` package. +As a developer, you may be interested in calling the queries using the [`websocket`](/docs/xrpl/websocket) or [`rpc`](/docs/xrpl/rpc) clients. Both clients expose methods to call each query exposed by the `queries` package. ::: @@ -23,12 +23,12 @@ Queries are grouped by different categories or packages: - `server`: Methods to retrieve information about the current state of the [`rippled`](https://github.com/XRPLF/rippled) server. - `utility`: Perform convenient tasks, such as ping and random number generation. - ### API version By default, all queries are meant to be used with the latest XRPL API version (currently `v2`). If you want to use a specific version, you will need to import the specific version queries package from each subpackage. For example, if you want to use the XRPL API version `v1` queries of the `account` subpackage, you will need to import it this way: + ```go import accountv1 "github.com/Peersyst/xrpl-go/xrpl/queries/account/v1" ``` @@ -48,18 +48,18 @@ The available methods correspond to the [Account Methods](https://xrpl.org/docs/ The account subpackage provides the following queries requests: -| Request | Method name | V1 support | -|---------|------------|------------| -| `ChannelRequest` | [account_channels](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_channels) | ✅ | -| `CurrenciesRequest` | [account_currencies](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_currencies) | ✅ | -| `GatewayBalancesRequest` | [gateway_balances](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/gateway_balances) | ✅ | -| `InfoRequest` | [account_info](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_info) | ✅ | -| `LinesRequest` | [account_lines](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_lines) | ✅ | -| `NFTsRequest` | [account_nfts](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_nfts) | ✅ | -| `NoRippleCheckRequest` | [noripple_check](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/noripple_check) | ✅ | -| `ObjectsRequest` | [account_objects](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_objects) | ✅ | -| `OffersRequest` | [account_offers](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_offers) | ✅ | -| `TransactionsRequest` | [account_tx](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_tx) | ✅ | +| Request | Method name | V1 support | V2 support | +| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------- | +| `ChannelRequest` | [account_channels](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_channels) | ✅ | ✅ | +| `CurrenciesRequest` | [account_currencies](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_currencies) | ✅ | ✅ | +| `GatewayBalancesRequest` | [gateway_balances](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/gateway_balances) | ❌ | ✅ | +| `InfoRequest` | [account_info](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_info) | ✅ | ✅ | +| `LinesRequest` | [account_lines](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_lines) | ✅ | ✅ | +| `NFTsRequest` | [account_nfts](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_nfts) | ✅ | ✅ | +| `NoRippleCheckRequest` | [noripple_check](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/noripple_check) | ✅ | ✅ | +| `ObjectsRequest` | [account_objects](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_objects) | ✅ | ✅ | +| `OffersRequest` | [account_offers](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_offers) | ✅ | ✅ | +| `TransactionsRequest` | [account_tx](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_tx) | ✅ | ✅ | #### Usage @@ -69,8 +69,6 @@ To use the `account` package, you need to import it in your project: import "github.com/Peersyst/xrpl-go/xrpl/queries/account" ``` - - ### channel The `channel` package contains methods to interact with XRPL channels. These methods allow you to: @@ -81,9 +79,9 @@ The available methods correspond to the [Payment Channel Methods](https://xrpl.o The `channel` subpackage provides the following queries requests: -| Request | Method name | V1 support | -|---------|------------|------------| -| `VerifyRequest` | [channel_verify](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/payment-channel-methods/channel_verify) | ✅ | +| Request | Method name | V1 support | V2 support | +| --------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------- | +| `VerifyRequest` | [channel_verify](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/payment-channel-methods/channel_verify) | ✅ | ✅ | #### Usage @@ -93,7 +91,6 @@ To use the `channel` package, you need to import it in your project: import "github.com/Peersyst/xrpl-go/xrpl/queries/channel" ``` - ### ledger The `ledger` package contains methods to interact with XRPL ledgers. These methods allow you to: @@ -104,12 +101,12 @@ The available methods correspond to the [Ledger Methods](https://xrpl.org/docs/r The `ledger` subpackage provides the following queries requests: -| Request | Method name | V1 support | -|---------|------------|------------| -| `Request` | [ledger](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/ledger-methods/ledger) | ✅ | -| `ClosedRequest` | [ledger_closed](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/ledger-methods/ledger_closed) | ✅ | -| `CurrentRequest` | [ledger_current](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/ledger-methods/ledger_current) | ✅ | -| `DataRequest` | [ledger_data](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/ledger-methods/ledger_data) | ✅ | +| Request | Method name | V1 support | V2 support | +| ---------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------- | ---------- | +| `Request` | [ledger](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/ledger-methods/ledger) | ✅ | ✅ | +| `ClosedRequest` | [ledger_closed](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/ledger-methods/ledger_closed) | ✅ | ✅ | +| `CurrentRequest` | [ledger_current](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/ledger-methods/ledger_current) | ✅ | ✅ | +| `DataRequest` | [ledger_data](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/ledger-methods/ledger_data) | ✅ | ✅ | #### Usage @@ -119,7 +116,6 @@ To use the `ledger` package, you need to import it in your project: import "github.com/Peersyst/xrpl-go/xrpl/queries/ledger" ``` - ### transaction The `transaction` package contains methods to interact with XRPL transactions. These methods allow you to: @@ -131,12 +127,12 @@ The available methods correspond to the [Transaction Methods](https://xrpl.org/d The `transaction` subpackage provides the following queries requests: -| Request | Method name | V1 support | -|---------|------------|------------| -| `SubmitRequest` | [submit](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/transaction-methods/submit) | ✅ | -| `SubmitMultisignedRequest` | [submit_multisigned](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/transaction-methods/submit_multisigned) | ✅ | -| `EntryRequest` | [transaction_entry](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/transaction-methods/transaction_entry) | ✅ | -| `TxRequest` | [tx](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/transaction-methods/tx) | ✅ | +| Request | Method name | V1 support | V1 support | +| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ---------- | ---------- | +| `SubmitRequest` | [submit](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/transaction-methods/submit) | ✅ | ✅ | +| `SubmitMultisignedRequest` | [submit_multisigned](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/transaction-methods/submit_multisigned) | ✅ | ✅ | +| `EntryRequest` | [transaction_entry](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/transaction-methods/transaction_entry) | ✅ | ✅ | +| `TxRequest` | [tx](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/transaction-methods/tx) | ✅ | ✅ | #### Usage @@ -157,26 +153,25 @@ The available methods correspond to the [Path and Order Book Methods](https://xr The `path` subpackage provides the following queries requests: -| Request | Method name | V1 support | -|---------|------------|------------| -| `BookOffersRequest` | [book_offers](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/path-and-order-book-methods/book_offers) | ✅ | -| `DepositAuthorizedRequest` | [deposit_authorized](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/path-and-order-book-methods/deposit_authorized) | ✅ | -| `FindCreateRequest`, `FindCloseRequest`, `FindStatusRequest` | [path_find](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/path-and-order-book-methods/path_find) | ✅ | -| `RipplePathFindRequest` | [ripple_path_find](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/path-and-order-book-methods/ripple_path_find) | ✅ | - +| Request | Method name | V1 support | V2 support | +| ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------- | +| `BookOffersRequest` | [book_offers](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/path-and-order-book-methods/book_offers) | ✅ | ✅ | +| `DepositAuthorizedRequest` | [deposit_authorized](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/path-and-order-book-methods/deposit_authorized) | ✅ | ✅ | +| `FindCreateRequest`, `FindCloseRequest`, `FindStatusRequest` | [path_find](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/path-and-order-book-methods/path_find) | ✅ | ✅ | +| `RipplePathFindRequest` | [ripple_path_find](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/path-and-order-book-methods/ripple_path_find) | ✅ | ✅ | The `nft` subpackage provides the following queries requests: -| Request | Method name | V1 support | -|---------|------------|------------| -| `NFTokenBuyOffersRequest` | [nft_buy_offers](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/path-and-order-book-methods/nft_buy_offers) | ✅ | -| `NFTokenSellOffersRequest` | [nft_sell_offers](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/path-and-order-book-methods/nft_sell_offers) | ✅ | +| Request | Method name | V1 support | V2 support | +| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------- | +| `NFTokenBuyOffersRequest` | [nft_buy_offers](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/path-and-order-book-methods/nft_buy_offers) | ✅ | ✅ | +| `NFTokenSellOffersRequest` | [nft_sell_offers](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/path-and-order-book-methods/nft_sell_offers) | ✅ | ✅ | The `oracle` subpackage provides the following queries requests: -| Request | Method name | V1 support | -|---------|------------|------------| -| `GetAggregatePriceRequest` | [get_aggregate_price](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/oracle-methods/get_aggregate_price) | ✅ | +| Request | Method name | V1 support | V2 support | +| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------- | +| `GetAggregatePriceRequest` | [get_aggregate_price](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/oracle-methods/get_aggregate_price) | ❌ | ✅ | #### Usage @@ -209,11 +204,11 @@ The available methods correspond to the [Clio Methods](https://xrpl.org/docs/ref The `clio` subpackage provides the following queries requests: -| Request | Method name | V1 support | -|---------|------------|------------| -| `NFTHistoryRequest` | [nft_history](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/clio-methods/nft_history) | ✅ | -| `NFTInfoRequest` | [nft_info](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/clio-methods/nft_info) | ✅ | -| `NFTsByIssuerRequest` | [nfts_by_issuer](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/clio-methods/nfts_by_issuer) | ✅ | +| Request | Method name | V1 support | V2 support | +| --------------------- | --------------------------------------------------------------------------------------------------------------------- | ---------- | ---------- | +| `NFTHistoryRequest` | [nft_history](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/clio-methods/nft_history) | ✅ | ✅ | +| `NFTInfoRequest` | [nft_info](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/clio-methods/nft_info) | ✅ | ✅ | +| `NFTsByIssuerRequest` | [nfts_by_issuer](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/clio-methods/nfts_by_issuer) | ❌ | ✅ | #### Usage @@ -223,7 +218,6 @@ To use the `clio` package, you need to import it in your project: import "github.com/Peersyst/xrpl-go/xrpl/queries/clio" ``` - ### server The `server` package contains methods to interact with the [`rippled`](https://github.com/XRPLF/rippled) server. These methods allow you to: @@ -236,14 +230,14 @@ The available methods correspond to the [Server Info Methods](https://xrpl.org/d The `server` subpackage provides the following queries requests: -| Request | Method name | V1 support | -|---------|------------|------------| -| `FeatureAllRequest` | [feature_all](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/server-info-methods/feature_all) | ✅ | -| `FeatureOneRequest` | [feature](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/server-info-methods/feature) | ✅ | -| `FeeRequest` | [fee](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/server-info-methods/fee) | ✅ | -| `ManifestRequest` | [manifest](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/server-info-methods/manifest) | ✅ | -| `InfoRequest` | [server_info](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/server-info-methods/server_info) | ✅ | -| `StateRequest` | [server_state](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/server-info-methods/server_state) | ✅ | +| Request | Method name | V1 support | V2 support | +| ------------------- | ------------------------------------------------------------------------------------------------------------------------ | ---------- | ---------- | +| `FeatureAllRequest` | [feature_all](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/server-info-methods/feature_all) | ✅ | ✅ | +| `FeatureOneRequest` | [feature](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/server-info-methods/feature) | ✅ | ✅ | +| `FeeRequest` | [fee](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/server-info-methods/fee) | ✅ | ✅ | +| `ManifestRequest` | [manifest](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/server-info-methods/manifest) | ✅ | ✅ | +| `InfoRequest` | [server_info](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/server-info-methods/server_info) | ✅ | ✅ | +| `StateRequest` | [server_state](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/server-info-methods/server_state) | ✅ | ✅ | #### Usage @@ -253,7 +247,6 @@ To use the `server` package, you need to import it in your project: import "github.com/Peersyst/xrpl-go/xrpl/queries/server" ``` - ### utility The `utility` package contains methods to interact with the XRPL utility. These methods allow you to: @@ -265,10 +258,10 @@ The available methods correspond to the [Utility Methods](https://xrpl.org/docs/ The `utility` subpackage provides the following queries requests: -| Request | Method name | V1 support | -|---------|------------|------------| -| `RandomRequest` | [random](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/utility-methods/random) | ✅ | -| `PingRequest` | [ping](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/utility-methods/ping) | ✅ | +| Request | Method name | V1 support | V2 support | +| --------------- | -------------------------------------------------------------------------------------------------------- | ---------- | ---------- | +| `RandomRequest` | [random](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/utility-methods/random) | ✅ | ✅ | +| `PingRequest` | [ping](https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/utility-methods/ping) | ✅ | ✅ | #### Usage diff --git a/docs/docs/xrpl/rpc.md b/docs/docs/xrpl/rpc.md index e2114377..fc9c1c90 100644 --- a/docs/docs/xrpl/rpc.md +++ b/docs/docs/xrpl/rpc.md @@ -23,7 +23,7 @@ if err != nil { client := rpc.NewClient(cfg) ``` -Every time you create a new `Client`, you need to provde a `Config` struct as an argument. You can initialize a `Config` struct using the `NewClientConfig` function. +Every time you create a new `Client`, you need to provide a `Config` struct as an argument. You can initialize a `Config` struct using the `NewClientConfig` function. `Config` struct follows the options pattern, so you can pass different options to the `NewClientConfig` function. @@ -77,29 +77,32 @@ The `Request` method is used to make queries to the XRPL network. It returns a ` func (c *Client) Request(reqParams XRPLRequest) (XRPLResponse, error) ``` -### Submit/SubmitMultisigned +### Autofill/AutofillMultisigned -The `Submit` method is used to submit a transaction to the XRPL network. It returns a `TxResponse` struct containing the transaction result for the blob submitted. `txBlob` must be signed. There's also a `SubmitMultisigned` method that works the same way but for multisigned transactions. +The `Autofill` method is used to autofill some fields in a flat transaction. This method is useful for adding dynamic fields like `LastLedgerSequence` or `Fee`. It returns an error if the transaction is not valid or some internal call fails. There's also a `AutofillMultisigned` method that works the same way but for multisigned transactions. +Both methods support `Batch` transactions, filling in both the inner `RawTransactions` and the outer `Batch` transaction. ```go -func (c *Client) SubmitTxBlob(txBlob string, failHard bool) (*requests.TxResponse, error) -func (c *Client) SubmitMultisigned(txBlob string, failHard bool) (*requests.SubmitMultisignedResponse, error) +func (c *Client) Autofill(tx *transaction.FlatTransaction) error +func (c *Client) AutofillMultisigned(tx *transaction.FlatTransaction, nSigners uint64) error ``` -### Autofill/AutofillMultisigned +### Submit -The `Autofill` method is used to autofill some fields in a flat transaction. This method is useful for adding dynamic fields like `LastLedgerSequence` or `Fee`. It returns an error if the transaction is not valid or some internall call fails. There's also a `AutofillMultisigned` method that works the same way but for multisigned transactions. +The `SubmitTx` and `SubmitTxBlob` methods are used to submit a transaction to the XRPL network. They return a `SubmitResponse` struct containing the immediate submission result and status for the submitted blob or flattened transaction. The inputted transaction must be signed. There's also a `SubmitMultisigned` method that works the same way but for multisigned transactions. ```go -func (c *Client) Autofill(tx *transaction.FlatTransaction) error -func (c *Client) AutofillMultisigned(tx *transaction.FlatTransaction, nSigners uint64) error +func (c *Client) SubmitTx(tx transaction.FlatTransaction, opts *rpctypes.SubmitOptions) (*requests.SubmitResponse, error) +func (c *Client) SubmitTxBlob(txBlob string, failHard bool) (*requests.SubmitResponse, error) +func (c *Client) SubmitMultisigned(txBlob string, failHard bool) (*requests.SubmitMultisignedResponse, error) ``` -### SubmitTxBlobAndWait +### SubmitTxAndWait/SubmitTxBlobAndWait -The `SubmitTxBlobAndWait` method is used to submit a transaction to the XRPL network and wait for it to be included in a ledger. It returns a `TxResponse` struct containing the transaction result for the blob submitted. +The `SubmitTxAndWait` and `SubmitTxBlobAndWait` methods are used to submit a transaction to the XRPL network and wait for it to be included in a ledger. They return a `TxResponse` struct containing the finalized ledger transaction result for the flattened transaction or blob submitted. ```go +func (c *Client) SubmitTxAndWait(tx transaction.FlatTransaction, opts *rpctypes.SubmitOptions) (*requests.TxResponse, error) func (c *Client) SubmitTxBlobAndWait(txBlob string, failHard bool) (*requests.TxResponse, error) ``` diff --git a/docs/docs/xrpl/transaction.md b/docs/docs/xrpl/transaction.md index e032a0ff..d0a777e7 100644 --- a/docs/docs/xrpl/transaction.md +++ b/docs/docs/xrpl/transaction.md @@ -11,16 +11,22 @@ These are the transaction types available in the XRPL: - [AccountDelete](https://xrpl.org/docs/references/protocol/transactions/types/accountdelete) - [AccountSet](https://xrpl.org/docs/references/protocol/transactions/types/accountset) - [AMMBid](https://xrpl.org/docs/references/protocol/transactions/types/ammbid) +- [AMMClawback](https://xrpl.org/docs/references/protocol/transactions/types/ammclawback) - [AMMCreate](https://xrpl.org/docs/references/protocol/transactions/types/ammcreate) - [AMMDelete](https://xrpl.org/docs/references/protocol/transactions/types/ammdelete) - [AMMDeposit](https://xrpl.org/docs/references/protocol/transactions/types/ammdeposit) - [AMMVote](https://xrpl.org/docs/references/protocol/transactions/types/ammvote) - [AMMWithdraw](https://xrpl.org/docs/references/protocol/transactions/types/ammwithdraw) +- [Batch](https://xrpl.org/docs/references/protocol/transactions/types/batch) - [CheckCancel](https://xrpl.org/docs/references/protocol/transactions/types/checkcancel) - [CheckCash](https://xrpl.org/docs/references/protocol/transactions/types/checkcash) - [CheckCreate](https://xrpl.org/docs/references/protocol/transactions/types/checkcreate) - [Clawback](https://xrpl.org/docs/references/protocol/transactions/types/clawback) +- [CredentialAccept](https://xrpl.org/docs/references/protocol/transactions/types/credentialaccept) +- [CredentialCreate](https://xrpl.org/docs/references/protocol/transactions/types/credentialcreate) +- [CredentialDelete](https://xrpl.org/docs/references/protocol/transactions/types/credentialdelete) - [DepositPreauth](https://xrpl.org/docs/references/protocol/transactions/types/depositpreauth) +- [DelegateSet](https://xrpl.org/docs/references/protocol/transactions/types/delegateset) - [DIDDelete](https://xrpl.org/docs/references/protocol/transactions/types/diddelete) - [DIDSet](https://xrpl.org/docs/references/protocol/transactions/types/didset) - [EscrowCancel](https://xrpl.org/docs/references/protocol/transactions/types/escrowcancel) @@ -31,6 +37,7 @@ These are the transaction types available in the XRPL: - [NFTokenCancelOffer](https://xrpl.org/docs/references/protocol/transactions/types/nftokencanceloffer) - [NFTokenCreateOffer](https://xrpl.org/docs/references/protocol/transactions/types/nftokencreateoffer) - [NFTokenMint](https://xrpl.org/docs/references/protocol/transactions/types/nftokenmint) +- [NFTokenModify](https://xrpl.org/docs/references/protocol/transactions/types/nftokenmodify) - [OfferCancel](https://xrpl.org/docs/references/protocol/transactions/types/offercancel) - [OfferCreate](https://xrpl.org/docs/references/protocol/transactions/types/offercreate) - [OracleDelete](https://xrpl.org/docs/references/protocol/transactions/types/oracledelete) @@ -38,11 +45,17 @@ These are the transaction types available in the XRPL: - [PaymentChannelClaim](https://xrpl.org/docs/references/protocol/transactions/types/paymentchannelclaim) - [PaymentChannelCreate](https://xrpl.org/docs/references/protocol/transactions/types/paymentchannelcreate) - [PaymentChannelFund](https://xrpl.org/docs/references/protocol/transactions/types/paymentchannelfund) +- [PermissionedDomainDelete](https://xrpl.org/docs/references/protocol/transactions/types/permissioneddomaindelete) +- [PermissionedDomainSet](https://xrpl.org/docs/references/protocol/transactions/types/permissioneddomainset) - [Payment](https://xrpl.org/docs/references/protocol/transactions/types/payment) - [SetRegularKey](https://xrpl.org/docs/references/protocol/transactions/types/setregularkey) - [SignerListSet](https://xrpl.org/docs/references/protocol/transactions/types/signerlistset) - [TicketCreate](https://xrpl.org/docs/references/protocol/transactions/types/ticketcreate) - [TrustSet](https://xrpl.org/docs/references/protocol/transactions/types/trustset) +- [MPTokenAuthorize](https://xrpl.org/docs/references/protocol/transactions/types/mptokenauthorize) +- [MPTokenIssuanceCreate](https://xrpl.org/docs/references/protocol/transactions/types/mptokenissuancecreate) +- [MPTokenIssuanceDestroy](https://xrpl.org/docs/references/protocol/transactions/types/mptokenissuancedestroy) +- [MPTokenIssuanceSet](https://xrpl.org/docs/references/protocol/transactions/types/mptokenissuanceset) - [XChainAccountCreateCommit](https://xrpl.org/docs/references/protocol/transactions/types/xchainaccountcreatecommit) - [XChainAddAccountCreateAttestation](https://xrpl.org/docs/references/protocol/transactions/types/xchainaddaccountcreateattestation) - [XChainAddClaimAttestation](https://xrpl.org/docs/references/protocol/transactions/types/xchainaddclaimattestation) @@ -58,4 +71,4 @@ To use the `transaction` package, you need to import it in your project: ```go import "github.com/Peersyst/xrpl-go/xrpl/transaction" -``` \ No newline at end of file +``` diff --git a/docs/docs/xrpl/wallet.md b/docs/docs/xrpl/wallet.md index 1c0850dd..90bd62c7 100644 --- a/docs/docs/xrpl/wallet.md +++ b/docs/docs/xrpl/wallet.md @@ -54,6 +54,14 @@ The `Sign` method signs a flat transaction and returns the signed transaction bl On the other hand, the `Multisign` method multisigns a flat transaction by adding the wallet's signature to the transaction and returning the resulting transaction blob and the blob hash. Learn more about how multisigns work in the [official documentation](https://xrpl.org/docs/concepts/accounts/multi-signing). +## Signing a batch transaction + +There's also the `SignMultiBatch` package function that signs each `RawTransaction` of a `Batch` transaction, signed by every account involved, excluding the account that's signing the overall transaction. + +```go +func SignMultiBatch(wallet Wallet, tx *transaction.FlatTransaction, opts *SignMultiBatchOptions) error +``` + ## Usage In this section, we will see how to generate a `Wallet`, call the faucet to get XRP, and send the XRP to another account. @@ -65,6 +73,7 @@ if err != nil { // ... } ``` + Once we have the `Wallet`, we can call the faucet to get XRP. For this example, we will use the `DevnetFaucetProvider` to get XRP on the `devnet` ledger: ```go @@ -136,4 +145,4 @@ func main() { fmt.Println("Tx blob: ", blob) fmt.Println("Tx hash: ", hash) } -``` \ No newline at end of file +``` diff --git a/docs/docs/xrpl/websocket.md b/docs/docs/xrpl/websocket.md index 8433cd9d..921e601b 100644 --- a/docs/docs/xrpl/websocket.md +++ b/docs/docs/xrpl/websocket.md @@ -109,27 +109,30 @@ func (c *Client) Request(reqParams XRPLRequest) (*ClientResponse, error) ### Autofill/AutofillMultisigned -The `Autofill` method is used to autofill some fields in a flat transaction. This method is useful for adding dynamic fields like `LastLedgerSequence` or `Fee`. It returns an error if the transaction is not valid or some internall call fails. There's also a `AutofillMultisigned` method that works the same way but for multisigned transactions. +The `Autofill` method is used to autofill some fields in a flat transaction. This method is useful for adding dynamic fields like `LastLedgerSequence` or `Fee`. It returns an error if the transaction is not valid or some internal call fails. There's also a `AutofillMultisigned` method that works the same way but for multisigned transactions. +Both methods support `Batch` transactions, filling in both the inner `RawTransactions` and the outer `Batch` transaction. ```go func (c *Client) Autofill(tx *transaction.FlatTransaction) error func (c *Client) AutofillMultisigned(tx *transaction.FlatTransaction, nSigners uint64) error ``` -### Submit/SubmitMultisigned +### Submit -The `Submit` method is used to submit a transaction to the XRPL network. It returns a `TxResponse` struct containing the transaction result for the blob submitted. `txBlob` must be signed. There's also a `SubmitMultisigned` method that works the same way but for multisigned transactions. +The `SubmitTx` and `SubmitTxBlob` methods are used to submit a transaction to the XRPL network. They return a `SubmitResponse` struct containing the immediate submission result and status for the submitted blob or flattened transaction. The inputted transaction must be signed. There's also a `SubmitMultisigned` method that works the same way but for multisigned transactions. ```go +func (c *Client) SubmitTx(tx transaction.FlatTransaction, opts *rpctypes.SubmitOptions) (*requests.SubmitResponse, error) func (c *Client) SubmitTxBlob(txBlob string, failHard bool) (*requests.SubmitResponse, error) func (c *Client) SubmitMultisigned(txBlob string, failHard bool) (*requests.SubmitMultisignedResponse, error) ``` -### SubmitTxBlobAndWait +### SubmitTxAndWait/SubmitTxBlobAndWait -The `SubmitTxBlobAndWait` method is used to submit a transaction to the XRPL network and wait for it to be included in a ledger. It returns a `TxResponse` struct containing the transaction result for the blob submitted. +The `SubmitTxAndWait` and `SubmitTxBlobAndWait` methods are used to submit a transaction to the XRPL network and wait for it to be included in a ledger. They return a `TxResponse` struct containing the finalized ledger transaction result for the flattened transaction or blob submitted. ```go +func (c *Client) SubmitTxAndWait(tx transaction.FlatTransaction, opts *rpctypes.SubmitOptions) (*requests.TxResponse, error) func (c *Client) SubmitTxBlobAndWait(txBlob string, failHard bool) (*requests.TxResponse, error) ```