Conversation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Show discount in UI
…-failed-to-rebalancer Add handling for partial failed to rebalancer
Contributor
There was a problem hiding this comment.
Pull request overview
This release PR bundles multiple product and operational updates across the shared types, API, SDK, rebalancer, and frontend widget—most notably adding a quote-less KYB deep-link flow and introducing “quote-time discount” display fields derived from subsidy snapshots.
Changes:
- Add KYB deep link support (widget URL params, region selection, KYB routing, docs + manifest updates).
- Add public discount display fields (
discountFiat/discountUsd/discountCurrency) to quote + ramp status responses, backed by quote-time subsidy snapshots. - Expand Base rebalancer capabilities (nonce manager, cost policy + daily limits, ticket polling utilities, Slack notification formatting) and tighten typing/error handling across packages; enable Biome verification in CI.
Reviewed changes
Copilot reviewed 131 out of 134 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/shared/src/substrateEvents/xcmParsers.ts | Tighten XCM event JSON typing. |
| packages/shared/src/services/xcm/moonbeamToAssethub.ts | Stronger typing for XCM execute call. |
| packages/shared/src/services/nabla/contractRead.ts | Type Abi constructor input instead of any. |
| packages/shared/src/services/evm/clientManager.ts | Improve retry logging + sanitize messages once. |
| packages/shared/src/services/evm/clientManager.test.ts | Add logging assertions for non-retry path. |
| packages/shared/src/services/brla/types.ts | Add optional outputPaymentMethod; extend ticket statuses. |
| packages/shared/src/services/brla/brlaApiService.ts | Allow configurable outputPaymentMethod defaulting to Polygon. |
| packages/shared/src/index.ts | Reorder exports and re-add tokens export. |
| packages/shared/src/endpoints/ramp.endpoints.ts | Add discount fields to ramp status response type. |
| packages/shared/src/endpoints/quote.endpoints.ts | Add discount fields to quote response type. |
| packages/shared/src/endpoints/brla.endpoints.ts | Make quoteId optional for KYB deep link. |
| packages/sdk/src/storage.ts | Replace any with unknown; safer ENOENT detection. |
| packages/sdk/src/handlers/BrlHandler.ts | Replace any[] with PresignedTx[] typing. |
| packages/sdk/src/errors.ts | Harden API error parsing and error payload typing. |
| package.json | Bump @scure/bip39 version range. |
| docs/security-spec/README.md | Add FastForex entry; expand glossary. |
| docs/security-spec/AUDIT-RESULTS.md | Update audit narrative for Base/legacy flows. |
| docs/security-spec/07-operations/secret-management.md | Document EVM_ACCOUNT_SECRET + legacy Pendulum secret. |
| docs/security-spec/05-integrations/fastforex.md | New FastForex hardening/security spec. |
| docs/security-spec/05-integrations/brla.md | Document quote-less KYB deep link + PARTIAL-FAILED semantics. |
| docs/security-spec/03-ramp-engine/quote-lifecycle.md | Document optional subsidy display fields + snapshot invariant. |
| docs/security-spec/03-ramp-engine/fee-integrity.md | Clarify discount display must not mutate charged fees. |
| docs/security-spec/03-ramp-engine/discount-mechanism.md | Add discount snapshot + AMM-only minimum invariant notes. |
| docs/api/pages/13-kyb-deep-link.md | New public docs page for KYB deep link. |
| docs/api/openapi/vortex.openapi.json | Document quoteId optionality for createSubaccount. |
| docs/api/apidog/page-manifest.json | Add KYB deep link page to docs manifest. |
| contracts/relayer/test/relayer-execution.ts | Avoid any in catch; safer error formatting. |
| contracts/relayer/test/relayer-execution-squid.ts | Remove unused ABI; safer catch error formatting. |
| bun.lock | Lockfile updates for bip39/catalog changes. |
| biome.json | Expand ignore patterns; enable VCS ignore integration. |
| apps/rebalancer/src/utils/nonce.ts | New nonce manager helper. |
| apps/rebalancer/src/utils/config.ts | Switch to EVM_ACCOUNT_SECRET; add cost policy + limits parsing. |
| apps/rebalancer/src/utils/config.test.ts | New tests for config parsing and policy validation. |
| apps/rebalancer/src/utils/brla.ts | New Avenia ticket polling + PARTIAL-FAILED handling helper. |
| apps/rebalancer/src/utils/brla.test.ts | Tests for ticket polling terminal behaviors. |
| apps/rebalancer/src/services/stateManager.test.ts | New test for persisted opportunistic policy fields. |
| apps/rebalancer/src/services/indexer/index.ts | Add Base Nabla coverage ratio fetch via EVM contracts. |
| apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.test.ts | Add tests for resume/recovery logic and validations. |
| apps/rebalancer/src/rebalance/usdc-brla-usdc-base/notifications.ts | New Slack notification formatting utilities. |
| apps/rebalancer/src/rebalance/usdc-brla-usdc-base/notifications.test.ts | Tests for Slack message formatting. |
| apps/rebalancer/src/rebalance/usdc-brla-usdc-base/guards.ts | New policy/daily-limit guard logic. |
| apps/rebalancer/src/rebalance/usdc-brla-usdc-base/guards.test.ts | Tests for guard logic and thresholds. |
| apps/rebalancer/src/rebalance/usdc-brla-usdc-base/dailyLimit.ts | New daily bridge limit orchestration helpers. |
| apps/rebalancer/src/rebalance/usdc-brla-usdc-base/dailyLimit.test.ts | Tests for daily-limit logic and history aggregation. |
| apps/rebalancer/src/rebalance/brla-to-usdc-base/notifications.ts | New Slack message formatting for BRLA→USDC Base flow. |
| apps/rebalancer/src/rebalance/brla-to-usdc-base/notifications.test.ts | Tests for BRLA→USDC Base notifications formatting. |
| apps/rebalancer/src/rebalance/brla-to-usdc-base/index.ts | New Base BRLA→USDC rebalance flow implementation. |
| apps/rebalancer/src/rebalance/brla-to-usdc-base/guards.ts | New daily swap limit guard (BRLA→USDC). |
| apps/rebalancer/src/rebalance/brla-to-axlusdc/steps.ts | Use shared ticket poller; adjust typing + BRLA swap amount formatting. |
| apps/rebalancer/src/rebalance/brla-to-axlusdc/index.ts | Use dedicated state manager; phase-order constants; safer logging. |
| apps/rebalancer/README.md | Document new env vars + Base policy behavior. |
| apps/rebalancer/.env.example | Update env var names + add policy/limit knobs. |
| apps/frontend/vite.config.ts | Switch to hidden sourcemaps. |
| apps/frontend/src/types/searchParams.ts | Add kyb / kybLocked query params schema. |
| apps/frontend/src/translations/pt.json | Add KYB region selector + discount UI strings; CNPJ validation copy. |
| apps/frontend/src/translations/en.json | Add KYB region selector + discount UI strings; CNPJ validation copy. |
| apps/frontend/src/stories/RampFollowUpRedirectStep.stories.tsx | Replace any casts with typed props. |
| apps/frontend/src/stories/RampFeeCollapse.stories.tsx | New story demonstrating discount display. |
| apps/frontend/src/stories/AveniaLivenessStep.stories.tsx | Replace any casts with typed props. |
| apps/frontend/src/stories/AveniaFormStep.stories.tsx | Type story form wrapper inputs. |
| apps/frontend/src/services/transactions/userSigning.ts | Reject with Error objects and include dispatchError message. |
| apps/frontend/src/services/api/polkadot.service.ts | Avoid double-creation; return cached API promise. |
| apps/frontend/src/services/api/brla.service.ts | Return empty object type safely (Record<string, never>). |
| apps/frontend/src/services/api/api-client.ts | Improve ApiError message grouping for Sentry. |
| apps/frontend/src/routes/{-$locale}.tsx | Default locale from pinned KYB region for deep links. |
| apps/frontend/src/pages/widget/index.tsx | Add region selector + KYB completion screen wiring. |
| apps/frontend/src/pages/quote/index.tsx | Remove overflow-hidden from quote container. |
| apps/frontend/src/main.tsx | Move Sentry init after router; add React 19 root error handlers. |
| apps/frontend/src/machines/types.ts | Add KYB link context + events and post-auth routing target. |
| apps/frontend/src/machines/ramp.machine.ts | Add START_KYB_LINK flow; central PostAuthRouting; KYB terminal state. |
| apps/frontend/src/machines/ramp.context.ts | Initialize KYB link context. |
| apps/frontend/src/machines/kyc.states.ts | Route KYC provider via quote-less KYB selection; adjust GO_BACK behavior. |
| apps/frontend/src/machines/alfredpayKyc.machine.ts | Route business KYB flow for MX/CO; harden 404 detection typing. |
| apps/frontend/src/machines/actors/brla/createSubaccount.actor.ts | Allow createSubaccount without quoteId for KYB deep link. |
| apps/frontend/src/hooks/useStepBackNavigation.ts | Hide back button appropriately for locked KYB entry. |
| apps/frontend/src/hooks/useRampUrlParams.ts | Parse KYB deep-link params; auto-start KYB link flow in widget. |
| apps/frontend/src/hooks/brla/useKYBForm/index.tsx | Optionally require CNPJ-only validation in quote-less KYB. |
| apps/frontend/src/constants/kybRegions.ts | New KYB region mapping (region→fiatToken + defaultLocale). |
| apps/frontend/src/components/widget-steps/SummaryStep/USOnrampDetails.tsx | Remove unused isQuoteExpired destructure. |
| apps/frontend/src/components/widget-steps/SummaryStep/TransactionTokensDisplay.tsx | Pass discount payload into FeeDetails when present. |
| apps/frontend/src/components/widget-steps/SummaryStep/FeeDetails.tsx | Show “effective fee” and discount line item. |
| apps/frontend/src/components/widget-steps/RegionSelectStep/index.tsx | New KYB region selector UI step. |
| apps/frontend/src/components/ui/DropdownSelector.tsx | Adjust transitions; avoid initial AnimatePresence animation. |
| apps/frontend/src/components/StatusBadge/index.tsx | Improve a11y: show link affordance on focus/hover. |
| apps/frontend/src/components/RampFeeCollapse/index.tsx | Add discount line item and effective fee total. |
| apps/frontend/src/components/Navbar/SolutionsDropdown.tsx | Make dropdown trigger keyboard-accessible. |
| apps/frontend/src/components/menus/HistoryMenu/TransactionItem/index.tsx | Remove hover state plumbing from transaction items. |
| apps/frontend/src/components/Globe/index.tsx | Fix exhaustive-deps warning by capturing refs safely. |
| apps/frontend/src/components/ComparisonSlider/index.tsx | Add keyboard-accessible slider semantics. |
| apps/frontend/src/components/Avenia/AveniaKYBForm.tsx | Support quote-less KYB by allowing editable CNPJ input. |
| apps/api/src/models/user.model.ts | Formatting/style alignment. |
| apps/api/src/models/kycLevel2.model.ts | Replace any with unknown types. |
| apps/api/src/models/apiKey.model.ts | Type partners association as Partner[]. |
| apps/api/src/database/migrator.ts | Safer error handling + typed QueryInterface wrappers. |
| apps/api/src/database/migrations/029-create-mykobo-customers-table.ts | Deduplicate enum drop logic with helper. |
| apps/api/src/database/migrations/023-create-alfredpay-customers-table.ts | Deduplicate enum drop logic with helper. |
| apps/api/src/database/migrations/022-add-user-id-to-entities.ts | Safer unknown error handling for down migration. |
| apps/api/src/database/migrations/021-create-users-table.ts | Formatting/style alignment. |
| apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts | Safer Ethereum USDC fallback token resolution. |
| apps/api/src/api/services/transactions/onramp/common/transactions.ts | Use AMM-only output snapshot for swap minimums. |
| apps/api/src/api/services/transactions/onramp/common/transactions.test.ts | Add tests ensuring minimums use AMM-only output. |
| apps/api/src/api/services/transactions/offramp/routes/evm-to-alfredpay.ts | Guard unsupported network chainId. |
| apps/api/src/api/services/spreadsheet.service.ts | Log header-check failures instead of swallowing. |
| apps/api/src/api/services/ramp/ramp.service.ts | Include discount snapshot fields in status responses. |
| apps/api/src/api/services/quote/engines/nabla-swap/onramp-mykobo-evm.ts | Persist AMM-only output snapshot fields. |
| apps/api/src/api/services/quote/engines/nabla-swap/onramp-evm.ts | Persist AMM-only output snapshot fields. |
| apps/api/src/api/services/quote/engines/nabla-swap/base-evm.ts | Store AMM-only output fields in context. |
| apps/api/src/api/services/quote/engines/nabla-swap/base-evm.test.ts | Test AMM-only fields are set. |
| apps/api/src/api/services/quote/engines/merge-subsidy/offramp-evm.test.ts | Test AMM-only output preserved under subsidy merge. |
| apps/api/src/api/services/quote/engines/finalize/index.ts | Snapshot subsidy into discount display fields at quote time. |
| apps/api/src/api/services/quote/engines/finalize/index.test.ts | Tests for discount display serialization behavior. |
| apps/api/src/api/services/quote/engines/fee/offramp-avenia.ts | Replace non-null assertions with explicit validation. |
| apps/api/src/api/services/quote/engines/discount/onramp.ts | Replace non-null assertions with explicit validation. |
| apps/api/src/api/services/quote/engines/discount/onramp-alfredpay.ts | Replace non-null assertions with explicit validation. |
| apps/api/src/api/services/quote/core/types.ts | Add AMM-only output + subsidyDisplay context fields. |
| apps/api/src/api/services/priceFeed.service.ts | Add strict conversion core + nullable conversion helper. |
| apps/api/src/api/services/phases/handlers/moonbeam-to-pendulum-xcm-handler.ts | Avoid unused caught error binding. |
| apps/api/src/api/services/phases/handlers/brla-payout-base-handler.ts | Replace any with unknown; safer error-message formatting. |
| apps/api/src/api/services/phases/handlers/alfredpay-onramp-mint-handler.ts | Add typed failed-status guard. |
| apps/api/src/api/services/phases/handlers/alfredpay-offramp-transfer-handler.ts | Add typed failed-status guard + safer error formatting. |
| apps/api/src/api/services/auth/supabase.service.ts | Return typed Supabase User and validate existence. |
| apps/api/src/api/routes/v1/quote.route.ts | Document discount fields in API docblock. |
| apps/api/src/api/middlewares/supabaseAuth.ts | Add Biome ignore note for Express namespace augmentation. |
| apps/api/src/api/middlewares/auth.ts | Make derivedMemo optional; add Biome ignore note. |
| apps/api/src/api/controllers/metrics.controller.ts | Improve typing and error handling; remove any usage. |
| apps/api/package.json | Use workspace catalog for bip39. |
| .github/workflows/ci.yml | Add bun run verify (Biome) to CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.