RegularWallet

public class RegularWallet : Wallet
extension RegularWallet: Equatable
extension RegularWallet: 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 non-HD wallet, sometimes referred to as a “legacy” wallet. It follows the Bip39 standard for generation via menmonic.

  • enum used to differientate wallet class types. Needed for applications that allow users to create many different types of wallets

    Declaration

    Swift

    public let type: WalletType
  • The TZ1 or TZ2 address of the wallet

    Declaration

    Swift

    public let address: String
  • An object representing the PrivateKey used to generate the wallet

    Declaration

    Swift

    public var privateKey: PrivateKey
  • An object representing the PublicKey used to generate the wallet address

    Declaration

    Swift

    public var publicKey: PublicKey
  • Optional Bip39 mnemonic used to generate the wallet

    Declaration

    Swift

    public var mnemonic: Mnemonic?

Init

  • Attempt to create an instance of a RegularWallet from an encoded string containing a private key

    Declaration

    Swift

    public init?(secp256k1WithBase58String base58String: String, type: WalletType)

    Parameters

    secp256k1WithBase58String

    String containing the Base58 encoded private key, prefixed with the curve’s secret

    type

    WalletType indicating the top most type of wallet

  • Create a RegularWallet by supplying a Mnemonic and a passphrase (or “” if none).

    Declaration

    Swift

    public init?(withMnemonic mnemonic: Mnemonic, passphrase: String)

    Parameters

    withMnemonic

    A Mnemonic representing a BIP39 menmonic

    passphrase

    String contianing a passphrase, or empty string if none

  • Create a RegularWallet by asking for a mnemonic of a given number of words and a passphrase (or “” if none).

    Declaration

    Swift

    public convenience init?(withMnemonicLength length: Mnemonic.NumberOfWords, passphrase: String)

    Parameters

    withMnemonicLength

    Mnemonic.NumberOfWords the number of words to use when creating a mnemonic

    passphrase

    String contianing a passphrase, or empty string if none

Crypto Functions

  • Sign a hex payload with the private key

    Declaration

    Swift

    public func sign(_ hex: String, isOperation: Bool, completion: @escaping ((Result<[UInt8], KukaiError>) -> Void))
  • Return the curve used to create the key

    Declaration

    Swift

    public func privateKeyCurve() -> EllipticalCurve
  • Get a Base58 encoded version of the public key, in order to reveal the address on the network

    Declaration

    Swift

    public func publicKeyBase58encoded() -> String
  • Declaration

    Swift

    public static func == (lhs: RegularWallet, rhs: RegularWallet) -> Bool
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)