Skip to content

feat(contact): multi-address contact support - #92

Merged
Gaubee merged 5 commits into
mainfrom
feat/contact-service
Dec 23, 2025
Merged

Gaubee merged 5 commits into
mainfrom
feat/contact-service

Conversation

@Gaubee

@Gaubee Gaubee commented Dec 23, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR adds multi-address support to the Contact model, allowing one contact to have multiple addresses for different chains.

Changes

Documentation

  • Created docs/white-book/04-服务篇/09-联系人服务/index.md - Contact service documentation
  • Updated docs/white-book/04-服务篇/02-链服务/实现规范/index.md - SDK integration docs

Contact Model Update

  • Contact.addresses: Changed from single address: string to addresses: ContactAddress[]
  • ContactAddress: New type with id, address, chainType, label (optional), isDefault
  • Data Migration: Automatically migrates v1 (single address) to v2 (multi address) format
  • Version: Store version bumped to 2

New Features

  • addressBookSelectors.getDefaultAddress(contact, chainType?) - Get preferred address for a chain
  • addressBookSelectors.suggestContacts(state, input) - Get contact suggestions for address input
  • detectAddressFormat(address) - Detect chain type from address format (Ethereum, TRON, Bitcoin, BioForest)

Component Updates

  • ContactEditJob: Multi-address editing UI (WIP)
  • TransferTab: Uses getDefaultAddress for quick contacts
  • AddressBookPage: Shows address count for multi-address contacts (+N indicator)
  • AddressBookPage: Initialize address book from storage on mount

Tests

  • Updated all unit tests for new Contact model
  • Added e2e tests for address book with contacts
  • Added e2e test for multi-address display
  • All 1382 unit tests pass
  • All 36 e2e page tests pass

Screenshots

Address Book - Empty

address-book-empty

Address Book - With Contacts

Shows multi-address indicator (+1, +2) for contacts with multiple addresses.
address-book-with-contacts

TODO (Future PR)

  • Complete ContactEditJob multi-address editing UI
  • Add AddressInput contact suggestions component

- Add 09-联系人服务 section to white-book
  - Multi-address contact model
  - Address format detection
  - Contact suggestions in address input
  - Integration with transfer flow

- Update 实现规范 with SDK integration details
  - BioForest SDK structure
  - Pay password flow diagram

- Add address-format.ts utility (WIP)
Core changes:
- Contact now has 'addresses: ContactAddress[]' instead of 'address: string'
- Each ContactAddress has chainType, label, isDefault
- Added data migration from v1 (single address) to v2 (multi address)
- Updated addressBookSelectors with suggestContacts()
- Updated ContactEditJob, TransferTab, AddressBookPage
- Added address-format detection utility

Still TODO:
- Update test files (address-book, migration, stories)
- Add AddressInput contact suggestions component
- Create PR
Changes:
- Contact now uses addresses: ContactAddress[] instead of single address
- Each ContactAddress has id, address, chainType, label (optional), isDefault
- Added data migration from v1 (single address) to v2 (multi address)
- Added addressBookSelectors.getDefaultAddress() and suggestContacts()
- Created address-format.ts with detectAddressFormat() utility
- Updated all tests, stories, and dependent components
- All 1382 tests pass
- Initialize address book from storage in AddressBookPage
- Add e2e test for address-book with contacts
- Add e2e test for multi-address contact display
- Update screenshots for all page tests
- Shows dropdown with matching contacts when typing
- Supports filtering by chainType
- Keyboard navigation (Arrow Up/Down, Enter, Escape)
- Added WithContactSuggestions story
@Gaubee
Gaubee merged commit 2aa53c5 into main Dec 23, 2025
5 checks passed
@Gaubee
Gaubee deleted the feat/contact-service branch January 4, 2026 07:22
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