Skip to content

Release: develop -> main#3519

Merged
TaprootFreak merged 11 commits intomainfrom
develop
Mar 27, 2026
Merged

Release: develop -> main#3519
TaprootFreak merged 11 commits intomainfrom
develop

Conversation

@github-actions
Copy link
Copy Markdown

Automatic Release PR

This PR was automatically created after changes were pushed to develop.

Commits: 1 new commit(s)

Checklist

  • Review all changes
  • Verify CI passes
  • Approve and merge when ready for production

…age (#3517)

* feat(auth): use browser language preference instead of IP-based language

- Add optional `language` parameter to SignUpDto
- Pass browser language from frontend to createUser
- Prefer browser language over IP-based country language
- Remove country-specific language defaults (CH/LI/DE/AT/IT/FR)
- Keep only currency defaults for CH/LI (CHF)

This fixes the issue where Swiss users always got German regardless
of their browser language setting. Language should be determined by
user preference (browser), not by geographic location.

* chore: cleanup

---------

Co-authored-by: David May <david.leo.may@gmail.com>
TaprootFreak and others added 5 commits March 27, 2026 15:59
Use InMemoryWalletRepository and InMemoryContractRepository instead of
IndexedDB variants, which are not available in Node.js server environment.
RULE_14 already skips the age-based phone check but not the
BIC/IBAN-based checks for banks like Swissquote. This adds
the same exception to both phone verification conditions.
* feat: add logging to account merge flow

Add DfxLogger to AccountMergeService to track merge requests and executions for audit purposes.

* refactor: use kyc_log table instead of AppInsights for merge logging

Persist merge events in kyc_log table for better audit trail:
- Log for both master and slave accounts
- Queryable per user in admin interface

* fix: add merge completion log for slave account

Ensure both master and slave accounts have the final merge log entry.

* feat: add request ID to merge log messages

Include AccountMerge request ID for easier correlation across log entries.

* chore: refactoring

---------

Co-authored-by: David May <david.leo.may@gmail.com>
* feat: add asset reconciliation endpoint for balance auditing

Add read-only admin endpoint GET /balance/reconciliation that verifies
start + inflows - outflows = end for any asset over a given period.
Supports blockchain, exchange, and bank assets with LM deduplication.

* fix: use accountIban for bank matching and parse symbol for exchange trades

- Bank flows: query by tx.accountIban instead of batch.iban (most bank_tx
  records link to the account IBAN directly, not via batch)
- Exchange trades: parse symbol field (e.g. "BTC/USDT") as fallback when
  currency/pair are null (Binance trade format)

* fix: exclude Lightning withdrawals and track exchange withdrawal fees

- Filter out Lightning Network withdrawals (lnbc* addresses) from
  blockchain inflow calculation — these don't hit the on-chain wallet
- Track withdrawal/deposit fees as exchange outflows (not just trade fees)
  to capture network fees deducted by exchanges like Binance

* fix: remove misleading liquidity.total fallback in balance extraction

Use only liquidityBalance.total for balance snapshots, falling back to 0
if missing. The previous liquidity.total fallback included paymentDeposit
balances which would produce inconsistent reconciliation results.

* refactor: align with codebase conventions

- Add @apitags('Balance') to ReconciliationController
- Add DfxLogger with warning on financial log parse failures
- Parameterize NOT LIKE pattern in QueryBuilder

* feat: add counter-accounts and tx resolution to reconciliation

Group flows by counter-account (exchange/customer), resolve LM order
correlationIds to blockchain txIds via ExchangeTx lookup, filter
zero-amount groups, and sub-group bank flows by transaction type.

* fix: resolve DfxDex counter-account to actual destination exchange

Parse destinationSystem from LM action params when system is DfxDex,
so counter-account shows Binance/BTC instead of DfxDex/BTC.

* feat: resolve counter-account asset IDs for clickable navigation

* fix: use blockchain asset as counter-account for exchange deposits/withdrawals

Resolves Binance/BTC showing itself as counter-account. Deposits and
withdrawals now correctly reference Bitcoin/BTC (the blockchain wallet).

* fix: prefix trade counter-accounts with exchange name

USDT → Binance/USDT, WBTC → Binance/WBTC for proper account names.

* fix: find primary blockchain asset by uniqueName pattern

Filter by uniqueName LIKE '%/BTC' to exclude DeFiChain/dBTC, and
order by ID to prefer Bitcoin/BTC over Lightning/BTC.

* feat: add full reconciliation overview with flows and differences

New endpoint GET /balance/reconciliation/overview runs reconciliation
for all assets, showing start/end balance, inflows, outflows, and
unexplained differences per account.

* fix: filter exchange withdrawals by hot wallet address per chain

Prevents ETH withdrawals to Ethereum mainnet from being counted as
inflows for Arbitrum/ETH, Optimism/ETH, etc. Uses blockchain-specific
wallet addresses from environment variables to filter.

* fix: add comment to empty catch block to satisfy linter

* chore: moved code + refactoring

---------

Co-authored-by: David May <david.leo.may@gmail.com>
* feat: add sell-if-deficit command to Scrypt adapter

Adds conditional selling of EUR for BTC on Scrypt when Bitcoin on-chain
has a deficit. Falls through to existing EUR→USDT sell if no BTC is needed.

DB setup required:
- Create action: system=Scrypt, command=sell-if-deficit,
  params={"tradeAsset":"BTC","checkAssetId":113}, onFailId=233
- Update rule 313: set redundancyStartActionId to new action

* feat: add migration for sell-if-deficit action and rule update

Creates the Scrypt sell-if-deficit action (EUR→BTC when Bitcoin has a
deficit, fallback to EUR→USDT via onFail=233) and updates rule 313 to
use it as the redundancy start action.

* feat: include missing amount

* chore: refactoring

* fix: format

---------

Co-authored-by: David May <david.leo.may@gmail.com>
TaprootFreak
TaprootFreak previously approved these changes Mar 27, 2026
…yManagementModule (#3520)

LiquidityManagementModule now imports BuyCryptoModule with forwardRef,
but BuyCryptoModule was importing LiquidityManagementModule without it.
Both sides need forwardRef for NestJS to resolve circular dependencies.
Remove InMemoryWalletRepository and InMemoryContractRepository from
Ark wallet creation - these may be causing slow imports that lead to
container startup timeouts on Azure.

This is a diagnostic change to isolate the cause of dev API downtime.
The migration hardcoded onFailId=233, which doesn't exist in the dev
database. This caused a FK constraint violation on every startup,
preventing the app from starting. Skip the entire migration if the
referenced action is not present.
The revert in #3522 was based on a misdiagnosis — the actual cause of
dev API downtime was a FK constraint violation in the sell-if-deficit
migration, not the Ark InMemory imports.

Without explicit storage config, the Ark SDK falls back to IndexedDB
which is not available in Node.js, causing wallet initialization to fail.
@TaprootFreak TaprootFreak merged commit c964c89 into main Mar 27, 2026
12 checks passed
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