Skip to content

h6x0r/tonapi4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☕ Tonapi4j

Based on TON License: MIT GitHub last commit

Image

Java SDK for tonapi.io.
Information about the API can be found in the documentation.
To use the API you need an API key, you can get it here tonconsole.com.

For creating wallets, transferring TON, Jetton, NFTs, and other operations, recommend using ton4j in combination with the library. For more information, refer to the library documentation.

Maven Maven Central

<dependency>
  <groupId>io.github.h6x0r</groupId>
  <artifactId>tonapi4j</artifactId>
  <version>1.0.5</version>
</dependency>

Usage

import org.ton.tonapi.async.AsyncTonapi;
import org.ton.tonapi.sync.Tonapi;

// Specify your API_KEY
String API_KEY = "YOUR_TON_API_KEY";
// Specify the account ID (wallet_address)
String ACCOUNT_ID = "UQB8ANV_ynITQr1qHXADHDKYUAQ9VFcCRDZB7h4aPuPKuFtm";

// Asynchronous

// Create a new AsyncTonapi client with the provided API key, testnet and maxRetries count
AsyncTonapi asyncTonapi = new AsyncTonapi(API_KEY, false, 10);

// Retrieve account information asynchronously
CompletableFuture<Account> future = asyncTonapi.getAccounts().getInfo(ACCOUNT_ID);
Account response = future.get();

// Synchronous

// Create a new Tonapi client with the provided API key, testnet and maxRetries count
Tonapi tonapi = new Tonapi(API_KEY, false, 10);

// Retrieve account information synchronously
Account response = tonapi.getAccounts().getInfo(ACCOUNT_ID);
  • More examples can be found in the test package.

Support ton-java development

If you want to speed up ton-java development and thus change its priority in my backlog, you are welcome to donate some toncoins:

UQB8ANV_ynITQr1qHXADHDKYUAQ9VFcCRDZB7h4aPuPKuFtm

Contribution

Your contribution is welcome! If you have ideas for improvement or have identified a bug, please create an issue or submit a pull request.

License

This repository is distributed under the MIT License. Feel free to use, modify, and distribute the code in accordance with the terms of the license.

Star History Chart