File tree Expand file tree Collapse file tree 5 files changed +14
-28
lines changed
ton-kotlin-api/src/commonMain/kotlin/org/ton/api/tonnode
ton-kotlin-hashmap/src/commonMain/kotlin/org/ton/hashmap
ton-kotlin-liteclient/src
commonMain/kotlin/org/ton/lite/client Expand file tree Collapse file tree 5 files changed +14
-28
lines changed Original file line number Diff line number Diff line change 4242 - name : Build using gradle
4343 uses : gradle/gradle-build-action@v2
4444 with :
45- arguments : ${{ matrix.gradle_args }} closeAndReleaseSonatypeStagingRepository
45+ arguments : ${{ matrix.gradle_args }}
Original file line number Diff line number Diff line change 22
33package org.ton.api.tonnode
44
5- import io.ktor.utils.io.core.*
65import kotlinx.serialization.Serializable
76import org.ton.tl.TlCodec
87import org.ton.tl.TlConstructor
@@ -66,7 +65,7 @@ private data class TonNodeBlockIdImpl(
6665) : TonNodeBlockId {
6766 override fun withSeqno (seqno : Int ): TonNodeBlockId = copy(seqno = seqno)
6867
69- override fun toString (): String = " ($workchain :${shard.toString( 16 ).uppercase ()} :$seqno )"
68+ override fun toString (): String = " ($workchain :${shard.toShard().hex ()} :$seqno )"
7069}
7170
7271private object TonNodeBlockIdTlbConstructor : TlConstructor<TonNodeBlockId>(
Original file line number Diff line number Diff line change @@ -187,7 +187,6 @@ internal class AhmnNodeIterator<X, Y>(
187187 edge
188188 } else {
189189 addState(prefix, node)
190- // println("goto next")
191190 gotoNext()
192191 }
193192 }
Original file line number Diff line number Diff line change @@ -296,6 +296,11 @@ public class LiteClient(
296296 result
297297 }
298298
299+ public suspend fun getBlock (blockId : TonNodeBlockId ): Block ? {
300+ val blockIdExt = lookupBlock(blockId) ? : return null
301+ return getBlock(blockIdExt)
302+ }
303+
299304 public suspend fun getBlock (blockId : TonNodeBlockIdExt ): Block ? {
300305 val blockData = try {
301306 liteApi(LiteServerGetBlock (blockId))
Original file line number Diff line number Diff line change 11import kotlinx.coroutines.Dispatchers
22import kotlinx.coroutines.runBlocking
3- import org.ton.api.liteclient.config.LiteClientConfigGlobal
4- import org.ton.api.liteserver.LiteServerDesc
5- import org.ton.api.pub.PublicKeyEd25519
3+ import org.ton.api.tonnode.Shard
64import org.ton.api.tonnode.TonNodeBlockId
7- import org.ton.api.validator.config.ValidatorConfigGlobal
8- import org.ton.crypto.base64
95import org.ton.lite.client.LiteClient
106
11- fun main () {
7+ fun main () = runBlocking {
128 val liteClient = LiteClient (
139 coroutineContext = Dispatchers .Default ,
14- liteClientConfigGlobal = LiteClientConfigGlobal (
15- liteServers = listOf (
16- LiteServerDesc (
17- id = PublicKeyEd25519 (base64(" p2tSiaeSqX978BxE5zLxuTQM06WVDErf5/15QToxMYA=" )),
18- ip = 1097649206 ,
19- port = 29296
20- )
21- ),
22- validator = ValidatorConfigGlobal ()
23- )
10+ liteClientConfigGlobal = GLOBAL_CONFIG
2411 )
25- val blockId = 8573000
26- runBlocking {
27- liteClient.lookupBlock(
28- TonNodeBlockId (workchain = 0 , shard = Long .MIN_VALUE , seqno = blockId)
29- )?.let {
30- println (liteClient.getBlock(it))
31- }
32- }
12+ val blockId = 27750192
13+ val block = liteClient.getBlock(TonNodeBlockId (- 1 , Shard .ID_ALL , 27750192 )) ? : error(" no block" )
14+ // println(block)
15+ val accountBlocks = block.extra.value.accountBlocks.value
3316}
You can’t perform that action at this time.
0 commit comments