Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3.0 KiB
3.0 KiB
@suaveplan/currency-provider-cryptocompare - Universal CryptoCompare crypto-rates provider for @suaveplan/currency. Sibling provider package on the slim @suaveplan/currency-providers core (httpRequest, defineCurrencyProvider, CurrencyProviderError, NoKeyConfig). Optional API key — free tier works keyless; key boosts the rate limit and is sent via authorization: Apikey <key> header.
Universal CryptoCompare crypto-rates provider for @suaveplan/currency.
Sibling provider package on top of the slim @suaveplan/currency-providers
core (httpRequest, CurrencyProviderError, NoKeyConfig). Optional API
key — CryptoCompare's free tier works fully keyless; supplying a key boosts
the upstream rate limit and is sent on every request via the
authorization: Apikey <key> header.
Documentation tree
- cryptocompare —
CryptoCompareProviderimplements theCurrencyProvidercontract from@suaveplan/currencyon top of CryptoCompare's…- cryptocompare —
CryptoCompareProviderimplements theCurrencyProvidercontract from@suaveplan/currencyon top of CryptoCompare's…
- cryptocompare —
Install
bun add @suaveplan/currency-provider-cryptocompare \
@suaveplan/currency \
@suaveplan/currency-providers
Quick start
import { CurrencyConverter } from "@suaveplan/currency";
import { CryptoCompareProvider } from "@suaveplan/currency-provider-cryptocompare";
const provider = new CryptoCompareProvider({
apiKey: process.env.CRYPTOCOMPARE_API_KEY, // optional
});
const converter = new CurrencyConverter({
provider,
staleDurationMs: 60_000,
});
const conversion = await converter.convert(amount, "BTC");
Or register through the slim-core registry:
import { CurrencyProviderRegistry } from "@suaveplan/currency-providers";
import { CryptoCompareProvider } from "@suaveplan/currency-provider-cryptocompare";
const registry = new CurrencyProviderRegistry();
registry.register(new CryptoCompareProvider());
const provider = registry.get("cryptocompare");
Modules
cryptocompare/cryptocompare—CryptoCompareProviderclass,CryptoCompareConfiginterface, error mapping forHTTP_ERROR/PARSE_ERROR/UPSTREAM_ERROR/UNKNOWN_CURRENCY.
Errors
Every failure path raises CurrencyProviderError from the slim core:
| Code | Raised when |
|---|---|
CURRENCY_PROVIDER.HTTP_ERROR |
Non-2xx HTTP response (shared httpRequest) |
CURRENCY_PROVIDER.PARSE_ERROR |
Body not valid JSON, or payload not a JSON object |
CURRENCY_PROVIDER.UPSTREAM_ERROR |
Payload carries Response: "Error" |
CURRENCY_PROVIDER.UNKNOWN_CURRENCY |
No requested symbol produced a finite positive quote |
Dispatch on error.code, not the message string. The instance also
carries providerName: "cryptocompare", optional status (for HTTP_ERROR),
and optional upstreamMessage (for UPSTREAM_ERROR).