Get Deposit Addresses (V3) (Implementation)
Source:R/impl_account_deposit.R
get_deposit_addresses_v3_impl.Rd
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 toget_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 emptydata.table
is returned.
Details
Workflow Overview
URL Construction: Combines the base URL with the endpoint
/api/v3/deposit-addresses
and appends query parameters usingbuild_query()
.Header Preparation: Generates authentication headers asynchronously via
build_headers()
.API Request: Sends a GET request using
httr::GET()
with the constructed URL and headers, applying a 3-second timeout.Response Handling: Processes the JSON response with
process_kucoin_response()
, extracting the"data"
field and converting it to adata.table
usingrbindlist()
for the array of 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.
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()
} # }