Repository navigation
feat(biobridge): upgrade forge to BioBridge with redemption support - #230
Merged
Merged
Conversation
The IconCircle component from @biochain/key-ui expects ReactNode (elements) but was receiving Component functions, causing 'Objects are not valid as React child' error during token transfers. Fixed 7 occurrences across: - send-result.tsx - pattern-lock-setup.tsx - recover.tsx - wallet-chains.tsx - create.tsx
When assetType is specified in URL params (e.g. ?assetType=CPCC), the previous code would immediately fallback to native asset if tokens hadn't loaded yet, then get overwritten again causing a flicker. Now returns null from initialAsset when tokens are still loading, allowing the useEffect to properly set the asset once tokens are available.
Tests verify that: - assetType param correctly selects the specified token after async load - Unknown assetType falls back to native asset
- SendPage: use explorer.queryTx to open block explorer, disable button if not configured - TransferWalletLockJob: add onViewExplorer callback to TxStatusDisplay - DestroyPage: same fix as SendPage - TxStatusDisplay: add onViewExplorer prop for explorer link button
Previously assetType was hardcoded to chainConfig.symbol (native asset), causing all token transfers to incorrectly use the native asset (e.g., BFM) instead of the user-selected token (e.g., CPCC). Changes: - Add assetType param to SubmitBioforestParams interface - Pass state.asset.assetType in submit and submitWithTwoStepSecret
- Add PendingTxService for managing unconfirmed transaction lifecycle - Schema: PendingTxSchema with status, rawTx, meta fields - Service: IndexedDB storage with CRUD operations - States: created -> broadcasting -> broadcasted -> confirmed/failed - Add BroadcastError class with i18n error code translation - Zod Schema for BroadcastResult validation - Error codes: 001-11028 (asset not enough), 001-11029 (fee not enough) - translateBroadcastError() for user-friendly messages - Fix broadcast error handling in hooks - Remove silent .catch() that hid broadcast failures - Properly catch and translate BroadcastError - Return error status with translated message - Add i18n translations for broadcast errors - zh-CN/en: broadcast.assetNotEnough, feeNotEnough, rejected, unknown - zh-CN/en: pendingTx.title, broadcasting, broadcasted, failed, retry, delete
- Add redemption API client (submitRedemption, getRecords, retryInternal/External) - Add useRedemption and useRedemptionRecords hooks - Add RedemptionForm and ModeTabs UI components - Add fee calculation utilities (lib/fee.ts) - Rewrite App.tsx with dual-mode (recharge/redemption) architecture - Update branding from 锻造/Forge to 跨链通/BioBridge - Update manifest.json, package.json with new identity - Add all redemption-related i18n translations (en, zh-CN, zh-TW) - Update tests for new branding BREAKING CHANGE: App renamed from forge to biobridge with new dual-mode UI
…used imports - Replace BigInt/parseFloat with big.js for accurate ratio fee calculation - Remove unused Loader2 import from RedemptionForm - Remove unused onBack parameter from RedemptionForm - Add big.js and @types/big.js dependencies
- Update e2e/helpers/i18n.ts with new BioBridge branding - Update e2e/ui.spec.ts tests for new UI structure - Add RedemptionMode story to App.stories.tsx - Update mock config with redemption parameters - Regenerate E2E screenshots for new UI - Remove token picker tests (functionality changed in new UI)
… mode tests - Add redemption config to mockApiResponses (enable, min, max, fee, radioFee) - Add redemption API endpoint mock - Add test '09 - mode tabs visible' to verify mode tabs display - Add test '09b - redemption mode UI' to verify redemption mode works - Regenerate all screenshots with mode tabs visible
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.
Summary
Upgrade the forge (锻造) miniapp to BioBridge (跨链通) with dual-mode bridge functionality:
Changes
API Layer
redemption.ts) with endpoints:submitRedemption- Submit redemption requestgetRecords- Fetch redemption historygetRecordDetail- Get single record detailretryInternalOnChain/retryExternalOnChain- Retry failed transactionsREDEMPTION_ORDER_STATE_ID,REDEMPTION_RECORD_STATE, DTOs)Hooks
useRedemption- Redemption flow (create tx → sign → submit)useRedemptionRecords- Record listing and detail fetchingUI Components
RedemptionForm- Full redemption UI with option selection, amount input, address input, fee previewModeTabs- Tab switcher for recharge/redemption modesFee Calculation
lib/fee.ts-calculateRedemptionFee,formatAmount,parseAmount,isAmountWithinLimitsApp Integration
App.tsxwith dual-mode architectureBranding
manifest.json(id, name, version, theme colors)package.json(name: @biochain/miniapp-biobridge)Testing
Breaking Changes
App renamed from forge to biobridge with new dual-mode UI. No backward compatibility needed per requirements.