@Test void testSendIcxTransaction() { Provider provider = mock(Provider.class); Address fromAddress = new Address("hxbe258ceb872e08851f1f59694dac2558708ece11"); Address toAddress = new Address("hx5bfdb090f43a808005ffc27c25b213145e80b7cd"); Transaction transaction = TransactionBuilder.newBuilder() .nid(NetworkId.MAIN) .from(fromAddress) .to(toAddress) .value(new BigInteger("de0b6b3a7640000", 16)) .stepLimit(new BigInteger("12345", 16)) .timestamp(new BigInteger("563a6cf330136", 16)) .nonce(new BigInteger("1")) .build(); Wallet wallet = KeyWallet.load(new Bytes(PRIVATE_KEY_STRING)); SignedTransaction signedTransaction = new SignedTransaction(transaction, wallet); IconService iconService = new IconService(provider); iconService.sendTransaction(signedTransaction); String expected = "xR6wKs+IA+7E91bT8966jFKlK5mayutXCvayuSMCrx9KB7670CsWa0B7LQzgsxU0GLXaovlAT2MLs1XuDiSaZQE="; verify(provider).request( argThat(request -> { boolean isMethodMathces = request.getMethod().equals("icx_sendTransaction"); boolean isSignaureMatches = request.getParams().getItem("signature").asString().equals(expected); return isMethodMathces && isSignaureMatches; }), argThat(Objects::nonNull)); }
public Request<Bytes> sendTransaction(SignedTransaction signedTransaction) { long requestId = System.currentTimeMillis(); foundation.icon.icx.transport.jsonrpc.Request request = new foundation.icon.icx.transport.jsonrpc.Request( requestId, "icx_sendTransaction", signedTransaction.getProperties()); return provider.request(request, findConverter(Bytes.class)); }
IconService { public Request<Bytes> sendTransaction(SignedTransaction signedTransaction) { long requestId = System.currentTimeMillis(); foundation.icon.icx.transport.jsonrpc.Request request = new foundation.icon.icx.transport.jsonrpc.Request( requestId, "icx_sendTransaction", signedTransaction.getProperties()); return provider.request(request, findConverter(Bytes.class)); } }
IconService { public Request<Bytes> sendTransaction(SignedTransaction signedTransaction) { long requestId = System.currentTimeMillis(); foundation.icon.icx.transport.jsonrpc.Request request = new foundation.icon.icx.transport.jsonrpc.Request( requestId, "icx_sendTransaction", signedTransaction.getProperties()); return provider.request(request, findConverter(Bytes.class)); } @SuppressWarnings("unchecked")  IconService(Provider provider); }
IconService { public Request<Bytes> sendTransaction(SignedTransaction signedTransaction) { long requestId = System.currentTimeMillis(); foundation.icon.icx.transport.jsonrpc.Request request = new foundation.icon.icx.transport.jsonrpc.Request( requestId, "icx_sendTransaction", signedTransaction.getProperties()); return provider.request(request, findConverter(Bytes.class)); } @SuppressWarnings("unchecked")  IconService(Provider provider); Request<BigInteger> getTotalSupply(); Request<BigInteger> getBalance(Address address); Request<Block> getBlock(BigInteger height); Request<Block> getBlock(Bytes hash); Request<Block> getLastBlock(); @SuppressWarnings("unchecked") Request<List<ScoreApi>> getScoreApi(Address scoreAddress); Request<ConfirmedTransaction> getTransaction(Bytes hash); Request<TransactionResult> getTransactionResult(Bytes hash); Request<T> call(Call<T> call); Request<Bytes> sendTransaction(SignedTransaction signedTransaction); Request<BigInteger> estimateStep(Transaction transaction); void addConverterFactory(RpcConverterFactory factory); }
IconService { public Request<Bytes> sendTransaction(SignedTransaction signedTransaction) { long requestId = System.currentTimeMillis(); foundation.icon.icx.transport.jsonrpc.Request request = new foundation.icon.icx.transport.jsonrpc.Request( requestId, "icx_sendTransaction", signedTransaction.getProperties()); return provider.request(request, findConverter(Bytes.class)); } @SuppressWarnings("unchecked")  IconService(Provider provider); Request<BigInteger> getTotalSupply(); Request<BigInteger> getBalance(Address address); Request<Block> getBlock(BigInteger height); Request<Block> getBlock(Bytes hash); Request<Block> getLastBlock(); @SuppressWarnings("unchecked") Request<List<ScoreApi>> getScoreApi(Address scoreAddress); Request<ConfirmedTransaction> getTransaction(Bytes hash); Request<TransactionResult> getTransactionResult(Bytes hash); Request<T> call(Call<T> call); Request<Bytes> sendTransaction(SignedTransaction signedTransaction); Request<BigInteger> estimateStep(Transaction transaction); void addConverterFactory(RpcConverterFactory factory);  }