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 mnemonic

    passphrase

    String contianing a passphrase, or empty string if none

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

    Declaration

    Swift

    public init?(withShiftedMnemonic shiftedMnemonic: Mnemonic, passphrase: String)

    Parameters

    withShiftedMnemonic

    A Mnemonic representing a BIP39 mnemonic that has been shifted to support social recovery

    passphrase

    String contianing a passphrase, or empty string if none

  • Create a RegularWallet by supplying a a Base58 encoded string containing a secret key. Both encrypted and unencrypted are supported. Supports Tz1 and Tz2

    Declaration

    Swift

    public init?(fromSecretKey secretKey: String, passphrase: String?)

    Parameters

    fromSecretKey

    A String containing a Base58Check encoded secret key

    passphrase

    An optional string containing the passphrase used to encrypt the secret key

  • 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)