Skip to content

Commit

Permalink
TransactionRecordQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
janaakhterov authored and qtbeee committed Nov 6, 2019
1 parent a1716ca commit 54982ac
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Sources/Hedera/TransactionRecordQuery.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
public final class TransactionRecordQuery: QueryBuilder<TransactionRecord> {
public override init(client: Client) {
super.init(client: client)

body.transactionGetRecord = Proto_TransactionGetRecordQuery()
}

public func setTransaction(_ id: TransactionId) -> Self {
body.transactionGetRecord.transactionID = id.toProto()

return self
}

override func mapResponse(_ response: Proto_Response) throws -> TransactionRecord {
guard case .transactionGetRecord(let response) = response.response else {
throw HederaError(message: "query response was not of type 'transactionGetRecord'")
}

return TransactionRecord(response.transactionRecord)
}
}

0 comments on commit 54982ac

Please sign in to comment.