diff --git a/README.md b/README.md index 6d342d0..94f91cf 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/main/kotlin/ee/nx01/tonclient/TonClientConfig.kt b/src/main/kotlin/ee/nx01/tonclient/TonClientConfig.kt index 81f109f..866f222 100644 --- a/src/main/kotlin/ee/nx01/tonclient/TonClientConfig.kt +++ b/src/main/kotlin/ee/nx01/tonclient/TonClientConfig.kt @@ -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 = mapOf("library" to "ton-client-kotlin", "version" to "0.0.59" ) ) @@ -30,4 +31,5 @@ data class AbiConfig( val workchain: Int? = null, val messageExpirationTimeout: Int? = null, val messageExpirationTimeoutGrowFactor: Int? = null -) \ No newline at end of file +) + diff --git a/src/main/kotlin/ee/nx01/tonclient/abi/AbiModule.kt b/src/main/kotlin/ee/nx01/tonclient/abi/AbiModule.kt index 7e53cdb..6a9506b 100644 --- a/src/main/kotlin/ee/nx01/tonclient/abi/AbiModule.kt +++ b/src/main/kotlin/ee/nx01/tonclient/abi/AbiModule.kt @@ -1,7 +1,6 @@ package ee.nx01.tonclient.abi import ee.nx01.tonclient.TonClient -import ee.nx01.tonclient.boc.BocCacheType /** # Module abi @@ -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) @@ -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) + } } diff --git a/src/main/kotlin/ee/nx01/tonclient/abi/Types.kt b/src/main/kotlin/ee/nx01/tonclient/abi/Types.kt index 739f3c3..c13ec72 100644 --- a/src/main/kotlin/ee/nx01/tonclient/abi/Types.kt +++ b/src/main/kotlin/ee/nx01/tonclient/abi/Types.kt @@ -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 +) \ No newline at end of file diff --git a/src/main/resources/natives/osx_64/libtonclientjni.dylib b/src/main/resources/natives/osx_64/libtonclientjni.dylib index 6fe502b..625d0a5 100644 Binary files a/src/main/resources/natives/osx_64/libtonclientjni.dylib and b/src/main/resources/natives/osx_64/libtonclientjni.dylib differ diff --git a/src/main/resources/natives/osx_arm64/libtonclientjni.dylib b/src/main/resources/natives/osx_arm64/libtonclientjni.dylib index 8e6367e..4e2652f 100644 Binary files a/src/main/resources/natives/osx_arm64/libtonclientjni.dylib and b/src/main/resources/natives/osx_arm64/libtonclientjni.dylib differ diff --git a/src/test/kotlin/ee/nx01/tonclient/abi/AbiModuleTest.kt b/src/test/kotlin/ee/nx01/tonclient/abi/AbiModuleTest.kt index 7c47d2a..641654f 100644 --- a/src/test/kotlin/ee/nx01/tonclient/abi/AbiModuleTest.kt +++ b/src/test/kotlin/ee/nx01/tonclient/abi/AbiModuleTest.kt @@ -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 + + } + }) \ No newline at end of file