Tutorial: Deposit a crypto asset

This tutorial shows you how to deposit crypto assets into your Liquidity Hub account using the Liquidity Hub API. Depositing a crypto asset into your account is a two-step process:

  1. Get the destination wallet address for the specific crypto asset you want to deposit. The destination wallet address is unique to the crypto asset you are sending.
  2. Transfer crypto assets to the destination wallet.
This tutorial uses the example of getting the destination wallet address to deposit Ether (ETH) into your Liquidity Hub account.

Prerequisites

The GET /wallet-address/{asset} operation is protected by Bearer authentication. To successfully call this operation, you must include a valid Bearer authentication token in the request header. For more information, see the Get an authentication token tutorial.

Step 1: Get the destination wallet address

Let's use the GET /wallet-address/{asset} operation to request the destination wallet address that you can use to deposit ETH into your Liquidity Hub account.
Note
Before every deposit, send a request to the /wallet-address/{asset} endpoint to get the destination wallet address for the crypto asset you are sending. This ensures that you have the correct address for that asset, as the address may change for security reasons.

Construct the request

The GET /wallet-address/{asset} operation accepts the asset path parameter. The valid value of this parameter is the symbol of the crypto asset you want to deposit. To get the wallet address that you can transfer Ether to, specify the value of the asset parameter as ETH.

Sample request

The following code sample requests the destination wallet address where you can deposit ETH:

Examine the response

The following code sample shows the success response received from the /wallet-address/{asset} endpoint.
{
  • "asset": "ETH",
  • "walletAddress": "r3e3YwutMYWBx3TTLi9xGgbtzDHsiRaWgk"
}
The value of the walletAddress field in the response is the destination wallet address where you should transfer your crypto asset.

For the full response schema, see the Retrieve wallet address for a specific asset operation reference.

Step 2: Transfer crypto assets to destination wallet

After getting the walletAddress from step 1, transfer the desired quantity of the crypto asset to that address. When all on-chain confirmations for the transfer are complete, the available balance of that crypto asset in your Liquidity Hub account will reflect the deposit. The time taken for on-chain confirmations to complete depends on the blockchain on which the transfer takes place.
Crypto asset transfer fees

The available balance reflects the amount of the crypto asset actually received by Ripple (net of any fees or transaction costs, such as gas fees). You can see the fee applicable to a transaction on the Transfers page in the Liquidity Hub UI.

Error responses and handling

If your request is unsuccessful, you may receive a 400, 401, 404, or 500 error code from the Liquidity Hub API.

Here are some recommendations for error handling:

Error codeNamePossible cause and error handling
400Bad RequestYour request may be missing required header or path parameters. Inspect your request and retry the request.
401UnauthorizedYour Bearer authentication token may be invalid or expired. Verify that the authentication token is not truncated or past the token expiry period. Retry the request again with a valid authentication token.
404Not FoundThe resource was not found.
500Internal Server ErrorThe service is temporarily unavailable. Retry the request later.

Next steps

After completing the transfer, you can: