galacticcouncil / galacticcouncil/sdk
expose circuit breaker deposit/withdraw limits in xcm api
- Dominant language
- TypeScript
- Stars
- 28
- Forks
- 32
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 10
Description
## problem
hydration's runtime includes a circuit breaker pallet that rate-limits xcm deposits and withdrawals:
- **per-asset deposit limit** — \`xcmRateLimit\` field on \`assetRegistry.assets[id]\`. if an asset's issuance increases by more than this amount within the configured period, the asset enters lockdown (further deposits rejected).
- **global withdraw limit** — \`circuitBreaker.globalWithdrawLimitConfig\` (limit + time window) combined with \`circuitBreaker.withdrawLimitAccumulator\` (linearly decaying usage). when exceeded, global withdraw lockdown kicks in.
users submitting xcm tx today don't see this until the extrinsic fails on-chain, which is a poor ux.
## ask
expose circuit-breaker state through the sdk's xcm api so clients can:
1. preview whether a deposit/withdraw would succeed (enough headroom vs limit)
2. show remaining capacity (per-asset deposit, global withdraw) to the user
3. warn before submitting a tx that would fail, or block it client-side
## reference
- pallet: https://github.com/galacticcouncil/hydration-node/tree/master/pallets/circuit-breaker
- storage used by existing dashboard:
- \`assetRegistry.assets(id).xcmRateLimit\`
- \`circuitBreaker.assetLockdownState(id)\`
- \`circuitBreaker.withdrawLimitAccumulator()\`
- \`circuitBreaker.globalWithdrawLimitConfig()\`
- \`circuitBreaker.withdrawLockdownUntil()\`
- live dashboard: https://circuit-breaker.lark.hydration.cloud
Contributor guide
Assessment
This issue has not been assessed yet.