forked from achal126/hedera-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 3
/
query_transaction_get_receipt.go
51 lines (40 loc) · 1.24 KB
/
query_transaction_get_receipt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package hedera
// #include "hedera.h"
import "C"
import "github.com/markbates/oncer"
type QueryTransactionGetReceipt struct {
query
}
func newQueryTransactionGetReceipt(client Client, id TransactionID) QueryTransactionGetReceipt {
return QueryTransactionGetReceipt{
query{C.hedera_query__transaction_get_receipt__new(client.inner, cTransactionID(id))},
}
}
// Deprecated: Use Query.Get() instead
func (query QueryTransactionGetReceipt) Answer() (TransactionReceipt, error) {
oncer.Deprecate(0,
"github.com/launchbadge/hedera-sdk-go#Query.Answer()",
"Use Query.Get() instead.")
return query.Get()
}
func (query QueryTransactionGetReceipt) Get() (TransactionReceipt, error) {
var out C.HederaTransactionReceipt
res := C.hedera_query__transaction_get_receipt__get(query.inner, &out)
if res != 0 {
return TransactionReceipt{}, hederaLastError()
}
receipt := TransactionReceipt{Status: Status(out.status)}
if out.account_id != nil {
accountID := goAccountID(*out.account_id)
receipt.AccountID = &accountID
}
if out.contract_id != nil {
contractID := goContractID(*out.contract_id)
receipt.ContractID = &contractID
}
if out.file_id != nil {
fileID := goFileID(*out.file_id)
receipt.FileID = &fileID
}
return receipt, nil
}