Skip to content
2 changes: 1 addition & 1 deletion docs/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
13 changes: 6 additions & 7 deletions docs/docs/keypairs.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -199,4 +198,4 @@ func main() {
fmt.Println("Public Key: ", pubK)
fmt.Println("Address: ", addr)
}
```
```
7 changes: 6 additions & 1 deletion docs/docs/xrpl/currency.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
pagination_prev: keypairs
---

# currency

## Overview
Expand Down Expand Up @@ -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)
func ConvertHexToString(input string) (string, error)
```
20 changes: 18 additions & 2 deletions docs/docs/xrpl/hash.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -14,6 +18,18 @@ import "github.com/Peersyst/xrpl-go/xrpl/hash"

## API

### SignTxBlob

```go
func SignTxBlob(blob []byte, secret string) ([]byte, error)
```
```

Hashes a signed transaction blob and returns the transaction hash or an error if the blob is invalid.

### SignTx

```go
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.
4 changes: 3 additions & 1 deletion docs/docs/xrpl/ledger-entry-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -33,4 +35,4 @@ To import the package, you can use the following code:

```go
import "github.com/Peersyst/xrpl-go/xrpl/ledger-entry-types"
```
```
25 changes: 14 additions & 11 deletions docs/docs/xrpl/rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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)
```

Expand Down
15 changes: 14 additions & 1 deletion docs/docs/xrpl/transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -31,18 +37,25 @@ 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)
- [OracleSet](https://xrpl.org/docs/references/protocol/transactions/types/oracleset)
- [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)
Expand All @@ -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"
```
```
10 changes: 6 additions & 4 deletions docs/docs/xrpl/wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ A wallet lets the developer sign and multisign transactions easily. The `Wallet`
// Signing methods
func (w *Wallet) Sign(tx map[string]interface{}) (string, string, error)
func (w *Wallet) Multisign(tx map[string]interface{}) (string, string, error)
func (w *Wallet) SignMultiBatch(tx *transaction.FlatTransaction, opts *SignMultiBatchOptions) error
```

The `Sign` method signs a flat transaction and returns the signed transaction blob and the signature.

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).
- The `Sign` method signs a flat transaction and returns the signed transaction blob and the signature.
- 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).
- The `SignMultiBatch` method signs each `RawTransaction` of a `Batch` transaction, signed by every account involved, excluding the account that's signing the overall transaction.

## Usage

Expand All @@ -65,6 +66,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
Expand Down Expand Up @@ -136,4 +138,4 @@ func main() {
fmt.Println("Tx blob: ", blob)
fmt.Println("Tx hash: ", hash)
}
```
```
13 changes: 8 additions & 5 deletions docs/docs/xrpl/websocket.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand Down