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;
-
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
identifierdestination
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
identifieramount
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;
-
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
methodcallback
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
ZKAccount
idcallback
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
See
ZKCardType
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.’.
See
ZKCardStatus
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.
See
ZKCardDetails
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 inZKUtils
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.
See
ZKCurrencyCode
See
ZKNetworkType
See
ZKAccountType
See
ZKCustodyType
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
-
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
-
createWallet
completion 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
-
unlockWallet
completion handler extension.Declaration
Objective-C
- (void)unlockWallet:(nonnull NSString *)password completion:(ZKWalletCompletionBlock _Nonnull)completionHandler;
Swift
func unlockWallet(_ password: String) async throws -> ZKWallet
-
revealMnemonic
completion handler extension.Declaration
Objective-C
- (void)revealMnemonic:(nonnull NSString *)password completion:(ZKMnemonicCompletionBlock _Nonnull)completionHandler;
Swift
func revealMnemonic(_ password: String) async throws -> String
-
recoverWallet
completion 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
-
makeFiatCustomer
completion 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
-
createAccount
completion handler extension.Declaration
Objective-C
- (void)createAccount:(nonnull NSString *)currencyCode completion:(ZKAccountCompletionBlock _Nonnull)completionHandler;
Swift
func createAccount(_ currencyCode: String) async throws -> ZKAccount
-
getNominatedAccountFiatProperties
completion handler extension.Declaration
Objective-C
- (void) getNominatedAccountFiatProperties:(nonnull NSString *)accountId completion: (ZKAccountFiatPropertiesCompletionBlock _Nonnull) completionHandler;
Swift
func nominatedAccountFiatProperties(_ accountId: String) async throws -> ZKAccountFiatProperties
-
fetchAuthenticationConfig
completion handler extension.See
-[ZKUser fetchAuthenticationConfig:callback:]
Declaration
Objective-C
- (void)fetchAuthenticationConfigWithCompletion: (ZKAuthenticationConfigCompletionBlock _Nonnull)completionHandler;
Swift
func fetchAuthenticationConfig() async throws -> ZKAuthenticationConfig
-
createCard
completion 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
-
setCardStatus
completion 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
-
revealCardDetails
completion handler extension.Declaration
Objective-C
- (void)revealCardDetails:(nonnull NSString *)cardId completion: (ZKCardDetailsCompletionBlock _Nonnull)completionHandler;
Swift
func revealCardDetails(_ cardId: String) async throws -> ZKCardDetails
-
revealPin
completion handler extension.Declaration
Objective-C
- (void)revealPin:(nonnull NSString *)cardId completion:(ZKPinCompletionBlock _Nonnull)completionHandler;
Swift
func revealPin(_ cardId: String) async throws -> Int32
-
unblockPin
completion handler extension.Declaration
Objective-C
- (void)unblockPin:(nonnull NSString *)cardId completion:(ZKSuccessCompletionBlock _Nonnull)completionHandler;
Swift
func unblockPin(_ cardId: String) async throws
-
setAuthentication
completion 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
-
composeTransaction
completion 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
-
composeCustodyWithdrawTransaction
completion 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
-
composeNominatedTransaction
completion 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
-
fetchTradingPairsWithCompletionHandler
completion handler extension.See
-[ZKUser fetchTradingPairs]
Declaration
Objective-C
- (void)fetchTradingPairsWithCompletionHandler: (ZKStringifiedJsonCompletionBlock _Nonnull)completionHandler;
Swift
func fetchTradingPairs() async throws -> String
-
composeExchange
completion 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
-
submitTransaction
completion 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
-
submitExchange
completion handler extension.Declaration
Objective-C
- (void)submitExchange:(nonnull ZKComposedExchange *)composedExchange completion: (ZKSubmitExchangeCompletionBlock _Nonnull)completionHandler;
Swift
func submitExchange(_ composedExchange: ZKComposedExchange) async throws -> ZKExchange