Skip to content

Commit

Permalink
Update to SDK 1.16.0 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdorofeev authored Jun 13, 2021
1 parent 2f18ffe commit 47cee97
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repositories {
```

```groovy
implementation "ee.nx-01.tonclient:ton-client-kotlin:0.0.30"
implementation "ee.nx-01.tonclient:ton-client-kotlin:0.0.31"
```

## Supported OS
Expand Down
18 changes: 18 additions & 0 deletions src/main/kotlin/ee/nx01/tonclient/net/NetModule.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package ee.nx01.tonclient.net

import ee.nx01.tonclient.TonClient
import ee.nx01.tonclient.abi.Abi
import ee.nx01.tonclient.abi.DecodedMessageBody
import ee.nx01.tonclient.types.QueryOrderByInput

class NetModule(private val tonClient: TonClient) {
Expand Down Expand Up @@ -95,5 +97,21 @@ class NetModule(private val tonClient: TonClient) {
return tonClient.request("net.set_endpoints", params)
}

/**
* Returns transactions tree for specific message.
* Performs recursive retrieval of the transactions tree produced by the specific message: in_msg -> dst_transaction -> out_messages -> dst_transaction -> ...
* All retrieved messages and transactions will be included into result.messages and result.transactions respectively.
* The retrieval process will stop when the retrieved transaction count is more than 50.
* It is guaranteed that each message in result.messages has the corresponding transaction in the result.transactions.
* But there are no guaranties that all messages from transactions out_msgs are presented in result.messages. So the application have to continue retrieval for missing messages if it requires.
*/
suspend fun queryTransactionTree(params: ParamsOfQueryTransactionTree): ResultOfQueryTransactionTree {
return tonClient.request("net.query_transaction_tree", params)
}


}




34 changes: 34 additions & 0 deletions src/main/kotlin/ee/nx01/tonclient/net/Types.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package ee.nx01.tonclient.net

import ee.nx01.tonclient.abi.Abi
import ee.nx01.tonclient.abi.DecodedMessageBody
import ee.nx01.tonclient.types.QueryOrderByInput


Expand Down Expand Up @@ -64,3 +66,35 @@ data class Query(
val order: List<QueryOrderByInput>? = null,
val limit: Int? = null
)

data class MessageNode(
val id: String,
val srcTransactionId: String? = null,
val dstTransactionId: String? = null,
val src: String? = null,
val dst: String? = null,
val value: String? = null,
val bounce: Boolean,
val decodedBody: DecodedMessageBody? = null
)

data class TransactionNode(
val id: String,
val inMsg: String,
val outMsgs: List<String>,
val accountAddr: String,
val totalFees: String,
val aborted: Boolean,
val exitCode: Int? = null
)


data class ParamsOfQueryTransactionTree(
val in_msg: String,
val abiRegistry: List<Abi>? = null
)

data class ResultOfQueryTransactionTree(
val messages: List<MessageNode>,
val transactions: List<TransactionNode>
)
Binary file modified src/main/resources/natives/linux_64/libtonclientjni.so
Binary file not shown.
Binary file modified src/main/resources/natives/osx_64/libtonclientjni.dylib
Binary file not shown.
Binary file modified src/main/resources/natives/windows_64/tonclientjni.dll
Binary file not shown.
9 changes: 9 additions & 0 deletions src/test/kotlin/ee/nx01/tonclient/net/NetModuletTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,13 @@ class NetModuletTest : StringSpec({

client.net.setEndpoints(endpointSet)
}

"Query transaction tree" {
val client = TonClient()

val response = client.net.queryTransactionTree(ParamsOfQueryTransactionTree("94a29f117ef5c1afbc0ee129e9a9c014aa9261ce285b1e7597d0282e0aa29cf5"))

response.messages shouldNotBe null

}
})

0 comments on commit 47cee97

Please sign in to comment.