@Test public void testLimitOrderCancelTransaction() throws NoSuchAlgorithmException, IOException, WebSocketException { ECKey privateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); expiration = (System.currentTimeMillis() / 1000) + 60 * 5; LimitOrderCreateOperation operation = new LimitOrderCreateOperation(seller, amountToSell, minToReceive, (int) expiration, false); operation.setFee(new AssetAmount(UnsignedLong.valueOf(2), CORE_ASSET)); ArrayList<BaseOperation> operationList = new ArrayList<>(); operationList.add(operation); broadcastTransaction(privateKey, operationList, new WitnessResponseListener() { @Override public void onSuccess(WitnessResponse response) { System.out.println("onSuccess.0"); try{ Asset base = amountToSell.getAsset(); Asset quote = minToReceive.getAsset(); SSLContext context = NaiveSSLContext.getInstance("TLS"); WebSocketFactory factory = new WebSocketFactory(); factory.setSSLContext(context); WebSocket mWebSocket = factory.createSocket(NODE_URL); mWebSocket.addListener(new GetLimitOrders(base.getObjectId(), quote.getObjectId(), 100, new WitnessResponseListener() { @Override public void onSuccess(WitnessResponse response) { System.out.println("onSuccess.1"); List<LimitOrder> orders = (List<LimitOrder>) response.result; for(LimitOrder order : orders){ if(order.getSeller().getObjectId().equals(bilthon_7.getObjectId())){ ECKey privateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); LimitOrderCancelOperation operation = new LimitOrderCancelOperation(order, bilthon_7); ArrayList<BaseOperation> operationList = new ArrayList<>(); operationList.add(operation); broadcastTransaction(privateKey, operationList, new WitnessResponseListener() { @Override public void onSuccess(WitnessResponse response) { System.out.println("onSuccess.2"); baseResponse = response; synchronized (this){ notifyAll(); } synchronized (lockObject){ lockObject.notifyAll(); } } @Override public void onError(BaseResponse.Error error) { System.out.println("onError.2"); synchronized (this){ notifyAll(); } synchronized (lockObject){ lockObject.notifyAll(); } } }, null); } } } @Override public void onError(BaseResponse.Error error) { System.out.println("onError.1"); System.out.println(error.data.message); Assert.assertNull(error); synchronized (lockObject){ lockObject.notifyAll(); } } })); mWebSocket.connect(); }catch(NoSuchAlgorithmException e){ System.out.println("NoSuchAlgorithmException. Msg: "+e.getMessage()); } catch (WebSocketException e) { System.out.println("WebSocketException. Msg: "+e.getMessage()); } catch (IOException e) { System.out.println("IOException. Msg: "+e.getMessage()); } } @Override public void onError(BaseResponse.Error error) { System.out.println("OnError. Msg: "+error.message); synchronized (this){ notifyAll(); } } }, lockObject); }
public ECKey getPrivateKey(){ return this.privateKey; }
Transaction implements ByteSerializable, JsonSerializable { public ECKey getPrivateKey(){ return this.privateKey; } }
Transaction implements ByteSerializable, JsonSerializable { public ECKey getPrivateKey(){ return this.privateKey; } Transaction(byte[] chainId, ECKey privateKey, BlockData blockData, List<BaseOperation> operations);  Transaction(ECKey privateKey, BlockData blockData, List<BaseOperation> operationList);  Transaction(String wif, BlockData block_data, List<BaseOperation> operation_list);  Transaction(BlockData blockData, List<BaseOperation> operationList); }
Transaction implements ByteSerializable, JsonSerializable { public ECKey getPrivateKey(){ return this.privateKey; } Transaction(byte[] chainId, ECKey privateKey, BlockData blockData, List<BaseOperation> operations);  Transaction(ECKey privateKey, BlockData blockData, List<BaseOperation> operationList);  Transaction(String wif, BlockData block_data, List<BaseOperation> operation_list);  Transaction(BlockData blockData, List<BaseOperation> operationList); void setBlockData(BlockData blockData); BlockData getBlockData(); void setFees(List<AssetAmount> fees); ECKey getPrivateKey(); List<BaseOperation> getOperations(); boolean hasPrivateKey(); byte[] getGrapheneSignature(); void setChainId(String chainId); void setChainId(byte[] chainId); byte[] getChainId(); byte[] toBytes(); @Override String toJsonString(); @Override JsonObject toJsonObject(); }
Transaction implements ByteSerializable, JsonSerializable { public ECKey getPrivateKey(){ return this.privateKey; } Transaction(byte[] chainId, ECKey privateKey, BlockData blockData, List<BaseOperation> operations);  Transaction(ECKey privateKey, BlockData blockData, List<BaseOperation> operationList);  Transaction(String wif, BlockData block_data, List<BaseOperation> operation_list);  Transaction(BlockData blockData, List<BaseOperation> operationList); void setBlockData(BlockData blockData); BlockData getBlockData(); void setFees(List<AssetAmount> fees); ECKey getPrivateKey(); List<BaseOperation> getOperations(); boolean hasPrivateKey(); byte[] getGrapheneSignature(); void setChainId(String chainId); void setChainId(byte[] chainId); byte[] getChainId(); byte[] toBytes(); @Override String toJsonString(); @Override JsonObject toJsonObject(); static final int DEFAULT_EXPIRATION_TIME; static final String KEY_EXPIRATION; static final String KEY_SIGNATURES; static final String KEY_OPERATIONS; static final String KEY_EXTENSIONS; static final String KEY_REF_BLOCK_NUM; static final String KEY_REF_BLOCK_PREFIX; }