# Manage XRPL tokens

You can perform the following fungible token management operations on the XRP ledger:

- Manage trust lines, including trust line creation, settings, and freezing
- Preauthorize deposits on an account
- Claw back tokens from an account
- Trade tokens in the decentralized exchange (DEX)


Each of these operations involves the creation of a transaction order.

You can also issue XRPL fungible tokens with a transfer order or transaction order. Transfer orders are the recommended method for sending all assets, including XRPL tokens.

For more information about:

- Issuing tokens with a transfer order, see [Send assets](/products/custody/v1.34/ui/accounting/send-assets)
- Trading tokens on the DEX, see Trade in the Decentralized Exchange in the XRPL documentation


## Manage trust lines

A trust line is an accounting relationship between two accounts: a token **issuer** account, which controls the tokens, and a token **holder** account, which receives the tokens. A trust line is characterized as follows:

- Creates a trust relationship between accounts for trading fungible tokens.
- Is identified by the account pair and currency symbol.
- Provides a structure to hold the tokens.


In a given trust line, the token issuer has a negative balance equal to the positive balance of the token holder. For example, if the token holder holds 10 tokens issued by the issuer:

- The issuer account has a balance of -10 tokens.
- The holder account has a balance of 10 tokens.


For more information about trust lines, see Trust Lines in the XRPL documentation.

In Ripple Custody, you can create a trust line in two ways:

- With an issuer account and currency.
- With an allowlisted fungible token.


### Prerequisites

To create or update an XRPL trust line, you need the following:

