SPB Git

spb/os-vault Public

Self-custody, multi-chain crypto wallet for macOS. One recovery phrase, six chain families, zero API keys — nothing leaves your Mac.

Swift 96% Shell 3.4% Makefile 0.6%
2.1 KB · 70 lines swift
Raw Blame History
1import WalletCoreC2import Foundation3// SPDX-License-Identifier: Apache-2.04//5// Copyright © 2017 Trust Wallet.6//7// This is a GENERATED FILE, changes made here WILL BE LOST.8//910import Foundation1112/// Represents a legacy Groestlcoin address.13public final class GroestlcoinAddress: Address {1415    /// Compares two addresses for equality.16    ///17    /// - Parameter lhs: left Non-null GroestlCoin address to be compared18    /// - Parameter rhs: right Non-null GroestlCoin address to be compared19    /// - Returns: true if both address are equal, false otherwise20    public static func == (lhs: GroestlcoinAddress, rhs: GroestlcoinAddress) -> Bool {21        return TWGroestlcoinAddressEqual(lhs.rawValue, rhs.rawValue)22    }2324    /// Determines if the string is a valid Groestlcoin address.25    ///26    /// - Parameter string: Non-null string.27    /// - Returns: true if it's a valid address, false otherwise28    public static func isValidString(string: String) -> Bool {29        let stringString = TWStringCreateWithNSString(string)30        defer {31            TWStringDelete(stringString)32        }33        return TWGroestlcoinAddressIsValidString(stringString)34    }3536    /// Returns the address base58 string representation.37    ///38    /// - Parameter address: Non-null GroestlcoinAddress39    /// - Returns: Address description as a non-null string40    public var description: String {41        return TWStringNSString(TWGroestlcoinAddressDescription(rawValue))42    }4344    let rawValue: OpaquePointer4546    init(rawValue: OpaquePointer) {47        self.rawValue = rawValue48    }4950    public init?(string: String) {51        let stringString = TWStringCreateWithNSString(string)52        defer {53            TWStringDelete(stringString)54        }55        guard let rawValue = TWGroestlcoinAddressCreateWithString(stringString) else {56            return nil57        }58        self.rawValue = rawValue59    }6061    public init(publicKey: PublicKey, prefix: UInt8) {62        rawValue = TWGroestlcoinAddressCreateWithPublicKey(publicKey.rawValue, prefix)63    }6465    deinit {66        TWGroestlcoinAddressDelete(rawValue)67    }6869}70