diff --git a/Readme.md b/Readme.md index b5d7e85..4a1f578 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ # TON SDK client Golang -[![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-SDK](https://img.shields.io/badge/TON_SDK-1.16.0-green.svg)](https://github.com/tonlabs/TON-SDK/tree/1.16.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) diff --git a/api-spec.json b/api-spec.json index a143981..648dedd 100644 --- a/api-spec.json +++ b/api-spec.json @@ -1,5 +1,5 @@ { - "version": "1.15.0", + "version": "1.16.0", "modules": [ { "name": "client", @@ -4281,9 +4281,9 @@ "struct_fields": [ { "name": "key", - "type": "BigInt", + "type": "Number", "number_type": "UInt", - "number_size": 64, + "number_size": 32, "summary": null, "description": null }, @@ -8091,6 +8091,139 @@ "summary": null, "description": null }, + { + "name": "TransactionNode", + "type": "Struct", + "struct_fields": [ + { + "name": "id", + "type": "String", + "summary": "Transaction id.", + "description": null + }, + { + "name": "in_msg", + "type": "String", + "summary": "In message id.", + "description": null + }, + { + "name": "out_msgs", + "type": "Array", + "array_item": { + "type": "String" + }, + "summary": "Out message ids.", + "description": null + }, + { + "name": "account_addr", + "type": "String", + "summary": "Account address.", + "description": null + }, + { + "name": "total_fees", + "type": "String", + "summary": "Transactions total fees.", + "description": null + }, + { + "name": "aborted", + "type": "Boolean", + "summary": "Aborted flag.", + "description": null + }, + { + "name": "exit_code", + "type": "Optional", + "optional_inner": { + "type": "Number", + "number_type": "UInt", + "number_size": 32 + }, + "summary": "Compute phase exit code.", + "description": null + } + ], + "summary": null, + "description": null + }, + { + "name": "MessageNode", + "type": "Struct", + "struct_fields": [ + { + "name": "id", + "type": "String", + "summary": "Message id.", + "description": null + }, + { + "name": "src_transaction_id", + "type": "Optional", + "optional_inner": { + "type": "String" + }, + "summary": "Source transaction id.", + "description": "This field is missing for an external inbound messages." + }, + { + "name": "dst_transaction_id", + "type": "Optional", + "optional_inner": { + "type": "String" + }, + "summary": "Destination transaction id.", + "description": "This field is missing for an external outbound messages." + }, + { + "name": "src", + "type": "Optional", + "optional_inner": { + "type": "String" + }, + "summary": "Source address.", + "description": null + }, + { + "name": "dst", + "type": "Optional", + "optional_inner": { + "type": "String" + }, + "summary": "Destination address.", + "description": null + }, + { + "name": "value", + "type": "Optional", + "optional_inner": { + "type": "String" + }, + "summary": "Transferred tokens value.", + "description": null + }, + { + "name": "bounce", + "type": "Boolean", + "summary": "Bounce flag.", + "description": null + }, + { + "name": "decoded_body", + "type": "Optional", + "optional_inner": { + "type": "Ref", + "ref_name": "abi.DecodedMessageBody" + }, + "summary": "Decoded body.", + "description": "Library tries to decode message body using provided `params.abi_registry`.\nThis field will be missing if none of the provided abi can be used to decode." + } + ], + "summary": null, + "description": null + }, { "name": "ParamsOfQuery", "type": "Struct", @@ -8499,6 +8632,61 @@ ], "summary": null, "description": null + }, + { + "name": "ParamsOfQueryTransactionTree", + "type": "Struct", + "struct_fields": [ + { + "name": "in_msg", + "type": "String", + "summary": "Input message id.", + "description": null + }, + { + "name": "abi_registry", + "type": "Optional", + "optional_inner": { + "type": "Array", + "array_item": { + "type": "Ref", + "ref_name": "abi.Abi" + } + }, + "summary": "List of contract ABIs that will be used to decode message bodies. Library will try to decode each returned message body using any ABI from the registry.", + "description": null + } + ], + "summary": null, + "description": null + }, + { + "name": "ResultOfQueryTransactionTree", + "type": "Struct", + "struct_fields": [ + { + "name": "messages", + "type": "Array", + "array_item": { + "type": "Ref", + "ref_name": "net.MessageNode" + }, + "summary": "Messages.", + "description": null + }, + { + "name": "transactions", + "type": "Array", + "array_item": { + "type": "Ref", + "ref_name": "net.TransactionNode" + }, + "summary": "Transactions.", + "description": null + } + ], + "summary": null, + "description": null } ], "functions": [ @@ -9014,6 +9202,44 @@ ] }, "errors": null + }, + { + "name": "query_transaction_tree", + "summary": "Returns transactions tree for specific message.", + "description": "Performs recursive retrieval of the transactions tree produced by the specific message:\nin_msg -> dst_transaction -> out_messages -> dst_transaction -> ...\n\nAll retrieved messages and transactions will be included\ninto `result.messages` and `result.transactions` respectively.\n\nThe retrieval process will stop when the retrieved transaction count is more than 50.\n\nIt is guaranteed that each message in `result.messages` has the corresponding transaction\nin the `result.transactions`.\n\nBut there are no guaranties that all messages from transactions `out_msgs` are\npresented in `result.messages`.\nSo the application have to continue retrieval for missing messages if it requires.", + "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": "net.ParamsOfQueryTransactionTree", + "summary": null, + "description": null + } + ], + "result": { + "type": "Generic", + "generic_name": "ClientResult", + "generic_args": [ + { + "type": "Ref", + "ref_name": "net.ResultOfQueryTransactionTree" + } + ] + }, + "errors": null } ] }, diff --git a/client/mod_abi.gen.go b/client/mod_abi.gen.go index 173443d..0cd0c6b 100644 --- a/client/mod_abi.gen.go +++ b/client/mod_abi.gen.go @@ -1,6 +1,6 @@ package client -// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC +// DON'T EDIT THIS FILE! It is generated via 'task generate' at 26 May 21 07:49 UTC // // Mod abi // @@ -415,7 +415,7 @@ type AbiEvent struct { } type AbiData struct { - Key big.Int `json:"key"` + Key uint32 `json:"key"` Name string `json:"name"` Type string `json:"type"` Components []AbiParam `json:"components"` // optional diff --git a/client/mod_boc.gen.go b/client/mod_boc.gen.go index b358044..7227c11 100644 --- a/client/mod_boc.gen.go +++ b/client/mod_boc.gen.go @@ -1,6 +1,6 @@ package client -// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC +// DON'T EDIT THIS FILE! It is generated via 'task generate' at 26 May 21 07:49 UTC // // Mod boc // diff --git a/client/mod_client.gen.go b/client/mod_client.gen.go index f220267..2303f1d 100644 --- a/client/mod_client.gen.go +++ b/client/mod_client.gen.go @@ -1,6 +1,6 @@ package client -// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC +// DON'T EDIT THIS FILE! It is generated via 'task generate' at 26 May 21 07:49 UTC // // Mod client // diff --git a/client/mod_crypto.gen.go b/client/mod_crypto.gen.go index f1abbd0..d45cf3c 100644 --- a/client/mod_crypto.gen.go +++ b/client/mod_crypto.gen.go @@ -1,6 +1,6 @@ package client -// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC +// DON'T EDIT THIS FILE! It is generated via 'task generate' at 26 May 21 07:49 UTC // // Mod crypto // diff --git a/client/mod_debot.gen.go b/client/mod_debot.gen.go index 9a90ec2..55b306c 100644 --- a/client/mod_debot.gen.go +++ b/client/mod_debot.gen.go @@ -1,6 +1,6 @@ package client -// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC +// DON'T EDIT THIS FILE! It is generated via 'task generate' at 26 May 21 07:49 UTC // // Mod debot // diff --git a/client/mod_net.gen.go b/client/mod_net.gen.go index f599fe2..b622558 100644 --- a/client/mod_net.gen.go +++ b/client/mod_net.gen.go @@ -1,6 +1,6 @@ package client -// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC +// DON'T EDIT THIS FILE! It is generated via 'task generate' at 26 May 21 07:49 UTC // // Mod net // @@ -179,6 +179,46 @@ const ( AverageAggregationFn AggregationFn = "AVERAGE" ) +type TransactionNode struct { + // Transaction id. + ID string `json:"id"` + // In message id. + InMsg string `json:"in_msg"` + // Out message ids. + OutMsgs []string `json:"out_msgs"` + // Account address. + AccountAddr string `json:"account_addr"` + // Transactions total fees. + TotalFees string `json:"total_fees"` + // Aborted flag. + Aborted bool `json:"aborted"` + // Compute phase exit code. + ExitCode null.Uint32 `json:"exit_code"` // optional +} + +type MessageNode struct { + // Message id. + ID string `json:"id"` + // Source transaction id. + // This field is missing for an external inbound messages. + SrcTransactionID null.String `json:"src_transaction_id"` // optional + // Destination transaction id. + // This field is missing for an external outbound messages. + DstTransactionID null.String `json:"dst_transaction_id"` // optional + // Source address. + Src null.String `json:"src"` // optional + // Destination address. + Dst null.String `json:"dst"` // optional + // Transferred tokens value. + Value null.String `json:"value"` // optional + // Bounce flag. + Bounce bool `json:"bounce"` + // Decoded body. + // Library tries to decode message body using provided `params.abi_registry`. + // This field will be missing if none of the provided abi can be used to decode. + DecodedBody *DecodedMessageBody `json:"decoded_body"` // optional +} + type ParamsOfQuery struct { // GraphQL query text. Query string `json:"query"` @@ -301,6 +341,20 @@ type ParamsOfQueryCounterparties struct { After null.String `json:"after"` // optional } +type ParamsOfQueryTransactionTree struct { + // Input message id. + InMsg string `json:"in_msg"` + // List of contract ABIs that will be used to decode message bodies. Library will try to decode each returned message body using any ABI from the registry. + AbiRegistry []Abi `json:"abi_registry"` // optional +} + +type ResultOfQueryTransactionTree struct { + // Messages. + Messages []MessageNode `json:"messages"` + // Transactions. + Transactions []TransactionNode `json:"transactions"` +} + // Performs DAppServer GraphQL query. func (c *Client) NetQuery(p *ParamsOfQuery) (*ResultOfQuery, error) { result := new(ResultOfQuery) @@ -423,3 +477,26 @@ func (c *Client) NetQueryCounterparties(p *ParamsOfQueryCounterparties) (*Result return result, err } + +// 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. +func (c *Client) NetQueryTransactionTree(p *ParamsOfQueryTransactionTree) (*ResultOfQueryTransactionTree, error) { + result := new(ResultOfQueryTransactionTree) + + err := c.dllClient.waitErrorOrResultUnmarshal("net.query_transaction_tree", p, result) + + return result, err +} diff --git a/client/mod_processing.gen.go b/client/mod_processing.gen.go index 7426174..6c13322 100644 --- a/client/mod_processing.gen.go +++ b/client/mod_processing.gen.go @@ -1,6 +1,6 @@ package client -// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC +// DON'T EDIT THIS FILE! It is generated via 'task generate' at 26 May 21 07:49 UTC // // Mod processing // diff --git a/client/mod_tvm.gen.go b/client/mod_tvm.gen.go index 205c2ab..db9cb66 100644 --- a/client/mod_tvm.gen.go +++ b/client/mod_tvm.gen.go @@ -1,6 +1,6 @@ package client -// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC +// DON'T EDIT THIS FILE! It is generated via 'task generate' at 26 May 21 07:49 UTC // // Mod tvm // diff --git a/client/mod_utils.gen.go b/client/mod_utils.gen.go index 3c1dd35..aef78e7 100644 --- a/client/mod_utils.gen.go +++ b/client/mod_utils.gen.go @@ -1,6 +1,6 @@ package client -// DON'T EDIT THIS FILE! It is generated via 'task generate' at 21 May 21 06:08 UTC +// DON'T EDIT THIS FILE! It is generated via 'task generate' at 26 May 21 07:49 UTC // // Mod utils //