An advanced Ethereum/EVM mobile wallet
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
alpha-wallet-ios/Trust/EtherClient/TrustClient/TrustClient.swift

47 lines
1.1 KiB

// Copyright SIX DAY LLC. All rights reserved.
import Foundation
import Moya
enum TrustService {
case getTransactions(address: String, startBlock: Int)
case getTransaction(ID: String)
}
extension TrustService: TargetType {
var baseURL: URL { return Config().remoteURL }
var path: String {
switch self {
case .getTransactions:
return "/transactions"
case .getTransaction(let ID):
return "/transactions/\(ID)"
}
}
var method: Moya.Method {
switch self {
case .getTransactions: return .get
case .getTransaction: return .get
}
}
var task: Task {
switch self {
case .getTransactions(let address, let startBlock):
return .requestParameters(parameters: ["address": address, "startBlock": startBlock], encoding: URLEncoding())
case .getTransaction:
return .requestPlain
}
}
var sampleData: Data {
return Data()
}
var headers: [String: String]? {
return ["Content-type": "application/json"]
}
}