lnd/lntemp/rpc/wallet_kit.go

75 lines
1.9 KiB
Go

package rpc
import (
"context"
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
)
// =====================
// WalletKitClient related RPCs.
// =====================
// FinalizePsbt makes a RPC call to node's ListUnspent and asserts.
func (h *HarnessRPC) ListUnspent(
req *walletrpc.ListUnspentRequest) *walletrpc.ListUnspentResponse {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
resp, err := h.WalletKit.ListUnspent(ctxt, req)
h.NoError(err, "ListUnspent")
return resp
}
// DeriveKey makes a RPC call to the DeriveKey and asserts.
func (h *HarnessRPC) DeriveKey(kl *signrpc.KeyLocator) *signrpc.KeyDescriptor {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
key, err := h.WalletKit.DeriveKey(ctxt, kl)
h.NoError(err, "DeriveKey")
return key
}
// SendOutputs makes a RPC call to the node's WalletKitClient and asserts.
func (h *HarnessRPC) SendOutputs(
req *walletrpc.SendOutputsRequest) *walletrpc.SendOutputsResponse {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
resp, err := h.WalletKit.SendOutputs(ctxt, req)
h.NoError(err, "SendOutputs")
return resp
}
// FundPsbt makes a RPC call to node's FundPsbt and asserts.
func (h *HarnessRPC) FundPsbt(
req *walletrpc.FundPsbtRequest) *walletrpc.FundPsbtResponse {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
resp, err := h.WalletKit.FundPsbt(ctxt, req)
h.NoError(err, "FundPsbt")
return resp
}
// FinalizePsbt makes a RPC call to node's FinalizePsbt and asserts.
func (h *HarnessRPC) FinalizePsbt(
req *walletrpc.FinalizePsbtRequest) *walletrpc.FinalizePsbtResponse {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
resp, err := h.WalletKit.FinalizePsbt(ctxt, req)
h.NoError(err, "FinalizePsbt")
return resp
}