walletrpc: add ListLeases

This commit is contained in:
Joost Jager committed 2021-03-13 08:45:52 +01:00
1 parent b8e54fffbf
commit 9398220568
10 files changed
+411 -123

No files matched your search

+18
View File
@@ -112,6 +112,10 @@ var (
Entity: "onchain",
Action: "write",
}},
"/walletrpc.WalletKit/ListLeases": {{
Entity: "onchain",
Action: "read",
}},
"/walletrpc.WalletKit/ListUnspent": {{
Entity: "onchain",
Action: "read",
@@ -421,6 +425,20 @@ func (w *WalletKit) ReleaseOutput(ctx context.Context,
return &ReleaseOutputResponse{}, nil
}
// ListLeases returns a list of all currently locked utxos.
func (w *WalletKit) ListLeases(ctx context.Context,
req *ListLeasesRequest) (*ListLeasesResponse, error) {
leases, err := w.cfg.Wallet.ListLeasedOutputs()
if err != nil {
return nil, err
}
return &ListLeasesResponse{
LockedUtxos: marshallLeases(leases),
}, nil
}
// DeriveNextKey attempts to derive the *next* key within the key family
// (account in BIP43) specified. This method should return the next external
// child within this branch.