Documentation
¶
Overview ¶
Package dex hosts on-device DEX aggregator clients (jupiter, bungee, lifi, okx, uniswap, pancakeswap, oneinch, univ3). Every client takes a variadic list of ClientOption values from its own subpackage; the only shared building block up here is RateLimit, since every provider is behind a per-IP rate-limited gateway and needs the same primitive to configure it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimit ¶
type RateLimit struct {
// QPS is the sustained requests-per-second the bucket refills at.
// Fractional values are legal — 0.5 = 30/min, useful for tight
// free tiers (CoinGecko demo, GT public). A zero or negative QPS
// leaves the target Request's existing limit untouched (Apply
// no-ops), so a `RateLimit{}` zero-value doesn't accidentally
// remove rate limiting.
QPS float64
// Burst is the max tokens the bucket can hold at once, i.e. how
// many requests can arrive bunched together before the QPS gate
// starts stretching them out. Small (1-3) for latency-sensitive
// polls where we WANT to feel the limit immediately, ~QPS for
// batch sweeps that legitimately arrive in short bursts.
Burst int
}
RateLimit is a token-bucket policy passed to a DEX client via its package's WithRateLimit option. Each provider ships one or more presets (e.g. jupiter.RateLimitFree, jupiter.RateLimitPro) that name the upstream tier so operators don't have to look up the documented cap to know why the number is what it is.
Consumers with a private key on a paid tier just construct their own RateLimit{QPS: X, Burst: Y} and pass it in — the presets are starting points, not a closed enum.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package pancakeswap wraps the PancakeSwap V3 subgraph on BNB Chain.
|
Package pancakeswap wraps the PancakeSwap V3 subgraph on BNB Chain. |
|
Package uniswap wraps the Uniswap V3 subgraph on Ethereum mainnet.
|
Package uniswap wraps the Uniswap V3 subgraph on Ethereum mainnet. |