Skip to content

Conversation

@Gaubee
Copy link
Contributor

@Gaubee Gaubee commented Dec 27, 2025

概述

搭建 Bio 小程序生态系统的完整架构,包括:

  • pnpm workspace: Monorepo 结构支持 SDK 和小程序
  • @aspect-aspect/bio-sdk: 客户端 SDK,提供 window.bio 接口(类似 window.ethereum
  • Host Provider: PostMessage 通信桥和方法处理器
  • UI 集成: 生态 Tab、小程序列表、MiniappFrame 容器、对话框组件
  • 内置小程序: 一键传送、锻造
  • 订阅系统: ecosystem.json 格式

新增文件结构

packages/bio-sdk/          # 客户端 SDK
miniapps/teleport/         # 一键传送小程序
miniapps/forge/            # 锻造小程序
public/ecosystem.json      # 订阅源

src/services/ecosystem/    # Host Provider
├── types.ts               # 类型定义
├── bridge.ts              # PostMessage 通信
├── provider.ts            # Provider 初始化
├── registry.ts            # 小程序注册表
└── handlers/              # 方法处理器
    ├── wallet.ts          # 钱包方法
    ├── signing.ts         # 签名方法
    └── transfer.ts        # 转账方法

src/stackflow/activities/sheets/
├── AccountPickerJob.tsx      # 账户选择器
├── SigningConfirmJob.tsx     # 签名确认对话框
└── PermissionRequestJob.tsx  # 权限请求对话框

src/stackflow/
├── activities/tabs/EcosystemTab.tsx  # 生态 Tab
├── activities/MiniappActivity.tsx    # 小程序 Activity
└── components/TabBar.tsx             # 3 Tab 布局

docs/white-book/10-生态篇/  # 白皮书

构建命令

pnpm sdk:build              # 构建 SDK
pnpm miniapps:build         # 构建所有小程序到 public/
pnpm miniapps:dev:teleport  # 开发一键传送
pnpm miniapps:dev:forge     # 开发锻造

测试

  • ✅ 类型检查通过
  • ✅ 1623 单元测试通过
  • ✅ 新增 ecosystem 服务测试

已完成

  • Phase 1: 基础设施 (Monorepo, SDK, 小程序骨架)
  • Phase 2: Host Provider (Bridge, Handlers, Registry)
  • Phase 3: UI 集成 (EcosystemTab, MiniappActivity)
  • Phase 4: UI 对话框 (AccountPickerJob, SigningConfirmJob, PermissionRequestJob)
  • 单元测试
  • 白皮书 (第十篇:生态篇)

待完成 (后续 PR)

  • 转账确认对话框 (MiniappTransferConfirmJob)
  • 设置页可信源管理
  • 小程序后端 API 集成

@Gaubee Gaubee mentioned this pull request Dec 27, 2025
21 tasks
- Add pnpm-workspace.yaml for monorepo structure
- Create @aspect-aspect/bio-sdk package with EIP-1193 style API
- Create miniapps/teleport (一键传送) demo app
- Create miniapps/forge (锻造) demo app
- Add ecosystem.json subscription manifest
- Add whitebook documentation (10-生态篇)
- Configure build scripts for SDK and miniapps
Phase 2: Host Provider
- Add PostMessage bridge for iframe communication
- Implement wallet handlers (requestAccounts, selectAccount, pickWallet)
- Implement signing handlers (signMessage, signTypedData)
- Implement transfer handlers (sendTransaction)
- Add miniapp registry for subscription management

Phase 3: UI Integration
- Add EcosystemTab with app grid
- Add MiniappActivity and MiniappPage for running miniapps
- Update TabBar with ecosystem tab (3 tabs: wallet, ecosystem, settings)
- Register MiniappActivity route

Testing
- Add unit tests for types, bridge, and registry
- All 1622 tests passing

Documentation
- Add implementation status document
- Update whitebook index with ecosystem chapter
- AccountPickerJob: wallet account selector for miniapps
- SigningConfirmJob: message signing confirmation dialog
- PermissionRequestJob: permission request dialog
- MiniappPage: register handler callbacks for UI integration

Phase 4: Complete UI integration for bio_selectAccount, bio_signMessage
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.

2 participants