ZKUtils

Objective-C

@interface ZKUtils : NSObject

Swift

class ZKUtils : NSObject

Utility class providing blockchain related utility methods. Accessed from ZKZumoKit class.

This class provides mnemonic phrase generation utility and Bitcoin & Ethereum address validation utilities.

  • Generates mnemonic seed phrase used in wallet creation process.

    Declaration

    Objective-C

    - (nonnull NSString *)generateMnemonic:(int32_t)wordCount;

    Swift

    func generateMnemonic(_ wordCount: Int32) -> String

    Parameters

    wordCount

    12, 15, 18, 21 or 24

  • Validates Ethereum address.

    Declaration

    Objective-C

    - (BOOL)isValidEthAddress:(nonnull NSString *)address;

    Swift

    func isValidEthAddress(_ address: String) -> Bool

    Parameters

    address

    Ethereum address

    Return Value

    true if Ethereum address is valid

  • Validates Bitcoin address on a given network.

    Declaration

    Objective-C

    - (BOOL)isValidBtcAddress:(nonnull NSString *)address
                      network:(nonnull NSString *)network;

    Swift

    func isValidBtcAddress(_ address: String, network: String) -> Bool

    Parameters

    address

    Bitcoin address

    network

    network type, either ‘MAINNET’ or ‘TESTNET’

    Return Value

    true if Bitcoin address is valid on a given network