@Test public void testGetContractState() { buildResponse( "{\n" + " \"jsonrpc\": \"2.0\",\n" + " \"id\": 1,\n" + " \"result\": {\n" + " \"id\": -2,\n" + " \"hash\": \"0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc\",\n" + " \"script\": \"QetD9PQ=\",\n" + " \"manifest\": {\n" + " \"groups\": [\n" + " {\n" + " \"pubkey\": \"03b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c\",\n" + " \"signature\": \"41414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141\"\n" + " }\n" + " ],\n" + " \"features\": {\n" + " \"storage\": true,\n" + " \"payable\": false\n" + " },\n" + " \"supportedstandards\": [" + " \"NEP-5\"" + " ],\n" + " \"abi\": {\n" + " \"hash\": \"0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc\",\n" + " \"methods\": [\n" + " {\n" + " \"name\": \"name\",\n" + " \"parameters\": [],\n" + " \"offset\": 0,\n" + " \"returntype\": \"String\"\n" + " },\n" + " {\n" + " \"name\": \"symbol\",\n" + " \"parameters\": [],\n" + " \"offset\": 0,\n" + " \"returntype\": \"String\"\n" + " },\n" + " {\n" + " \"name\": \"decimals\",\n" + " \"parameters\": [],\n" + " \"offset\": 0,\n" + " \"returntype\": \"Integer\"\n" + " },\n" + " {\n" + " \"name\": \"totalSupply\",\n" + " \"parameters\": [],\n" + " \"offset\": 0,\n" + " \"returntype\": \"Integer\"\n" + " },\n" + " {\n" + " \"name\": \"balanceOf\",\n" + " \"parameters\": [\n" + " {\n" + " \"name\": \"account\",\n" + " \"type\": \"ByteArray\"\n" + " }\n" + " ],\n" + " \"offset\": 0,\n" + " \"returntype\": \"Integer\"\n" + " }\n" + " ],\n" + " \"events\": [\n" + " {\n" + " \"name\": \"Transfer\",\n" + " \"parameters\": [\n" + " {\n" + " \"name\": \"from\",\n" + " \"type\": \"Hash160\"\n" + " },\n" + " {\n" + " \"name\": \"to\",\n" + " \"type\": \"Hash160\"\n" + " },\n" + " {\n" + " \"name\": \"amount\",\n" + " \"type\": \"Integer\"\n" + " }\n" + " ]\n" + " }\n" + " ]\n" + " },\n" + " \"permissions\": [\n" + " {\n" + " \"contract\": \"0xde5f57d430d3dece511cf975a8d37848cb9e0525\",\n" + " \"methods\": [\n" + " \"name\",\n" + " \"transfer\"\n" + " ]\n" + " }\n" + " ],\n" + " \"trusts\": [" + " \"0xde5f57d430d3dece511cf975a8d37848cb9e0525\"\n" + " ],\n" + " \"safemethods\": [\n" + " \"name\",\n" + " \"symbol\",\n" + " \"decimals\",\n" + " \"totalSupply\",\n" + " \"balanceOf\",\n" + " \"supportedStandards\"\n" + " ],\n" + " \"extra\": null\n" + " }\n" + " }\n" + "}" ); NeoGetContractState getContractState = deserialiseResponse(NeoGetContractState.class); assertThat(getContractState.getContractState(), is(notNullValue())); assertThat(getContractState.getContractState().getId(), is(-2)); assertThat(getContractState.getContractState().getHash(), is("0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc")); assertThat(getContractState.getContractState().getScript(), is("QetD9PQ=")); ContractManifest manifest = getContractState.getContractState().getManifest(); assertThat(manifest, is(notNullValue())); assertThat(manifest.getGroups(), is(notNullValue())); assertThat(manifest.getGroups(), hasSize(1)); assertThat(manifest.getGroups().get(0).getPubKey(), is("03b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c")); assertThat(manifest.getGroups().get(0).getSignature(), is("41414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141")); assertThat(manifest.getFeatures(), is(notNullValue())); assertThat(manifest.getFeatures().getStorage(), is(true)); assertThat(manifest.getFeatures().getPayable(), is(false)); assertThat(manifest.getSupportedStandards(), hasSize(1)); assertThat(manifest.getSupportedStandards().get(0), is("NEP-5")); ContractManifest.ContractABI abi = manifest.getAbi(); assertThat(abi, is(notNullValue())); assertThat(abi.getHash(), is("0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc")); assertThat(abi.getMethods(), is(notNullValue())); assertThat(abi.getMethods(), hasSize(5)); assertThat(abi.getMethods().get(1).getName(), is("symbol")); assertThat(abi.getMethods().get(1).getParameters(), is(notNullValue())); assertThat(abi.getMethods().get(1).getParameters(), hasSize(0)); assertThat(abi.getMethods().get(4).getName(), is("balanceOf")); assertThat(abi.getMethods().get(4).getParameters(), is(notNullValue())); assertThat(abi.getMethods().get(4).getParameters(), hasSize(1)); assertThat(abi.getMethods().get(4).getReturnType(), is(ContractParameterType.INTEGER)); assertThat(abi.getEvents(), is(notNullValue())); assertThat(abi.getEvents(), hasSize(1)); assertThat(abi.getEvents().get(0).getName(), is("Transfer")); assertThat(abi.getEvents().get(0).getParameters(), is(notNullValue())); assertThat(abi.getEvents().get(0).getParameters(), hasSize(3)); assertThat(abi.getEvents().get(0).getParameters().get(2).getParamName(), is("amount")); assertThat(abi.getEvents().get(0).getParameters().get(2).getParamType(), is(ContractParameterType.INTEGER)); assertThat(manifest.getPermissions(), is(notNullValue())); assertThat(manifest.getPermissions(), hasSize(1)); assertThat(manifest.getPermissions().get(0).getContract(), is("0xde5f57d430d3dece511cf975a8d37848cb9e0525")); assertThat(manifest.getPermissions().get(0).getMethods(), is(notNullValue())); assertThat(manifest.getPermissions().get(0).getMethods(), hasSize(2)); assertThat(manifest.getPermissions().get(0).getMethods().get(1), is("transfer")); assertThat(manifest.getTrusts(), is(notNullValue())); assertThat(manifest.getTrusts(), hasSize(1)); assertFalse(manifest.trusts_isWildCard()); assertThat(manifest.getTrusts().get(0), is("0xde5f57d430d3dece511cf975a8d37848cb9e0525")); assertThat(manifest.getSafeMethods(), is(notNullValue())); assertThat(manifest.getSafeMethods(), hasSize(6)); assertFalse(manifest.safeMethods_isWildCard()); assertThat(manifest.getSafeMethods(), containsInAnyOrder( "name", "symbol", "decimals", "totalSupply", "balanceOf", "supportedStandards" )); assertThat(manifest.getExtra(), is(nullValue())); }
public long getId() { return id; }
Response { public long getId() { return id; } }
Response { public long getId() { return id; } Response(); }
Response { public long getId() { return id; } Response(); long getId(); void setId(long id); String getJsonrpc(); void setJsonrpc(String jsonrpc); T getResult(); void setResult(T result); Error getError(); void setError(Error error); boolean hasError(); String getRawResponse(); void setRawResponse(String rawResponse); void throwOnError(); }
Response { public long getId() { return id; } Response(); long getId(); void setId(long id); String getJsonrpc(); void setJsonrpc(String jsonrpc); T getResult(); void setResult(T result); Error getError(); void setError(Error error); boolean hasError(); String getRawResponse(); void setRawResponse(String rawResponse); void throwOnError();  }