Skip to content

Commit

Permalink
add rpc:parity_listAccounts which "Returns all addresses if Fat DB is…
Browse files Browse the repository at this point in the history
… enabled (--fat-db), null otherwise."
  • Loading branch information
psdev committed Mar 4, 2018
1 parent fee3b5d commit 43a0e1e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,16 @@ public class JsonRpc2_0Parity extends JsonRpc2_0Admin implements Parity {
public JsonRpc2_0Parity(Web3jService web3jService) {
super(web3jService);
}


@Override
public Request<?, ParityAddressesResponse> parityListAccounts(BigInteger quantity) {
return new Request<>(
"parity_listAccounts",
Arrays.asList(quantity, null),
web3jService,
ParityAddressesResponse.class);
}

@Override
public Request<?, ParityAllAccountsInfo> parityAllAccountsInfo() {
return new Request<>(
Expand Down
5 changes: 4 additions & 1 deletion parity/src/main/java/org/web3j/protocol/parity/Parity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.web3j.protocol.parity;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -26,7 +27,9 @@ public interface Parity extends Admin, Trace {
static Parity build(Web3jService web3jService) {
return new JsonRpc2_0Parity(web3jService);
}


Request<?, ParityAddressesResponse> parityListAccounts(BigInteger quantity);

Request<?, ParityAllAccountsInfo> parityAllAccountsInfo();

Request<?, BooleanResponse> parityChangePassword(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.web3j.protocol.core.Response;

/**
* parity_listAccounts
* parity_getGetDappAddresses
* parity_getGetNewDappsAddresses
* parity_importGethAccounts
Expand Down
11 changes: 10 additions & 1 deletion parity/src/test/java/org/web3j/protocol/parity/RequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ public class RequestTest extends RequestTester {
protected void initWeb3Client(HttpService httpService) {
web3j = Parity.build(httpService);
}


@Test
public void testParityListAccounts() throws Exception {
BigInteger maxQuantityReturned = BigInteger.valueOf(100);
web3j.parityListAccounts(maxQuantityReturned).send();

verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"parity_listAccounts\","
+ "\"params\":[100,null],\"id\":1}");
}

@Test
public void testParityAllAccountsInfo() throws Exception {
web3j.parityAllAccountsInfo().send();
Expand Down

0 comments on commit 43a0e1e

Please sign in to comment.