Tesseract Swift
Tesseract.swift 提供了 Tesseract 的 Swift API,它是一个去中心化应用(dApp)钱包桥梁,旨在使移动设备上的 dApp/wallet 通信变得简单自然,同时不妥协去中心化和安全性。
如果您正在寻找其他语言/操作系统的 Tesseract 文档,请考虑以下内容
入门
Tesseract 提供了两套 API,一套用于想要连接钱包的 dApp,另一套用于想要为 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,待定
更多
如果您想通过Rust API在iOS上使用Tesseract,这也是可行的。您可以查看以下内容:
路线图
- v0.1 - iOS的IPC传输 - 链接同一设备上的dApp/Wallet
- v0.2 - 示例dApp和钱包
- v0.3 - Substrate协议支持
- v0.4 - dev-wallet.swift 测试实现
- v0.5 - 首次Swift库发布版本
- v1.0 - 支持移动dApps所需的一切
许可证
Tesseract.swift可以在Apache 2.0许可证下使用、分发和修改。