A Swift library to interact with the Tezos blockchain.
The Tezos Swift SDK ships with tools that can be used to:
General
- convert a Base58 encoded string to bytes and vice versa
Michelson/Micheline
- parse or create a Micheline JSON string
- pack and unpack Micheline
- convert Micheline to typed Michelson and vice versa
Operations
- create an unsigned or signed Tezos operation
- forge and unforge an operation
- sign an operation and verify the signature
RPC
- interact with a Tezos node
- estimate the operation fee
Contract
- read a contract's storage
- read BigMaps
- prepare contract calls
The Tezos Swift SDK requires:
- iOS 13
- macOS 10.15
The Tezos Swift SDK is a multi-package project. It has been designed to allow its users to use only the required minimum of functionality that meets their needs, thus optimizing the amount of redundant and unwanted code and dependencies. The library modules can be divided into 3 categories:
- Core
- Plugin
- Default Provider
The core modules are the basis for other modules. They are required for the SDK to work as expected.
Core Module | Description | Module Dependencies |
---|---|---|
TezosCore |
Provides base Tezos types and actions that can be performed on them. | ✖️ |
The plugin modules are optional and come with additional functionality. They should be registered in the appropriate core components before use.
Plugin Module | Description | Module Dependencies |
---|---|---|
TezosMichelson |
Provides Michelson and Micheline types and actions, e.g. pack /unpack . |
TezosCore |
TezosOperation |
Provides Tezos Operation structures as defined in the P2P message format and actions that can be performed on them, e.g. forge /unforge and sign /verify . |
TezosCore TezosMichelson |
TezosRPC |
Provides a Tezos RPC client which should be used to interact with Tezos nodes. | TezosCore TezosMichelson TezosOperation |
TezosContract |
Provides a Tezos contract handler which should be used to interact with Tezos contracts. | TezosCore TezosMichelson TezosOperation TezosRPC |
The default provider modules are optional and come with default implementations of various components that can be provided externally.
Default Provider Module | Description | Module Dependencies |
---|---|---|
TezosCryptoDefault |
Uses Swift Crypto, Swift-Sodium and secp256k1.swift to satisfy the cryptographic requirements. | TezosCore |
See the below guides to learn how to add the Tezos Swift SDK into your project.
To add the Tezos Swift SDK with the Swift Package Manager, add the Tezos Swift SDK package dependency:
Open the Add Package Dependency
window (as described in the official guide) and enter the Tezos Swift SDK GitHub repository URL:
https://github.com/airgap-it/tezos-swift-sdk
Add the following dependency in your Package.swift
file:
.package(url: "https://github.com/airgap-it/tezos-swift-sdk", from: "x.y.z")
A high level guide on how to use the library can be found in the docs. To try out the library in action, see the Samples.