Swiftpack.co - kukai-wallet/kukai-core-swift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
kukai-wallet/kukai-core-swift
Kukai Core Swift is a native Swift library for interacting with the Tezos blockchain and other applications in the Tezos ecosystem
.package(url: "https://github.com/kukai-wallet/kukai-core-swift.git", from: "0.1.1")

Kukai Core Swift

Platforms Swift Package Manager License

Kukai Core Swift is a native Swift library for interacting with the Tezos blockchain and other applications in the Tezos ecosystem, such as the indexer TzKT and the smart contract explorer Better Call Dev. It leverages WalletCore the open source library built by TrustWallet, for key and wallet creation.


Feature set includes:

  • Create Linear or HD Wallets
  • A service to cache and retrieve encrypted wallet details from disk, using the secure enclave
  • Fetching a wallet's XTZ balance, all FA token balances, owned NFT's grouped together by type, all in a single function call
  • Fetching and caching token metadata
  • Fetching transaction history
  • Remote forging using a second node or Local forging via @taquito/local-forging
  • Estimating Gas, Storage and Fees for operations
  • Parsing Michelson JSON into a Swift object using Codable
  • Wait for an operation to be injected


Install

Kukai Core Swift supports the Swift Package Manager. Either use the Xcode editor to add to your project by clicking File -> Swift Packages -> Add Package Dependency, search for the git repo https://github.com/kukai-wallet/kukai-core-swift.git and choose from version 0.1.0.

Or add it to your Package.swift dependencies like so:

dependencies: [
    .package(url: "https://github.com/kukai-wallet/kukai-core-swift", from: "0.1.0")
]


How to use

Wallets are created using dedicated classes for each type, conforming to the Wallet protocol.

  • LinearWallet
    • Created using a BIP 39 mnemonic and optional passphrase
  • HDWallet
    • Created using a BIP 39 mnemonic, optional passphrase, and a BIP 44 derivation path

The main functionality centres around client classes and a factory:

  • TezosNodeClient
    • Query details about the node
    • Estimate fees via the node RPC
    • Send operations
  • BetterCallDevClient
    • Fetching balances
    • Fetching metadata
    • Detailed operation errors
  • TzKTClient
    • Transaction history
    • Determining if an operation has been successfully injected
  • OperationFactory
    • Helper methods to create arrays of operations needed for common tasks

You can see some of this functionality inside the repo's example iOS-Example project. The app is a simple tableview, with the first section responsible for creating and caching wallets. The rest of the sections will load the cached wallet and use its details to fetch/display balances or estiamte/send operations.



Documentation

Compiled Swift Doc's can be found here

GitHub

link
Stars: 3
Last commit: Yesterday

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics