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 more

    Declaration

    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 more

    Declaration

    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 more

    Declaration

    Swift

    public class ObjktClient
  • A client class allowing integration with the tezos domains GraphQL API. See more here: https://tezos.domains/

    See more

    Declaration

    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 Token objects to make common tasks easier.

    See more

    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 more

    Declaration

    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 more

    Declaration

    Swift

    public class OperationFactory
  • A model matching the response that comes back from BetterCallDev’s API: v1/tokens/<network>/metadata?contract=<address>

    See more

    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 the Wallet.

    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 more

    Declaration

    Swift

    public class HDWallet : Wallet
    extension HDWallet: Equatable
    extension HDWallet: Hashable
  • 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 more

    Declaration

    Swift

    public class LedgerWallet : Wallet
  • Base class representing an Operation on the Tezos network. On its own this class can’t be sent to the network. See its subclasses for more info.

    See more

    Declaration

    Swift

    public class Operation : Codable
  • Operation subclass for revealing a publickey to the network.

    See more

    Declaration

    Swift

    public class OperationActivateAccount : Operation
  • Operation to submit a ballot on an upcoming proposal

    See more

    Declaration

    Swift

    public class OperationBallot : Operation
  • Operation subclass for delegating an account to a baker

    See more

    Declaration

    Swift

    public class OperationDelegation : Operation
  • Operation to report a baking of baking the same block twice

    See more

    Declaration

    Swift

    public class OperationDoubleBakingEvidence : Operation
  • Operation to report a baker trying to endorse a block twice

    See more

    Declaration

    Swift

    public class OperationDoubleEndorsementEvidence : Operation
  • Operation for endorsing a block

    See more

    Declaration

    Swift

    public class OperationEndorsement : Operation
  • Operation subclass for originating a contract on the Tezos network

    See more

    Declaration

    Swift

    public class OperationOrigination : Operation
  • Declaration

    Swift

    public class OperationProposals : Operation
  • Operation subclass for revealing a publickey to the network.

    See more

    Declaration

    Swift

    public class OperationReveal : Operation
  • Operation to reveal seed nonce to blockchain

    See more

    Declaration

    Swift

    public class OperationSeedNonceRevelation : Operation
  • Operation subclass for sending XTZ to a destination

    See more

    Declaration

    Swift

    public class OperationTransaction : Operation
  • RPC

    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 more

    Declaration

    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 the Wallet.

    This wallet is a non-HD wallet, sometimes referred to as a “legacy” wallet. It follows the Bip39 standard for generation via menmonic.

    See more

    Declaration

    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 more

    Declaration

    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 BigInt and provide all the necessary init’s and formatting functions to work with the networks requirements.

    See more

    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 the Wallet.

    This wallet is a subclass of LinearWallet 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.

    See more

    Declaration

    Swift

    public class TorusWallet : RegularWallet
  • A subclass of TokenAmount to make it more explict when functions require XTZ (such as network fees). It also serves as a means to more quickly create TokenAmount‘s conforming to XTZ.

    See more

    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 more

    Declaration

    Swift

    public class DAppHelperService
  • Wrapper around the kukai-dex-calculations JS library for performing calculations: https://github.com/kukai-wallet/kukai-dex-calculations

    See more

    Declaration

    Swift

    public class DexCalculationService
  • A service class to write and read data from the devices documents directory

    See more

    Declaration

    Swift

    public class DiskService

Service class

  • A class used to process errors into more readable format, and optionally notifiy a global error handler of every error occuring

    See more

    Declaration

    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 more

    Declaration

    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 Transport 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.

    See more

    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 more

    Declaration

    Swift

    public class MediaProxyService : NSObject
    extension MediaProxyService: URLSessionDownloadDelegate
  • Declaration

    Swift

    public class ContentTypeCheckingImageDownloader : ImageDownloader
  • Class responsible for sending all the networking requests, checking for http errors, RPC errors, Decoding the responses and optionally logging progress

    See more

    Declaration

    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 more

    Declaration

    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 more

    Declaration

    Swift

    public class TaquitoService

Types

  • TorusAuthService is a wrapper around the SDK provided by: https://tor.us/ to allow the creation of TorusWallet‘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 example

    See more

    Declaration

    Swift

    public class TorusAuthService : NSObject
    extension TorusAuthService: ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding
  • A service class used to store and retrieve Wallet objects such as RegularWallet, HDWallet, LedgerWallet and TorusWallet 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 themselves

    See more

    Declaration

    Swift

    public class WalletCacheService