Skip to content

Commit

Permalink
feat: add walletlock function
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
  • Loading branch information
LaurentMontBlanc committed Jul 12, 2024
1 parent aba303e commit e738cdd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions types/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ var (
MethodListWallets = "listwallets"
MethodListReceivedByAddress = "listreceivedbyaddress"
MethodGetBalance = "getbalance"
MethodWalletLock = "walletlock"
)
2 changes: 2 additions & 0 deletions utils/mocks/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ func GetDoFunc(req *http.Request) (*http.Response, error) {
response.Result = testListWallets
case types.MethodWalletpassphrase:
response.Result = nil
case types.MethodWalletLock:
response.Result = nil
default:
response.Result = nil
response.Error.Code = -1337
Expand Down
7 changes: 7 additions & 0 deletions wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func ListReceivedByAddress(url string, params []string) (listReceivedByAddressRe
return
}

// GetBalance returns balances for a given wallet
func GetBalance(url string, params []string) (getBalanceResult types.GetBalanceResult, err error) {
result, err := SendRequest(url, types.MethodGetBalance, params)
if err != nil {
Expand All @@ -174,3 +175,9 @@ func GetBalance(url string, params []string) (getBalanceResult types.GetBalanceR
}
return
}

// WalletLock removes the encryption key from memory for a given wallet
func WalletLock(url string) (err error) {
_, err = SendRequest(url, types.MethodWalletLock, []string{})
return
}

0 comments on commit e738cdd

Please sign in to comment.