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
                          fromCurrency:(nonnull NSString *)fromCurrency
                         fromAccountId:(nonnull NSString *)fromAccountId
                 outgoingTransactionId:(nullable NSString *)outgoingTransactionId
                            toCurrency:(nonnull NSString *)toCurrency
                           toAccountId:(nonnull NSString *)toAccountId
                   returnTransactionId:(nullable NSString *)returnTransactionId
                                amount:(nonnull NSDecimalNumber *)amount
                outgoingTransactionFee:(nullable NSDecimalNumber *)outgoingTransactionFee
                          returnAmount:(nonnull NSDecimalNumber *)returnAmount
                           exchangeFee:(nonnull NSDecimalNumber *)exchangeFee
                  returnTransactionFee:(nonnull NSDecimalNumber *)returnTransactionFee
                                 quote:(nonnull ZKQuote *)quote
                       exchangeSetting:(nonnull ZKExchangeSetting *)exchangeSetting
                         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, fromCurrency: String, fromAccountId: String, outgoingTransactionId: String?, toCurrency: String, toAccountId: String, returnTransactionId: String?, amount: NSDecimalNumber, outgoingTransactionFee: NSDecimalNumber?, returnAmount: NSDecimalNumber, exchangeFee: NSDecimalNumber, returnTransactionFee: NSDecimalNumber, quote: ZKQuote, exchangeSetting: ZKExchangeSetting, exchangeRates: [String : [String : ZKExchangeRate]], nonce: String?, submittedAt: NSNumber?, confirmedAt: NSNumber?)
  • Declaration

    Objective-C

    + (nonnull instancetype)exchangeWithId:(nonnull NSString *)id
                                    status:(nonnull NSString *)status
                              fromCurrency:(nonnull NSString *)fromCurrency
                             fromAccountId:(nonnull NSString *)fromAccountId
                     outgoingTransactionId:(nullable NSString *)outgoingTransactionId
                                toCurrency:(nonnull NSString *)toCurrency
                               toAccountId:(nonnull NSString *)toAccountId
                       returnTransactionId:(nullable NSString *)returnTransactionId
                                    amount:(nonnull NSDecimalNumber *)amount
                    outgoingTransactionFee:(nullable NSDecimalNumber *)outgoingTransactionFee
                              returnAmount:(nonnull NSDecimalNumber *)returnAmount
                               exchangeFee:(nonnull NSDecimalNumber *)exchangeFee
                      returnTransactionFee:(nonnull NSDecimalNumber *)returnTransactionFee
                                     quote:(nonnull ZKQuote *)quote
                           exchangeSetting:(nonnull ZKExchangeSetting *)exchangeSetting
                             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 *fromCurrency;

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

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

    Swift

    var outgoingTransactionFee: NSDecimalNumber? { get }
  • Amount that user receives, calculated as amount X quote.value X (1 - feeRate) - returnTransactionFee.

    Declaration

    Objective-C

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

    Swift

    var returnAmount: NSDecimalNumber { get }
  • Exchange fee, calculated as amount X quote.value X exchangeFeeRate.

    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 *returnTransactionFee;

    Swift

    var returnTransactionFee: NSDecimalNumber { get }
  • Exchange rate quote used.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) ZKQuote *quote;

    Swift

    var quote: ZKQuote { get }
  • Exchange setting used.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) ZKExchangeSetting *exchangeSetting;

    Swift

    var exchangeSetting: ZKExchangeSetting { 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 }