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

  • Get user integrator id.

    Declaration

    Objective-C

    - (nonnull NSString *)getIntegratorId;

    Swift

    func getIntegratorId() -> String

    Return Value

    user integrator 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 a registered fiat customer.

    Declaration

    Objective-C

    - (BOOL)isFiatCustomer;

    Swift

    func isFiatCustomer() -> Bool

    Return Value

    true if user is a registered fiat customer.

  • Make user fiat customer by providing user’s personal details.

    Declaration

    Objective-C

    - (void)makeFiatCustomer:(nonnull NSString *)firstName
                  middleName:(nullable NSString *)middleName
                    lastName:(nonnull NSString *)lastName
                 dateOfBirth:(nonnull NSString *)dateOfBirth
                       email:(nonnull NSString *)email
                       phone:(nonnull NSString *)phone
                     address:(nonnull ZKAddress *)address
                    callback:(nullable id<ZKSuccessCallback>)callback;

    Parameters

    firstName

    first name

    middleName

    middle name or null

    lastName

    last name

    dateOfBirth

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

    email

    email

    phone

    phone number

    address

    home address

    callback

    an interface to receive the result or error

  • Create custody or fiat account for specified currency. When creating a fiat account, user must already be fiat customer.

    See

    ZKAccount

    Declaration

    Objective-C

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

    Parameters

    currencyCode

    country code, e.g. ‘GBP’, ‘BTC’, ‘ETH’

    callback

    an interface to receive the result or error

  • Compose transaction between custody or fiat accounts in Zumo ecosystem. Refer to Send Transactions guide for usage details.

    On success ZKComposedTransaction is returned via callback.

    Declaration

    Objective-C

    - (void)composeTransaction:(nonnull NSString *)fromAccountId
                   toAccountId:(nonnull NSString *)toAccountId
                        amount:(nullable NSDecimalNumber *)amount
                       sendMax:(BOOL)sendMax
                      callback:(nullable id<ZKComposeTransactionCallback>)callback;

    Parameters

    fromAccountId

    custody or fiat ZKAccount identifier

    toAccountId

    custody or fiat ZKAccount identifier

    amount

    amount in source account currency

    sendMax

    send maximum possible funds to destination

    callback

    an interface to receive the result or error

  • Compose custody withdraw transaction from custody account. Refer to Send Transactions guide for usage details.

    On success ZKComposedTransaction is returned via callback.

    Declaration

    Objective-C

    - (void)composeCustodyWithdrawTransaction:(nonnull NSString *)fromAccountId
                                  destination:(nonnull NSString *)destination
                                       amount:(nullable NSDecimalNumber *)amount
                                      sendMax:(BOOL)sendMax
                                     callback:
                                         (nullable id<ZKComposeTransactionCallback>)
                                             callback;

    Parameters

    fromAccountId

    custody ZKAccount identifier

    destination

    destination address or non-custodial account identifier

    amount

    amount in source account currency

    sendMax

    send maximum possible funds to destination

    callback

    an interface to receive the result or error

  • Compose transaction from user fiat account to user’s nominated account. Refer to Send Transactions guide for usage details.

    On success ZKComposedTransaction object is returned via callback.

    Declaration

    Objective-C

    - (void)composeNominatedTransaction:(nonnull NSString *)fromAccountId
                                 amount:(nullable NSDecimalNumber *)amount
                                sendMax:(BOOL)sendMax
                               callback:(nullable id<ZKComposeTransactionCallback>)
                                            callback;

    Parameters

    fromAccountId

    ZKAccount identifier

    amount

    amount in source account currency

    sendMax

    send maximum possible funds to destination

    callback

    an interface to receive the result or error

  • Submit a transaction. Refer to Send Transactions guide for usage details.

    On success ZKTransaction object is returned via callback.

    Declaration

    Objective-C

    - (void)submitTransaction:(nonnull ZKComposedTransaction *)composedTransaction
                  toAccountId:(nullable NSString *)toAccountId
                     metadata:(nullable NSString *)metadata
                     callback:(nullable id<ZKSubmitTransactionCallback>)callback;

    Parameters

    composedTransaction

    Composed transaction retrieved as a result of one of the compose transaction methods

    toAccountId

    Debit account id override, only applicable to direct custody deposits. In case no account id is specified senders custody account will be debited.

    metadata

    Optional metadata (stringified JSON) that will be attached to transaction

    callback

    An interface to receive the result or error

  • Fetch trading pairs that are currently supported.

    On success stringified JSON containing supported pairs and other details is returned via callback.

    Declaration

    Objective-C

    - (void)fetchTradingPairs:(nullable id<ZKStringifiedJsonCallback>)callback;
  • Compose exchange. Refer to Make Exchanges guide for usage details.

    On success ZKComposedExchange is returned via callback.

    Declaration

    Objective-C

    - (void)composeExchange:(nonnull NSString *)debitAccountId
            creditAccountId:(nonnull NSString *)creditAccountId
                     amount:(nullable NSDecimalNumber *)amount
                    sendMax:(BOOL)sendMax
                   callback:(nullable id<ZKComposeExchangeCallback>)callback;

    Parameters

    debitAccountId

    ZKAccount identifier

    creditAccountId

    ZKAccount identifier

    amount

    amount in deposit account currency

    sendMax

    exchange maximum possible funds

    callback

    an interface to receive the result or error

  • Submit an exchange. Make Exchanges guide for usage details.

    On success ZKExchange object is returned via callback.

    Declaration

    Objective-C

    - (void)submitExchange:(nonnull ZKComposedExchange *)composedExchange
                  callback:(nullable id<ZKSubmitExchangeCallback>)callback;

    Parameters

    composedExchange

    Composed exchange retrieved as the result of composeExchange method

    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

  • Fetch Strong Customer Authentication (SCA) config.

    Declaration

    Objective-C

    - (void)fetchAuthenticationConfig:
        (nullable id<ZKAuthenticationConfigCallback>)callback;

    Parameters

    callback

    an interface to receive the result or error

  • Create card for a fiat account.

    At least one Knowled-Based Authentication (KBA) answer should be defined, answers are limited to 256 characters and cannot be null or empty and only one answer per question type should be provided.

    See

    ZKCard

    Declaration

    Objective-C

    - (void)createCard:(nonnull NSString *)fiatAccountId
              cardType:(nonnull NSString *)cardType
          mobileNumber:(nonnull NSString *)mobileNumber
         knowledgeBase:(nonnull NSArray<ZKKbaAnswer *> *)knowledgeBase
              callback:(nullable id<ZKCardCallback>)callback;

    Parameters

    fiatAccountId

    fiat account id

    cardType

    ‘VIRTUAL’ or ‘PHYSICAL’

    mobileNumber

    card holder mobile number, starting with a ‘+’, followed by the country code and then the mobile number

    callback

    an interface to receive the result or error

    knowledgeBase

    list of KBA answers

  • Set card status to ‘ACTIVE’, ‘BLOCKED’ or ‘CANCELLED’.

    • To block card, set card status to ‘BLOCKED’.
    • To activate a physical card, set card status to ‘ACTIVE’ and provide PAN and CVV2 fields.
    • To cancel a card, set card status to ‘CANCELLED’.
    • To unblock a card, set card status to ‘ACTIVE.’.

    Declaration

    Objective-C

    - (void)setCardStatus:(nonnull NSString *)cardId
               cardStatus:(nonnull NSString *)cardStatus
                      pan:(nullable NSString *)pan
                     cvv2:(nullable NSString *)cvv2
                 callback:(nullable id<ZKSuccessCallback>)callback;

    Parameters

    cardId

    card id

    cardStatus

    new card status

    pan

    PAN when activating a physical card, null otherwise

    cvv2

    CVV2 when activating a physical card, null otherwise

    callback

    an interface to receive the result or error

  • Reveals sensitive card details.

    Declaration

    Objective-C

    - (void)revealCardDetails:(nonnull NSString *)cardId
                     callback:(nullable id<ZKCardDetailsCallback>)callback;

    Parameters

    cardId

    card id

    callback

    an interface to receive the result or error

  • Reveal card PIN.

    Declaration

    Objective-C

    - (void)revealPin:(nonnull NSString *)cardId
             callback:(nullable id<ZKPinCallback>)callback;

    Parameters

    cardId

    card id

    callback

    an interface to receive the result or error

  • Unblock card PIN.

    Declaration

    Objective-C

    - (void)unblockPin:(nonnull NSString *)cardId
              callback:(nullable id<ZKSuccessCallback>)callback;

    Parameters

    cardId

    card id

    callback

    an interface to receive the result or error

  • Add KBA answers to a card without SCA.

    This endpoint is used to set Knowledge-Based Authentication (KBA) answers to a card without Strong Customer Authentication (SCA). Once it is set SCA flag on corresponding card is set to true.

    At least one answer should be defined, answers are limited to 256 characters and cannot be null or empty and only one answer per question type should be provided.

    Declaration

    Objective-C

    - (void)setAuthentication:(nonnull NSString *)cardId
                knowledgeBase:(nonnull NSArray<ZKKbaAnswer *> *)knowledgeBase
                     callback:(nullable id<ZKSuccessCallback>)callback;

    Parameters

    cardId

    card id

    knowledgeBase

    list of KBA answers

    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
                           custodyType:(nonnull NSString *)custodyType;

    Swift

    func getAccount(_ currencyCode: String, network: String, type: String, custodyType: 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’

    custodyType

    custdoy type, i.e. ‘CUSTODY’ or ‘NON-CUSTODY’

    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