Classes
The following classes are available globally.
-
BetterCallDev (BCD) is an indexer/smart contract debugging tool, used for the Tezos blockchain. This class allows developers to interact with their API, to fetch data that would otherwise be impossible for a mobile app to fetch from the Tezos RPC
See moreDeclaration
Swift
public class BetterCallDevClient
-
This client exposes functions to allow communication to the indexer platform DipDup ( https://dipdup.net/ ). DipDup is composed of many small, dedicated indexers, powered by GraphQL. This client tries to exposes userflow functions, allowing users to accomplish tasks without having to worry about the underlying complexities
See moreDeclaration
Swift
public class DipDupClient
-
Client for interacting with the API of the popular NFT marketplace, OBJKT.com Client exposes functions for fetching metadata, pricing, purchase offers, listing etc
See moreDeclaration
Swift
public class ObjktClient
-
A client class allowing integration with the tezos domains GraphQL API. See more here: https://tezos.domains/
See moreDeclaration
Swift
public class TezosDomainsClient
-
The TezosNodeClient offers methods for interacting with the Tezos node to fetch balances, send transactions etc. The client will abstract away all the compelx tasks of remote forging, parsing, signing, preapply and injecting operations. It will also convert amounts from the network into
See moreToken
objects to make common tasks easier.Declaration
Swift
public class TezosNodeClient
-
TzKT is an indexer for Tezos, who’s API allows developers to query details about wallets, transactions, bakers, account status etc
See moreDeclaration
Swift
public class TzKTClient
extension TzKTClient: HubConnectionDelegate
-
Class responsible for creating operations necessary to perform a given action, and converting those operations into the single payload expected by the RPC. Although not every action requires more than one operation, all functions will return an array, for consistency.
See moreDeclaration
Swift
public class OperationFactory
-
A model matching the response that comes back from BetterCallDev’s API:
See morev1/tokens/<network>/metadata?contract=<address>
Declaration
Swift
public class BetterCallDevTokenMetadata : Codable
-
A Tezos Wallet used for signing transactions before sending to the Tezos network. This object holds the public and private key used to create the contained Tezos address. You should NOT store a copy of this class in a singleton or gloabl variable of any kind. it should be created as needed and nil’d when not. In order to help developers achieve this, use the
WalletCacheService
to store/retreive an encrypted copy of the wallet on disk, and recreate theWallet
.This wallet is a HD wallet, allowing the creation of many child wallets from the one base privateKey. It also follows the Bip39 stnadard for generation via a mnemonic.
See moreDeclaration
-
A Tezos wallet class, used to cache infomration regarding the paired ledger device used to sign the payload. This class can only be created by fetching data from a Ledger device and supplying this data to the constructor.
It is not possible to call the async sign function of this class, it will return null. Signing with a ledger is a complicated async process. Please use the LedgerService class to setup a bluetooth connection, connect to the device and request a payload signing.
See moreDeclaration
Swift
public class LedgerWallet : Wallet
-
Base class representing an
See moreOperation
on the Tezos network. On its own this class can’t be sent to the network. See its subclasses for more info.Declaration
Swift
public class Operation : Codable
-
A subclass of
See moreOperation
meant to catch any, currently, unsupported operations. The Tezos protocol can add new operations at any time. If notCodable
struct / class is present to parse it, then that operation can’t be performed. This class allows for clients to parse the JSON, capturing all of the data, enabling the ability to add counter, source and fees, without needing to know what type of operation it is. Class can be encoded as JSON and presented to the user to confirm if they want to trust it or notDeclaration
Swift
public class OperationUnknown : Operation
-
A generic class representing an RPC call to the Tezos network. A type must be passed in when creating an instance of this object, this will be used by the network layer to parse the response and detect errors.
See moreDeclaration
Swift
public class RPC<T> where T : Decodable
-
A Tezos Wallet used for signing transactions before sending to the Tezos network. This object holds the public and private key used to create the contained Tezos address. You should NOT store a copy of this class in a singleton or gloabl variable of any kind. it should be created as needed and nil’d when not. In order to help developers achieve this, use the
WalletCacheService
to store/retreive an encrypted copy of the wallet on disk, and recreate theWallet
.This wallet is a non-HD wallet, sometimes referred to as a “legacy” wallet. It follows the Bip39 standard for generation via menmonic.
See moreDeclaration
Swift
public class RegularWallet : Wallet
extension RegularWallet: Equatable
extension RegularWallet: Hashable
-
A class to represent a Token on the Tezos network. This class will do all the heavy lifting of converting values from the RPC to more human readbale values. This class will also handle arithmetic functions, allowing developers to add and subtract tokens (useful when caluclating fees and total values).
See moreDeclaration
Swift
public class Token : Codable, CustomStringConvertible
extension Token: Equatable
extension Token: Hashable
extension Token: Identifiable
-
Class representing a numeric amount on the Tezos network. The network uses natural numbers inside strings, which technically have an infinite length. This class is used to encapsulate a
See moreBigInt
and provide all the necessary init’s and formatting functions to work with the networks requirements.Declaration
Swift
public class TokenAmount : Codable
extension TokenAmount: Comparable
extension TokenAmount: Equatable
extension TokenAmount: CustomStringConvertible
extension TokenAmount: Hashable
-
A Tezos Wallet used for signing transactions before sending to the Tezos network. This object holds the public and private key used to create the contained Tezos address. You should NOT store a copy of this class in a singleton or gloabl variable of any kind. it should be created as needed and nil’d when not. In order to help developers achieve this, use the
WalletCacheService
to store/retreive an encrypted copy of the wallet on disk, and recreate theWallet
.This wallet is a subclass of
See moreLinearWallet
created by using the Torus network to generate wallets from social media accounts. This class is equivalent to a LinearWallet producing a TZ2 address via secp256k1, without the use of a mnemonic, and instead including the social profile of the user.Declaration
Swift
public class TorusWallet : RegularWallet
-
Container to store groups of WalletMetadata based on type
See moreDeclaration
Swift
public class WalletMetadataList : Codable, Hashable
-
Object to store UI related info about wallets, seperated from the wallet object itself to avoid issues merging together
See moreDeclaration
Swift
public class WalletMetadata : Codable, Hashable
-
A subclass of
See moreTokenAmount
to make it more explict when functions require XTZ (such as network fees). It also serves as a means to more quickly createTokenAmount
‘s conforming to XTZ.Declaration
Swift
public class XTZAmount : TokenAmount
-
A Helper service to simply combine multiple calls from other services, and/or map to specific responses, in order to expose a piece of functionality provided by a dApp
See moreDeclaration
Swift
public class DAppHelperService
-
Wrapper around the kukai-dex-calculations JS library for performing calculations: https://github.com/kukai-wallet/kukai-dex-calculations
See moreDeclaration
Swift
public class DexCalculationService
-
A service class to write and read data from the devices documents directory
See moreDeclaration
Swift
public class DiskService
-
A class used to process errors into more readable format, and optionally notifiy a global error handler of every error occuring
See moreDeclaration
Swift
public class ErrorHandlingService
-
An object allowing developers to automatically estimate the necessary fee per Operation to ensure it will be accpeted by a Baker. This avoids the need to ask users to enter a fee, which is not a very user friendly approach as most users wouldn’t know what is required.
See moreDeclaration
Swift
public class FeeEstimatorService
-
A service class to wrap up all the complicated interactions with CoreBluetooth and the modified version of ledgerjs, needed to communicate with a Ledger Nano X.
Ledger only provide a ReactNative module for third parties to integrate with. The architecture of the module also makes it very difficult to integrate with native mobile (if it can be packaged up) as it relies heavily on long observable chains passing through many classes and functions. To overcome this, I copied the base logic from multiple ledgerjs classes into a single typescript file and split the functions up into more of a utility style class, where each function returns a result, that must be passed into another function. This allowed the creation of a swift class to sit in the middle of these functions and decide what to do with the responses.
The modified typescript can be found in this file (under a fork of the main repo) https://github.com/simonmcl/ledgerjs/blob/native-mobile/packages/hw-app-tezos/src/NativeMobileTezos.ts . The containing package also includes a webpack file, which will package up the typescript and its dependencies into mobile friendly JS file, which needs to be included in the swift project. Usage of the JS can be seen below.
NOTE: this modified typescript is Tezos only as I was unable to find a way to simply subclass their
See moreTransport
class, to produce a re-usable NativeMobile transport. The changes required modifiying the app and other class logic which became impossible to refactor back into the project, without rewriting everything.Declaration
Swift
public class LedgerService : NSObject, CBPeripheralDelegate, CBCentralManagerDelegate
-
A service class for interacting with the TC infrastructure to proxy NFT images, videos and audio files
See moreDeclaration
Swift
public class MediaProxyService : NSObject
extension MediaProxyService: URLSessionDownloadDelegate
-
Class responsible for sending all the networking requests, checking for http errors, RPC errors, Decoding the responses and optionally logging progress
See moreDeclaration
Swift
public class NetworkService
-
Several classes need to use pieces of the forge-sign-parse-preapply-inject flow. This class abstracts those functions away so that it can be shared throughout the library.
See moreDeclaration
Swift
public class OperationService
-
Taquito (https://github.com/ecadlabs/taquito) is a popular open source Tezos library written in Typescript and Javascript. Taquito is made up of many separate packages that deal with various aspects of Tezos RPC and Michelson. This serivce class is a wrapper around a small piece of the Taquito library to expose funtionality that would otherwise be time consuming/risky/dangerous to re-implement natively. The JS can now be found on each github release here: https://github.com/ecadlabs/taquito/releases/, by extracting the zip named “taquito-local-forging-vanilla.zip”
See moreDeclaration
Swift
public class TaquitoService
-
TorusAuthService is a wrapper around the SDK provided by: https://tor.us/ to allow the creation of
See moreTorusWallet
‘s. This allows users to create a wallet from their social media accounts without having to use a seed phrase / mnemonic. TorusAuthService allows Tezos apps to leverage this service for a number of providers, and also has the ability to query the network for someone else’s wallet address, based on their social profile. This allows you to send XTZ or tokens to your friend based on their twitter username for exampleDeclaration
Swift
public class TorusAuthService : NSObject
extension TorusAuthService: ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding
-
A service class used to store and retrieve
See moreWallet
objects such asRegularWallet
,HDWallet
,LedgerWallet
andTorusWallet
from the devices disk. This class will use the secure enclave (keychain if not available) to generate a key used to encrypt the contents locally, and retrieve. This class will also store non senstiivve “metadata” about wallets, to allow storage of UI related data users might want to add, without cluttering up the wallet objects themselvesDeclaration
Swift
public class WalletCacheService