avraapi.currency() for the four released Currency operations. Every call
is asynchronous and resolves to an ApiResponse; retain requestId for
support and troubleshooting.
Every Currency operation supports the shared one-request privacy control:
avraapi.currency().withPrivacyMode().getCodes(). It sends
X-Privacy-Mode: 1 for that request only, then clears automatically.base and target before sending them. They must
still be active Currency codes, so retrieve the current set instead of keeping
a hard-coded list.
Get supported currency codes
getCodes(): Promise<ApiResponse> returns the active code list, including
target-only CBSL codes when available.
SDK function
Copy the SDK call
Read the active code list
Response
LKR-SELL, LKR-BUY, and
LKR-CBSL are target-only CBSL codes, not ordinary base currencies. See
CBSL Rates for their meanings.
Get latest rates from one base currency
getLatestRates(base: string): Promise<ApiResponse> returns the available
rate map for one base currency. The base is not repeated in data.rates.
SDK function
Copy the SDK call
Read a rate map
Response
last_updated as a freshness value, not a binding financial quote. Apply
your own pricing, approval, and rounding rules before displaying a price.
Get one currency-pair rate
getPairRate(base: string, target: string): Promise<ApiResponse> returns one
rate. A target can be a standard active currency or LKR-SELL, LKR-BUY, or
LKR-CBSL for the applicable CBSL rate type.
SDK function
Copy the SDK call
Read one pair rate
Response
Convert a currency amount
convert(base: string, target: string, amount: number): Promise<ApiResponse>
calculates a current conversion for one positive amount.
SDK function
Copy the SDK call
Convert and use a positive amount
Response
Handle Currency errors
Currency calls reject with typed SDK errors rather than resolving to an errorApiResponse. Use the common pattern in Node.js Overview and setup, and retain an error’s
requestId only in backend support records.