Quickstart
Integrate private token transfers into your iOS app in a few minutes.
Installation
Add the SDK with Swift Package Manager. In Xcode: File → Add Package Dependencies…, then enter:
https://github.com/Hinkal-Protocol/hinkal-sdkSelect version 0.1.1 and add the Hinkal library to your target. SPM downloads and verifies the prebuilt binary automatically. Full detail in Installation.
import HinkalQuick Example
1. Implement the host wallet
class WalletHost: NSObject, MobileHostWalletProtocol {
let wallet: YourWalletImplementation
func address(_ error: NSErrorPointer) -> String { wallet.address }
func chainID() -> Int64 { wallet.chainId }
func personalSign(_ message: String?, error: NSErrorPointer) -> String {
wallet.personalSign(message ?? "")
}
func sendTransaction(_ toHex: String?, dataHex: String?, valueDec: String?,
gasLimit: Int64, error: NSErrorPointer) -> String {
wallet.sendTransaction(toHex ?? "", dataHex ?? "", valueDec ?? "", gasLimit)
}
func switchChain(_ chainID: Int64) throws { try wallet.switchChain(chainID) }
}2. Connect and use the SDK
Throwing calls take an NSError out-parameter (the framework is generated by gomobile). Wrap them with a small rethrow helper:
SwiftUI Example
Last updated