Skip to content

[codex] Add address book transfer history#31

Closed
Jim8y wants to merge 7 commits into
neoorder:masterfrom
Jim8y:codex/pro-address-book
Closed

[codex] Add address book transfer history#31
Jim8y wants to merge 7 commits into
neoorder:masterfrom
Jim8y:codex/pro-address-book

Conversation

@Jim8y

@Jim8y Jim8y commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

English

Purpose

This PR adds a first-pass professional address book for OneGate wallet transfers. The goal is to make recipient selection safer and more user-friendly by supporting saved contacts, recent transfer recipients, name/address search, transfer-aware contact details, and consistent recipient selection in token and NFT send flows.

What changed

  • Added an AddressBookService that normalizes Neo addresses, resolves saved contact names, returns address suggestions, and records successful transfer recipients.
  • Extended contacts with notes, address-book vs. recent-recipient status, last-used metadata, transfer counts, and the last transaction hash.
  • Added a ContactTransfers history table and migration so saved contacts can show related transfer records.
  • Updated Address Book list rows to show display name, badge, note/last-used detail, address, copy action, and detail navigation.
  • Updated Add/Edit Contact pages with notes, saved-contact upgrades from recent recipients, associated transaction lists, and a transaction detail page.
  • Updated token and NFT send flows so users can pick from the address book, type a saved contact name or address, see suggestions while typing, and record successful recipients after a transaction is sent.
  • Updated the recipient picker popup to use the same search and display model as the address book.
  • Tightened mobile shell tab behavior so secondary pages such as Address Book, Send, and Edit Contact use full-height layouts without the root tab bar.
  • Posted Android and iOS screenshots in a PR comment instead of keeping screenshots in the codebase.

User impact

  • Users can save an address with a name and note.
  • Users can select a recipient from the address-book button next to the send recipient field.
  • Users can type a saved name or address and choose from suggestions under the recipient field.
  • Saved contacts display the friendly name first, with the full address and note visible as supporting context.
  • Successful transfers record the recipient as a recent address, so addresses that are not saved still become available as recent recipients.
  • Deleting a saved contact with prior transfers now keeps the recent-recipient history instead of deleting the historical recipient row.

