在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:pexavc/IPFSKit开源软件地址:https://github.com/pexavc/IPFSKit开源编程语言:Swift 100.0%开源软件介绍:IPFSKitBased on: https://github.com/ipfs-shipyard/swift-ipfs-http-client Converted into a standalone Swift Package. InstallationAdd this repo link as a swift package to your XCode project. Requirements
Usageimport IPFSKit
let client: IPFSClient?
public init() {
client = try? IPFSClient.init(host: "ipfs.infura.io", port: 5001, ssl: true)
} Adding data to IPFSif let data = result.data.pngData() {
do {
try state.service.client?.add(data) { nodes in // Adding data to IPFS
// use 'nodes' to pin content
}
} catch let error {
GraniteLogger.info("error adding new image:\n\(error)", .expedition, focus: true)
}
}
Convert any type of object into a Pinning data to IPFSdo {
if let addHash = nodes.first?.hash { // the `nodes` from the closure of the previous code example
try client?.pin.add(addHash) { pinHash in
let gatewayHash = b58String(pinHash) // IPFS public hash gateway for the pinned content
}
}
} catch let error {
GraniteLogger.info("error pinning:\n\(error)", .expedition, focus: true)
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论