LedgerWallet

public class LedgerWallet : Wallet

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.

  • The wallet type, hardcoded to always be WalletType.ledger

    Declaration

    Swift

    public var type: WalletType
  • The TZ address pulled from the Ledger device, cached to avoid complex retrieval when fetching balances etc.

    Declaration

    Swift

    public var address: String
  • The raw hex public key extracted from the Ledger, needed in order to perform REVEAL operations

    Declaration

    Swift

    public var publicKey: String
  • The derivation path used to fetch the address and public key

    Declaration

    Swift

    public var derivationPath: String
  • The elliptical curve used to fetch the address and public key

    Declaration

    Swift

    public var curve: EllipticalCurve
  • The unique ledger UUID, that corresponds to this wallet address

    Declaration

    Swift

    public var ledgerUUID: String
  • Create an instance of a LedgerWallet. Can return nil if invalid public key supplied

    Declaration

    Swift

    public init?(address: String, publicKey: String, derivationPath: String, curve: EllipticalCurve, ledgerUUID: String)

    Parameters

    address

    The TZ address pulled from the Ledger device

    publicKey

    The hex string denoting the public key, pulled from the ledger device

    derivationPath

    The derivation path used to fetch the address / publicKey

    curve

    The elliptical curve used to fetch the address / public key

    ledgerUUID

    The unique Ledger UUID to identify the Ledger

  • Sign a hex string. If the string starts with “03” and is not 32 characters long, it will be treated as a watermarked operation and Ledger will be asked to parse + display the operation details. Else it will be treated as an unknown operation and will simply display the Blake2b hash. Please be careful when asking the Ledger to parse (passing in an operation), Ledgers have very limited display ability. Keep it to a single operation, not invoking a smart contract

    Declaration

    Swift

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

    Declaration

    Swift

    public func privateKeyCurve() -> EllipticalCurve
  • Function to convert the public key into a Base58 encoded string

    Declaration

    Swift

    public func publicKeyBase58encoded() -> String