private static void doStartHttpServer(String routeFilePath) throws IOException { try { cliServices.startJsApiHttpServer( routeFilePath, hashId -> { try { return getClientNetwork().check(hashId).state == ItemState.APPROVED; } catch (IOException e) { report("error while checking contract for approve: " + e); return false; } }, (slotId, originId) -> { try { if (slotId == null) return null; return getClientNetwork().client.queryContract(slotId, originId, null); } catch (IOException e) { report("error while querying contract from slot1: " + e); return null; } }); } catch (Exception e) { report("http server error: " + e); } finish(); }
assertNull(slotInfo); byte[] simpleContractBytes = client.queryContract(slotContract.getId(), null, simpleContract.getId()); System.out.println("simpleContractBytes (by contractId): " + simpleContractBytes); assertEquals(false, Arrays.equals(simpleContract.getPackedTransaction(), simpleContractBytes)); simpleContractBytes = client.queryContract(slotContract.getId(), simpleContract.getOrigin(), null); System.out.println("simpleContractBytes (by originId): " + simpleContractBytes); assertEquals(false, Arrays.equals(simpleContract.getPackedTransaction(), simpleContractBytes)); assertNotNull(slotInfo); simpleContractBytes = client.queryContract(slotContract.getId(), null, simpleContract.getId()); System.out.println("simpleContractBytes (by contractId) length: " + simpleContractBytes.length); assertEquals(true, Arrays.equals(simpleContract.getPackedTransaction(), simpleContractBytes)); simpleContractBytes = client.queryContract(slotContract.getId(), simpleContract.getOrigin(), null); System.out.println("simpleContractBytes (by originId) length: " + simpleContractBytes.length); assertEquals(true, Arrays.equals(simpleContract.getPackedTransaction(), simpleContractBytes));
try { Binder slotInfo = testSpace.client.querySlotInfo(slotId); return testSpace.client.queryContract(slotId, originId, null); } catch (ClientError e) { e.printStackTrace();
try { Binder slotInfo = testSpace.client.querySlotInfo(slotId); return testSpace.client.queryContract(slotId, originId, null); } catch (ClientError e) { e.printStackTrace();