Skip to content

Commit

Permalink
Merge pull request #13 from radianceteam/1.15.0-rc
Browse files Browse the repository at this point in the history
[1.15.0-rc] Add support for TON-SDK 1.15.0
  • Loading branch information
risentveber authored May 21, 2021
2 parents ccb3235 + b22dfa0 commit b7bddb8
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TON SDK client Golang

[![TON-SDK](https://img.shields.io/badge/TON_SDK-1.14.1-green.svg)](https://github.com/tonlabs/TON-SDK/tree/1.14.1)
[![TON-SDK](https://img.shields.io/badge/TON_SDK-1.15.0-green.svg)](https://github.com/tonlabs/TON-SDK/tree/1.15.0)
[![TON local-node docker image](https://img.shields.io/badge/TON_version-0.24.11-green.svg)](https://hub.docker.com/layers/tonlabs/local-node/0.24.8/images/sha256-62239cb2b215cbca7e8792812e27fa293727cfd8b17d3e58523c8a15a3673504?context=explore)
[![Chat Telegram](https://img.shields.io/badge/chat-Telegram-9cf.svg)](https://t.me/RADIANCE_TON_SDK)
[![Documentation](https://godoc.org/github.com/radianceteam/ton-client-go/client?status.svg)](https://godoc.org/github.com/radianceteam/ton-client-go/client)
Expand Down
110 changes: 97 additions & 13 deletions api-spec.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.14.1",
"version": "1.15.0",
"modules": [
{
"name": "client",
Expand Down Expand Up @@ -366,8 +366,8 @@
"number_type": "UInt",
"number_size": 32
},
"summary": "Maximum time for sequential reconnections in ms.",
"description": "Default value is 120000 (2 min)"
"summary": "Maximum time for sequential reconnections.",
"description": "Must be specified in milliseconds. Default is 120000 (2 min)."
},
{
"name": "reconnect_timeout",
Expand All @@ -388,8 +388,8 @@
"number_type": "Int",
"number_size": 8
},
"summary": "The number of automatic message processing retries that SDK performs in case of `Message Expired (507)` error - but only for those messages which local emulation was successful or failed with replay protection error. The default value is 5.",
"description": null
"summary": "The number of automatic message processing retries that SDK performs in case of `Message Expired (507)` error - but only for those messages which local emulation was successful or failed with replay protection error.",
"description": "Default is 5."
},
{
"name": "message_processing_timeout",
Expand All @@ -400,7 +400,7 @@
"number_size": 32
},
"summary": "Timeout that is used to process message delivery for the contracts which ABI does not include \"expire\" header. If the message is not delivered within the specified timeout the appropriate error occurs.",
"description": null
"description": "Must be specified in milliseconds. Default is 40000 (40 sec)."
},
{
"name": "wait_for_timeout",
Expand All @@ -410,8 +410,8 @@
"number_type": "UInt",
"number_size": 32
},
"summary": "Maximum timeout that is used for query response. The default value is 40 sec.",
"description": null
"summary": "Maximum timeout that is used for query response.",
"description": "Must be specified in milliseconds. Default is 40000 (40 sec)."
},
{
"name": "out_of_sync_threshold",
Expand All @@ -422,7 +422,7 @@
"number_size": 32
},
"summary": "Maximum time difference between server and client.",
"description": "If client's device time is out of sync and difference is more than the threshold then error will occur. Also an error will occur if the specified threshold is more than\n`message_processing_timeout/2`.\nThe default value is 15 sec."
"description": "If client's device time is out of sync and difference is more than the threshold then error will occur. Also an error will occur if the specified threshold is more than\n`message_processing_timeout/2`.\n\nMust be specified in milliseconds. Default is 15000 (15 sec)."
},
{
"name": "sending_endpoint_count",
Expand All @@ -432,8 +432,30 @@
"number_type": "UInt",
"number_size": 8
},
"summary": "Maximum number of randomly chosen endpoints the library uses to send message. The default value is 2 endpoints.",
"description": null
"summary": "Maximum number of randomly chosen endpoints the library uses to broadcast a message.",
"description": "Default is 2."
},
{
"name": "latency_detection_interval",
"type": "Optional",
"optional_inner": {
"type": "Number",
"number_type": "UInt",
"number_size": 32
},
"summary": "Frequency of sync latency detection.",
"description": "Library periodically checks the current endpoint for blockchain data syncronization latency.\nIf the latency (time-lag) is less then `NetworkConfig.max_latency`\nthen library selects another endpoint.\n\nMust be specified in milliseconds. Default is 60000 (1 min)."
},
{
"name": "max_latency",
"type": "Optional",
"optional_inner": {
"type": "Number",
"number_type": "UInt",
"number_size": 32
},
"summary": "Maximum value for the endpoint's blockchain data syncronization latency (time-lag). Library periodically checks the current endpoint for blockchain data syncronization latency. If the latency (time-lag) is less then `NetworkConfig.max_latency` then library selects another endpoint.",
"description": "Must be specified in milliseconds. Default is 60000 (1 min)."
},
{
"name": "access_key",
Expand All @@ -442,7 +464,7 @@
"type": "String"
},
"summary": "Access key to GraphQL API.",
"description": "At the moment is not used in production"
"description": "At the moment is not used in production."
}
],
"summary": null,
Expand Down Expand Up @@ -7709,7 +7731,7 @@
{
"name": "run_executor",
"summary": "Emulates all the phases of contract execution locally",
"description": "Performs all the phases of contract execution on Transaction Executor -\nthe same component that is used on Validator Nodes.\n\nCan be used for contract debugginh, to find out the reason why message was not delivered successfully\n - because Validators just throw away the failed external inbound messages, here you can catch them.\n\nAnother use case is to estimate fees for message execution. Set `AccountForExecutor::Account.unlimited_balance`\nto `true` so that emulation will not depend on the actual balance.\n\nOne more use case - you can produce the sequence of operations,\nthus emulating the multiple contract calls locally.\nAnd so on.\n\nTo get the account BOC (bag of cells) - use `net.query` method to download it from GraphQL API\n(field `boc` of `account`) or generate it with `abi.encode_account` method.\nTo get the message BOC - use `abi.encode_message` or prepare it any other way, for instance, with FIFT script.\n\nIf you need this emulation to be as precise as possible then specify `ParamsOfRunExecutor` parameter.\nIf you need to see the aborted transaction as a result, not as an error, set `skip_transaction_check` to `true`.",
"description": "Performs all the phases of contract execution on Transaction Executor -\nthe same component that is used on Validator Nodes.\n\nCan be used for contract debugging, to find out the reason why a message was not delivered successfully.\nValidators throw away the failed external inbound messages (if they failed bedore `ACCEPT`) in the real network.\nThis is why these messages are impossible to debug in the real network.\nWith the help of run_executor you can do that. In fact, `process_message` function\nperforms local check with `run_executor` if there was no transaction as a result of processing\nand returns the error, if there is one.\n\nAnother use case to use `run_executor` is to estimate fees for message execution.\nSet `AccountForExecutor::Account.unlimited_balance`\nto `true` so that emulation will not depend on the actual balance.\nThis may be needed to calculate deploy fees for an account that does not exist yet.\nJSON with fees is in `fees` field of the result.\n\nOne more use case - you can produce the sequence of operations,\nthus emulating the sequential contract calls locally.\nAnd so on.\n\nTransaction executor requires account BOC (bag of cells) as a parameter.\nTo get the account BOC - use `net.query` method to download it from GraphQL API\n(field `boc` of `account`) or generate it with `abi.encode_account` method.\n\nAlso it requires message BOC. To get the message BOC - use `abi.encode_message` or `abi.encode_internal_message`.\n\nIf you need this emulation to be as precise as possible (for instance - emulate transaction\nwith particular lt in particular block or use particular blockchain config,\nin case you want to download it from a particular key block - then specify `ParamsOfRunExecutor` parameter.\n\nIf you need to see the aborted transaction as a result, not as an error, set `skip_transaction_check` to `true`.",
"params": [
{
"name": "context",
Expand Down Expand Up @@ -8415,6 +8437,29 @@
"summary": null,
"description": null
},
{
"name": "ResultOfGetEndpoints",
"type": "Struct",
"struct_fields": [
{
"name": "query",
"type": "String",
"summary": "Current query endpoint",
"description": null
},
{
"name": "endpoints",
"type": "Array",
"array_item": {
"type": "String"
},
"summary": "List of all endpoints used by client",
"description": null
}
],
"summary": null,
"description": null
},
{
"name": "ParamsOfQueryCounterparties",
"type": "Struct",
Expand Down Expand Up @@ -8901,6 +8946,37 @@
},
"errors": null
},
{
"name": "get_endpoints",
"summary": "Requests the list of alternative endpoints from server",
"description": null,
"params": [
{
"name": "context",
"type": "Generic",
"generic_name": "Arc",
"generic_args": [
{
"type": "Ref",
"ref_name": "ClientContext"
}
],
"summary": null,
"description": null
}
],
"result": {
"type": "Generic",
"generic_name": "ClientResult",
"generic_args": [
{
"type": "Ref",
"ref_name": "net.ResultOfGetEndpoints"
}
]
},
"errors": null
},
{
"name": "query_counterparties",
"summary": "Allows to query and paginate through the list of accounts that the specified account has interacted with, sorted by the time of the last internal message between accounts",
Expand Down Expand Up @@ -9250,6 +9326,14 @@
"type": "String",
"summary": "Public key from keypair that was used to sign external message.",
"description": null
},
{
"name": "signing_box_handle",
"type": "Number",
"number_type": "UInt",
"number_size": 32,
"summary": "Signing box handle used to sign external message.",
"description": null
}
],
"summary": "DeBot wants to create new transaction in blockchain.",
Expand Down
2 changes: 1 addition & 1 deletion client/mod_abi.gen.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package client

// DON'T EDIT THIS FILE! It is generated via 'task generate' at 15 May 21 07:58 UTC
// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC
//
// Mod abi
//
Expand Down
2 changes: 1 addition & 1 deletion client/mod_boc.gen.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package client

// DON'T EDIT THIS FILE! It is generated via 'task generate' at 15 May 21 07:58 UTC
// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC
//
// Mod boc
//
Expand Down
29 changes: 22 additions & 7 deletions client/mod_client.gen.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package client

// DON'T EDIT THIS FILE! It is generated via 'task generate' at 15 May 21 07:58 UTC
// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC
//
// Mod client
//
Expand Down Expand Up @@ -107,24 +107,39 @@ type NetworkConfig struct {
// Deprecated.
// You must use `network.max_reconnect_timeout` that allows to specify maximum network resolving timeout.
NetworkRetriesCount null.Int8 `json:"network_retries_count"` // optional
// Maximum time for sequential reconnections in ms.
// Default value is 120000 (2 min).
// Maximum time for sequential reconnections.
// Must be specified in milliseconds. Default is 120000 (2 min).
MaxReconnectTimeout null.Uint32 `json:"max_reconnect_timeout"` // optional
// Deprecated.
ReconnectTimeout null.Uint32 `json:"reconnect_timeout"` // optional
// The number of automatic message processing retries that SDK performs in case of `Message Expired (507)` error - but only for those messages which local emulation was successful or failed with replay protection error. The default value is 5.
// The number of automatic message processing retries that SDK performs in case of `Message Expired (507)` error - but only for those messages which local emulation was successful or failed with replay protection error.
// Default is 5.
MessageRetriesCount null.Int8 `json:"message_retries_count"` // optional
// Timeout that is used to process message delivery for the contracts which ABI does not include "expire" header. If the message is not delivered within the specified timeout the appropriate error occurs.
// Must be specified in milliseconds. Default is 40000 (40 sec).
MessageProcessingTimeout null.Uint32 `json:"message_processing_timeout"` // optional
// Maximum timeout that is used for query response. The default value is 40 sec.
// Maximum timeout that is used for query response.
// Must be specified in milliseconds. Default is 40000 (40 sec).
WaitForTimeout null.Uint32 `json:"wait_for_timeout"` // optional
// Maximum time difference between server and client.
// If client's device time is out of sync and difference is more than the threshold then error will occur. Also an error will occur if the specified threshold is more than
// `message_processing_timeout/2`.
// The default value is 15 sec.
//
// Must be specified in milliseconds. Default is 15000 (15 sec).
OutOfSyncThreshold null.Uint32 `json:"out_of_sync_threshold"` // optional
// Maximum number of randomly chosen endpoints the library uses to send message. The default value is 2 endpoints.
// Maximum number of randomly chosen endpoints the library uses to broadcast a message.
// Default is 2.
SendingEndpointCount null.Uint8 `json:"sending_endpoint_count"` // optional
// Frequency of sync latency detection.
// Library periodically checks the current endpoint for blockchain data synchronization latency.
// If the latency (time-lag) is less then `NetworkConfig.max_latency`
// then library selects another endpoint.
//
// Must be specified in milliseconds. Default is 60000 (1 min).
LatencyDetectionInterval null.Uint32 `json:"latency_detection_interval"` // optional
// Maximum value for the endpoint's blockchain data synchronization latency (time-lag). Library periodically checks the current endpoint for blockchain data synchronization latency. If the latency (time-lag) is less then `NetworkConfig.max_latency` then library selects another endpoint.
// Must be specified in milliseconds. Default is 60000 (1 min).
MaxLatency null.Uint32 `json:"max_latency"` // optional
// Access key to GraphQL API.
// At the moment is not used in production.
AccessKey null.String `json:"access_key"` // optional
Expand Down
2 changes: 1 addition & 1 deletion client/mod_crypto.gen.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package client

// DON'T EDIT THIS FILE! It is generated via 'task generate' at 15 May 21 07:58 UTC
// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC
//
// Mod crypto
//
Expand Down
4 changes: 3 additions & 1 deletion client/mod_debot.gen.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package client

// DON'T EDIT THIS FILE! It is generated via 'task generate' at 15 May 21 07:58 UTC
// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC
//
// Mod debot
//
Expand Down Expand Up @@ -108,6 +108,8 @@ type TransactionDebotActivity struct {
Setcode bool `json:"setcode"`
// Public key from keypair that was used to sign external message.
Signkey string `json:"signkey"`
// Signing box handle used to sign external message.
SigningBoxHandle uint32 `json:"signing_box_handle"`
}

type DebotActivity struct {
Expand Down
18 changes: 17 additions & 1 deletion client/mod_net.gen.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package client

// DON'T EDIT THIS FILE! It is generated via 'task generate' at 15 May 21 07:58 UTC
// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC
//
// Mod net
//
Expand Down Expand Up @@ -283,6 +283,13 @@ type EndpointsSet struct {
Endpoints []string `json:"endpoints"`
}

type ResultOfGetEndpoints struct {
// Current query endpoint.
Query string `json:"query"`
// List of all endpoints used by client.
Endpoints []string `json:"endpoints"`
}

type ParamsOfQueryCounterparties struct {
// Account address.
Account string `json:"account"`
Expand Down Expand Up @@ -396,6 +403,15 @@ func (c *Client) NetSetEndpoints(p *EndpointsSet) error {
return err
}

// Requests the list of alternative endpoints from server.
func (c *Client) NetGetEndpoints() (*ResultOfGetEndpoints, error) {
result := new(ResultOfGetEndpoints)

err := c.dllClient.waitErrorOrResultUnmarshal("net.get_endpoints", nil, result)

return result, err
}

// Allows to query and paginate through the list of accounts that the specified account has interacted with, sorted by the time of the last internal message between accounts.
// *Attention* this query retrieves data from 'Counterparties' service which is not supported in
// the opensource version of DApp Server (and will not be supported) as well as in TON OS SE (will be supported in SE in future),
Expand Down
2 changes: 1 addition & 1 deletion client/mod_processing.gen.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package client

// DON'T EDIT THIS FILE! It is generated via 'task generate' at 15 May 21 07:58 UTC
// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC
//
// Mod processing
//
Expand Down
Loading

0 comments on commit b7bddb8

Please sign in to comment.