Skip to content

fix: [codex] Only count completed Binance withdrawals in callers#3176

Merged
nicholaspai merged 5 commits intomasterfrom
npai/codex/binance-completed-withdrawal-filtering
Apr 8, 2026
Merged

fix: [codex] Only count completed Binance withdrawals in callers#3176
nicholaspai merged 5 commits intomasterfrom
npai/codex/binance-completed-withdrawal-filtering

Conversation

@nicholaspai
Copy link
Copy Markdown
Member

@nicholaspai nicholaspai commented Apr 7, 2026

What changed

  • add isCompletedBinanceWithdrawal() in src/utils/BinanceUtils.ts
  • update callers that interpret Binance withdrawal history as completed fund movement to filter to completed withdrawals first
  • apply that filtering in:
    • src/finalizer/utils/binance.ts
    • src/adapter/bridges/BinanceCEXBridge.ts
    • src/adapter/l2Bridges/BinanceCEXBridge.ts
  • add a focused unit test for the completed-withdrawal helper

Why

getBinanceWithdrawals() is a generic history fetcher and should continue returning the raw Binance history. But several callers are using that history for accounting or receipt lookups that only make sense once a withdrawal has actually completed.

Before this change, those callers could count non-completed Binance withdrawals as if funds had already moved. This PR keeps the shared utility generic and fixes the behavior at the call sites that require completed-only semantics.

Validation

  • yarn test test/BinanceUtils.ts
  • yarn eslint src/utils/BinanceUtils.ts src/adapter/bridges/BinanceCEXBridge.ts src/adapter/l2Bridges/BinanceCEXBridge.ts src/finalizer/utils/binance.ts test/BinanceUtils.ts
  • yarn build

@nicholaspai nicholaspai force-pushed the npai/codex/binance-completed-withdrawal-filtering branch from 3a6ab0a to 5aa1b72 Compare April 7, 2026 22:00
@nicholaspai nicholaspai changed the base branch from npai/codex/binance-withdraw-failure-handling to master April 7, 2026 22:00
@nicholaspai nicholaspai marked this pull request as ready for review April 7, 2026 22:01
pxrl
pxrl previously approved these changes Apr 8, 2026
* handle failed Binance withdrawals

* preserve failed Binance withdrawal tags

* match only terminal Binance withdrawals

* reuse Binance withdrawal status enum
@nicholaspai nicholaspai merged commit 2705af7 into master Apr 8, 2026
4 checks passed
@nicholaspai nicholaspai deleted the npai/codex/binance-completed-withdrawal-filtering branch April 8, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants