ZKUser

Objective-C

@interface ZKUser : NSObject

Swift

class ZKUser : NSObject

User class provides methods for managing user wallet and accounts.

User instance can be obtained via getUser method on ZKZumoKit instance.

See Manage User Wallet, Create Fiat Account and View User Data guides for usage details.

  • Get user id.

    Declaration

    Objective-C

    - (nonnull NSString *)getId;

    Swift

    func getId() -> String

    Return Value

    user id

  • Check if user has wallet

    Declaration

    Objective-C

    - (BOOL)hasWallet;

    Swift

    func hasWallet() -> Bool

    Return Value

    true if user has wallet

  • Check if user is currenly active user. Only one user can be active at a time.

    Declaration

    Objective-C

    - (BOOL)isActiveUser;

    Swift

    func isActiveUser() -> Bool

    Return Value

    true if user is currenly active user

  • Check if user is a Modulr customer on ‘MAINNET’ or ‘TESTNET’ network.

    Declaration

    Objective-C

    - (BOOL)isModulrCustomer:(nonnull NSString *)network;

    Swift

    func isModulrCustomer(_ network: String) -> Bool

    Parameters

    network

    ‘MAINNET’ or ‘TESTNET’

    Return Value

    true if user is currenly active user.

  • Make user Modulr customer on specified network by providing user’s personal details.

    Declaration

    Objective-C

    - (void)makeModulrCustomer:(nonnull NSString *)network
                     firstName:(nonnull NSString *)firstName
                    middleName:(nullable NSString *)middleName
                      lastName:(nonnull NSString *)lastName
                   dateOfBirth:(nonnull NSString *)dateOfBirth
                         email:(nonnull NSString *)email
                         phone:(nonnull NSString *)phone
                  addressLine1:(nonnull NSString *)addressLine1
                  addressLine2:(nullable NSString *)addressLine2
                       country:(nonnull NSString *)country
                      postCode:(nonnull NSString *)postCode
                      postTown:(nonnull NSString *)postTown
                      callback:(nullable id<ZKSuccessCallback>)callback;

    Parameters

    network

    ‘MAINNET’ or ‘TESTNET’

    firstName

    first name

    middleName

    middle name or null

    lastName

    last name

    dateOfBirth

    date of birth in ISO 8601 format, e.g ‘2020-08-12’

    phone

    phone number

    addressLine1

    address line 1

    addressLine2

    adress line 2 or null

    country

    country code in ISO 3166-1 Alpha-2 format, e.g. ‘GB’

    postCode

    post code

    postTown

    post town

    callback

    an interface to receive the result or error

  • Create fiat account on specified network and currency code. User must already be Modulr customer on specified network.

    See

    ZKAccount

    Declaration

    Objective-C

    - (void)createFiatAccount:(nonnull NSString *)network
                 currencyCode:(nonnull NSString *)currencyCode
                     callback:(nullable id<ZKAccountCallback>)callback;

    Parameters

    network

    ‘MAINNET’ or ‘TESTNET’

    currencyCode

    country code in ISO 4217 format, e.g. ‘GBP’

    callback

    an interface to receive the result or error

  • Get nominated account details for specified account if it exists. Refer to Create Fiat Account for explanation about nominated account.

    Declaration

    Objective-C

    - (void)
        getNominatedAccountFiatProperties:(nonnull NSString *)accountId
                                 callback:
                                     (nullable id<ZKAccountFiatPropertiesCallback>)
                                         callback;

    Parameters

    accountId
    callback

    an interface to receive the result or error

  • Create user wallet seeded by provided mnemonic and encrypted with user’s password.

    Mnemonic can be generated by generateMnemonic method in ZKUtils class.

    See

    ZKWallet

    Declaration

    Objective-C

    - (void)createWallet:(nonnull NSString *)mnemonic
                password:(nonnull NSString *)password
                callback:(nullable id<ZKWalletCallback>)callback;

    Parameters

    mnemonic

    mnemonic seed phrase

    password

    user provided password

    callback

    an interface to receive the result or error

  • Unlock user wallet with user’s password.

    See

    ZKWallet

    Declaration

    Objective-C

    - (void)unlockWallet:(nonnull NSString *)password
                callback:(nullable id<ZKWalletCallback>)callback;

    Parameters

    password

    user provided password

    callback

    an interface to receive the result or error

  • Reveal menmonic seed phrase used to seed user wallet.

    Declaration

    Objective-C

    - (void)revealMnemonic:(nonnull NSString *)password
                  callback:(nullable id<ZKMnemonicCallback>)callback;

    Parameters

    password

    user provided password

    callback

    an interface to receive the result or error

  • Check if mnemonic seed phrase corresponds to user’s wallet. This is useful for validating seed phrase before trying to recover wallet.

    Declaration

    Objective-C

    - (BOOL)isRecoveryMnemonic:(nonnull NSString *)mnemonic;

    Swift

    func isRecoveryMnemonic(_ mnemonic: String) -> Bool

    Parameters

    mnemonic

    mnemonic seed phrase

    Return Value

    true if mnemonic seed phrase corresponds to user’s wallet

  • Recover user wallet with mnemonic seed phrase corresponding to user’s wallet. This can be used if user forgets his password or wants to change his wallet password.

    Declaration

    Objective-C

    - (void)recoverWallet:(nonnull NSString *)mnemonic
                 password:(nonnull NSString *)password
                 callback:(nullable id<ZKWalletCallback>)callback;

    Parameters

    mnemonic

    mnemonic seed phrase corresponding to user’s wallet

    password

    user provided password

    callback

    an interface to receive the result or error

  • Get account in specific currency, on specific network, with specific type.

    Declaration

    Objective-C

    - (nullable ZKAccount *)getAccount:(nonnull NSString *)currencyCode
                               network:(nonnull NSString *)network
                                  type:(nonnull NSString *)type;

    Swift

    func getAccount(_ currencyCode: String, network: String, type: String) -> ZKAccount?

    Parameters

    currencyCode

    currency code, e.g. ‘BTC’, ‘ETH’ or ‘GBP’

    network

    network type, e.g. ‘MAINNET’, ‘TESTNET’ or ‘RINKEBY’

    type

    account type, e.g. ‘STANDARD’, ‘COMPATIBILITY’ or ‘SEGWIT’

    Return Value

    account with selected parameters if it exists, null otherwise

  • Get all user accounts.

    Declaration

    Objective-C

    - (nonnull NSArray<ZKAccount *> *)getAccounts;

    Swift

    func getAccounts() -> [ZKAccount]

    Return Value

    all user accounts

  • Listen to all account data changes.

    Declaration

    Objective-C

    - (void)addAccountDataListener:(nullable id<ZKAccountDataListener>)listener;

    Parameters

    listener

    interface to listen to user changes

  • Remove listener to account data changes.

    Declaration

    Objective-C

    - (void)removeAccountDataListener:(nullable id<ZKAccountDataListener>)listener;

    Parameters

    listener

    interface to listen to user changes

ZKUserCallbackCompletion