Tesseract Swift
Tesseract.swift 为 Tesseract 提供 Swift API,Tesseract 是一个去中心化钱包桥接器,旨在使移动设备上的 dApp/wallet 通信更简单、更自然,而不损害去中心化和安全性。
如果您在寻找其他语言/操作系统的 Tesseract 文档,请考虑以下内容
入门
Tesseract 为想要连接到钱包的 dApp 提供了一组 API,以及一组钱包 API,用于为 dApp 提供服务。
以下是一个典型的 Tesseract 工作流程
dApp | 钱包 |
---|---|
//initialize Tesseract with default config
let tesseract = Tesseract.default
//indicate what blockchain are we gonna use
let substrateService = tesseract.service(SubstrateService.self)
//at this point Tesseract connects to the
//wallet and the wallet presents the user
//with its screen, asking if the user
//wants to share their public key to a dApp
let account = try await substrateService.getAccount(.sr25519) |
//Inside the Wallet Tesseract serves requests
//from the dApps as long as the reference is kept alive
//save it somewhere in the Extension instance
let tesseract = Tesseract()
.transport(IPCTransportIOS(self)) //add iOS IPC transport
.service(MySubstrateService())
//MySubstrateService instance methods
//will be called when a dApp asks for something |
详情
由于 Tesseract 在 dApp 和钱包中使用的性质非常不同(本质上作为客户端和服务端进行通信),详细的文档分为两个文档
示例
如果您想查看 Tesseract 集成的示例,请参阅:
- dev-wallet.swift - 用于钱包
- polkachat.swift - 用于 dApps,待定
更多
如果想在 iOS 上通过 Rust API 使用 Tesseract,也是可以的。可以考虑以下选项:
路线图
- v0.1 - iOS IPC 传输 - 同一台设备上的 dApp/Wallet 连接
- v0.2 - 演示 dApp 和 Wallet
- v0.3 - Substrate 协议支持
- v0.4 - dev-wallet.swift 测试实现
- v0.5 - 第一个 Swift 库版本
- v1.0 - 支持移动 dApp 所需的一切
许可
Tesseract.swift 可在 Apache 2.0 许可下使用、分发和修改。