-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1716ca
commit 54982ac
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |