func (d *DcrtimeWallet) GetWalletBalance() (*BalanceResult, error) {
	balanceRequest := &pb.BalanceRequest{
		AccountNumber:         d.account,
		RequiredConfirmations: d.minconf,
	}
	balanceResponse, err := d.wallet.Balance(d.ctx, balanceRequest)
	if err != nil {
		return nil, err
	}
	accountBalance := &BalanceResult{
		Total:       balanceResponse.Total,
		Spendable:   balanceResponse.Spendable,
		Unconfirmed: balanceResponse.Unconfirmed,
	}
	return accountBalance, nil
}
GetWalletBalance returns balance information from the
wallet account.
package dcrtimewallet
import (
	"context"
	"crypto/sha256"
	"crypto/tls"
	"crypto/x509"
	"fmt"
	"io/ioutil"
	pb "decred.org/dcrwallet/rpc/walletrpc"
	"github.com/decred/dcrd/chaincfg/chainhash"
	"github.com/decred/dcrd/txscript/v3"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials"
)
type DcrtimeWallet struct {
	account    uint32
	minconf    int32
	conn       *grpc.ClientConn
	wallet     pb.WalletServiceClient
	ctx        context.Context
	passphrase []byte
}
type TxLookupResult struct {
	BlockHash     chainhash.Hash
	Timestamp     int64
	Confirmations int32
	BlockHeight   int32
}
type BalanceResult struct {
	Total       int64
	Spendable   int64
	Unconfirmed int64
}
func (d *DcrtimeWallet) Lookup(tx chainhash.Hash) (*TxLookupResult, error) {
	ctx, cancel := context.WithCancel(d.ctx)
	defer cancel()
	n, err := d.wallet.ConfirmationNotifications(ctx)
	if err != nil {
		return nil, err
	}
	err = n.Send(&pb.ConfirmationNotificationsRequest{
		TxHashes:  [][]byte{tx[:]},
		StopAfter: 0,  
	})
	if err != nil {
		return nil, err
	}
	r, err := n.Recv()
	if err != nil {
		return nil, err
	}
	if len(r.Confirmations) != 1 {
		return nil, fmt.Errorf("invalid reply length: %v",
			len(r.Confirmations))
	}
	h, err := chainhash.NewHash(r.Confirmations[0].TxHash)
	if err != nil {
		return nil, err
	}
	if !h.IsEqual(&tx) {
		return nil, fmt.Errorf("invalid tx hash: %v", tx.String())
	}
	if r.Confirmations[0].Confirmations <= 0 {
		return &TxLookupResult{
			Confirmations: r.Confirmations[0].Confirmations,
		}, nil
	}
	rbi, err := d.wallet.BlockInfo(ctx, &pb.BlockInfoRequest{
		BlockHash: r.Confirmations[0].BlockHash,
	})
	if err != nil {
		return nil, err
	}
	block, err := chainhash.NewHash(rbi.BlockHash)
	if err != nil {
		return nil, err
	}
	return &TxLookupResult{
		BlockHash:     *block,
		Timestamp:     rbi.Timestamp,
		Confirmations: rbi.Confirmations,
		BlockHeight:   rbi.BlockHeight,
	}, nil
}
func (d *DcrtimeWallet) Construct(merkleRoot [sha256.Size]byte) (*chainhash.Hash, error) {
	script, err := txscript.NewScriptBuilder().AddOp(txscript.OP_RETURN).
		AddData(merkleRoot[:]).Script()
	if err != nil {
		return nil, err
	}
	constructRequest := &pb.ConstructTransactionRequest{
		SourceAccount:            d.account,
		RequiredConfirmations:    d.minconf,
		FeePerKb:                 0,  
		OutputSelectionAlgorithm: pb.ConstructTransactionRequest_UNSPECIFIED,
		NonChangeOutputs: []*pb.ConstructTransactionRequest_Output{
			{
				Destination: &pb.ConstructTransactionRequest_OutputDestination{
					Script:        script,
					ScriptVersion: 0,
				},
				Amount: 0,
			},
		},
	}
	constructResponse, err := d.wallet.ConstructTransaction(d.ctx,
		constructRequest)
	if err != nil {
		return nil, err
	}
	signRequest := &pb.SignTransactionRequest{
		Passphrase:            d.passphrase,
		SerializedTransaction: constructResponse.UnsignedTransaction,
	}
	signResponse, err := d.wallet.SignTransaction(d.ctx, signRequest)
	if err != nil {
		return nil, err
	}
	publishRequest := &pb.PublishTransactionRequest{
		SignedTransaction: signResponse.Transaction,
	}
	publishResponse, err := d.wallet.PublishTransaction(d.ctx,
		publishRequest)
	if err != nil {
		return nil, err
	}
	txHash, err := chainhash.NewHash(publishResponse.TransactionHash)
	if err != nil {
		return nil, err
	}
	return txHash, nil
}