Skip to content

Commit

Permalink
support getting public spend and view keys over wallet rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Jun 12, 2024
1 parent c0ddb47 commit fb8fb6a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/java/monero/wallet/MoneroWalletRpc.java
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,24 @@ public String getPrivateViewKey() {
}


@SuppressWarnings("unchecked")
@Override
public String getPublicViewKey() {
throw new MoneroError("MoneroWalletRpc.getPublicViewKey() not supported");
Map<String, Object> params = new HashMap<String, Object>();
params.put("key_type", "public_view_key");
Map<String, Object> resp = rpc.sendJsonRequest("query_key", params);
Map<String, Object> result = (Map<String, Object>) resp.get("result");
return (String) result.get("key");
}

@SuppressWarnings("unchecked")
@Override
public String getPublicSpendKey() {
throw new MoneroError("MoneroWalletRpc.getPublicSpendKey() not supported");
Map<String, Object> params = new HashMap<String, Object>();
params.put("key_type", "public_spend_key");
Map<String, Object> resp = rpc.sendJsonRequest("query_key", params);
Map<String, Object> result = (Map<String, Object>) resp.get("result");
return (String) result.get("key");
}

@SuppressWarnings("unchecked")
Expand Down

0 comments on commit fb8fb6a

Please sign in to comment.