forked from bitmark-inc/bitmarkd
/
status.go
39 lines (29 loc) · 857 Bytes
/
status.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
// Copyright (c) 2014-2018 Bitmark Inc.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package rpccalls
import (
"github.com/bitmark-inc/bitmarkd/merkle"
"github.com/bitmark-inc/bitmarkd/rpc"
)
type TransactionStatusData struct {
TxId string
}
func (client *Client) GetTransactionStatus(statusConfig *TransactionStatusData) (*rpc.TransactionStatusReply, error) {
var txId merkle.Digest
err := txId.UnmarshalText([]byte(statusConfig.TxId))
if nil != err {
return nil, err
}
statusArgs := rpc.TransactionArguments{
TxId: txId,
}
client.printJson("Status Request", statusArgs)
var reply rpc.TransactionStatusReply
err = client.client.Call("Transaction.Status", statusArgs, &reply)
if err != nil {
return nil, err
}
client.printJson("Status Reply", reply)
return &reply, nil
}