Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Fix warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Fořt committed Dec 17, 2018
1 parent f3312cc commit f21d428
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ PODS:
- Result (4.0.0)
- SipHash (1.2.2)
- Sodium (0.7.0)
- TezosSwift (0.0.2):
- TezosSwift (0.1):
- BigInt (~> 3.1)
- MnemonicKit
- MnemonicKit (~> 1.2.0)
- Result (~> 4.0.0)
- Sodium (~> 0.7.0)

Expand All @@ -36,8 +36,8 @@ SPEC CHECKSUMS:
Result: 7645bb3f50c2ce726dd0ff2fa7b6f42bbe6c3713
SipHash: fad90a4683e420c52ef28063063dbbce248ea6d4
Sodium: c5510cc6f5e1b27858e5f260b5cac80d4a3f9379
TezosSwift: 4f3429ebcafb32b2c3264767065a5e0cfc73d5fc
TezosSwift: 20119e6e44ac2ce2a02eeae294c7ad3963d09932

PODFILE CHECKSUM: 8fab5015085c28935bf74bf105c1e94931cabef1
PODFILE CHECKSUM: d17465db3a6056cb578b80ea85b9ccea39c9fc7d

COCOAPODS: 1.6.0.beta.2
13 changes: 5 additions & 8 deletions TezosSwift/Client/TezosClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,8 @@ public class TezosClient {
let unwrappedError = error as? TezosError ?? TezosError.injectError(reason: .jsonSigningFailed)
completion(.failure(unwrappedError))
}


case .failure(let error):
completion(.failure(.injectError(reason: .forgeError)))
completion(.failure(error))
}
})
}
Expand Down Expand Up @@ -414,7 +412,7 @@ public class TezosClient {
self?.forgeAndSignOperation(chainId: operationMetadata.chainId, headHash: operationMetadata.headHash, operationPayload: operationPayload, keys: keys, completion: { [weak self] result in
guard let self = self else { completion(.failure(.injectError(reason: .forgeError))); return }
switch result {
case .success((let signingResult, let forgeResult)):
case .success((let signingResult, _)):
let signedOperationPayload = SignedOperationPayload(contents: operationPayload.contents, branch: operationPayload.branch, protocol: operationMetadata.protocolHash, signature: signingResult.edsig)
guard let jsonSignedBytes = signingResult.jsonSignedBytes else { completion(.failure(.injectError(reason: .jsonSigningFailed))); return }
self.preapplyAndInjectRPC(payload: [signedOperationPayload],
Expand All @@ -437,13 +435,12 @@ public class TezosClient {
signedBytesForInjection: String,
operationMetadata: OperationMetadata,
completion: @escaping (Result<Void, TezosError>) -> Void) {
var payloadWithFees = SignedRunOperationPayload(contents: payload.contents.filter { $0.defaultFees }, branch: payload.branch, signature: payload.signature)
let payloadWithFees = SignedRunOperationPayload(contents: payload.contents.filter { $0.defaultFees }, branch: payload.branch, signature: payload.signature)
guard !payloadWithFees.contents.isEmpty else {
completion(.success(()))
return
}

let runPayload = SignedRunOperationPayload(contents: payload.contents, branch: payload.branch, signature: payload.signature)
// TODO: Fees .max
let operationFees = OperationFees(fee: Tez(0), gasLimit: Tez(0.4), storageLimit: Tez(0.06))
payloadWithFees.contents.forEach { $0.operationFees = operationFees }
Expand All @@ -461,7 +458,7 @@ public class TezosClient {
}

private func modifyFees(of payload: SignedRunOperationPayload, with contents: [OperationStatus], operationBytesString: String) {
contents.map { operation in
contents.forEach { operation in
let gasLimit = operation.metadata.operationResult.consumedGas + Mutez(100)
let operationBytes = operationBytesString.lengthOfBytes(using: .ascii)
// TODO: Check if account exists, if yes, storage limit should be zero
Expand All @@ -484,7 +481,7 @@ public class TezosClient {
completion: @escaping RPCCompletion<String>) {
let rpcCompletion: RPCCompletion<String> = { [weak self] result in
switch result {
case .success(let value):
case .success(_):
// TODO: Catch error here (and send it down the chain)
self?.sendInjectionRPC(payload: signedBytesForInjection, completion: completion)
case .failure(let error):
Expand Down

0 comments on commit f21d428

Please sign in to comment.