ZKExchange

Objective-C

@interface ZKExchange : NSObject

Swift

class ZKExchange : NSObject

Record containing exchange details.

  • Declaration

    Objective-C

    - (nonnull instancetype)initWithId:(nonnull NSString *)id
                                status:(nonnull NSString *)status
                       depositCurrency:(nonnull NSString *)depositCurrency
                      depositAccountId:(nonnull NSString *)depositAccountId
                  depositTransactionId:(nullable NSString *)depositTransactionId
                      withdrawCurrency:(nonnull NSString *)withdrawCurrency
                     withdrawAccountId:(nonnull NSString *)withdrawAccountId
                 withdrawTransactionId:(nullable NSString *)withdrawTransactionId
                                amount:(nonnull NSDecimalNumber *)amount
                            depositFee:(nullable NSDecimalNumber *)depositFee
                          returnAmount:(nonnull NSDecimalNumber *)returnAmount
                           exchangeFee:(nonnull NSDecimalNumber *)exchangeFee
                           withdrawFee:(nonnull NSDecimalNumber *)withdrawFee
                          exchangeRate:(nonnull ZKExchangeRate *)exchangeRate
                      exchangeSettings:(nonnull ZKExchangeSettings *)exchangeSettings
                         exchangeRates:(nonnull NSDictionary<NSString *, NSDictionary<NSString *, ZKExchangeRate *> *> *)exchangeRates
                                 nonce:(nullable NSString *)nonce
                           submittedAt:(nullable NSNumber *)submittedAt
                           confirmedAt:(nullable NSNumber *)confirmedAt;

    Swift

    init(id: String, status: String, depositCurrency: String, depositAccountId: String, depositTransactionId: String?, withdrawCurrency: String, withdrawAccountId: String, withdrawTransactionId: String?, amount: NSDecimalNumber, depositFee: NSDecimalNumber?, returnAmount: NSDecimalNumber, exchangeFee: NSDecimalNumber, withdrawFee: NSDecimalNumber, exchangeRate: ZKExchangeRate, exchangeSettings: ZKExchangeSettings, exchangeRates: [String : [String : ZKExchangeRate]], nonce: String?, submittedAt: NSNumber?, confirmedAt: NSNumber?)
  • Declaration

    Objective-C

    + (nonnull instancetype)exchangeWithId:(nonnull NSString *)id
                                    status:(nonnull NSString *)status
                           depositCurrency:(nonnull NSString *)depositCurrency
                          depositAccountId:(nonnull NSString *)depositAccountId
                      depositTransactionId:(nullable NSString *)depositTransactionId
                          withdrawCurrency:(nonnull NSString *)withdrawCurrency
                         withdrawAccountId:(nonnull NSString *)withdrawAccountId
                     withdrawTransactionId:(nullable NSString *)withdrawTransactionId
                                    amount:(nonnull NSDecimalNumber *)amount
                                depositFee:(nullable NSDecimalNumber *)depositFee
                              returnAmount:(nonnull NSDecimalNumber *)returnAmount
                               exchangeFee:(nonnull NSDecimalNumber *)exchangeFee
                               withdrawFee:(nonnull NSDecimalNumber *)withdrawFee
                              exchangeRate:(nonnull ZKExchangeRate *)exchangeRate
                          exchangeSettings:(nonnull ZKExchangeSettings *)exchangeSettings
                             exchangeRates:(nonnull NSDictionary<NSString *, NSDictionary<NSString *, ZKExchangeRate *> *> *)exchangeRates
                                     nonce:(nullable NSString *)nonce
                               submittedAt:(nullable NSNumber *)submittedAt
                               confirmedAt:(nullable NSNumber *)confirmedAt;
  • id

    Identifier

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) NSString *id;

    Swift

    var id: String { get }
  • Exchange status.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) NSString *status;

    Swift

    var status: String { get }
  • Currency from which exchange was made.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) NSString *depositCurrency;

    Swift

    var depositCurrency: String { get }
  • Source ZKAccount identifier.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) NSString *depositAccountId;

    Swift

    var depositAccountId: String { get }
  • Outgoing ZKTransaction identifier.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *depositTransactionId;

    Swift

    var depositTransactionId: String? { get }
  • Currency to which exchange was made.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) NSString *withdrawCurrency;

    Swift

    var withdrawCurrency: String { get }
  • Target ZKAccount identifier.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) NSString *withdrawAccountId;

    Swift

    var withdrawAccountId: String { get }
  • Return ZKTransaction identifier.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *withdrawTransactionId;

    Swift

    var withdrawTransactionId: String? { get }
  • Amount in deposit currency.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) NSDecimalNumber *amount;

    Swift

    var amount: NSDecimalNumber { get }
  • Deposit transaction fee.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSDecimalNumber *depositFee;

    Swift

    var depositFee: NSDecimalNumber? { get }
  • Amount that user receives, calculated as amount X exchangeRate X (1 - feeRate) - withdrawFee.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) NSDecimalNumber *returnAmount;

    Swift

    var returnAmount: NSDecimalNumber { get }
  • Exchange fee, calculated as amount X exchangeRate X feeRate.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) NSDecimalNumber *exchangeFee;

    Swift

    var exchangeFee: NSDecimalNumber { get }
  • Return transaction fee.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) NSDecimalNumber *withdrawFee;

    Swift

    var withdrawFee: NSDecimalNumber { get }
  • Exchange rate used.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) ZKExchangeRate *exchangeRate;

    Swift

    var exchangeRate: ZKExchangeRate { get }
  • Exchange settings used.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) ZKExchangeSettings *exchangeSettings;

    Swift

    var exchangeSettings: ZKExchangeSettings { get }
  • Exchange rates at the time exchange was made. This can be used to display amounts in local currency to the user.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) NSDictionary<NSString *, NSDictionary<NSString *, ZKExchangeRate *> *> *exchangeRates;

    Swift

    var exchangeRates: [String : [String : ZKExchangeRate]] { get }
  • Exchange nonce or null. Used to prevent double spend.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *nonce;

    Swift

    var nonce: String? { get }
  • Epoch timestamp when transaction was submitted.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSNumber *submittedAt;

    Swift

    var submittedAt: NSNumber? { get }
  • Epoch timestamp when transaction was confirmed or null if not yet confirmed.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSNumber *confirmedAt;

    Swift

    var confirmedAt: NSNumber? { get }