Validation

  • xmllint --noout OneGateApp/Pages/*.xaml OneGateApp/Controls/Popups/*.xaml OneGateApp/AppShell.xaml passed.
  • git diff --check passed.
  • Android build passed: dotnet build OneGateApp/OneGateApp.csproj -f net10.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true.
  • iOS Simulator build passed: dotnet build OneGateApp/OneGateApp.csproj -f net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64 -p:EnableCodeSigning=false -p:CodesignKey= -p:CodesignProvision= -p:ProvisioningType=automatic.
  • Installed the Android APK on emulator-5554, launched OneGate, and verified Address Book list, contact detail, focused recipient suggestions, selected recipient preview, and recipient picker popup through real UI operations.
  • Installed the iOS Simulator app on iPhone 17 Pro, launched OneGate, seeded the same test wallet/settings data, and verified it reaches the wallet home screen.
  • Android crash buffer was empty after the final install and launch.
  • Screenshots are posted in a PR comment.
  • The build still reports pre-existing NU1903 warnings for SQLitePCLRaw.lib.e_sqlite3*; this PR does not add those package advisories.

中文

目的

这个 PR 为 OneGate 钱包转账添加第一轮专业地址簿。目标是通过保存联系人、最近转账收款人、姓名/地址搜索、与转账历史关联的联系人详情,以及在代币和 NFT 发送流程中一致的收款人选择体验,让收款人选择更安全、更用户友好。

修改内容

  • 添加 AddressBookService,用于规范化 Neo 地址、解析已保存联系人名称、返回地址建议,并记录成功转账的收款人。
  • 扩展联系人数据,增加备注、地址簿/最近收款人状态、最后使用时间、转账次数和最后交易哈希。
  • 添加 ContactTransfers 历史表和迁移,让已保存联系人可以展示关联转账记录。
  • 更新地址簿列表行,展示显示名称、标记、备注/最后使用详情、地址、复制操作和详情导航。
  • 更新新增/编辑联系人页面,支持备注、从最近收款人升级为已保存联系人、关联交易列表和交易详情页。
  • 更新代币和 NFT 发送流程,让用户可以从地址簿选择、输入已保存联系人名称或地址、在输入时查看建议,并在交易成功发送后记录收款人。
  • 更新收款人选择弹窗,使它使用与地址簿相同的搜索和展示模型。
  • 收紧移动端 Shell 底部导航行为,让地址簿、发送、编辑联系人等二级页面使用完整高度布局,不再显示根页面底部 tab bar。
  • 将 Android 和 iOS 截图发布到 PR 评论中,不再把截图保留在代码库里。

用户影响

  • 用户可以用名称和备注保存地址。
  • 用户可以通过发送页收款人输入框右侧的地址簿按钮选择收款人。
  • 用户可以输入已保存名称或地址,并从收款人输入框下方的建议中选择。
  • 已保存联系人优先展示友好名称,并把完整地址和备注作为辅助上下文展示。
  • 成功转账会记录收款人为最近地址,所以未保存的地址也会作为最近收款人出现。
  • 删除有历史转账的已保存联系人时,现在会保留最近收款人历史,而不是删除历史收款人行。

验证

  • xmllint --noout OneGateApp/Pages/*.xaml OneGateApp/Controls/Popups/*.xaml OneGateApp/AppShell.xaml 通过。
  • git diff --check 通过。
  • Android 构建通过:dotnet build OneGateApp/OneGateApp.csproj -f net10.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true
  • iOS Simulator 构建通过:dotnet build OneGateApp/OneGateApp.csproj -f net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64 -p:EnableCodeSigning=false -p:CodesignKey= -p:CodesignProvision= -p:ProvisioningType=automatic
  • 将 Android APK 安装到 emulator-5554,启动 OneGate,并通过真实 UI 操作验证了地址簿列表、联系人详情、聚焦后的收款人建议、选择后的收款人预览和收款人选择弹窗。
  • 将 iOS Simulator app 安装到 iPhone 17 Pro,启动 OneGate,种入同一份测试钱包/settings 数据,并验证可以进入钱包首页。
  • 最终安装和启动后 Android crash buffer 为空。
  • 截图已发布到 PR 评论中。
  • 构建仍会报告既有的 SQLitePCLRaw.lib.e_sqlite3* NU1903 警告;这些包安全公告不是本 PR 新增的。

@erikzhang

Copy link
Copy Markdown
Contributor

Please remove the screenshots.

@Jim8y

Jim8y commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Screenshots / 截图

Screenshots are posted here for review only. They were removed from the PR file tree so they will not be merged into the codebase.

截图只放在这里供 review 使用;截图文件已经从 PR 文件树中移除,不会合并进代码库。

Android wallet tab
Android address book
Android contact detail
Android send focused suggestions
Android send selected contact
Android recipient picker
iOS wallet home

@Jim8y

Jim8y commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Reviewed the external PR #31 audit and addressed the wallet-safety blockers.

Fixed:

  • Duplicate address-book labels are no longer resolved nondeterministically. Exact name resolution now succeeds only when the label maps to exactly one address; ambiguous legacy labels are not auto-resolved.
  • New/edit contact flows now validate that saved address-book names are unique, with localized LabelAlreadyExists messages.
  • Send and Send NFT now resolve the recipient from the current field at submit time instead of relying on validator side effects or stale ResolvedToAddress state. Explicitly selected contacts remain valid even if legacy data contains duplicate labels.
  • RecordTransferAsync now runs after SendRawTransaction succeeds and has its own failure isolation, so local history DB errors cannot be shown as transaction broadcast failures after a transaction has already been relayed.
  • Send NFT now clears selected-recipient state on manual address edits, matching the token send flow and avoiding stale selected addresses.
  • Contact avatar initials now use StringInfo.GetNextTextElement(...) instead of slicing one UTF-16 code unit.

Reviewed but not expanded in this patch:

  • Transfer-history rows intentionally remain after contact deletion because they are also used for recent-recipient history.
  • The existing synchronous edit-page lookup and per-keystroke query behavior are lower-priority polish compared with the send-path fixes above.
  • The pre-existing sign-failure flow in Send/Send NFT is inherited from master and was not widened into this PR fix.

Validation repeated:

  • xmllint --noout for edited XAML/resx files
  • git diff --check
  • Android build: passed
  • iOS simulator build: passed

Known warning remains pre-existing: SQLitePCLRaw NU1903 warnings from the dependency graph. No screenshots or binary assets were added to the PR file tree.

@Jim8y Jim8y marked this pull request as ready for review June 19, 2026 10:57
@erikzhang

Copy link
Copy Markdown
Contributor

Please remove irrelevant changes.

@Jim8y

Jim8y commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up on the scope feedback:

  • Removed the unrelated Shell/tabbar behavior change from this PR in 3bbc1ed; the PR diff now keeps only the address-book transaction-detail route in AppShell.xaml.cs.
  • Split the address-book data/service foundation into smaller PR Add address book data service #37 so it can be reviewed independently at a PR33-like size.

I left this original PR open to preserve the review history and avoid a destructive force-push. The remaining address-book UI/send integration can be split after #37 or converted into a smaller replacement PR if preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants