Skip to content

Commit a9f699b

Browse files
committed
Merge branch 'hotfix/0.2.5'
2 parents a0a2836 + 61f26a5 commit a9f699b

17 files changed

+73
-70
lines changed

Adamant/Helpers/JSModels.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,39 +72,39 @@ import JavaScriptCore
7272
// MARK: - Transaction
7373

7474
@objc protocol JSTransactionProtocol: JSExport {
75-
var id: UInt { get set }
75+
var id: UInt64 { get set }
7676
var height: Int { get set }
77-
var blockId: UInt { get set }
77+
var blockId: UInt64 { get set }
7878
var type: Int { get set }
79-
var timestamp: UInt { get set }
79+
var timestamp: UInt64 { get set }
8080
var senderPublicKey: String? { get set }
8181
var senderId: String? { get set }
8282
var recipientId: String? { get set }
8383
var recipientPublicKey: String? { get set }
84-
var amount: UInt { get set }
85-
var fee: UInt { get set }
84+
var amount: UInt64 { get set }
85+
var fee: UInt64 { get set }
8686
var signature: String? { get set }
87-
var confirmations: UInt { get set }
87+
var confirmations: UInt64 { get set }
8888
var asset: JSAsset { get set }
8989
}
9090

9191
@objc class JSTransaction: NSObject, JSTransactionProtocol {
92-
dynamic var id: UInt
92+
dynamic var id: UInt64
9393
dynamic var height: Int
94-
dynamic var blockId: UInt
94+
dynamic var blockId: UInt64
9595
dynamic var type: Int
96-
dynamic var timestamp: UInt
96+
dynamic var timestamp: UInt64
9797
dynamic var senderPublicKey: String?
9898
dynamic var senderId: String?
9999
dynamic var recipientId: String?
100100
dynamic var recipientPublicKey: String?
101-
dynamic var amount: UInt
102-
dynamic var fee: UInt
101+
dynamic var amount: UInt64
102+
dynamic var fee: UInt64
103103
dynamic var signature: String?
104-
dynamic var confirmations: UInt
104+
dynamic var confirmations: UInt64
105105
dynamic var asset: JSAsset
106106

107-
init(id: UInt, height: Int, blockId: UInt, type: Int, timestamp: UInt, senderPublicKey: String?, senderId: String?, recipientId: String?, recipientPublicKey: String?, amount: UInt, fee: UInt, signature: String?, confirmations: UInt, asset: JSAsset) {
107+
init(id: UInt64, height: Int, blockId: UInt64, type: Int, timestamp: UInt64, senderPublicKey: String?, senderId: String?, recipientId: String?, recipientPublicKey: String?, amount: UInt64, fee: UInt64, signature: String?, confirmations: UInt64, asset: JSAsset) {
108108
self.id = id
109109
self.height = height
110110
self.blockId = blockId

Adamant/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>0.2.4</string>
20+
<string>0.2.5</string>
2121
<key>CFBundleVersion</key>
22-
<string>11</string>
22+
<string>12</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>NSCameraUsageDescription</key>

Adamant/Models/Account.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import Foundation
1010

1111
struct Account {
1212
let address: String
13-
var unconfirmedBalance: UInt
14-
var balance: UInt
13+
var unconfirmedBalance: UInt64
14+
var balance: UInt64
1515
let publicKey: String
1616
let unconfirmedSignature: Int
1717
let secondSignature: Int
@@ -37,8 +37,8 @@ extension Account: Decodable {
3737
let container = try decoder.container(keyedBy: CodingKeys.self)
3838

3939
self.address = try container.decode(String.self, forKey: .address)
40-
self.unconfirmedBalance = UInt(try container.decode(String.self, forKey: .unconfirmedBalance))!
41-
self.balance = UInt(try container.decode(String.self, forKey: .balance))!
40+
self.unconfirmedBalance = UInt64(try container.decode(String.self, forKey: .unconfirmedBalance))!
41+
self.balance = UInt64(try container.decode(String.self, forKey: .balance))!
4242
self.unconfirmedSignature = try container.decode(Int.self, forKey: .unconfirmedSignature)
4343
self.publicKey = try container.decode(String.self, forKey: .publicKey)
4444
self.secondSignature = try container.decode(Int.self, forKey: .secondSignature)

Adamant/Models/NormalizedTransaction.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import Foundation
1010

1111
struct NormalizedTransaction {
1212
let type: TransactionType
13-
let amount: UInt
13+
let amount: UInt64
1414
let senderPublicKey: String
1515
let requesterPublicKey: String?
16-
let timestamp: UInt
16+
let timestamp: UInt64
1717
let recipientId: String
1818
let asset: TransactionAsset
1919

@@ -37,10 +37,10 @@ extension NormalizedTransaction: Decodable {
3737
let container = try decoder.container(keyedBy: CodingKeys.self)
3838

3939
self.type = try container.decode(TransactionType.self, forKey: .type)
40-
self.amount = try container.decode(UInt.self, forKey: .amount)
40+
self.amount = try container.decode(UInt64.self, forKey: .amount)
4141
self.senderPublicKey = try container.decode(String.self, forKey: .senderPublicKey)
4242
self.requesterPublicKey = try? container.decode(String.self, forKey: .requesterPublicKey)
43-
self.timestamp = try container.decode(UInt.self, forKey: .timestamp)
43+
self.timestamp = try container.decode(UInt64.self, forKey: .timestamp)
4444
self.recipientId = try container.decode(String.self, forKey: .recipientId)
4545
self.asset = try container.decode(TransactionAsset.self, forKey: .asset)
4646
}

Adamant/Models/Transaction.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
import Foundation
1010

1111
struct Transaction {
12-
let id: UInt
12+
let id: UInt64
1313
let height: Int
14-
let blockId: UInt
14+
let blockId: UInt64
1515
let type: TransactionType
16-
let timestamp: UInt
16+
let timestamp: UInt64
1717
let senderPublicKey: String
1818
let senderId: String
1919
let requesterPublicKey: String?
2020
let recipientId: String
2121
let recipientPublicKey: String?
22-
let amount: UInt
23-
let fee: UInt
22+
let amount: UInt64
23+
let fee: UInt64
2424
let signature: String
2525
let signSignature: String?
26-
let confirmations: UInt
26+
let confirmations: UInt64
2727
let signatures: [String]
2828
let asset: TransactionAsset
2929

@@ -54,19 +54,19 @@ extension Transaction: Decodable {
5454
init(from decoder: Decoder) throws {
5555
let container = try decoder.container(keyedBy: CodingKeys.self)
5656

57-
self.id = UInt(try container.decode(String.self, forKey: .id))!
57+
self.id = UInt64(try container.decode(String.self, forKey: .id))!
5858
self.height = try container.decode(Int.self, forKey: .height)
59-
self.blockId = UInt(try container.decode(String.self, forKey: .blockId))!
59+
self.blockId = UInt64(try container.decode(String.self, forKey: .blockId))!
6060
self.type = try container.decode(TransactionType.self, forKey: .type)
61-
self.timestamp = try container.decode(UInt.self, forKey: .timestamp)
61+
self.timestamp = try container.decode(UInt64.self, forKey: .timestamp)
6262
self.senderPublicKey = try container.decode(String.self, forKey: .senderPublicKey)
6363
self.senderId = try container.decode(String.self, forKey: .senderId)
6464
self.recipientId = try container.decode(String.self, forKey: .recipientId)
6565
self.recipientPublicKey = try? container.decode(String.self, forKey: .recipientPublicKey)
66-
self.amount = try container.decode(UInt.self, forKey: .amount)
67-
self.fee = try container.decode(UInt.self, forKey: .fee)
66+
self.amount = try container.decode(UInt64.self, forKey: .amount)
67+
self.fee = try container.decode(UInt64.self, forKey: .fee)
6868
self.signature = try container.decode(String.self, forKey: .signature)
69-
self.confirmations = (try? container.decode(UInt.self, forKey: .confirmations)) ?? 0
69+
self.confirmations = (try? container.decode(UInt64.self, forKey: .confirmations)) ?? 0
7070
self.requesterPublicKey = try? container.decode(String.self, forKey: .requesterPublicKey)
7171
self.signSignature = try? container.decode(String.self, forKey: .signSignature)
7272
self.signatures = try container.decode([String].self, forKey: .signatures)

Adamant/ServerResponses/ProcessTransactionResponse.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
import Foundation
1010

1111
class ProcessTransactionResponse: ServerResponse {
12-
let transactionId: UInt?
12+
let transactionId: UInt64?
1313

1414
required init(from decoder: Decoder) throws {
1515
let container = try decoder.container(keyedBy: CodingKeys.self)
1616
let success = try container.decode(Bool.self, forKey: .success)
1717
let error = try? container.decode(String.self, forKey: .error)
1818

1919
if let idRaw = try? container.decode(String.self, forKey: CodingKeys.init(stringValue: "transactionId")!) {
20-
transactionId = UInt(idRaw)
20+
transactionId = UInt64(idRaw)
2121
} else {
2222
transactionId = nil
2323
}

Adamant/ServiceProtocols/ApiService.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ protocol ApiService {
6767

6868
// MARK: - Transactions
6969

70-
func getTransaction(id: UInt, completion: @escaping (ApiServiceResult<Transaction>) -> Void)
71-
func getTransactions(forAccount: String, type: TransactionType, fromHeight: UInt?, completion: @escaping (ApiServiceResult<[Transaction]>) -> Void)
70+
func getTransaction(id: UInt64, completion: @escaping (ApiServiceResult<Transaction>) -> Void)
71+
func getTransactions(forAccount: String, type: TransactionType, fromHeight: UInt64?, completion: @escaping (ApiServiceResult<[Transaction]>) -> Void)
7272

7373

7474
// MARK: - Funds
7575

76-
func transferFunds(sender: String, recipient: String, amount: UInt, keypair: Keypair, completion: @escaping (ApiServiceResult<Bool>) -> Void)
76+
func transferFunds(sender: String, recipient: String, amount: UInt64, keypair: Keypair, completion: @escaping (ApiServiceResult<Bool>) -> Void)
7777

7878

7979
// MARK: - Chats
@@ -87,5 +87,5 @@ protocol ApiService {
8787

8888
/// Send text message
8989
/// - completion: Contains processed transactionId, if success, or AdamantError, if fails.
90-
func sendMessage(senderId: String, recipientId: String, keypair: Keypair, message: String, nonce: String, completion: @escaping (ApiServiceResult<UInt>) -> Void)
90+
func sendMessage(senderId: String, recipientId: String, keypair: Keypair, message: String, nonce: String, completion: @escaping (ApiServiceResult<UInt64>) -> Void)
9191
}

Adamant/Services/ApiService/AdamantApi+Chats.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ extension AdamantApiService {
5252
}
5353
}
5454

55-
func sendMessage(senderId: String, recipientId: String, keypair: Keypair, message: String, nonce: String, completion: @escaping (ApiServiceResult<UInt>) -> Void) {
55+
func sendMessage(senderId: String, recipientId: String, keypair: Keypair, message: String, nonce: String, completion: @escaping (ApiServiceResult<UInt64>) -> Void) {
5656
// MARK: 1. Prepare params
5757
let params: [String : Any] = [
5858
"type": TransactionType.chatMessage.rawValue,

Adamant/Services/ApiService/AdamantApi+Transactions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extension AdamantApiService.ApiCommands {
1818
}
1919

2020
extension AdamantApiService {
21-
func getTransaction(id: UInt, completion: @escaping (ApiServiceResult<Transaction>) -> Void) {
21+
func getTransaction(id: UInt64, completion: @escaping (ApiServiceResult<Transaction>) -> Void) {
2222
let endpoint: URL
2323
do {
2424
endpoint = try buildUrl(path: ApiCommands.Transactions.getTransaction, queryItems: [URLQueryItem(name: "id", value: String(id))])
@@ -44,7 +44,7 @@ extension AdamantApiService {
4444
}
4545
}
4646

47-
func getTransactions(forAccount account: String, type: TransactionType, fromHeight: UInt?, completion: @escaping (ApiServiceResult<[Transaction]>) -> Void) {
47+
func getTransactions(forAccount account: String, type: TransactionType, fromHeight: UInt64?, completion: @escaping (ApiServiceResult<[Transaction]>) -> Void) {
4848
var queryItems = [URLQueryItem(name: "inId", value: account),
4949
URLQueryItem(name: "and:type", value: String(type.rawValue))]
5050

Adamant/Services/ApiService/AdamantApi+Transfers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010

1111
extension AdamantApiService {
12-
func transferFunds(sender: String, recipient: String, amount: UInt, keypair: Keypair, completion: @escaping (ApiServiceResult<Bool>) -> Void) {
12+
func transferFunds(sender: String, recipient: String, amount: UInt64, keypair: Keypair, completion: @escaping (ApiServiceResult<Bool>) -> Void) {
1313
// MARK: 1. Prepare params
1414
let params: [String : Any] = [
1515
"type": TransactionType.send.rawValue,

Adamant/Services/DataProviders/AdamantChatsProvider.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class AdamantChatsProvider: ChatsProvider {
2121
private(set) var state: State = .empty
2222
private(set) var lastHeight: Int?
2323
private let apiTransactions = 100
24-
private var unconfirmedTransactions: [UInt:ChatTransaction] = [:]
24+
private var unconfirmedTransactions: [UInt64:ChatTransaction] = [:]
2525

2626
private let processingQueue = DispatchQueue(label: "im.adamant.processing.chat", qos: .utility, attributes: [.concurrent])
2727
private let sendingQueue = DispatchQueue(label: "im.adamant.sending.chat", qos: .utility, attributes: [.concurrent])
@@ -704,7 +704,7 @@ extension AdamantChatsProvider {
704704
/// - transaction: Unconfirmed transaction
705705
/// - id: New transaction id
706706
/// - height: New transaction height
707-
private func confirmTransaction(_ transaction: ChatTransaction, id: UInt, height: Int) {
707+
private func confirmTransaction(_ transaction: ChatTransaction, id: UInt64, height: Int) {
708708
if transaction.isConfirmed {
709709
return
710710
}

Adamant/Services/DataProviders/AdamantTransfersProvider.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AdamantTransfersProvider: TransfersProvider {
1818

1919
// MARK: Properties
2020
private(set) var state: State = .empty
21-
private var lastHeight: UInt?
21+
private var lastHeight: UInt64?
2222

2323
private let processingQueue = DispatchQueue(label: "im.Adamant.processing.transfers", qos: .utility, attributes: [.concurrent])
2424
private let stateSemaphore = DispatchSemaphore(value: 1)
@@ -148,7 +148,7 @@ extension AdamantTransfersProvider {
148148
return
149149
}
150150

151-
apiService.transferFunds(sender: senderAddress, recipient: recipient, amount: (amount as NSDecimalNumber).uintValue, keypair: keypair) { result in
151+
apiService.transferFunds(sender: senderAddress, recipient: recipient, amount: (amount as NSDecimalNumber).uint64Value, keypair: keypair) { result in
152152
switch result {
153153
case .success(_):
154154
completion(.success)
@@ -263,7 +263,7 @@ extension AdamantTransfersProvider {
263263
// MARK: 4. Check lastHeight
264264
// API returns transactions from lastHeight INCLUDING transaction with height == lastHeight, so +1
265265
if height > 0 {
266-
let uH = UInt(height + 1)
266+
let uH = UInt64(height + 1)
267267

268268
if let lastHeight = lastHeight {
269269
if lastHeight < uH {

Adamant/Stories/Chats/ChatViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ChatViewController: MessagesViewController {
6060
private var feeIsVisible: Bool = false
6161
private var feeTimer: Timer?
6262
private var feeLabel: InputBarButtonItem?
63-
private var prevFee: UInt = 0
63+
private var prevFee: UInt64 = 0
6464

6565

6666
// MARK: - Lifecycle
@@ -170,7 +170,7 @@ class ChatViewController: MessagesViewController {
170170

171171
// MARK: - EstimatedFee label
172172
extension ChatViewController {
173-
private func setEstimatedFee(_ fee: UInt) {
173+
private func setEstimatedFee(_ fee: UInt64) {
174174
if prevFee != fee && fee > 0 {
175175
guard let feeLabel = feeLabel else {
176176
return

Adamant/Stories/Login/LoginHeader.xib

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3-
<device id="retina4_7" orientation="portrait">
3+
<device id="retina4_0" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
@@ -20,36 +20,39 @@
2020
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
2121
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
2222
<view contentMode="scaleToFill" id="zyJ-1h-Ix7">
23-
<rect key="frame" x="0.0" y="0.0" width="374" height="374"/>
23+
<rect key="frame" x="0.0" y="0.0" width="320" height="350"/>
2424
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
2525
<subviews>
2626
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="hUF-Ul-HEi">
27-
<rect key="frame" x="75" y="42" width="225" height="290.5"/>
27+
<rect key="frame" x="0.0" y="46.5" width="320" height="257"/>
2828
<subviews>
2929
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Adamant_Logo" translatesAutoresizingMaskIntoConstraints="NO" id="Ci1-bB-rdf">
30-
<rect key="frame" x="0.0" y="0.0" width="225" height="225"/>
30+
<rect key="frame" x="64" y="0.0" width="192" height="191.5"/>
3131
<constraints>
3232
<constraint firstAttribute="width" secondItem="Ci1-bB-rdf" secondAttribute="height" multiplier="1:1" id="whs-kN-2Wa"/>
3333
</constraints>
3434
</imageView>
3535
<label opaque="NO" userInteractionEnabled="NO" tag="888" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ADAMANT" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MaP-ZE-Rez">
36-
<rect key="frame" x="16.5" y="240" width="192.5" height="50.5"/>
36+
<rect key="frame" x="64" y="206.5" width="192.5" height="50.5"/>
3737
<fontDescription key="fontDescription" name="Exo2-Thin" family="Exo 2 Thin" pointSize="42"/>
3838
<nil key="textColor"/>
3939
<nil key="highlightedColor"/>
4040
</label>
4141
</subviews>
42+
<constraints>
43+
<constraint firstItem="Ci1-bB-rdf" firstAttribute="width" secondItem="hUF-Ul-HEi" secondAttribute="width" multiplier="0.6" id="lTA-wh-5Ws"/>
44+
</constraints>
4245
</stackView>
4346
</subviews>
4447
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
4548
<constraints>
46-
<constraint firstItem="hUF-Ul-HEi" firstAttribute="width" secondItem="zyJ-1h-Ix7" secondAttribute="width" multiplier="0.6" id="92q-lM-4uz"/>
49+
<constraint firstItem="hUF-Ul-HEi" firstAttribute="width" secondItem="zyJ-1h-Ix7" secondAttribute="width" id="92q-lM-4uz"/>
4750
<constraint firstItem="hUF-Ul-HEi" firstAttribute="centerX" secondItem="kK0-eO-vLx" secondAttribute="centerX" id="e0L-Wd-P6W"/>
4851
<constraint firstItem="hUF-Ul-HEi" firstAttribute="centerY" secondItem="kK0-eO-vLx" secondAttribute="centerY" id="gef-QZ-C1q"/>
4952
</constraints>
5053
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
5154
<viewLayoutGuide key="safeArea" id="kK0-eO-vLx"/>
52-
<point key="canvasLocation" x="8" y="116"/>
55+
<point key="canvasLocation" x="8" y="7"/>
5356
</view>
5457
</objects>
5558
<resources>

Adamant/Utilities/AdamantFeeCalculator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
import Foundation
1010

1111
class AdamantFeeCalculator {
12-
static func estimatedFeeFor(message: AdamantMessage) -> UInt {
12+
static func estimatedFeeFor(message: AdamantMessage) -> UInt64 {
1313
switch message {
1414
case .text(let text):
1515
return AdamantUtilities.from(double: ceil(Double(text.count) / 255.0) * 0.001)
1616
}
1717
}
1818

19-
static func estimatedFeeFor(transfer: UInt) -> UInt {
19+
static func estimatedFeeFor(transfer: UInt64) -> UInt64 {
2020
return AdamantUtilities.from(double: 0.5)
2121
}
2222

0 commit comments

Comments
 (0)