Skip to contents

Retrieves all deposit addresses for a specified currency on KuCoin asynchronously by sending a GET request to the /api/v3/deposit-addresses endpoint. This internal function is designed for use within an R6 class and is not intended for direct end-user consumption.

Usage

get_deposit_addresses_v3_impl(
  keys = get_api_keys(),
  base_url = get_base_url(),
  currency,
  amount = NULL,
  chain = NULL,
  .__coro_env_parent__ = <environment>
)

Arguments

keys

List containing API configuration parameters from get_api_keys(), including:

  • api_key: Character string; your KuCoin API key.

  • api_secret: Character string; your KuCoin API secret.

  • api_passphrase: Character string; your KuCoin API passphrase.

  • key_version: Character string; API key version (e.g., "2"). Defaults to get_api_keys().

base_url

Character string representing the base URL for the API. Defaults to get_base_url().

currency

Character string; the currency for which to retrieve deposit addresses (e.g., "BTC", "ETH", "USDT").

amount

Character string (optional); the deposit amount, only used for Lightning Network invoices.

chain

Character string (optional); the chain identifier (e.g., "eth", "bech32", "btc").

Value

Promise resolving to a data.table containing the deposit address details, with columns including:

  • address (character): The deposit address.

  • memo (character): Address remark (may be empty).

  • chainId (character): The chain identifier.

  • to (character): The account type ("main" or "trade").

  • expirationDate (integer): Expiration time (for Lightning Network).

  • currency (character): The currency.

  • contractAddress (character): The token contract address.

  • chainName (character): The chain name. If no addresses are found, an empty data.table is returned.

Details

Workflow Overview

  1. URL Construction: Combines the base URL with the endpoint /api/v3/deposit-addresses and appends query parameters using build_query().

  2. Header Preparation: Generates authentication headers asynchronously via build_headers().

  3. API Request: Sends a GET request using httr::GET() with the constructed URL and headers, applying a 3-second timeout.

  4. Response Handling: Processes the JSON response with process_kucoin_response(), extracting the "data" field and converting it to a data.table using rbindlist() for the array of addresses.

API Endpoint

GET https://api.kucoin.com/api/v3/deposit-addresses

Usage

Utilised internally to retrieve all existing deposit addresses for a given currency, which can be used for depositing funds to the specified account type.

Official Documentation

KuCoin Get Deposit Address (V3)

Examples

if (FALSE) { # \dontrun{
keys <- get_api_keys()
base_url <- "https://api.kucoin.com"
main_async <- coro::async(function() {
  dt <- await(get_deposit_address_v3_impl(
    keys = keys,
    base_url = base_url,
    currency = "USDT",
    chain = "trx"
  ))
  print(dt)
})
main_async()
while (!later::loop_empty()) later::run_now()
} # }