Skip to content

Commit

Permalink
Update to EVER SDK 1.41.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mdorofeev committed Feb 19, 2023
1 parent 6b8e932 commit 03cec34
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 5 deletions.
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.53"
implementation "ee.nx-01.tonclient:ton-client-kotlin:0.0.59"
```

## Supported OS
Expand Down
6 changes: 4 additions & 2 deletions src/main/kotlin/ee/nx01/tonclient/TonClientConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ package ee.nx01.tonclient
data class TonClientConfig(
val network: NetworkConfig = NetworkConfig(),
val crypto: CryptoConfig? = null,
val abi: AbiConfig? = null
val abi: AbiConfig? = null,
val binding: Map<String, String> = mapOf("library" to "ton-client-kotlin", "version" to "0.0.59" )
)


Expand All @@ -30,4 +31,5 @@ data class AbiConfig(
val workchain: Int? = null,
val messageExpirationTimeout: Int? = null,
val messageExpirationTimeoutGrowFactor: Int? = null
)
)

10 changes: 8 additions & 2 deletions src/main/kotlin/ee/nx01/tonclient/abi/AbiModule.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ee.nx01.tonclient.abi

import ee.nx01.tonclient.TonClient
import ee.nx01.tonclient.boc.BocCacheType

/**
# Module abi
Expand Down Expand Up @@ -110,7 +109,7 @@ class AbiModule(private val tonClient: TonClient) {
/**
* Decodes account data using provided data BOC and ABI.
Note: this feature requires ABI 2.1 or higher.
Note: this feature requires ABI 2.1 or higher.
*/
suspend fun decodeAccountData(params: ParamsOfDecodeAccountData): ResultOfDecodeData {
return tonClient.request("abi.decode_account_data", params)
Expand Down Expand Up @@ -155,4 +154,11 @@ class AbiModule(private val tonClient: TonClient) {
suspend fun calcFunctionId(params: ParamsOfCalcFunctionId): ResultOfCalcFunctionId {
return tonClient.request("abi.calc_function_id", params)
}

/**
* Extracts signature from message body and calculates hash to verify the signature
*/
suspend fun getSignatureData(params: ParamsOfGetSignatureData): ResultOfGetSignatureData {
return tonClient.request("abi.get_signature_data", params)
}
}
11 changes: 11 additions & 0 deletions src/main/kotlin/ee/nx01/tonclient/abi/Types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,14 @@ data class ParamsOfCalcFunctionId(
data class ResultOfCalcFunctionId(
val function_id: Long
)

data class ParamsOfGetSignatureData(
val abi: Abi,
val message: String,
val signature_id: Int? = null
)

data class ResultOfGetSignatureData(
val signature: String,
val unsigned: String
)
Binary file modified src/main/resources/natives/osx_64/libtonclientjni.dylib
Binary file not shown.
Binary file modified src/main/resources/natives/osx_arm64/libtonclientjni.dylib
Binary file not shown.
11 changes: 11 additions & 0 deletions src/test/kotlin/ee/nx01/tonclient/abi/AbiModuleTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,15 @@ class AbiModuleTest : StringSpec({

}

"Should be able call get signature data " {
val client = TonClient()

val abi = TonUtils.readAbi("setcodemultisig/SetcodeMultisigWallet.abi.json")

val response = client.abi.getSignatureData(ParamsOfGetSignatureData(abi, "te6ccgEBBAEA0QABRYgAIOUk2QkCZir6x9GC0jec83d6iyaPfI+1cKptIHEpXWYMAQHh9w7spN3GKgAeE8SSmvi/Q6Scw7SVwnsVRjvNxXPh1E/qDF1GTgGA/LZwnQOlAYVq/9oxrJuv4wPCZA+XfyuYB1+82TQK99ImlZxRVPdZiYGZtUtSwPFq9bOYux/+8CiygAAAXVAHUH8X41XhBMdgs2ACAWOAHdKNExvciXNvqdqKX1ybdO59hnMullzqRH0NBClYA7/AAAAAAAAAAAAAAAAAvrwgBAMAAA=="))

response shouldNotBe null

}

})

0 comments on commit 03cec34

Please sign in to comment.