Translations: Sample Java Programs/10/en

From ArdorDocs
Jump to: navigation, search

public static void main(String[] args) throws MalformedURLException {

       URL remoteUrl = new URL("https://testardor.jelurida.com/nxt");
       FeeCalculation feeCalculation = new FeeCalculation();
       Chain chain = Chain.getChain("IGNIS");
       JO transactionResponse = feeCalculation.prepare(remoteUrl, chain.getId());
       long minimumParentChainFeeFQT = transactionResponse.getLong("minimumFeeFQT");
       long feeRateNQTPerFXT = feeCalculation.getBestBundlingFee(remoteUrl, minimumParentChainFeeFQT, chain.getId());
       long feeNQT = BigDecimal.valueOf(minimumParentChainFeeFQT).multiply(BigDecimal.valueOf(feeRateNQTPerFXT)).divide(BigDecimal.valueOf(chain.ONE_COIN), RoundingMode.HALF_EVEN).longValue();
       System.out.printf("calculatedFee: %d\n", feeNQT);
       JO submittedTransaction = feeCalculation.submit(remoteUrl, chain.getId(), feeNQT);
       System.out.printf("submittedTransaction: %s\n", submittedTransaction);
   }