/
status.go
42 lines (32 loc) · 1006 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
40
41
42
// SPDX-License-Identifier: ISC
// Copyright (c) 2014-2020 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/transaction"
)
// TransactionStatusData - request data fro transaction status
type TransactionStatusData struct {
TxId string
}
// GetTransactionStatus - perform a status request
func (client *Client) GetTransactionStatus(statusConfig *TransactionStatusData) (*transaction.StatusReply, error) {
var txId merkle.Digest
err := txId.UnmarshalText([]byte(statusConfig.TxId))
if err != nil {
return nil, err
}
statusArgs := transaction.Arguments{
TxId: txId,
}
client.printJson("Status Request", statusArgs)
var reply transaction.StatusReply
err = client.client.Call("Transaction.Status", statusArgs, &reply)
if err != nil {
return nil, err
}
client.printJson("Status Reply", reply)
return &reply, nil
}