- A token issuer account.
- A token holder account.
- An allowlisted fungible token, if you want to use a token to create the trust line.
- Enough funds in the accounts to cover the transaction and all reserves, including the network reserve of 10 XRP and the reserve of 2 XRP for each object held in the account.
For more information about checking account balances, see [Check account balances](/products/custody/v1.34/ui/accounting-entities/account/view#check-account-balances).


### Create a trust line

You can use the **TrustSet** operation to create new trust lines.

For more information about the **TrustSet** operation, see TrustSet in the XRPL documentation.

Creation of a trust line adds a reserved amount of 2 XRP.
For more information about reserved amounts, see [Check account balances](/products/custody/v1.34/ui/accounting-entities/account/view#check-account-balances).

To create a trust line:

1. Navigate to **Transactions**.
2. Click **Create an order**.
3. Select **Transaction order**.
4. In **Source**, select the holder account.
5. In **Ledger**, select an XRP ledger.
6. In **Operation**, select **TrustSet**.
7. Specify the details of the trust line. To specify this information as:
  - An issuer account address and currency, select **Currency** and then enter the following:
    - In **Issuer**, the address of the issuer account.
    - The currency code, specified as a three-character string or a 160-bit hexadecimal string.
For more information about currency code formats, see Currency Codes in the XRPL documentation.
  - A token, select **Asset** and then enter details of an allowlisted fungible token.
8. In **Limit**, enter the maximum balance of tokens that the holder is willing to hold.
9. To enable rippling, select **Enable Rippling**.
For more information about rippling, see [Rippling](https://xrpl.org/docs/concepts/tokens/fungible-tokens/rippling#rippling) in the XRPL documentation.
10. In **Additional information**, enter any optional information.
11. In the **Fee** section, specify the following fee information:
  - The fee strategy to use to calculate the transaction fees.
  - A maximum fee as a percentage or amount, if required. The maximum fee must take into consideration the fee calculation method for the ledger. The transaction is not broadcast if the fees are higher than this cap.
Ripple Custody displays the estimated fee for the transaction.
[Learn more about how Ripple Custody calculates transaction fees](/products/custody/v1.34/concepts/transactions-reference#fee-strategies-by-ledger)
12. Click **Submit for Approval** and [sign the operation with the app](/products/custody/v1.34/ui/get-started/key-operations/intent-signature).


The transaction is sent when the intent is successfully executed.
The trust line is created and the holder account can now receive tokens.

### Create an authorized trust line

You can authorize a holder account to hold tokens as part of trust line creation.

This setting is only needed if **Require Auth** is enabled for the holder account.
For more information, see [Update XRPL account settings](/products/custody/v1.34/ui/accounting/account-settings/xrpl#update-xrpl-account-settings).

To create an authorized trust line:

1. Navigate to **Transactions**.
2. Click **Create an order**.
3. Select **Transaction order**.
4. In **Source**, select the holder account.
5. In **Ledger**, select an XRP ledger.
6. In **Operation**, select **TrustSet**.
7. Specify the details of the trust line. To specify this information as:
  - An issuer account address and currency, select **Currency** and then enter the following:
    - In **Issuer**, the address of the issuer account.
    - The currency code, specified as a three-character string or a 160-bit hexadecimal string.
For more information about currency code formats, see Currency Codes in the XRPL documentation.
  - A token, select **Asset** and then enter details of an allowlisted fungible token.
8. In **Limit**, enter the maximum balance of tokens that the holder can hold.
9. Select **Authorize**.
10. In **Additional information**, enter any optional information.
11. In the **Fee** section, specify the following fee information:
  - The fee strategy to use to calculate the transaction fees.
  - A maximum fee as a percentage or amount, if required. The maximum fee must take into consideration the fee calculation method for the ledger. The transaction is not broadcast if the fees are higher than this cap.
Ripple Custody displays the estimated fee for the transaction.
[Learn more about how Ripple Custody calculates transaction fees](/products/custody/v1.34/concepts/transactions-reference#fee-strategies-by-ledger)
12. Click **Submit for Approval** and [sign the operation with the app](/products/custody/v1.34/ui/get-started/key-operations/intent-signature).


The transaction is sent when the intent is successfully executed.
The holder account is now able to receive tokens.

### Freeze or unfreeze a trust line

You can use the **TrustSet** operation to freeze or unfreeze trust lines.

You cannot freeze the trust line if **No Freeze** is enabled for the issuer account.
For more information, see [Update XRPL account settings](/products/custody/v1.34/ui/accounting/account-settings/xrpl#update-xrpl-account-settings).

To create or update a trust line:

1. Navigate to **Transactions**.
2. Click **Create an order**.
3. Select **Transaction order**.
4. In **Source**, select the issuer account.
5. In **Ledger**, select an XRP ledger.
6. In **Operation**, select **TrustSet**.
7. Specify the details of the trust line. To specify this information as:
  - The holder account address and currency, select **Currency** and then enter the following:
    - In **Issuer**, the address of the issuer account.
    - The currency code, specified as a three-character string or a 160-bit hexadecimal string.
For more information about currency code formats, see Currency Codes in the XRPL documentation.
  - A token, select **Asset** and then enter details of an allowlisted fungible token.
8. To update the trust line settings, select the following options:
  - **Set freeze**: Freezes this trust line.
  - **Clear freeze**: Unfreezes this trust line.
9. In **Additional information**, enter any optional information.
10. In the **Fee** section, specify the following fee information:
  - The fee strategy to use to calculate the transaction fees.
  - A maximum fee as a percentage or amount, if required. The maximum fee must take into consideration the fee calculation method for the ledger. The transaction is not broadcast if the fees are higher than this cap.
Ripple Custody displays the estimated fee for the transaction.
[Learn more about how Ripple Custody calculates transaction fees](/products/custody/v1.34/concepts/transactions-reference#fee-strategies-by-ledger)
11. Click **Submit for Approval** and [sign the operation with the app](/products/custody/v1.34/ui/get-started/key-operations/intent-signature).


The transaction is sent when the intent is successfully executed.

## Preauthorize deposits on an account

You can use the **DepositPreAuth** operation to authorize or revoke the authorization for an account to send tokens and XRP to the holder account. You can also remove authorization from an authorized account.

For more information about the **DepositPreAuth** operation, see DepositPreauth in the XRPL documentation.

This operation is only valid for accounts with the **Deposit Auth** setting enabled. This setting is disabled by default.

For more information, see [Update XRPL account settings](/products/custody/v1.34/ui/accounting/account-settings/xrpl#update-xrpl-account-settings).

### Prerequisites

To preauthorize an account, you need the following:

- Details of the token holder account.
- The account address or endpoint to authorize or unauthorize.
- Enough funds in the account to cover the transaction and all reserves, including the network reserve of 10 XRP and the reserve of 2 XRP for each object held in the account, including the account itself.
For more information about checking account balances, see [Check account balances](/products/custody/v1.34/ui/accounting-entities/account/view#check-account-balances).


### Preauthorize or revoke the authorization for an account

To preauthorize or revoke the authorization for an account:

1. Navigate to **Transactions**.
2. Click **Create an order**.
3. Select **Transaction order**.
4. In **Source**, select the holder account.
5. In **Ledger**, select an XRP ledger.
6. In **Operation**, select **DepositPreAuth**.
7. In **Deposit authorization**, select:
  - **Authorize** to authorize an account.
  - **Unauthorize** to revoke an account authorization.
8. Select the address or endpoint of the sender account to authorize or unauthorize.
9. In **Additional information**, enter any optional information.
10. In the **Fee** section, specify the following fee information:
  - The fee strategy to use to calculate the transaction fees.
  - A maximum fee as a percentage or amount, if required. The maximum fee must take into consideration the fee calculation method for the ledger. The transaction is not broadcast if the fees are higher than this cap.
Ripple Custody displays the estimated fee for the transaction.
[Learn more about how Ripple Custody calculates transaction fees](/products/custody/v1.34/concepts/transactions-reference#fee-strategies-by-ledger)
11. Click **Submit for Approval** and [sign the operation with the app](/products/custody/v1.34/ui/get-started/key-operations/intent-signature).


The transaction is sent when the intent is successfully executed.
The sender account is now authorized or unauthorized to send tokens and XRP to the holder account.

## Claw back tokens from an account

You can use the **Clawback** operation to claw back tokens issued from the issuer account. You can use this, for example, when the trust line for an account is frozen.

For more information about the **Clawback** operation, see Clawback in the XRPL documentation.

This operation is only valid for accounts with the **Allow Trust Line Clawback** setting enabled.

For more information, see [Update XRPL account settings](/products/custody/v1.34/ui/accounting/account-settings/xrpl#update-xrpl-account-settings).

### Prerequisites

To claw back tokens, you need the following:

- Details of the token issuer account.
- Details of the trust line where the tokens are held.
- Enough funds in the account to cover the transaction and all reserves, including the network reserve of 10 XRP and the reserve of 2 XRP for each object held in the account, including the account itself.
For more information about checking account balances, see [Check account balances](/products/custody/v1.34/ui/accounting-entities/account/view#check-account-balances).


### Claw back tokens

To claw back tokens:

1. Navigate to **Transactions**.
2. Click **Create an order**.
3. Select **Transaction order**.
4. In **Source**, select the issuer account.
5. In **Ledger**, select an XRP ledger.
6. In **Operation**, select **Clawback**.
7. Specify the details of the trust line from which to claw back the tokens. To specify this information as:
  - An issuer account address and currency, select **Currency** and then enter the following:
    - In **Issuer**, the address of the issuer account.
    - The currency code, specified as a three-character string or a 160-bit hexadecimal string.
For more information about currency code formats, see Currency Codes in the XRPL documentation.
  - A token, select **Asset** and then enter details of an allowlisted fungible token.
8. In **Amount**, specify the amount to claw back.
9. In **Holder** select the address, account, or endpoint from which to claw back the tokens.
10. In **Additional information**, enter any optional information.
11. In the **Fee** section, specify the following fee information:
  - The fee strategy to use to calculate the transaction fees.
  - A maximum fee as a percentage or amount, if required. The maximum fee must take into consideration the fee calculation method for the ledger. The transaction is not broadcast if the fees are higher than this cap.
Ripple Custody displays the estimated fee for the transaction.
[Learn more about how Ripple Custody calculates transaction fees](/products/custody/v1.34/concepts/transactions-reference#fee-strategies-by-ledger)
12. Click **Submit for Approval** and [sign the operation with the app](/products/custody/v1.34/ui/get-started/key-operations/intent-signature).


The transaction is sent when the intent is successfully executed.

## Trade tokens in the decentralized exchange (DEX)

You can use the **OfferCreate** operation to create an offer on the DEX to trade XRP for tokens, or tokens for other tokens.
Only offers that have a corresponding offer on the DEX are executed.

During a trade, two parties create offers. For example:

- A seller account offers tokens for XRP.
- A taker account offers XRP for tokens.


As long as the offer amounts match, the trade is automatically executed on the ledger.

For more information about:

- The **OfferCreate** operation, see OfferCreate in the XRPL documentation.
- Trading tokens on the DEX, see Trade in the Decentralized Exchange in the XRPL documentation.


### Supported settings

Since Ripple Custody only supports the creation of offers with a corresponding offer on the DEX, it is mandatory to set one of the following settings:

- **Immediate or Cancel**: The offer is either executed immediately or cancelled. It can be partially fulfilled.
- **Fill or Kill**: The offer is either fully filled immediately or cancelled. It can't be partially fulfilled.


You can also set the following optional setting:

- **Sell**: Used to agree to receive more than the amount specified in **Taker Pays** if an offer is available for more than the amount asked for.


### Prerequisites

To trade fungible tokens on the DEX, you need to create a trust line with the seller account. For more information, see [Create a trust line](#create-a-trust-line).

### Create an offer to trade on the DEX

To create an offer to trade on the DEX:

1. Navigate to **Transactions**.
2. Click **Create an order**.
3. Select **Transaction order**.
4. In **Source**, select the account that creates the offer.
5. In **Ledger**, select an XRP ledger.
6. In **Operation**, select **OfferCreate**.
7. In **Offer settings**, select the required settings.
For more information, see [Update XRPL account settings](/products/custody/v1.34/ui/accounting/account-settings/xrpl#update-xrpl-account-settings).
8. In **Taker Gets**, specify what you want to offer:
  - The details of the currency or token you own and want to offer. To specify this information as:
    - An account address and currency, select **Currency** and then enter the following:
      - In **Issuer**, the address of the issuer account.
      - The currency code, specified as a three-character string or a 160-bit hexadecimal string.
For more information about currency code formats, see Currency Codes in the XRPL documentation.
    - A token, select **Asset** and then enter details of an allowlisted fungible token.
  - The amount of tokens you want to offer.
9. In **Taker Pays**, specify what you are willing to accept:
  - The details of the currency or token to accept. To specify this information as:
    - An account address and currency, select **Currency** and then enter the following:
      - In **Issuer**, the address of the issuer account.
      - The currency code, specified as a three-character string or a 160-bit hexadecimal string.
For more information about currency code formats, see Currency Codes in the XRPL documentation.
    - A token, select **Asset** and then enter details of an allowlisted fungible token.
  - The amount you are willing to accept.
10. In **Additional information**, enter any optional information.
11. In the **Fee** section, specify the following fee information:
  - The fee strategy to use to calculate the transaction fees.
  - A maximum fee as a percentage or amount, if required. The maximum fee must take into consideration the fee calculation method for the ledger. The transaction is not broadcast if the fees are higher than this cap.
Ripple Custody displays the estimated fee for the transaction.
[Learn more about how Ripple Custody calculates transaction fees](/products/custody/v1.34/concepts/transactions-reference#fee-strategies-by-ledger)
12. Click **Submit for Approval** and [sign the operation with the app](/products/custody/v1.34/ui/get-started/key-operations/intent-signature).


The transaction is sent when the intent is successfully executed.
The transaction is automatically executed on the ledger when two offers match.