Repository navigation
fix: drop withdrawal type options below the asset minimum (ORD-2049) - #619
aaronmboyd wants to merge 1 commit into
Conversation
|
📦 Preview published under the Install the exact version(s) — npm i @lifi/perps-sdk@0.0.0-preview-3530448 |
There was a problem hiding this comment.
Zeus QA Review — ORD-2049 · #619
Verdict: ✅ Approve — 0 Critical · 0 High · 0 Medium · 0 Low
getWithdrawalTypes now syncs the asset registry and drops every option whose max is below the source asset's minWithdrawalAmount.
All six acceptance criteria are met:
- Shared helper.
minWithdrawalAmountOfis lifted verbatim fromgetWithdrawableBalances, so both methods use the same parse and the sameSDKErrormessage. - Decimal math. The filter keeps an option when
max >= minimum, using!isDecimalStringGreaterThan(minimum, max). There is no float math, and an equalmaxstays. - Rows returned unchanged. A row with no minimum, or whose asset is not in the registry, comes back as the same object.
- No mutation. Rows are rebuilt with a spread, so the plugin's array is not touched.
- Plugin result.
undefinedfrom the plugin still returnsundefined, and no/assetsread happens in that case. - Sync call.
registry.sync()takes no arguments, as in the other call sites.
Specs cover the regression (FAST 0.134502 against a 1.000000 minimum gives STANDARD only), the equal and above cases, a missing minimum, an asset the registry does not carry, and a non-decimal minimum. The README and TSDoc are updated, and the patch changeset is correct.
🔵 Notes, none of them gating:
- CI
checkswas still pending when I reviewed, and I did not re-run the gates. getWithdrawalTypescan now throw if the/assetssync fails. The TSDoc discloses this, and it matchesgetWithdrawableBalances.- A row whose options are all removed stays in the result with
options: []. The author discloses this, and it cannot happen for Lighter today. - The live withdraw-sheet check is for a human, through the follow-up widget pin bump (ORD-2052).
Zeus QA Review — ORD-2049 · #619Verdict: ✅ Approve — 0 Critical · 0 High · 0 Medium · 0 Low
All six acceptance criteria are met:
Specs cover the regression (FAST 0.134502 against a 1.000000 minimum gives STANDARD only), the equal and above cases, a missing minimum, an asset the registry does not carry, and a non-decimal minimum. The README and TSDoc are updated, and the patch changeset is correct. 🔵 Notes, none of them gating:
|
Closes ORD-2049
Linear: https://linear.app/lifi-linear/issue/ORD-2049
Intent
PerpsClient.getWithdrawalTypesnow joins each source asset against the core/assetsregistry and removes each option whosemaxis below the asset'sminWithdrawalAmount. The Lighter FAST option with a 0.134502 USDC cap no longer appears next to a 1.000000 USDC minimum.What changed
packages/perps-sdk/src/client/PerpsClient.tsminWithdrawalAmountOf(asset). It holds the parse and theSDKErrormessage thatgetWithdrawableBalanceshad inline.getWithdrawableBalancesnow calls it, and its behaviour does not change.getWithdrawalTypessyncs the asset registry after the plugin read. For each row, it looks uprow.source.asset.id. When the asset has a minimum, it keeps only the options wheremax >= minimum(isDecimalStringGreaterThan, no floats). A row whose asset has no minimum, or that the registry does not carry, is returned as the same object.minWithdrawalAmount).packages/perps-sdk/README.md: one sentence on the removal rule in thegetWithdrawalTypes()paragraph.lighterWithdrawalTypesdoes not change. The venue cap stays verbatim.Assumptions
optionsarray. This cannot occur for Lighter today: the STANDARDmaxequals the rowmax, andgetWithdrawableBalancesalready removes a row whoseavailableis below the minimum.getWithdrawalTypesnow does one/assetsread (cached by the registry) per call. That is the same cost asgetWithdrawableBalances.Tests
packages/perps-sdk/src/client/PerpsClient.unit.spec.ts,describe('getWithdrawalTypes'):max0.134502 with a 1.000000 minimum gives STANDARD only (regression).max25 and FASTmax1 (equal to the minimum) keep both options.minWithdrawalAmountkeeps all options.minWithdrawalAmountthat is not a decimal throws the sameSDKErrormessage asgetWithdrawableBalances./assetsand assertstoEqualin place oftoBe.The
getWithdrawableBalancescases are unchanged and pass.Follow-ups
(none). ORD-2052 (widget pin bump) already exists and this issue blocks it.
Dependencies / upstream branches
None. A human runs the release after merge. ORD-2052 consumes the published
@lifi/perps-sdkpatch.