Skip to content

feat: implement destroy asset feature and transfer enhancements - #199

Merged
Gaubee merged 24 commits into
mainfrom
feat/destroy-asset-feature
Jan 9, 2026
Merged

Gaubee merged 24 commits into
mainfrom
feat/destroy-asset-feature

Conversation

@Gaubee

@Gaubee Gaubee commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR implements the destroy (burn) asset feature for BioForest chain and includes several UI/UX improvements.

Features

  • Destroy Asset Feature: Burn/destroy non-main assets (BioForest-specific)
  • Transfer Page Enhancement: Asset selector with configurable locking
  • AmountDisplay Auto Mode: Adaptive decimal display using ResizeObserver

UI/UX Improvements

  • Refactored AssetSelector to use Select component instead of bottom sheet
  • Improved TokenItem with DropdownMenu for context actions
  • Fixed touch targets and layout issues for mobile
  • Added fixedDecimals='auto' mode for responsive amount display

Technical Changes

  • Canvas-based text measurement for performance
  • ResizeObserver pattern for adaptive layouts
  • Full precision display in confirmation dialogs and fee displays

Files Changed

  • src/components/asset/asset-selector.tsx - Refactored to use Select
  • src/components/common/amount-display.tsx - Added auto mode
  • src/components/token/token-item.tsx - Added dropdown menu
  • src/pages/destroy/ - New destroy page
  • Various confirmation dialogs and tests updated

Gaubee added 24 commits January 9, 2026 14:17
BioForest chain timestamps are relative to the genesis block's
beginEpochTime, not absolute Unix timestamps. This fix adds the
epoch time offset to correctly display transaction times.

Before: timestamps showed 1970 (only relative seconds * 1000)
After: timestamps show correct dates (relative seconds * 1000 + epochTime)

Changes:
- Add getBeginEpochTime() to fetch and cache epoch time from SDK
- Add toAbsoluteTimestamp() helper for timestamp conversion
- Fix getTransaction() to use absolute timestamps
- Fix getTransactionHistory() to use absolute timestamps
- Add top-level await to load labels from GitHub at startup
- Add getLabels() to list all available labels with colors
- Add createLabel() and ensureLabels() for label management
- Add --create-labels flag to auto-create missing labels
- Add --list-labels flag to display available labels grouped by prefix
- Update createIssue/createPr to validate labels before creation

Usage:
  pnpm agent task start --list-labels
  pnpm agent task start --type service --title 'Feature' --create-labels
Add [skip ci] to initial commit message to avoid triggering CI runners
for draft PRs. CI will run normally when task submit is called.
- Document workflow stages (start → develop → submit)
- Explain CI skip behavior for draft PRs
- Document label management features
- Add color inference rules for new labels
Rename the MCP tool from 'workflow' to 'use' for cleaner API:
- workflow___workflow -> workflow___use
- Update examples in dynamic description
- Add RuntimeContext to detect MCP vs CLI mode
- Support async description: string | () => string | () => Promise<string>
- Add formatScenarios() and formatDataSection() mode-aware formatters
- MCP mode set automatically in buildToolDescription and executeWorkflow

Usage example:
  description: async () => {
    const labels = await getLabels();
    return `Task management\n\n${formatScenarios('task', scenarios)}\n\n${formatDataSection('Labels', labels)}`;
  }
- Add AssetSelector component for selecting transfer/destroy assets
- Add TokenItem renderActions slot for custom action menus
- Create useBurn hook with bioforest-specific destroy logic
- Add DestroyPage with confirmation flow
- Enhance SendPage with AssetSelector for non-native assets
- Add WalletTab token menu (transfer/destroy options)
- Add bio_destroyAsset miniapp ecosystem handler
- Add MiniappDestroyConfirmJob sheet
- Add i18n translations (zh-CN, en)
- Add unit tests (25 new tests passed)
- str`...` returns () => Promise<string>
- str.scenarios(args) returns () => string
- str.data(title, items) returns () => string
- Remove StrPlaceholder wrapper, just use functions
…s, and more button

- Add onContextMenu prop to TokenItem with (event, token, context) signature
- Add long-press support (500ms) for touch devices
- Add more button (IconDotsVertical) when onContextMenu is provided
- Refactor WalletTab to use Sheet-based action menu instead of DropdownMenu
- Add token-item-actions.test.tsx with 9 tests for the feature
- str`` tagged template returns () => Promise<string>
- str.scenarios(args) formats commands based on runtime mode (CLI vs MCP)
- str.data(title, items) formats data sections by mode
- Resolve async descriptions in meta.mcp.ts with WorkflowNameContext
- Update task.workflow.ts to use str template for start workflow
- Add WithContextMenu and ContextMenuList stories to token-item.stories.tsx
- Fix DestroyPage story to remove non-existent imports
- Create token-item-context-menu.spec.ts with 3 tests for context menu feature
- Add baseline screenshots for visual regression testing
- Add token-context-menu.mock.spec.ts with 14 tests
- Test more button click, long press, right click triggers
- Test transfer and destroy action navigation
- Test main asset restriction (no destroy option for BFM)
- Add baseline screenshots for visual regression
- Fix SendPage: move useSend hook before code that references state/setAsset
  (fixes 'Cannot access state before initialization' error)
- Add menuItems prop to TokenItem for DropdownMenu-based actions
- Export TokenMenuItem type from token components
- Update TokenList and WalletAddressPortfolioView to support menuItems
- Refactor WalletTab to use tokenMenuItems instead of Sheet-based menu
- Remove Sheet import and action sheet state from WalletTab
…le UX

- Replace div-based layout with shadcn Item component (ItemMedia, ItemContent, ItemTitle, etc.)
- Replace DropdownMenu with ContextMenu for touch-friendly interaction
  - ContextMenu triggered by right-click (desktop) or long-press (mobile)
  - Entire item becomes the context menu trigger (no small button to tap)
- Add context-menu.tsx and item.tsx from shadcn base-ui
- Update tests to use new data-slot selectors
- Remove deprecated more button test (no longer applicable)
- Remove ContextMenu and long-press logic for simpler UX
- Use DropdownMenu triggered by more button (⋮) click
- Keep Item component from shadcn for consistent styling
- Update tests to reflect new menuItems behavior
- Remove ItemActions wrapper from DropdownMenu for proper flex layout
- Increase more button touch target to 44x44px (size-11)
- Add overflow-visible to ItemMedia to prevent ChainIcon clipping
- Use percentage-based sizing for ChainIcon (40% of parent)
- Add fixedDecimals='auto' mode that adapts decimals based on container width
- Use ResizeObserver pattern from AddressDisplay for responsive behavior
- Canvas-based text measurement for performance (no reflow)
- Three display modes: auto (default), true (full), false (hidden)
- Update AnimatedNumber/AnimatedAmount to support auto mode
- Add fixedDecimals={true} to confirmation dialogs and FeeDisplay
- Update tests to use aria-label queries for auto mode
@Gaubee
Gaubee merged commit 4eb6ca3 into main Jan 9, 2026
5 checks passed
@Gaubee
Gaubee deleted the feat/destroy-asset-feature branch January 9, 2026 14:25
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.

1 participant