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() -> StringReturn Value
user id
-
Get user integrator id.
Declaration
Objective-C
- (nonnull NSString *)getIntegratorId;Swift
func getIntegratorId() -> StringReturn Value
user integrator id
-
Check if user has wallet
Declaration
Objective-C
- (BOOL)hasWallet;Swift
func hasWallet() -> BoolReturn Value
true if user has wallet
-
Check if user is a registered fiat customer.
Declaration
Objective-C
- (BOOL)isFiatCustomer;Swift
func isFiatCustomer() -> BoolReturn 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
firstNamefirst name
middleNamemiddle name or null
lastNamelast name
dateOfBirthdate of birth in ISO 8601 format, e.g ‘2020-08-12’
emailemail
phonephone number
addresshome address
callbackan 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
ZKAccountDeclaration
Objective-C
- (void)createAccount:(nonnull NSString *)currencyCode callback:(nullable id<ZKAccountCallback>)callback;Parameters
currencyCodecountry code, e.g. ‘GBP’, ‘BTC’, ‘ETH’
callbackan 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
ZKComposedTransactionis 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; -
Compose custody withdraw transaction from custody account. Refer to Send Transactions guide for usage details.
On success
ZKComposedTransactionis 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
fromAccountIdcustody
ZKAccountidentifierdestinationdestination address or non-custodial account identifier
amountamount in source account currency
sendMaxsend maximum possible funds to destination
callbackan 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
ZKComposedTransactionobject 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
fromAccountIdZKAccountidentifieramountamount in source account currency
sendMaxsend maximum possible funds to destination
callbackan interface to receive the result or error
-
Submit a transaction. Refer to Send Transactions guide for usage details.
On success
ZKTransactionobject 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
composedTransactionComposed transaction retrieved as a result of one of the compose transaction methods
toAccountIdDebit account id override, only applicable to direct custody deposits. In case no account id is specified senders custody account will be debited.
metadataOptional metadata (stringified JSON) that will be attached to transaction
callbackAn 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
ZKComposedExchangeis 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; -
Submit an exchange. Make Exchanges guide for usage details.
On success
ZKExchangeobject is returned via callback.Declaration
Objective-C
- (void)submitExchange:(nonnull ZKComposedExchange *)composedExchange callback:(nullable id<ZKSubmitExchangeCallback>)callback;Parameters
composedExchangeComposed exchange retrieved as the result of
composeExchangemethodcallbackAn 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
accountIdZKAccountidcallbackan interface to receive the result or error
-
Fetch Strong Customer Authentication (SCA) config.
Declaration
Objective-C
- (void)fetchAuthenticationConfig: (nullable id<ZKAuthenticationConfigCallback>)callback;Parameters
callbackan 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
ZKCardSee
ZKCardTypeDeclaration
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
fiatAccountIdfiat account id
cardType‘VIRTUAL’ or ‘PHYSICAL’
mobileNumbercard holder mobile number, starting with a ‘+’, followed by the country code and then the mobile number
callbackan interface to receive the result or error
knowledgeBaselist 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.’.
See
ZKCardStatusDeclaration
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
cardIdcard id
cardStatusnew card status
panPAN when activating a physical card, null otherwise
cvv2CVV2 when activating a physical card, null otherwise
callbackan interface to receive the result or error
-
Reveals sensitive card details.
See
ZKCardDetailsDeclaration
Objective-C
- (void)revealCardDetails:(nonnull NSString *)cardId callback:(nullable id<ZKCardDetailsCallback>)callback;Parameters
cardIdcard id
callbackan interface to receive the result or error
-
Reveal card PIN.
Declaration
Objective-C
- (void)revealPin:(nonnull NSString *)cardId callback:(nullable id<ZKPinCallback>)callback;Parameters
cardIdcard id
callbackan interface to receive the result or error
-
Unblock card PIN.
Declaration
Objective-C
- (void)unblockPin:(nonnull NSString *)cardId callback:(nullable id<ZKSuccessCallback>)callback;Parameters
cardIdcard id
callbackan 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
cardIdcard id
knowledgeBaselist of KBA answers
callbackan 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
generateMnemonicmethod inZKUtilsclass.See
ZKWalletDeclaration
Objective-C
- (void)createWallet:(nonnull NSString *)mnemonic password:(nonnull NSString *)password callback:(nullable id<ZKWalletCallback>)callback;Parameters
mnemonicmnemonic seed phrase
passworduser provided password
callbackan interface to receive the result or error
-
Unlock user wallet with user’s password.
See
ZKWalletDeclaration
Objective-C
- (void)unlockWallet:(nonnull NSString *)password callback:(nullable id<ZKWalletCallback>)callback;Parameters
passworduser provided password
callbackan 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
passworduser provided password
callbackan 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) -> BoolParameters
mnemonicmnemonic 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
mnemonicmnemonic seed phrase corresponding to user’s wallet
passworduser provided password
callbackan interface to receive the result or error
-
Get account in specific currency, on specific network, with specific type.
See
ZKCurrencyCodeSee
ZKNetworkTypeSee
ZKAccountTypeSee
ZKCustodyTypeDeclaration
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
currencyCodecurrency code, e.g. ‘BTC’, ‘ETH’ or ‘GBP’
networknetwork type, e.g. ‘MAINNET’, ‘TESTNET’ or ‘RINKEBY’
typeaccount type, e.g. ‘STANDARD’, ‘COMPATIBILITY’ or ‘SEGWIT’
custodyTypecustdoy type, i.e. ‘CUSTODY’ or ‘NON-CUSTODY’
Return Value
account with selected parameters if it exists, null otherwise
-
Listen to all account data changes.
Declaration
Objective-C
- (void)addAccountDataListener:(nullable id<ZKAccountDataListener>)listener;Parameters
listenerinterface to listen to user changes
-
Remove listener to account data changes.
Declaration
Objective-C
- (void)removeAccountDataListener:(nullable id<ZKAccountDataListener>)listener;Parameters
listenerinterface to listen to user changes
-
createWalletcompletion handler extension.Declaration
Objective-C
- (void)createWallet:(nonnull NSString *)mnemonic password:(nonnull NSString *)password completion:(ZKWalletCompletionBlock _Nonnull)completionHandler;Swift
func createWallet(_ mnemonic: String, password: String) async throws -> ZKWallet -
unlockWalletcompletion handler extension.Declaration
Objective-C
- (void)unlockWallet:(nonnull NSString *)password completion:(ZKWalletCompletionBlock _Nonnull)completionHandler;Swift
func unlockWallet(_ password: String) async throws -> ZKWallet -
revealMnemoniccompletion handler extension.Declaration
Objective-C
- (void)revealMnemonic:(nonnull NSString *)password completion:(ZKMnemonicCompletionBlock _Nonnull)completionHandler;Swift
func revealMnemonic(_ password: String) async throws -> String -
recoverWalletcompletion handler extension.Declaration
Objective-C
- (void)recoverWallet:(nonnull NSString *)mnemonic password:(nonnull NSString *)password completion:(ZKWalletCompletionBlock _Nonnull)completionHandler;Swift
func recoverWallet(_ mnemonic: String, password: String) async throws -> ZKWallet -
makeFiatCustomercompletion handler extension.See
-[ZKUser makeFiatCustomer:firstName:middleName:lastName:dateOfBirth:email:phone:address:callback:]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 completion:(ZKSuccessCompletionBlock _Nonnull)completionHandler;Swift
func makeFiatCustomer(_ firstName: String, middleName: String?, lastName: String, dateOfBirth: String, email: String, phone: String, address: ZKAddress) async throws -
createAccountcompletion handler extension.Declaration
Objective-C
- (void)createAccount:(nonnull NSString *)currencyCode completion:(ZKAccountCompletionBlock _Nonnull)completionHandler;Swift
func createAccount(_ currencyCode: String) async throws -> ZKAccount -
getNominatedAccountFiatPropertiescompletion handler extension.Declaration
Objective-C
- (void) getNominatedAccountFiatProperties:(nonnull NSString *)accountId completion: (ZKAccountFiatPropertiesCompletionBlock _Nonnull) completionHandler;Swift
func nominatedAccountFiatProperties(_ accountId: String) async throws -> ZKAccountFiatProperties -
fetchAuthenticationConfigcompletion handler extension.See
-[ZKUser fetchAuthenticationConfig:callback:]Declaration
Objective-C
- (void)fetchAuthenticationConfigWithCompletion: (ZKAuthenticationConfigCompletionBlock _Nonnull)completionHandler;Swift
func fetchAuthenticationConfig() async throws -> ZKAuthenticationConfig -
createCardcompletion handler extension.Declaration
Objective-C
- (void)createCard:(nonnull NSString *)fiatAccountId cardType:(nonnull NSString *)cardType mobileNumber:(nonnull NSString *)mobileNumber knowledgeBase:(nonnull NSArray<ZKKbaAnswer *> *)knowledgeBase completion:(ZKCardCompletionBlock _Nonnull)completionHandler;Swift
func createCard(_ fiatAccountId: String, cardType: String, mobileNumber: String, knowledgeBase: [ZKKbaAnswer]) async throws -> ZKCard -
setCardStatuscompletion handler extension.See
-[ZKUser setCardStatus:pan:cvv2:callback:]Declaration
Objective-C
- (void)setCardStatus:(nonnull NSString *)cardId cardStatus:(nonnull NSString *)cardStatus pan:(nullable NSString *)pan cvv2:(nullable NSString *)cvv2 completion:(ZKSuccessCompletionBlock _Nonnull)completionHandler;Swift
func setCardStatus(_ cardId: String, cardStatus: String, pan: String?, cvv2: String?) async throws -
revealCardDetailscompletion handler extension.Declaration
Objective-C
- (void)revealCardDetails:(nonnull NSString *)cardId completion: (ZKCardDetailsCompletionBlock _Nonnull)completionHandler;Swift
func revealCardDetails(_ cardId: String) async throws -> ZKCardDetails -
revealPincompletion handler extension.Declaration
Objective-C
- (void)revealPin:(nonnull NSString *)cardId completion:(ZKPinCompletionBlock _Nonnull)completionHandler;Swift
func revealPin(_ cardId: String) async throws -> Int32 -
unblockPincompletion handler extension.Declaration
Objective-C
- (void)unblockPin:(nonnull NSString *)cardId completion:(ZKSuccessCompletionBlock _Nonnull)completionHandler;Swift
func unblockPin(_ cardId: String) async throws -
setAuthenticationcompletion handler extension.Declaration
Objective-C
- (void)setAuthentication:(nonnull NSString *)cardId knowledgeBase:(nonnull NSArray<ZKKbaAnswer *> *)knowledgeBase completion:(ZKSuccessCompletionBlock _Nonnull)completionHandler;Swift
func setAuthentication(_ cardId: String, knowledgeBase: [ZKKbaAnswer]) async throws -
composeTransactioncompletion handler extension.Declaration
Objective-C
- (void)composeTransaction:(nonnull NSString *)fromAccountId toAccountId:(nonnull NSString *)toAccountId amount:(nullable NSDecimalNumber *)amount sendMax:(BOOL)sendMax completion:(ZKComposeTransactionCompletionBlock _Nonnull) completionHandler;Swift
func composeTransaction(_ fromAccountId: String, toAccountId: String, amount: NSDecimalNumber?, sendMax: Bool) async throws -> ZKComposedTransaction -
composeCustodyWithdrawTransactioncompletion handler extension.Declaration
Objective-C
- (void) composeCustodyWithdrawTransaction:(nonnull NSString *)fromAccountId destination:(nonnull NSString *)destination amount:(nullable NSDecimalNumber *)amount sendMax:(BOOL)sendMax completion: (ZKComposeTransactionCompletionBlock _Nonnull) completionHandler;Swift
func composeCustodyWithdrawTransaction(_ fromAccountId: String, destination: String, amount: NSDecimalNumber?, sendMax: Bool) async throws -> ZKComposedTransaction -
composeNominatedTransactioncompletion handler extension.Declaration
Objective-C
- (void)composeNominatedTransaction:(nonnull NSString *)fromAccountId amount:(nullable NSDecimalNumber *)amount sendMax:(BOOL)sendMax completion: (ZKComposeTransactionCompletionBlock _Nonnull) completionHandler;Swift
func composeNominatedTransaction(_ fromAccountId: String, amount: NSDecimalNumber?, sendMax: Bool) async throws -> ZKComposedTransaction -
fetchTradingPairsWithCompletionHandlercompletion handler extension.See
-[ZKUser fetchTradingPairs]Declaration
Objective-C
- (void)fetchTradingPairsWithCompletionHandler: (ZKStringifiedJsonCompletionBlock _Nonnull)completionHandler;Swift
func fetchTradingPairs() async throws -> String -
composeExchangecompletion handler extension.Declaration
Objective-C
- (void)composeExchange:(nonnull NSString *)debitAccountId creditAccountId:(nonnull NSString *)creditAccountId amount:(nullable NSDecimalNumber *)amount sendMax:(BOOL)sendMax completion: (ZKComposeExchangeCompletionBlock _Nonnull)completionHandler;Swift
func composeExchange(_ debitAccountId: String, creditAccountId: String, amount: NSDecimalNumber?, sendMax: Bool) async throws -> ZKComposedExchange -
submitTransactioncompletion handler extension.Declaration
Objective-C
- (void)submitTransaction:(nonnull ZKComposedTransaction *)composedTransaction toAccountId:(nullable NSString *)toAccountId metadata:(nullable NSString *)metadata completion:(ZKSubmitTransactionCompletionBlock _Nonnull) completionHandler;Swift
func submitTransaction(_ composedTransaction: ZKComposedTransaction, toAccountId: String?, metadata: String?) async throws -> ZKTransaction -
submitExchangecompletion handler extension.Declaration
Objective-C
- (void)submitExchange:(nonnull ZKComposedExchange *)composedExchange completion: (ZKSubmitExchangeCompletionBlock _Nonnull)completionHandler;Swift
func submitExchange(_ composedExchange: ZKComposedExchange) async throws -> ZKExchange
View on GitHub
ZKUser Class Reference