Skip to content

Commit

Permalink
Merge pull request #32 from radianceteam/develop
Browse files Browse the repository at this point in the history
1.35.0 implementation
  • Loading branch information
sdvornik authored Jul 12, 2022
2 parents cf7f3a3 + 8843b71 commit 31fba6e
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
**Community links:**

[![Chat on Telegram](https://img.shields.io/badge/chat-on%20telegram-9cf.svg)](https://t.me/RADIANCE_TON_SDK)
[![SDK version](https://img.shields.io/badge/TON%20SDK%20version-1.34.2-green)](https://github.com/tonlabs/ever-sdk/tree/1.34.2)
[![SDK version](https://img.shields.io/badge/TON%20SDK%20version-1.35.0-green)](https://github.com/tonlabs/ever-sdk/tree/1.35.0)

**Everscale scala client** is a simple scala binding to the [ever-sdk](https://github.com/tonlabs/ever-sdk).

Features:
* All methods of the ever-sdk v 1.34.2
* All methods of the ever-sdk v 1.35.0
* Interaction with the ever-sdk through synchronous an asynchronous calls
* The every method contains inline-doc
* The automatic download of the ever-sdk library for the current environment
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ val root = project in file(".")
lazy val `everscale-client-scala` = project
.settings(
scalaVersion := "2.13.4",
version := "1.34.2",
version := "1.35.0",
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-derivation" % circeDerivationVersion,
Expand Down
2 changes: 1 addition & 1 deletion ever-sdk
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,26 @@ class AbiModule(ctx: Context) {
)
}

/**
* Calculates contract function ID by contract ABI
* @param abi
* abi
* @param function_name
* function_name
* @param output
* output
*/
def calcFunctionId(
abi: AbiADT.Abi,
function_name: String,
output: Option[Boolean]
): Future[Either[Throwable, ResultOfCalcFunctionId]] = {
ctx.execAsync[ParamsOfCalcFunctionId, ResultOfCalcFunctionId](
"abi.calc_function_id",
ParamsOfCalcFunctionId(abi, function_name, output)
)
}

/**
* Decodes account data using provided data BOC and ABI. Note: this feature requires ABI 2.1 or higher.
* @param abi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ object AbiErrorCodeEnum {
case object InvalidFunctionId extends AbiErrorCode {
override val code: String = "312"
}
case object InvalidFunctionName extends AbiErrorCode {
override val code: String = "315"
}
case object InvalidJson extends AbiErrorCode {
override val code: String = "303"
}
Expand Down Expand Up @@ -265,6 +268,13 @@ object ParamsOfAttachSignatureToMessageBody {
deriveEncoder[ParamsOfAttachSignatureToMessageBody]
}

case class ParamsOfCalcFunctionId(abi: AbiADT.Abi, function_name: String, output: Option[Boolean])

object ParamsOfCalcFunctionId {
implicit val encoder: Encoder[ParamsOfCalcFunctionId] =
deriveEncoder[ParamsOfCalcFunctionId]
}

case class ParamsOfDecodeAccountData(abi: AbiADT.Abi, data: String, allow_partial: Option[Boolean])

object ParamsOfDecodeAccountData {
Expand Down Expand Up @@ -407,6 +417,13 @@ object ResultOfAttachSignatureToMessageBody {
deriveDecoder[ResultOfAttachSignatureToMessageBody]
}

case class ResultOfCalcFunctionId(function_id: Long)

object ResultOfCalcFunctionId {
implicit val decoder: Decoder[ResultOfCalcFunctionId] =
deriveDecoder[ResultOfCalcFunctionId]
}

case class ResultOfDecodeAccountData(data: Value)

object ResultOfDecodeAccountData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ case class ExecutionOptions(
blockchain_config: Option[String],
block_time: Option[Long],
block_lt: Option[BigInt],
transaction_lt: Option[BigInt]
transaction_lt: Option[BigInt],
chksig_always_succeed: Option[Boolean]
)

object ExecutionOptions {
Expand Down
102 changes: 101 additions & 1 deletion everscale-codegen/src/main/resources/api.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.34.2",
"version": "1.35.0",
"modules": [
{
"name": "client",
Expand Down Expand Up @@ -5374,6 +5374,13 @@
"value": "314",
"summary": null,
"description": null
},
{
"name": "InvalidFunctionName",
"type": "Number",
"value": "315",
"summary": null,
"description": null
}
],
"summary": null,
Expand Down Expand Up @@ -6950,6 +6957,52 @@
],
"summary": null,
"description": null
},
{
"name": "ParamsOfCalcFunctionId",
"type": "Struct",
"struct_fields": [
{
"name": "abi",
"type": "Ref",
"ref_name": "abi.Abi",
"summary": "Contract ABI.",
"description": null
},
{
"name": "function_name",
"type": "String",
"summary": "Contract function name",
"description": null
},
{
"name": "output",
"type": "Optional",
"optional_inner": {
"type": "Boolean"
},
"summary": "If set to `true` output function ID will be returned which is used in contract response. Default is `false`",
"description": null
}
],
"summary": null,
"description": null
},
{
"name": "ResultOfCalcFunctionId",
"type": "Struct",
"struct_fields": [
{
"name": "function_id",
"type": "Number",
"number_type": "UInt",
"number_size": 32,
"summary": "Contract function ID",
"description": null
}
],
"summary": null,
"description": null
}
],
"functions": [
Expand Down Expand Up @@ -7484,6 +7537,44 @@
]
},
"errors": null
},
{
"name": "calc_function_id",
"summary": "Calculates contract function ID by contract ABI",
"description": null,
"params": [
{
"name": "_context",
"type": "Generic",
"generic_name": "Arc",
"generic_args": [
{
"type": "Ref",
"ref_name": "ClientContext"
}
],
"summary": null,
"description": null
},
{
"name": "params",
"type": "Ref",
"ref_name": "abi.ParamsOfCalcFunctionId",
"summary": null,
"description": null
}
],
"result": {
"type": "Generic",
"generic_name": "ClientResult",
"generic_args": [
{
"type": "Ref",
"ref_name": "abi.ResultOfCalcFunctionId"
}
]
},
"errors": null
}
]
},
Expand Down Expand Up @@ -10512,6 +10603,15 @@
},
"summary": "transaction logical time",
"description": null
},
{
"name": "chksig_always_succeed",
"type": "Optional",
"optional_inner": {
"type": "Boolean"
},
"summary": "Overrides standard TVM behaviour. If set to `true` then CHKSIG always will return `true`.",
"description": null
}
],
"summary": null,
Expand Down
14 changes: 13 additions & 1 deletion everscale-codegen/src/main/resources/prototypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,9 @@ package abi {
case object InvalidFunctionId extends AbiErrorCode {
override val code: String = "312"
}
case object InvalidFunctionName extends AbiErrorCode {
override val code: String = "315"
}
case object InvalidJson extends AbiErrorCode {
override val code: String = "303"
}
Expand Down Expand Up @@ -890,6 +893,7 @@ package abi {
case class ParamsOfAbiEncodeBoc(params: List[AbiParam], data: Value, boc_cache: Option[BocCacheType])
case class ParamsOfAttachSignature(abi: Abi, public_key: String, message: String, signature: String)
case class ParamsOfAttachSignatureToMessageBody(abi: Abi, public_key: String, message: String, signature: String)
case class ParamsOfCalcFunctionId(abi: Abi, function_name: String, output: Option[Boolean])
case class ParamsOfDecodeAccountData(abi: Abi, data: String, allow_partial: Option[Boolean])
case class ParamsOfDecodeBoc(params: List[AbiParam], boc: String, allow_partial: Boolean)
case class ParamsOfDecodeInitialData(abi: Option[Abi], data: String, allow_partial: Option[Boolean])
Expand All @@ -904,6 +908,7 @@ package abi {
case class ResultOfAbiEncodeBoc(boc: String)
case class ResultOfAttachSignature(message: String, message_id: String)
case class ResultOfAttachSignatureToMessageBody(body: String)
case class ResultOfCalcFunctionId(function_id: Long)
case class ResultOfDecodeAccountData(data: Value)
case class ResultOfDecodeBoc(data: Value)
case class ResultOfDecodeInitialData(initial_data: Option[Value], initial_pubkey: String)
Expand Down Expand Up @@ -948,6 +953,13 @@ package abi {
* @param signature Must be encoded with `hex`.
*/
def attachSignatureToMessageBody(abi: Abi, public_key: String, message: String, signature: String): Future[Either[Throwable, ResultOfAttachSignatureToMessageBody]]
/**
* Calculates contract function ID by contract ABI
* @param abi abi
* @param function_name function_name
* @param output output
*/
def calcFunctionId(abi: Abi, function_name: String, output: Option[Boolean]): Future[Either[Throwable, ResultOfCalcFunctionId]]
/**
* Decodes account data using provided data BOC and ABI.
* Note: this feature requires ABI 2.1 or higher.
Expand Down Expand Up @@ -1574,7 +1586,7 @@ package tvm {
/** Emulate uninitialized account to run deploy message */
case object Uninit extends AccountForExecutor
}
case class ExecutionOptions(blockchain_config: Option[String], block_time: Option[Long], block_lt: Option[BigInt], transaction_lt: Option[BigInt])
case class ExecutionOptions(blockchain_config: Option[String], block_time: Option[Long], block_lt: Option[BigInt], transaction_lt: Option[BigInt], chksig_always_succeed: Option[Boolean])
case class ParamsOfRunExecutor(message: String, account: AccountForExecutor, execution_options: Option[ExecutionOptions], abi: Option[Abi], skip_transaction_check: Option[Boolean], boc_cache: Option[BocCacheType], return_updated_account: Option[Boolean])
case class ParamsOfRunGet(account: String, function_name: String, input: Option[Value], execution_options: Option[ExecutionOptions], tuple_list_as_array: Option[Boolean])
case class ParamsOfRunTvm(message: String, account: String, execution_options: Option[ExecutionOptions], abi: Option[Abi], boc_cache: Option[BocCacheType], return_updated_account: Option[Boolean])
Expand Down

0 comments on commit 31fba6e

Please sign in to comment.