Skip to content

90K2/ton-kotlin-usecase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

Step 0: make sure that your IDE is ready to use this project :

  • jetbrains://idea/settings?name=Build%2C+Execution%2C+Deployment--Build+Tools--Gradle : Gradle JVM 18
  • Project Settings - Project - SDK - 18

How to connect ton-kotlin in your project:

repositories {
    mavenCentral()
    maven("https://s01.oss.sonatype.org/service/local/repositories/snapshots/content/")
}
dependencies {
    implementation("org.ton:ton-kotlin-jvm:0.3.0-20230412.120307-1")
    implementation("org.ton:ton-kotlin-contract-jvm:0.3.0-20230412.120307-1")

}

Blockchain config file setup over application.yml

ton:
  net-config: classpath:global-config.json

Config components

config.TonChainConfigReader : config class that serves for reading json config and setup liteClient config.TonBeansConfig : config class that creating main beans, eg. LiteClient that will often be used later

Use cases

LiteClient org.ton.tonkotlinusecase.LiteClientTests

Accounts:

  • get account info raw
  • get account info DTO (with suggested object mapping)

Blocks:

  • get last masterchain block
  • decode coin transfer with comment
  • decode notification about NFT receiving

Contract get methods examples org.ton.tonkotlinusecase.GetMethodsTest

  • get nft data
  • get collectable nft address by index
  • get collection data

Wallet org.ton.tonkotlinusecase.WalletTests

Before start you need to set wallet seed phrase in env variable WALLET_MNEMONIC or directly inside application.yml

  • get wallet seqno
  • send TONs
  • deploy nft
  • transfer nft

Advanced options