diff --git a/CHANGELOG.md b/CHANGELOG.md index 62b357c6..df5af835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,4 +18,8 @@ ### 2023-07-11 -- /v2/blockchain/messages/{msg_id}/transaction \ No newline at end of file +- /v2/blockchain/messages/{msg_id}/transaction + +### 2023-07-17 +- Add methods for get raw data, see /v2/liteserver/... +- /v2/rates supports changing percent the daily price \ No newline at end of file diff --git a/api/openapi.json b/api/openapi.json index 116f381c..4d387f37 100644 --- a/api/openapi.json +++ b/api/openapi.json @@ -25,6 +25,27 @@ "type": "array" } }, + "accountIdQuery": { + "description": "account ID", + "explode": false, + "in": "query", + "name": "account_id", + "required": false, + "schema": { + "example": "0:97264395BD65A255A429B11326C84128B7D70FFED7949ABAE3036D506BA38621", + "type": "string" + } + }, + "blockIdExtParameter": { + "description": "block ID: (workchain,shard,seqno,root_hash,file_hash)", + "in": "path", + "name": "block_id", + "required": true, + "schema": { + "example": "(-1,8000000000000000,4234234,3E575DAB1D25...90D8,47192E5C46C...BB29)", + "type": "string" + } + }, "blockIdParameter": { "description": "block ID", "in": "path", @@ -45,6 +66,17 @@ "type": "string" } }, + "countQuery": { + "description": "count", + "in": "query", + "name": "count", + "required": true, + "schema": { + "example": 100, + "format": "uint32", + "type": "integer" + } + }, "domainFilterParameter": { "description": "domain filter for current auctions \"ton\" or \"t.me\"", "in": "query", @@ -75,6 +107,26 @@ "type": "string" } }, + "exactQuery": { + "description": "exact", + "in": "query", + "name": "exact", + "required": true, + "schema": { + "example": false, + "type": "boolean" + } + }, + "hashQuery": { + "description": "hash", + "in": "query", + "name": "hash", + "required": true, + "schema": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + } + }, "i18n": { "in": "header", "name": "Accept-Language", @@ -95,6 +147,16 @@ "type": "string" } }, + "knownBlockIdExtQuery": { + "description": "known block: (workchain,shard,seqno,root_hash,file_hash)", + "in": "query", + "name": "known_block", + "required": true, + "schema": { + "example": "(-1,8000000000000000,4234234,3E575DAB1D25...90D8,47192E5C46C...BB29)", + "type": "string" + } + }, "limit": { "in": "query", "name": "limit", @@ -105,6 +167,27 @@ "type": "integer" } }, + "ltMustQuery": { + "description": "lt", + "in": "query", + "name": "lt", + "required": true, + "schema": { + "example": 23814011000000, + "format": "uint64", + "type": "integer" + } + }, + "ltQuery": { + "description": "lt", + "in": "query", + "name": "lt", + "schema": { + "example": 23814011000000, + "format": "uint64", + "type": "integer" + } + }, "messageIdParameter": { "description": "message ID", "in": "path", @@ -125,6 +208,17 @@ "type": "string" } }, + "modeQuery": { + "description": "mode", + "in": "query", + "name": "mode", + "required": true, + "schema": { + "example": 0, + "format": "uint32", + "type": "integer" + } + }, "offset": { "in": "query", "name": "offset", @@ -154,6 +248,27 @@ "type": "string" } }, + "shardQuery": { + "description": "shard", + "in": "query", + "name": "shard", + "required": true, + "schema": { + "example": 1, + "format": "uint64", + "type": "integer" + } + }, + "targetBlockIdExtQuery": { + "description": "target block: (workchain,shard,seqno,root_hash,file_hash)", + "in": "query", + "name": "target_block", + "required": false, + "schema": { + "example": "(-1,8000000000000000,4234234,3E575DAB1D25...90D8,47192E5C46C...BB29)", + "type": "string" + } + }, "traceIdParameter": { "description": "trace ID or transaction hash in hex (without 0x) or base64url format", "in": "path", @@ -173,6 +288,17 @@ "example": "97264395BD65A255A429B11326C84128B7D70FFED7949ABAE3036D506BA38621", "type": "string" } + }, + "workchainQuery": { + "description": "workchain", + "in": "query", + "name": "workchain", + "required": true, + "schema": { + "example": 1, + "format": "uint32", + "type": "integer" + } } }, "requestBodies": { @@ -230,6 +356,25 @@ "description": "bag-of-cells serialized to base64", "required": true }, + "LiteServerSendMessageRequest": { + "content": { + "application/json": { + "schema": { + "properties": { + "body": { + "type": "string" + } + }, + "required": [ + "body" + ], + "type": "object" + } + } + }, + "description": "Data that is expected", + "required": true + }, "MethodParameters": { "content": { "application/json": { @@ -1117,6 +1262,41 @@ ], "type": "object" }, + "BlockRaw": { + "properties": { + "file_hash": { + "example": "A6A0BD6608672B11B79538A50B2204E748305C12AA0DED9C16CF0006CE3AF8DB", + "type": "string" + }, + "root_hash": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "seqno": { + "example": 30699640, + "format": "uint32", + "type": "integer" + }, + "shard": { + "example": 9223372036854775808, + "format": "uint64", + "type": "integer" + }, + "workchain": { + "example": 4294967295, + "format": "uint32", + "type": "integer" + } + }, + "required": [ + "workchain", + "shard", + "seqno", + "root_hash", + "file_hash" + ], + "type": "object" + }, "BouncePhaseType": { "enum": [ "TrPhaseBounceNegfunds", @@ -1532,6 +1712,29 @@ ], "type": "object" }, + "InitStateRaw": { + "properties": { + "file_hash": { + "example": "A6A0BD6608672B11B79538A50B2204E748305C12AA0DED9C16CF0006CE3AF8DB", + "type": "string" + }, + "root_hash": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "workchain": { + "example": 4294967295, + "format": "uint32", + "type": "integer" + } + }, + "required": [ + "workchain", + "root_hash", + "file_hash" + ], + "type": "object" + }, "JettonBalance": { "properties": { "balance": { @@ -4559,6 +4762,1022 @@ ] } }, + "/v2/liteserver/get_account_state/{account_id}": { + "get": { + "description": "Get account state", + "operationId": "getAccountStateLiteServer", + "parameters": [ + { + "$ref": "#/components/parameters/accountIdParameter" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "id": { + "$ref": "#/components/schemas/BlockRaw" + }, + "proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "shard_proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "shardblk": { + "$ref": "#/components/schemas/BlockRaw" + }, + "state": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + } + }, + "required": [ + "id", + "shardblk", + "shard_proof", + "proof", + "state" + ], + "type": "object" + } + } + }, + "description": "account state" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/get_all_shards_info/{block_id}": { + "get": { + "description": "Get all shards info", + "operationId": "getAllShardsInfoLiteServer", + "parameters": [ + { + "$ref": "#/components/parameters/blockIdExtParameter" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "id": { + "$ref": "#/components/schemas/BlockRaw" + }, + "proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + } + }, + "required": [ + "id", + "proof", + "data" + ], + "type": "object" + } + } + }, + "description": "shards info" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/get_block/{block_id}": { + "get": { + "description": "Get block", + "operationId": "getBlockLiteServer", + "parameters": [ + { + "$ref": "#/components/parameters/blockIdExtParameter" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "id": { + "$ref": "#/components/schemas/BlockRaw" + } + }, + "required": [ + "id", + "data" + ], + "type": "object" + } + } + }, + "description": "block" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/get_block_header/{block_id}": { + "get": { + "description": "Get block header", + "operationId": "getBlockHeaderLiteServer", + "parameters": [ + { + "$ref": "#/components/parameters/blockIdExtParameter" + }, + { + "$ref": "#/components/parameters/modeQuery" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "header_proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "id": { + "$ref": "#/components/schemas/BlockRaw" + }, + "mode": { + "example": 0, + "format": "uint32", + "type": "integer" + } + }, + "required": [ + "id", + "mode", + "header_proof" + ], + "type": "object" + } + } + }, + "description": "block header" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/get_block_proof": { + "get": { + "description": "Get block proof", + "operationId": "getBlockProofLiteServer", + "parameters": [ + { + "$ref": "#/components/parameters/knownBlockIdExtQuery" + }, + { + "$ref": "#/components/parameters/targetBlockIdExtQuery" + }, + { + "$ref": "#/components/parameters/modeQuery" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "complete": { + "example": true, + "type": "boolean" + }, + "from": { + "$ref": "#/components/schemas/BlockRaw" + }, + "steps": { + "items": { + "properties": { + "lite_server_block_link_back": { + "properties": { + "dest_proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "from": { + "$ref": "#/components/schemas/BlockRaw" + }, + "proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "state_proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "to": { + "$ref": "#/components/schemas/BlockRaw" + }, + "to_key_block": { + "example": false, + "type": "boolean" + } + }, + "required": [ + "to_key_block", + "from", + "to", + "dest_proof", + "proof", + "state_proof" + ], + "type": "object" + }, + "lite_server_block_link_forward": { + "properties": { + "config_proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "dest_proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "from": { + "$ref": "#/components/schemas/BlockRaw" + }, + "signatures": { + "properties": { + "catchain_seqno": { + "format": "uint32", + "type": "integer" + }, + "signatures": { + "items": { + "properties": { + "node_id_short": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "signature": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + } + }, + "required": [ + "node_id_short", + "signature" + ], + "type": "object" + }, + "type": "array" + }, + "validator_set_hash": { + "format": "uint32", + "type": "integer" + } + }, + "required": [ + "validator_set_hash", + "catchain_seqno", + "signatures" + ], + "type": "object" + }, + "to": { + "$ref": "#/components/schemas/BlockRaw" + }, + "to_key_block": { + "example": false, + "type": "boolean" + } + }, + "required": [ + "to_key_block", + "from", + "to", + "dest_proof", + "config_proof", + "signatures" + ], + "type": "object" + } + }, + "required": [ + "lite_server_block_link_back", + "lite_server_block_link_forward" + ], + "type": "object" + }, + "type": "array" + }, + "to": { + "$ref": "#/components/schemas/BlockRaw" + } + }, + "required": [ + "complete", + "from", + "to", + "steps" + ], + "type": "object" + } + } + }, + "description": "proof" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/get_config_all/{block_id}": { + "get": { + "description": "Get config all", + "operationId": "getConfigAllLiteServer", + "parameters": [ + { + "$ref": "#/components/parameters/blockIdExtParameter" + }, + { + "$ref": "#/components/parameters/modeQuery" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "config_proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "id": { + "$ref": "#/components/schemas/BlockRaw" + }, + "mode": { + "example": 0, + "format": "uint32", + "type": "integer" + }, + "state_proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + } + }, + "required": [ + "mode", + "id", + "state_proof", + "config_proof" + ], + "type": "object" + } + } + }, + "description": "config" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/get_masterchain_info": { + "get": { + "description": "Get masterchain info", + "operationId": "getMasterchainInfoLiteServer", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "init": { + "$ref": "#/components/schemas/InitStateRaw" + }, + "last": { + "$ref": "#/components/schemas/BlockRaw" + }, + "state_root_hash": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + } + }, + "required": [ + "last", + "state_root_hash", + "init" + ], + "type": "object" + } + } + }, + "description": "masterchain info" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/get_masterchain_info_ext": { + "get": { + "description": "Get masterchain info ext", + "operationId": "getMasterchainInfoExtLiteServer", + "parameters": [ + { + "$ref": "#/components/parameters/modeQuery" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "capabilities": { + "example": 7, + "format": "uint64", + "type": "integer" + }, + "init": { + "$ref": "#/components/schemas/InitStateRaw" + }, + "last": { + "$ref": "#/components/schemas/BlockRaw" + }, + "last_utime": { + "example": 1687938199, + "format": "uint32", + "type": "integer" + }, + "mode": { + "example": 0, + "format": "uint32", + "type": "integer" + }, + "now": { + "example": 1687938204, + "format": "uint32", + "type": "integer" + }, + "state_root_hash": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "version": { + "example": 257, + "format": "uint32", + "type": "integer" + } + }, + "required": [ + "mode", + "version", + "capabilities", + "last", + "last_utime", + "now", + "state_root_hash", + "init" + ], + "type": "object" + } + } + }, + "description": "masterchain info ext" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/get_shard_block_proof/{block_id}": { + "get": { + "description": "Get shard block proof", + "operationId": "getShardBlockProofLiteServer", + "parameters": [ + { + "$ref": "#/components/parameters/blockIdExtParameter" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "links": { + "items": { + "properties": { + "id": { + "$ref": "#/components/schemas/BlockRaw" + }, + "proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + } + }, + "required": [ + "id", + "proof" + ], + "type": "object" + }, + "type": "array" + }, + "masterchain_id": { + "$ref": "#/components/schemas/BlockRaw" + } + }, + "required": [ + "masterchain_id", + "links" + ], + "type": "object" + } + } + }, + "description": "shard" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/get_shard_info/{block_id}": { + "get": { + "description": "Get shard info", + "operationId": "getShardInfoLiteServer", + "parameters": [ + { + "$ref": "#/components/parameters/blockIdExtParameter" + }, + { + "$ref": "#/components/parameters/workchainQuery" + }, + { + "$ref": "#/components/parameters/shardQuery" + }, + { + "$ref": "#/components/parameters/exactQuery" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "id": { + "$ref": "#/components/schemas/BlockRaw" + }, + "shard_descr": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "shard_proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "shardblk": { + "$ref": "#/components/schemas/BlockRaw" + } + }, + "required": [ + "id", + "shardblk", + "shard_proof", + "shard_descr" + ], + "type": "object" + } + } + }, + "description": "shard info" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/get_state/{block_id}": { + "get": { + "description": "Get block state", + "operationId": "getStateLiteServer", + "parameters": [ + { + "$ref": "#/components/parameters/blockIdExtParameter" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "file_hash": { + "example": "A6A0BD6608672B11B79538A50B2204E748305C12AA0DED9C16CF0006CE3AF8DB", + "type": "string" + }, + "id": { + "$ref": "#/components/schemas/BlockRaw" + }, + "root_hash": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + } + }, + "required": [ + "id", + "root_hash", + "file_hash", + "data" + ], + "type": "object" + } + } + }, + "description": "state" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/get_time": { + "get": { + "description": "Get time", + "operationId": "getTimeLiteServer", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "time": { + "example": 1687146728, + "format": "uint32", + "type": "integer" + } + }, + "required": [ + "time" + ], + "type": "object" + } + } + }, + "description": "time" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/get_transactions/{account_id}": { + "get": { + "description": "Get transactions", + "operationId": "getTransactionsLiteServer", + "parameters": [ + { + "$ref": "#/components/parameters/accountIdParameter" + }, + { + "$ref": "#/components/parameters/countQuery" + }, + { + "$ref": "#/components/parameters/ltMustQuery" + }, + { + "$ref": "#/components/parameters/hashQuery" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "ids": { + "items": { + "$ref": "#/components/schemas/BlockRaw" + }, + "type": "array" + }, + "transactions": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + } + }, + "required": [ + "ids", + "transactions" + ], + "type": "object" + } + } + }, + "description": "transactions" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/list_block_transactions/{block_id}": { + "get": { + "description": "Get list block transactions", + "operationId": "getListBlockTransactionsLiteServer", + "parameters": [ + { + "$ref": "#/components/parameters/blockIdExtParameter" + }, + { + "$ref": "#/components/parameters/modeQuery" + }, + { + "$ref": "#/components/parameters/countQuery" + }, + { + "$ref": "#/components/parameters/accountIdQuery" + }, + { + "$ref": "#/components/parameters/ltQuery" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "id": { + "$ref": "#/components/schemas/BlockRaw" + }, + "ids": { + "items": { + "properties": { + "account": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "hash": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "lt": { + "format": "uint64", + "type": "integer" + }, + "mode": { + "example": 0, + "format": "uint32", + "type": "integer" + } + }, + "required": [ + "mode" + ], + "type": "object" + }, + "type": "array" + }, + "incomplete": { + "example": true, + "type": "boolean" + }, + "proof": { + "example": "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85", + "type": "string" + }, + "req_count": { + "example": 100, + "format": "uint32", + "type": "integer" + } + }, + "required": [ + "id", + "req_count", + "incomplete", + "ids", + "proof" + ], + "type": "object" + } + } + }, + "description": "list block transactions" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, + "/v2/liteserver/send_message": { + "post": { + "description": "Send message", + "operationId": "sendMessageLiteServer", + "requestBody": { + "$ref": "#/components/requestBodies/LiteServerSendMessageRequest" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "code": { + "example": 200, + "format": "uint32", + "type": "integer" + } + }, + "required": [ + "code" + ], + "type": "object" + } + } + }, + "description": "code" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorizedError" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "Lite Server" + ] + } + }, "/v2/nfts/_bulk": { "post": { "description": "Get NFT items by their addresses", diff --git a/api/openapi.yml b/api/openapi.yml index 95fd3bc2..238832a6 100644 --- a/api/openapi.yml +++ b/api/openapi.yml @@ -1532,6 +1532,668 @@ paths: $ref: '#/components/responses/InternalError' + /v2/liteserver/get_masterchain_info: + get: + description: "Get masterchain info" + operationId: getMasterchainInfoLiteServer + tags: + - Lite Server + responses: + '200': + description: "masterchain info" + content: + application/json: + schema: + type: object + required: + - last + - state_root_hash + - init + properties: + last: + $ref: '#/components/schemas/BlockRaw' + state_root_hash: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + init: + $ref: '#/components/schemas/InitStateRaw' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/get_masterchain_info_ext: + get: + description: "Get masterchain info ext" + operationId: getMasterchainInfoExtLiteServer + tags: + - Lite Server + parameters: + - $ref: '#/components/parameters/modeQuery' + responses: + '200': + description: "masterchain info ext" + content: + application/json: + schema: + type: object + required: + - mode + - version + - capabilities + - last + - last_utime + - now + - state_root_hash + - init + properties: + mode: + type: integer + format: uint32 + example: 0 + version: + type: integer + format: uint32 + example: 257 + capabilities: + type: integer + format: uint64 + example: 7 + last: + $ref: '#/components/schemas/BlockRaw' + last_utime: + type: integer + format: uint32 + example: 1687938199 + now: + type: integer + format: uint32 + example: 1687938204 + state_root_hash: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + init: + $ref: '#/components/schemas/InitStateRaw' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/get_time: + get: + description: "Get time" + operationId: getTimeLiteServer + tags: + - Lite Server + responses: + '200': + description: "time" + content: + application/json: + schema: + type: object + required: + - time + properties: + time: + type: integer + format: uint32 + example: 1687146728 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/get_block/{block_id}: + get: + description: "Get block" + operationId: getBlockLiteServer + tags: + - Lite Server + parameters: + - $ref: '#/components/parameters/blockIdExtParameter' + responses: + '200': + description: "block" + content: + application/json: + schema: + type: object + required: + - id + - data + properties: + id: + $ref: '#/components/schemas/BlockRaw' + data: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/get_state/{block_id}: + get: + description: "Get block state" + operationId: getStateLiteServer + tags: + - Lite Server + parameters: + - $ref: '#/components/parameters/blockIdExtParameter' + responses: + '200': + description: "state" + content: + application/json: + schema: + type: object + required: + - id + - root_hash + - file_hash + - data + properties: + id: + $ref: '#/components/schemas/BlockRaw' + root_hash: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + file_hash: + type: string + example: A6A0BD6608672B11B79538A50B2204E748305C12AA0DED9C16CF0006CE3AF8DB + data: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/get_block_header/{block_id}: + get: + description: "Get block header" + operationId: getBlockHeaderLiteServer + tags: + - Lite Server + parameters: + - $ref: '#/components/parameters/blockIdExtParameter' + - $ref: '#/components/parameters/modeQuery' + responses: + '200': + description: "block header" + content: + application/json: + schema: + type: object + required: + - id + - mode + - header_proof + properties: + id: + $ref: '#/components/schemas/BlockRaw' + mode: + type: integer + format: uint32 + example: 0 + header_proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/send_message: + post: + description: "Send message" + operationId: sendMessageLiteServer + tags: + - Lite Server + requestBody: + $ref: "#/components/requestBodies/LiteServerSendMessageRequest" + responses: + '200': + description: "code" + content: + application/json: + schema: + type: object + required: + - code + properties: + code: + type: integer + format: uint32 + example: 200 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/get_account_state/{account_id}: + get: + description: "Get account state" + operationId: getAccountStateLiteServer + tags: + - Lite Server + parameters: + - $ref: '#/components/parameters/accountIdParameter' + responses: + '200': + description: "account state" + content: + application/json: + schema: + type: object + required: + - id + - shardblk + - shard_proof + - proof + - state + properties: + id: + $ref: '#/components/schemas/BlockRaw' + shardblk: + $ref: '#/components/schemas/BlockRaw' + shard_proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + state: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/get_shard_info/{block_id}: + get: + description: "Get shard info" + operationId: getShardInfoLiteServer + tags: + - Lite Server + parameters: + - $ref: '#/components/parameters/blockIdExtParameter' + - $ref: '#/components/parameters/workchainQuery' + - $ref: '#/components/parameters/shardQuery' + - $ref: '#/components/parameters/exactQuery' + responses: + '200': + description: "shard info" + content: + application/json: + schema: + type: object + required: + - id + - shardblk + - shard_proof + - shard_descr + properties: + id: + $ref: '#/components/schemas/BlockRaw' + shardblk: + $ref: '#/components/schemas/BlockRaw' + shard_proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + shard_descr: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/get_all_shards_info/{block_id}: + get: + description: "Get all shards info" + operationId: getAllShardsInfoLiteServer + tags: + - Lite Server + parameters: + - $ref: '#/components/parameters/blockIdExtParameter' + responses: + '200': + description: "shards info" + content: + application/json: + schema: + type: object + required: + - id + - proof + - data + properties: + id: + $ref: '#/components/schemas/BlockRaw' + proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + data: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/get_transactions/{account_id}: + get: + description: "Get transactions" + operationId: getTransactionsLiteServer + tags: + - Lite Server + parameters: + - $ref: '#/components/parameters/accountIdParameter' + - $ref: '#/components/parameters/countQuery' + - $ref: '#/components/parameters/ltMustQuery' + - $ref: '#/components/parameters/hashQuery' + responses: + '200': + description: "transactions" + content: + application/json: + schema: + type: object + required: + - ids + - transactions + properties: + ids: + type: array + items: + $ref: '#/components/schemas/BlockRaw' + transactions: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/list_block_transactions/{block_id}: + get: + description: "Get list block transactions" + operationId: getListBlockTransactionsLiteServer + tags: + - Lite Server + parameters: + - $ref: '#/components/parameters/blockIdExtParameter' + - $ref: '#/components/parameters/modeQuery' + - $ref: '#/components/parameters/countQuery' + - $ref: '#/components/parameters/accountIdQuery' + - $ref: '#/components/parameters/ltQuery' + responses: + '200': + description: "list block transactions" + content: + application/json: + schema: + type: object + required: + - id + - req_count + - incomplete + - ids + - proof + properties: + id: + $ref: '#/components/schemas/BlockRaw' + req_count: + type: integer + format: uint32 + example: 100 + incomplete: + type: boolean + example: true + ids: + type: array + items: + type: object + required: + - mode + properties: + mode: + type: integer + format: uint32 + example: 0 + account: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + lt: + type: integer + format: uint64 + hash: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/get_block_proof: + get: + description: "Get block proof" + operationId: getBlockProofLiteServer + tags: + - Lite Server + parameters: + - $ref: '#/components/parameters/knownBlockIdExtQuery' + - $ref: '#/components/parameters/targetBlockIdExtQuery' + - $ref: '#/components/parameters/modeQuery' + responses: + '200': + description: "proof" + content: + application/json: + schema: + type: object + required: + - complete + - from + - to + - steps + properties: + complete: + type: boolean + example: true + from: + $ref: '#/components/schemas/BlockRaw' + to: + $ref: '#/components/schemas/BlockRaw' + steps: + type: array + items: + type: object + required: + - lite_server_block_link_back + - lite_server_block_link_forward + properties: + lite_server_block_link_back: + type: object + required: + - to_key_block + - from + - to + - dest_proof + - proof + - state_proof + properties: + to_key_block: + type: boolean + example: false + from: + $ref: '#/components/schemas/BlockRaw' + to: + $ref: '#/components/schemas/BlockRaw' + dest_proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + state_proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + lite_server_block_link_forward: + type: object + required: + - to_key_block + - from + - to + - dest_proof + - config_proof + - signatures + properties: + to_key_block: + type: boolean + example: false + from: + $ref: '#/components/schemas/BlockRaw' + to: + $ref: '#/components/schemas/BlockRaw' + dest_proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + config_proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + signatures: + type: object + required: + - validator_set_hash + - catchain_seqno + - signatures + properties: + validator_set_hash: + type: integer + format: uint32 + catchain_seqno: + type: integer + format: uint32 + signatures: + type: array + items: + type: object + required: + - node_id_short + - signature + properties: + node_id_short: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + signature: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/get_config_all/{block_id}: + get: + description: "Get config all" + operationId: getConfigAllLiteServer + tags: + - Lite Server + parameters: + - $ref: '#/components/parameters/blockIdExtParameter' + - $ref: '#/components/parameters/modeQuery' + responses: + '200': + description: "config" + content: + application/json: + schema: + type: object + required: + - mode + - id + - state_proof + - config_proof + properties: + mode: + type: integer + format: uint32 + example: 0 + id: + $ref: '#/components/schemas/BlockRaw' + state_proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + config_proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + /v2/liteserver/get_shard_block_proof/{block_id}: + get: + description: "Get shard block proof" + operationId: getShardBlockProofLiteServer + tags: + - Lite Server + parameters: + - $ref: '#/components/parameters/blockIdExtParameter' + responses: + '200': + description: "shard" + content: + application/json: + schema: + type: object + required: + - masterchain_id + - links + properties: + masterchain_id: + $ref: '#/components/schemas/BlockRaw' + links: + type: array + items: + type: object + required: + - id + - proof + properties: + id: + $ref: '#/components/schemas/BlockRaw' + proof: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/UnauthorizedError' + '500': + $ref: '#/components/responses/InternalError' + components: parameters: blockIdParameter: @@ -1542,6 +2204,14 @@ components: schema: type: string example: (-1,8000000000000000,4234234) + blockIdExtParameter: + in: path + name: block_id + required: true + description: "block ID: (workchain,shard,seqno,root_hash,file_hash)" + schema: + type: string + example: (-1,8000000000000000,4234234,3E575DAB1D25...90D8,47192E5C46C...BB29) transactionIdParameter: in: path name: transaction_id @@ -1672,6 +2342,100 @@ components: schema: type: string example: "0:06d811f426598591b32b2c49f29f66c821368e4acb1de16762b04e0174532465" + modeQuery: + in: query + name: mode + required: true + description: "mode" + schema: + type: integer + format: uint32 + example: 0 + countQuery: + in: query + name: count + required: true + description: "count" + schema: + type: integer + format: uint32 + example: 100 + knownBlockIdExtQuery: + in: query + name: known_block + required: true + description: "known block: (workchain,shard,seqno,root_hash,file_hash)" + schema: + type: string + example: (-1,8000000000000000,4234234,3E575DAB1D25...90D8,47192E5C46C...BB29) + targetBlockIdExtQuery: + in: query + name: target_block + required: false + description: "target block: (workchain,shard,seqno,root_hash,file_hash)" + schema: + type: string + example: (-1,8000000000000000,4234234,3E575DAB1D25...90D8,47192E5C46C...BB29) + ltMustQuery: + in: query + name: lt + required: true + description: "lt" + schema: + type: integer + format: uint64 + example: 23814011000000 + ltQuery: + in: query + name: lt + description: "lt" + schema: + type: integer + format: uint64 + example: 23814011000000 + hashQuery: + in: query + name: hash + required: true + description: "hash" + schema: + type: string + example: "131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85" + workchainQuery: + in: query + name: workchain + required: true + description: "workchain" + schema: + type: integer + format: uint32 + example: 1 + shardQuery: + in: query + name: shard + required: true + description: "shard" + schema: + type: integer + format: uint64 + example: 1 + exactQuery: + in: query + name: exact + required: true + description: "exact" + schema: + type: boolean + example: false + accountIdQuery: + in: query + name: account_id + required: false + description: account ID + explode: false + schema: + type: string + example: 0:97264395BD65A255A429B11326C84128B7D70FFED7949ABAE3036D506BA38621 requestBodies: MethodParameters: @@ -1680,7 +2444,6 @@ components: application/json: schema: type: object - Boc: description: bag-of-cells serialized to base64 required: true @@ -1771,6 +2534,18 @@ components: properties: state_init: type: string + LiteServerSendMessageRequest: + description: "Data that is expected" + required: true + content: + application/json: + schema: + type: object + required: + - body + properties: + body: + type: string schemas: Error: @@ -3790,7 +4565,51 @@ components: seqno: type: integer format: uint32 - + BlockRaw: + type: object + required: + - workchain + - shard + - seqno + - root_hash + - file_hash + properties: + workchain: + type: integer + example: 4294967295 + format: uint32 + shard: + type: integer + example: 9223372036854775808 + format: uint64 + seqno: + type: integer + example: 30699640 + format: uint32 + root_hash: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + file_hash: + type: string + example: A6A0BD6608672B11B79538A50B2204E748305C12AA0DED9C16CF0006CE3AF8DB + InitStateRaw: + type: object + required: + - workchain + - root_hash + - file_hash + properties: + workchain: + type: integer + example: 4294967295 + format: uint32 + root_hash: + type: string + example: 131D0C65055F04E9C19D687B51BC70F952FD9CA6F02C2801D3B89964A779DF85 + file_hash: + type: string + example: A6A0BD6608672B11B79538A50B2204E748305C12AA0DED9C16CF0006CE3AF8DB + responses: NotFound: description: The specified resource was not found diff --git a/go.mod b/go.mod index 789c6ba8..ba8b51de 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( go.opentelemetry.io/otel/trace v1.11.1 go.uber.org/multierr v1.9.0 go.uber.org/zap v1.24.0 - golang.org/x/exp v0.0.0-20230116083435-1de6713980de + golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 golang.org/x/text v0.9.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 63fd6e48..f5770af1 100644 --- a/go.sum +++ b/go.sum @@ -318,6 +318,8 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20230116083435-1de6713980de h1:DBWn//IJw30uYCgERoxCg84hWtA97F4wMiKOIh00Uf0= golang.org/x/exp v0.0.0-20230116083435-1de6713980de/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc= +golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= diff --git a/pkg/api/blockchain_converters.go b/pkg/api/blockchain_converters.go index f44228ae..bca46ea3 100644 --- a/pkg/api/blockchain_converters.go +++ b/pkg/api/blockchain_converters.go @@ -22,6 +22,26 @@ func blockIdFromString(s string) (tongo.BlockID, error) { return id, nil } +func blockIdExtFromString(s string) (tongo.BlockIDExt, error) { + var ( + id tongo.BlockIDExt + rootHash, fileHash []byte + ) + _, err := fmt.Sscanf(s, "(%d,%x,%d,%x,%x)", &id.Workchain, &id.Shard, &id.Seqno, &rootHash, &fileHash) + if err != nil { + return tongo.BlockIDExt{}, err + } + err = id.RootHash.FromBytes(rootHash) + if err != nil { + return tongo.BlockIDExt{}, err + } + err = id.FileHash.FromBytes(fileHash) + if err != nil { + return tongo.BlockIDExt{}, err + } + return id, nil +} + func convertBlockHeader(b core.BlockHeader) oas.Block { res := oas.Block{ WorkchainID: b.Workchain, diff --git a/pkg/api/interfaces.go b/pkg/api/interfaces.go index 6b0793ae..ab7ba4ef 100644 --- a/pkg/api/interfaces.go +++ b/pkg/api/interfaces.go @@ -7,6 +7,7 @@ import ( "github.com/tonkeeper/tongo" "github.com/tonkeeper/tongo/abi" + "github.com/tonkeeper/tongo/liteclient" "github.com/tonkeeper/tongo/tep64" "github.com/tonkeeper/tongo/tlb" @@ -78,6 +79,26 @@ type storage interface { GetLastConfig() (tlb.ConfigParams, error) GetSeqno(ctx context.Context, account tongo.AccountID) (uint32, error) + + liteStorageRaw +} + +type liteStorageRaw interface { + GetMasterchainInfoRaw(ctx context.Context) (liteclient.LiteServerMasterchainInfoC, error) + GetMasterchainInfoExtRaw(ctx context.Context, mode uint32) (liteclient.LiteServerMasterchainInfoExtC, error) + GetTimeRaw(ctx context.Context) (uint32, error) + GetBlockRaw(ctx context.Context, id tongo.BlockIDExt) (liteclient.LiteServerBlockDataC, error) + GetStateRaw(ctx context.Context, id tongo.BlockIDExt) (liteclient.LiteServerBlockStateC, error) + GetBlockHeaderRaw(ctx context.Context, id tongo.BlockIDExt, mode uint32) (liteclient.LiteServerBlockHeaderC, error) + SendMessageRaw(ctx context.Context, payload []byte) (uint32, error) + GetAccountStateRaw(ctx context.Context, accountID tongo.AccountID) (liteclient.LiteServerAccountStateC, error) + GetShardInfoRaw(ctx context.Context, id tongo.BlockIDExt, workchain uint32, shard uint64, exact bool) (liteclient.LiteServerShardInfoC, error) + GetShardsAllInfo(ctx context.Context, id tongo.BlockIDExt) (liteclient.LiteServerAllShardsInfoC, error) + GetTransactionsRaw(ctx context.Context, count uint32, accountID tongo.AccountID, lt uint64, hash tongo.Bits256) (liteclient.LiteServerTransactionListC, error) + ListBlockTransactionsRaw(ctx context.Context, id tongo.BlockIDExt, mode, count uint32, after *liteclient.LiteServerTransactionId3C) (liteclient.LiteServerBlockTransactionsC, error) + GetBlockProofRaw(ctx context.Context, knownBlock tongo.BlockIDExt, targetBlock *tongo.BlockIDExt) (liteclient.LiteServerPartialBlockProofC, error) + GetConfigAllRaw(ctx context.Context, mode uint32, id tongo.BlockIDExt) (liteclient.LiteServerConfigInfoC, error) + GetShardBlockProofRaw(ctx context.Context, id tongo.BlockIDExt) (liteclient.LiteServerShardBlockProofC, error) } // chainState provides current blockchain state which change very rarely or slow like staking APY income diff --git a/pkg/api/liteserver_converters.go b/pkg/api/liteserver_converters.go new file mode 100644 index 00000000..e7f57548 --- /dev/null +++ b/pkg/api/liteserver_converters.go @@ -0,0 +1,421 @@ +package api + +import ( + "encoding/hex" + + "github.com/tonkeeper/opentonapi/pkg/oas" + "github.com/tonkeeper/tongo/liteclient" +) + +func toJson(target *string, source interface{ MarshalJSON() ([]byte, error) }) error { + bytes, err := source.MarshalJSON() + *target = hex.EncodeToString(bytes) + return err +} + +func errChain(mappings ...error) error { + for i := range mappings { + if mappings[i] != nil { + return mappings[i] + } + } + return nil +} + +func convertMasterchainInfo(info liteclient.LiteServerMasterchainInfoC) (*oas.GetMasterchainInfoLiteServerOK, error) { + convertedInfo := oas.GetMasterchainInfoLiteServerOK{ + Last: oas.BlockRaw{ + Workchain: info.Last.Workchain, + Shard: info.Last.Shard, + Seqno: info.Last.Seqno, + }, + Init: oas.InitStateRaw{ + Workchain: info.Init.Workchain, + }, + } + err := errChain( + toJson(&convertedInfo.Last.RootHash, info.Last.RootHash), + toJson(&convertedInfo.Last.FileHash, info.Last.FileHash), + toJson(&convertedInfo.StateRootHash, info.StateRootHash), + toJson(&convertedInfo.Init.RootHash, info.Init.RootHash), + toJson(&convertedInfo.Init.FileHash, info.Init.FileHash), + ) + if err != nil { + return nil, err + } + return &convertedInfo, nil +} + +func convertMasterchainInfoExt(info liteclient.LiteServerMasterchainInfoExtC) (*oas.GetMasterchainInfoExtLiteServerOK, error) { + convertedInfo := oas.GetMasterchainInfoExtLiteServerOK{ + Mode: info.Mode, + Version: info.Version, + Capabilities: info.Capabilities, + Last: oas.BlockRaw{ + Workchain: info.Last.Workchain, + Shard: info.Last.Shard, + Seqno: info.Last.Seqno, + }, + LastUtime: info.LastUtime, + Now: info.Now, + Init: oas.InitStateRaw{ + Workchain: info.Init.Workchain, + }, + } + err := errChain( + toJson(&convertedInfo.Last.RootHash, info.Last.RootHash), + toJson(&convertedInfo.Last.FileHash, info.Last.FileHash), + toJson(&convertedInfo.StateRootHash, info.StateRootHash), + toJson(&convertedInfo.Init.RootHash, info.Init.RootHash), + toJson(&convertedInfo.Init.FileHash, info.Init.FileHash), + ) + if err != nil { + return nil, err + } + return &convertedInfo, nil +} + +func convertBlock(block liteclient.LiteServerBlockDataC) (*oas.GetBlockLiteServerOK, error) { + convertedBlock := oas.GetBlockLiteServerOK{ + ID: oas.BlockRaw{ + Workchain: block.Id.Workchain, + Shard: block.Id.Shard, + Seqno: block.Id.Seqno, + }, + Data: hex.EncodeToString(block.Data), + } + err := errChain( + toJson(&convertedBlock.ID.RootHash, block.Id.RootHash), + toJson(&convertedBlock.ID.FileHash, block.Id.FileHash), + ) + if err != nil { + return nil, err + } + return &convertedBlock, nil +} + +func convertState(state liteclient.LiteServerBlockStateC) (*oas.GetStateLiteServerOK, error) { + convertedState := oas.GetStateLiteServerOK{ + ID: oas.BlockRaw{ + Workchain: state.Id.Workchain, + Shard: state.Id.Shard, + Seqno: state.Id.Seqno, + }, + Data: hex.EncodeToString(state.Data), + } + err := errChain( + toJson(&convertedState.ID.RootHash, state.Id.RootHash), + toJson(&convertedState.ID.FileHash, state.Id.FileHash), + toJson(&convertedState.RootHash, state.RootHash), + toJson(&convertedState.FileHash, state.FileHash), + ) + if err != nil { + return nil, err + } + return &convertedState, nil +} + +func convertBlockHeaderRaw(blockHeader liteclient.LiteServerBlockHeaderC) (*oas.GetBlockHeaderLiteServerOK, error) { + convertedBlockHeader := oas.GetBlockHeaderLiteServerOK{ + ID: oas.BlockRaw{ + Workchain: blockHeader.Id.Workchain, + Shard: blockHeader.Id.Shard, + Seqno: blockHeader.Id.Seqno, + }, + Mode: blockHeader.Mode, + HeaderProof: hex.EncodeToString(blockHeader.HeaderProof), + } + err := errChain( + toJson(&convertedBlockHeader.ID.RootHash, blockHeader.Id.RootHash), + toJson(&convertedBlockHeader.ID.FileHash, blockHeader.Id.FileHash), + ) + if err != nil { + return nil, err + } + return &convertedBlockHeader, nil +} + +func convertAccountState(accountState liteclient.LiteServerAccountStateC) (*oas.GetAccountStateLiteServerOK, error) { + convertedAccountState := oas.GetAccountStateLiteServerOK{ + ID: oas.BlockRaw{ + Workchain: accountState.Id.Workchain, + Shard: accountState.Id.Shard, + Seqno: accountState.Id.Seqno, + }, + Shardblk: oas.BlockRaw{ + Workchain: accountState.Shardblk.Workchain, + Shard: accountState.Shardblk.Shard, + Seqno: accountState.Shardblk.Seqno, + }, + ShardProof: hex.EncodeToString(accountState.ShardProof), + Proof: hex.EncodeToString(accountState.Proof), + State: hex.EncodeToString(accountState.State), + } + err := errChain( + toJson(&convertedAccountState.ID.RootHash, accountState.Id.RootHash), + toJson(&convertedAccountState.ID.FileHash, accountState.Id.FileHash), + toJson(&convertedAccountState.Shardblk.RootHash, accountState.Shardblk.RootHash), + toJson(&convertedAccountState.Shardblk.FileHash, accountState.Shardblk.FileHash), + ) + if err != nil { + return nil, err + } + return &convertedAccountState, nil +} + +func convertShardInfo(shardInfo liteclient.LiteServerShardInfoC) (*oas.GetShardInfoLiteServerOK, error) { + convertedShardInfo := oas.GetShardInfoLiteServerOK{ + ID: oas.BlockRaw{ + Workchain: shardInfo.Id.Workchain, + Shard: shardInfo.Id.Shard, + Seqno: shardInfo.Id.Seqno, + }, + Shardblk: oas.BlockRaw{ + Workchain: shardInfo.Shardblk.Workchain, + Shard: shardInfo.Shardblk.Shard, + Seqno: shardInfo.Shardblk.Seqno, + }, + ShardProof: hex.EncodeToString(shardInfo.ShardProof), + ShardDescr: hex.EncodeToString(shardInfo.ShardDescr), + } + err := errChain( + toJson(&convertedShardInfo.ID.RootHash, shardInfo.Id.RootHash), + toJson(&convertedShardInfo.ID.FileHash, shardInfo.Id.FileHash), + toJson(&convertedShardInfo.Shardblk.RootHash, shardInfo.Shardblk.RootHash), + toJson(&convertedShardInfo.Shardblk.FileHash, shardInfo.Shardblk.FileHash), + ) + if err != nil { + return nil, err + } + return &convertedShardInfo, nil +} + +func convertShardsAllInfo(shardsAllInfo liteclient.LiteServerAllShardsInfoC) (*oas.GetAllShardsInfoLiteServerOK, error) { + convertedShardsAllInfo := oas.GetAllShardsInfoLiteServerOK{ + ID: oas.BlockRaw{ + Workchain: shardsAllInfo.Id.Workchain, + Shard: shardsAllInfo.Id.Shard, + Seqno: shardsAllInfo.Id.Seqno, + }, + Proof: hex.EncodeToString(shardsAllInfo.Proof), + Data: hex.EncodeToString(shardsAllInfo.Data), + } + err := errChain( + toJson(&convertedShardsAllInfo.ID.RootHash, shardsAllInfo.Id.RootHash), + toJson(&convertedShardsAllInfo.ID.FileHash, shardsAllInfo.Id.FileHash), + ) + if err != nil { + return nil, err + } + return &convertedShardsAllInfo, nil +} + +func convertTransactions(txs liteclient.LiteServerTransactionListC) (*oas.GetTransactionsLiteServerOK, error) { + convertedTransactions := oas.GetTransactionsLiteServerOK{ + Transactions: hex.EncodeToString(txs.Transactions), + } + for _, tx := range txs.Ids { + blockRaw := oas.BlockRaw{ + Workchain: tx.Workchain, + Shard: tx.Shard, + Seqno: tx.Seqno, + } + err := errChain( + toJson(&blockRaw.RootHash, tx.RootHash), + toJson(&blockRaw.FileHash, tx.FileHash), + ) + if err != nil { + return nil, err + } + convertedTransactions.Ids = append(convertedTransactions.Ids, blockRaw) + } + return &convertedTransactions, nil +} + +func convertListBlockTxs(txs liteclient.LiteServerBlockTransactionsC) (*oas.GetListBlockTransactionsLiteServerOK, error) { + convertedTxs := &oas.GetListBlockTransactionsLiteServerOK{ + ID: oas.BlockRaw{ + Workchain: txs.Id.Workchain, + Shard: txs.Id.Shard, + Seqno: txs.Id.Seqno, + }, + ReqCount: txs.ReqCount, + Incomplete: txs.Incomplete, + Proof: hex.EncodeToString(txs.Proof), + } + err := errChain( + toJson(&convertedTxs.ID.RootHash, txs.Id.RootHash), + toJson(&convertedTxs.ID.FileHash, txs.Id.FileHash), + ) + if err != nil { + return nil, err + } + for _, tx := range txs.Ids { + item := oas.GetListBlockTransactionsLiteServerOKIdsItem{Mode: tx.Mode} + if tx.Account != nil { + err = errChain(toJson(&item.Account.Value, tx.Account)) + if err != nil { + return nil, err + } + } + if tx.Lt != nil { + item.Lt.Value = *tx.Lt + } + if tx.Hash != nil { + err = errChain(toJson(&item.Hash.Value, tx.Hash)) + if err != nil { + return nil, err + } + } + convertedTxs.Ids = append(convertedTxs.Ids, item) + } + return convertedTxs, nil +} + +func convertBlockProof(blockProof liteclient.LiteServerPartialBlockProofC) (*oas.GetBlockProofLiteServerOK, error) { + convertedBlockProof := &oas.GetBlockProofLiteServerOK{ + Complete: blockProof.Complete, + From: oas.BlockRaw{ + Workchain: blockProof.From.Workchain, + Shard: blockProof.From.Shard, + Seqno: blockProof.From.Seqno, + }, + To: oas.BlockRaw{ + Workchain: blockProof.To.Workchain, + Shard: blockProof.To.Shard, + Seqno: blockProof.To.Seqno, + }, + } + err := errChain( + toJson(&convertedBlockProof.From.RootHash, blockProof.From.RootHash), + toJson(&convertedBlockProof.From.FileHash, blockProof.From.FileHash), + toJson(&convertedBlockProof.To.RootHash, blockProof.To.RootHash), + toJson(&convertedBlockProof.To.FileHash, blockProof.To.FileHash), + ) + if err != nil { + return nil, err + } + for _, step := range blockProof.Steps { + signatures := []oas.GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem{} + for _, signature := range step.LiteServerBlockLinkForward.Signatures.Signatures { + item := oas.GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem{ + Signature: hex.EncodeToString(signature.Signature), + } + err = errChain(toJson(&item.NodeIDShort, signature.NodeIdShort)) + if err != nil { + return nil, err + } + signatures = append(signatures, item) + } + item := oas.GetBlockProofLiteServerOKStepsItem{ + LiteServerBlockLinkBack: oas.GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack{ + ToKeyBlock: step.LiteServerBlockLinkBack.ToKeyBlock, + From: oas.BlockRaw{ + Workchain: step.LiteServerBlockLinkBack.From.Workchain, + Shard: step.LiteServerBlockLinkBack.From.Shard, + Seqno: step.LiteServerBlockLinkBack.From.Seqno, + }, + To: oas.BlockRaw{ + Workchain: step.LiteServerBlockLinkBack.To.Workchain, + Shard: step.LiteServerBlockLinkBack.To.Shard, + Seqno: step.LiteServerBlockLinkBack.To.Seqno, + }, + DestProof: hex.EncodeToString(step.LiteServerBlockLinkBack.DestProof), + Proof: hex.EncodeToString(step.LiteServerBlockLinkBack.Proof), + StateProof: hex.EncodeToString(step.LiteServerBlockLinkBack.StateProof), + }, + LiteServerBlockLinkForward: oas.GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward{ + ToKeyBlock: step.LiteServerBlockLinkForward.ToKeyBlock, + From: oas.BlockRaw{ + Workchain: step.LiteServerBlockLinkForward.From.Workchain, + Shard: step.LiteServerBlockLinkForward.From.Shard, + Seqno: step.LiteServerBlockLinkForward.From.Seqno, + }, + To: oas.BlockRaw{ + Workchain: step.LiteServerBlockLinkForward.To.Workchain, + Shard: step.LiteServerBlockLinkForward.To.Shard, + Seqno: step.LiteServerBlockLinkForward.To.Seqno, + }, + DestProof: hex.EncodeToString(step.LiteServerBlockLinkForward.DestProof), + ConfigProof: hex.EncodeToString(step.LiteServerBlockLinkForward.ConfigProof), + Signatures: oas.GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures{ + ValidatorSetHash: step.LiteServerBlockLinkForward.Signatures.ValidatorSetHash, + CatchainSeqno: step.LiteServerBlockLinkForward.Signatures.CatchainSeqno, + Signatures: signatures, + }, + }, + } + err = errChain( + toJson(&item.LiteServerBlockLinkBack.From.RootHash, step.LiteServerBlockLinkBack.From.RootHash), + toJson(&item.LiteServerBlockLinkBack.From.FileHash, step.LiteServerBlockLinkBack.From.FileHash), + toJson(&item.LiteServerBlockLinkBack.To.RootHash, step.LiteServerBlockLinkBack.To.RootHash), + toJson(&item.LiteServerBlockLinkBack.To.FileHash, step.LiteServerBlockLinkBack.To.FileHash), + toJson(&item.LiteServerBlockLinkForward.From.RootHash, step.LiteServerBlockLinkForward.From.RootHash), + toJson(&item.LiteServerBlockLinkForward.From.FileHash, step.LiteServerBlockLinkForward.From.FileHash), + toJson(&item.LiteServerBlockLinkForward.To.RootHash, step.LiteServerBlockLinkForward.To.RootHash), + toJson(&item.LiteServerBlockLinkForward.To.FileHash, step.LiteServerBlockLinkForward.To.FileHash), + ) + if err != nil { + return nil, err + } + convertedBlockProof.Steps = append(convertedBlockProof.Steps, item) + } + return convertedBlockProof, nil +} + +func convertRawConfig(config liteclient.LiteServerConfigInfoC) (*oas.GetConfigAllLiteServerOK, error) { + convertedConfig := oas.GetConfigAllLiteServerOK{ + Mode: config.Mode, + ID: oas.BlockRaw{ + Workchain: config.Id.Workchain, + Shard: config.Id.Shard, + Seqno: config.Id.Seqno, + }, + StateProof: hex.EncodeToString(config.StateProof), + ConfigProof: hex.EncodeToString(config.ConfigProof), + } + err := errChain( + toJson(&convertedConfig.ID.RootHash, config.Id.RootHash), + toJson(&convertedConfig.ID.FileHash, config.Id.FileHash), + ) + if err != nil { + return nil, err + } + return &convertedConfig, nil +} + +func convertShardBlockProof(shardBlockProof liteclient.LiteServerShardBlockProofC) (*oas.GetShardBlockProofLiteServerOK, error) { + convertedShardBlockProof := oas.GetShardBlockProofLiteServerOK{ + MasterchainID: oas.BlockRaw{ + Workchain: shardBlockProof.MasterchainId.Workchain, + Shard: shardBlockProof.MasterchainId.Shard, + Seqno: shardBlockProof.MasterchainId.Seqno, + }, + } + err := errChain( + toJson(&convertedShardBlockProof.MasterchainID.RootHash, shardBlockProof.MasterchainId.RootHash), + toJson(&convertedShardBlockProof.MasterchainID.FileHash, shardBlockProof.MasterchainId.FileHash), + ) + if err != nil { + return nil, err + } + for _, link := range shardBlockProof.Links { + shardBlock := oas.GetShardBlockProofLiteServerOKLinksItem{ + ID: oas.BlockRaw{ + Workchain: link.Id.Workchain, + Shard: link.Id.Shard, + Seqno: link.Id.Seqno, + }, + Proof: hex.EncodeToString(link.Proof), + } + err = errChain( + toJson(&shardBlock.ID.RootHash, link.Id.RootHash), + toJson(&shardBlock.ID.FileHash, link.Id.FileHash), + ) + if err != nil { + return nil, err + } + convertedShardBlockProof.Links = append(convertedShardBlockProof.Links, shardBlock) + } + return &convertedShardBlockProof, nil +} diff --git a/pkg/api/liteserver_handlers.go b/pkg/api/liteserver_handlers.go new file mode 100644 index 00000000..5cb01b29 --- /dev/null +++ b/pkg/api/liteserver_handlers.go @@ -0,0 +1,251 @@ +package api + +import ( + "context" + "encoding/json" + + "github.com/tonkeeper/opentonapi/pkg/oas" + "github.com/tonkeeper/tongo" + "github.com/tonkeeper/tongo/liteclient" +) + +func (h Handler) GetMasterchainInfoLiteServer(ctx context.Context) (res oas.GetMasterchainInfoLiteServerRes, err error) { + info, err := h.storage.GetMasterchainInfoRaw(ctx) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + resp, err := convertMasterchainInfo(info) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} + +func (h Handler) GetMasterchainInfoExtLiteServer(ctx context.Context, params oas.GetMasterchainInfoExtLiteServerParams) (oas.GetMasterchainInfoExtLiteServerRes, error) { + info, err := h.storage.GetMasterchainInfoExtRaw(ctx, params.Mode) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + resp, err := convertMasterchainInfoExt(info) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} + +func (h Handler) GetTimeLiteServer(ctx context.Context) (res oas.GetTimeLiteServerRes, err error) { + time, err := h.storage.GetTimeRaw(ctx) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return &oas.GetTimeLiteServerOK{Time: time}, nil +} + +func (h Handler) GetBlockLiteServer(ctx context.Context, params oas.GetBlockLiteServerParams) (res oas.GetBlockLiteServerRes, err error) { + id, err := blockIdExtFromString(params.BlockID) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + block, err := h.storage.GetBlockRaw(ctx, id) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + resp, err := convertBlock(block) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} + +func (h Handler) GetStateLiteServer(ctx context.Context, params oas.GetStateLiteServerParams) (res oas.GetStateLiteServerRes, err error) { + id, err := blockIdExtFromString(params.BlockID) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + state, err := h.storage.GetStateRaw(ctx, id) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + resp, err := convertState(state) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} + +func (h Handler) GetBlockHeaderLiteServer(ctx context.Context, params oas.GetBlockHeaderLiteServerParams) (res oas.GetBlockHeaderLiteServerRes, err error) { + id, err := blockIdExtFromString(params.BlockID) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + blockHeader, err := h.storage.GetBlockHeaderRaw(ctx, id, params.Mode) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + resp, err := convertBlockHeaderRaw(blockHeader) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} + +func (h Handler) SendMessageLiteServer(ctx context.Context, request oas.SendMessageLiteServerReq) (res oas.SendMessageLiteServerRes, err error) { + payload, err := json.Marshal(request.Body) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + code, err := h.storage.SendMessageRaw(ctx, payload) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + return &oas.SendMessageLiteServerOK{Code: code}, nil +} + +func (h Handler) GetAccountStateLiteServer(ctx context.Context, params oas.GetAccountStateLiteServerParams) (res oas.GetAccountStateLiteServerRes, err error) { + accountID, err := tongo.ParseAccountID(params.AccountID) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + accountState, err := h.storage.GetAccountStateRaw(ctx, accountID) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + resp, err := convertAccountState(accountState) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} + +func (h Handler) GetShardInfoLiteServer(ctx context.Context, params oas.GetShardInfoLiteServerParams) (res oas.GetShardInfoLiteServerRes, err error) { + blockID, err := blockIdExtFromString(params.BlockID) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + shardInfo, err := h.storage.GetShardInfoRaw(ctx, blockID, params.Workchain, params.Shard, params.Exact) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + resp, err := convertShardInfo(shardInfo) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} + +func (h Handler) GetAllShardsInfoLiteServer(ctx context.Context, params oas.GetAllShardsInfoLiteServerParams) (res oas.GetAllShardsInfoLiteServerRes, err error) { + blockID, err := blockIdExtFromString(params.BlockID) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + shardsAllInfo, err := h.storage.GetShardsAllInfo(ctx, blockID) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + resp, err := convertShardsAllInfo(shardsAllInfo) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} + +func (h Handler) GetTransactionsLiteServer(ctx context.Context, params oas.GetTransactionsLiteServerParams) (oas.GetTransactionsLiteServerRes, error) { + accountID, err := tongo.ParseAccountID(params.AccountID) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + hash, err := tongo.ParseHash(params.Hash) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + txs, err := h.storage.GetTransactionsRaw(ctx, params.Count, accountID, params.Lt, hash) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + resp, err := convertTransactions(txs) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} + +func (h Handler) GetListBlockTransactionsLiteServer(ctx context.Context, params oas.GetListBlockTransactionsLiteServerParams) (res oas.GetListBlockTransactionsLiteServerRes, err error) { + blockID, err := blockIdExtFromString(params.BlockID) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + var after *liteclient.LiteServerTransactionId3C + if params.AccountID.Value != "" && params.Lt.Value != 0 { + accountID, err := tongo.ParseAccountID(params.AccountID.Value) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + after.Account = accountID.Address + after.Lt = params.Lt.Value + } + listBlockTxs, err := h.storage.ListBlockTransactionsRaw(ctx, blockID, params.Mode, params.Count, after) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + resp, err := convertListBlockTxs(listBlockTxs) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} + +func (h Handler) GetBlockProofLiteServer(ctx context.Context, params oas.GetBlockProofLiteServerParams) (res oas.GetBlockProofLiteServerRes, err error) { + knownBlockID, err := blockIdExtFromString(params.KnownBlock) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + var targetBlockID *tongo.BlockIDExt + if params.TargetBlock.Value != "" { + blockID, err := blockIdExtFromString(params.TargetBlock.Value) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + targetBlockID = &blockID + } + blockProof, err := h.storage.GetBlockProofRaw(ctx, knownBlockID, targetBlockID) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + resp, err := convertBlockProof(blockProof) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} + +func (h Handler) GetConfigAllLiteServer(ctx context.Context, params oas.GetConfigAllLiteServerParams) (res oas.GetConfigAllLiteServerRes, err error) { + blockID, err := blockIdExtFromString(params.BlockID) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + config, err := h.storage.GetConfigAllRaw(ctx, params.Mode, blockID) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + resp, err := convertRawConfig(config) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} + +func (h Handler) GetShardBlockProofLiteServer(ctx context.Context, params oas.GetShardBlockProofLiteServerParams) (res oas.GetShardBlockProofLiteServerRes, err error) { + blockID, err := blockIdExtFromString(params.BlockID) + if err != nil { + return &oas.BadRequest{Error: err.Error()}, nil + } + shardBlockProof, err := h.storage.GetShardBlockProofRaw(ctx, blockID) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + resp, err := convertShardBlockProof(shardBlockProof) + if err != nil { + return &oas.InternalError{Error: err.Error()}, nil + } + return resp, nil +} diff --git a/pkg/litestorage/raw.go b/pkg/litestorage/raw.go new file mode 100644 index 00000000..5325bdfd --- /dev/null +++ b/pkg/litestorage/raw.go @@ -0,0 +1,69 @@ +package litestorage + +import ( + "context" + + "github.com/tonkeeper/tongo" + "github.com/tonkeeper/tongo/liteapi" + "github.com/tonkeeper/tongo/liteclient" +) + +func (s *LiteStorage) GetMasterchainInfoRaw(ctx context.Context) (liteclient.LiteServerMasterchainInfoC, error) { + return s.client.GetMasterchainInfo(ctx) +} + +func (s *LiteStorage) GetMasterchainInfoExtRaw(ctx context.Context, mode uint32) (liteclient.LiteServerMasterchainInfoExtC, error) { + return s.client.GetMasterchainInfoExt(ctx, mode) +} + +func (s *LiteStorage) GetTimeRaw(ctx context.Context) (uint32, error) { + return s.client.GetTime(ctx) +} + +func (s *LiteStorage) GetBlockRaw(ctx context.Context, id tongo.BlockIDExt) (liteclient.LiteServerBlockDataC, error) { + return s.client.GetBlockRaw(ctx, id) +} + +func (s *LiteStorage) GetStateRaw(ctx context.Context, id tongo.BlockIDExt) (liteclient.LiteServerBlockStateC, error) { + return s.client.GetStateRaw(ctx, id) +} + +func (s *LiteStorage) GetBlockHeaderRaw(ctx context.Context, id tongo.BlockIDExt, mode uint32) (liteclient.LiteServerBlockHeaderC, error) { + return s.client.GetBlockHeaderRaw(ctx, id, mode) +} + +func (s *LiteStorage) SendMessageRaw(ctx context.Context, payload []byte) (uint32, error) { + return s.client.SendMessage(ctx, payload) +} + +func (s *LiteStorage) GetAccountStateRaw(ctx context.Context, accountID tongo.AccountID) (liteclient.LiteServerAccountStateC, error) { + return s.client.GetAccountStateRaw(ctx, accountID) +} + +func (s *LiteStorage) GetShardInfoRaw(ctx context.Context, id tongo.BlockIDExt, workchain uint32, shard uint64, exact bool) (liteclient.LiteServerShardInfoC, error) { + return s.client.GetShardInfoRaw(ctx, id, workchain, shard, exact) +} + +func (s *LiteStorage) GetShardsAllInfo(ctx context.Context, id tongo.BlockIDExt) (liteclient.LiteServerAllShardsInfoC, error) { + return s.client.GetAllShardsInfoRaw(ctx, id) +} + +func (s *LiteStorage) GetTransactionsRaw(ctx context.Context, count uint32, accountID tongo.AccountID, lt uint64, hash tongo.Bits256) (liteclient.LiteServerTransactionListC, error) { + return s.client.GetTransactionsRaw(ctx, count, accountID, lt, hash) +} + +func (s *LiteStorage) ListBlockTransactionsRaw(ctx context.Context, id tongo.BlockIDExt, mode, count uint32, after *liteclient.LiteServerTransactionId3C) (liteclient.LiteServerBlockTransactionsC, error) { + return s.client.ListBlockTransactionsRaw(ctx, id, mode, count, after) +} + +func (s *LiteStorage) GetBlockProofRaw(ctx context.Context, knownBlock tongo.BlockIDExt, targetBlock *tongo.BlockIDExt) (liteclient.LiteServerPartialBlockProofC, error) { + return s.client.GetBlockProofRaw(ctx, knownBlock, targetBlock) +} + +func (s *LiteStorage) GetConfigAllRaw(ctx context.Context, mode uint32, id tongo.BlockIDExt) (liteclient.LiteServerConfigInfoC, error) { + return s.client.WithBlock(id).GetConfigAllRaw(ctx, liteapi.ConfigMode(mode)) +} + +func (s *LiteStorage) GetShardBlockProofRaw(ctx context.Context, id tongo.BlockIDExt) (liteclient.LiteServerShardBlockProofC, error) { + return s.client.WithBlock(id).GetShardBlockProofRaw(ctx) +} diff --git a/pkg/oas/oas_client_gen.go b/pkg/oas/oas_client_gen.go index b92483bf..df0178dc 100644 --- a/pkg/oas/oas_client_gen.go +++ b/pkg/oas/oas_client_gen.go @@ -951,6 +951,82 @@ func (c *Client) GetAccountSeqno(ctx context.Context, params GetAccountSeqnoPara return result, nil } +// GetAccountStateLiteServer invokes getAccountStateLiteServer operation. +// +// Get account state. +// +// GET /v2/liteserver/get_account_state/{account_id} +func (c *Client) GetAccountStateLiteServer(ctx context.Context, params GetAccountStateLiteServerParams) (res GetAccountStateLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getAccountStateLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetAccountStateLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/get_account_state/" + { + // Encode "account_id" parameter. + e := uri.NewPathEncoder(uri.PathEncoderConfig{ + Param: "account_id", + Style: uri.PathStyleSimple, + Explode: false, + }) + if err := func() error { + return e.EncodeValue(conv.StringToString(params.AccountID)) + }(); err != nil { + return res, errors.Wrap(err, "encode path") + } + u.Path += e.Result() + } + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetAccountStateLiteServerResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + // GetAccountTransactions invokes getAccountTransactions operation. // // Get account transactions. @@ -1247,6 +1323,82 @@ func (c *Client) GetAllAuctions(ctx context.Context, params GetAllAuctionsParams return result, nil } +// GetAllShardsInfoLiteServer invokes getAllShardsInfoLiteServer operation. +// +// Get all shards info. +// +// GET /v2/liteserver/get_all_shards_info/{block_id} +func (c *Client) GetAllShardsInfoLiteServer(ctx context.Context, params GetAllShardsInfoLiteServerParams) (res GetAllShardsInfoLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getAllShardsInfoLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetAllShardsInfoLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/get_all_shards_info/" + { + // Encode "block_id" parameter. + e := uri.NewPathEncoder(uri.PathEncoderConfig{ + Param: "block_id", + Style: uri.PathStyleSimple, + Explode: false, + }) + if err := func() error { + return e.EncodeValue(conv.StringToString(params.BlockID)) + }(); err != nil { + return res, errors.Wrap(err, "encode path") + } + u.Path += e.Result() + } + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetAllShardsInfoLiteServerResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + // GetBlock invokes getBlock operation. // // Get block data. @@ -1323,6 +1475,287 @@ func (c *Client) GetBlock(ctx context.Context, params GetBlockParams) (res GetBl return result, nil } +// GetBlockHeaderLiteServer invokes getBlockHeaderLiteServer operation. +// +// Get block header. +// +// GET /v2/liteserver/get_block_header/{block_id} +func (c *Client) GetBlockHeaderLiteServer(ctx context.Context, params GetBlockHeaderLiteServerParams) (res GetBlockHeaderLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getBlockHeaderLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetBlockHeaderLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/get_block_header/" + { + // Encode "block_id" parameter. + e := uri.NewPathEncoder(uri.PathEncoderConfig{ + Param: "block_id", + Style: uri.PathStyleSimple, + Explode: false, + }) + if err := func() error { + return e.EncodeValue(conv.StringToString(params.BlockID)) + }(); err != nil { + return res, errors.Wrap(err, "encode path") + } + u.Path += e.Result() + } + + stage = "EncodeQueryParams" + q := uri.NewQueryEncoder() + { + // Encode "mode" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "mode", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.Uint32ToString(params.Mode)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + u.RawQuery = q.Values().Encode() + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetBlockHeaderLiteServerResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + +// GetBlockLiteServer invokes getBlockLiteServer operation. +// +// Get block. +// +// GET /v2/liteserver/get_block/{block_id} +func (c *Client) GetBlockLiteServer(ctx context.Context, params GetBlockLiteServerParams) (res GetBlockLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getBlockLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetBlockLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/get_block/" + { + // Encode "block_id" parameter. + e := uri.NewPathEncoder(uri.PathEncoderConfig{ + Param: "block_id", + Style: uri.PathStyleSimple, + Explode: false, + }) + if err := func() error { + return e.EncodeValue(conv.StringToString(params.BlockID)) + }(); err != nil { + return res, errors.Wrap(err, "encode path") + } + u.Path += e.Result() + } + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetBlockLiteServerResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + +// GetBlockProofLiteServer invokes getBlockProofLiteServer operation. +// +// Get block proof. +// +// GET /v2/liteserver/get_block_proof +func (c *Client) GetBlockProofLiteServer(ctx context.Context, params GetBlockProofLiteServerParams) (res GetBlockProofLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getBlockProofLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetBlockProofLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/get_block_proof" + + stage = "EncodeQueryParams" + q := uri.NewQueryEncoder() + { + // Encode "known_block" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "known_block", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.StringToString(params.KnownBlock)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + { + // Encode "target_block" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "target_block", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := params.TargetBlock.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + { + // Encode "mode" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "mode", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.Uint32ToString(params.Mode)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + u.RawQuery = q.Values().Encode() + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetBlockProofLiteServerResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + // GetBlockTransactions invokes getBlockTransactions operation. // // Get transactions from block. @@ -1454,7 +1887,101 @@ func (c *Client) GetConfig(ctx context.Context) (res GetConfigRes, err error) { defer resp.Body.Close() stage = "DecodeResponse" - result, err := decodeGetConfigResponse(resp) + result, err := decodeGetConfigResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + +// GetConfigAllLiteServer invokes getConfigAllLiteServer operation. +// +// Get config all. +// +// GET /v2/liteserver/get_config_all/{block_id} +func (c *Client) GetConfigAllLiteServer(ctx context.Context, params GetConfigAllLiteServerParams) (res GetConfigAllLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getConfigAllLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetConfigAllLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/get_config_all/" + { + // Encode "block_id" parameter. + e := uri.NewPathEncoder(uri.PathEncoderConfig{ + Param: "block_id", + Style: uri.PathStyleSimple, + Explode: false, + }) + if err := func() error { + return e.EncodeValue(conv.StringToString(params.BlockID)) + }(); err != nil { + return res, errors.Wrap(err, "encode path") + } + u.Path += e.Result() + } + + stage = "EncodeQueryParams" + q := uri.NewQueryEncoder() + { + // Encode "mode" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "mode", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.Uint32ToString(params.Mode)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + u.RawQuery = q.Values().Encode() + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetConfigAllLiteServerResponse(resp) if err != nil { return res, errors.Wrap(err, "decode response") } @@ -2628,14 +3155,298 @@ func (c *Client) GetJettonsHistoryByID(ctx context.Context, params GetJettonsHis return result, nil } +// GetListBlockTransactionsLiteServer invokes getListBlockTransactionsLiteServer operation. +// +// Get list block transactions. +// +// GET /v2/liteserver/list_block_transactions/{block_id} +func (c *Client) GetListBlockTransactionsLiteServer(ctx context.Context, params GetListBlockTransactionsLiteServerParams) (res GetListBlockTransactionsLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getListBlockTransactionsLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetListBlockTransactionsLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/list_block_transactions/" + { + // Encode "block_id" parameter. + e := uri.NewPathEncoder(uri.PathEncoderConfig{ + Param: "block_id", + Style: uri.PathStyleSimple, + Explode: false, + }) + if err := func() error { + return e.EncodeValue(conv.StringToString(params.BlockID)) + }(); err != nil { + return res, errors.Wrap(err, "encode path") + } + u.Path += e.Result() + } + + stage = "EncodeQueryParams" + q := uri.NewQueryEncoder() + { + // Encode "mode" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "mode", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.Uint32ToString(params.Mode)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + { + // Encode "count" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "count", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.Uint32ToString(params.Count)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + { + // Encode "account_id" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "account_id", + Style: uri.QueryStyleForm, + Explode: false, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := params.AccountID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + { + // Encode "lt" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "lt", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := params.Lt.Get(); ok { + return e.EncodeValue(conv.Uint64ToString(val)) + } + return nil + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + u.RawQuery = q.Values().Encode() + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetListBlockTransactionsLiteServerResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + // GetMasterchainHead invokes getMasterchainHead operation. // // Get last known masterchain block. // -// GET /v2/blockchain/masterchain-head -func (c *Client) GetMasterchainHead(ctx context.Context) (res GetMasterchainHeadRes, err error) { +// GET /v2/blockchain/masterchain-head +func (c *Client) GetMasterchainHead(ctx context.Context) (res GetMasterchainHeadRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getMasterchainHead"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetMasterchainHead", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/blockchain/masterchain-head" + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetMasterchainHeadResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + +// GetMasterchainInfoExtLiteServer invokes getMasterchainInfoExtLiteServer operation. +// +// Get masterchain info ext. +// +// GET /v2/liteserver/get_masterchain_info_ext +func (c *Client) GetMasterchainInfoExtLiteServer(ctx context.Context, params GetMasterchainInfoExtLiteServerParams) (res GetMasterchainInfoExtLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getMasterchainInfoExtLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetMasterchainInfoExtLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/get_masterchain_info_ext" + + stage = "EncodeQueryParams" + q := uri.NewQueryEncoder() + { + // Encode "mode" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "mode", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.Uint32ToString(params.Mode)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + u.RawQuery = q.Values().Encode() + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetMasterchainInfoExtLiteServerResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + +// GetMasterchainInfoLiteServer invokes getMasterchainInfoLiteServer operation. +// +// Get masterchain info. +// +// GET /v2/liteserver/get_masterchain_info +func (c *Client) GetMasterchainInfoLiteServer(ctx context.Context) (res GetMasterchainInfoLiteServerRes, err error) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getMasterchainHead"), + otelogen.OperationID("getMasterchainInfoLiteServer"), } // Run stopwatch. @@ -2649,7 +3460,7 @@ func (c *Client) GetMasterchainHead(ctx context.Context) (res GetMasterchainHead c.requests.Add(ctx, 1, otelAttrs...) // Start a span for this request. - ctx, span := c.cfg.Tracer.Start(ctx, "GetMasterchainHead", + ctx, span := c.cfg.Tracer.Start(ctx, "GetMasterchainInfoLiteServer", trace.WithAttributes(otelAttrs...), clientSpanKind, ) @@ -2666,7 +3477,7 @@ func (c *Client) GetMasterchainHead(ctx context.Context) (res GetMasterchainHead stage = "BuildURL" u := uri.Clone(c.requestURL(ctx)) - u.Path += "/v2/blockchain/masterchain-head" + u.Path += "/v2/liteserver/get_masterchain_info" stage = "EncodeRequest" r, err := ht.NewRequest(ctx, "GET", u, nil) @@ -2682,7 +3493,7 @@ func (c *Client) GetMasterchainHead(ctx context.Context) (res GetMasterchainHead defer resp.Body.Close() stage = "DecodeResponse" - result, err := decodeGetMasterchainHeadResponse(resp) + result, err := decodeGetMasterchainInfoLiteServerResponse(resp) if err != nil { return res, errors.Wrap(err, "decode response") } @@ -3394,8 +4205,286 @@ func (c *Client) GetRawAccount(ctx context.Context, params GetRawAccountParams) }(); err != nil { return res, errors.Wrap(err, "encode path") } - u.Path += e.Result() + u.Path += e.Result() + } + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetRawAccountResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + +// GetSearchAccounts invokes getSearchAccounts operation. +// +// Search for accounts by name. You can find the account by the first characters of the domain. +// +// GET /v2/accounts/search +func (c *Client) GetSearchAccounts(ctx context.Context, params GetSearchAccountsParams) (res GetSearchAccountsRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getSearchAccounts"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetSearchAccounts", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/accounts/search" + + stage = "EncodeQueryParams" + q := uri.NewQueryEncoder() + { + // Encode "name" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "name", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.StringToString(params.Name)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + u.RawQuery = q.Values().Encode() + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetSearchAccountsResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + +// GetShardBlockProofLiteServer invokes getShardBlockProofLiteServer operation. +// +// Get shard block proof. +// +// GET /v2/liteserver/get_shard_block_proof/{block_id} +func (c *Client) GetShardBlockProofLiteServer(ctx context.Context, params GetShardBlockProofLiteServerParams) (res GetShardBlockProofLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getShardBlockProofLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetShardBlockProofLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/get_shard_block_proof/" + { + // Encode "block_id" parameter. + e := uri.NewPathEncoder(uri.PathEncoderConfig{ + Param: "block_id", + Style: uri.PathStyleSimple, + Explode: false, + }) + if err := func() error { + return e.EncodeValue(conv.StringToString(params.BlockID)) + }(); err != nil { + return res, errors.Wrap(err, "encode path") + } + u.Path += e.Result() + } + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetShardBlockProofLiteServerResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + +// GetShardInfoLiteServer invokes getShardInfoLiteServer operation. +// +// Get shard info. +// +// GET /v2/liteserver/get_shard_info/{block_id} +func (c *Client) GetShardInfoLiteServer(ctx context.Context, params GetShardInfoLiteServerParams) (res GetShardInfoLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getShardInfoLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetShardInfoLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/get_shard_info/" + { + // Encode "block_id" parameter. + e := uri.NewPathEncoder(uri.PathEncoderConfig{ + Param: "block_id", + Style: uri.PathStyleSimple, + Explode: false, + }) + if err := func() error { + return e.EncodeValue(conv.StringToString(params.BlockID)) + }(); err != nil { + return res, errors.Wrap(err, "encode path") + } + u.Path += e.Result() + } + + stage = "EncodeQueryParams" + q := uri.NewQueryEncoder() + { + // Encode "workchain" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "workchain", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.Uint32ToString(params.Workchain)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + { + // Encode "shard" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "shard", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.Uint64ToString(params.Shard)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + { + // Encode "exact" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "exact", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.BoolToString(params.Exact)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } } + u.RawQuery = q.Values().Encode() stage = "EncodeRequest" r, err := ht.NewRequest(ctx, "GET", u, nil) @@ -3411,7 +4500,7 @@ func (c *Client) GetRawAccount(ctx context.Context, params GetRawAccountParams) defer resp.Body.Close() stage = "DecodeResponse" - result, err := decodeGetRawAccountResponse(resp) + result, err := decodeGetShardInfoLiteServerResponse(resp) if err != nil { return res, errors.Wrap(err, "decode response") } @@ -3419,14 +4508,14 @@ func (c *Client) GetRawAccount(ctx context.Context, params GetRawAccountParams) return result, nil } -// GetSearchAccounts invokes getSearchAccounts operation. +// GetStateLiteServer invokes getStateLiteServer operation. // -// Search for accounts by name. You can find the account by the first characters of the domain. +// Get block state. // -// GET /v2/accounts/search -func (c *Client) GetSearchAccounts(ctx context.Context, params GetSearchAccountsParams) (res GetSearchAccountsRes, err error) { +// GET /v2/liteserver/get_state/{block_id} +func (c *Client) GetStateLiteServer(ctx context.Context, params GetStateLiteServerParams) (res GetStateLiteServerRes, err error) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getSearchAccounts"), + otelogen.OperationID("getStateLiteServer"), } // Run stopwatch. @@ -3440,7 +4529,7 @@ func (c *Client) GetSearchAccounts(ctx context.Context, params GetSearchAccounts c.requests.Add(ctx, 1, otelAttrs...) // Start a span for this request. - ctx, span := c.cfg.Tracer.Start(ctx, "GetSearchAccounts", + ctx, span := c.cfg.Tracer.Start(ctx, "GetStateLiteServer", trace.WithAttributes(otelAttrs...), clientSpanKind, ) @@ -3457,25 +4546,21 @@ func (c *Client) GetSearchAccounts(ctx context.Context, params GetSearchAccounts stage = "BuildURL" u := uri.Clone(c.requestURL(ctx)) - u.Path += "/v2/accounts/search" - - stage = "EncodeQueryParams" - q := uri.NewQueryEncoder() + u.Path += "/v2/liteserver/get_state/" { - // Encode "name" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "name", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - return e.EncodeValue(conv.StringToString(params.Name)) - }); err != nil { - return res, errors.Wrap(err, "encode query") + // Encode "block_id" parameter. + e := uri.NewPathEncoder(uri.PathEncoderConfig{ + Param: "block_id", + Style: uri.PathStyleSimple, + Explode: false, + }) + if err := func() error { + return e.EncodeValue(conv.StringToString(params.BlockID)) + }(); err != nil { + return res, errors.Wrap(err, "encode path") } + u.Path += e.Result() } - u.RawQuery = q.Values().Encode() stage = "EncodeRequest" r, err := ht.NewRequest(ctx, "GET", u, nil) @@ -3491,7 +4576,7 @@ func (c *Client) GetSearchAccounts(ctx context.Context, params GetSearchAccounts defer resp.Body.Close() stage = "DecodeResponse" - result, err := decodeGetSearchAccountsResponse(resp) + result, err := decodeGetStateLiteServerResponse(resp) if err != nil { return res, errors.Wrap(err, "decode response") } @@ -3638,6 +4723,68 @@ func (c *Client) GetSubscriptionsByAccount(ctx context.Context, params GetSubscr return result, nil } +// GetTimeLiteServer invokes getTimeLiteServer operation. +// +// Get time. +// +// GET /v2/liteserver/get_time +func (c *Client) GetTimeLiteServer(ctx context.Context) (res GetTimeLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getTimeLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetTimeLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/get_time" + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetTimeLiteServerResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + // GetTonConnectPayload invokes getTonConnectPayload operation. // // Get a payload for further token receipt. @@ -4027,6 +5174,128 @@ func (c *Client) GetTransactionByMessageHash(ctx context.Context, params GetTran return result, nil } +// GetTransactionsLiteServer invokes getTransactionsLiteServer operation. +// +// Get transactions. +// +// GET /v2/liteserver/get_transactions/{account_id} +func (c *Client) GetTransactionsLiteServer(ctx context.Context, params GetTransactionsLiteServerParams) (res GetTransactionsLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getTransactionsLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "GetTransactionsLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/get_transactions/" + { + // Encode "account_id" parameter. + e := uri.NewPathEncoder(uri.PathEncoderConfig{ + Param: "account_id", + Style: uri.PathStyleSimple, + Explode: false, + }) + if err := func() error { + return e.EncodeValue(conv.StringToString(params.AccountID)) + }(); err != nil { + return res, errors.Wrap(err, "encode path") + } + u.Path += e.Result() + } + + stage = "EncodeQueryParams" + q := uri.NewQueryEncoder() + { + // Encode "count" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "count", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.Uint32ToString(params.Count)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + { + // Encode "lt" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "lt", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.Uint64ToString(params.Lt)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + { + // Encode "hash" parameter. + cfg := uri.QueryParameterEncodingConfig{ + Name: "hash", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.StringToString(params.Hash)) + }); err != nil { + return res, errors.Wrap(err, "encode query") + } + } + u.RawQuery = q.Values().Encode() + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "GET", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeGetTransactionsLiteServerResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + // GetValidators invokes getValidators operation. // // Get validators. @@ -4461,6 +5730,71 @@ func (c *Client) SendMessage(ctx context.Context, request SendMessageReq) (res S return result, nil } +// SendMessageLiteServer invokes sendMessageLiteServer operation. +// +// Send message. +// +// POST /v2/liteserver/send_message +func (c *Client) SendMessageLiteServer(ctx context.Context, request SendMessageLiteServerReq) (res SendMessageLiteServerRes, err error) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("sendMessageLiteServer"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, otelAttrs...) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "SendMessageLiteServer", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, otelAttrs...) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + u.Path += "/v2/liteserver/send_message" + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "POST", u, nil) + if err != nil { + return res, errors.Wrap(err, "create request") + } + if err := encodeSendMessageLiteServerRequest(request, r); err != nil { + return res, errors.Wrap(err, "encode request") + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodeSendMessageLiteServerResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + // SetWalletBackup invokes setWalletBackup operation. // // Set backup info. diff --git a/pkg/oas/oas_handlers_gen.go b/pkg/oas/oas_handlers_gen.go index 1628f097..501763c0 100644 --- a/pkg/oas/oas_handlers_gen.go +++ b/pkg/oas/oas_handlers_gen.go @@ -1162,6 +1162,105 @@ func (s *Server) handleGetAccountSeqnoRequest(args [1]string, w http.ResponseWri } } +// handleGetAccountStateLiteServerRequest handles getAccountStateLiteServer operation. +// +// Get account state. +// +// GET /v2/liteserver/get_account_state/{account_id} +func (s *Server) handleGetAccountStateLiteServerRequest(args [1]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getAccountStateLiteServer"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetAccountStateLiteServer", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetAccountStateLiteServer", + ID: "getAccountStateLiteServer", + } + ) + params, err := decodeGetAccountStateLiteServerParams(args, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var response GetAccountStateLiteServerRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetAccountStateLiteServer", + OperationID: "getAccountStateLiteServer", + Body: nil, + Params: middleware.Parameters{ + { + Name: "account_id", + In: "path", + }: params.AccountID, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetAccountStateLiteServerParams + Response = GetAccountStateLiteServerRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetAccountStateLiteServerParams, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetAccountStateLiteServer(ctx, params) + }, + ) + } else { + response, err = s.h.GetAccountStateLiteServer(ctx, params) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetAccountStateLiteServerResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + // handleGetAccountTransactionsRequest handles getAccountTransactions operation. // // Get account transactions. @@ -1471,18 +1570,18 @@ func (s *Server) handleGetAllAuctionsRequest(args [0]string, w http.ResponseWrit } } -// handleGetBlockRequest handles getBlock operation. +// handleGetAllShardsInfoLiteServerRequest handles getAllShardsInfoLiteServer operation. // -// Get block data. +// Get all shards info. // -// GET /v2/blockchain/blocks/{block_id} -func (s *Server) handleGetBlockRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/liteserver/get_all_shards_info/{block_id} +func (s *Server) handleGetAllShardsInfoLiteServerRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getBlock"), + otelogen.OperationID("getAllShardsInfoLiteServer"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetBlock", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetAllShardsInfoLiteServer", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -1506,11 +1605,11 @@ func (s *Server) handleGetBlockRequest(args [1]string, w http.ResponseWriter, r } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetBlock", - ID: "getBlock", + Name: "GetAllShardsInfoLiteServer", + ID: "getAllShardsInfoLiteServer", } ) - params, err := decodeGetBlockParams(args, r) + params, err := decodeGetAllShardsInfoLiteServerParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -1521,12 +1620,12 @@ func (s *Server) handleGetBlockRequest(args [1]string, w http.ResponseWriter, r return } - var response GetBlockRes + var response GetAllShardsInfoLiteServerRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetBlock", - OperationID: "getBlock", + OperationName: "GetAllShardsInfoLiteServer", + OperationID: "getAllShardsInfoLiteServer", Body: nil, Params: middleware.Parameters{ { @@ -1539,8 +1638,8 @@ func (s *Server) handleGetBlockRequest(args [1]string, w http.ResponseWriter, r type ( Request = struct{} - Params = GetBlockParams - Response = GetBlockRes + Params = GetAllShardsInfoLiteServerParams + Response = GetAllShardsInfoLiteServerRes ) response, err = middleware.HookMiddleware[ Request, @@ -1549,13 +1648,13 @@ func (s *Server) handleGetBlockRequest(args [1]string, w http.ResponseWriter, r ]( m, mreq, - unpackGetBlockParams, + unpackGetAllShardsInfoLiteServerParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetBlock(ctx, params) + return s.h.GetAllShardsInfoLiteServer(ctx, params) }, ) } else { - response, err = s.h.GetBlock(ctx, params) + response, err = s.h.GetAllShardsInfoLiteServer(ctx, params) } if err != nil { recordError("Internal", err) @@ -1563,25 +1662,25 @@ func (s *Server) handleGetBlockRequest(args [1]string, w http.ResponseWriter, r return } - if err := encodeGetBlockResponse(response, w, span); err != nil { + if err := encodeGetAllShardsInfoLiteServerResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetBlockTransactionsRequest handles getBlockTransactions operation. +// handleGetBlockRequest handles getBlock operation. // -// Get transactions from block. +// Get block data. // -// GET /v2/blockchain/blocks/{block_id}/transactions -func (s *Server) handleGetBlockTransactionsRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/blockchain/blocks/{block_id} +func (s *Server) handleGetBlockRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getBlockTransactions"), + otelogen.OperationID("getBlock"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetBlockTransactions", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetBlock", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -1605,11 +1704,11 @@ func (s *Server) handleGetBlockTransactionsRequest(args [1]string, w http.Respon } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetBlockTransactions", - ID: "getBlockTransactions", + Name: "GetBlock", + ID: "getBlock", } ) - params, err := decodeGetBlockTransactionsParams(args, r) + params, err := decodeGetBlockParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -1620,12 +1719,12 @@ func (s *Server) handleGetBlockTransactionsRequest(args [1]string, w http.Respon return } - var response GetBlockTransactionsRes + var response GetBlockRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetBlockTransactions", - OperationID: "getBlockTransactions", + OperationName: "GetBlock", + OperationID: "getBlock", Body: nil, Params: middleware.Parameters{ { @@ -1638,8 +1737,8 @@ func (s *Server) handleGetBlockTransactionsRequest(args [1]string, w http.Respon type ( Request = struct{} - Params = GetBlockTransactionsParams - Response = GetBlockTransactionsRes + Params = GetBlockParams + Response = GetBlockRes ) response, err = middleware.HookMiddleware[ Request, @@ -1648,13 +1747,13 @@ func (s *Server) handleGetBlockTransactionsRequest(args [1]string, w http.Respon ]( m, mreq, - unpackGetBlockTransactionsParams, + unpackGetBlockParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetBlockTransactions(ctx, params) + return s.h.GetBlock(ctx, params) }, ) } else { - response, err = s.h.GetBlockTransactions(ctx, params) + response, err = s.h.GetBlock(ctx, params) } if err != nil { recordError("Internal", err) @@ -1662,25 +1761,25 @@ func (s *Server) handleGetBlockTransactionsRequest(args [1]string, w http.Respon return } - if err := encodeGetBlockTransactionsResponse(response, w, span); err != nil { + if err := encodeGetBlockResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetConfigRequest handles getConfig operation. +// handleGetBlockHeaderLiteServerRequest handles getBlockHeaderLiteServer operation. // -// Get blockchain config. +// Get block header. // -// GET /v2/blockchain/config -func (s *Server) handleGetConfigRequest(args [0]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/liteserver/get_block_header/{block_id} +func (s *Server) handleGetBlockHeaderLiteServerRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getConfig"), + otelogen.OperationID("getBlockHeaderLiteServer"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetConfig", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetBlockHeaderLiteServer", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -1702,24 +1801,47 @@ func (s *Server) handleGetConfigRequest(args [0]string, w http.ResponseWriter, r span.SetStatus(codes.Error, stage) s.errors.Add(ctx, 1, otelAttrs...) } - err error + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetBlockHeaderLiteServer", + ID: "getBlockHeaderLiteServer", + } ) + params, err := decodeGetBlockHeaderLiteServerParams(args, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } - var response GetConfigRes + var response GetBlockHeaderLiteServerRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetConfig", - OperationID: "getConfig", + OperationName: "GetBlockHeaderLiteServer", + OperationID: "getBlockHeaderLiteServer", Body: nil, - Params: middleware.Parameters{}, - Raw: r, + Params: middleware.Parameters{ + { + Name: "block_id", + In: "path", + }: params.BlockID, + { + Name: "mode", + In: "query", + }: params.Mode, + }, + Raw: r, } type ( Request = struct{} - Params = struct{} - Response = GetConfigRes + Params = GetBlockHeaderLiteServerParams + Response = GetBlockHeaderLiteServerRes ) response, err = middleware.HookMiddleware[ Request, @@ -1728,13 +1850,13 @@ func (s *Server) handleGetConfigRequest(args [0]string, w http.ResponseWriter, r ]( m, mreq, - nil, + unpackGetBlockHeaderLiteServerParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetConfig(ctx) + return s.h.GetBlockHeaderLiteServer(ctx, params) }, ) } else { - response, err = s.h.GetConfig(ctx) + response, err = s.h.GetBlockHeaderLiteServer(ctx, params) } if err != nil { recordError("Internal", err) @@ -1742,25 +1864,25 @@ func (s *Server) handleGetConfigRequest(args [0]string, w http.ResponseWriter, r return } - if err := encodeGetConfigResponse(response, w, span); err != nil { + if err := encodeGetBlockHeaderLiteServerResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetDnsExpiringRequest handles getDnsExpiring operation. +// handleGetBlockLiteServerRequest handles getBlockLiteServer operation. // -// Get expiring .ton dns. +// Get block. // -// GET /v2/accounts/{account_id}/dns/expiring -func (s *Server) handleGetDnsExpiringRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/liteserver/get_block/{block_id} +func (s *Server) handleGetBlockLiteServerRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getDnsExpiring"), + otelogen.OperationID("getBlockLiteServer"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetDnsExpiring", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetBlockLiteServer", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -1784,11 +1906,11 @@ func (s *Server) handleGetDnsExpiringRequest(args [1]string, w http.ResponseWrit } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetDnsExpiring", - ID: "getDnsExpiring", + Name: "GetBlockLiteServer", + ID: "getBlockLiteServer", } ) - params, err := decodeGetDnsExpiringParams(args, r) + params, err := decodeGetBlockLiteServerParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -1799,30 +1921,26 @@ func (s *Server) handleGetDnsExpiringRequest(args [1]string, w http.ResponseWrit return } - var response GetDnsExpiringRes + var response GetBlockLiteServerRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetDnsExpiring", - OperationID: "getDnsExpiring", + OperationName: "GetBlockLiteServer", + OperationID: "getBlockLiteServer", Body: nil, Params: middleware.Parameters{ { - Name: "account_id", + Name: "block_id", In: "path", - }: params.AccountID, - { - Name: "period", - In: "query", - }: params.Period, + }: params.BlockID, }, Raw: r, } type ( Request = struct{} - Params = GetDnsExpiringParams - Response = GetDnsExpiringRes + Params = GetBlockLiteServerParams + Response = GetBlockLiteServerRes ) response, err = middleware.HookMiddleware[ Request, @@ -1831,13 +1949,13 @@ func (s *Server) handleGetDnsExpiringRequest(args [1]string, w http.ResponseWrit ]( m, mreq, - unpackGetDnsExpiringParams, + unpackGetBlockLiteServerParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetDnsExpiring(ctx, params) + return s.h.GetBlockLiteServer(ctx, params) }, ) } else { - response, err = s.h.GetDnsExpiring(ctx, params) + response, err = s.h.GetBlockLiteServer(ctx, params) } if err != nil { recordError("Internal", err) @@ -1845,25 +1963,25 @@ func (s *Server) handleGetDnsExpiringRequest(args [1]string, w http.ResponseWrit return } - if err := encodeGetDnsExpiringResponse(response, w, span); err != nil { + if err := encodeGetBlockLiteServerResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetDomainBidsRequest handles getDomainBids operation. +// handleGetBlockProofLiteServerRequest handles getBlockProofLiteServer operation. // -// Get domain bids. +// Get block proof. // -// GET /v2/dns/{domain_name}/bids -func (s *Server) handleGetDomainBidsRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/liteserver/get_block_proof +func (s *Server) handleGetBlockProofLiteServerRequest(args [0]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getDomainBids"), + otelogen.OperationID("getBlockProofLiteServer"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetDomainBids", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetBlockProofLiteServer", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -1887,11 +2005,11 @@ func (s *Server) handleGetDomainBidsRequest(args [1]string, w http.ResponseWrite } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetDomainBids", - ID: "getDomainBids", + Name: "GetBlockProofLiteServer", + ID: "getBlockProofLiteServer", } ) - params, err := decodeGetDomainBidsParams(args, r) + params, err := decodeGetBlockProofLiteServerParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -1902,26 +2020,34 @@ func (s *Server) handleGetDomainBidsRequest(args [1]string, w http.ResponseWrite return } - var response GetDomainBidsRes + var response GetBlockProofLiteServerRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetDomainBids", - OperationID: "getDomainBids", + OperationName: "GetBlockProofLiteServer", + OperationID: "getBlockProofLiteServer", Body: nil, Params: middleware.Parameters{ { - Name: "domain_name", - In: "path", - }: params.DomainName, + Name: "known_block", + In: "query", + }: params.KnownBlock, + { + Name: "target_block", + In: "query", + }: params.TargetBlock, + { + Name: "mode", + In: "query", + }: params.Mode, }, Raw: r, } type ( Request = struct{} - Params = GetDomainBidsParams - Response = GetDomainBidsRes + Params = GetBlockProofLiteServerParams + Response = GetBlockProofLiteServerRes ) response, err = middleware.HookMiddleware[ Request, @@ -1930,13 +2056,13 @@ func (s *Server) handleGetDomainBidsRequest(args [1]string, w http.ResponseWrite ]( m, mreq, - unpackGetDomainBidsParams, + unpackGetBlockProofLiteServerParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetDomainBids(ctx, params) + return s.h.GetBlockProofLiteServer(ctx, params) }, ) } else { - response, err = s.h.GetDomainBids(ctx, params) + response, err = s.h.GetBlockProofLiteServer(ctx, params) } if err != nil { recordError("Internal", err) @@ -1944,30 +2070,25 @@ func (s *Server) handleGetDomainBidsRequest(args [1]string, w http.ResponseWrite return } - if err := encodeGetDomainBidsResponse(response, w, span); err != nil { + if err := encodeGetBlockProofLiteServerResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetEventRequest handles getEvent operation. +// handleGetBlockTransactionsRequest handles getBlockTransactions operation. // -// Get an event either by event ID or a hash of any transaction in a trace. An event is built on top -// of a trace which is a series of transactions caused by one inbound message. TonAPI looks for known -// patterns inside the trace and splits the trace into actions, where a single action represents a -// meaningful high-level operation like a Jetton Transfer or an NFT Purchase. Actions are expected to -// be shown to users. It is advised not to build any logic on top of actions because actions can be -// changed at any time. +// Get transactions from block. // -// GET /v2/events/{event_id} -func (s *Server) handleGetEventRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/blockchain/blocks/{block_id}/transactions +func (s *Server) handleGetBlockTransactionsRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getEvent"), + otelogen.OperationID("getBlockTransactions"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetEvent", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetBlockTransactions", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -1991,11 +2112,11 @@ func (s *Server) handleGetEventRequest(args [1]string, w http.ResponseWriter, r } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetEvent", - ID: "getEvent", + Name: "GetBlockTransactions", + ID: "getBlockTransactions", } ) - params, err := decodeGetEventParams(args, r) + params, err := decodeGetBlockTransactionsParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -2006,30 +2127,26 @@ func (s *Server) handleGetEventRequest(args [1]string, w http.ResponseWriter, r return } - var response GetEventRes + var response GetBlockTransactionsRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetEvent", - OperationID: "getEvent", + OperationName: "GetBlockTransactions", + OperationID: "getBlockTransactions", Body: nil, Params: middleware.Parameters{ { - Name: "event_id", + Name: "block_id", In: "path", - }: params.EventID, - { - Name: "Accept-Language", - In: "header", - }: params.AcceptLanguage, + }: params.BlockID, }, Raw: r, } type ( Request = struct{} - Params = GetEventParams - Response = GetEventRes + Params = GetBlockTransactionsParams + Response = GetBlockTransactionsRes ) response, err = middleware.HookMiddleware[ Request, @@ -2038,13 +2155,13 @@ func (s *Server) handleGetEventRequest(args [1]string, w http.ResponseWriter, r ]( m, mreq, - unpackGetEventParams, + unpackGetBlockTransactionsParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetEvent(ctx, params) + return s.h.GetBlockTransactions(ctx, params) }, ) } else { - response, err = s.h.GetEvent(ctx, params) + response, err = s.h.GetBlockTransactions(ctx, params) } if err != nil { recordError("Internal", err) @@ -2052,29 +2169,25 @@ func (s *Server) handleGetEventRequest(args [1]string, w http.ResponseWriter, r return } - if err := encodeGetEventResponse(response, w, span); err != nil { + if err := encodeGetBlockTransactionsResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetEventsByAccountRequest handles getEventsByAccount operation. +// handleGetConfigRequest handles getConfig operation. // -// Get events for an account. Each event is built on top of a trace which is a series of transactions -// caused by one inbound message. TonAPI looks for known patterns inside the trace and splits the -// trace into actions, where a single action represents a meaningful high-level operation like a -// Jetton Transfer or an NFT Purchase. Actions are expected to be shown to users. It is advised not -// to build any logic on top of actions because actions can be changed at any time. +// Get blockchain config. // -// GET /v2/accounts/{account_id}/events -func (s *Server) handleGetEventsByAccountRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/blockchain/config +func (s *Server) handleGetConfigRequest(args [0]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getEventsByAccount"), + otelogen.OperationID("getConfig"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetEventsByAccount", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetConfig", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -2096,67 +2209,24 @@ func (s *Server) handleGetEventsByAccountRequest(args [1]string, w http.Response span.SetStatus(codes.Error, stage) s.errors.Add(ctx, 1, otelAttrs...) } - err error - opErrContext = ogenerrors.OperationContext{ - Name: "GetEventsByAccount", - ID: "getEventsByAccount", - } + err error ) - params, err := decodeGetEventsByAccountParams(args, r) - if err != nil { - err = &ogenerrors.DecodeParamsError{ - OperationContext: opErrContext, - Err: err, - } - recordError("DecodeParams", err) - s.cfg.ErrorHandler(ctx, w, r, err) - return - } - var response GetEventsByAccountRes + var response GetConfigRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetEventsByAccount", - OperationID: "getEventsByAccount", + OperationName: "GetConfig", + OperationID: "getConfig", Body: nil, - Params: middleware.Parameters{ - { - Name: "account_id", - In: "path", - }: params.AccountID, - { - Name: "Accept-Language", - In: "header", - }: params.AcceptLanguage, - { - Name: "subject_only", - In: "query", - }: params.SubjectOnly, - { - Name: "before_lt", - In: "query", - }: params.BeforeLt, - { - Name: "limit", - In: "query", - }: params.Limit, - { - Name: "start_date", - In: "query", - }: params.StartDate, - { - Name: "end_date", - In: "query", - }: params.EndDate, - }, - Raw: r, + Params: middleware.Parameters{}, + Raw: r, } type ( Request = struct{} - Params = GetEventsByAccountParams - Response = GetEventsByAccountRes + Params = struct{} + Response = GetConfigRes ) response, err = middleware.HookMiddleware[ Request, @@ -2165,13 +2235,13 @@ func (s *Server) handleGetEventsByAccountRequest(args [1]string, w http.Response ]( m, mreq, - unpackGetEventsByAccountParams, + nil, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetEventsByAccount(ctx, params) + return s.h.GetConfig(ctx) }, ) } else { - response, err = s.h.GetEventsByAccount(ctx, params) + response, err = s.h.GetConfig(ctx) } if err != nil { recordError("Internal", err) @@ -2179,25 +2249,25 @@ func (s *Server) handleGetEventsByAccountRequest(args [1]string, w http.Response return } - if err := encodeGetEventsByAccountResponse(response, w, span); err != nil { + if err := encodeGetConfigResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetItemsFromCollectionRequest handles getItemsFromCollection operation. +// handleGetConfigAllLiteServerRequest handles getConfigAllLiteServer operation. // -// Get NFT items from collection by collection address. +// Get config all. // -// GET /v2/nfts/collections/{account_id}/items -func (s *Server) handleGetItemsFromCollectionRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/liteserver/get_config_all/{block_id} +func (s *Server) handleGetConfigAllLiteServerRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getItemsFromCollection"), + otelogen.OperationID("getConfigAllLiteServer"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetItemsFromCollection", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetConfigAllLiteServer", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -2221,11 +2291,11 @@ func (s *Server) handleGetItemsFromCollectionRequest(args [1]string, w http.Resp } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetItemsFromCollection", - ID: "getItemsFromCollection", + Name: "GetConfigAllLiteServer", + ID: "getConfigAllLiteServer", } ) - params, err := decodeGetItemsFromCollectionParams(args, r) + params, err := decodeGetConfigAllLiteServerParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -2236,34 +2306,30 @@ func (s *Server) handleGetItemsFromCollectionRequest(args [1]string, w http.Resp return } - var response GetItemsFromCollectionRes + var response GetConfigAllLiteServerRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetItemsFromCollection", - OperationID: "getItemsFromCollection", + OperationName: "GetConfigAllLiteServer", + OperationID: "getConfigAllLiteServer", Body: nil, Params: middleware.Parameters{ { - Name: "account_id", + Name: "block_id", In: "path", - }: params.AccountID, - { - Name: "limit", - In: "query", - }: params.Limit, + }: params.BlockID, { - Name: "offset", + Name: "mode", In: "query", - }: params.Offset, + }: params.Mode, }, Raw: r, } type ( Request = struct{} - Params = GetItemsFromCollectionParams - Response = GetItemsFromCollectionRes + Params = GetConfigAllLiteServerParams + Response = GetConfigAllLiteServerRes ) response, err = middleware.HookMiddleware[ Request, @@ -2272,13 +2338,13 @@ func (s *Server) handleGetItemsFromCollectionRequest(args [1]string, w http.Resp ]( m, mreq, - unpackGetItemsFromCollectionParams, + unpackGetConfigAllLiteServerParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetItemsFromCollection(ctx, params) + return s.h.GetConfigAllLiteServer(ctx, params) }, ) } else { - response, err = s.h.GetItemsFromCollection(ctx, params) + response, err = s.h.GetConfigAllLiteServer(ctx, params) } if err != nil { recordError("Internal", err) @@ -2286,25 +2352,25 @@ func (s *Server) handleGetItemsFromCollectionRequest(args [1]string, w http.Resp return } - if err := encodeGetItemsFromCollectionResponse(response, w, span); err != nil { + if err := encodeGetConfigAllLiteServerResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetJettonInfoRequest handles getJettonInfo operation. +// handleGetDnsExpiringRequest handles getDnsExpiring operation. // -// Get jetton metadata by jetton master address. +// Get expiring .ton dns. // -// GET /v2/jettons/{account_id} -func (s *Server) handleGetJettonInfoRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/accounts/{account_id}/dns/expiring +func (s *Server) handleGetDnsExpiringRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getJettonInfo"), + otelogen.OperationID("getDnsExpiring"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetJettonInfo", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetDnsExpiring", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -2328,11 +2394,11 @@ func (s *Server) handleGetJettonInfoRequest(args [1]string, w http.ResponseWrite } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetJettonInfo", - ID: "getJettonInfo", + Name: "GetDnsExpiring", + ID: "getDnsExpiring", } ) - params, err := decodeGetJettonInfoParams(args, r) + params, err := decodeGetDnsExpiringParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -2343,26 +2409,30 @@ func (s *Server) handleGetJettonInfoRequest(args [1]string, w http.ResponseWrite return } - var response GetJettonInfoRes + var response GetDnsExpiringRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetJettonInfo", - OperationID: "getJettonInfo", + OperationName: "GetDnsExpiring", + OperationID: "getDnsExpiring", Body: nil, Params: middleware.Parameters{ { Name: "account_id", In: "path", }: params.AccountID, + { + Name: "period", + In: "query", + }: params.Period, }, Raw: r, } type ( Request = struct{} - Params = GetJettonInfoParams - Response = GetJettonInfoRes + Params = GetDnsExpiringParams + Response = GetDnsExpiringRes ) response, err = middleware.HookMiddleware[ Request, @@ -2371,13 +2441,13 @@ func (s *Server) handleGetJettonInfoRequest(args [1]string, w http.ResponseWrite ]( m, mreq, - unpackGetJettonInfoParams, + unpackGetDnsExpiringParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetJettonInfo(ctx, params) + return s.h.GetDnsExpiring(ctx, params) }, ) } else { - response, err = s.h.GetJettonInfo(ctx, params) + response, err = s.h.GetDnsExpiring(ctx, params) } if err != nil { recordError("Internal", err) @@ -2385,25 +2455,25 @@ func (s *Server) handleGetJettonInfoRequest(args [1]string, w http.ResponseWrite return } - if err := encodeGetJettonInfoResponse(response, w, span); err != nil { + if err := encodeGetDnsExpiringResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetJettonsRequest handles getJettons operation. +// handleGetDomainBidsRequest handles getDomainBids operation. // -// Get a list of all indexed jetton masters in the blockchain. +// Get domain bids. // -// GET /v2/jettons -func (s *Server) handleGetJettonsRequest(args [0]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/dns/{domain_name}/bids +func (s *Server) handleGetDomainBidsRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getJettons"), + otelogen.OperationID("getDomainBids"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetJettons", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetDomainBids", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -2427,11 +2497,11 @@ func (s *Server) handleGetJettonsRequest(args [0]string, w http.ResponseWriter, } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetJettons", - ID: "getJettons", + Name: "GetDomainBids", + ID: "getDomainBids", } ) - params, err := decodeGetJettonsParams(args, r) + params, err := decodeGetDomainBidsParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -2442,30 +2512,26 @@ func (s *Server) handleGetJettonsRequest(args [0]string, w http.ResponseWriter, return } - var response GetJettonsRes + var response GetDomainBidsRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetJettons", - OperationID: "getJettons", + OperationName: "GetDomainBids", + OperationID: "getDomainBids", Body: nil, Params: middleware.Parameters{ { - Name: "limit", - In: "query", - }: params.Limit, - { - Name: "offset", - In: "query", - }: params.Offset, + Name: "domain_name", + In: "path", + }: params.DomainName, }, Raw: r, } type ( Request = struct{} - Params = GetJettonsParams - Response = GetJettonsRes + Params = GetDomainBidsParams + Response = GetDomainBidsRes ) response, err = middleware.HookMiddleware[ Request, @@ -2474,13 +2540,13 @@ func (s *Server) handleGetJettonsRequest(args [0]string, w http.ResponseWriter, ]( m, mreq, - unpackGetJettonsParams, + unpackGetDomainBidsParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetJettons(ctx, params) + return s.h.GetDomainBids(ctx, params) }, ) } else { - response, err = s.h.GetJettons(ctx, params) + response, err = s.h.GetDomainBids(ctx, params) } if err != nil { recordError("Internal", err) @@ -2488,25 +2554,30 @@ func (s *Server) handleGetJettonsRequest(args [0]string, w http.ResponseWriter, return } - if err := encodeGetJettonsResponse(response, w, span); err != nil { + if err := encodeGetDomainBidsResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetJettonsBalancesRequest handles getJettonsBalances operation. +// handleGetEventRequest handles getEvent operation. // -// Get all Jettons balances by owner address. +// Get an event either by event ID or a hash of any transaction in a trace. An event is built on top +// of a trace which is a series of transactions caused by one inbound message. TonAPI looks for known +// patterns inside the trace and splits the trace into actions, where a single action represents a +// meaningful high-level operation like a Jetton Transfer or an NFT Purchase. Actions are expected to +// be shown to users. It is advised not to build any logic on top of actions because actions can be +// changed at any time. // -// GET /v2/accounts/{account_id}/jettons -func (s *Server) handleGetJettonsBalancesRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/events/{event_id} +func (s *Server) handleGetEventRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getJettonsBalances"), + otelogen.OperationID("getEvent"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetJettonsBalances", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetEvent", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -2530,11 +2601,11 @@ func (s *Server) handleGetJettonsBalancesRequest(args [1]string, w http.Response } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetJettonsBalances", - ID: "getJettonsBalances", + Name: "GetEvent", + ID: "getEvent", } ) - params, err := decodeGetJettonsBalancesParams(args, r) + params, err := decodeGetEventParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -2545,27 +2616,31 @@ func (s *Server) handleGetJettonsBalancesRequest(args [1]string, w http.Response return } - var response GetJettonsBalancesRes + var response GetEventRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetJettonsBalances", - OperationID: "getJettonsBalances", + OperationName: "GetEvent", + OperationID: "getEvent", Body: nil, Params: middleware.Parameters{ { - Name: "account_id", + Name: "event_id", In: "path", - }: params.AccountID, + }: params.EventID, + { + Name: "Accept-Language", + In: "header", + }: params.AcceptLanguage, }, Raw: r, } type ( Request = struct{} - Params = GetJettonsBalancesParams - Response = GetJettonsBalancesRes - ) + Params = GetEventParams + Response = GetEventRes + ) response, err = middleware.HookMiddleware[ Request, Params, @@ -2573,13 +2648,13 @@ func (s *Server) handleGetJettonsBalancesRequest(args [1]string, w http.Response ]( m, mreq, - unpackGetJettonsBalancesParams, + unpackGetEventParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetJettonsBalances(ctx, params) + return s.h.GetEvent(ctx, params) }, ) } else { - response, err = s.h.GetJettonsBalances(ctx, params) + response, err = s.h.GetEvent(ctx, params) } if err != nil { recordError("Internal", err) @@ -2587,25 +2662,29 @@ func (s *Server) handleGetJettonsBalancesRequest(args [1]string, w http.Response return } - if err := encodeGetJettonsBalancesResponse(response, w, span); err != nil { + if err := encodeGetEventResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetJettonsHistoryRequest handles getJettonsHistory operation. +// handleGetEventsByAccountRequest handles getEventsByAccount operation. // -// Get the transfer jettons history for account_id. +// Get events for an account. Each event is built on top of a trace which is a series of transactions +// caused by one inbound message. TonAPI looks for known patterns inside the trace and splits the +// trace into actions, where a single action represents a meaningful high-level operation like a +// Jetton Transfer or an NFT Purchase. Actions are expected to be shown to users. It is advised not +// to build any logic on top of actions because actions can be changed at any time. // -// GET /v2/accounts/{account_id}/jettons/history -func (s *Server) handleGetJettonsHistoryRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/accounts/{account_id}/events +func (s *Server) handleGetEventsByAccountRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getJettonsHistory"), + otelogen.OperationID("getEventsByAccount"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetJettonsHistory", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetEventsByAccount", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -2629,11 +2708,11 @@ func (s *Server) handleGetJettonsHistoryRequest(args [1]string, w http.ResponseW } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetJettonsHistory", - ID: "getJettonsHistory", + Name: "GetEventsByAccount", + ID: "getEventsByAccount", } ) - params, err := decodeGetJettonsHistoryParams(args, r) + params, err := decodeGetEventsByAccountParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -2644,12 +2723,12 @@ func (s *Server) handleGetJettonsHistoryRequest(args [1]string, w http.ResponseW return } - var response GetJettonsHistoryRes + var response GetEventsByAccountRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetJettonsHistory", - OperationID: "getJettonsHistory", + OperationName: "GetEventsByAccount", + OperationID: "getEventsByAccount", Body: nil, Params: middleware.Parameters{ { @@ -2660,6 +2739,10 @@ func (s *Server) handleGetJettonsHistoryRequest(args [1]string, w http.ResponseW Name: "Accept-Language", In: "header", }: params.AcceptLanguage, + { + Name: "subject_only", + In: "query", + }: params.SubjectOnly, { Name: "before_lt", In: "query", @@ -2682,8 +2765,8 @@ func (s *Server) handleGetJettonsHistoryRequest(args [1]string, w http.ResponseW type ( Request = struct{} - Params = GetJettonsHistoryParams - Response = GetJettonsHistoryRes + Params = GetEventsByAccountParams + Response = GetEventsByAccountRes ) response, err = middleware.HookMiddleware[ Request, @@ -2692,13 +2775,13 @@ func (s *Server) handleGetJettonsHistoryRequest(args [1]string, w http.ResponseW ]( m, mreq, - unpackGetJettonsHistoryParams, + unpackGetEventsByAccountParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetJettonsHistory(ctx, params) + return s.h.GetEventsByAccount(ctx, params) }, ) } else { - response, err = s.h.GetJettonsHistory(ctx, params) + response, err = s.h.GetEventsByAccount(ctx, params) } if err != nil { recordError("Internal", err) @@ -2706,25 +2789,25 @@ func (s *Server) handleGetJettonsHistoryRequest(args [1]string, w http.ResponseW return } - if err := encodeGetJettonsHistoryResponse(response, w, span); err != nil { + if err := encodeGetEventsByAccountResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetJettonsHistoryByIDRequest handles getJettonsHistoryByID operation. +// handleGetItemsFromCollectionRequest handles getItemsFromCollection operation. // -// Get the transfer jetton history for account_id and jetton_id. +// Get NFT items from collection by collection address. // -// GET /v2/accounts/{account_id}/jettons/{jetton_id}/history -func (s *Server) handleGetJettonsHistoryByIDRequest(args [2]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/nfts/collections/{account_id}/items +func (s *Server) handleGetItemsFromCollectionRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getJettonsHistoryByID"), + otelogen.OperationID("getItemsFromCollection"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetJettonsHistoryByID", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetItemsFromCollection", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -2748,11 +2831,11 @@ func (s *Server) handleGetJettonsHistoryByIDRequest(args [2]string, w http.Respo } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetJettonsHistoryByID", - ID: "getJettonsHistoryByID", + Name: "GetItemsFromCollection", + ID: "getItemsFromCollection", } ) - params, err := decodeGetJettonsHistoryByIDParams(args, r) + params, err := decodeGetItemsFromCollectionParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -2763,50 +2846,34 @@ func (s *Server) handleGetJettonsHistoryByIDRequest(args [2]string, w http.Respo return } - var response GetJettonsHistoryByIDRes + var response GetItemsFromCollectionRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetJettonsHistoryByID", - OperationID: "getJettonsHistoryByID", + OperationName: "GetItemsFromCollection", + OperationID: "getItemsFromCollection", Body: nil, Params: middleware.Parameters{ { Name: "account_id", In: "path", }: params.AccountID, - { - Name: "jetton_id", - In: "path", - }: params.JettonID, - { - Name: "Accept-Language", - In: "header", - }: params.AcceptLanguage, - { - Name: "before_lt", - In: "query", - }: params.BeforeLt, { Name: "limit", In: "query", }: params.Limit, { - Name: "start_date", - In: "query", - }: params.StartDate, - { - Name: "end_date", + Name: "offset", In: "query", - }: params.EndDate, + }: params.Offset, }, Raw: r, } type ( Request = struct{} - Params = GetJettonsHistoryByIDParams - Response = GetJettonsHistoryByIDRes + Params = GetItemsFromCollectionParams + Response = GetItemsFromCollectionRes ) response, err = middleware.HookMiddleware[ Request, @@ -2815,13 +2882,13 @@ func (s *Server) handleGetJettonsHistoryByIDRequest(args [2]string, w http.Respo ]( m, mreq, - unpackGetJettonsHistoryByIDParams, + unpackGetItemsFromCollectionParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetJettonsHistoryByID(ctx, params) + return s.h.GetItemsFromCollection(ctx, params) }, ) } else { - response, err = s.h.GetJettonsHistoryByID(ctx, params) + response, err = s.h.GetItemsFromCollection(ctx, params) } if err != nil { recordError("Internal", err) @@ -2829,25 +2896,25 @@ func (s *Server) handleGetJettonsHistoryByIDRequest(args [2]string, w http.Respo return } - if err := encodeGetJettonsHistoryByIDResponse(response, w, span); err != nil { + if err := encodeGetItemsFromCollectionResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetMasterchainHeadRequest handles getMasterchainHead operation. +// handleGetJettonInfoRequest handles getJettonInfo operation. // -// Get last known masterchain block. +// Get jetton metadata by jetton master address. // -// GET /v2/blockchain/masterchain-head -func (s *Server) handleGetMasterchainHeadRequest(args [0]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/jettons/{account_id} +func (s *Server) handleGetJettonInfoRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getMasterchainHead"), + otelogen.OperationID("getJettonInfo"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetMasterchainHead", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetJettonInfo", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -2869,24 +2936,43 @@ func (s *Server) handleGetMasterchainHeadRequest(args [0]string, w http.Response span.SetStatus(codes.Error, stage) s.errors.Add(ctx, 1, otelAttrs...) } - err error + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetJettonInfo", + ID: "getJettonInfo", + } ) + params, err := decodeGetJettonInfoParams(args, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } - var response GetMasterchainHeadRes + var response GetJettonInfoRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetMasterchainHead", - OperationID: "getMasterchainHead", + OperationName: "GetJettonInfo", + OperationID: "getJettonInfo", Body: nil, - Params: middleware.Parameters{}, - Raw: r, + Params: middleware.Parameters{ + { + Name: "account_id", + In: "path", + }: params.AccountID, + }, + Raw: r, } type ( Request = struct{} - Params = struct{} - Response = GetMasterchainHeadRes + Params = GetJettonInfoParams + Response = GetJettonInfoRes ) response, err = middleware.HookMiddleware[ Request, @@ -2895,13 +2981,13 @@ func (s *Server) handleGetMasterchainHeadRequest(args [0]string, w http.Response ]( m, mreq, - nil, + unpackGetJettonInfoParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetMasterchainHead(ctx) + return s.h.GetJettonInfo(ctx, params) }, ) } else { - response, err = s.h.GetMasterchainHead(ctx) + response, err = s.h.GetJettonInfo(ctx, params) } if err != nil { recordError("Internal", err) @@ -2909,25 +2995,25 @@ func (s *Server) handleGetMasterchainHeadRequest(args [0]string, w http.Response return } - if err := encodeGetMasterchainHeadResponse(response, w, span); err != nil { + if err := encodeGetJettonInfoResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetNftCollectionRequest handles getNftCollection operation. +// handleGetJettonsRequest handles getJettons operation. // -// Get NFT collection by collection address. +// Get a list of all indexed jetton masters in the blockchain. // -// GET /v2/nfts/collections/{account_id} -func (s *Server) handleGetNftCollectionRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/jettons +func (s *Server) handleGetJettonsRequest(args [0]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getNftCollection"), + otelogen.OperationID("getJettons"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetNftCollection", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetJettons", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -2951,11 +3037,11 @@ func (s *Server) handleGetNftCollectionRequest(args [1]string, w http.ResponseWr } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetNftCollection", - ID: "getNftCollection", + Name: "GetJettons", + ID: "getJettons", } ) - params, err := decodeGetNftCollectionParams(args, r) + params, err := decodeGetJettonsParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -2966,26 +3052,30 @@ func (s *Server) handleGetNftCollectionRequest(args [1]string, w http.ResponseWr return } - var response GetNftCollectionRes + var response GetJettonsRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetNftCollection", - OperationID: "getNftCollection", + OperationName: "GetJettons", + OperationID: "getJettons", Body: nil, Params: middleware.Parameters{ { - Name: "account_id", - In: "path", - }: params.AccountID, + Name: "limit", + In: "query", + }: params.Limit, + { + Name: "offset", + In: "query", + }: params.Offset, }, Raw: r, } type ( Request = struct{} - Params = GetNftCollectionParams - Response = GetNftCollectionRes + Params = GetJettonsParams + Response = GetJettonsRes ) response, err = middleware.HookMiddleware[ Request, @@ -2994,13 +3084,13 @@ func (s *Server) handleGetNftCollectionRequest(args [1]string, w http.ResponseWr ]( m, mreq, - unpackGetNftCollectionParams, + unpackGetJettonsParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetNftCollection(ctx, params) + return s.h.GetJettons(ctx, params) }, ) } else { - response, err = s.h.GetNftCollection(ctx, params) + response, err = s.h.GetJettons(ctx, params) } if err != nil { recordError("Internal", err) @@ -3008,25 +3098,25 @@ func (s *Server) handleGetNftCollectionRequest(args [1]string, w http.ResponseWr return } - if err := encodeGetNftCollectionResponse(response, w, span); err != nil { + if err := encodeGetJettonsResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetNftCollectionsRequest handles getNftCollections operation. +// handleGetJettonsBalancesRequest handles getJettonsBalances operation. // -// Get NFT collections. +// Get all Jettons balances by owner address. // -// GET /v2/nfts/collections -func (s *Server) handleGetNftCollectionsRequest(args [0]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/accounts/{account_id}/jettons +func (s *Server) handleGetJettonsBalancesRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getNftCollections"), + otelogen.OperationID("getJettonsBalances"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetNftCollections", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetJettonsBalances", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -3050,11 +3140,11 @@ func (s *Server) handleGetNftCollectionsRequest(args [0]string, w http.ResponseW } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetNftCollections", - ID: "getNftCollections", + Name: "GetJettonsBalances", + ID: "getJettonsBalances", } ) - params, err := decodeGetNftCollectionsParams(args, r) + params, err := decodeGetJettonsBalancesParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -3065,30 +3155,26 @@ func (s *Server) handleGetNftCollectionsRequest(args [0]string, w http.ResponseW return } - var response GetNftCollectionsRes + var response GetJettonsBalancesRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetNftCollections", - OperationID: "getNftCollections", + OperationName: "GetJettonsBalances", + OperationID: "getJettonsBalances", Body: nil, Params: middleware.Parameters{ { - Name: "limit", - In: "query", - }: params.Limit, - { - Name: "offset", - In: "query", - }: params.Offset, + Name: "account_id", + In: "path", + }: params.AccountID, }, Raw: r, } type ( Request = struct{} - Params = GetNftCollectionsParams - Response = GetNftCollectionsRes + Params = GetJettonsBalancesParams + Response = GetJettonsBalancesRes ) response, err = middleware.HookMiddleware[ Request, @@ -3097,13 +3183,1144 @@ func (s *Server) handleGetNftCollectionsRequest(args [0]string, w http.ResponseW ]( m, mreq, - unpackGetNftCollectionsParams, + unpackGetJettonsBalancesParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetNftCollections(ctx, params) + return s.h.GetJettonsBalances(ctx, params) + }, + ) + } else { + response, err = s.h.GetJettonsBalances(ctx, params) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetJettonsBalancesResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + +// handleGetJettonsHistoryRequest handles getJettonsHistory operation. +// +// Get the transfer jettons history for account_id. +// +// GET /v2/accounts/{account_id}/jettons/history +func (s *Server) handleGetJettonsHistoryRequest(args [1]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getJettonsHistory"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetJettonsHistory", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetJettonsHistory", + ID: "getJettonsHistory", + } + ) + params, err := decodeGetJettonsHistoryParams(args, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var response GetJettonsHistoryRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetJettonsHistory", + OperationID: "getJettonsHistory", + Body: nil, + Params: middleware.Parameters{ + { + Name: "account_id", + In: "path", + }: params.AccountID, + { + Name: "Accept-Language", + In: "header", + }: params.AcceptLanguage, + { + Name: "before_lt", + In: "query", + }: params.BeforeLt, + { + Name: "limit", + In: "query", + }: params.Limit, + { + Name: "start_date", + In: "query", + }: params.StartDate, + { + Name: "end_date", + In: "query", + }: params.EndDate, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetJettonsHistoryParams + Response = GetJettonsHistoryRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetJettonsHistoryParams, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetJettonsHistory(ctx, params) + }, + ) + } else { + response, err = s.h.GetJettonsHistory(ctx, params) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetJettonsHistoryResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + +// handleGetJettonsHistoryByIDRequest handles getJettonsHistoryByID operation. +// +// Get the transfer jetton history for account_id and jetton_id. +// +// GET /v2/accounts/{account_id}/jettons/{jetton_id}/history +func (s *Server) handleGetJettonsHistoryByIDRequest(args [2]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getJettonsHistoryByID"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetJettonsHistoryByID", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetJettonsHistoryByID", + ID: "getJettonsHistoryByID", + } + ) + params, err := decodeGetJettonsHistoryByIDParams(args, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var response GetJettonsHistoryByIDRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetJettonsHistoryByID", + OperationID: "getJettonsHistoryByID", + Body: nil, + Params: middleware.Parameters{ + { + Name: "account_id", + In: "path", + }: params.AccountID, + { + Name: "jetton_id", + In: "path", + }: params.JettonID, + { + Name: "Accept-Language", + In: "header", + }: params.AcceptLanguage, + { + Name: "before_lt", + In: "query", + }: params.BeforeLt, + { + Name: "limit", + In: "query", + }: params.Limit, + { + Name: "start_date", + In: "query", + }: params.StartDate, + { + Name: "end_date", + In: "query", + }: params.EndDate, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetJettonsHistoryByIDParams + Response = GetJettonsHistoryByIDRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetJettonsHistoryByIDParams, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetJettonsHistoryByID(ctx, params) + }, + ) + } else { + response, err = s.h.GetJettonsHistoryByID(ctx, params) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetJettonsHistoryByIDResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + +// handleGetListBlockTransactionsLiteServerRequest handles getListBlockTransactionsLiteServer operation. +// +// Get list block transactions. +// +// GET /v2/liteserver/list_block_transactions/{block_id} +func (s *Server) handleGetListBlockTransactionsLiteServerRequest(args [1]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getListBlockTransactionsLiteServer"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetListBlockTransactionsLiteServer", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetListBlockTransactionsLiteServer", + ID: "getListBlockTransactionsLiteServer", + } + ) + params, err := decodeGetListBlockTransactionsLiteServerParams(args, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var response GetListBlockTransactionsLiteServerRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetListBlockTransactionsLiteServer", + OperationID: "getListBlockTransactionsLiteServer", + Body: nil, + Params: middleware.Parameters{ + { + Name: "block_id", + In: "path", + }: params.BlockID, + { + Name: "mode", + In: "query", + }: params.Mode, + { + Name: "count", + In: "query", + }: params.Count, + { + Name: "account_id", + In: "query", + }: params.AccountID, + { + Name: "lt", + In: "query", + }: params.Lt, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetListBlockTransactionsLiteServerParams + Response = GetListBlockTransactionsLiteServerRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetListBlockTransactionsLiteServerParams, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetListBlockTransactionsLiteServer(ctx, params) + }, + ) + } else { + response, err = s.h.GetListBlockTransactionsLiteServer(ctx, params) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetListBlockTransactionsLiteServerResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + +// handleGetMasterchainHeadRequest handles getMasterchainHead operation. +// +// Get last known masterchain block. +// +// GET /v2/blockchain/masterchain-head +func (s *Server) handleGetMasterchainHeadRequest(args [0]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getMasterchainHead"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetMasterchainHead", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + ) + + var response GetMasterchainHeadRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetMasterchainHead", + OperationID: "getMasterchainHead", + Body: nil, + Params: middleware.Parameters{}, + Raw: r, + } + + type ( + Request = struct{} + Params = struct{} + Response = GetMasterchainHeadRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + nil, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetMasterchainHead(ctx) + }, + ) + } else { + response, err = s.h.GetMasterchainHead(ctx) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetMasterchainHeadResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + +// handleGetMasterchainInfoExtLiteServerRequest handles getMasterchainInfoExtLiteServer operation. +// +// Get masterchain info ext. +// +// GET /v2/liteserver/get_masterchain_info_ext +func (s *Server) handleGetMasterchainInfoExtLiteServerRequest(args [0]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getMasterchainInfoExtLiteServer"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetMasterchainInfoExtLiteServer", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetMasterchainInfoExtLiteServer", + ID: "getMasterchainInfoExtLiteServer", + } + ) + params, err := decodeGetMasterchainInfoExtLiteServerParams(args, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var response GetMasterchainInfoExtLiteServerRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetMasterchainInfoExtLiteServer", + OperationID: "getMasterchainInfoExtLiteServer", + Body: nil, + Params: middleware.Parameters{ + { + Name: "mode", + In: "query", + }: params.Mode, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetMasterchainInfoExtLiteServerParams + Response = GetMasterchainInfoExtLiteServerRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetMasterchainInfoExtLiteServerParams, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetMasterchainInfoExtLiteServer(ctx, params) + }, + ) + } else { + response, err = s.h.GetMasterchainInfoExtLiteServer(ctx, params) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetMasterchainInfoExtLiteServerResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + +// handleGetMasterchainInfoLiteServerRequest handles getMasterchainInfoLiteServer operation. +// +// Get masterchain info. +// +// GET /v2/liteserver/get_masterchain_info +func (s *Server) handleGetMasterchainInfoLiteServerRequest(args [0]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getMasterchainInfoLiteServer"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetMasterchainInfoLiteServer", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + ) + + var response GetMasterchainInfoLiteServerRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetMasterchainInfoLiteServer", + OperationID: "getMasterchainInfoLiteServer", + Body: nil, + Params: middleware.Parameters{}, + Raw: r, + } + + type ( + Request = struct{} + Params = struct{} + Response = GetMasterchainInfoLiteServerRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + nil, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetMasterchainInfoLiteServer(ctx) + }, + ) + } else { + response, err = s.h.GetMasterchainInfoLiteServer(ctx) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetMasterchainInfoLiteServerResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + +// handleGetNftCollectionRequest handles getNftCollection operation. +// +// Get NFT collection by collection address. +// +// GET /v2/nfts/collections/{account_id} +func (s *Server) handleGetNftCollectionRequest(args [1]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getNftCollection"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetNftCollection", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetNftCollection", + ID: "getNftCollection", + } + ) + params, err := decodeGetNftCollectionParams(args, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var response GetNftCollectionRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetNftCollection", + OperationID: "getNftCollection", + Body: nil, + Params: middleware.Parameters{ + { + Name: "account_id", + In: "path", + }: params.AccountID, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetNftCollectionParams + Response = GetNftCollectionRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetNftCollectionParams, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetNftCollection(ctx, params) + }, + ) + } else { + response, err = s.h.GetNftCollection(ctx, params) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetNftCollectionResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + +// handleGetNftCollectionsRequest handles getNftCollections operation. +// +// Get NFT collections. +// +// GET /v2/nfts/collections +func (s *Server) handleGetNftCollectionsRequest(args [0]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getNftCollections"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetNftCollections", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetNftCollections", + ID: "getNftCollections", + } + ) + params, err := decodeGetNftCollectionsParams(args, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var response GetNftCollectionsRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetNftCollections", + OperationID: "getNftCollections", + Body: nil, + Params: middleware.Parameters{ + { + Name: "limit", + In: "query", + }: params.Limit, + { + Name: "offset", + In: "query", + }: params.Offset, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetNftCollectionsParams + Response = GetNftCollectionsRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetNftCollectionsParams, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetNftCollections(ctx, params) + }, + ) + } else { + response, err = s.h.GetNftCollections(ctx, params) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetNftCollectionsResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + +// handleGetNftItemByAddressRequest handles getNftItemByAddress operation. +// +// Get NFT item by its address. +// +// GET /v2/nfts/{account_id} +func (s *Server) handleGetNftItemByAddressRequest(args [1]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getNftItemByAddress"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetNftItemByAddress", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetNftItemByAddress", + ID: "getNftItemByAddress", + } + ) + params, err := decodeGetNftItemByAddressParams(args, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var response GetNftItemByAddressRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetNftItemByAddress", + OperationID: "getNftItemByAddress", + Body: nil, + Params: middleware.Parameters{ + { + Name: "account_id", + In: "path", + }: params.AccountID, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetNftItemByAddressParams + Response = GetNftItemByAddressRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetNftItemByAddressParams, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetNftItemByAddress(ctx, params) + }, + ) + } else { + response, err = s.h.GetNftItemByAddress(ctx, params) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetNftItemByAddressResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + +// handleGetNftItemsByAddressesRequest handles getNftItemsByAddresses operation. +// +// Get NFT items by their addresses. +// +// POST /v2/nfts/_bulk +func (s *Server) handleGetNftItemsByAddressesRequest(args [0]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getNftItemsByAddresses"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetNftItemsByAddresses", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetNftItemsByAddresses", + ID: "getNftItemsByAddresses", + } + ) + request, close, err := s.decodeGetNftItemsByAddressesRequest(r) + if err != nil { + err = &ogenerrors.DecodeRequestError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeRequest", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + defer func() { + if err := close(); err != nil { + recordError("CloseRequest", err) + } + }() + + var response GetNftItemsByAddressesRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetNftItemsByAddresses", + OperationID: "getNftItemsByAddresses", + Body: request, + Params: middleware.Parameters{}, + Raw: r, + } + + type ( + Request = OptGetNftItemsByAddressesReq + Params = struct{} + Response = GetNftItemsByAddressesRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + nil, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetNftItemsByAddresses(ctx, request) + }, + ) + } else { + response, err = s.h.GetNftItemsByAddresses(ctx, request) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetNftItemsByAddressesResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + +// handleGetNftItemsByOwnerRequest handles getNftItemsByOwner operation. +// +// Get all NFT items by owner address. +// +// GET /v2/accounts/{account_id}/nfts +func (s *Server) handleGetNftItemsByOwnerRequest(args [1]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getNftItemsByOwner"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetNftItemsByOwner", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetNftItemsByOwner", + ID: "getNftItemsByOwner", + } + ) + params, err := decodeGetNftItemsByOwnerParams(args, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var response GetNftItemsByOwnerRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetNftItemsByOwner", + OperationID: "getNftItemsByOwner", + Body: nil, + Params: middleware.Parameters{ + { + Name: "account_id", + In: "path", + }: params.AccountID, + { + Name: "collection", + In: "query", + }: params.Collection, + { + Name: "limit", + In: "query", + }: params.Limit, + { + Name: "offset", + In: "query", + }: params.Offset, + { + Name: "indirect_ownership", + In: "query", + }: params.IndirectOwnership, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetNftItemsByOwnerParams + Response = GetNftItemsByOwnerRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetNftItemsByOwnerParams, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetNftItemsByOwner(ctx, params) }, ) } else { - response, err = s.h.GetNftCollections(ctx, params) + response, err = s.h.GetNftItemsByOwner(ctx, params) } if err != nil { recordError("Internal", err) @@ -3111,25 +4328,25 @@ func (s *Server) handleGetNftCollectionsRequest(args [0]string, w http.ResponseW return } - if err := encodeGetNftCollectionsResponse(response, w, span); err != nil { + if err := encodeGetNftItemsByOwnerResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetNftItemByAddressRequest handles getNftItemByAddress operation. +// handleGetPublicKeyByAccountIDRequest handles getPublicKeyByAccountID operation. // -// Get NFT item by its address. +// Get public key by account id. // -// GET /v2/nfts/{account_id} -func (s *Server) handleGetNftItemByAddressRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/accounts/{account_id}/publickey +func (s *Server) handleGetPublicKeyByAccountIDRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getNftItemByAddress"), + otelogen.OperationID("getPublicKeyByAccountID"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetNftItemByAddress", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetPublicKeyByAccountID", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -3153,11 +4370,11 @@ func (s *Server) handleGetNftItemByAddressRequest(args [1]string, w http.Respons } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetNftItemByAddress", - ID: "getNftItemByAddress", + Name: "GetPublicKeyByAccountID", + ID: "getPublicKeyByAccountID", } ) - params, err := decodeGetNftItemByAddressParams(args, r) + params, err := decodeGetPublicKeyByAccountIDParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -3168,12 +4385,12 @@ func (s *Server) handleGetNftItemByAddressRequest(args [1]string, w http.Respons return } - var response GetNftItemByAddressRes + var response GetPublicKeyByAccountIDRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetNftItemByAddress", - OperationID: "getNftItemByAddress", + OperationName: "GetPublicKeyByAccountID", + OperationID: "getPublicKeyByAccountID", Body: nil, Params: middleware.Parameters{ { @@ -3186,8 +4403,8 @@ func (s *Server) handleGetNftItemByAddressRequest(args [1]string, w http.Respons type ( Request = struct{} - Params = GetNftItemByAddressParams - Response = GetNftItemByAddressRes + Params = GetPublicKeyByAccountIDParams + Response = GetPublicKeyByAccountIDRes ) response, err = middleware.HookMiddleware[ Request, @@ -3196,13 +4413,13 @@ func (s *Server) handleGetNftItemByAddressRequest(args [1]string, w http.Respons ]( m, mreq, - unpackGetNftItemByAddressParams, + unpackGetPublicKeyByAccountIDParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetNftItemByAddress(ctx, params) + return s.h.GetPublicKeyByAccountID(ctx, params) }, ) } else { - response, err = s.h.GetNftItemByAddress(ctx, params) + response, err = s.h.GetPublicKeyByAccountID(ctx, params) } if err != nil { recordError("Internal", err) @@ -3210,25 +4427,25 @@ func (s *Server) handleGetNftItemByAddressRequest(args [1]string, w http.Respons return } - if err := encodeGetNftItemByAddressResponse(response, w, span); err != nil { + if err := encodeGetPublicKeyByAccountIDResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetNftItemsByAddressesRequest handles getNftItemsByAddresses operation. +// handleGetRatesRequest handles getRates operation. // -// Get NFT items by their addresses. +// Get the token price to the currency. // -// POST /v2/nfts/_bulk -func (s *Server) handleGetNftItemsByAddressesRequest(args [0]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/rates +func (s *Server) handleGetRatesRequest(args [0]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getNftItemsByAddresses"), + otelogen.OperationID("getRates"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetNftItemsByAddresses", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetRates", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -3252,41 +4469,45 @@ func (s *Server) handleGetNftItemsByAddressesRequest(args [0]string, w http.Resp } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetNftItemsByAddresses", - ID: "getNftItemsByAddresses", + Name: "GetRates", + ID: "getRates", } ) - request, close, err := s.decodeGetNftItemsByAddressesRequest(r) + params, err := decodeGetRatesParams(args, r) if err != nil { - err = &ogenerrors.DecodeRequestError{ + err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, Err: err, } - recordError("DecodeRequest", err) + recordError("DecodeParams", err) s.cfg.ErrorHandler(ctx, w, r, err) return } - defer func() { - if err := close(); err != nil { - recordError("CloseRequest", err) - } - }() - var response GetNftItemsByAddressesRes + var response GetRatesRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetNftItemsByAddresses", - OperationID: "getNftItemsByAddresses", - Body: request, - Params: middleware.Parameters{}, - Raw: r, + OperationName: "GetRates", + OperationID: "getRates", + Body: nil, + Params: middleware.Parameters{ + { + Name: "tokens", + In: "query", + }: params.Tokens, + { + Name: "currencies", + In: "query", + }: params.Currencies, + }, + Raw: r, } type ( - Request = OptGetNftItemsByAddressesReq - Params = struct{} - Response = GetNftItemsByAddressesRes + Request = struct{} + Params = GetRatesParams + Response = GetRatesRes ) response, err = middleware.HookMiddleware[ Request, @@ -3295,13 +4516,13 @@ func (s *Server) handleGetNftItemsByAddressesRequest(args [0]string, w http.Resp ]( m, mreq, - nil, + unpackGetRatesParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetNftItemsByAddresses(ctx, request) + return s.h.GetRates(ctx, params) }, ) } else { - response, err = s.h.GetNftItemsByAddresses(ctx, request) + response, err = s.h.GetRates(ctx, params) } if err != nil { recordError("Internal", err) @@ -3309,25 +4530,25 @@ func (s *Server) handleGetNftItemsByAddressesRequest(args [0]string, w http.Resp return } - if err := encodeGetNftItemsByAddressesResponse(response, w, span); err != nil { + if err := encodeGetRatesResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetNftItemsByOwnerRequest handles getNftItemsByOwner operation. +// handleGetRawAccountRequest handles getRawAccount operation. // -// Get all NFT items by owner address. +// Get low-level information about an account taken directly from the blockchain. // -// GET /v2/accounts/{account_id}/nfts -func (s *Server) handleGetNftItemsByOwnerRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/blockchain/accounts/{account_id} +func (s *Server) handleGetRawAccountRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getNftItemsByOwner"), + otelogen.OperationID("getRawAccount"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetNftItemsByOwner", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetRawAccount", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -3351,11 +4572,11 @@ func (s *Server) handleGetNftItemsByOwnerRequest(args [1]string, w http.Response } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetNftItemsByOwner", - ID: "getNftItemsByOwner", + Name: "GetRawAccount", + ID: "getRawAccount", } ) - params, err := decodeGetNftItemsByOwnerParams(args, r) + params, err := decodeGetRawAccountParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -3366,42 +4587,26 @@ func (s *Server) handleGetNftItemsByOwnerRequest(args [1]string, w http.Response return } - var response GetNftItemsByOwnerRes + var response GetRawAccountRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetNftItemsByOwner", - OperationID: "getNftItemsByOwner", + OperationName: "GetRawAccount", + OperationID: "getRawAccount", Body: nil, Params: middleware.Parameters{ { Name: "account_id", In: "path", }: params.AccountID, - { - Name: "collection", - In: "query", - }: params.Collection, - { - Name: "limit", - In: "query", - }: params.Limit, - { - Name: "offset", - In: "query", - }: params.Offset, - { - Name: "indirect_ownership", - In: "query", - }: params.IndirectOwnership, }, Raw: r, } type ( Request = struct{} - Params = GetNftItemsByOwnerParams - Response = GetNftItemsByOwnerRes + Params = GetRawAccountParams + Response = GetRawAccountRes ) response, err = middleware.HookMiddleware[ Request, @@ -3410,13 +4615,13 @@ func (s *Server) handleGetNftItemsByOwnerRequest(args [1]string, w http.Response ]( m, mreq, - unpackGetNftItemsByOwnerParams, + unpackGetRawAccountParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetNftItemsByOwner(ctx, params) + return s.h.GetRawAccount(ctx, params) }, ) } else { - response, err = s.h.GetNftItemsByOwner(ctx, params) + response, err = s.h.GetRawAccount(ctx, params) } if err != nil { recordError("Internal", err) @@ -3424,25 +4629,25 @@ func (s *Server) handleGetNftItemsByOwnerRequest(args [1]string, w http.Response return } - if err := encodeGetNftItemsByOwnerResponse(response, w, span); err != nil { + if err := encodeGetRawAccountResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetPublicKeyByAccountIDRequest handles getPublicKeyByAccountID operation. +// handleGetSearchAccountsRequest handles getSearchAccounts operation. // -// Get public key by account id. +// Search for accounts by name. You can find the account by the first characters of the domain. // -// GET /v2/accounts/{account_id}/publickey -func (s *Server) handleGetPublicKeyByAccountIDRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/accounts/search +func (s *Server) handleGetSearchAccountsRequest(args [0]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getPublicKeyByAccountID"), + otelogen.OperationID("getSearchAccounts"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetPublicKeyByAccountID", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetSearchAccounts", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -3466,11 +4671,11 @@ func (s *Server) handleGetPublicKeyByAccountIDRequest(args [1]string, w http.Res } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetPublicKeyByAccountID", - ID: "getPublicKeyByAccountID", + Name: "GetSearchAccounts", + ID: "getSearchAccounts", } ) - params, err := decodeGetPublicKeyByAccountIDParams(args, r) + params, err := decodeGetSearchAccountsParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -3481,26 +4686,26 @@ func (s *Server) handleGetPublicKeyByAccountIDRequest(args [1]string, w http.Res return } - var response GetPublicKeyByAccountIDRes + var response GetSearchAccountsRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetPublicKeyByAccountID", - OperationID: "getPublicKeyByAccountID", + OperationName: "GetSearchAccounts", + OperationID: "getSearchAccounts", Body: nil, Params: middleware.Parameters{ { - Name: "account_id", - In: "path", - }: params.AccountID, + Name: "name", + In: "query", + }: params.Name, }, Raw: r, } type ( Request = struct{} - Params = GetPublicKeyByAccountIDParams - Response = GetPublicKeyByAccountIDRes + Params = GetSearchAccountsParams + Response = GetSearchAccountsRes ) response, err = middleware.HookMiddleware[ Request, @@ -3509,13 +4714,13 @@ func (s *Server) handleGetPublicKeyByAccountIDRequest(args [1]string, w http.Res ]( m, mreq, - unpackGetPublicKeyByAccountIDParams, + unpackGetSearchAccountsParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetPublicKeyByAccountID(ctx, params) + return s.h.GetSearchAccounts(ctx, params) }, ) } else { - response, err = s.h.GetPublicKeyByAccountID(ctx, params) + response, err = s.h.GetSearchAccounts(ctx, params) } if err != nil { recordError("Internal", err) @@ -3523,25 +4728,25 @@ func (s *Server) handleGetPublicKeyByAccountIDRequest(args [1]string, w http.Res return } - if err := encodeGetPublicKeyByAccountIDResponse(response, w, span); err != nil { + if err := encodeGetSearchAccountsResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetRatesRequest handles getRates operation. +// handleGetShardBlockProofLiteServerRequest handles getShardBlockProofLiteServer operation. // -// Get the token price to the currency. +// Get shard block proof. // -// GET /v2/rates -func (s *Server) handleGetRatesRequest(args [0]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/liteserver/get_shard_block_proof/{block_id} +func (s *Server) handleGetShardBlockProofLiteServerRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getRates"), + otelogen.OperationID("getShardBlockProofLiteServer"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetRates", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetShardBlockProofLiteServer", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -3565,11 +4770,11 @@ func (s *Server) handleGetRatesRequest(args [0]string, w http.ResponseWriter, r } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetRates", - ID: "getRates", + Name: "GetShardBlockProofLiteServer", + ID: "getShardBlockProofLiteServer", } ) - params, err := decodeGetRatesParams(args, r) + params, err := decodeGetShardBlockProofLiteServerParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -3580,30 +4785,26 @@ func (s *Server) handleGetRatesRequest(args [0]string, w http.ResponseWriter, r return } - var response GetRatesRes + var response GetShardBlockProofLiteServerRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetRates", - OperationID: "getRates", + OperationName: "GetShardBlockProofLiteServer", + OperationID: "getShardBlockProofLiteServer", Body: nil, Params: middleware.Parameters{ { - Name: "tokens", - In: "query", - }: params.Tokens, - { - Name: "currencies", - In: "query", - }: params.Currencies, + Name: "block_id", + In: "path", + }: params.BlockID, }, Raw: r, } type ( Request = struct{} - Params = GetRatesParams - Response = GetRatesRes + Params = GetShardBlockProofLiteServerParams + Response = GetShardBlockProofLiteServerRes ) response, err = middleware.HookMiddleware[ Request, @@ -3612,13 +4813,13 @@ func (s *Server) handleGetRatesRequest(args [0]string, w http.ResponseWriter, r ]( m, mreq, - unpackGetRatesParams, + unpackGetShardBlockProofLiteServerParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetRates(ctx, params) + return s.h.GetShardBlockProofLiteServer(ctx, params) }, ) } else { - response, err = s.h.GetRates(ctx, params) + response, err = s.h.GetShardBlockProofLiteServer(ctx, params) } if err != nil { recordError("Internal", err) @@ -3626,25 +4827,25 @@ func (s *Server) handleGetRatesRequest(args [0]string, w http.ResponseWriter, r return } - if err := encodeGetRatesResponse(response, w, span); err != nil { + if err := encodeGetShardBlockProofLiteServerResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetRawAccountRequest handles getRawAccount operation. +// handleGetShardInfoLiteServerRequest handles getShardInfoLiteServer operation. // -// Get low-level information about an account taken directly from the blockchain. +// Get shard info. // -// GET /v2/blockchain/accounts/{account_id} -func (s *Server) handleGetRawAccountRequest(args [1]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/liteserver/get_shard_info/{block_id} +func (s *Server) handleGetShardInfoLiteServerRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getRawAccount"), + otelogen.OperationID("getShardInfoLiteServer"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetRawAccount", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetShardInfoLiteServer", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -3668,11 +4869,11 @@ func (s *Server) handleGetRawAccountRequest(args [1]string, w http.ResponseWrite } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetRawAccount", - ID: "getRawAccount", + Name: "GetShardInfoLiteServer", + ID: "getShardInfoLiteServer", } ) - params, err := decodeGetRawAccountParams(args, r) + params, err := decodeGetShardInfoLiteServerParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -3683,26 +4884,38 @@ func (s *Server) handleGetRawAccountRequest(args [1]string, w http.ResponseWrite return } - var response GetRawAccountRes + var response GetShardInfoLiteServerRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetRawAccount", - OperationID: "getRawAccount", + OperationName: "GetShardInfoLiteServer", + OperationID: "getShardInfoLiteServer", Body: nil, Params: middleware.Parameters{ { - Name: "account_id", + Name: "block_id", In: "path", - }: params.AccountID, + }: params.BlockID, + { + Name: "workchain", + In: "query", + }: params.Workchain, + { + Name: "shard", + In: "query", + }: params.Shard, + { + Name: "exact", + In: "query", + }: params.Exact, }, Raw: r, } type ( Request = struct{} - Params = GetRawAccountParams - Response = GetRawAccountRes + Params = GetShardInfoLiteServerParams + Response = GetShardInfoLiteServerRes ) response, err = middleware.HookMiddleware[ Request, @@ -3711,13 +4924,13 @@ func (s *Server) handleGetRawAccountRequest(args [1]string, w http.ResponseWrite ]( m, mreq, - unpackGetRawAccountParams, + unpackGetShardInfoLiteServerParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetRawAccount(ctx, params) + return s.h.GetShardInfoLiteServer(ctx, params) }, ) } else { - response, err = s.h.GetRawAccount(ctx, params) + response, err = s.h.GetShardInfoLiteServer(ctx, params) } if err != nil { recordError("Internal", err) @@ -3725,25 +4938,25 @@ func (s *Server) handleGetRawAccountRequest(args [1]string, w http.ResponseWrite return } - if err := encodeGetRawAccountResponse(response, w, span); err != nil { + if err := encodeGetShardInfoLiteServerResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return } } -// handleGetSearchAccountsRequest handles getSearchAccounts operation. +// handleGetStateLiteServerRequest handles getStateLiteServer operation. // -// Search for accounts by name. You can find the account by the first characters of the domain. +// Get block state. // -// GET /v2/accounts/search -func (s *Server) handleGetSearchAccountsRequest(args [0]string, w http.ResponseWriter, r *http.Request) { +// GET /v2/liteserver/get_state/{block_id} +func (s *Server) handleGetStateLiteServerRequest(args [1]string, w http.ResponseWriter, r *http.Request) { otelAttrs := []attribute.KeyValue{ - otelogen.OperationID("getSearchAccounts"), + otelogen.OperationID("getStateLiteServer"), } // Start a span for this request. - ctx, span := s.cfg.Tracer.Start(r.Context(), "GetSearchAccounts", + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetStateLiteServer", trace.WithAttributes(otelAttrs...), serverSpanKind, ) @@ -3767,11 +4980,11 @@ func (s *Server) handleGetSearchAccountsRequest(args [0]string, w http.ResponseW } err error opErrContext = ogenerrors.OperationContext{ - Name: "GetSearchAccounts", - ID: "getSearchAccounts", + Name: "GetStateLiteServer", + ID: "getStateLiteServer", } ) - params, err := decodeGetSearchAccountsParams(args, r) + params, err := decodeGetStateLiteServerParams(args, r) if err != nil { err = &ogenerrors.DecodeParamsError{ OperationContext: opErrContext, @@ -3782,26 +4995,26 @@ func (s *Server) handleGetSearchAccountsRequest(args [0]string, w http.ResponseW return } - var response GetSearchAccountsRes + var response GetStateLiteServerRes if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, - OperationName: "GetSearchAccounts", - OperationID: "getSearchAccounts", + OperationName: "GetStateLiteServer", + OperationID: "getStateLiteServer", Body: nil, Params: middleware.Parameters{ { - Name: "name", - In: "query", - }: params.Name, + Name: "block_id", + In: "path", + }: params.BlockID, }, Raw: r, } type ( Request = struct{} - Params = GetSearchAccountsParams - Response = GetSearchAccountsRes + Params = GetStateLiteServerParams + Response = GetStateLiteServerRes ) response, err = middleware.HookMiddleware[ Request, @@ -3810,13 +5023,13 @@ func (s *Server) handleGetSearchAccountsRequest(args [0]string, w http.ResponseW ]( m, mreq, - unpackGetSearchAccountsParams, + unpackGetStateLiteServerParams, func(ctx context.Context, request Request, params Params) (Response, error) { - return s.h.GetSearchAccounts(ctx, params) + return s.h.GetStateLiteServer(ctx, params) }, ) } else { - response, err = s.h.GetSearchAccounts(ctx, params) + response, err = s.h.GetStateLiteServer(ctx, params) } if err != nil { recordError("Internal", err) @@ -3824,7 +5037,7 @@ func (s *Server) handleGetSearchAccountsRequest(args [0]string, w http.ResponseW return } - if err := encodeGetSearchAccountsResponse(response, w, span); err != nil { + if err := encodeGetStateLiteServerResponse(response, w, span); err != nil { recordError("EncodeResponse", err) s.cfg.ErrorHandler(ctx, w, r, err) return @@ -4010,6 +5223,86 @@ func (s *Server) handleGetSubscriptionsByAccountRequest(args [1]string, w http.R } } +// handleGetTimeLiteServerRequest handles getTimeLiteServer operation. +// +// Get time. +// +// GET /v2/liteserver/get_time +func (s *Server) handleGetTimeLiteServerRequest(args [0]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getTimeLiteServer"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetTimeLiteServer", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + ) + + var response GetTimeLiteServerRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetTimeLiteServer", + OperationID: "getTimeLiteServer", + Body: nil, + Params: middleware.Parameters{}, + Raw: r, + } + + type ( + Request = struct{} + Params = struct{} + Response = GetTimeLiteServerRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + nil, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetTimeLiteServer(ctx) + }, + ) + } else { + response, err = s.h.GetTimeLiteServer(ctx) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetTimeLiteServerResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + // handleGetTonConnectPayloadRequest handles getTonConnectPayload operation. // // Get a payload for further token receipt. @@ -4490,6 +5783,117 @@ func (s *Server) handleGetTransactionByMessageHashRequest(args [1]string, w http } } +// handleGetTransactionsLiteServerRequest handles getTransactionsLiteServer operation. +// +// Get transactions. +// +// GET /v2/liteserver/get_transactions/{account_id} +func (s *Server) handleGetTransactionsLiteServerRequest(args [1]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getTransactionsLiteServer"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetTransactionsLiteServer", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetTransactionsLiteServer", + ID: "getTransactionsLiteServer", + } + ) + params, err := decodeGetTransactionsLiteServerParams(args, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var response GetTransactionsLiteServerRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetTransactionsLiteServer", + OperationID: "getTransactionsLiteServer", + Body: nil, + Params: middleware.Parameters{ + { + Name: "account_id", + In: "path", + }: params.AccountID, + { + Name: "count", + In: "query", + }: params.Count, + { + Name: "lt", + In: "query", + }: params.Lt, + { + Name: "hash", + In: "query", + }: params.Hash, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetTransactionsLiteServerParams + Response = GetTransactionsLiteServerRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetTransactionsLiteServerParams, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.GetTransactionsLiteServer(ctx, params) + }, + ) + } else { + response, err = s.h.GetTransactionsLiteServer(ctx, params) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetTransactionsLiteServerResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + // handleGetValidatorsRequest handles getValidators operation. // // Get validators. @@ -5065,6 +6469,105 @@ func (s *Server) handleSendMessageRequest(args [0]string, w http.ResponseWriter, } } +// handleSendMessageLiteServerRequest handles sendMessageLiteServer operation. +// +// Send message. +// +// POST /v2/liteserver/send_message +func (s *Server) handleSendMessageLiteServerRequest(args [0]string, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("sendMessageLiteServer"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "SendMessageLiteServer", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, otelAttrs...) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, otelAttrs...) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "SendMessageLiteServer", + ID: "sendMessageLiteServer", + } + ) + request, close, err := s.decodeSendMessageLiteServerRequest(r) + if err != nil { + err = &ogenerrors.DecodeRequestError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeRequest", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + defer func() { + if err := close(); err != nil { + recordError("CloseRequest", err) + } + }() + + var response SendMessageLiteServerRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "SendMessageLiteServer", + OperationID: "sendMessageLiteServer", + Body: request, + Params: middleware.Parameters{}, + Raw: r, + } + + type ( + Request = SendMessageLiteServerReq + Params = struct{} + Response = SendMessageLiteServerRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + nil, + func(ctx context.Context, request Request, params Params) (Response, error) { + return s.h.SendMessageLiteServer(ctx, request) + }, + ) + } else { + response, err = s.h.SendMessageLiteServer(ctx, request) + } + if err != nil { + recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeSendMessageLiteServerResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } +} + // handleSetWalletBackupRequest handles setWalletBackup operation. // // Set backup info. diff --git a/pkg/oas/oas_interfaces_gen.go b/pkg/oas/oas_interfaces_gen.go index e9ea4ca3..98633d57 100644 --- a/pkg/oas/oas_interfaces_gen.go +++ b/pkg/oas/oas_interfaces_gen.go @@ -45,6 +45,10 @@ type GetAccountSeqnoRes interface { getAccountSeqnoRes() } +type GetAccountStateLiteServerRes interface { + getAccountStateLiteServerRes() +} + type GetAccountTransactionsRes interface { getAccountTransactionsRes() } @@ -57,6 +61,22 @@ type GetAllAuctionsRes interface { getAllAuctionsRes() } +type GetAllShardsInfoLiteServerRes interface { + getAllShardsInfoLiteServerRes() +} + +type GetBlockHeaderLiteServerRes interface { + getBlockHeaderLiteServerRes() +} + +type GetBlockLiteServerRes interface { + getBlockLiteServerRes() +} + +type GetBlockProofLiteServerRes interface { + getBlockProofLiteServerRes() +} + type GetBlockRes interface { getBlockRes() } @@ -65,6 +85,10 @@ type GetBlockTransactionsRes interface { getBlockTransactionsRes() } +type GetConfigAllLiteServerRes interface { + getConfigAllLiteServerRes() +} + type GetConfigRes interface { getConfigRes() } @@ -109,10 +133,22 @@ type GetJettonsRes interface { getJettonsRes() } +type GetListBlockTransactionsLiteServerRes interface { + getListBlockTransactionsLiteServerRes() +} + type GetMasterchainHeadRes interface { getMasterchainHeadRes() } +type GetMasterchainInfoExtLiteServerRes interface { + getMasterchainInfoExtLiteServerRes() +} + +type GetMasterchainInfoLiteServerRes interface { + getMasterchainInfoLiteServerRes() +} + type GetNftCollectionRes interface { getNftCollectionRes() } @@ -149,6 +185,18 @@ type GetSearchAccountsRes interface { getSearchAccountsRes() } +type GetShardBlockProofLiteServerRes interface { + getShardBlockProofLiteServerRes() +} + +type GetShardInfoLiteServerRes interface { + getShardInfoLiteServerRes() +} + +type GetStateLiteServerRes interface { + getStateLiteServerRes() +} + type GetStorageProvidersRes interface { getStorageProvidersRes() } @@ -157,6 +205,10 @@ type GetSubscriptionsByAccountRes interface { getSubscriptionsByAccountRes() } +type GetTimeLiteServerRes interface { + getTimeLiteServerRes() +} + type GetTonConnectPayloadRes interface { getTonConnectPayloadRes() } @@ -177,6 +229,10 @@ type GetTransactionRes interface { getTransactionRes() } +type GetTransactionsLiteServerRes interface { + getTransactionsLiteServerRes() +} + type GetValidatorsRes interface { getValidatorsRes() } @@ -197,6 +253,10 @@ type ReindexAccountRes interface { reindexAccountRes() } +type SendMessageLiteServerRes interface { + sendMessageLiteServerRes() +} + type SendMessageRes interface { sendMessageRes() } diff --git a/pkg/oas/oas_json_gen.go b/pkg/oas/oas_json_gen.go index 11f4d3ee..c9bb8d71 100644 --- a/pkg/oas/oas_json_gen.go +++ b/pkg/oas/oas_json_gen.go @@ -3654,6 +3654,175 @@ func (s *Block) UnmarshalJSON(data []byte) error { return s.Decode(d) } +// Encode implements json.Marshaler. +func (s BlockRaw) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s BlockRaw) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("workchain") + e.UInt32(s.Workchain) + } + { + + e.FieldStart("shard") + e.UInt64(s.Shard) + } + { + + e.FieldStart("seqno") + e.UInt32(s.Seqno) + } + { + + e.FieldStart("root_hash") + e.Str(s.RootHash) + } + { + + e.FieldStart("file_hash") + e.Str(s.FileHash) + } +} + +var jsonFieldsNameOfBlockRaw = [5]string{ + 0: "workchain", + 1: "shard", + 2: "seqno", + 3: "root_hash", + 4: "file_hash", +} + +// Decode decodes BlockRaw from json. +func (s *BlockRaw) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode BlockRaw to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "workchain": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.UInt32() + s.Workchain = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"workchain\"") + } + case "shard": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.UInt64() + s.Shard = uint64(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"shard\"") + } + case "seqno": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.UInt32() + s.Seqno = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"seqno\"") + } + case "root_hash": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + v, err := d.Str() + s.RootHash = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"root_hash\"") + } + case "file_hash": + requiredBitSet[0] |= 1 << 4 + if err := func() error { + v, err := d.Str() + s.FileHash = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"file_hash\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode BlockRaw") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00011111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfBlockRaw) { + name = jsonFieldsNameOfBlockRaw[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s BlockRaw) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *BlockRaw) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + // Encode encodes BouncePhaseType as json. func (s BouncePhaseType) Encode(e *jx.Encoder) { e.Str(string(s)) @@ -6411,69 +6580,125 @@ func (s *GetAccountInfoByStateInitReq) UnmarshalJSON(data []byte) error { } // Encode implements json.Marshaler. -func (s GetAccountsReq) Encode(e *jx.Encoder) { +func (s GetAccountStateLiteServerOK) Encode(e *jx.Encoder) { e.ObjStart() s.encodeFields(e) e.ObjEnd() } // encodeFields encodes fields. -func (s GetAccountsReq) encodeFields(e *jx.Encoder) { +func (s GetAccountStateLiteServerOK) encodeFields(e *jx.Encoder) { { - e.FieldStart("account_ids") - e.ArrStart() - for _, elem := range s.AccountIds { - e.Str(elem) - } - e.ArrEnd() + e.FieldStart("id") + s.ID.Encode(e) + } + { + + e.FieldStart("shardblk") + s.Shardblk.Encode(e) + } + { + + e.FieldStart("shard_proof") + e.Str(s.ShardProof) + } + { + + e.FieldStart("proof") + e.Str(s.Proof) + } + { + + e.FieldStart("state") + e.Str(s.State) } } -var jsonFieldsNameOfGetAccountsReq = [1]string{ - 0: "account_ids", +var jsonFieldsNameOfGetAccountStateLiteServerOK = [5]string{ + 0: "id", + 1: "shardblk", + 2: "shard_proof", + 3: "proof", + 4: "state", } -// Decode decodes GetAccountsReq from json. -func (s *GetAccountsReq) Decode(d *jx.Decoder) error { +// Decode decodes GetAccountStateLiteServerOK from json. +func (s *GetAccountStateLiteServerOK) Decode(d *jx.Decoder) error { if s == nil { - return errors.New("invalid: unable to decode GetAccountsReq to nil") + return errors.New("invalid: unable to decode GetAccountStateLiteServerOK to nil") } var requiredBitSet [1]uint8 if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { switch string(k) { - case "account_ids": + case "id": requiredBitSet[0] |= 1 << 0 if err := func() error { - s.AccountIds = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.AccountIds = append(s.AccountIds, elem) - return nil - }); err != nil { + if err := s.ID.Decode(d); err != nil { return err } return nil }(); err != nil { - return errors.Wrap(err, "decode field \"account_ids\"") + return errors.Wrap(err, "decode field \"id\"") + } + case "shardblk": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.Shardblk.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"shardblk\"") + } + case "shard_proof": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.Str() + s.ShardProof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"shard_proof\"") + } + case "proof": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + v, err := d.Str() + s.Proof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"proof\"") + } + case "state": + requiredBitSet[0] |= 1 << 4 + if err := func() error { + v, err := d.Str() + s.State = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"state\"") } default: return d.Skip() } return nil }); err != nil { - return errors.Wrap(err, "decode GetAccountsReq") + return errors.Wrap(err, "decode GetAccountStateLiteServerOK") } // Validate required fields. var failures []validate.FieldError for i, mask := range [1]uint8{ - 0b00000001, + 0b00011111, } { if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { // Mask only required fields and check equality to mask using XOR. @@ -6485,8 +6710,8 @@ func (s *GetAccountsReq) Decode(d *jx.Decoder) error { bitIdx := bits.TrailingZeros8(result) fieldIdx := i*8 + bitIdx var name string - if fieldIdx < len(jsonFieldsNameOfGetAccountsReq) { - name = jsonFieldsNameOfGetAccountsReq[fieldIdx] + if fieldIdx < len(jsonFieldsNameOfGetAccountStateLiteServerOK) { + name = jsonFieldsNameOfGetAccountStateLiteServerOK[fieldIdx] } else { name = strconv.Itoa(fieldIdx) } @@ -6507,27 +6732,27 @@ func (s *GetAccountsReq) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s GetAccountsReq) MarshalJSON() ([]byte, error) { +func (s GetAccountStateLiteServerOK) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *GetAccountsReq) UnmarshalJSON(data []byte) error { +func (s *GetAccountStateLiteServerOK) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } // Encode implements json.Marshaler. -func (s GetNftItemsByAddressesReq) Encode(e *jx.Encoder) { +func (s GetAccountsReq) Encode(e *jx.Encoder) { e.ObjStart() s.encodeFields(e) e.ObjEnd() } // encodeFields encodes fields. -func (s GetNftItemsByAddressesReq) encodeFields(e *jx.Encoder) { +func (s GetAccountsReq) encodeFields(e *jx.Encoder) { { e.FieldStart("account_ids") @@ -6539,14 +6764,14 @@ func (s GetNftItemsByAddressesReq) encodeFields(e *jx.Encoder) { } } -var jsonFieldsNameOfGetNftItemsByAddressesReq = [1]string{ +var jsonFieldsNameOfGetAccountsReq = [1]string{ 0: "account_ids", } -// Decode decodes GetNftItemsByAddressesReq from json. -func (s *GetNftItemsByAddressesReq) Decode(d *jx.Decoder) error { +// Decode decodes GetAccountsReq from json. +func (s *GetAccountsReq) Decode(d *jx.Decoder) error { if s == nil { - return errors.New("invalid: unable to decode GetNftItemsByAddressesReq to nil") + return errors.New("invalid: unable to decode GetAccountsReq to nil") } var requiredBitSet [1]uint8 @@ -6577,7 +6802,7 @@ func (s *GetNftItemsByAddressesReq) Decode(d *jx.Decoder) error { } return nil }); err != nil { - return errors.Wrap(err, "decode GetNftItemsByAddressesReq") + return errors.Wrap(err, "decode GetAccountsReq") } // Validate required fields. var failures []validate.FieldError @@ -6594,8 +6819,8 @@ func (s *GetNftItemsByAddressesReq) Decode(d *jx.Decoder) error { bitIdx := bits.TrailingZeros8(result) fieldIdx := i*8 + bitIdx var name string - if fieldIdx < len(jsonFieldsNameOfGetNftItemsByAddressesReq) { - name = jsonFieldsNameOfGetNftItemsByAddressesReq[fieldIdx] + if fieldIdx < len(jsonFieldsNameOfGetAccountsReq) { + name = jsonFieldsNameOfGetAccountsReq[fieldIdx] } else { name = strconv.Itoa(fieldIdx) } @@ -6616,65 +6841,3096 @@ func (s *GetNftItemsByAddressesReq) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s GetNftItemsByAddressesReq) MarshalJSON() ([]byte, error) { +func (s GetAccountsReq) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *GetNftItemsByAddressesReq) UnmarshalJSON(data []byte) error { +func (s *GetAccountsReq) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } // Encode implements json.Marshaler. -func (s GetPublicKeyByAccountIDOK) Encode(e *jx.Encoder) { +func (s GetAllShardsInfoLiteServerOK) Encode(e *jx.Encoder) { e.ObjStart() s.encodeFields(e) e.ObjEnd() } // encodeFields encodes fields. -func (s GetPublicKeyByAccountIDOK) encodeFields(e *jx.Encoder) { +func (s GetAllShardsInfoLiteServerOK) encodeFields(e *jx.Encoder) { { - e.FieldStart("public_key") + e.FieldStart("id") + s.ID.Encode(e) + } + { + + e.FieldStart("proof") + e.Str(s.Proof) + } + { + + e.FieldStart("data") + e.Str(s.Data) + } +} + +var jsonFieldsNameOfGetAllShardsInfoLiteServerOK = [3]string{ + 0: "id", + 1: "proof", + 2: "data", +} + +// Decode decodes GetAllShardsInfoLiteServerOK from json. +func (s *GetAllShardsInfoLiteServerOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetAllShardsInfoLiteServerOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "id": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.ID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"id\"") + } + case "proof": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.Proof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"proof\"") + } + case "data": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.Str() + s.Data = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"data\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetAllShardsInfoLiteServerOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetAllShardsInfoLiteServerOK) { + name = jsonFieldsNameOfGetAllShardsInfoLiteServerOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetAllShardsInfoLiteServerOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetAllShardsInfoLiteServerOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetBlockHeaderLiteServerOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetBlockHeaderLiteServerOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("id") + s.ID.Encode(e) + } + { + + e.FieldStart("mode") + e.UInt32(s.Mode) + } + { + + e.FieldStart("header_proof") + e.Str(s.HeaderProof) + } +} + +var jsonFieldsNameOfGetBlockHeaderLiteServerOK = [3]string{ + 0: "id", + 1: "mode", + 2: "header_proof", +} + +// Decode decodes GetBlockHeaderLiteServerOK from json. +func (s *GetBlockHeaderLiteServerOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetBlockHeaderLiteServerOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "id": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.ID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"id\"") + } + case "mode": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.UInt32() + s.Mode = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"mode\"") + } + case "header_proof": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.Str() + s.HeaderProof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"header_proof\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetBlockHeaderLiteServerOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetBlockHeaderLiteServerOK) { + name = jsonFieldsNameOfGetBlockHeaderLiteServerOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetBlockHeaderLiteServerOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetBlockHeaderLiteServerOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetBlockLiteServerOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetBlockLiteServerOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("id") + s.ID.Encode(e) + } + { + + e.FieldStart("data") + e.Str(s.Data) + } +} + +var jsonFieldsNameOfGetBlockLiteServerOK = [2]string{ + 0: "id", + 1: "data", +} + +// Decode decodes GetBlockLiteServerOK from json. +func (s *GetBlockLiteServerOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetBlockLiteServerOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "id": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.ID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"id\"") + } + case "data": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.Data = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"data\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetBlockLiteServerOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetBlockLiteServerOK) { + name = jsonFieldsNameOfGetBlockLiteServerOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetBlockLiteServerOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetBlockLiteServerOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetBlockProofLiteServerOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetBlockProofLiteServerOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("complete") + e.Bool(s.Complete) + } + { + + e.FieldStart("from") + s.From.Encode(e) + } + { + + e.FieldStart("to") + s.To.Encode(e) + } + { + + e.FieldStart("steps") + e.ArrStart() + for _, elem := range s.Steps { + elem.Encode(e) + } + e.ArrEnd() + } +} + +var jsonFieldsNameOfGetBlockProofLiteServerOK = [4]string{ + 0: "complete", + 1: "from", + 2: "to", + 3: "steps", +} + +// Decode decodes GetBlockProofLiteServerOK from json. +func (s *GetBlockProofLiteServerOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetBlockProofLiteServerOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "complete": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.Bool() + s.Complete = bool(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"complete\"") + } + case "from": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.From.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"from\"") + } + case "to": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + if err := s.To.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"to\"") + } + case "steps": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + s.Steps = make([]GetBlockProofLiteServerOKStepsItem, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem GetBlockProofLiteServerOKStepsItem + if err := elem.Decode(d); err != nil { + return err + } + s.Steps = append(s.Steps, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"steps\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetBlockProofLiteServerOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00001111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetBlockProofLiteServerOK) { + name = jsonFieldsNameOfGetBlockProofLiteServerOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetBlockProofLiteServerOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetBlockProofLiteServerOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetBlockProofLiteServerOKStepsItem) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetBlockProofLiteServerOKStepsItem) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("lite_server_block_link_back") + s.LiteServerBlockLinkBack.Encode(e) + } + { + + e.FieldStart("lite_server_block_link_forward") + s.LiteServerBlockLinkForward.Encode(e) + } +} + +var jsonFieldsNameOfGetBlockProofLiteServerOKStepsItem = [2]string{ + 0: "lite_server_block_link_back", + 1: "lite_server_block_link_forward", +} + +// Decode decodes GetBlockProofLiteServerOKStepsItem from json. +func (s *GetBlockProofLiteServerOKStepsItem) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetBlockProofLiteServerOKStepsItem to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "lite_server_block_link_back": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.LiteServerBlockLinkBack.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"lite_server_block_link_back\"") + } + case "lite_server_block_link_forward": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.LiteServerBlockLinkForward.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"lite_server_block_link_forward\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetBlockProofLiteServerOKStepsItem") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetBlockProofLiteServerOKStepsItem) { + name = jsonFieldsNameOfGetBlockProofLiteServerOKStepsItem[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetBlockProofLiteServerOKStepsItem) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetBlockProofLiteServerOKStepsItem) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("to_key_block") + e.Bool(s.ToKeyBlock) + } + { + + e.FieldStart("from") + s.From.Encode(e) + } + { + + e.FieldStart("to") + s.To.Encode(e) + } + { + + e.FieldStart("dest_proof") + e.Str(s.DestProof) + } + { + + e.FieldStart("proof") + e.Str(s.Proof) + } + { + + e.FieldStart("state_proof") + e.Str(s.StateProof) + } +} + +var jsonFieldsNameOfGetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack = [6]string{ + 0: "to_key_block", + 1: "from", + 2: "to", + 3: "dest_proof", + 4: "proof", + 5: "state_proof", +} + +// Decode decodes GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack from json. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "to_key_block": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.Bool() + s.ToKeyBlock = bool(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"to_key_block\"") + } + case "from": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.From.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"from\"") + } + case "to": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + if err := s.To.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"to\"") + } + case "dest_proof": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + v, err := d.Str() + s.DestProof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"dest_proof\"") + } + case "proof": + requiredBitSet[0] |= 1 << 4 + if err := func() error { + v, err := d.Str() + s.Proof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"proof\"") + } + case "state_proof": + requiredBitSet[0] |= 1 << 5 + if err := func() error { + v, err := d.Str() + s.StateProof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"state_proof\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00111111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) { + name = jsonFieldsNameOfGetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("to_key_block") + e.Bool(s.ToKeyBlock) + } + { + + e.FieldStart("from") + s.From.Encode(e) + } + { + + e.FieldStart("to") + s.To.Encode(e) + } + { + + e.FieldStart("dest_proof") + e.Str(s.DestProof) + } + { + + e.FieldStart("config_proof") + e.Str(s.ConfigProof) + } + { + + e.FieldStart("signatures") + s.Signatures.Encode(e) + } +} + +var jsonFieldsNameOfGetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward = [6]string{ + 0: "to_key_block", + 1: "from", + 2: "to", + 3: "dest_proof", + 4: "config_proof", + 5: "signatures", +} + +// Decode decodes GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward from json. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "to_key_block": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.Bool() + s.ToKeyBlock = bool(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"to_key_block\"") + } + case "from": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.From.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"from\"") + } + case "to": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + if err := s.To.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"to\"") + } + case "dest_proof": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + v, err := d.Str() + s.DestProof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"dest_proof\"") + } + case "config_proof": + requiredBitSet[0] |= 1 << 4 + if err := func() error { + v, err := d.Str() + s.ConfigProof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"config_proof\"") + } + case "signatures": + requiredBitSet[0] |= 1 << 5 + if err := func() error { + if err := s.Signatures.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"signatures\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00111111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) { + name = jsonFieldsNameOfGetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("validator_set_hash") + e.UInt32(s.ValidatorSetHash) + } + { + + e.FieldStart("catchain_seqno") + e.UInt32(s.CatchainSeqno) + } + { + + e.FieldStart("signatures") + e.ArrStart() + for _, elem := range s.Signatures { + elem.Encode(e) + } + e.ArrEnd() + } +} + +var jsonFieldsNameOfGetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures = [3]string{ + 0: "validator_set_hash", + 1: "catchain_seqno", + 2: "signatures", +} + +// Decode decodes GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures from json. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "validator_set_hash": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.UInt32() + s.ValidatorSetHash = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"validator_set_hash\"") + } + case "catchain_seqno": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.UInt32() + s.CatchainSeqno = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"catchain_seqno\"") + } + case "signatures": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + s.Signatures = make([]GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem + if err := elem.Decode(d); err != nil { + return err + } + s.Signatures = append(s.Signatures, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"signatures\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) { + name = jsonFieldsNameOfGetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("node_id_short") + e.Str(s.NodeIDShort) + } + { + + e.FieldStart("signature") + e.Str(s.Signature) + } +} + +var jsonFieldsNameOfGetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem = [2]string{ + 0: "node_id_short", + 1: "signature", +} + +// Decode decodes GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem from json. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "node_id_short": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.Str() + s.NodeIDShort = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"node_id_short\"") + } + case "signature": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.Signature = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"signature\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem) { + name = jsonFieldsNameOfGetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetConfigAllLiteServerOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetConfigAllLiteServerOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("mode") + e.UInt32(s.Mode) + } + { + + e.FieldStart("id") + s.ID.Encode(e) + } + { + + e.FieldStart("state_proof") + e.Str(s.StateProof) + } + { + + e.FieldStart("config_proof") + e.Str(s.ConfigProof) + } +} + +var jsonFieldsNameOfGetConfigAllLiteServerOK = [4]string{ + 0: "mode", + 1: "id", + 2: "state_proof", + 3: "config_proof", +} + +// Decode decodes GetConfigAllLiteServerOK from json. +func (s *GetConfigAllLiteServerOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetConfigAllLiteServerOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "mode": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.UInt32() + s.Mode = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"mode\"") + } + case "id": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.ID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"id\"") + } + case "state_proof": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.Str() + s.StateProof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"state_proof\"") + } + case "config_proof": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + v, err := d.Str() + s.ConfigProof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"config_proof\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetConfigAllLiteServerOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00001111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetConfigAllLiteServerOK) { + name = jsonFieldsNameOfGetConfigAllLiteServerOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetConfigAllLiteServerOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetConfigAllLiteServerOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetListBlockTransactionsLiteServerOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetListBlockTransactionsLiteServerOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("id") + s.ID.Encode(e) + } + { + + e.FieldStart("req_count") + e.UInt32(s.ReqCount) + } + { + + e.FieldStart("incomplete") + e.Bool(s.Incomplete) + } + { + + e.FieldStart("ids") + e.ArrStart() + for _, elem := range s.Ids { + elem.Encode(e) + } + e.ArrEnd() + } + { + + e.FieldStart("proof") + e.Str(s.Proof) + } +} + +var jsonFieldsNameOfGetListBlockTransactionsLiteServerOK = [5]string{ + 0: "id", + 1: "req_count", + 2: "incomplete", + 3: "ids", + 4: "proof", +} + +// Decode decodes GetListBlockTransactionsLiteServerOK from json. +func (s *GetListBlockTransactionsLiteServerOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetListBlockTransactionsLiteServerOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "id": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.ID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"id\"") + } + case "req_count": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.UInt32() + s.ReqCount = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"req_count\"") + } + case "incomplete": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.Bool() + s.Incomplete = bool(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"incomplete\"") + } + case "ids": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + s.Ids = make([]GetListBlockTransactionsLiteServerOKIdsItem, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem GetListBlockTransactionsLiteServerOKIdsItem + if err := elem.Decode(d); err != nil { + return err + } + s.Ids = append(s.Ids, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"ids\"") + } + case "proof": + requiredBitSet[0] |= 1 << 4 + if err := func() error { + v, err := d.Str() + s.Proof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"proof\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetListBlockTransactionsLiteServerOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00011111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetListBlockTransactionsLiteServerOK) { + name = jsonFieldsNameOfGetListBlockTransactionsLiteServerOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetListBlockTransactionsLiteServerOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetListBlockTransactionsLiteServerOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetListBlockTransactionsLiteServerOKIdsItem) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetListBlockTransactionsLiteServerOKIdsItem) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("mode") + e.UInt32(s.Mode) + } + { + if s.Account.Set { + e.FieldStart("account") + s.Account.Encode(e) + } + } + { + if s.Lt.Set { + e.FieldStart("lt") + s.Lt.Encode(e) + } + } + { + if s.Hash.Set { + e.FieldStart("hash") + s.Hash.Encode(e) + } + } +} + +var jsonFieldsNameOfGetListBlockTransactionsLiteServerOKIdsItem = [4]string{ + 0: "mode", + 1: "account", + 2: "lt", + 3: "hash", +} + +// Decode decodes GetListBlockTransactionsLiteServerOKIdsItem from json. +func (s *GetListBlockTransactionsLiteServerOKIdsItem) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetListBlockTransactionsLiteServerOKIdsItem to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "mode": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.UInt32() + s.Mode = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"mode\"") + } + case "account": + if err := func() error { + s.Account.Reset() + if err := s.Account.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"account\"") + } + case "lt": + if err := func() error { + s.Lt.Reset() + if err := s.Lt.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"lt\"") + } + case "hash": + if err := func() error { + s.Hash.Reset() + if err := s.Hash.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"hash\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetListBlockTransactionsLiteServerOKIdsItem") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000001, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetListBlockTransactionsLiteServerOKIdsItem) { + name = jsonFieldsNameOfGetListBlockTransactionsLiteServerOKIdsItem[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetListBlockTransactionsLiteServerOKIdsItem) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetListBlockTransactionsLiteServerOKIdsItem) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetMasterchainInfoExtLiteServerOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetMasterchainInfoExtLiteServerOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("mode") + e.UInt32(s.Mode) + } + { + + e.FieldStart("version") + e.UInt32(s.Version) + } + { + + e.FieldStart("capabilities") + e.UInt64(s.Capabilities) + } + { + + e.FieldStart("last") + s.Last.Encode(e) + } + { + + e.FieldStart("last_utime") + e.UInt32(s.LastUtime) + } + { + + e.FieldStart("now") + e.UInt32(s.Now) + } + { + + e.FieldStart("state_root_hash") + e.Str(s.StateRootHash) + } + { + + e.FieldStart("init") + s.Init.Encode(e) + } +} + +var jsonFieldsNameOfGetMasterchainInfoExtLiteServerOK = [8]string{ + 0: "mode", + 1: "version", + 2: "capabilities", + 3: "last", + 4: "last_utime", + 5: "now", + 6: "state_root_hash", + 7: "init", +} + +// Decode decodes GetMasterchainInfoExtLiteServerOK from json. +func (s *GetMasterchainInfoExtLiteServerOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetMasterchainInfoExtLiteServerOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "mode": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.UInt32() + s.Mode = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"mode\"") + } + case "version": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.UInt32() + s.Version = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"version\"") + } + case "capabilities": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.UInt64() + s.Capabilities = uint64(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"capabilities\"") + } + case "last": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + if err := s.Last.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"last\"") + } + case "last_utime": + requiredBitSet[0] |= 1 << 4 + if err := func() error { + v, err := d.UInt32() + s.LastUtime = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"last_utime\"") + } + case "now": + requiredBitSet[0] |= 1 << 5 + if err := func() error { + v, err := d.UInt32() + s.Now = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"now\"") + } + case "state_root_hash": + requiredBitSet[0] |= 1 << 6 + if err := func() error { + v, err := d.Str() + s.StateRootHash = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"state_root_hash\"") + } + case "init": + requiredBitSet[0] |= 1 << 7 + if err := func() error { + if err := s.Init.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"init\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetMasterchainInfoExtLiteServerOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b11111111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetMasterchainInfoExtLiteServerOK) { + name = jsonFieldsNameOfGetMasterchainInfoExtLiteServerOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetMasterchainInfoExtLiteServerOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetMasterchainInfoExtLiteServerOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetMasterchainInfoLiteServerOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetMasterchainInfoLiteServerOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("last") + s.Last.Encode(e) + } + { + + e.FieldStart("state_root_hash") + e.Str(s.StateRootHash) + } + { + + e.FieldStart("init") + s.Init.Encode(e) + } +} + +var jsonFieldsNameOfGetMasterchainInfoLiteServerOK = [3]string{ + 0: "last", + 1: "state_root_hash", + 2: "init", +} + +// Decode decodes GetMasterchainInfoLiteServerOK from json. +func (s *GetMasterchainInfoLiteServerOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetMasterchainInfoLiteServerOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "last": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Last.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"last\"") + } + case "state_root_hash": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.StateRootHash = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"state_root_hash\"") + } + case "init": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + if err := s.Init.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"init\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetMasterchainInfoLiteServerOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetMasterchainInfoLiteServerOK) { + name = jsonFieldsNameOfGetMasterchainInfoLiteServerOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetMasterchainInfoLiteServerOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetMasterchainInfoLiteServerOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetNftItemsByAddressesReq) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetNftItemsByAddressesReq) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("account_ids") + e.ArrStart() + for _, elem := range s.AccountIds { + e.Str(elem) + } + e.ArrEnd() + } +} + +var jsonFieldsNameOfGetNftItemsByAddressesReq = [1]string{ + 0: "account_ids", +} + +// Decode decodes GetNftItemsByAddressesReq from json. +func (s *GetNftItemsByAddressesReq) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetNftItemsByAddressesReq to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "account_ids": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + s.AccountIds = make([]string, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem string + v, err := d.Str() + elem = string(v) + if err != nil { + return err + } + s.AccountIds = append(s.AccountIds, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"account_ids\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetNftItemsByAddressesReq") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000001, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetNftItemsByAddressesReq) { + name = jsonFieldsNameOfGetNftItemsByAddressesReq[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetNftItemsByAddressesReq) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetNftItemsByAddressesReq) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetPublicKeyByAccountIDOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetPublicKeyByAccountIDOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("public_key") e.Str(s.PublicKey) } } -var jsonFieldsNameOfGetPublicKeyByAccountIDOK = [1]string{ - 0: "public_key", +var jsonFieldsNameOfGetPublicKeyByAccountIDOK = [1]string{ + 0: "public_key", +} + +// Decode decodes GetPublicKeyByAccountIDOK from json. +func (s *GetPublicKeyByAccountIDOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetPublicKeyByAccountIDOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "public_key": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.Str() + s.PublicKey = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"public_key\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetPublicKeyByAccountIDOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000001, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetPublicKeyByAccountIDOK) { + name = jsonFieldsNameOfGetPublicKeyByAccountIDOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetPublicKeyByAccountIDOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetPublicKeyByAccountIDOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetRatesOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetRatesOK) encodeFields(e *jx.Encoder) { + { + + if len(s.Rates) != 0 { + e.FieldStart("rates") + e.Raw(s.Rates) + } + } +} + +var jsonFieldsNameOfGetRatesOK = [1]string{ + 0: "rates", +} + +// Decode decodes GetRatesOK from json. +func (s *GetRatesOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetRatesOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "rates": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.RawAppend(nil) + s.Rates = jx.Raw(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"rates\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetRatesOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000001, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetRatesOK) { + name = jsonFieldsNameOfGetRatesOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetRatesOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetRatesOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetShardBlockProofLiteServerOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetShardBlockProofLiteServerOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("masterchain_id") + s.MasterchainID.Encode(e) + } + { + + e.FieldStart("links") + e.ArrStart() + for _, elem := range s.Links { + elem.Encode(e) + } + e.ArrEnd() + } +} + +var jsonFieldsNameOfGetShardBlockProofLiteServerOK = [2]string{ + 0: "masterchain_id", + 1: "links", +} + +// Decode decodes GetShardBlockProofLiteServerOK from json. +func (s *GetShardBlockProofLiteServerOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetShardBlockProofLiteServerOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "masterchain_id": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.MasterchainID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"masterchain_id\"") + } + case "links": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + s.Links = make([]GetShardBlockProofLiteServerOKLinksItem, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem GetShardBlockProofLiteServerOKLinksItem + if err := elem.Decode(d); err != nil { + return err + } + s.Links = append(s.Links, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"links\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetShardBlockProofLiteServerOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetShardBlockProofLiteServerOK) { + name = jsonFieldsNameOfGetShardBlockProofLiteServerOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetShardBlockProofLiteServerOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetShardBlockProofLiteServerOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetShardBlockProofLiteServerOKLinksItem) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetShardBlockProofLiteServerOKLinksItem) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("id") + s.ID.Encode(e) + } + { + + e.FieldStart("proof") + e.Str(s.Proof) + } +} + +var jsonFieldsNameOfGetShardBlockProofLiteServerOKLinksItem = [2]string{ + 0: "id", + 1: "proof", +} + +// Decode decodes GetShardBlockProofLiteServerOKLinksItem from json. +func (s *GetShardBlockProofLiteServerOKLinksItem) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetShardBlockProofLiteServerOKLinksItem to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "id": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.ID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"id\"") + } + case "proof": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.Proof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"proof\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetShardBlockProofLiteServerOKLinksItem") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetShardBlockProofLiteServerOKLinksItem) { + name = jsonFieldsNameOfGetShardBlockProofLiteServerOKLinksItem[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetShardBlockProofLiteServerOKLinksItem) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetShardBlockProofLiteServerOKLinksItem) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetShardInfoLiteServerOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetShardInfoLiteServerOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("id") + s.ID.Encode(e) + } + { + + e.FieldStart("shardblk") + s.Shardblk.Encode(e) + } + { + + e.FieldStart("shard_proof") + e.Str(s.ShardProof) + } + { + + e.FieldStart("shard_descr") + e.Str(s.ShardDescr) + } +} + +var jsonFieldsNameOfGetShardInfoLiteServerOK = [4]string{ + 0: "id", + 1: "shardblk", + 2: "shard_proof", + 3: "shard_descr", +} + +// Decode decodes GetShardInfoLiteServerOK from json. +func (s *GetShardInfoLiteServerOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetShardInfoLiteServerOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "id": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.ID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"id\"") + } + case "shardblk": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.Shardblk.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"shardblk\"") + } + case "shard_proof": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.Str() + s.ShardProof = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"shard_proof\"") + } + case "shard_descr": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + v, err := d.Str() + s.ShardDescr = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"shard_descr\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetShardInfoLiteServerOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00001111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetShardInfoLiteServerOK) { + name = jsonFieldsNameOfGetShardInfoLiteServerOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetShardInfoLiteServerOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetShardInfoLiteServerOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetStateLiteServerOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetStateLiteServerOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("id") + s.ID.Encode(e) + } + { + + e.FieldStart("root_hash") + e.Str(s.RootHash) + } + { + + e.FieldStart("file_hash") + e.Str(s.FileHash) + } + { + + e.FieldStart("data") + e.Str(s.Data) + } +} + +var jsonFieldsNameOfGetStateLiteServerOK = [4]string{ + 0: "id", + 1: "root_hash", + 2: "file_hash", + 3: "data", +} + +// Decode decodes GetStateLiteServerOK from json. +func (s *GetStateLiteServerOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetStateLiteServerOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "id": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.ID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"id\"") + } + case "root_hash": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.RootHash = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"root_hash\"") + } + case "file_hash": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.Str() + s.FileHash = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"file_hash\"") + } + case "data": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + v, err := d.Str() + s.Data = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"data\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetStateLiteServerOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00001111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetStateLiteServerOK) { + name = jsonFieldsNameOfGetStateLiteServerOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetStateLiteServerOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetStateLiteServerOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetStorageProvidersOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetStorageProvidersOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("providers") + e.ArrStart() + for _, elem := range s.Providers { + elem.Encode(e) + } + e.ArrEnd() + } +} + +var jsonFieldsNameOfGetStorageProvidersOK = [1]string{ + 0: "providers", +} + +// Decode decodes GetStorageProvidersOK from json. +func (s *GetStorageProvidersOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode GetStorageProvidersOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "providers": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + s.Providers = make([]StorageProvider, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem StorageProvider + if err := elem.Decode(d); err != nil { + return err + } + s.Providers = append(s.Providers, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"providers\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode GetStorageProvidersOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000001, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfGetStorageProvidersOK) { + name = jsonFieldsNameOfGetStorageProvidersOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s GetStorageProvidersOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil } -// Decode decodes GetPublicKeyByAccountIDOK from json. -func (s *GetPublicKeyByAccountIDOK) Decode(d *jx.Decoder) error { +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *GetStorageProvidersOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s GetTimeLiteServerOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s GetTimeLiteServerOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("time") + e.UInt32(s.Time) + } +} + +var jsonFieldsNameOfGetTimeLiteServerOK = [1]string{ + 0: "time", +} + +// Decode decodes GetTimeLiteServerOK from json. +func (s *GetTimeLiteServerOK) Decode(d *jx.Decoder) error { if s == nil { - return errors.New("invalid: unable to decode GetPublicKeyByAccountIDOK to nil") + return errors.New("invalid: unable to decode GetTimeLiteServerOK to nil") } var requiredBitSet [1]uint8 if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { switch string(k) { - case "public_key": + case "time": requiredBitSet[0] |= 1 << 0 if err := func() error { - v, err := d.Str() - s.PublicKey = string(v) + v, err := d.UInt32() + s.Time = uint32(v) if err != nil { return err } return nil }(); err != nil { - return errors.Wrap(err, "decode field \"public_key\"") + return errors.Wrap(err, "decode field \"time\"") } default: return d.Skip() } return nil }); err != nil { - return errors.Wrap(err, "decode GetPublicKeyByAccountIDOK") + return errors.Wrap(err, "decode GetTimeLiteServerOK") } // Validate required fields. var failures []validate.FieldError @@ -6691,8 +9947,8 @@ func (s *GetPublicKeyByAccountIDOK) Decode(d *jx.Decoder) error { bitIdx := bits.TrailingZeros8(result) fieldIdx := i*8 + bitIdx var name string - if fieldIdx < len(jsonFieldsNameOfGetPublicKeyByAccountIDOK) { - name = jsonFieldsNameOfGetPublicKeyByAccountIDOK[fieldIdx] + if fieldIdx < len(jsonFieldsNameOfGetTimeLiteServerOK) { + name = jsonFieldsNameOfGetTimeLiteServerOK[fieldIdx] } else { name = strconv.Itoa(fieldIdx) } @@ -6713,67 +9969,65 @@ func (s *GetPublicKeyByAccountIDOK) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s GetPublicKeyByAccountIDOK) MarshalJSON() ([]byte, error) { +func (s GetTimeLiteServerOK) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *GetPublicKeyByAccountIDOK) UnmarshalJSON(data []byte) error { +func (s *GetTimeLiteServerOK) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } // Encode implements json.Marshaler. -func (s GetRatesOK) Encode(e *jx.Encoder) { +func (s GetTonConnectPayloadOK) Encode(e *jx.Encoder) { e.ObjStart() s.encodeFields(e) e.ObjEnd() } // encodeFields encodes fields. -func (s GetRatesOK) encodeFields(e *jx.Encoder) { +func (s GetTonConnectPayloadOK) encodeFields(e *jx.Encoder) { { - if len(s.Rates) != 0 { - e.FieldStart("rates") - e.Raw(s.Rates) - } + e.FieldStart("payload") + e.Str(s.Payload) } } -var jsonFieldsNameOfGetRatesOK = [1]string{ - 0: "rates", +var jsonFieldsNameOfGetTonConnectPayloadOK = [1]string{ + 0: "payload", } -// Decode decodes GetRatesOK from json. -func (s *GetRatesOK) Decode(d *jx.Decoder) error { +// Decode decodes GetTonConnectPayloadOK from json. +func (s *GetTonConnectPayloadOK) Decode(d *jx.Decoder) error { if s == nil { - return errors.New("invalid: unable to decode GetRatesOK to nil") + return errors.New("invalid: unable to decode GetTonConnectPayloadOK to nil") } var requiredBitSet [1]uint8 if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { switch string(k) { - case "rates": + case "payload": requiredBitSet[0] |= 1 << 0 if err := func() error { - v, err := d.RawAppend(nil) - s.Rates = jx.Raw(v) + v, err := d.Str() + s.Payload = string(v) if err != nil { return err } return nil }(); err != nil { - return errors.Wrap(err, "decode field \"rates\"") + return errors.Wrap(err, "decode field \"payload\"") } default: return d.Skip() } return nil }); err != nil { - return errors.Wrap(err, "decode GetRatesOK") + return errors.Wrap(err, "decode GetTonConnectPayloadOK") } // Validate required fields. var failures []validate.FieldError @@ -6790,8 +10044,8 @@ func (s *GetRatesOK) Decode(d *jx.Decoder) error { bitIdx := bits.TrailingZeros8(result) fieldIdx := i*8 + bitIdx var name string - if fieldIdx < len(jsonFieldsNameOfGetRatesOK) { - name = jsonFieldsNameOfGetRatesOK[fieldIdx] + if fieldIdx < len(jsonFieldsNameOfGetTonConnectPayloadOK) { + name = jsonFieldsNameOfGetTonConnectPayloadOK[fieldIdx] } else { name = strconv.Itoa(fieldIdx) } @@ -6812,80 +10066,98 @@ func (s *GetRatesOK) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s GetRatesOK) MarshalJSON() ([]byte, error) { +func (s GetTonConnectPayloadOK) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *GetRatesOK) UnmarshalJSON(data []byte) error { +func (s *GetTonConnectPayloadOK) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } // Encode implements json.Marshaler. -func (s GetStorageProvidersOK) Encode(e *jx.Encoder) { +func (s GetTransactionsLiteServerOK) Encode(e *jx.Encoder) { e.ObjStart() s.encodeFields(e) e.ObjEnd() } // encodeFields encodes fields. -func (s GetStorageProvidersOK) encodeFields(e *jx.Encoder) { +func (s GetTransactionsLiteServerOK) encodeFields(e *jx.Encoder) { { - e.FieldStart("providers") + e.FieldStart("ids") e.ArrStart() - for _, elem := range s.Providers { + for _, elem := range s.Ids { elem.Encode(e) } e.ArrEnd() } + { + + e.FieldStart("transactions") + e.Str(s.Transactions) + } } -var jsonFieldsNameOfGetStorageProvidersOK = [1]string{ - 0: "providers", +var jsonFieldsNameOfGetTransactionsLiteServerOK = [2]string{ + 0: "ids", + 1: "transactions", } -// Decode decodes GetStorageProvidersOK from json. -func (s *GetStorageProvidersOK) Decode(d *jx.Decoder) error { +// Decode decodes GetTransactionsLiteServerOK from json. +func (s *GetTransactionsLiteServerOK) Decode(d *jx.Decoder) error { if s == nil { - return errors.New("invalid: unable to decode GetStorageProvidersOK to nil") + return errors.New("invalid: unable to decode GetTransactionsLiteServerOK to nil") } var requiredBitSet [1]uint8 if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { switch string(k) { - case "providers": + case "ids": requiredBitSet[0] |= 1 << 0 if err := func() error { - s.Providers = make([]StorageProvider, 0) + s.Ids = make([]BlockRaw, 0) if err := d.Arr(func(d *jx.Decoder) error { - var elem StorageProvider + var elem BlockRaw if err := elem.Decode(d); err != nil { return err } - s.Providers = append(s.Providers, elem) + s.Ids = append(s.Ids, elem) return nil }); err != nil { return err } return nil }(); err != nil { - return errors.Wrap(err, "decode field \"providers\"") + return errors.Wrap(err, "decode field \"ids\"") + } + case "transactions": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.Transactions = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"transactions\"") } default: return d.Skip() } return nil }); err != nil { - return errors.Wrap(err, "decode GetStorageProvidersOK") + return errors.Wrap(err, "decode GetTransactionsLiteServerOK") } // Validate required fields. var failures []validate.FieldError for i, mask := range [1]uint8{ - 0b00000001, + 0b00000011, } { if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { // Mask only required fields and check equality to mask using XOR. @@ -6897,8 +10169,8 @@ func (s *GetStorageProvidersOK) Decode(d *jx.Decoder) error { bitIdx := bits.TrailingZeros8(result) fieldIdx := i*8 + bitIdx var name string - if fieldIdx < len(jsonFieldsNameOfGetStorageProvidersOK) { - name = jsonFieldsNameOfGetStorageProvidersOK[fieldIdx] + if fieldIdx < len(jsonFieldsNameOfGetTransactionsLiteServerOK) { + name = jsonFieldsNameOfGetTransactionsLiteServerOK[fieldIdx] } else { name = strconv.Itoa(fieldIdx) } @@ -6919,65 +10191,65 @@ func (s *GetStorageProvidersOK) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s GetStorageProvidersOK) MarshalJSON() ([]byte, error) { +func (s GetTransactionsLiteServerOK) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *GetStorageProvidersOK) UnmarshalJSON(data []byte) error { +func (s *GetTransactionsLiteServerOK) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } // Encode implements json.Marshaler. -func (s GetTonConnectPayloadOK) Encode(e *jx.Encoder) { +func (s GetWalletBackupOK) Encode(e *jx.Encoder) { e.ObjStart() s.encodeFields(e) e.ObjEnd() } // encodeFields encodes fields. -func (s GetTonConnectPayloadOK) encodeFields(e *jx.Encoder) { +func (s GetWalletBackupOK) encodeFields(e *jx.Encoder) { { - e.FieldStart("payload") - e.Str(s.Payload) + e.FieldStart("dump") + e.Str(s.Dump) } } -var jsonFieldsNameOfGetTonConnectPayloadOK = [1]string{ - 0: "payload", +var jsonFieldsNameOfGetWalletBackupOK = [1]string{ + 0: "dump", } -// Decode decodes GetTonConnectPayloadOK from json. -func (s *GetTonConnectPayloadOK) Decode(d *jx.Decoder) error { +// Decode decodes GetWalletBackupOK from json. +func (s *GetWalletBackupOK) Decode(d *jx.Decoder) error { if s == nil { - return errors.New("invalid: unable to decode GetTonConnectPayloadOK to nil") + return errors.New("invalid: unable to decode GetWalletBackupOK to nil") } var requiredBitSet [1]uint8 if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { switch string(k) { - case "payload": + case "dump": requiredBitSet[0] |= 1 << 0 if err := func() error { v, err := d.Str() - s.Payload = string(v) + s.Dump = string(v) if err != nil { return err } return nil }(); err != nil { - return errors.Wrap(err, "decode field \"payload\"") + return errors.Wrap(err, "decode field \"dump\"") } default: return d.Skip() } return nil }); err != nil { - return errors.Wrap(err, "decode GetTonConnectPayloadOK") + return errors.Wrap(err, "decode GetWalletBackupOK") } // Validate required fields. var failures []validate.FieldError @@ -6994,8 +10266,8 @@ func (s *GetTonConnectPayloadOK) Decode(d *jx.Decoder) error { bitIdx := bits.TrailingZeros8(result) fieldIdx := i*8 + bitIdx var name string - if fieldIdx < len(jsonFieldsNameOfGetTonConnectPayloadOK) { - name = jsonFieldsNameOfGetTonConnectPayloadOK[fieldIdx] + if fieldIdx < len(jsonFieldsNameOfGetWalletBackupOK) { + name = jsonFieldsNameOfGetWalletBackupOK[fieldIdx] } else { name = strconv.Itoa(fieldIdx) } @@ -7016,70 +10288,88 @@ func (s *GetTonConnectPayloadOK) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s GetTonConnectPayloadOK) MarshalJSON() ([]byte, error) { +func (s GetWalletBackupOK) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *GetTonConnectPayloadOK) UnmarshalJSON(data []byte) error { +func (s *GetWalletBackupOK) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } // Encode implements json.Marshaler. -func (s GetWalletBackupOK) Encode(e *jx.Encoder) { +func (s ImagePreview) Encode(e *jx.Encoder) { e.ObjStart() s.encodeFields(e) e.ObjEnd() } // encodeFields encodes fields. -func (s GetWalletBackupOK) encodeFields(e *jx.Encoder) { +func (s ImagePreview) encodeFields(e *jx.Encoder) { { - e.FieldStart("dump") - e.Str(s.Dump) + e.FieldStart("resolution") + e.Str(s.Resolution) + } + { + + e.FieldStart("url") + e.Str(s.URL) } } -var jsonFieldsNameOfGetWalletBackupOK = [1]string{ - 0: "dump", +var jsonFieldsNameOfImagePreview = [2]string{ + 0: "resolution", + 1: "url", } -// Decode decodes GetWalletBackupOK from json. -func (s *GetWalletBackupOK) Decode(d *jx.Decoder) error { +// Decode decodes ImagePreview from json. +func (s *ImagePreview) Decode(d *jx.Decoder) error { if s == nil { - return errors.New("invalid: unable to decode GetWalletBackupOK to nil") + return errors.New("invalid: unable to decode ImagePreview to nil") } var requiredBitSet [1]uint8 if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { switch string(k) { - case "dump": + case "resolution": requiredBitSet[0] |= 1 << 0 if err := func() error { v, err := d.Str() - s.Dump = string(v) + s.Resolution = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"resolution\"") + } + case "url": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.URL = string(v) if err != nil { return err } return nil }(); err != nil { - return errors.Wrap(err, "decode field \"dump\"") + return errors.Wrap(err, "decode field \"url\"") } default: return d.Skip() } return nil }); err != nil { - return errors.Wrap(err, "decode GetWalletBackupOK") + return errors.Wrap(err, "decode ImagePreview") } // Validate required fields. var failures []validate.FieldError for i, mask := range [1]uint8{ - 0b00000001, + 0b00000011, } { if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { // Mask only required fields and check equality to mask using XOR. @@ -7091,8 +10381,8 @@ func (s *GetWalletBackupOK) Decode(d *jx.Decoder) error { bitIdx := bits.TrailingZeros8(result) fieldIdx := i*8 + bitIdx var name string - if fieldIdx < len(jsonFieldsNameOfGetWalletBackupOK) { - name = jsonFieldsNameOfGetWalletBackupOK[fieldIdx] + if fieldIdx < len(jsonFieldsNameOfImagePreview) { + name = jsonFieldsNameOfImagePreview[fieldIdx] } else { name = strconv.Itoa(fieldIdx) } @@ -7113,88 +10403,106 @@ func (s *GetWalletBackupOK) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s GetWalletBackupOK) MarshalJSON() ([]byte, error) { +func (s ImagePreview) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *GetWalletBackupOK) UnmarshalJSON(data []byte) error { +func (s *ImagePreview) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } // Encode implements json.Marshaler. -func (s ImagePreview) Encode(e *jx.Encoder) { +func (s InitStateRaw) Encode(e *jx.Encoder) { e.ObjStart() s.encodeFields(e) e.ObjEnd() } // encodeFields encodes fields. -func (s ImagePreview) encodeFields(e *jx.Encoder) { +func (s InitStateRaw) encodeFields(e *jx.Encoder) { { - e.FieldStart("resolution") - e.Str(s.Resolution) + e.FieldStart("workchain") + e.UInt32(s.Workchain) } { - e.FieldStart("url") - e.Str(s.URL) + e.FieldStart("root_hash") + e.Str(s.RootHash) + } + { + + e.FieldStart("file_hash") + e.Str(s.FileHash) } } -var jsonFieldsNameOfImagePreview = [2]string{ - 0: "resolution", - 1: "url", +var jsonFieldsNameOfInitStateRaw = [3]string{ + 0: "workchain", + 1: "root_hash", + 2: "file_hash", } -// Decode decodes ImagePreview from json. -func (s *ImagePreview) Decode(d *jx.Decoder) error { +// Decode decodes InitStateRaw from json. +func (s *InitStateRaw) Decode(d *jx.Decoder) error { if s == nil { - return errors.New("invalid: unable to decode ImagePreview to nil") + return errors.New("invalid: unable to decode InitStateRaw to nil") } var requiredBitSet [1]uint8 if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { switch string(k) { - case "resolution": + case "workchain": requiredBitSet[0] |= 1 << 0 if err := func() error { - v, err := d.Str() - s.Resolution = string(v) + v, err := d.UInt32() + s.Workchain = uint32(v) if err != nil { return err } return nil }(); err != nil { - return errors.Wrap(err, "decode field \"resolution\"") + return errors.Wrap(err, "decode field \"workchain\"") } - case "url": + case "root_hash": requiredBitSet[0] |= 1 << 1 if err := func() error { v, err := d.Str() - s.URL = string(v) + s.RootHash = string(v) if err != nil { return err } return nil }(); err != nil { - return errors.Wrap(err, "decode field \"url\"") + return errors.Wrap(err, "decode field \"root_hash\"") + } + case "file_hash": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.Str() + s.FileHash = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"file_hash\"") } default: return d.Skip() } return nil }); err != nil { - return errors.Wrap(err, "decode ImagePreview") + return errors.Wrap(err, "decode InitStateRaw") } // Validate required fields. var failures []validate.FieldError for i, mask := range [1]uint8{ - 0b00000011, + 0b00000111, } { if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { // Mask only required fields and check equality to mask using XOR. @@ -7206,8 +10514,8 @@ func (s *ImagePreview) Decode(d *jx.Decoder) error { bitIdx := bits.TrailingZeros8(result) fieldIdx := i*8 + bitIdx var name string - if fieldIdx < len(jsonFieldsNameOfImagePreview) { - name = jsonFieldsNameOfImagePreview[fieldIdx] + if fieldIdx < len(jsonFieldsNameOfInitStateRaw) { + name = jsonFieldsNameOfInitStateRaw[fieldIdx] } else { name = strconv.Itoa(fieldIdx) } @@ -7228,14 +10536,14 @@ func (s *ImagePreview) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s ImagePreview) MarshalJSON() ([]byte, error) { +func (s InitStateRaw) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ImagePreview) UnmarshalJSON(data []byte) error { +func (s *InitStateRaw) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } @@ -11871,6 +15179,41 @@ func (s *OptUint32) UnmarshalJSON(data []byte) error { return s.Decode(d) } +// Encode encodes uint64 as json. +func (o OptUint64) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.UInt64(uint64(o.Value)) +} + +// Decode decodes uint64 from json. +func (o *OptUint64) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptUint64 to nil") + } + o.Set = true + v, err := d.UInt64() + if err != nil { + return err + } + o.Value = uint64(v) + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptUint64) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptUint64) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + // Encode encodes UnSubscriptionAction as json. func (o OptUnSubscriptionAction) Encode(e *jx.Encoder) { if !o.Set { @@ -13627,6 +16970,200 @@ func (s *Sale) UnmarshalJSON(data []byte) error { return s.Decode(d) } +// Encode implements json.Marshaler. +func (s SendMessageLiteServerOK) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s SendMessageLiteServerOK) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("code") + e.UInt32(s.Code) + } +} + +var jsonFieldsNameOfSendMessageLiteServerOK = [1]string{ + 0: "code", +} + +// Decode decodes SendMessageLiteServerOK from json. +func (s *SendMessageLiteServerOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode SendMessageLiteServerOK to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "code": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.UInt32() + s.Code = uint32(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"code\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode SendMessageLiteServerOK") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000001, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfSendMessageLiteServerOK) { + name = jsonFieldsNameOfSendMessageLiteServerOK[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s SendMessageLiteServerOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *SendMessageLiteServerOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s SendMessageLiteServerReq) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s SendMessageLiteServerReq) encodeFields(e *jx.Encoder) { + { + + e.FieldStart("body") + e.Str(s.Body) + } +} + +var jsonFieldsNameOfSendMessageLiteServerReq = [1]string{ + 0: "body", +} + +// Decode decodes SendMessageLiteServerReq from json. +func (s *SendMessageLiteServerReq) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode SendMessageLiteServerReq to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "body": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.Str() + s.Body = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"body\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode SendMessageLiteServerReq") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000001, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfSendMessageLiteServerReq) { + name = jsonFieldsNameOfSendMessageLiteServerReq[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s SendMessageLiteServerReq) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *SendMessageLiteServerReq) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + // Encode implements json.Marshaler. func (s SendMessageReq) Encode(e *jx.Encoder) { e.ObjStart() diff --git a/pkg/oas/oas_parameters_gen.go b/pkg/oas/oas_parameters_gen.go index e5494e32..eb7f6bb0 100644 --- a/pkg/oas/oas_parameters_gen.go +++ b/pkg/oas/oas_parameters_gen.go @@ -632,6 +632,58 @@ func decodeGetAccountSeqnoParams(args [1]string, r *http.Request) (params GetAcc return params, nil } +// GetAccountStateLiteServerParams is parameters of getAccountStateLiteServer operation. +type GetAccountStateLiteServerParams struct { + // Account ID. + AccountID string +} + +func unpackGetAccountStateLiteServerParams(packed middleware.Parameters) (params GetAccountStateLiteServerParams) { + { + key := middleware.ParameterKey{ + Name: "account_id", + In: "path", + } + params.AccountID = packed[key].(string) + } + return params +} + +func decodeGetAccountStateLiteServerParams(args [1]string, r *http.Request) (params GetAccountStateLiteServerParams, _ error) { + // Decode path: account_id. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "account_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.AccountID = c + return nil + }(); err != nil { + return params, errors.Wrap(err, "path: account_id: parse") + } + } else { + return params, errors.New("path: account_id: not specified") + } + } + return params, nil +} + // GetAccountTransactionsParams is parameters of getAccountTransactions operation. type GetAccountTransactionsParams struct { // Account ID. @@ -906,13 +958,13 @@ func decodeGetAllAuctionsParams(args [0]string, r *http.Request) (params GetAllA return params, nil } -// GetBlockParams is parameters of getBlock operation. -type GetBlockParams struct { - // Block ID. +// GetAllShardsInfoLiteServerParams is parameters of getAllShardsInfoLiteServer operation. +type GetAllShardsInfoLiteServerParams struct { + // Block ID: (workchain,shard,seqno,root_hash,file_hash). BlockID string } -func unpackGetBlockParams(packed middleware.Parameters) (params GetBlockParams) { +func unpackGetAllShardsInfoLiteServerParams(packed middleware.Parameters) (params GetAllShardsInfoLiteServerParams) { { key := middleware.ParameterKey{ Name: "block_id", @@ -923,7 +975,7 @@ func unpackGetBlockParams(packed middleware.Parameters) (params GetBlockParams) return params } -func decodeGetBlockParams(args [1]string, r *http.Request) (params GetBlockParams, _ error) { +func decodeGetAllShardsInfoLiteServerParams(args [1]string, r *http.Request) (params GetAllShardsInfoLiteServerParams, _ error) { // Decode path: block_id. { param := args[0] @@ -958,13 +1010,13 @@ func decodeGetBlockParams(args [1]string, r *http.Request) (params GetBlockParam return params, nil } -// GetBlockTransactionsParams is parameters of getBlockTransactions operation. -type GetBlockTransactionsParams struct { +// GetBlockParams is parameters of getBlock operation. +type GetBlockParams struct { // Block ID. BlockID string } -func unpackGetBlockTransactionsParams(packed middleware.Parameters) (params GetBlockTransactionsParams) { +func unpackGetBlockParams(packed middleware.Parameters) (params GetBlockParams) { { key := middleware.ParameterKey{ Name: "block_id", @@ -975,7 +1027,7 @@ func unpackGetBlockTransactionsParams(packed middleware.Parameters) (params GetB return params } -func decodeGetBlockTransactionsParams(args [1]string, r *http.Request) (params GetBlockTransactionsParams, _ error) { +func decodeGetBlockParams(args [1]string, r *http.Request) (params GetBlockParams, _ error) { // Decode path: block_id. { param := args[0] @@ -1010,42 +1062,40 @@ func decodeGetBlockTransactionsParams(args [1]string, r *http.Request) (params G return params, nil } -// GetDnsExpiringParams is parameters of getDnsExpiring operation. -type GetDnsExpiringParams struct { - // Account ID. - AccountID string - // Number of days before expiration. - Period OptInt +// GetBlockHeaderLiteServerParams is parameters of getBlockHeaderLiteServer operation. +type GetBlockHeaderLiteServerParams struct { + // Block ID: (workchain,shard,seqno,root_hash,file_hash). + BlockID string + // Mode. + Mode uint32 } -func unpackGetDnsExpiringParams(packed middleware.Parameters) (params GetDnsExpiringParams) { +func unpackGetBlockHeaderLiteServerParams(packed middleware.Parameters) (params GetBlockHeaderLiteServerParams) { { key := middleware.ParameterKey{ - Name: "account_id", + Name: "block_id", In: "path", } - params.AccountID = packed[key].(string) + params.BlockID = packed[key].(string) } { key := middleware.ParameterKey{ - Name: "period", + Name: "mode", In: "query", } - if v, ok := packed[key]; ok { - params.Period = v.(OptInt) - } + params.Mode = packed[key].(uint32) } return params } -func decodeGetDnsExpiringParams(args [1]string, r *http.Request) (params GetDnsExpiringParams, _ error) { +func decodeGetBlockHeaderLiteServerParams(args [1]string, r *http.Request) (params GetBlockHeaderLiteServerParams, _ error) { q := uri.NewQueryDecoder(r.URL.Query()) - // Decode path: account_id. + // Decode path: block_id. { param := args[0] if len(param) > 0 { d := uri.NewPathDecoder(uri.PathDecoderConfig{ - Param: "account_id", + Param: "block_id", Value: param, Style: uri.PathStyleSimple, Explode: false, @@ -1062,100 +1112,71 @@ func decodeGetDnsExpiringParams(args [1]string, r *http.Request) (params GetDnsE return err } - params.AccountID = c + params.BlockID = c return nil }(); err != nil { - return params, errors.Wrap(err, "path: account_id: parse") + return params, errors.Wrap(err, "path: block_id: parse") } } else { - return params, errors.New("path: account_id: not specified") + return params, errors.New("path: block_id: not specified") } } - // Decode query: period. + // Decode query: mode. { cfg := uri.QueryParameterDecodingConfig{ - Name: "period", + Name: "mode", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotPeriodVal int - if err := func() error { - val, err := d.DecodeValue() - if err != nil { - return err - } - - c, err := conv.ToInt(val) - if err != nil { - return err - } + val, err := d.DecodeValue() + if err != nil { + return err + } - paramsDotPeriodVal = c - return nil - }(); err != nil { + c, err := conv.ToUint32(val) + if err != nil { return err } - params.Period.SetTo(paramsDotPeriodVal) + + params.Mode = c return nil }); err != nil { - return params, errors.Wrap(err, "query: period: parse") - } - if err := func() error { - if params.Period.Set { - if err := func() error { - if err := (validate.Int{ - MinSet: true, - Min: 1, - MaxSet: true, - Max: 3660, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - }).Validate(int64(params.Period.Value)); err != nil { - return errors.Wrap(err, "int") - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - return params, errors.Wrap(err, "query: period: invalid") + return params, errors.Wrap(err, "query: mode: parse") } + } else { + return params, errors.Wrap(err, "query") } } return params, nil } -// GetDomainBidsParams is parameters of getDomainBids operation. -type GetDomainBidsParams struct { - // Domain name with .ton or .t.me. - DomainName string +// GetBlockLiteServerParams is parameters of getBlockLiteServer operation. +type GetBlockLiteServerParams struct { + // Block ID: (workchain,shard,seqno,root_hash,file_hash). + BlockID string } -func unpackGetDomainBidsParams(packed middleware.Parameters) (params GetDomainBidsParams) { +func unpackGetBlockLiteServerParams(packed middleware.Parameters) (params GetBlockLiteServerParams) { { key := middleware.ParameterKey{ - Name: "domain_name", + Name: "block_id", In: "path", } - params.DomainName = packed[key].(string) + params.BlockID = packed[key].(string) } return params } -func decodeGetDomainBidsParams(args [1]string, r *http.Request) (params GetDomainBidsParams, _ error) { - // Decode path: domain_name. +func decodeGetBlockLiteServerParams(args [1]string, r *http.Request) (params GetBlockLiteServerParams, _ error) { + // Decode path: block_id. { param := args[0] if len(param) > 0 { d := uri.NewPathDecoder(uri.PathDecoderConfig{ - Param: "domain_name", + Param: "block_id", Value: param, Style: uri.PathStyleSimple, Explode: false, @@ -1172,59 +1193,67 @@ func decodeGetDomainBidsParams(args [1]string, r *http.Request) (params GetDomai return err } - params.DomainName = c + params.BlockID = c return nil }(); err != nil { - return params, errors.Wrap(err, "path: domain_name: parse") + return params, errors.Wrap(err, "path: block_id: parse") } } else { - return params, errors.New("path: domain_name: not specified") + return params, errors.New("path: block_id: not specified") } } return params, nil } -// GetEventParams is parameters of getEvent operation. -type GetEventParams struct { - // Event ID or transaction hash in hex (without 0x) or base64url format. - EventID string - AcceptLanguage OptString +// GetBlockProofLiteServerParams is parameters of getBlockProofLiteServer operation. +type GetBlockProofLiteServerParams struct { + // Known block: (workchain,shard,seqno,root_hash,file_hash). + KnownBlock string + // Target block: (workchain,shard,seqno,root_hash,file_hash). + TargetBlock OptString + // Mode. + Mode uint32 } -func unpackGetEventParams(packed middleware.Parameters) (params GetEventParams) { +func unpackGetBlockProofLiteServerParams(packed middleware.Parameters) (params GetBlockProofLiteServerParams) { { key := middleware.ParameterKey{ - Name: "event_id", - In: "path", + Name: "known_block", + In: "query", } - params.EventID = packed[key].(string) + params.KnownBlock = packed[key].(string) } { key := middleware.ParameterKey{ - Name: "Accept-Language", - In: "header", + Name: "target_block", + In: "query", } if v, ok := packed[key]; ok { - params.AcceptLanguage = v.(OptString) + params.TargetBlock = v.(OptString) + } + } + { + key := middleware.ParameterKey{ + Name: "mode", + In: "query", } + params.Mode = packed[key].(uint32) } return params } -func decodeGetEventParams(args [1]string, r *http.Request) (params GetEventParams, _ error) { - h := uri.NewHeaderDecoder(r.Header) - // Decode path: event_id. +func decodeGetBlockProofLiteServerParams(args [0]string, r *http.Request) (params GetBlockProofLiteServerParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Decode query: known_block. { - param := args[0] - if len(param) > 0 { - d := uri.NewPathDecoder(uri.PathDecoderConfig{ - Param: "event_id", - Value: param, - Style: uri.PathStyleSimple, - Explode: false, - }) + cfg := uri.QueryParameterDecodingConfig{ + Name: "known_block", + Style: uri.QueryStyleForm, + Explode: true, + } - if err := func() error { + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { val, err := d.DecodeValue() if err != nil { return err @@ -1235,29 +1264,26 @@ func decodeGetEventParams(args [1]string, r *http.Request) (params GetEventParam return err } - params.EventID = c + params.KnownBlock = c return nil - }(); err != nil { - return params, errors.Wrap(err, "path: event_id: parse") + }); err != nil { + return params, errors.Wrap(err, "query: known_block: parse") } } else { - return params, errors.New("path: event_id: not specified") + return params, errors.Wrap(err, "query") } } - // Set default value for header: Accept-Language. - { - val := string("en") - params.AcceptLanguage.SetTo(val) - } - // Decode header: Accept-Language. + // Decode query: target_block. { - cfg := uri.HeaderParameterDecodingConfig{ - Name: "Accept-Language", - Explode: false, + cfg := uri.QueryParameterDecodingConfig{ + Name: "target_block", + Style: uri.QueryStyleForm, + Explode: true, } - if err := h.HasParam(cfg); err == nil { - if err := h.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotAcceptLanguageVal string + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotTargetBlockVal string if err := func() error { val, err := d.DecodeValue() if err != nil { @@ -1269,107 +1295,136 @@ func decodeGetEventParams(args [1]string, r *http.Request) (params GetEventParam return err } - paramsDotAcceptLanguageVal = c + paramsDotTargetBlockVal = c return nil }(); err != nil { return err } - params.AcceptLanguage.SetTo(paramsDotAcceptLanguageVal) + params.TargetBlock.SetTo(paramsDotTargetBlockVal) return nil }); err != nil { - return params, errors.Wrap(err, "header: Accept-Language: parse") + return params, errors.Wrap(err, "query: target_block: parse") } } } + // Decode query: mode. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "mode", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToUint32(val) + if err != nil { + return err + } + + params.Mode = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: mode: parse") + } + } else { + return params, errors.Wrap(err, "query") + } + } return params, nil } -// GetEventsByAccountParams is parameters of getEventsByAccount operation. -type GetEventsByAccountParams struct { - // Account ID. - AccountID string - AcceptLanguage OptString - // Filter actions where requested account is not real subject (for example sender or reciver jettons). - SubjectOnly OptBool - // Omit this parameter to get last events. - BeforeLt OptInt64 - Limit int - StartDate OptInt64 - EndDate OptInt64 +// GetBlockTransactionsParams is parameters of getBlockTransactions operation. +type GetBlockTransactionsParams struct { + // Block ID. + BlockID string } -func unpackGetEventsByAccountParams(packed middleware.Parameters) (params GetEventsByAccountParams) { +func unpackGetBlockTransactionsParams(packed middleware.Parameters) (params GetBlockTransactionsParams) { { key := middleware.ParameterKey{ - Name: "account_id", + Name: "block_id", In: "path", } - params.AccountID = packed[key].(string) - } - { - key := middleware.ParameterKey{ - Name: "Accept-Language", - In: "header", - } - if v, ok := packed[key]; ok { - params.AcceptLanguage = v.(OptString) - } - } - { - key := middleware.ParameterKey{ - Name: "subject_only", - In: "query", - } - if v, ok := packed[key]; ok { - params.SubjectOnly = v.(OptBool) - } - } - { - key := middleware.ParameterKey{ - Name: "before_lt", - In: "query", - } - if v, ok := packed[key]; ok { - params.BeforeLt = v.(OptInt64) - } + params.BlockID = packed[key].(string) } + return params +} + +func decodeGetBlockTransactionsParams(args [1]string, r *http.Request) (params GetBlockTransactionsParams, _ error) { + // Decode path: block_id. { - key := middleware.ParameterKey{ - Name: "limit", - In: "query", + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "block_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.BlockID = c + return nil + }(); err != nil { + return params, errors.Wrap(err, "path: block_id: parse") + } + } else { + return params, errors.New("path: block_id: not specified") } - params.Limit = packed[key].(int) } + return params, nil +} + +// GetConfigAllLiteServerParams is parameters of getConfigAllLiteServer operation. +type GetConfigAllLiteServerParams struct { + // Block ID: (workchain,shard,seqno,root_hash,file_hash). + BlockID string + // Mode. + Mode uint32 +} + +func unpackGetConfigAllLiteServerParams(packed middleware.Parameters) (params GetConfigAllLiteServerParams) { { key := middleware.ParameterKey{ - Name: "start_date", - In: "query", - } - if v, ok := packed[key]; ok { - params.StartDate = v.(OptInt64) + Name: "block_id", + In: "path", } + params.BlockID = packed[key].(string) } { key := middleware.ParameterKey{ - Name: "end_date", + Name: "mode", In: "query", } - if v, ok := packed[key]; ok { - params.EndDate = v.(OptInt64) - } + params.Mode = packed[key].(uint32) } return params } -func decodeGetEventsByAccountParams(args [1]string, r *http.Request) (params GetEventsByAccountParams, _ error) { +func decodeGetConfigAllLiteServerParams(args [1]string, r *http.Request) (params GetConfigAllLiteServerParams, _ error) { q := uri.NewQueryDecoder(r.URL.Query()) - h := uri.NewHeaderDecoder(r.Header) - // Decode path: account_id. + // Decode path: block_id. { param := args[0] if len(param) > 0 { d := uri.NewPathDecoder(uri.PathDecoderConfig{ - Param: "account_id", + Param: "block_id", Value: param, Style: uri.PathStyleSimple, Explode: false, @@ -1386,251 +1441,336 @@ func decodeGetEventsByAccountParams(args [1]string, r *http.Request) (params Get return err } - params.AccountID = c + params.BlockID = c return nil }(); err != nil { - return params, errors.Wrap(err, "path: account_id: parse") + return params, errors.Wrap(err, "path: block_id: parse") } } else { - return params, errors.New("path: account_id: not specified") + return params, errors.New("path: block_id: not specified") } } - // Set default value for header: Accept-Language. - { - val := string("en") - params.AcceptLanguage.SetTo(val) - } - // Decode header: Accept-Language. + // Decode query: mode. { - cfg := uri.HeaderParameterDecodingConfig{ - Name: "Accept-Language", - Explode: false, + cfg := uri.QueryParameterDecodingConfig{ + Name: "mode", + Style: uri.QueryStyleForm, + Explode: true, } - if err := h.HasParam(cfg); err == nil { - if err := h.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotAcceptLanguageVal string - if err := func() error { - val, err := d.DecodeValue() - if err != nil { - return err - } - c, err := conv.ToString(val) - if err != nil { - return err - } + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } - paramsDotAcceptLanguageVal = c - return nil - }(); err != nil { + c, err := conv.ToUint32(val) + if err != nil { return err } - params.AcceptLanguage.SetTo(paramsDotAcceptLanguageVal) + + params.Mode = c return nil }); err != nil { - return params, errors.Wrap(err, "header: Accept-Language: parse") + return params, errors.Wrap(err, "query: mode: parse") } + } else { + return params, errors.Wrap(err, "query") } } - // Set default value for query: subject_only. + return params, nil +} + +// GetDnsExpiringParams is parameters of getDnsExpiring operation. +type GetDnsExpiringParams struct { + // Account ID. + AccountID string + // Number of days before expiration. + Period OptInt +} + +func unpackGetDnsExpiringParams(packed middleware.Parameters) (params GetDnsExpiringParams) { { - val := bool(false) - params.SubjectOnly.SetTo(val) + key := middleware.ParameterKey{ + Name: "account_id", + In: "path", + } + params.AccountID = packed[key].(string) } - // Decode query: subject_only. { - cfg := uri.QueryParameterDecodingConfig{ - Name: "subject_only", - Style: uri.QueryStyleForm, - Explode: true, + key := middleware.ParameterKey{ + Name: "period", + In: "query", + } + if v, ok := packed[key]; ok { + params.Period = v.(OptInt) } + } + return params +} - if err := q.HasParam(cfg); err == nil { - if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotSubjectOnlyVal bool - if err := func() error { - val, err := d.DecodeValue() - if err != nil { - return err - } +func decodeGetDnsExpiringParams(args [1]string, r *http.Request) (params GetDnsExpiringParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Decode path: account_id. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "account_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) - c, err := conv.ToBool(val) - if err != nil { - return err - } + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } - paramsDotSubjectOnlyVal = c - return nil - }(); err != nil { + c, err := conv.ToString(val) + if err != nil { return err } - params.SubjectOnly.SetTo(paramsDotSubjectOnlyVal) + + params.AccountID = c return nil - }); err != nil { - return params, errors.Wrap(err, "query: subject_only: parse") + }(); err != nil { + return params, errors.Wrap(err, "path: account_id: parse") } + } else { + return params, errors.New("path: account_id: not specified") } } - // Decode query: before_lt. + // Decode query: period. { cfg := uri.QueryParameterDecodingConfig{ - Name: "before_lt", + Name: "period", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotBeforeLtVal int64 + var paramsDotPeriodVal int if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt64(val) + c, err := conv.ToInt(val) if err != nil { return err } - paramsDotBeforeLtVal = c + paramsDotPeriodVal = c return nil }(); err != nil { return err } - params.BeforeLt.SetTo(paramsDotBeforeLtVal) + params.Period.SetTo(paramsDotPeriodVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: before_lt: parse") + return params, errors.Wrap(err, "query: period: parse") } - } - } - // Decode query: limit. - { - cfg := uri.QueryParameterDecodingConfig{ - Name: "limit", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.HasParam(cfg); err == nil { - if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - val, err := d.DecodeValue() - if err != nil { - return err - } - - c, err := conv.ToInt(val) - if err != nil { - return err + if err := func() error { + if params.Period.Set { + if err := func() error { + if err := (validate.Int{ + MinSet: true, + Min: 1, + MaxSet: true, + Max: 3660, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + }).Validate(int64(params.Period.Value)); err != nil { + return errors.Wrap(err, "int") + } + return nil + }(); err != nil { + return err + } } - - params.Limit = c return nil - }); err != nil { - return params, errors.Wrap(err, "query: limit: parse") + }(); err != nil { + return params, errors.Wrap(err, "query: period: invalid") } + } + } + return params, nil +} + +// GetDomainBidsParams is parameters of getDomainBids operation. +type GetDomainBidsParams struct { + // Domain name with .ton or .t.me. + DomainName string +} + +func unpackGetDomainBidsParams(packed middleware.Parameters) (params GetDomainBidsParams) { + { + key := middleware.ParameterKey{ + Name: "domain_name", + In: "path", + } + params.DomainName = packed[key].(string) + } + return params +} + +func decodeGetDomainBidsParams(args [1]string, r *http.Request) (params GetDomainBidsParams, _ error) { + // Decode path: domain_name. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "domain_name", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + if err := func() error { - if err := (validate.Int{ - MinSet: false, - Min: 0, - MaxSet: true, - Max: 1000, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - }).Validate(int64(params.Limit)); err != nil { - return errors.Wrap(err, "int") + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err } + + params.DomainName = c return nil }(); err != nil { - return params, errors.Wrap(err, "query: limit: invalid") + return params, errors.Wrap(err, "path: domain_name: parse") } } else { - return params, errors.Wrap(err, "query") + return params, errors.New("path: domain_name: not specified") } } - // Decode query: start_date. + return params, nil +} + +// GetEventParams is parameters of getEvent operation. +type GetEventParams struct { + // Event ID or transaction hash in hex (without 0x) or base64url format. + EventID string + AcceptLanguage OptString +} + +func unpackGetEventParams(packed middleware.Parameters) (params GetEventParams) { { - cfg := uri.QueryParameterDecodingConfig{ - Name: "start_date", - Style: uri.QueryStyleForm, - Explode: true, + key := middleware.ParameterKey{ + Name: "event_id", + In: "path", + } + params.EventID = packed[key].(string) + } + { + key := middleware.ParameterKey{ + Name: "Accept-Language", + In: "header", + } + if v, ok := packed[key]; ok { + params.AcceptLanguage = v.(OptString) } + } + return params +} - if err := q.HasParam(cfg); err == nil { - if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotStartDateVal int64 - if err := func() error { - val, err := d.DecodeValue() - if err != nil { - return err - } +func decodeGetEventParams(args [1]string, r *http.Request) (params GetEventParams, _ error) { + h := uri.NewHeaderDecoder(r.Header) + // Decode path: event_id. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "event_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) - c, err := conv.ToInt64(val) - if err != nil { - return err - } + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } - paramsDotStartDateVal = c - return nil - }(); err != nil { + c, err := conv.ToString(val) + if err != nil { return err } - params.StartDate.SetTo(paramsDotStartDateVal) + + params.EventID = c return nil - }); err != nil { - return params, errors.Wrap(err, "query: start_date: parse") + }(); err != nil { + return params, errors.Wrap(err, "path: event_id: parse") } + } else { + return params, errors.New("path: event_id: not specified") } } - // Decode query: end_date. + // Set default value for header: Accept-Language. { - cfg := uri.QueryParameterDecodingConfig{ - Name: "end_date", - Style: uri.QueryStyleForm, - Explode: true, + val := string("en") + params.AcceptLanguage.SetTo(val) + } + // Decode header: Accept-Language. + { + cfg := uri.HeaderParameterDecodingConfig{ + Name: "Accept-Language", + Explode: false, } - - if err := q.HasParam(cfg); err == nil { - if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotEndDateVal int64 + if err := h.HasParam(cfg); err == nil { + if err := h.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotAcceptLanguageVal string if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt64(val) + c, err := conv.ToString(val) if err != nil { return err } - paramsDotEndDateVal = c + paramsDotAcceptLanguageVal = c return nil }(); err != nil { return err } - params.EndDate.SetTo(paramsDotEndDateVal) + params.AcceptLanguage.SetTo(paramsDotAcceptLanguageVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: end_date: parse") + return params, errors.Wrap(err, "header: Accept-Language: parse") } } } return params, nil } -// GetItemsFromCollectionParams is parameters of getItemsFromCollection operation. -type GetItemsFromCollectionParams struct { +// GetEventsByAccountParams is parameters of getEventsByAccount operation. +type GetEventsByAccountParams struct { // Account ID. - AccountID string - Limit OptInt - Offset OptInt + AccountID string + AcceptLanguage OptString + // Filter actions where requested account is not real subject (for example sender or reciver jettons). + SubjectOnly OptBool + // Omit this parameter to get last events. + BeforeLt OptInt64 + Limit int + StartDate OptInt64 + EndDate OptInt64 } -func unpackGetItemsFromCollectionParams(packed middleware.Parameters) (params GetItemsFromCollectionParams) { +func unpackGetEventsByAccountParams(packed middleware.Parameters) (params GetEventsByAccountParams) { { key := middleware.ParameterKey{ Name: "account_id", @@ -1638,29 +1778,64 @@ func unpackGetItemsFromCollectionParams(packed middleware.Parameters) (params Ge } params.AccountID = packed[key].(string) } + { + key := middleware.ParameterKey{ + Name: "Accept-Language", + In: "header", + } + if v, ok := packed[key]; ok { + params.AcceptLanguage = v.(OptString) + } + } + { + key := middleware.ParameterKey{ + Name: "subject_only", + In: "query", + } + if v, ok := packed[key]; ok { + params.SubjectOnly = v.(OptBool) + } + } + { + key := middleware.ParameterKey{ + Name: "before_lt", + In: "query", + } + if v, ok := packed[key]; ok { + params.BeforeLt = v.(OptInt64) + } + } { key := middleware.ParameterKey{ Name: "limit", In: "query", } + params.Limit = packed[key].(int) + } + { + key := middleware.ParameterKey{ + Name: "start_date", + In: "query", + } if v, ok := packed[key]; ok { - params.Limit = v.(OptInt) + params.StartDate = v.(OptInt64) } } { key := middleware.ParameterKey{ - Name: "offset", + Name: "end_date", In: "query", } if v, ok := packed[key]; ok { - params.Offset = v.(OptInt) + params.EndDate = v.(OptInt64) } } return params } -func decodeGetItemsFromCollectionParams(args [1]string, r *http.Request) (params GetItemsFromCollectionParams, _ error) { +func decodeGetEventsByAccountParams(args [1]string, r *http.Request) (params GetEventsByAccountParams, _ error) { q := uri.NewQueryDecoder(r.URL.Query()) + h := uri.NewHeaderDecoder(r.Header) // Decode path: account_id. { param := args[0] @@ -1692,363 +1867,242 @@ func decodeGetItemsFromCollectionParams(args [1]string, r *http.Request) (params return params, errors.New("path: account_id: not specified") } } - // Set default value for query: limit. + // Set default value for header: Accept-Language. { - val := int(1000) - params.Limit.SetTo(val) + val := string("en") + params.AcceptLanguage.SetTo(val) } - // Decode query: limit. + // Decode header: Accept-Language. + { + cfg := uri.HeaderParameterDecodingConfig{ + Name: "Accept-Language", + Explode: false, + } + if err := h.HasParam(cfg); err == nil { + if err := h.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotAcceptLanguageVal string + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + paramsDotAcceptLanguageVal = c + return nil + }(); err != nil { + return err + } + params.AcceptLanguage.SetTo(paramsDotAcceptLanguageVal) + return nil + }); err != nil { + return params, errors.Wrap(err, "header: Accept-Language: parse") + } + } + } + // Set default value for query: subject_only. + { + val := bool(false) + params.SubjectOnly.SetTo(val) + } + // Decode query: subject_only. { cfg := uri.QueryParameterDecodingConfig{ - Name: "limit", + Name: "subject_only", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotLimitVal int + var paramsDotSubjectOnlyVal bool if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt(val) + c, err := conv.ToBool(val) if err != nil { return err } - paramsDotLimitVal = c + paramsDotSubjectOnlyVal = c return nil }(); err != nil { return err } - params.Limit.SetTo(paramsDotLimitVal) + params.SubjectOnly.SetTo(paramsDotSubjectOnlyVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: limit: parse") - } - if err := func() error { - if params.Limit.Set { - if err := func() error { - if err := (validate.Int{ - MinSet: false, - Min: 0, - MaxSet: true, - Max: 1000, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - }).Validate(int64(params.Limit.Value)); err != nil { - return errors.Wrap(err, "int") - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - return params, errors.Wrap(err, "query: limit: invalid") + return params, errors.Wrap(err, "query: subject_only: parse") } } } - // Set default value for query: offset. - { - val := int(0) - params.Offset.SetTo(val) - } - // Decode query: offset. + // Decode query: before_lt. { cfg := uri.QueryParameterDecodingConfig{ - Name: "offset", + Name: "before_lt", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotOffsetVal int + var paramsDotBeforeLtVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt(val) + c, err := conv.ToInt64(val) if err != nil { return err } - paramsDotOffsetVal = c + paramsDotBeforeLtVal = c return nil }(); err != nil { return err } - params.Offset.SetTo(paramsDotOffsetVal) + params.BeforeLt.SetTo(paramsDotBeforeLtVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: offset: parse") + return params, errors.Wrap(err, "query: before_lt: parse") } } } - return params, nil -} - -// GetJettonInfoParams is parameters of getJettonInfo operation. -type GetJettonInfoParams struct { - // Account ID. - AccountID string -} - -func unpackGetJettonInfoParams(packed middleware.Parameters) (params GetJettonInfoParams) { + // Decode query: limit. { - key := middleware.ParameterKey{ - Name: "account_id", - In: "path", + cfg := uri.QueryParameterDecodingConfig{ + Name: "limit", + Style: uri.QueryStyleForm, + Explode: true, } - params.AccountID = packed[key].(string) - } - return params -} - -func decodeGetJettonInfoParams(args [1]string, r *http.Request) (params GetJettonInfoParams, _ error) { - // Decode path: account_id. - { - param := args[0] - if len(param) > 0 { - d := uri.NewPathDecoder(uri.PathDecoderConfig{ - Param: "account_id", - Value: param, - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToString(val) + c, err := conv.ToInt(val) if err != nil { return err } - params.AccountID = c + params.Limit = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: limit: parse") + } + if err := func() error { + if err := (validate.Int{ + MinSet: false, + Min: 0, + MaxSet: true, + Max: 1000, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + }).Validate(int64(params.Limit)); err != nil { + return errors.Wrap(err, "int") + } return nil }(); err != nil { - return params, errors.Wrap(err, "path: account_id: parse") + return params, errors.Wrap(err, "query: limit: invalid") } } else { - return params, errors.New("path: account_id: not specified") - } - } - return params, nil -} - -// GetJettonsParams is parameters of getJettons operation. -type GetJettonsParams struct { - Limit OptInt32 - Offset OptInt32 -} - -func unpackGetJettonsParams(packed middleware.Parameters) (params GetJettonsParams) { - { - key := middleware.ParameterKey{ - Name: "limit", - In: "query", - } - if v, ok := packed[key]; ok { - params.Limit = v.(OptInt32) - } - } - { - key := middleware.ParameterKey{ - Name: "offset", - In: "query", - } - if v, ok := packed[key]; ok { - params.Offset = v.(OptInt32) + return params, errors.Wrap(err, "query") } } - return params -} - -func decodeGetJettonsParams(args [0]string, r *http.Request) (params GetJettonsParams, _ error) { - q := uri.NewQueryDecoder(r.URL.Query()) - // Set default value for query: limit. - { - val := int32(100) - params.Limit.SetTo(val) - } - // Decode query: limit. + // Decode query: start_date. { cfg := uri.QueryParameterDecodingConfig{ - Name: "limit", + Name: "start_date", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotLimitVal int32 + var paramsDotStartDateVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt32(val) + c, err := conv.ToInt64(val) if err != nil { return err } - paramsDotLimitVal = c + paramsDotStartDateVal = c return nil }(); err != nil { return err } - params.Limit.SetTo(paramsDotLimitVal) + params.StartDate.SetTo(paramsDotStartDateVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: limit: parse") - } - if err := func() error { - if params.Limit.Set { - if err := func() error { - if err := (validate.Int{ - MinSet: false, - Min: 0, - MaxSet: true, - Max: 1000, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - }).Validate(int64(params.Limit.Value)); err != nil { - return errors.Wrap(err, "int") - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - return params, errors.Wrap(err, "query: limit: invalid") + return params, errors.Wrap(err, "query: start_date: parse") } } } - // Set default value for query: offset. - { - val := int32(0) - params.Offset.SetTo(val) - } - // Decode query: offset. + // Decode query: end_date. { cfg := uri.QueryParameterDecodingConfig{ - Name: "offset", + Name: "end_date", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotOffsetVal int32 + var paramsDotEndDateVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt32(val) + c, err := conv.ToInt64(val) if err != nil { return err } - paramsDotOffsetVal = c + paramsDotEndDateVal = c return nil }(); err != nil { return err } - params.Offset.SetTo(paramsDotOffsetVal) + params.EndDate.SetTo(paramsDotEndDateVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: offset: parse") + return params, errors.Wrap(err, "query: end_date: parse") } } } return params, nil } -// GetJettonsBalancesParams is parameters of getJettonsBalances operation. -type GetJettonsBalancesParams struct { +// GetItemsFromCollectionParams is parameters of getItemsFromCollection operation. +type GetItemsFromCollectionParams struct { // Account ID. AccountID string + Limit OptInt + Offset OptInt } -func unpackGetJettonsBalancesParams(packed middleware.Parameters) (params GetJettonsBalancesParams) { - { - key := middleware.ParameterKey{ - Name: "account_id", - In: "path", - } - params.AccountID = packed[key].(string) - } - return params -} - -func decodeGetJettonsBalancesParams(args [1]string, r *http.Request) (params GetJettonsBalancesParams, _ error) { - // Decode path: account_id. - { - param := args[0] - if len(param) > 0 { - d := uri.NewPathDecoder(uri.PathDecoderConfig{ - Param: "account_id", - Value: param, - Style: uri.PathStyleSimple, - Explode: false, - }) - - if err := func() error { - val, err := d.DecodeValue() - if err != nil { - return err - } - - c, err := conv.ToString(val) - if err != nil { - return err - } - - params.AccountID = c - return nil - }(); err != nil { - return params, errors.Wrap(err, "path: account_id: parse") - } - } else { - return params, errors.New("path: account_id: not specified") - } - } - return params, nil -} - -// GetJettonsHistoryParams is parameters of getJettonsHistory operation. -type GetJettonsHistoryParams struct { - // Account ID. - AccountID string - AcceptLanguage OptString - // Omit this parameter to get last events. - BeforeLt OptInt64 - Limit int - StartDate OptInt64 - EndDate OptInt64 -} - -func unpackGetJettonsHistoryParams(packed middleware.Parameters) (params GetJettonsHistoryParams) { +func unpackGetItemsFromCollectionParams(packed middleware.Parameters) (params GetItemsFromCollectionParams) { { key := middleware.ParameterKey{ Name: "account_id", @@ -2056,55 +2110,29 @@ func unpackGetJettonsHistoryParams(packed middleware.Parameters) (params GetJett } params.AccountID = packed[key].(string) } - { - key := middleware.ParameterKey{ - Name: "Accept-Language", - In: "header", - } - if v, ok := packed[key]; ok { - params.AcceptLanguage = v.(OptString) - } - } - { - key := middleware.ParameterKey{ - Name: "before_lt", - In: "query", - } - if v, ok := packed[key]; ok { - params.BeforeLt = v.(OptInt64) - } - } { key := middleware.ParameterKey{ Name: "limit", In: "query", } - params.Limit = packed[key].(int) - } - { - key := middleware.ParameterKey{ - Name: "start_date", - In: "query", - } if v, ok := packed[key]; ok { - params.StartDate = v.(OptInt64) + params.Limit = v.(OptInt) } } { key := middleware.ParameterKey{ - Name: "end_date", + Name: "offset", In: "query", } if v, ok := packed[key]; ok { - params.EndDate = v.(OptInt64) + params.Offset = v.(OptInt) } } return params } -func decodeGetJettonsHistoryParams(args [1]string, r *http.Request) (params GetJettonsHistoryParams, _ error) { +func decodeGetItemsFromCollectionParams(args [1]string, r *http.Request) (params GetItemsFromCollectionParams, _ error) { q := uri.NewQueryDecoder(r.URL.Query()) - h := uri.NewHeaderDecoder(r.Header) // Decode path: account_id. { param := args[0] @@ -2136,209 +2164,118 @@ func decodeGetJettonsHistoryParams(args [1]string, r *http.Request) (params GetJ return params, errors.New("path: account_id: not specified") } } - // Set default value for header: Accept-Language. - { - val := string("en") - params.AcceptLanguage.SetTo(val) - } - // Decode header: Accept-Language. + // Set default value for query: limit. { - cfg := uri.HeaderParameterDecodingConfig{ - Name: "Accept-Language", - Explode: false, - } - if err := h.HasParam(cfg); err == nil { - if err := h.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotAcceptLanguageVal string - if err := func() error { - val, err := d.DecodeValue() - if err != nil { - return err - } - - c, err := conv.ToString(val) - if err != nil { - return err - } - - paramsDotAcceptLanguageVal = c - return nil - }(); err != nil { - return err - } - params.AcceptLanguage.SetTo(paramsDotAcceptLanguageVal) - return nil - }); err != nil { - return params, errors.Wrap(err, "header: Accept-Language: parse") - } - } + val := int(1000) + params.Limit.SetTo(val) } - // Decode query: before_lt. + // Decode query: limit. { cfg := uri.QueryParameterDecodingConfig{ - Name: "before_lt", + Name: "limit", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotBeforeLtVal int64 + var paramsDotLimitVal int if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt64(val) + c, err := conv.ToInt(val) if err != nil { return err } - paramsDotBeforeLtVal = c + paramsDotLimitVal = c return nil }(); err != nil { return err } - params.BeforeLt.SetTo(paramsDotBeforeLtVal) - return nil - }); err != nil { - return params, errors.Wrap(err, "query: before_lt: parse") - } - } - } - // Decode query: limit. - { - cfg := uri.QueryParameterDecodingConfig{ - Name: "limit", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.HasParam(cfg); err == nil { - if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - val, err := d.DecodeValue() - if err != nil { - return err - } - - c, err := conv.ToInt(val) - if err != nil { - return err - } - - params.Limit = c + params.Limit.SetTo(paramsDotLimitVal) return nil }); err != nil { return params, errors.Wrap(err, "query: limit: parse") } if err := func() error { - if err := (validate.Int{ - MinSet: false, - Min: 0, - MaxSet: true, - Max: 1000, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - }).Validate(int64(params.Limit)); err != nil { - return errors.Wrap(err, "int") + if params.Limit.Set { + if err := func() error { + if err := (validate.Int{ + MinSet: false, + Min: 0, + MaxSet: true, + Max: 1000, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + }).Validate(int64(params.Limit.Value)); err != nil { + return errors.Wrap(err, "int") + } + return nil + }(); err != nil { + return err + } } return nil }(); err != nil { return params, errors.Wrap(err, "query: limit: invalid") } - } else { - return params, errors.Wrap(err, "query") } } - // Decode query: start_date. + // Set default value for query: offset. { - cfg := uri.QueryParameterDecodingConfig{ - Name: "start_date", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.HasParam(cfg); err == nil { - if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotStartDateVal int64 - if err := func() error { - val, err := d.DecodeValue() - if err != nil { - return err - } - - c, err := conv.ToInt64(val) - if err != nil { - return err - } - - paramsDotStartDateVal = c - return nil - }(); err != nil { - return err - } - params.StartDate.SetTo(paramsDotStartDateVal) - return nil - }); err != nil { - return params, errors.Wrap(err, "query: start_date: parse") - } - } + val := int(0) + params.Offset.SetTo(val) } - // Decode query: end_date. + // Decode query: offset. { cfg := uri.QueryParameterDecodingConfig{ - Name: "end_date", + Name: "offset", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotEndDateVal int64 + var paramsDotOffsetVal int if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt64(val) + c, err := conv.ToInt(val) if err != nil { return err } - paramsDotEndDateVal = c + paramsDotOffsetVal = c return nil }(); err != nil { return err } - params.EndDate.SetTo(paramsDotEndDateVal) + params.Offset.SetTo(paramsDotOffsetVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: end_date: parse") + return params, errors.Wrap(err, "query: offset: parse") } } } return params, nil } -// GetJettonsHistoryByIDParams is parameters of getJettonsHistoryByID operation. -type GetJettonsHistoryByIDParams struct { +// GetJettonInfoParams is parameters of getJettonInfo operation. +type GetJettonInfoParams struct { // Account ID. AccountID string - // Jetton ID. - JettonID string - AcceptLanguage OptString - // Omit this parameter to get last events. - BeforeLt OptInt64 - Limit int - StartDate OptInt64 - EndDate OptInt64 } -func unpackGetJettonsHistoryByIDParams(packed middleware.Parameters) (params GetJettonsHistoryByIDParams) { +func unpackGetJettonInfoParams(packed middleware.Parameters) (params GetJettonInfoParams) { { key := middleware.ParameterKey{ Name: "account_id", @@ -2346,62 +2283,10 @@ func unpackGetJettonsHistoryByIDParams(packed middleware.Parameters) (params Get } params.AccountID = packed[key].(string) } - { - key := middleware.ParameterKey{ - Name: "jetton_id", - In: "path", - } - params.JettonID = packed[key].(string) - } - { - key := middleware.ParameterKey{ - Name: "Accept-Language", - In: "header", - } - if v, ok := packed[key]; ok { - params.AcceptLanguage = v.(OptString) - } - } - { - key := middleware.ParameterKey{ - Name: "before_lt", - In: "query", - } - if v, ok := packed[key]; ok { - params.BeforeLt = v.(OptInt64) - } - } - { - key := middleware.ParameterKey{ - Name: "limit", - In: "query", - } - params.Limit = packed[key].(int) - } - { - key := middleware.ParameterKey{ - Name: "start_date", - In: "query", - } - if v, ok := packed[key]; ok { - params.StartDate = v.(OptInt64) - } - } - { - key := middleware.ParameterKey{ - Name: "end_date", - In: "query", - } - if v, ok := packed[key]; ok { - params.EndDate = v.(OptInt64) - } - } return params } -func decodeGetJettonsHistoryByIDParams(args [2]string, r *http.Request) (params GetJettonsHistoryByIDParams, _ error) { - q := uri.NewQueryDecoder(r.URL.Query()) - h := uri.NewHeaderDecoder(r.Header) +func decodeGetJettonInfoParams(args [1]string, r *http.Request) (params GetJettonInfoParams, _ error) { // Decode path: account_id. { param := args[0] @@ -2433,232 +2318,209 @@ func decodeGetJettonsHistoryByIDParams(args [2]string, r *http.Request) (params return params, errors.New("path: account_id: not specified") } } - // Decode path: jetton_id. - { - param := args[1] - if len(param) > 0 { - d := uri.NewPathDecoder(uri.PathDecoderConfig{ - Param: "jetton_id", - Value: param, - Style: uri.PathStyleSimple, - Explode: false, - }) - - if err := func() error { - val, err := d.DecodeValue() - if err != nil { - return err - } + return params, nil +} - c, err := conv.ToString(val) - if err != nil { - return err - } +// GetJettonsParams is parameters of getJettons operation. +type GetJettonsParams struct { + Limit OptInt32 + Offset OptInt32 +} - params.JettonID = c - return nil - }(); err != nil { - return params, errors.Wrap(err, "path: jetton_id: parse") - } - } else { - return params, errors.New("path: jetton_id: not specified") +func unpackGetJettonsParams(packed middleware.Parameters) (params GetJettonsParams) { + { + key := middleware.ParameterKey{ + Name: "limit", + In: "query", + } + if v, ok := packed[key]; ok { + params.Limit = v.(OptInt32) } } - // Set default value for header: Accept-Language. { - val := string("en") - params.AcceptLanguage.SetTo(val) + key := middleware.ParameterKey{ + Name: "offset", + In: "query", + } + if v, ok := packed[key]; ok { + params.Offset = v.(OptInt32) + } } - // Decode header: Accept-Language. + return params +} + +func decodeGetJettonsParams(args [0]string, r *http.Request) (params GetJettonsParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Set default value for query: limit. { - cfg := uri.HeaderParameterDecodingConfig{ - Name: "Accept-Language", - Explode: false, + val := int32(100) + params.Limit.SetTo(val) + } + // Decode query: limit. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "limit", + Style: uri.QueryStyleForm, + Explode: true, } - if err := h.HasParam(cfg); err == nil { - if err := h.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotAcceptLanguageVal string + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotLimitVal int32 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToString(val) + c, err := conv.ToInt32(val) if err != nil { return err } - paramsDotAcceptLanguageVal = c + paramsDotLimitVal = c return nil }(); err != nil { return err } - params.AcceptLanguage.SetTo(paramsDotAcceptLanguageVal) + params.Limit.SetTo(paramsDotLimitVal) return nil }); err != nil { - return params, errors.Wrap(err, "header: Accept-Language: parse") + return params, errors.Wrap(err, "query: limit: parse") + } + if err := func() error { + if params.Limit.Set { + if err := func() error { + if err := (validate.Int{ + MinSet: false, + Min: 0, + MaxSet: true, + Max: 1000, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + }).Validate(int64(params.Limit.Value)); err != nil { + return errors.Wrap(err, "int") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return params, errors.Wrap(err, "query: limit: invalid") } } } - // Decode query: before_lt. + // Set default value for query: offset. + { + val := int32(0) + params.Offset.SetTo(val) + } + // Decode query: offset. { cfg := uri.QueryParameterDecodingConfig{ - Name: "before_lt", + Name: "offset", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotBeforeLtVal int64 + var paramsDotOffsetVal int32 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt64(val) + c, err := conv.ToInt32(val) if err != nil { return err } - paramsDotBeforeLtVal = c + paramsDotOffsetVal = c return nil }(); err != nil { return err } - params.BeforeLt.SetTo(paramsDotBeforeLtVal) + params.Offset.SetTo(paramsDotOffsetVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: before_lt: parse") + return params, errors.Wrap(err, "query: offset: parse") } } } - // Decode query: limit. + return params, nil +} + +// GetJettonsBalancesParams is parameters of getJettonsBalances operation. +type GetJettonsBalancesParams struct { + // Account ID. + AccountID string +} + +func unpackGetJettonsBalancesParams(packed middleware.Parameters) (params GetJettonsBalancesParams) { { - cfg := uri.QueryParameterDecodingConfig{ - Name: "limit", - Style: uri.QueryStyleForm, - Explode: true, + key := middleware.ParameterKey{ + Name: "account_id", + In: "path", } + params.AccountID = packed[key].(string) + } + return params +} - if err := q.HasParam(cfg); err == nil { - if err := q.DecodeParam(cfg, func(d uri.Decoder) error { +func decodeGetJettonsBalancesParams(args [1]string, r *http.Request) (params GetJettonsBalancesParams, _ error) { + // Decode path: account_id. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "account_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt(val) + c, err := conv.ToString(val) if err != nil { return err } - params.Limit = c - return nil - }); err != nil { - return params, errors.Wrap(err, "query: limit: parse") - } - if err := func() error { - if err := (validate.Int{ - MinSet: false, - Min: 0, - MaxSet: true, - Max: 1000, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - }).Validate(int64(params.Limit)); err != nil { - return errors.Wrap(err, "int") - } + params.AccountID = c return nil }(); err != nil { - return params, errors.Wrap(err, "query: limit: invalid") + return params, errors.Wrap(err, "path: account_id: parse") } } else { - return params, errors.Wrap(err, "query") - } - } - // Decode query: start_date. - { - cfg := uri.QueryParameterDecodingConfig{ - Name: "start_date", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.HasParam(cfg); err == nil { - if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotStartDateVal int64 - if err := func() error { - val, err := d.DecodeValue() - if err != nil { - return err - } - - c, err := conv.ToInt64(val) - if err != nil { - return err - } - - paramsDotStartDateVal = c - return nil - }(); err != nil { - return err - } - params.StartDate.SetTo(paramsDotStartDateVal) - return nil - }); err != nil { - return params, errors.Wrap(err, "query: start_date: parse") - } - } - } - // Decode query: end_date. - { - cfg := uri.QueryParameterDecodingConfig{ - Name: "end_date", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.HasParam(cfg); err == nil { - if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotEndDateVal int64 - if err := func() error { - val, err := d.DecodeValue() - if err != nil { - return err - } - - c, err := conv.ToInt64(val) - if err != nil { - return err - } - - paramsDotEndDateVal = c - return nil - }(); err != nil { - return err - } - params.EndDate.SetTo(paramsDotEndDateVal) - return nil - }); err != nil { - return params, errors.Wrap(err, "query: end_date: parse") - } + return params, errors.New("path: account_id: not specified") } } return params, nil } -// GetNftCollectionParams is parameters of getNftCollection operation. -type GetNftCollectionParams struct { +// GetJettonsHistoryParams is parameters of getJettonsHistory operation. +type GetJettonsHistoryParams struct { // Account ID. - AccountID string + AccountID string + AcceptLanguage OptString + // Omit this parameter to get last events. + BeforeLt OptInt64 + Limit int + StartDate OptInt64 + EndDate OptInt64 } -func unpackGetNftCollectionParams(packed middleware.Parameters) (params GetNftCollectionParams) { +func unpackGetJettonsHistoryParams(packed middleware.Parameters) (params GetJettonsHistoryParams) { { key := middleware.ParameterKey{ Name: "account_id", @@ -2666,10 +2528,55 @@ func unpackGetNftCollectionParams(packed middleware.Parameters) (params GetNftCo } params.AccountID = packed[key].(string) } + { + key := middleware.ParameterKey{ + Name: "Accept-Language", + In: "header", + } + if v, ok := packed[key]; ok { + params.AcceptLanguage = v.(OptString) + } + } + { + key := middleware.ParameterKey{ + Name: "before_lt", + In: "query", + } + if v, ok := packed[key]; ok { + params.BeforeLt = v.(OptInt64) + } + } + { + key := middleware.ParameterKey{ + Name: "limit", + In: "query", + } + params.Limit = packed[key].(int) + } + { + key := middleware.ParameterKey{ + Name: "start_date", + In: "query", + } + if v, ok := packed[key]; ok { + params.StartDate = v.(OptInt64) + } + } + { + key := middleware.ParameterKey{ + Name: "end_date", + In: "query", + } + if v, ok := packed[key]; ok { + params.EndDate = v.(OptInt64) + } + } return params } -func decodeGetNftCollectionParams(args [1]string, r *http.Request) (params GetNftCollectionParams, _ error) { +func decodeGetJettonsHistoryParams(args [1]string, r *http.Request) (params GetJettonsHistoryParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + h := uri.NewHeaderDecoder(r.Header) // Decode path: account_id. { param := args[0] @@ -2701,210 +2608,209 @@ func decodeGetNftCollectionParams(args [1]string, r *http.Request) (params GetNf return params, errors.New("path: account_id: not specified") } } - return params, nil -} - -// GetNftCollectionsParams is parameters of getNftCollections operation. -type GetNftCollectionsParams struct { - Limit OptInt32 - Offset OptInt32 -} - -func unpackGetNftCollectionsParams(packed middleware.Parameters) (params GetNftCollectionsParams) { - { - key := middleware.ParameterKey{ - Name: "limit", - In: "query", - } - if v, ok := packed[key]; ok { - params.Limit = v.(OptInt32) - } - } - { - key := middleware.ParameterKey{ - Name: "offset", - In: "query", - } - if v, ok := packed[key]; ok { - params.Offset = v.(OptInt32) - } - } - return params -} - -func decodeGetNftCollectionsParams(args [0]string, r *http.Request) (params GetNftCollectionsParams, _ error) { - q := uri.NewQueryDecoder(r.URL.Query()) - // Set default value for query: limit. + // Set default value for header: Accept-Language. { - val := int32(100) - params.Limit.SetTo(val) + val := string("en") + params.AcceptLanguage.SetTo(val) } - // Decode query: limit. + // Decode header: Accept-Language. { - cfg := uri.QueryParameterDecodingConfig{ - Name: "limit", - Style: uri.QueryStyleForm, - Explode: true, + cfg := uri.HeaderParameterDecodingConfig{ + Name: "Accept-Language", + Explode: false, } - - if err := q.HasParam(cfg); err == nil { - if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotLimitVal int32 + if err := h.HasParam(cfg); err == nil { + if err := h.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotAcceptLanguageVal string if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt32(val) + c, err := conv.ToString(val) if err != nil { return err } - paramsDotLimitVal = c + paramsDotAcceptLanguageVal = c return nil }(); err != nil { return err } - params.Limit.SetTo(paramsDotLimitVal) + params.AcceptLanguage.SetTo(paramsDotAcceptLanguageVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: limit: parse") - } - if err := func() error { - if params.Limit.Set { - if err := func() error { - if err := (validate.Int{ - MinSet: false, - Min: 0, - MaxSet: true, - Max: 1000, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - }).Validate(int64(params.Limit.Value)); err != nil { - return errors.Wrap(err, "int") - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - return params, errors.Wrap(err, "query: limit: invalid") + return params, errors.Wrap(err, "header: Accept-Language: parse") } } } - // Set default value for query: offset. - { - val := int32(0) - params.Offset.SetTo(val) - } - // Decode query: offset. + // Decode query: before_lt. { cfg := uri.QueryParameterDecodingConfig{ - Name: "offset", + Name: "before_lt", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotOffsetVal int32 + var paramsDotBeforeLtVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt32(val) + c, err := conv.ToInt64(val) if err != nil { return err } - paramsDotOffsetVal = c + paramsDotBeforeLtVal = c return nil }(); err != nil { return err } - params.Offset.SetTo(paramsDotOffsetVal) + params.BeforeLt.SetTo(paramsDotBeforeLtVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: offset: parse") + return params, errors.Wrap(err, "query: before_lt: parse") } } } - return params, nil -} - -// GetNftItemByAddressParams is parameters of getNftItemByAddress operation. -type GetNftItemByAddressParams struct { - // Account ID. - AccountID string -} - -func unpackGetNftItemByAddressParams(packed middleware.Parameters) (params GetNftItemByAddressParams) { + // Decode query: limit. { - key := middleware.ParameterKey{ - Name: "account_id", - In: "path", + cfg := uri.QueryParameterDecodingConfig{ + Name: "limit", + Style: uri.QueryStyleForm, + Explode: true, } - params.AccountID = packed[key].(string) - } - return params -} -func decodeGetNftItemByAddressParams(args [1]string, r *http.Request) (params GetNftItemByAddressParams, _ error) { - // Decode path: account_id. - { - param := args[0] - if len(param) > 0 { - d := uri.NewPathDecoder(uri.PathDecoderConfig{ - Param: "account_id", - Value: param, - Style: uri.PathStyleSimple, - Explode: false, - }) - - if err := func() error { + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToString(val) + c, err := conv.ToInt(val) if err != nil { return err } - params.AccountID = c + params.Limit = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: limit: parse") + } + if err := func() error { + if err := (validate.Int{ + MinSet: false, + Min: 0, + MaxSet: true, + Max: 1000, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + }).Validate(int64(params.Limit)); err != nil { + return errors.Wrap(err, "int") + } return nil }(); err != nil { - return params, errors.Wrap(err, "path: account_id: parse") + return params, errors.Wrap(err, "query: limit: invalid") } } else { - return params, errors.New("path: account_id: not specified") + return params, errors.Wrap(err, "query") + } + } + // Decode query: start_date. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "start_date", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotStartDateVal int64 + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt64(val) + if err != nil { + return err + } + + paramsDotStartDateVal = c + return nil + }(); err != nil { + return err + } + params.StartDate.SetTo(paramsDotStartDateVal) + return nil + }); err != nil { + return params, errors.Wrap(err, "query: start_date: parse") + } + } + } + // Decode query: end_date. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "end_date", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotEndDateVal int64 + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt64(val) + if err != nil { + return err + } + + paramsDotEndDateVal = c + return nil + }(); err != nil { + return err + } + params.EndDate.SetTo(paramsDotEndDateVal) + return nil + }); err != nil { + return params, errors.Wrap(err, "query: end_date: parse") + } } } return params, nil } -// GetNftItemsByOwnerParams is parameters of getNftItemsByOwner operation. -type GetNftItemsByOwnerParams struct { +// GetJettonsHistoryByIDParams is parameters of getJettonsHistoryByID operation. +type GetJettonsHistoryByIDParams struct { // Account ID. AccountID string - // Nft collection. - Collection OptString - Limit OptInt - Offset OptInt - // Selling nft items in ton implemented usually via transfer items to special selling account. This - // option enables including items which owned not directly. - IndirectOwnership OptBool + // Jetton ID. + JettonID string + AcceptLanguage OptString + // Omit this parameter to get last events. + BeforeLt OptInt64 + Limit int + StartDate OptInt64 + EndDate OptInt64 } -func unpackGetNftItemsByOwnerParams(packed middleware.Parameters) (params GetNftItemsByOwnerParams) { +func unpackGetJettonsHistoryByIDParams(packed middleware.Parameters) (params GetJettonsHistoryByIDParams) { { key := middleware.ParameterKey{ Name: "account_id", @@ -2914,45 +2820,60 @@ func unpackGetNftItemsByOwnerParams(packed middleware.Parameters) (params GetNft } { key := middleware.ParameterKey{ - Name: "collection", - In: "query", + Name: "jetton_id", + In: "path", + } + params.JettonID = packed[key].(string) + } + { + key := middleware.ParameterKey{ + Name: "Accept-Language", + In: "header", } if v, ok := packed[key]; ok { - params.Collection = v.(OptString) + params.AcceptLanguage = v.(OptString) } } { key := middleware.ParameterKey{ - Name: "limit", + Name: "before_lt", In: "query", } if v, ok := packed[key]; ok { - params.Limit = v.(OptInt) + params.BeforeLt = v.(OptInt64) } } { key := middleware.ParameterKey{ - Name: "offset", + Name: "limit", + In: "query", + } + params.Limit = packed[key].(int) + } + { + key := middleware.ParameterKey{ + Name: "start_date", In: "query", } if v, ok := packed[key]; ok { - params.Offset = v.(OptInt) + params.StartDate = v.(OptInt64) } } { key := middleware.ParameterKey{ - Name: "indirect_ownership", + Name: "end_date", In: "query", } if v, ok := packed[key]; ok { - params.IndirectOwnership = v.(OptBool) + params.EndDate = v.(OptInt64) } } return params } -func decodeGetNftItemsByOwnerParams(args [1]string, r *http.Request) (params GetNftItemsByOwnerParams, _ error) { +func decodeGetJettonsHistoryByIDParams(args [2]string, r *http.Request) (params GetJettonsHistoryByIDParams, _ error) { q := uri.NewQueryDecoder(r.URL.Query()) + h := uri.NewHeaderDecoder(r.Header) // Decode path: account_id. { param := args[0] @@ -2984,17 +2905,51 @@ func decodeGetNftItemsByOwnerParams(args [1]string, r *http.Request) (params Get return params, errors.New("path: account_id: not specified") } } - // Decode query: collection. + // Decode path: jetton_id. { - cfg := uri.QueryParameterDecodingConfig{ - Name: "collection", - Style: uri.QueryStyleForm, - Explode: true, - } + param := args[1] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "jetton_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) - if err := q.HasParam(cfg); err == nil { - if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotCollectionVal string + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.JettonID = c + return nil + }(); err != nil { + return params, errors.Wrap(err, "path: jetton_id: parse") + } + } else { + return params, errors.New("path: jetton_id: not specified") + } + } + // Set default value for header: Accept-Language. + { + val := string("en") + params.AcceptLanguage.SetTo(val) + } + // Decode header: Accept-Language. + { + cfg := uri.HeaderParameterDecodingConfig{ + Name: "Accept-Language", + Explode: false, + } + if err := h.HasParam(cfg); err == nil { + if err := h.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotAcceptLanguageVal string if err := func() error { val, err := d.DecodeValue() if err != nil { @@ -3006,186 +2961,234 @@ func decodeGetNftItemsByOwnerParams(args [1]string, r *http.Request) (params Get return err } - paramsDotCollectionVal = c + paramsDotAcceptLanguageVal = c return nil }(); err != nil { return err } - params.Collection.SetTo(paramsDotCollectionVal) + params.AcceptLanguage.SetTo(paramsDotAcceptLanguageVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: collection: parse") + return params, errors.Wrap(err, "header: Accept-Language: parse") } } } - // Set default value for query: limit. - { - val := int(1000) - params.Limit.SetTo(val) - } - // Decode query: limit. + // Decode query: before_lt. { cfg := uri.QueryParameterDecodingConfig{ - Name: "limit", + Name: "before_lt", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotLimitVal int + var paramsDotBeforeLtVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt(val) + c, err := conv.ToInt64(val) if err != nil { return err } - paramsDotLimitVal = c + paramsDotBeforeLtVal = c return nil }(); err != nil { return err } - params.Limit.SetTo(paramsDotLimitVal) + params.BeforeLt.SetTo(paramsDotBeforeLtVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: limit: parse") + return params, errors.Wrap(err, "query: before_lt: parse") } - if err := func() error { - if params.Limit.Set { - if err := func() error { - if err := (validate.Int{ - MinSet: false, - Min: 0, - MaxSet: true, - Max: 1000, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - }).Validate(int64(params.Limit.Value)); err != nil { - return errors.Wrap(err, "int") - } - return nil - }(); err != nil { - return err - } + } + } + // Decode query: limit. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "limit", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt(val) + if err != nil { + return err + } + + params.Limit = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: limit: parse") + } + if err := func() error { + if err := (validate.Int{ + MinSet: false, + Min: 0, + MaxSet: true, + Max: 1000, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + }).Validate(int64(params.Limit)); err != nil { + return errors.Wrap(err, "int") } return nil }(); err != nil { return params, errors.Wrap(err, "query: limit: invalid") } + } else { + return params, errors.Wrap(err, "query") } } - // Set default value for query: offset. - { - val := int(0) - params.Offset.SetTo(val) - } - // Decode query: offset. + // Decode query: start_date. { cfg := uri.QueryParameterDecodingConfig{ - Name: "offset", + Name: "start_date", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotOffsetVal int + var paramsDotStartDateVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToInt(val) + c, err := conv.ToInt64(val) if err != nil { return err } - paramsDotOffsetVal = c + paramsDotStartDateVal = c return nil }(); err != nil { return err } - params.Offset.SetTo(paramsDotOffsetVal) + params.StartDate.SetTo(paramsDotStartDateVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: offset: parse") + return params, errors.Wrap(err, "query: start_date: parse") } } } - // Set default value for query: indirect_ownership. - { - val := bool(false) - params.IndirectOwnership.SetTo(val) - } - // Decode query: indirect_ownership. + // Decode query: end_date. { cfg := uri.QueryParameterDecodingConfig{ - Name: "indirect_ownership", + Name: "end_date", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { - var paramsDotIndirectOwnershipVal bool + var paramsDotEndDateVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToBool(val) + c, err := conv.ToInt64(val) if err != nil { return err } - paramsDotIndirectOwnershipVal = c + paramsDotEndDateVal = c return nil }(); err != nil { return err } - params.IndirectOwnership.SetTo(paramsDotIndirectOwnershipVal) + params.EndDate.SetTo(paramsDotEndDateVal) return nil }); err != nil { - return params, errors.Wrap(err, "query: indirect_ownership: parse") + return params, errors.Wrap(err, "query: end_date: parse") } } } return params, nil } -// GetPublicKeyByAccountIDParams is parameters of getPublicKeyByAccountID operation. -type GetPublicKeyByAccountIDParams struct { +// GetListBlockTransactionsLiteServerParams is parameters of getListBlockTransactionsLiteServer operation. +type GetListBlockTransactionsLiteServerParams struct { + // Block ID: (workchain,shard,seqno,root_hash,file_hash). + BlockID string + // Mode. + Mode uint32 + // Count. + Count uint32 // Account ID. - AccountID string + AccountID OptString + // Lt. + Lt OptUint64 } -func unpackGetPublicKeyByAccountIDParams(packed middleware.Parameters) (params GetPublicKeyByAccountIDParams) { +func unpackGetListBlockTransactionsLiteServerParams(packed middleware.Parameters) (params GetListBlockTransactionsLiteServerParams) { { key := middleware.ParameterKey{ - Name: "account_id", + Name: "block_id", In: "path", } - params.AccountID = packed[key].(string) + params.BlockID = packed[key].(string) + } + { + key := middleware.ParameterKey{ + Name: "mode", + In: "query", + } + params.Mode = packed[key].(uint32) + } + { + key := middleware.ParameterKey{ + Name: "count", + In: "query", + } + params.Count = packed[key].(uint32) + } + { + key := middleware.ParameterKey{ + Name: "account_id", + In: "query", + } + if v, ok := packed[key]; ok { + params.AccountID = v.(OptString) + } + } + { + key := middleware.ParameterKey{ + Name: "lt", + In: "query", + } + if v, ok := packed[key]; ok { + params.Lt = v.(OptUint64) + } } return params } -func decodeGetPublicKeyByAccountIDParams(args [1]string, r *http.Request) (params GetPublicKeyByAccountIDParams, _ error) { - // Decode path: account_id. +func decodeGetListBlockTransactionsLiteServerParams(args [1]string, r *http.Request) (params GetListBlockTransactionsLiteServerParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Decode path: block_id. { param := args[0] if len(param) > 0 { d := uri.NewPathDecoder(uri.PathDecoderConfig{ - Param: "account_id", + Param: "block_id", Value: param, Style: uri.PathStyleSimple, Explode: false, @@ -3202,50 +3205,1097 @@ func decodeGetPublicKeyByAccountIDParams(args [1]string, r *http.Request) (param return err } - params.AccountID = c + params.BlockID = c return nil }(); err != nil { - return params, errors.Wrap(err, "path: account_id: parse") + return params, errors.Wrap(err, "path: block_id: parse") } } else { - return params, errors.New("path: account_id: not specified") + return params, errors.New("path: block_id: not specified") + } + } + // Decode query: mode. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "mode", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToUint32(val) + if err != nil { + return err + } + + params.Mode = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: mode: parse") + } + } else { + return params, errors.Wrap(err, "query") + } + } + // Decode query: count. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "count", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToUint32(val) + if err != nil { + return err + } + + params.Count = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: count: parse") + } + } else { + return params, errors.Wrap(err, "query") + } + } + // Decode query: account_id. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "account_id", + Style: uri.QueryStyleForm, + Explode: false, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotAccountIDVal string + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + paramsDotAccountIDVal = c + return nil + }(); err != nil { + return err + } + params.AccountID.SetTo(paramsDotAccountIDVal) + return nil + }); err != nil { + return params, errors.Wrap(err, "query: account_id: parse") + } + } + } + // Decode query: lt. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "lt", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotLtVal uint64 + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToUint64(val) + if err != nil { + return err + } + + paramsDotLtVal = c + return nil + }(); err != nil { + return err + } + params.Lt.SetTo(paramsDotLtVal) + return nil + }); err != nil { + return params, errors.Wrap(err, "query: lt: parse") + } } } return params, nil } -// GetRatesParams is parameters of getRates operation. -type GetRatesParams struct { - // Accept ton and jetton master addresses, separated by commas. - Tokens string - // Accept ton and all possible fiat currencies, separated by commas. - Currencies string +// GetMasterchainInfoExtLiteServerParams is parameters of getMasterchainInfoExtLiteServer operation. +type GetMasterchainInfoExtLiteServerParams struct { + // Mode. + Mode uint32 } -func unpackGetRatesParams(packed middleware.Parameters) (params GetRatesParams) { +func unpackGetMasterchainInfoExtLiteServerParams(packed middleware.Parameters) (params GetMasterchainInfoExtLiteServerParams) { { key := middleware.ParameterKey{ - Name: "tokens", + Name: "mode", In: "query", } - params.Tokens = packed[key].(string) + params.Mode = packed[key].(uint32) } + return params +} + +func decodeGetMasterchainInfoExtLiteServerParams(args [0]string, r *http.Request) (params GetMasterchainInfoExtLiteServerParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Decode query: mode. { - key := middleware.ParameterKey{ - Name: "currencies", - In: "query", + cfg := uri.QueryParameterDecodingConfig{ + Name: "mode", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToUint32(val) + if err != nil { + return err + } + + params.Mode = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: mode: parse") + } + } else { + return params, errors.Wrap(err, "query") + } + } + return params, nil +} + +// GetNftCollectionParams is parameters of getNftCollection operation. +type GetNftCollectionParams struct { + // Account ID. + AccountID string +} + +func unpackGetNftCollectionParams(packed middleware.Parameters) (params GetNftCollectionParams) { + { + key := middleware.ParameterKey{ + Name: "account_id", + In: "path", + } + params.AccountID = packed[key].(string) + } + return params +} + +func decodeGetNftCollectionParams(args [1]string, r *http.Request) (params GetNftCollectionParams, _ error) { + // Decode path: account_id. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "account_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.AccountID = c + return nil + }(); err != nil { + return params, errors.Wrap(err, "path: account_id: parse") + } + } else { + return params, errors.New("path: account_id: not specified") + } + } + return params, nil +} + +// GetNftCollectionsParams is parameters of getNftCollections operation. +type GetNftCollectionsParams struct { + Limit OptInt32 + Offset OptInt32 +} + +func unpackGetNftCollectionsParams(packed middleware.Parameters) (params GetNftCollectionsParams) { + { + key := middleware.ParameterKey{ + Name: "limit", + In: "query", + } + if v, ok := packed[key]; ok { + params.Limit = v.(OptInt32) + } + } + { + key := middleware.ParameterKey{ + Name: "offset", + In: "query", + } + if v, ok := packed[key]; ok { + params.Offset = v.(OptInt32) + } + } + return params +} + +func decodeGetNftCollectionsParams(args [0]string, r *http.Request) (params GetNftCollectionsParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Set default value for query: limit. + { + val := int32(100) + params.Limit.SetTo(val) + } + // Decode query: limit. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "limit", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotLimitVal int32 + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt32(val) + if err != nil { + return err + } + + paramsDotLimitVal = c + return nil + }(); err != nil { + return err + } + params.Limit.SetTo(paramsDotLimitVal) + return nil + }); err != nil { + return params, errors.Wrap(err, "query: limit: parse") + } + if err := func() error { + if params.Limit.Set { + if err := func() error { + if err := (validate.Int{ + MinSet: false, + Min: 0, + MaxSet: true, + Max: 1000, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + }).Validate(int64(params.Limit.Value)); err != nil { + return errors.Wrap(err, "int") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return params, errors.Wrap(err, "query: limit: invalid") + } + } + } + // Set default value for query: offset. + { + val := int32(0) + params.Offset.SetTo(val) + } + // Decode query: offset. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "offset", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotOffsetVal int32 + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt32(val) + if err != nil { + return err + } + + paramsDotOffsetVal = c + return nil + }(); err != nil { + return err + } + params.Offset.SetTo(paramsDotOffsetVal) + return nil + }); err != nil { + return params, errors.Wrap(err, "query: offset: parse") + } + } + } + return params, nil +} + +// GetNftItemByAddressParams is parameters of getNftItemByAddress operation. +type GetNftItemByAddressParams struct { + // Account ID. + AccountID string +} + +func unpackGetNftItemByAddressParams(packed middleware.Parameters) (params GetNftItemByAddressParams) { + { + key := middleware.ParameterKey{ + Name: "account_id", + In: "path", + } + params.AccountID = packed[key].(string) + } + return params +} + +func decodeGetNftItemByAddressParams(args [1]string, r *http.Request) (params GetNftItemByAddressParams, _ error) { + // Decode path: account_id. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "account_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.AccountID = c + return nil + }(); err != nil { + return params, errors.Wrap(err, "path: account_id: parse") + } + } else { + return params, errors.New("path: account_id: not specified") + } + } + return params, nil +} + +// GetNftItemsByOwnerParams is parameters of getNftItemsByOwner operation. +type GetNftItemsByOwnerParams struct { + // Account ID. + AccountID string + // Nft collection. + Collection OptString + Limit OptInt + Offset OptInt + // Selling nft items in ton implemented usually via transfer items to special selling account. This + // option enables including items which owned not directly. + IndirectOwnership OptBool +} + +func unpackGetNftItemsByOwnerParams(packed middleware.Parameters) (params GetNftItemsByOwnerParams) { + { + key := middleware.ParameterKey{ + Name: "account_id", + In: "path", + } + params.AccountID = packed[key].(string) + } + { + key := middleware.ParameterKey{ + Name: "collection", + In: "query", + } + if v, ok := packed[key]; ok { + params.Collection = v.(OptString) + } + } + { + key := middleware.ParameterKey{ + Name: "limit", + In: "query", + } + if v, ok := packed[key]; ok { + params.Limit = v.(OptInt) + } + } + { + key := middleware.ParameterKey{ + Name: "offset", + In: "query", + } + if v, ok := packed[key]; ok { + params.Offset = v.(OptInt) + } + } + { + key := middleware.ParameterKey{ + Name: "indirect_ownership", + In: "query", + } + if v, ok := packed[key]; ok { + params.IndirectOwnership = v.(OptBool) + } + } + return params +} + +func decodeGetNftItemsByOwnerParams(args [1]string, r *http.Request) (params GetNftItemsByOwnerParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Decode path: account_id. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "account_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.AccountID = c + return nil + }(); err != nil { + return params, errors.Wrap(err, "path: account_id: parse") + } + } else { + return params, errors.New("path: account_id: not specified") + } + } + // Decode query: collection. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "collection", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotCollectionVal string + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + paramsDotCollectionVal = c + return nil + }(); err != nil { + return err + } + params.Collection.SetTo(paramsDotCollectionVal) + return nil + }); err != nil { + return params, errors.Wrap(err, "query: collection: parse") + } + } + } + // Set default value for query: limit. + { + val := int(1000) + params.Limit.SetTo(val) + } + // Decode query: limit. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "limit", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotLimitVal int + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt(val) + if err != nil { + return err + } + + paramsDotLimitVal = c + return nil + }(); err != nil { + return err + } + params.Limit.SetTo(paramsDotLimitVal) + return nil + }); err != nil { + return params, errors.Wrap(err, "query: limit: parse") + } + if err := func() error { + if params.Limit.Set { + if err := func() error { + if err := (validate.Int{ + MinSet: false, + Min: 0, + MaxSet: true, + Max: 1000, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + }).Validate(int64(params.Limit.Value)); err != nil { + return errors.Wrap(err, "int") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return params, errors.Wrap(err, "query: limit: invalid") + } + } + } + // Set default value for query: offset. + { + val := int(0) + params.Offset.SetTo(val) + } + // Decode query: offset. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "offset", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotOffsetVal int + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt(val) + if err != nil { + return err + } + + paramsDotOffsetVal = c + return nil + }(); err != nil { + return err + } + params.Offset.SetTo(paramsDotOffsetVal) + return nil + }); err != nil { + return params, errors.Wrap(err, "query: offset: parse") + } + } + } + // Set default value for query: indirect_ownership. + { + val := bool(false) + params.IndirectOwnership.SetTo(val) + } + // Decode query: indirect_ownership. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "indirect_ownership", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotIndirectOwnershipVal bool + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToBool(val) + if err != nil { + return err + } + + paramsDotIndirectOwnershipVal = c + return nil + }(); err != nil { + return err + } + params.IndirectOwnership.SetTo(paramsDotIndirectOwnershipVal) + return nil + }); err != nil { + return params, errors.Wrap(err, "query: indirect_ownership: parse") + } + } + } + return params, nil +} + +// GetPublicKeyByAccountIDParams is parameters of getPublicKeyByAccountID operation. +type GetPublicKeyByAccountIDParams struct { + // Account ID. + AccountID string +} + +func unpackGetPublicKeyByAccountIDParams(packed middleware.Parameters) (params GetPublicKeyByAccountIDParams) { + { + key := middleware.ParameterKey{ + Name: "account_id", + In: "path", + } + params.AccountID = packed[key].(string) + } + return params +} + +func decodeGetPublicKeyByAccountIDParams(args [1]string, r *http.Request) (params GetPublicKeyByAccountIDParams, _ error) { + // Decode path: account_id. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "account_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.AccountID = c + return nil + }(); err != nil { + return params, errors.Wrap(err, "path: account_id: parse") + } + } else { + return params, errors.New("path: account_id: not specified") + } + } + return params, nil +} + +// GetRatesParams is parameters of getRates operation. +type GetRatesParams struct { + // Accept ton and jetton master addresses, separated by commas. + Tokens string + // Accept ton and all possible fiat currencies, separated by commas. + Currencies string +} + +func unpackGetRatesParams(packed middleware.Parameters) (params GetRatesParams) { + { + key := middleware.ParameterKey{ + Name: "tokens", + In: "query", + } + params.Tokens = packed[key].(string) + } + { + key := middleware.ParameterKey{ + Name: "currencies", + In: "query", + } + params.Currencies = packed[key].(string) + } + return params +} + +func decodeGetRatesParams(args [0]string, r *http.Request) (params GetRatesParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Decode query: tokens. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "tokens", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.Tokens = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: tokens: parse") + } + } else { + return params, errors.Wrap(err, "query") + } + } + // Decode query: currencies. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "currencies", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.Currencies = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: currencies: parse") + } + } else { + return params, errors.Wrap(err, "query") + } + } + return params, nil +} + +// GetRawAccountParams is parameters of getRawAccount operation. +type GetRawAccountParams struct { + // Account ID. + AccountID string +} + +func unpackGetRawAccountParams(packed middleware.Parameters) (params GetRawAccountParams) { + { + key := middleware.ParameterKey{ + Name: "account_id", + In: "path", + } + params.AccountID = packed[key].(string) + } + return params +} + +func decodeGetRawAccountParams(args [1]string, r *http.Request) (params GetRawAccountParams, _ error) { + // Decode path: account_id. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "account_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.AccountID = c + return nil + }(); err != nil { + return params, errors.Wrap(err, "path: account_id: parse") + } + } else { + return params, errors.New("path: account_id: not specified") + } + } + return params, nil +} + +// GetSearchAccountsParams is parameters of getSearchAccounts operation. +type GetSearchAccountsParams struct { + Name string +} + +func unpackGetSearchAccountsParams(packed middleware.Parameters) (params GetSearchAccountsParams) { + { + key := middleware.ParameterKey{ + Name: "name", + In: "query", + } + params.Name = packed[key].(string) + } + return params +} + +func decodeGetSearchAccountsParams(args [0]string, r *http.Request) (params GetSearchAccountsParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Decode query: name. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "name", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.Name = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: name: parse") + } + if err := func() error { + if err := (validate.String{ + MinLength: 3, + MinLengthSet: true, + MaxLength: 15, + MaxLengthSet: true, + Email: false, + Hostname: false, + Regex: nil, + }).Validate(string(params.Name)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return params, errors.Wrap(err, "query: name: invalid") + } + } else { + return params, errors.Wrap(err, "query") + } + } + return params, nil +} + +// GetShardBlockProofLiteServerParams is parameters of getShardBlockProofLiteServer operation. +type GetShardBlockProofLiteServerParams struct { + // Block ID: (workchain,shard,seqno,root_hash,file_hash). + BlockID string +} + +func unpackGetShardBlockProofLiteServerParams(packed middleware.Parameters) (params GetShardBlockProofLiteServerParams) { + { + key := middleware.ParameterKey{ + Name: "block_id", + In: "path", + } + params.BlockID = packed[key].(string) + } + return params +} + +func decodeGetShardBlockProofLiteServerParams(args [1]string, r *http.Request) (params GetShardBlockProofLiteServerParams, _ error) { + // Decode path: block_id. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "block_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.BlockID = c + return nil + }(); err != nil { + return params, errors.Wrap(err, "path: block_id: parse") + } + } else { + return params, errors.New("path: block_id: not specified") + } + } + return params, nil +} + +// GetShardInfoLiteServerParams is parameters of getShardInfoLiteServer operation. +type GetShardInfoLiteServerParams struct { + // Block ID: (workchain,shard,seqno,root_hash,file_hash). + BlockID string + // Workchain. + Workchain uint32 + // Shard. + Shard uint64 + // Exact. + Exact bool +} + +func unpackGetShardInfoLiteServerParams(packed middleware.Parameters) (params GetShardInfoLiteServerParams) { + { + key := middleware.ParameterKey{ + Name: "block_id", + In: "path", + } + params.BlockID = packed[key].(string) + } + { + key := middleware.ParameterKey{ + Name: "workchain", + In: "query", + } + params.Workchain = packed[key].(uint32) + } + { + key := middleware.ParameterKey{ + Name: "shard", + In: "query", + } + params.Shard = packed[key].(uint64) + } + { + key := middleware.ParameterKey{ + Name: "exact", + In: "query", + } + params.Exact = packed[key].(bool) + } + return params +} + +func decodeGetShardInfoLiteServerParams(args [1]string, r *http.Request) (params GetShardInfoLiteServerParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Decode path: block_id. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "block_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.BlockID = c + return nil + }(); err != nil { + return params, errors.Wrap(err, "path: block_id: parse") + } + } else { + return params, errors.New("path: block_id: not specified") } - params.Currencies = packed[key].(string) } - return params -} - -func decodeGetRatesParams(args [0]string, r *http.Request) (params GetRatesParams, _ error) { - q := uri.NewQueryDecoder(r.URL.Query()) - // Decode query: tokens. + // Decode query: workchain. { cfg := uri.QueryParameterDecodingConfig{ - Name: "tokens", + Name: "workchain", Style: uri.QueryStyleForm, Explode: true, } @@ -3257,24 +4307,24 @@ func decodeGetRatesParams(args [0]string, r *http.Request) (params GetRatesParam return err } - c, err := conv.ToString(val) + c, err := conv.ToUint32(val) if err != nil { return err } - params.Tokens = c + params.Workchain = c return nil }); err != nil { - return params, errors.Wrap(err, "query: tokens: parse") + return params, errors.Wrap(err, "query: workchain: parse") } } else { return params, errors.Wrap(err, "query") } } - // Decode query: currencies. + // Decode query: shard. { cfg := uri.QueryParameterDecodingConfig{ - Name: "currencies", + Name: "shard", Style: uri.QueryStyleForm, Explode: true, } @@ -3286,103 +4336,82 @@ func decodeGetRatesParams(args [0]string, r *http.Request) (params GetRatesParam return err } - c, err := conv.ToString(val) + c, err := conv.ToUint64(val) if err != nil { return err } - params.Currencies = c + params.Shard = c return nil }); err != nil { - return params, errors.Wrap(err, "query: currencies: parse") + return params, errors.Wrap(err, "query: shard: parse") } } else { return params, errors.Wrap(err, "query") } } - return params, nil -} - -// GetRawAccountParams is parameters of getRawAccount operation. -type GetRawAccountParams struct { - // Account ID. - AccountID string -} - -func unpackGetRawAccountParams(packed middleware.Parameters) (params GetRawAccountParams) { + // Decode query: exact. { - key := middleware.ParameterKey{ - Name: "account_id", - In: "path", + cfg := uri.QueryParameterDecodingConfig{ + Name: "exact", + Style: uri.QueryStyleForm, + Explode: true, } - params.AccountID = packed[key].(string) - } - return params -} - -func decodeGetRawAccountParams(args [1]string, r *http.Request) (params GetRawAccountParams, _ error) { - // Decode path: account_id. - { - param := args[0] - if len(param) > 0 { - d := uri.NewPathDecoder(uri.PathDecoderConfig{ - Param: "account_id", - Value: param, - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { val, err := d.DecodeValue() if err != nil { return err } - c, err := conv.ToString(val) + c, err := conv.ToBool(val) if err != nil { return err } - params.AccountID = c + params.Exact = c return nil - }(); err != nil { - return params, errors.Wrap(err, "path: account_id: parse") + }); err != nil { + return params, errors.Wrap(err, "query: exact: parse") } } else { - return params, errors.New("path: account_id: not specified") + return params, errors.Wrap(err, "query") } } return params, nil } -// GetSearchAccountsParams is parameters of getSearchAccounts operation. -type GetSearchAccountsParams struct { - Name string +// GetStateLiteServerParams is parameters of getStateLiteServer operation. +type GetStateLiteServerParams struct { + // Block ID: (workchain,shard,seqno,root_hash,file_hash). + BlockID string } -func unpackGetSearchAccountsParams(packed middleware.Parameters) (params GetSearchAccountsParams) { +func unpackGetStateLiteServerParams(packed middleware.Parameters) (params GetStateLiteServerParams) { { key := middleware.ParameterKey{ - Name: "name", - In: "query", + Name: "block_id", + In: "path", } - params.Name = packed[key].(string) + params.BlockID = packed[key].(string) } return params } -func decodeGetSearchAccountsParams(args [0]string, r *http.Request) (params GetSearchAccountsParams, _ error) { - q := uri.NewQueryDecoder(r.URL.Query()) - // Decode query: name. +func decodeGetStateLiteServerParams(args [1]string, r *http.Request) (params GetStateLiteServerParams, _ error) { + // Decode path: block_id. { - cfg := uri.QueryParameterDecodingConfig{ - Name: "name", - Style: uri.QueryStyleForm, - Explode: true, - } + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "block_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) - if err := q.HasParam(cfg); err == nil { - if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + if err := func() error { val, err := d.DecodeValue() if err != nil { return err @@ -3393,29 +4422,13 @@ func decodeGetSearchAccountsParams(args [0]string, r *http.Request) (params GetS return err } - params.Name = c - return nil - }); err != nil { - return params, errors.Wrap(err, "query: name: parse") - } - if err := func() error { - if err := (validate.String{ - MinLength: 3, - MinLengthSet: true, - MaxLength: 15, - MaxLengthSet: true, - Email: false, - Hostname: false, - Regex: nil, - }).Validate(string(params.Name)); err != nil { - return errors.Wrap(err, "string") - } + params.BlockID = c return nil }(); err != nil { - return params, errors.Wrap(err, "query: name: invalid") + return params, errors.Wrap(err, "path: block_id: parse") } } else { - return params, errors.Wrap(err, "query") + return params, errors.New("path: block_id: not specified") } } return params, nil @@ -3755,6 +4768,173 @@ func decodeGetTransactionByMessageHashParams(args [1]string, r *http.Request) (p return params, nil } +// GetTransactionsLiteServerParams is parameters of getTransactionsLiteServer operation. +type GetTransactionsLiteServerParams struct { + // Account ID. + AccountID string + // Count. + Count uint32 + // Lt. + Lt uint64 + // Hash. + Hash string +} + +func unpackGetTransactionsLiteServerParams(packed middleware.Parameters) (params GetTransactionsLiteServerParams) { + { + key := middleware.ParameterKey{ + Name: "account_id", + In: "path", + } + params.AccountID = packed[key].(string) + } + { + key := middleware.ParameterKey{ + Name: "count", + In: "query", + } + params.Count = packed[key].(uint32) + } + { + key := middleware.ParameterKey{ + Name: "lt", + In: "query", + } + params.Lt = packed[key].(uint64) + } + { + key := middleware.ParameterKey{ + Name: "hash", + In: "query", + } + params.Hash = packed[key].(string) + } + return params +} + +func decodeGetTransactionsLiteServerParams(args [1]string, r *http.Request) (params GetTransactionsLiteServerParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Decode path: account_id. + { + param := args[0] + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "account_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.AccountID = c + return nil + }(); err != nil { + return params, errors.Wrap(err, "path: account_id: parse") + } + } else { + return params, errors.New("path: account_id: not specified") + } + } + // Decode query: count. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "count", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToUint32(val) + if err != nil { + return err + } + + params.Count = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: count: parse") + } + } else { + return params, errors.Wrap(err, "query") + } + } + // Decode query: lt. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "lt", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToUint64(val) + if err != nil { + return err + } + + params.Lt = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: lt: parse") + } + } else { + return params, errors.Wrap(err, "query") + } + } + // Decode query: hash. + { + cfg := uri.QueryParameterDecodingConfig{ + Name: "hash", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.Hash = c + return nil + }); err != nil { + return params, errors.Wrap(err, "query: hash: parse") + } + } else { + return params, errors.Wrap(err, "query") + } + } + return params, nil +} + // GetWalletBackupParams is parameters of getWalletBackup operation. type GetWalletBackupParams struct { XTonConnectAuth string diff --git a/pkg/oas/oas_request_decoders_gen.go b/pkg/oas/oas_request_decoders_gen.go index 3fb1a3fe..2c768292 100644 --- a/pkg/oas/oas_request_decoders_gen.go +++ b/pkg/oas/oas_request_decoders_gen.go @@ -516,6 +516,64 @@ func (s *Server) decodeSendMessageRequest(r *http.Request) ( } } +func (s *Server) decodeSendMessageLiteServerRequest(r *http.Request) ( + req SendMessageLiteServerReq, + close func() error, + rerr error, +) { + var closers []func() error + close = func() error { + var merr error + // Close in reverse order, to match defer behavior. + for i := len(closers) - 1; i >= 0; i-- { + c := closers[i] + merr = multierr.Append(merr, c()) + } + return merr + } + defer func() { + if rerr != nil { + rerr = multierr.Append(rerr, close()) + } + }() + ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type")) + if err != nil { + return req, close, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + if r.ContentLength == 0 { + return req, close, validate.ErrBodyRequired + } + + var request SendMessageLiteServerReq + buf, err := io.ReadAll(r.Body) + if err != nil { + return req, close, err + } + + if len(buf) == 0 { + return req, close, validate.ErrBodyRequired + } + + d := jx.DecodeBytes(buf) + if err := func() error { + if err := request.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return req, close, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return req, close, errors.New("unexpected trailing data") + } + return request, close, nil + default: + return req, close, validate.InvalidContentType(ct) + } +} + func (s *Server) decodeSetWalletBackupRequest(r *http.Request) ( req SetWalletBackupReq, close func() error, diff --git a/pkg/oas/oas_request_encoders_gen.go b/pkg/oas/oas_request_encoders_gen.go index ff6be995..2d81c2a6 100644 --- a/pkg/oas/oas_request_encoders_gen.go +++ b/pkg/oas/oas_request_encoders_gen.go @@ -135,6 +135,20 @@ func encodeSendMessageRequest( return nil } +func encodeSendMessageLiteServerRequest( + req SendMessageLiteServerReq, + r *http.Request, +) error { + const contentType = "application/json" + e := jx.GetEncoder() + { + req.Encode(e) + } + encoded := e.Bytes() + ht.SetBody(r, bytes.NewReader(encoded), contentType) + return nil +} + func encodeSetWalletBackupRequest( req SetWalletBackupReq, r *http.Request, diff --git a/pkg/oas/oas_response_decoders_gen.go b/pkg/oas/oas_response_decoders_gen.go index c71f19ca..01619140 100644 --- a/pkg/oas/oas_response_decoders_gen.go +++ b/pkg/oas/oas_response_decoders_gen.go @@ -1519,6 +1519,132 @@ func decodeGetAccountSeqnoResponse(resp *http.Response) (res GetAccountSeqnoRes, return res, validate.UnexpectedStatusCode(resp.StatusCode) } +func decodeGetAccountStateLiteServerResponse(resp *http.Response) (res GetAccountStateLiteServerRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response GetAccountStateLiteServerOK + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + func decodeGetAccountTransactionsResponse(resp *http.Response) (res GetAccountTransactionsRes, err error) { switch resp.StatusCode { case 200: @@ -1535,7 +1661,1735 @@ func decodeGetAccountTransactionsResponse(resp *http.Response) (res GetAccountTr } d := jx.DecodeBytes(b) - var response Transactions + var response Transactions + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 404: + // Code 404. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response NotFound + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetAccountsResponse(resp *http.Response) (res GetAccountsRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response Accounts + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetAllAuctionsResponse(resp *http.Response) (res GetAllAuctionsRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response Auctions + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetAllShardsInfoLiteServerResponse(resp *http.Response) (res GetAllShardsInfoLiteServerRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response GetAllShardsInfoLiteServerOK + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetBlockResponse(resp *http.Response) (res GetBlockRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response Block + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 404: + // Code 404. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response NotFound + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetBlockHeaderLiteServerResponse(resp *http.Response) (res GetBlockHeaderLiteServerRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response GetBlockHeaderLiteServerOK + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetBlockLiteServerResponse(resp *http.Response) (res GetBlockLiteServerRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response GetBlockLiteServerOK + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetBlockProofLiteServerResponse(resp *http.Response) (res GetBlockProofLiteServerRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response GetBlockProofLiteServerOK + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetBlockTransactionsResponse(resp *http.Response) (res GetBlockTransactionsRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response Transactions + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 404: + // Code 404. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response NotFound + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetConfigResponse(resp *http.Response) (res GetConfigRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response Config + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetConfigAllLiteServerResponse(resp *http.Response) (res GetConfigAllLiteServerRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response GetConfigAllLiteServerOK + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetDnsExpiringResponse(resp *http.Response) (res GetDnsExpiringRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response DnsExpiring + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 404: + // Code 404. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response NotFound + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetDomainBidsResponse(resp *http.Response) (res GetDomainBidsRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response DomainBids + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 404: + // Code 404. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response NotFound + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetEventResponse(resp *http.Response) (res GetEventRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response Event if err := func() error { if err := response.Decode(d); err != nil { return err @@ -1675,7 +3529,7 @@ func decodeGetAccountTransactionsResponse(resp *http.Response) (res GetAccountTr return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetAccountsResponse(resp *http.Response) (res GetAccountsRes, err error) { +func decodeGetEventsByAccountResponse(resp *http.Response) (res GetEventsByAccountRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -1691,7 +3545,7 @@ func decodeGetAccountsResponse(resp *http.Response) (res GetAccountsRes, err err } d := jx.DecodeBytes(b) - var response Accounts + var response AccountEvents if err := func() error { if err := response.Decode(d); err != nil { return err @@ -1767,6 +3621,36 @@ func decodeGetAccountsResponse(resp *http.Response) (res GetAccountsRes, err err default: return res, validate.InvalidContentType(ct) } + case 404: + // Code 404. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response NotFound + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } case 500: // Code 500. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) @@ -1801,7 +3685,7 @@ func decodeGetAccountsResponse(resp *http.Response) (res GetAccountsRes, err err return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetAllAuctionsResponse(resp *http.Response) (res GetAllAuctionsRes, err error) { +func decodeGetItemsFromCollectionResponse(resp *http.Response) (res GetItemsFromCollectionRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -1817,7 +3701,37 @@ func decodeGetAllAuctionsResponse(resp *http.Response) (res GetAllAuctionsRes, e } d := jx.DecodeBytes(b) - var response Auctions + var response NftItems + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest if err := func() error { if err := response.Decode(d); err != nil { return err @@ -1863,6 +3777,36 @@ func decodeGetAllAuctionsResponse(resp *http.Response) (res GetAllAuctionsRes, e default: return res, validate.InvalidContentType(ct) } + case 404: + // Code 404. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response NotFound + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } case 500: // Code 500. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) @@ -1897,7 +3841,7 @@ func decodeGetAllAuctionsResponse(resp *http.Response) (res GetAllAuctionsRes, e return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetBlockResponse(resp *http.Response) (res GetBlockRes, err error) { +func decodeGetJettonInfoResponse(resp *http.Response) (res GetJettonInfoRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -1913,7 +3857,7 @@ func decodeGetBlockResponse(resp *http.Response) (res GetBlockRes, err error) { } d := jx.DecodeBytes(b) - var response Block + var response JettonInfo if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2053,7 +3997,7 @@ func decodeGetBlockResponse(resp *http.Response) (res GetBlockRes, err error) { return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetBlockTransactionsResponse(resp *http.Response) (res GetBlockTransactionsRes, err error) { +func decodeGetJettonsResponse(resp *http.Response) (res GetJettonsRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -2069,7 +4013,7 @@ func decodeGetBlockTransactionsResponse(resp *http.Response) (res GetBlockTransa } d := jx.DecodeBytes(b) - var response Transactions + var response Jettons if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2085,8 +4029,8 @@ func decodeGetBlockTransactionsResponse(resp *http.Response) (res GetBlockTransa default: return res, validate.InvalidContentType(ct) } - case 400: - // Code 400. + case 401: + // Code 401. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -2099,7 +4043,7 @@ func decodeGetBlockTransactionsResponse(resp *http.Response) (res GetBlockTransa } d := jx.DecodeBytes(b) - var response BadRequest + var response UnauthorizedError if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2115,8 +4059,8 @@ func decodeGetBlockTransactionsResponse(resp *http.Response) (res GetBlockTransa default: return res, validate.InvalidContentType(ct) } - case 401: - // Code 401. + case 500: + // Code 500. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -2129,7 +4073,7 @@ func decodeGetBlockTransactionsResponse(resp *http.Response) (res GetBlockTransa } d := jx.DecodeBytes(b) - var response UnauthorizedError + var response InternalError if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2145,8 +4089,14 @@ func decodeGetBlockTransactionsResponse(resp *http.Response) (res GetBlockTransa default: return res, validate.InvalidContentType(ct) } - case 404: - // Code 404. + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetJettonsBalancesResponse(resp *http.Response) (res GetJettonsBalancesRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -2159,7 +4109,7 @@ func decodeGetBlockTransactionsResponse(resp *http.Response) (res GetBlockTransa } d := jx.DecodeBytes(b) - var response NotFound + var response JettonsBalances if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2175,8 +4125,8 @@ func decodeGetBlockTransactionsResponse(resp *http.Response) (res GetBlockTransa default: return res, validate.InvalidContentType(ct) } - case 500: - // Code 500. + case 400: + // Code 400. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -2189,7 +4139,7 @@ func decodeGetBlockTransactionsResponse(resp *http.Response) (res GetBlockTransa } d := jx.DecodeBytes(b) - var response InternalError + var response BadRequest if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2205,14 +4155,8 @@ func decodeGetBlockTransactionsResponse(resp *http.Response) (res GetBlockTransa default: return res, validate.InvalidContentType(ct) } - } - return res, validate.UnexpectedStatusCode(resp.StatusCode) -} - -func decodeGetConfigResponse(resp *http.Response) (res GetConfigRes, err error) { - switch resp.StatusCode { - case 200: - // Code 200. + case 401: + // Code 401. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -2225,7 +4169,7 @@ func decodeGetConfigResponse(resp *http.Response) (res GetConfigRes, err error) } d := jx.DecodeBytes(b) - var response Config + var response UnauthorizedError if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2241,8 +4185,8 @@ func decodeGetConfigResponse(resp *http.Response) (res GetConfigRes, err error) default: return res, validate.InvalidContentType(ct) } - case 401: - // Code 401. + case 404: + // Code 404. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -2255,7 +4199,7 @@ func decodeGetConfigResponse(resp *http.Response) (res GetConfigRes, err error) } d := jx.DecodeBytes(b) - var response UnauthorizedError + var response NotFound if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2305,7 +4249,7 @@ func decodeGetConfigResponse(resp *http.Response) (res GetConfigRes, err error) return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetDnsExpiringResponse(resp *http.Response) (res GetDnsExpiringRes, err error) { +func decodeGetJettonsHistoryResponse(resp *http.Response) (res GetJettonsHistoryRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -2321,7 +4265,7 @@ func decodeGetDnsExpiringResponse(resp *http.Response) (res GetDnsExpiringRes, e } d := jx.DecodeBytes(b) - var response DnsExpiring + var response AccountEvents if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2461,7 +4405,7 @@ func decodeGetDnsExpiringResponse(resp *http.Response) (res GetDnsExpiringRes, e return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetDomainBidsResponse(resp *http.Response) (res GetDomainBidsRes, err error) { +func decodeGetJettonsHistoryByIDResponse(resp *http.Response) (res GetJettonsHistoryByIDRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -2477,7 +4421,7 @@ func decodeGetDomainBidsResponse(resp *http.Response) (res GetDomainBidsRes, err } d := jx.DecodeBytes(b) - var response DomainBids + var response AccountEvents if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2617,7 +4561,7 @@ func decodeGetDomainBidsResponse(resp *http.Response) (res GetDomainBidsRes, err return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetEventResponse(resp *http.Response) (res GetEventRes, err error) { +func decodeGetListBlockTransactionsLiteServerResponse(resp *http.Response) (res GetListBlockTransactionsLiteServerRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -2633,7 +4577,7 @@ func decodeGetEventResponse(resp *http.Response) (res GetEventRes, err error) { } d := jx.DecodeBytes(b) - var response Event + var response GetListBlockTransactionsLiteServerOK if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2709,8 +4653,74 @@ func decodeGetEventResponse(resp *http.Response) (res GetEventRes, err error) { default: return res, validate.InvalidContentType(ct) } - case 404: - // Code 404. + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetMasterchainHeadResponse(resp *http.Response) (res GetMasterchainHeadRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response Block + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -2723,7 +4733,7 @@ func decodeGetEventResponse(resp *http.Response) (res GetEventRes, err error) { } d := jx.DecodeBytes(b) - var response NotFound + var response UnauthorizedError if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2773,7 +4783,7 @@ func decodeGetEventResponse(resp *http.Response) (res GetEventRes, err error) { return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetEventsByAccountResponse(resp *http.Response) (res GetEventsByAccountRes, err error) { +func decodeGetMasterchainInfoExtLiteServerResponse(resp *http.Response) (res GetMasterchainInfoExtLiteServerRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -2789,7 +4799,7 @@ func decodeGetEventsByAccountResponse(resp *http.Response) (res GetEventsByAccou } d := jx.DecodeBytes(b) - var response AccountEvents + var response GetMasterchainInfoExtLiteServerOK if err := func() error { if err := response.Decode(d); err != nil { return err @@ -2865,36 +4875,6 @@ func decodeGetEventsByAccountResponse(resp *http.Response) (res GetEventsByAccou default: return res, validate.InvalidContentType(ct) } - case 404: - // Code 404. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - b, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - d := jx.DecodeBytes(b) - var response NotFound - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "decode \"application/json\"") - } - if err := d.Skip(); err != io.EOF { - return res, errors.New("unexpected trailing data") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } case 500: // Code 500. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) @@ -2929,7 +4909,7 @@ func decodeGetEventsByAccountResponse(resp *http.Response) (res GetEventsByAccou return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetItemsFromCollectionResponse(resp *http.Response) (res GetItemsFromCollectionRes, err error) { +func decodeGetMasterchainInfoLiteServerResponse(resp *http.Response) (res GetMasterchainInfoLiteServerRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -2945,7 +4925,7 @@ func decodeGetItemsFromCollectionResponse(resp *http.Response) (res GetItemsFrom } d := jx.DecodeBytes(b) - var response NftItems + var response GetMasterchainInfoLiteServerOK if err := func() error { if err := response.Decode(d); err != nil { return err @@ -3021,36 +5001,6 @@ func decodeGetItemsFromCollectionResponse(resp *http.Response) (res GetItemsFrom default: return res, validate.InvalidContentType(ct) } - case 404: - // Code 404. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - b, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - d := jx.DecodeBytes(b) - var response NotFound - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "decode \"application/json\"") - } - if err := d.Skip(); err != io.EOF { - return res, errors.New("unexpected trailing data") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } case 500: // Code 500. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) @@ -3085,7 +5035,7 @@ func decodeGetItemsFromCollectionResponse(resp *http.Response) (res GetItemsFrom return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetJettonInfoResponse(resp *http.Response) (res GetJettonInfoRes, err error) { +func decodeGetNftCollectionResponse(resp *http.Response) (res GetNftCollectionRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -3101,7 +5051,7 @@ func decodeGetJettonInfoResponse(resp *http.Response) (res GetJettonInfoRes, err } d := jx.DecodeBytes(b) - var response JettonInfo + var response NftCollection if err := func() error { if err := response.Decode(d); err != nil { return err @@ -3241,7 +5191,7 @@ func decodeGetJettonInfoResponse(resp *http.Response) (res GetJettonInfoRes, err return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetJettonsResponse(resp *http.Response) (res GetJettonsRes, err error) { +func decodeGetNftCollectionsResponse(resp *http.Response) (res GetNftCollectionsRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -3257,7 +5207,7 @@ func decodeGetJettonsResponse(resp *http.Response) (res GetJettonsRes, err error } d := jx.DecodeBytes(b) - var response Jettons + var response NftCollections if err := func() error { if err := response.Decode(d); err != nil { return err @@ -3337,7 +5287,7 @@ func decodeGetJettonsResponse(resp *http.Response) (res GetJettonsRes, err error return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetJettonsBalancesResponse(resp *http.Response) (res GetJettonsBalancesRes, err error) { +func decodeGetNftItemByAddressResponse(resp *http.Response) (res GetNftItemByAddressRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -3353,7 +5303,7 @@ func decodeGetJettonsBalancesResponse(resp *http.Response) (res GetJettonsBalanc } d := jx.DecodeBytes(b) - var response JettonsBalances + var response NftItem if err := func() error { if err := response.Decode(d); err != nil { return err @@ -3493,7 +5443,7 @@ func decodeGetJettonsBalancesResponse(resp *http.Response) (res GetJettonsBalanc return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetJettonsHistoryResponse(resp *http.Response) (res GetJettonsHistoryRes, err error) { +func decodeGetNftItemsByAddressesResponse(resp *http.Response) (res GetNftItemsByAddressesRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -3509,7 +5459,7 @@ func decodeGetJettonsHistoryResponse(resp *http.Response) (res GetJettonsHistory } d := jx.DecodeBytes(b) - var response AccountEvents + var response NftItems if err := func() error { if err := response.Decode(d); err != nil { return err @@ -3649,7 +5599,7 @@ func decodeGetJettonsHistoryResponse(resp *http.Response) (res GetJettonsHistory return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetJettonsHistoryByIDResponse(resp *http.Response) (res GetJettonsHistoryByIDRes, err error) { +func decodeGetNftItemsByOwnerResponse(resp *http.Response) (res GetNftItemsByOwnerRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -3665,7 +5615,7 @@ func decodeGetJettonsHistoryByIDResponse(resp *http.Response) (res GetJettonsHis } d := jx.DecodeBytes(b) - var response AccountEvents + var response NftItems if err := func() error { if err := response.Decode(d); err != nil { return err @@ -3805,103 +5755,7 @@ func decodeGetJettonsHistoryByIDResponse(resp *http.Response) (res GetJettonsHis return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetMasterchainHeadResponse(resp *http.Response) (res GetMasterchainHeadRes, err error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - b, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - d := jx.DecodeBytes(b) - var response Block - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "decode \"application/json\"") - } - if err := d.Skip(); err != io.EOF { - return res, errors.New("unexpected trailing data") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 401: - // Code 401. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - b, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - d := jx.DecodeBytes(b) - var response UnauthorizedError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "decode \"application/json\"") - } - if err := d.Skip(); err != io.EOF { - return res, errors.New("unexpected trailing data") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 500: - // Code 500. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - b, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - d := jx.DecodeBytes(b) - var response InternalError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "decode \"application/json\"") - } - if err := d.Skip(); err != io.EOF { - return res, errors.New("unexpected trailing data") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCode(resp.StatusCode) -} - -func decodeGetNftCollectionResponse(resp *http.Response) (res GetNftCollectionRes, err error) { +func decodeGetPublicKeyByAccountIDResponse(resp *http.Response) (res GetPublicKeyByAccountIDRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -3917,7 +5771,7 @@ func decodeGetNftCollectionResponse(resp *http.Response) (res GetNftCollectionRe } d := jx.DecodeBytes(b) - var response NftCollection + var response GetPublicKeyByAccountIDOK if err := func() error { if err := response.Decode(d); err != nil { return err @@ -3993,8 +5847,8 @@ func decodeGetNftCollectionResponse(resp *http.Response) (res GetNftCollectionRe default: return res, validate.InvalidContentType(ct) } - case 404: - // Code 404. + case 500: + // Code 500. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -4007,7 +5861,7 @@ func decodeGetNftCollectionResponse(resp *http.Response) (res GetNftCollectionRe } d := jx.DecodeBytes(b) - var response NotFound + var response InternalError if err := func() error { if err := response.Decode(d); err != nil { return err @@ -4023,8 +5877,14 @@ func decodeGetNftCollectionResponse(resp *http.Response) (res GetNftCollectionRe default: return res, validate.InvalidContentType(ct) } - case 500: - // Code 500. + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetRatesResponse(resp *http.Response) (res GetRatesRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -4037,7 +5897,7 @@ func decodeGetNftCollectionResponse(resp *http.Response) (res GetNftCollectionRe } d := jx.DecodeBytes(b) - var response InternalError + var response GetRatesOK if err := func() error { if err := response.Decode(d); err != nil { return err @@ -4053,14 +5913,8 @@ func decodeGetNftCollectionResponse(resp *http.Response) (res GetNftCollectionRe default: return res, validate.InvalidContentType(ct) } - } - return res, validate.UnexpectedStatusCode(resp.StatusCode) -} - -func decodeGetNftCollectionsResponse(resp *http.Response) (res GetNftCollectionsRes, err error) { - switch resp.StatusCode { - case 200: - // Code 200. + case 400: + // Code 400. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -4073,7 +5927,7 @@ func decodeGetNftCollectionsResponse(resp *http.Response) (res GetNftCollections } d := jx.DecodeBytes(b) - var response NftCollections + var response BadRequest if err := func() error { if err := response.Decode(d); err != nil { return err @@ -4153,7 +6007,7 @@ func decodeGetNftCollectionsResponse(resp *http.Response) (res GetNftCollections return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetNftItemByAddressResponse(resp *http.Response) (res GetNftItemByAddressRes, err error) { +func decodeGetRawAccountResponse(resp *http.Response) (res GetRawAccountRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -4169,7 +6023,7 @@ func decodeGetNftItemByAddressResponse(resp *http.Response) (res GetNftItemByAdd } d := jx.DecodeBytes(b) - var response NftItem + var response RawAccount if err := func() error { if err := response.Decode(d); err != nil { return err @@ -4309,7 +6163,7 @@ func decodeGetNftItemByAddressResponse(resp *http.Response) (res GetNftItemByAdd return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetNftItemsByAddressesResponse(resp *http.Response) (res GetNftItemsByAddressesRes, err error) { +func decodeGetSearchAccountsResponse(resp *http.Response) (res GetSearchAccountsRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -4325,7 +6179,7 @@ func decodeGetNftItemsByAddressesResponse(resp *http.Response) (res GetNftItemsB } d := jx.DecodeBytes(b) - var response NftItems + var response FoundAccounts if err := func() error { if err := response.Decode(d); err != nil { return err @@ -4465,7 +6319,7 @@ func decodeGetNftItemsByAddressesResponse(resp *http.Response) (res GetNftItemsB return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetNftItemsByOwnerResponse(resp *http.Response) (res GetNftItemsByOwnerRes, err error) { +func decodeGetShardBlockProofLiteServerResponse(resp *http.Response) (res GetShardBlockProofLiteServerRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -4481,7 +6335,7 @@ func decodeGetNftItemsByOwnerResponse(resp *http.Response) (res GetNftItemsByOwn } d := jx.DecodeBytes(b) - var response NftItems + var response GetShardBlockProofLiteServerOK if err := func() error { if err := response.Decode(d); err != nil { return err @@ -4557,36 +6411,6 @@ func decodeGetNftItemsByOwnerResponse(resp *http.Response) (res GetNftItemsByOwn default: return res, validate.InvalidContentType(ct) } - case 404: - // Code 404. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - b, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - d := jx.DecodeBytes(b) - var response NotFound - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "decode \"application/json\"") - } - if err := d.Skip(); err != io.EOF { - return res, errors.New("unexpected trailing data") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } case 500: // Code 500. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) @@ -4621,7 +6445,7 @@ func decodeGetNftItemsByOwnerResponse(resp *http.Response) (res GetNftItemsByOwn return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetPublicKeyByAccountIDResponse(resp *http.Response) (res GetPublicKeyByAccountIDRes, err error) { +func decodeGetShardInfoLiteServerResponse(resp *http.Response) (res GetShardInfoLiteServerRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -4637,7 +6461,7 @@ func decodeGetPublicKeyByAccountIDResponse(resp *http.Response) (res GetPublicKe } d := jx.DecodeBytes(b) - var response GetPublicKeyByAccountIDOK + var response GetShardInfoLiteServerOK if err := func() error { if err := response.Decode(d); err != nil { return err @@ -4747,7 +6571,7 @@ func decodeGetPublicKeyByAccountIDResponse(resp *http.Response) (res GetPublicKe return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetRatesResponse(resp *http.Response) (res GetRatesRes, err error) { +func decodeGetStateLiteServerResponse(resp *http.Response) (res GetStateLiteServerRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -4763,7 +6587,7 @@ func decodeGetRatesResponse(resp *http.Response) (res GetRatesRes, err error) { } d := jx.DecodeBytes(b) - var response GetRatesOK + var response GetStateLiteServerOK if err := func() error { if err := response.Decode(d); err != nil { return err @@ -4873,7 +6697,7 @@ func decodeGetRatesResponse(resp *http.Response) (res GetRatesRes, err error) { return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetRawAccountResponse(resp *http.Response) (res GetRawAccountRes, err error) { +func decodeGetStorageProvidersResponse(resp *http.Response) (res GetStorageProvidersRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -4889,7 +6713,7 @@ func decodeGetRawAccountResponse(resp *http.Response) (res GetRawAccountRes, err } d := jx.DecodeBytes(b) - var response RawAccount + var response GetStorageProvidersOK if err := func() error { if err := response.Decode(d); err != nil { return err @@ -4965,36 +6789,6 @@ func decodeGetRawAccountResponse(resp *http.Response) (res GetRawAccountRes, err default: return res, validate.InvalidContentType(ct) } - case 404: - // Code 404. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - b, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - d := jx.DecodeBytes(b) - var response NotFound - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "decode \"application/json\"") - } - if err := d.Skip(); err != io.EOF { - return res, errors.New("unexpected trailing data") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } case 500: // Code 500. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) @@ -5029,7 +6823,7 @@ func decodeGetRawAccountResponse(resp *http.Response) (res GetRawAccountRes, err return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetSearchAccountsResponse(resp *http.Response) (res GetSearchAccountsRes, err error) { +func decodeGetSubscriptionsByAccountResponse(resp *http.Response) (res GetSubscriptionsByAccountRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -5045,7 +6839,7 @@ func decodeGetSearchAccountsResponse(resp *http.Response) (res GetSearchAccounts } d := jx.DecodeBytes(b) - var response FoundAccounts + var response Subscriptions if err := func() error { if err := response.Decode(d); err != nil { return err @@ -5185,7 +6979,7 @@ func decodeGetSearchAccountsResponse(resp *http.Response) (res GetSearchAccounts return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetStorageProvidersResponse(resp *http.Response) (res GetStorageProvidersRes, err error) { +func decodeGetTimeLiteServerResponse(resp *http.Response) (res GetTimeLiteServerRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -5201,7 +6995,7 @@ func decodeGetStorageProvidersResponse(resp *http.Response) (res GetStorageProvi } d := jx.DecodeBytes(b) - var response GetStorageProvidersOK + var response GetTimeLiteServerOK if err := func() error { if err := response.Decode(d); err != nil { return err @@ -5311,7 +7105,7 @@ func decodeGetStorageProvidersResponse(resp *http.Response) (res GetStorageProvi return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetSubscriptionsByAccountResponse(resp *http.Response) (res GetSubscriptionsByAccountRes, err error) { +func decodeGetTonConnectPayloadResponse(resp *http.Response) (res GetTonConnectPayloadRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -5327,7 +7121,7 @@ func decodeGetSubscriptionsByAccountResponse(resp *http.Response) (res GetSubscr } d := jx.DecodeBytes(b) - var response Subscriptions + var response GetTonConnectPayloadOK if err := func() error { if err := response.Decode(d); err != nil { return err @@ -5403,8 +7197,8 @@ func decodeGetSubscriptionsByAccountResponse(resp *http.Response) (res GetSubscr default: return res, validate.InvalidContentType(ct) } - case 404: - // Code 404. + case 500: + // Code 500. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -5417,7 +7211,7 @@ func decodeGetSubscriptionsByAccountResponse(resp *http.Response) (res GetSubscr } d := jx.DecodeBytes(b) - var response NotFound + var response InternalError if err := func() error { if err := response.Decode(d); err != nil { return err @@ -5433,8 +7227,14 @@ func decodeGetSubscriptionsByAccountResponse(resp *http.Response) (res GetSubscr default: return res, validate.InvalidContentType(ct) } - case 500: - // Code 500. + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + +func decodeGetTraceResponse(resp *http.Response) (res GetTraceRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -5447,7 +7247,7 @@ func decodeGetSubscriptionsByAccountResponse(resp *http.Response) (res GetSubscr } d := jx.DecodeBytes(b) - var response InternalError + var response Trace if err := func() error { if err := response.Decode(d); err != nil { return err @@ -5463,14 +7263,8 @@ func decodeGetSubscriptionsByAccountResponse(resp *http.Response) (res GetSubscr default: return res, validate.InvalidContentType(ct) } - } - return res, validate.UnexpectedStatusCode(resp.StatusCode) -} - -func decodeGetTonConnectPayloadResponse(resp *http.Response) (res GetTonConnectPayloadRes, err error) { - switch resp.StatusCode { - case 200: - // Code 200. + case 400: + // Code 400. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -5483,7 +7277,7 @@ func decodeGetTonConnectPayloadResponse(resp *http.Response) (res GetTonConnectP } d := jx.DecodeBytes(b) - var response GetTonConnectPayloadOK + var response BadRequest if err := func() error { if err := response.Decode(d); err != nil { return err @@ -5499,8 +7293,8 @@ func decodeGetTonConnectPayloadResponse(resp *http.Response) (res GetTonConnectP default: return res, validate.InvalidContentType(ct) } - case 400: - // Code 400. + case 401: + // Code 401. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -5513,7 +7307,7 @@ func decodeGetTonConnectPayloadResponse(resp *http.Response) (res GetTonConnectP } d := jx.DecodeBytes(b) - var response BadRequest + var response UnauthorizedError if err := func() error { if err := response.Decode(d); err != nil { return err @@ -5529,8 +7323,8 @@ func decodeGetTonConnectPayloadResponse(resp *http.Response) (res GetTonConnectP default: return res, validate.InvalidContentType(ct) } - case 401: - // Code 401. + case 404: + // Code 404. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -5543,7 +7337,7 @@ func decodeGetTonConnectPayloadResponse(resp *http.Response) (res GetTonConnectP } d := jx.DecodeBytes(b) - var response UnauthorizedError + var response NotFound if err := func() error { if err := response.Decode(d); err != nil { return err @@ -5593,7 +7387,7 @@ func decodeGetTonConnectPayloadResponse(resp *http.Response) (res GetTonConnectP return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetTraceResponse(resp *http.Response) (res GetTraceRes, err error) { +func decodeGetTracesByAccountResponse(resp *http.Response) (res GetTracesByAccountRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -5609,7 +7403,7 @@ func decodeGetTraceResponse(resp *http.Response) (res GetTraceRes, err error) { } d := jx.DecodeBytes(b) - var response Trace + var response TraceIds if err := func() error { if err := response.Decode(d); err != nil { return err @@ -5749,7 +7543,7 @@ func decodeGetTraceResponse(resp *http.Response) (res GetTraceRes, err error) { return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetTracesByAccountResponse(resp *http.Response) (res GetTracesByAccountRes, err error) { +func decodeGetTransactionResponse(resp *http.Response) (res GetTransactionRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -5765,7 +7559,7 @@ func decodeGetTracesByAccountResponse(resp *http.Response) (res GetTracesByAccou } d := jx.DecodeBytes(b) - var response TraceIds + var response Transaction if err := func() error { if err := response.Decode(d); err != nil { return err @@ -5905,7 +7699,7 @@ func decodeGetTracesByAccountResponse(resp *http.Response) (res GetTracesByAccou return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetTransactionResponse(resp *http.Response) (res GetTransactionRes, err error) { +func decodeGetTransactionByMessageHashResponse(resp *http.Response) (res GetTransactionByMessageHashRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -6061,7 +7855,7 @@ func decodeGetTransactionResponse(resp *http.Response) (res GetTransactionRes, e return res, validate.UnexpectedStatusCode(resp.StatusCode) } -func decodeGetTransactionByMessageHashResponse(resp *http.Response) (res GetTransactionByMessageHashRes, err error) { +func decodeGetTransactionsLiteServerResponse(resp *http.Response) (res GetTransactionsLiteServerRes, err error) { switch resp.StatusCode { case 200: // Code 200. @@ -6077,7 +7871,7 @@ func decodeGetTransactionByMessageHashResponse(resp *http.Response) (res GetTran } d := jx.DecodeBytes(b) - var response Transaction + var response GetTransactionsLiteServerOK if err := func() error { if err := response.Decode(d); err != nil { return err @@ -6153,36 +7947,6 @@ func decodeGetTransactionByMessageHashResponse(resp *http.Response) (res GetTran default: return res, validate.InvalidContentType(ct) } - case 404: - // Code 404. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - b, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - - d := jx.DecodeBytes(b) - var response NotFound - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "decode \"application/json\"") - } - if err := d.Skip(); err != io.EOF { - return res, errors.New("unexpected trailing data") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } case 500: // Code 500. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) @@ -6919,6 +8683,132 @@ func decodeSendMessageResponse(resp *http.Response) (res SendMessageRes, err err return res, validate.UnexpectedStatusCode(resp.StatusCode) } +func decodeSendMessageLiteServerResponse(resp *http.Response) (res SendMessageLiteServerRes, err error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response SendMessageLiteServerOK + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response BadRequest + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 401: + // Code 401. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response UnauthorizedError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 500: + // Code 500. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + b, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + + d := jx.DecodeBytes(b) + var response InternalError + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "decode \"application/json\"") + } + if err := d.Skip(); err != io.EOF { + return res, errors.New("unexpected trailing data") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + func decodeSetWalletBackupResponse(resp *http.Response) (res SetWalletBackupRes, err error) { switch resp.StatusCode { case 200: diff --git a/pkg/oas/oas_response_encoders_gen.go b/pkg/oas/oas_response_encoders_gen.go index e6b6a0d2..db4802a2 100644 --- a/pkg/oas/oas_response_encoders_gen.go +++ b/pkg/oas/oas_response_encoders_gen.go @@ -664,9 +664,681 @@ func encodeGetAccountSeqnoResponse(response GetAccountSeqnoRes, w http.ResponseW } } +func encodeGetAccountStateLiteServerResponse(response GetAccountStateLiteServerRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *GetAccountStateLiteServerOK: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + func encodeGetAccountTransactionsResponse(response GetAccountTransactionsRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *Transactions: + case *Transactions: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *NotFound: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(404) + span.SetStatus(codes.Error, http.StatusText(404)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetAccountsResponse(response GetAccountsRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *Accounts: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetAllAuctionsResponse(response GetAllAuctionsRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *Auctions: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetAllShardsInfoLiteServerResponse(response GetAllShardsInfoLiteServerRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *GetAllShardsInfoLiteServerOK: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetBlockResponse(response GetBlockRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *Block: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *NotFound: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(404) + span.SetStatus(codes.Error, http.StatusText(404)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetBlockHeaderLiteServerResponse(response GetBlockHeaderLiteServerRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *GetBlockHeaderLiteServerOK: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetBlockLiteServerResponse(response GetBlockLiteServerRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *GetBlockLiteServerOK: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetBlockProofLiteServerResponse(response GetBlockProofLiteServerRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *GetBlockProofLiteServerOK: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetBlockTransactionsResponse(response GetBlockTransactionsRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *Transactions: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *NotFound: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(404) + span.SetStatus(codes.Error, http.StatusText(404)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetConfigResponse(response GetConfigRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *Config: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetConfigAllLiteServerResponse(response GetConfigAllLiteServerRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *GetConfigAllLiteServerOK: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetDnsExpiringResponse(response GetDnsExpiringRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *DnsExpiring: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -731,9 +1403,9 @@ func encodeGetAccountTransactionsResponse(response GetAccountTransactionsRes, w } } -func encodeGetAccountsResponse(response GetAccountsRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetDomainBidsResponse(response GetDomainBidsRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *Accounts: + case *DomainBids: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -769,6 +1441,18 @@ func encodeGetAccountsResponse(response GetAccountsRes, w http.ResponseWriter, s } return nil + case *NotFound: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(404) + span.SetStatus(codes.Error, http.StatusText(404)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + case *InternalError: w.Header().Set("Content-Type", "application/json") w.WriteHeader(500) @@ -786,9 +1470,9 @@ func encodeGetAccountsResponse(response GetAccountsRes, w http.ResponseWriter, s } } -func encodeGetAllAuctionsResponse(response GetAllAuctionsRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetEventResponse(response GetEventRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *Auctions: + case *Event: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -800,6 +1484,18 @@ func encodeGetAllAuctionsResponse(response GetAllAuctionsRes, w http.ResponseWri } return nil + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + case *UnauthorizedError: w.Header().Set("Content-Type", "application/json") w.WriteHeader(401) @@ -812,6 +1508,18 @@ func encodeGetAllAuctionsResponse(response GetAllAuctionsRes, w http.ResponseWri } return nil + case *NotFound: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(404) + span.SetStatus(codes.Error, http.StatusText(404)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + case *InternalError: w.Header().Set("Content-Type", "application/json") w.WriteHeader(500) @@ -829,9 +1537,9 @@ func encodeGetAllAuctionsResponse(response GetAllAuctionsRes, w http.ResponseWri } } -func encodeGetBlockResponse(response GetBlockRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetEventsByAccountResponse(response GetEventsByAccountRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *Block: + case *AccountEvents: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -896,9 +1604,9 @@ func encodeGetBlockResponse(response GetBlockRes, w http.ResponseWriter, span tr } } -func encodeGetBlockTransactionsResponse(response GetBlockTransactionsRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetItemsFromCollectionResponse(response GetItemsFromCollectionRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *Transactions: + case *NftItems: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -963,9 +1671,9 @@ func encodeGetBlockTransactionsResponse(response GetBlockTransactionsRes, w http } } -func encodeGetConfigResponse(response GetConfigRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetJettonInfoResponse(response GetJettonInfoRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *Config: + case *JettonInfo: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -977,6 +1685,18 @@ func encodeGetConfigResponse(response GetConfigRes, w http.ResponseWriter, span } return nil + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + case *UnauthorizedError: w.Header().Set("Content-Type", "application/json") w.WriteHeader(401) @@ -989,6 +1709,18 @@ func encodeGetConfigResponse(response GetConfigRes, w http.ResponseWriter, span } return nil + case *NotFound: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(404) + span.SetStatus(codes.Error, http.StatusText(404)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + case *InternalError: w.Header().Set("Content-Type", "application/json") w.WriteHeader(500) @@ -1006,9 +1738,52 @@ func encodeGetConfigResponse(response GetConfigRes, w http.ResponseWriter, span } } -func encodeGetDnsExpiringResponse(response GetDnsExpiringRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetJettonsResponse(response GetJettonsRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *DnsExpiring: + case *Jettons: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetJettonsBalancesResponse(response GetJettonsBalancesRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *JettonsBalances: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1073,9 +1848,9 @@ func encodeGetDnsExpiringResponse(response GetDnsExpiringRes, w http.ResponseWri } } -func encodeGetDomainBidsResponse(response GetDomainBidsRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetJettonsHistoryResponse(response GetJettonsHistoryRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *DomainBids: + case *AccountEvents: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1140,9 +1915,9 @@ func encodeGetDomainBidsResponse(response GetDomainBidsRes, w http.ResponseWrite } } -func encodeGetEventResponse(response GetEventRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetJettonsHistoryByIDResponse(response GetJettonsHistoryByIDRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *Event: + case *AccountEvents: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1207,9 +1982,9 @@ func encodeGetEventResponse(response GetEventRes, w http.ResponseWriter, span tr } } -func encodeGetEventsByAccountResponse(response GetEventsByAccountRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetListBlockTransactionsLiteServerResponse(response GetListBlockTransactionsLiteServerRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *AccountEvents: + case *GetListBlockTransactionsLiteServerOK: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1245,10 +2020,41 @@ func encodeGetEventsByAccountResponse(response GetEventsByAccountRes, w http.Res } return nil - case *NotFound: + case *InternalError: w.Header().Set("Content-Type", "application/json") - w.WriteHeader(404) - span.SetStatus(codes.Error, http.StatusText(404)) + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetMasterchainHeadResponse(response GetMasterchainHeadRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *Block: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) e := jx.GetEncoder() response.Encode(e) @@ -1274,9 +2080,9 @@ func encodeGetEventsByAccountResponse(response GetEventsByAccountRes, w http.Res } } -func encodeGetItemsFromCollectionResponse(response GetItemsFromCollectionRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetMasterchainInfoExtLiteServerResponse(response GetMasterchainInfoExtLiteServerRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *NftItems: + case *GetMasterchainInfoExtLiteServerOK: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1312,10 +2118,53 @@ func encodeGetItemsFromCollectionResponse(response GetItemsFromCollectionRes, w } return nil - case *NotFound: + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetMasterchainInfoLiteServerResponse(response GetMasterchainInfoLiteServerRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *GetMasterchainInfoLiteServerOK: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: w.Header().Set("Content-Type", "application/json") - w.WriteHeader(404) - span.SetStatus(codes.Error, http.StatusText(404)) + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) e := jx.GetEncoder() response.Encode(e) @@ -1341,9 +2190,9 @@ func encodeGetItemsFromCollectionResponse(response GetItemsFromCollectionRes, w } } -func encodeGetJettonInfoResponse(response GetJettonInfoRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetNftCollectionResponse(response GetNftCollectionRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *JettonInfo: + case *NftCollection: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1408,9 +2257,9 @@ func encodeGetJettonInfoResponse(response GetJettonInfoRes, w http.ResponseWrite } } -func encodeGetJettonsResponse(response GetJettonsRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetNftCollectionsResponse(response GetNftCollectionsRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *Jettons: + case *NftCollections: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1451,9 +2300,9 @@ func encodeGetJettonsResponse(response GetJettonsRes, w http.ResponseWriter, spa } } -func encodeGetJettonsBalancesResponse(response GetJettonsBalancesRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetNftItemByAddressResponse(response GetNftItemByAddressRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *JettonsBalances: + case *NftItem: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1518,9 +2367,9 @@ func encodeGetJettonsBalancesResponse(response GetJettonsBalancesRes, w http.Res } } -func encodeGetJettonsHistoryResponse(response GetJettonsHistoryRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetNftItemsByAddressesResponse(response GetNftItemsByAddressesRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *AccountEvents: + case *NftItems: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1585,9 +2434,9 @@ func encodeGetJettonsHistoryResponse(response GetJettonsHistoryRes, w http.Respo } } -func encodeGetJettonsHistoryByIDResponse(response GetJettonsHistoryByIDRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetNftItemsByOwnerResponse(response GetNftItemsByOwnerRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *AccountEvents: + case *NftItems: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1652,52 +2501,9 @@ func encodeGetJettonsHistoryByIDResponse(response GetJettonsHistoryByIDRes, w ht } } -func encodeGetMasterchainHeadResponse(response GetMasterchainHeadRes, w http.ResponseWriter, span trace.Span) error { - switch response := response.(type) { - case *Block: - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) - - e := jx.GetEncoder() - response.Encode(e) - if _, err := e.WriteTo(w); err != nil { - return errors.Wrap(err, "write") - } - return nil - - case *UnauthorizedError: - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(401) - span.SetStatus(codes.Error, http.StatusText(401)) - - e := jx.GetEncoder() - response.Encode(e) - if _, err := e.WriteTo(w); err != nil { - return errors.Wrap(err, "write") - } - return nil - - case *InternalError: - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(500) - span.SetStatus(codes.Error, http.StatusText(500)) - - e := jx.GetEncoder() - response.Encode(e) - if _, err := e.WriteTo(w); err != nil { - return errors.Wrap(err, "write") - } - return nil - - default: - return errors.Errorf("unexpected response type: %T", response) - } -} - -func encodeGetNftCollectionResponse(response GetNftCollectionRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetPublicKeyByAccountIDResponse(response GetPublicKeyByAccountIDRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *NftCollection: + case *GetPublicKeyByAccountIDOK: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1733,18 +2539,6 @@ func encodeGetNftCollectionResponse(response GetNftCollectionRes, w http.Respons } return nil - case *NotFound: - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(404) - span.SetStatus(codes.Error, http.StatusText(404)) - - e := jx.GetEncoder() - response.Encode(e) - if _, err := e.WriteTo(w); err != nil { - return errors.Wrap(err, "write") - } - return nil - case *InternalError: w.Header().Set("Content-Type", "application/json") w.WriteHeader(500) @@ -1762,9 +2556,9 @@ func encodeGetNftCollectionResponse(response GetNftCollectionRes, w http.Respons } } -func encodeGetNftCollectionsResponse(response GetNftCollectionsRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetRatesResponse(response GetRatesRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *NftCollections: + case *GetRatesOK: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1776,6 +2570,18 @@ func encodeGetNftCollectionsResponse(response GetNftCollectionsRes, w http.Respo } return nil + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + case *UnauthorizedError: w.Header().Set("Content-Type", "application/json") w.WriteHeader(401) @@ -1805,9 +2611,9 @@ func encodeGetNftCollectionsResponse(response GetNftCollectionsRes, w http.Respo } } -func encodeGetNftItemByAddressResponse(response GetNftItemByAddressRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetRawAccountResponse(response GetRawAccountRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *NftItem: + case *RawAccount: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1872,9 +2678,9 @@ func encodeGetNftItemByAddressResponse(response GetNftItemByAddressRes, w http.R } } -func encodeGetNftItemsByAddressesResponse(response GetNftItemsByAddressesRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetSearchAccountsResponse(response GetSearchAccountsRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *NftItems: + case *FoundAccounts: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1939,9 +2745,9 @@ func encodeGetNftItemsByAddressesResponse(response GetNftItemsByAddressesRes, w } } -func encodeGetNftItemsByOwnerResponse(response GetNftItemsByOwnerRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetShardBlockProofLiteServerResponse(response GetShardBlockProofLiteServerRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *NftItems: + case *GetShardBlockProofLiteServerOK: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -1977,18 +2783,6 @@ func encodeGetNftItemsByOwnerResponse(response GetNftItemsByOwnerRes, w http.Res } return nil - case *NotFound: - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(404) - span.SetStatus(codes.Error, http.StatusText(404)) - - e := jx.GetEncoder() - response.Encode(e) - if _, err := e.WriteTo(w); err != nil { - return errors.Wrap(err, "write") - } - return nil - case *InternalError: w.Header().Set("Content-Type", "application/json") w.WriteHeader(500) @@ -2006,9 +2800,9 @@ func encodeGetNftItemsByOwnerResponse(response GetNftItemsByOwnerRes, w http.Res } } -func encodeGetPublicKeyByAccountIDResponse(response GetPublicKeyByAccountIDRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetShardInfoLiteServerResponse(response GetShardInfoLiteServerRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *GetPublicKeyByAccountIDOK: + case *GetShardInfoLiteServerOK: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -2061,9 +2855,9 @@ func encodeGetPublicKeyByAccountIDResponse(response GetPublicKeyByAccountIDRes, } } -func encodeGetRatesResponse(response GetRatesRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetStateLiteServerResponse(response GetStateLiteServerRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *GetRatesOK: + case *GetStateLiteServerOK: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -2116,9 +2910,9 @@ func encodeGetRatesResponse(response GetRatesRes, w http.ResponseWriter, span tr } } -func encodeGetRawAccountResponse(response GetRawAccountRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetStorageProvidersResponse(response GetStorageProvidersRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *RawAccount: + case *GetStorageProvidersOK: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -2154,18 +2948,6 @@ func encodeGetRawAccountResponse(response GetRawAccountRes, w http.ResponseWrite } return nil - case *NotFound: - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(404) - span.SetStatus(codes.Error, http.StatusText(404)) - - e := jx.GetEncoder() - response.Encode(e) - if _, err := e.WriteTo(w); err != nil { - return errors.Wrap(err, "write") - } - return nil - case *InternalError: w.Header().Set("Content-Type", "application/json") w.WriteHeader(500) @@ -2183,9 +2965,9 @@ func encodeGetRawAccountResponse(response GetRawAccountRes, w http.ResponseWrite } } -func encodeGetSearchAccountsResponse(response GetSearchAccountsRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetSubscriptionsByAccountResponse(response GetSubscriptionsByAccountRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *FoundAccounts: + case *Subscriptions: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -2250,9 +3032,9 @@ func encodeGetSearchAccountsResponse(response GetSearchAccountsRes, w http.Respo } } -func encodeGetStorageProvidersResponse(response GetStorageProvidersRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetTimeLiteServerResponse(response GetTimeLiteServerRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *GetStorageProvidersOK: + case *GetTimeLiteServerOK: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -2305,9 +3087,9 @@ func encodeGetStorageProvidersResponse(response GetStorageProvidersRes, w http.R } } -func encodeGetSubscriptionsByAccountResponse(response GetSubscriptionsByAccountRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetTonConnectPayloadResponse(response GetTonConnectPayloadRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *Subscriptions: + case *GetTonConnectPayloadOK: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -2343,18 +3125,6 @@ func encodeGetSubscriptionsByAccountResponse(response GetSubscriptionsByAccountR } return nil - case *NotFound: - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(404) - span.SetStatus(codes.Error, http.StatusText(404)) - - e := jx.GetEncoder() - response.Encode(e) - if _, err := e.WriteTo(w); err != nil { - return errors.Wrap(err, "write") - } - return nil - case *InternalError: w.Header().Set("Content-Type", "application/json") w.WriteHeader(500) @@ -2372,9 +3142,9 @@ func encodeGetSubscriptionsByAccountResponse(response GetSubscriptionsByAccountR } } -func encodeGetTonConnectPayloadResponse(response GetTonConnectPayloadRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetTraceResponse(response GetTraceRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *GetTonConnectPayloadOK: + case *Trace: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -2410,6 +3180,18 @@ func encodeGetTonConnectPayloadResponse(response GetTonConnectPayloadRes, w http } return nil + case *NotFound: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(404) + span.SetStatus(codes.Error, http.StatusText(404)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + case *InternalError: w.Header().Set("Content-Type", "application/json") w.WriteHeader(500) @@ -2427,9 +3209,9 @@ func encodeGetTonConnectPayloadResponse(response GetTonConnectPayloadRes, w http } } -func encodeGetTraceResponse(response GetTraceRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetTracesByAccountResponse(response GetTracesByAccountRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *Trace: + case *TraceIds: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -2494,9 +3276,9 @@ func encodeGetTraceResponse(response GetTraceRes, w http.ResponseWriter, span tr } } -func encodeGetTracesByAccountResponse(response GetTracesByAccountRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetTransactionResponse(response GetTransactionRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *TraceIds: + case *Transaction: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -2561,7 +3343,7 @@ func encodeGetTracesByAccountResponse(response GetTracesByAccountRes, w http.Res } } -func encodeGetTransactionResponse(response GetTransactionRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetTransactionByMessageHashResponse(response GetTransactionByMessageHashRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { case *Transaction: w.Header().Set("Content-Type", "application/json") @@ -2628,9 +3410,9 @@ func encodeGetTransactionResponse(response GetTransactionRes, w http.ResponseWri } } -func encodeGetTransactionByMessageHashResponse(response GetTransactionByMessageHashRes, w http.ResponseWriter, span trace.Span) error { +func encodeGetTransactionsLiteServerResponse(response GetTransactionsLiteServerRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { - case *Transaction: + case *GetTransactionsLiteServerOK: w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) @@ -2666,18 +3448,6 @@ func encodeGetTransactionByMessageHashResponse(response GetTransactionByMessageH } return nil - case *NotFound: - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(404) - span.SetStatus(codes.Error, http.StatusText(404)) - - e := jx.GetEncoder() - response.Encode(e) - if _, err := e.WriteTo(w); err != nil { - return errors.Wrap(err, "write") - } - return nil - case *InternalError: w.Header().Set("Content-Type", "application/json") w.WriteHeader(500) @@ -3013,6 +3783,61 @@ func encodeSendMessageResponse(response SendMessageRes, w http.ResponseWriter, s } } +func encodeSendMessageLiteServerResponse(response SendMessageLiteServerRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *SendMessageLiteServerOK: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *BadRequest: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *UnauthorizedError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + span.SetStatus(codes.Error, http.StatusText(401)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + case *InternalError: + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + span.SetStatus(codes.Error, http.StatusText(500)) + + e := jx.GetEncoder() + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + func encodeSetWalletBackupResponse(response SetWalletBackupRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { case *SetWalletBackupOK: diff --git a/pkg/oas/oas_router_gen.go b/pkg/oas/oas_router_gen.go index 8b5c8f7b..f7be2ff4 100644 --- a/pkg/oas/oas_router_gen.go +++ b/pkg/oas/oas_router_gen.go @@ -907,8 +907,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } } - case 'n': // Prefix: "nfts/" - if l := len("nfts/"); len(elem) >= l && elem[0:l] == "nfts/" { + case 'l': // Prefix: "liteserver/" + if l := len("liteserver/"); len(elem) >= l && elem[0:l] == "liteserver/" { elem = elem[l:] } else { break @@ -918,83 +918,45 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { break } switch elem[0] { - case '_': // Prefix: "_bulk" - if l := len("_bulk"); len(elem) >= l && elem[0:l] == "_bulk" { + case 'g': // Prefix: "get_" + if l := len("get_"); len(elem) >= l && elem[0:l] == "get_" { elem = elem[l:] } else { break } if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "POST": - s.handleGetNftItemsByAddressesRequest([0]string{}, w, r) - default: - s.notAllowed(w, r, "POST") - } - - return - } - case 'c': // Prefix: "collections" - if l := len("collections"); len(elem) >= l && elem[0:l] == "collections" { - elem = elem[l:] - } else { break } - - if len(elem) == 0 { - switch r.Method { - case "GET": - s.handleGetNftCollectionsRequest([0]string{}, w, r) - default: - s.notAllowed(w, r, "GET") - } - - return - } switch elem[0] { - case '/': // Prefix: "/" - if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + case 'a': // Prefix: "a" + if l := len("a"); len(elem) >= l && elem[0:l] == "a" { elem = elem[l:] } else { break } - // Param: "account_id" - // Match until "/" - idx := strings.IndexByte(elem, '/') - if idx < 0 { - idx = len(elem) - } - args[0] = elem[:idx] - elem = elem[idx:] - if len(elem) == 0 { - switch r.Method { - case "GET": - s.handleGetNftCollectionRequest([1]string{ - args[0], - }, w, r) - default: - s.notAllowed(w, r, "GET") - } - - return + break } switch elem[0] { - case '/': // Prefix: "/items" - if l := len("/items"); len(elem) >= l && elem[0:l] == "/items" { + case 'c': // Prefix: "ccount_state/" + if l := len("ccount_state/"); len(elem) >= l && elem[0:l] == "ccount_state/" { elem = elem[l:] } else { break } + // Param: "account_id" + // Leaf parameter + args[0] = elem + elem = "" + if len(elem) == 0 { // Leaf node. switch r.Method { case "GET": - s.handleGetItemsFromCollectionRequest([1]string{ + s.handleGetAccountStateLiteServerRequest([1]string{ args[0], }, w, r) default: @@ -1003,140 +965,23 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - } - } - } - // Param: "account_id" - // Leaf parameter - args[0] = elem - elem = "" - - if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "GET": - s.handleGetNftItemByAddressRequest([1]string{ - args[0], - }, w, r) - default: - s.notAllowed(w, r, "GET") - } - - return - } - case 'p': // Prefix: "pubkeys/" - if l := len("pubkeys/"); len(elem) >= l && elem[0:l] == "pubkeys/" { - elem = elem[l:] - } else { - break - } - - // Param: "public_key" - // Match until "/" - idx := strings.IndexByte(elem, '/') - if idx < 0 { - idx = len(elem) - } - args[0] = elem[:idx] - elem = elem[idx:] - - if len(elem) == 0 { - break - } - switch elem[0] { - case '/': // Prefix: "/wallets" - if l := len("/wallets"); len(elem) >= l && elem[0:l] == "/wallets" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "GET": - s.handleGetWalletsByPublicKeyRequest([1]string{ - args[0], - }, w, r) - default: - s.notAllowed(w, r, "GET") - } - - return - } - } - case 'r': // Prefix: "rates" - if l := len("rates"); len(elem) >= l && elem[0:l] == "rates" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "GET": - s.handleGetRatesRequest([0]string{}, w, r) - default: - s.notAllowed(w, r, "GET") - } - - return - } - case 's': // Prefix: "st" - if l := len("st"); len(elem) >= l && elem[0:l] == "st" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - break - } - switch elem[0] { - case 'a': // Prefix: "aking/" - if l := len("aking/"); len(elem) >= l && elem[0:l] == "aking/" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - break - } - switch elem[0] { - case 'n': // Prefix: "nominator/" - if l := len("nominator/"); len(elem) >= l && elem[0:l] == "nominator/" { - elem = elem[l:] - } else { - break - } - - // Param: "account_id" - // Match until "/" - idx := strings.IndexByte(elem, '/') - if idx < 0 { - idx = len(elem) - } - args[0] = elem[:idx] - elem = elem[idx:] - - if len(elem) == 0 { - break - } - switch elem[0] { - case '/': // Prefix: "/pools" - if l := len("/pools"); len(elem) >= l && elem[0:l] == "/pools" { + case 'l': // Prefix: "ll_shards_info/" + if l := len("ll_shards_info/"); len(elem) >= l && elem[0:l] == "ll_shards_info/" { elem = elem[l:] } else { break } + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + if len(elem) == 0 { // Leaf node. switch r.Method { case "GET": - s.handlePoolsByNominatorsRequest([1]string{ + s.handleGetAllShardsInfoLiteServerRequest([1]string{ args[0], }, w, r) default: @@ -1146,8 +991,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } } - case 'p': // Prefix: "pool" - if l := len("pool"); len(elem) >= l && elem[0:l] == "pool" { + case 'b': // Prefix: "block" + if l := len("block"); len(elem) >= l && elem[0:l] == "block" { elem = elem[l:] } else { break @@ -1164,19 +1009,16 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { break } - // Param: "account_id" - // Match until "/" - idx := strings.IndexByte(elem, '/') - if idx < 0 { - idx = len(elem) - } - args[0] = elem[:idx] - elem = elem[idx:] + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" if len(elem) == 0 { + // Leaf node. switch r.Method { case "GET": - s.handleStakingPoolInfoRequest([1]string{ + s.handleGetBlockLiteServerRequest([1]string{ args[0], }, w, r) default: @@ -1185,19 +1027,34 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } + case '_': // Prefix: "_" + if l := len("_"); len(elem) >= l && elem[0:l] == "_" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } switch elem[0] { - case '/': // Prefix: "/history" - if l := len("/history"); len(elem) >= l && elem[0:l] == "/history" { + case 'h': // Prefix: "header/" + if l := len("header/"); len(elem) >= l && elem[0:l] == "header/" { elem = elem[l:] } else { break } + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + if len(elem) == 0 { // Leaf node. switch r.Method { case "GET": - s.handleStakingPoolHistoryRequest([1]string{ + s.handleGetBlockHeaderLiteServerRequest([1]string{ args[0], }, w, r) default: @@ -1206,136 +1063,251 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - } - case 's': // Prefix: "s" - if l := len("s"); len(elem) >= l && elem[0:l] == "s" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "GET": - s.handleStakingPoolsRequest([0]string{}, w, r) - default: - s.notAllowed(w, r, "GET") + case 'p': // Prefix: "proof" + if l := len("proof"); len(elem) >= l && elem[0:l] == "proof" { + elem = elem[l:] + } else { + break } - return + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetBlockProofLiteServerRequest([0]string{}, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } } } - } - case 'o': // Prefix: "orage/providers" - if l := len("orage/providers"); len(elem) >= l && elem[0:l] == "orage/providers" { - elem = elem[l:] - } else { - break - } + case 'c': // Prefix: "config_all/" + if l := len("config_all/"); len(elem) >= l && elem[0:l] == "config_all/" { + elem = elem[l:] + } else { + break + } - if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "GET": - s.handleGetStorageProvidersRequest([0]string{}, w, r) - default: - s.notAllowed(w, r, "GET") - } - - return - } - } - case 't': // Prefix: "t" - if l := len("t"); len(elem) >= l && elem[0:l] == "t" { - elem = elem[l:] - } else { - break - } + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" - if len(elem) == 0 { - break - } - switch elem[0] { - case 'o': // Prefix: "onconnect/" - if l := len("onconnect/"); len(elem) >= l && elem[0:l] == "onconnect/" { - elem = elem[l:] - } else { - break - } + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetConfigAllLiteServerRequest([1]string{ + args[0], + }, w, r) + default: + s.notAllowed(w, r, "GET") + } - if len(elem) == 0 { - break - } - switch elem[0] { - case 'p': // Prefix: "payload" - if l := len("payload"); len(elem) >= l && elem[0:l] == "payload" { + return + } + case 'm': // Prefix: "masterchain_info" + if l := len("masterchain_info"); len(elem) >= l && elem[0:l] == "masterchain_info" { elem = elem[l:] } else { break } if len(elem) == 0 { - // Leaf node. switch r.Method { case "GET": - s.handleGetTonConnectPayloadRequest([0]string{}, w, r) + s.handleGetMasterchainInfoLiteServerRequest([0]string{}, w, r) default: s.notAllowed(w, r, "GET") } return } - case 's': // Prefix: "stateinit" - if l := len("stateinit"); len(elem) >= l && elem[0:l] == "stateinit" { + switch elem[0] { + case '_': // Prefix: "_ext" + if l := len("_ext"); len(elem) >= l && elem[0:l] == "_ext" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetMasterchainInfoExtLiteServerRequest([0]string{}, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } + } + case 's': // Prefix: "s" + if l := len("s"); len(elem) >= l && elem[0:l] == "s" { elem = elem[l:] } else { break } if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "POST": - s.handleGetAccountInfoByStateInitRequest([0]string{}, w, r) - default: - s.notAllowed(w, r, "POST") + break + } + switch elem[0] { + case 'h': // Prefix: "hard_" + if l := len("hard_"); len(elem) >= l && elem[0:l] == "hard_" { + elem = elem[l:] + } else { + break } - return - } - } - case 'r': // Prefix: "races/" - if l := len("races/"); len(elem) >= l && elem[0:l] == "races/" { - elem = elem[l:] - } else { - break - } + if len(elem) == 0 { + break + } + switch elem[0] { + case 'b': // Prefix: "block_proof/" + if l := len("block_proof/"); len(elem) >= l && elem[0:l] == "block_proof/" { + elem = elem[l:] + } else { + break + } - if len(elem) == 0 { - break - } - switch elem[0] { - case 'e': // Prefix: "emulate" - if l := len("emulate"); len(elem) >= l && elem[0:l] == "emulate" { + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetShardBlockProofLiteServerRequest([1]string{ + args[0], + }, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } + case 'i': // Prefix: "info/" + if l := len("info/"); len(elem) >= l && elem[0:l] == "info/" { + elem = elem[l:] + } else { + break + } + + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetShardInfoLiteServerRequest([1]string{ + args[0], + }, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } + } + case 't': // Prefix: "tate/" + if l := len("tate/"); len(elem) >= l && elem[0:l] == "tate/" { + elem = elem[l:] + } else { + break + } + + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetStateLiteServerRequest([1]string{ + args[0], + }, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } + } + case 't': // Prefix: "t" + if l := len("t"); len(elem) >= l && elem[0:l] == "t" { elem = elem[l:] } else { break } if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "POST": - s.handleEmulateMessageToTraceRequest([0]string{}, w, r) - default: - s.notAllowed(w, r, "POST") + break + } + switch elem[0] { + case 'i': // Prefix: "ime" + if l := len("ime"); len(elem) >= l && elem[0:l] == "ime" { + elem = elem[l:] + } else { + break } - return + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetTimeLiteServerRequest([0]string{}, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } + case 'r': // Prefix: "ransactions/" + if l := len("ransactions/"); len(elem) >= l && elem[0:l] == "ransactions/" { + elem = elem[l:] + } else { + break + } + + // Param: "account_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetTransactionsLiteServerRequest([1]string{ + args[0], + }, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } } } - // Param: "trace_id" + case 'l': // Prefix: "list_block_transactions/" + if l := len("list_block_transactions/"); len(elem) >= l && elem[0:l] == "list_block_transactions/" { + elem = elem[l:] + } else { + break + } + + // Param: "block_id" // Leaf parameter args[0] = elem elem = "" @@ -1344,7 +1316,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Leaf node. switch r.Method { case "GET": - s.handleGetTraceRequest([1]string{ + s.handleGetListBlockTransactionsLiteServerRequest([1]string{ args[0], }, w, r) default: @@ -1353,20 +1325,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - } - case 'w': // Prefix: "wallet/" - if l := len("wallet/"); len(elem) >= l && elem[0:l] == "wallet/" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - break - } - switch elem[0] { - case 'a': // Prefix: "auth/proof" - if l := len("auth/proof"); len(elem) >= l && elem[0:l] == "auth/proof" { + case 's': // Prefix: "send_message" + if l := len("send_message"); len(elem) >= l && elem[0:l] == "send_message" { elem = elem[l:] } else { break @@ -1376,15 +1336,27 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Leaf node. switch r.Method { case "POST": - s.handleTonConnectProofRequest([0]string{}, w, r) + s.handleSendMessageLiteServerRequest([0]string{}, w, r) default: s.notAllowed(w, r, "POST") } return } - case 'b': // Prefix: "backup" - if l := len("backup"); len(elem) >= l && elem[0:l] == "backup" { + } + case 'n': // Prefix: "nfts/" + if l := len("nfts/"); len(elem) >= l && elem[0:l] == "nfts/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case '_': // Prefix: "_bulk" + if l := len("_bulk"); len(elem) >= l && elem[0:l] == "_bulk" { elem = elem[l:] } else { break @@ -1393,38 +1365,112 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { if len(elem) == 0 { // Leaf node. switch r.Method { - case "GET": - s.handleGetWalletBackupRequest([0]string{}, w, r) - case "PUT": - s.handleSetWalletBackupRequest([0]string{}, w, r) + case "POST": + s.handleGetNftItemsByAddressesRequest([0]string{}, w, r) default: - s.notAllowed(w, r, "GET,PUT") + s.notAllowed(w, r, "POST") } return } - case 'e': // Prefix: "emulate" - if l := len("emulate"); len(elem) >= l && elem[0:l] == "emulate" { + case 'c': // Prefix: "collections" + if l := len("collections"); len(elem) >= l && elem[0:l] == "collections" { elem = elem[l:] } else { break } if len(elem) == 0 { - // Leaf node. switch r.Method { - case "POST": - s.handleEmulateWalletMessageRequest([0]string{}, w, r) + case "GET": + s.handleGetNftCollectionsRequest([0]string{}, w, r) default: - s.notAllowed(w, r, "POST") + s.notAllowed(w, r, "GET") } return } - } - // Param: "account_id" - // Match until "/" - idx := strings.IndexByte(elem, '/') + switch elem[0] { + case '/': // Prefix: "/" + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + elem = elem[l:] + } else { + break + } + + // Param: "account_id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[0] = elem[:idx] + elem = elem[idx:] + + if len(elem) == 0 { + switch r.Method { + case "GET": + s.handleGetNftCollectionRequest([1]string{ + args[0], + }, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } + switch elem[0] { + case '/': // Prefix: "/items" + if l := len("/items"); len(elem) >= l && elem[0:l] == "/items" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetItemsFromCollectionRequest([1]string{ + args[0], + }, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } + } + } + } + // Param: "account_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetNftItemByAddressRequest([1]string{ + args[0], + }, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } + case 'p': // Prefix: "pubkeys/" + if l := len("pubkeys/"); len(elem) >= l && elem[0:l] == "pubkeys/" { + elem = elem[l:] + } else { + break + } + + // Param: "public_key" + // Match until "/" + idx := strings.IndexByte(elem, '/') if idx < 0 { idx = len(elem) } @@ -1435,8 +1481,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { break } switch elem[0] { - case '/': // Prefix: "/seqno" - if l := len("/seqno"); len(elem) >= l && elem[0:l] == "/seqno" { + case '/': // Prefix: "/wallets" + if l := len("/wallets"); len(elem) >= l && elem[0:l] == "/wallets" { elem = elem[l:] } else { break @@ -1446,7 +1492,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Leaf node. switch r.Method { case "GET": - s.handleGetAccountSeqnoRequest([1]string{ + s.handleGetWalletsByPublicKeyRequest([1]string{ args[0], }, w, r) default: @@ -1456,142 +1502,37 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } } - } - } - } - s.notFound(w, r) -} - -// Route is route object. -type Route struct { - name string - operationID string - count int - args [2]string -} - -// Name returns ogen operation name. -// -// It is guaranteed to be unique and not empty. -func (r Route) Name() string { - return r.name -} - -// OperationID returns OpenAPI operationId. -func (r Route) OperationID() string { - return r.operationID -} - -// Args returns parsed arguments. -func (r Route) Args() []string { - return r.args[:r.count] -} - -// FindRoute finds Route for given method and path. -func (s *Server) FindRoute(method, path string) (r Route, _ bool) { - var ( - args = [2]string{} - elem = path - ) - r.args = args - if elem == "" { - return r, false - } - - // Static code generated router with unwrapped path search. - switch { - default: - if len(elem) == 0 { - break - } - switch elem[0] { - case '/': // Prefix: "/v2/" - if l := len("/v2/"); len(elem) >= l && elem[0:l] == "/v2/" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - break - } - switch elem[0] { - case 'a': // Prefix: "accounts/" - if l := len("accounts/"); len(elem) >= l && elem[0:l] == "accounts/" { + case 'r': // Prefix: "rates" + if l := len("rates"); len(elem) >= l && elem[0:l] == "rates" { elem = elem[l:] } else { break } if len(elem) == 0 { - break - } - switch elem[0] { - case '_': // Prefix: "_bulk" - if l := len("_bulk"); len(elem) >= l && elem[0:l] == "_bulk" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - switch method { - case "POST": - // Leaf: GetAccounts - r.name = "GetAccounts" - r.operationID = "getAccounts" - r.args = args - r.count = 0 - return r, true - default: - return - } - } - case 's': // Prefix: "search" - if l := len("search"); len(elem) >= l && elem[0:l] == "search" { - elem = elem[l:] - } else { - break + // Leaf node. + switch r.Method { + case "GET": + s.handleGetRatesRequest([0]string{}, w, r) + default: + s.notAllowed(w, r, "GET") } - if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetSearchAccounts - r.name = "GetSearchAccounts" - r.operationID = "getSearchAccounts" - r.args = args - r.count = 0 - return r, true - default: - return - } - } + return } - // Param: "account_id" - // Match until "/" - idx := strings.IndexByte(elem, '/') - if idx < 0 { - idx = len(elem) + case 's': // Prefix: "st" + if l := len("st"); len(elem) >= l && elem[0:l] == "st" { + elem = elem[l:] + } else { + break } - args[0] = elem[:idx] - elem = elem[idx:] if len(elem) == 0 { - switch method { - case "GET": - r.name = "GetAccount" - r.operationID = "getAccount" - r.args = args - r.count = 1 - return r, true - default: - return - } + break } switch elem[0] { - case '/': // Prefix: "/" - if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + case 'a': // Prefix: "aking/" + if l := len("aking/"); len(elem) >= l && elem[0:l] == "aking/" { elem = elem[l:] } else { break @@ -1601,117 +1542,56 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { break } switch elem[0] { - case 'd': // Prefix: "dns/" - if l := len("dns/"); len(elem) >= l && elem[0:l] == "dns/" { + case 'n': // Prefix: "nominator/" + if l := len("nominator/"); len(elem) >= l && elem[0:l] == "nominator/" { elem = elem[l:] } else { break } + // Param: "account_id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[0] = elem[:idx] + elem = elem[idx:] + if len(elem) == 0 { break } switch elem[0] { - case 'b': // Prefix: "backresolve" - if l := len("backresolve"); len(elem) >= l && elem[0:l] == "backresolve" { + case '/': // Prefix: "/pools" + if l := len("/pools"); len(elem) >= l && elem[0:l] == "/pools" { elem = elem[l:] } else { break } if len(elem) == 0 { - switch method { + // Leaf node. + switch r.Method { case "GET": - // Leaf: DnsBackResolve - r.name = "DnsBackResolve" - r.operationID = "dnsBackResolve" - r.args = args - r.count = 1 - return r, true + s.handlePoolsByNominatorsRequest([1]string{ + args[0], + }, w, r) default: - return - } - } - case 'e': // Prefix: "expiring" - if l := len("expiring"); len(elem) >= l && elem[0:l] == "expiring" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetDnsExpiring - r.name = "GetDnsExpiring" - r.operationID = "getDnsExpiring" - r.args = args - r.count = 1 - return r, true - default: - return + s.notAllowed(w, r, "GET") } - } - } - case 'e': // Prefix: "events" - if l := len("events"); len(elem) >= l && elem[0:l] == "events" { - elem = elem[l:] - } else { - break - } - if len(elem) == 0 { - switch method { - case "GET": - r.name = "GetEventsByAccount" - r.operationID = "getEventsByAccount" - r.args = args - r.count = 1 - return r, true - default: return } } - switch elem[0] { - case '/': // Prefix: "/emulate" - if l := len("/emulate"); len(elem) >= l && elem[0:l] == "/emulate" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - switch method { - case "POST": - // Leaf: EmulateMessageToAccountEvent - r.name = "EmulateMessageToAccountEvent" - r.operationID = "emulateMessageToAccountEvent" - r.args = args - r.count = 1 - return r, true - default: - return - } - } - } - case 'j': // Prefix: "jettons" - if l := len("jettons"); len(elem) >= l && elem[0:l] == "jettons" { + case 'p': // Prefix: "pool" + if l := len("pool"); len(elem) >= l && elem[0:l] == "pool" { elem = elem[l:] } else { break } if len(elem) == 0 { - switch method { - case "GET": - r.name = "GetJettonsBalances" - r.operationID = "getJettonsBalances" - r.args = args - r.count = 1 - return r, true - default: - return - } + break } switch elem[0] { case '/': // Prefix: "/" @@ -1721,42 +1601,26 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { break } - if len(elem) == 0 { - break - } - switch elem[0] { - case 'h': // Prefix: "history" - if l := len("history"); len(elem) >= l && elem[0:l] == "history" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetJettonsHistory - r.name = "GetJettonsHistory" - r.operationID = "getJettonsHistory" - r.args = args - r.count = 1 - return r, true - default: - return - } - } - } - // Param: "jetton_id" + // Param: "account_id" // Match until "/" idx := strings.IndexByte(elem, '/') if idx < 0 { idx = len(elem) } - args[1] = elem[:idx] + args[0] = elem[:idx] elem = elem[idx:] if len(elem) == 0 { - break + switch r.Method { + case "GET": + s.handleStakingPoolInfoRequest([1]string{ + args[0], + }, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return } switch elem[0] { case '/': // Prefix: "/history" @@ -1767,124 +1631,168 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { } if len(elem) == 0 { - switch method { + // Leaf node. + switch r.Method { case "GET": - // Leaf: GetJettonsHistoryByID - r.name = "GetJettonsHistoryByID" - r.operationID = "getJettonsHistoryByID" - r.args = args - r.count = 2 - return r, true + s.handleStakingPoolHistoryRequest([1]string{ + args[0], + }, w, r) default: - return + s.notAllowed(w, r, "GET") } + + return + } + } + case 's': // Prefix: "s" + if l := len("s"); len(elem) >= l && elem[0:l] == "s" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleStakingPoolsRequest([0]string{}, w, r) + default: + s.notAllowed(w, r, "GET") } + + return } } - case 'n': // Prefix: "nfts" - if l := len("nfts"); len(elem) >= l && elem[0:l] == "nfts" { + } + case 'o': // Prefix: "orage/providers" + if l := len("orage/providers"); len(elem) >= l && elem[0:l] == "orage/providers" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetStorageProvidersRequest([0]string{}, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } + } + case 't': // Prefix: "t" + if l := len("t"); len(elem) >= l && elem[0:l] == "t" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'o': // Prefix: "onconnect/" + if l := len("onconnect/"); len(elem) >= l && elem[0:l] == "onconnect/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'p': // Prefix: "payload" + if l := len("payload"); len(elem) >= l && elem[0:l] == "payload" { elem = elem[l:] } else { break } if len(elem) == 0 { - switch method { + // Leaf node. + switch r.Method { case "GET": - // Leaf: GetNftItemsByOwner - r.name = "GetNftItemsByOwner" - r.operationID = "getNftItemsByOwner" - r.args = args - r.count = 1 - return r, true + s.handleGetTonConnectPayloadRequest([0]string{}, w, r) default: - return + s.notAllowed(w, r, "GET") } + + return } - case 'p': // Prefix: "publickey" - if l := len("publickey"); len(elem) >= l && elem[0:l] == "publickey" { + case 's': // Prefix: "stateinit" + if l := len("stateinit"); len(elem) >= l && elem[0:l] == "stateinit" { elem = elem[l:] } else { break } if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetPublicKeyByAccountID - r.name = "GetPublicKeyByAccountID" - r.operationID = "getPublicKeyByAccountID" - r.args = args - r.count = 1 - return r, true + // Leaf node. + switch r.Method { + case "POST": + s.handleGetAccountInfoByStateInitRequest([0]string{}, w, r) default: - return + s.notAllowed(w, r, "POST") } + + return } - case 'r': // Prefix: "reindex" - if l := len("reindex"); len(elem) >= l && elem[0:l] == "reindex" { + } + case 'r': // Prefix: "races/" + if l := len("races/"); len(elem) >= l && elem[0:l] == "races/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'e': // Prefix: "emulate" + if l := len("emulate"); len(elem) >= l && elem[0:l] == "emulate" { elem = elem[l:] } else { break } if len(elem) == 0 { - switch method { + // Leaf node. + switch r.Method { case "POST": - // Leaf: ReindexAccount - r.name = "ReindexAccount" - r.operationID = "reindexAccount" - r.args = args - r.count = 1 - return r, true + s.handleEmulateMessageToTraceRequest([0]string{}, w, r) default: - return + s.notAllowed(w, r, "POST") } - } - case 's': // Prefix: "subscriptions" - if l := len("subscriptions"); len(elem) >= l && elem[0:l] == "subscriptions" { - elem = elem[l:] - } else { - break - } - if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetSubscriptionsByAccount - r.name = "GetSubscriptionsByAccount" - r.operationID = "getSubscriptionsByAccount" - r.args = args - r.count = 1 - return r, true - default: - return - } - } - case 't': // Prefix: "traces" - if l := len("traces"); len(elem) >= l && elem[0:l] == "traces" { - elem = elem[l:] - } else { - break + return } + } + // Param: "trace_id" + // Leaf parameter + args[0] = elem + elem = "" - if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetTracesByAccount - r.name = "GetTracesByAccount" - r.operationID = "getTracesByAccount" - r.args = args - r.count = 1 - return r, true - default: - return - } + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetTraceRequest([1]string{ + args[0], + }, w, r) + default: + s.notAllowed(w, r, "GET") } + + return } } - case 'b': // Prefix: "blockchain/" - if l := len("blockchain/"); len(elem) >= l && elem[0:l] == "blockchain/" { + case 'w': // Prefix: "wallet/" + if l := len("wallet/"); len(elem) >= l && elem[0:l] == "wallet/" { elem = elem[l:] } else { break @@ -1894,284 +1802,170 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { break } switch elem[0] { - case 'a': // Prefix: "accounts/" - if l := len("accounts/"); len(elem) >= l && elem[0:l] == "accounts/" { + case 'a': // Prefix: "auth/proof" + if l := len("auth/proof"); len(elem) >= l && elem[0:l] == "auth/proof" { elem = elem[l:] } else { break } - // Param: "account_id" - // Match until "/" - idx := strings.IndexByte(elem, '/') - if idx < 0 { - idx = len(elem) - } - args[0] = elem[:idx] - elem = elem[idx:] - if len(elem) == 0 { - switch method { - case "GET": - r.name = "GetRawAccount" - r.operationID = "getRawAccount" - r.args = args - r.count = 1 - return r, true + // Leaf node. + switch r.Method { + case "POST": + s.handleTonConnectProofRequest([0]string{}, w, r) default: - return - } - } - switch elem[0] { - case '/': // Prefix: "/" - if l := len("/"); len(elem) >= l && elem[0:l] == "/" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - break + s.notAllowed(w, r, "POST") } - switch elem[0] { - case 'm': // Prefix: "methods/" - if l := len("methods/"); len(elem) >= l && elem[0:l] == "methods/" { - elem = elem[l:] - } else { - break - } - - // Param: "method_name" - // Leaf parameter - args[1] = elem - elem = "" - - if len(elem) == 0 { - switch method { - case "GET": - // Leaf: ExecGetMethod - r.name = "ExecGetMethod" - r.operationID = "execGetMethod" - r.args = args - r.count = 2 - return r, true - default: - return - } - } - case 't': // Prefix: "transactions" - if l := len("transactions"); len(elem) >= l && elem[0:l] == "transactions" { - elem = elem[l:] - } else { - break - } - if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetAccountTransactions - r.name = "GetAccountTransactions" - r.operationID = "getAccountTransactions" - r.args = args - r.count = 1 - return r, true - default: - return - } - } - } + return } - case 'b': // Prefix: "blocks/" - if l := len("blocks/"); len(elem) >= l && elem[0:l] == "blocks/" { + case 'b': // Prefix: "backup" + if l := len("backup"); len(elem) >= l && elem[0:l] == "backup" { elem = elem[l:] } else { break } - // Param: "block_id" - // Match until "/" - idx := strings.IndexByte(elem, '/') - if idx < 0 { - idx = len(elem) - } - args[0] = elem[:idx] - elem = elem[idx:] - if len(elem) == 0 { - switch method { + // Leaf node. + switch r.Method { case "GET": - r.name = "GetBlock" - r.operationID = "getBlock" - r.args = args - r.count = 1 - return r, true + s.handleGetWalletBackupRequest([0]string{}, w, r) + case "PUT": + s.handleSetWalletBackupRequest([0]string{}, w, r) default: - return - } - } - switch elem[0] { - case '/': // Prefix: "/transactions" - if l := len("/transactions"); len(elem) >= l && elem[0:l] == "/transactions" { - elem = elem[l:] - } else { - break + s.notAllowed(w, r, "GET,PUT") } - if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetBlockTransactions - r.name = "GetBlockTransactions" - r.operationID = "getBlockTransactions" - r.args = args - r.count = 1 - return r, true - default: - return - } - } + return } - case 'c': // Prefix: "config" - if l := len("config"); len(elem) >= l && elem[0:l] == "config" { + case 'e': // Prefix: "emulate" + if l := len("emulate"); len(elem) >= l && elem[0:l] == "emulate" { elem = elem[l:] } else { break } if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetConfig - r.name = "GetConfig" - r.operationID = "getConfig" - r.args = args - r.count = 0 - return r, true + // Leaf node. + switch r.Method { + case "POST": + s.handleEmulateWalletMessageRequest([0]string{}, w, r) default: - return + s.notAllowed(w, r, "POST") } + + return } - case 'm': // Prefix: "m" - if l := len("m"); len(elem) >= l && elem[0:l] == "m" { + } + // Param: "account_id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[0] = elem[:idx] + elem = elem[idx:] + + if len(elem) == 0 { + break + } + switch elem[0] { + case '/': // Prefix: "/seqno" + if l := len("/seqno"); len(elem) >= l && elem[0:l] == "/seqno" { elem = elem[l:] } else { break } if len(elem) == 0 { - break - } - switch elem[0] { - case 'a': // Prefix: "asterchain-head" - if l := len("asterchain-head"); len(elem) >= l && elem[0:l] == "asterchain-head" { - elem = elem[l:] - } else { - break + // Leaf node. + switch r.Method { + case "GET": + s.handleGetAccountSeqnoRequest([1]string{ + args[0], + }, w, r) + default: + s.notAllowed(w, r, "GET") } - if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetMasterchainHead - r.name = "GetMasterchainHead" - r.operationID = "getMasterchainHead" - r.args = args - r.count = 0 - return r, true - default: - return - } - } - case 'e': // Prefix: "essage" - if l := len("essage"); len(elem) >= l && elem[0:l] == "essage" { - elem = elem[l:] - } else { - break - } + return + } + } + } + } + } + s.notFound(w, r) +} - if len(elem) == 0 { - switch method { - case "POST": - r.name = "SendMessage" - r.operationID = "sendMessage" - r.args = args - r.count = 0 - return r, true - default: - return - } - } - switch elem[0] { - case 's': // Prefix: "s/" - if l := len("s/"); len(elem) >= l && elem[0:l] == "s/" { - elem = elem[l:] - } else { - break - } +// Route is route object. +type Route struct { + name string + operationID string + count int + args [2]string +} - // Param: "msg_id" - // Match until "/" - idx := strings.IndexByte(elem, '/') - if idx < 0 { - idx = len(elem) - } - args[0] = elem[:idx] - elem = elem[idx:] +// Name returns ogen operation name. +// +// It is guaranteed to be unique and not empty. +func (r Route) Name() string { + return r.name +} - if len(elem) == 0 { - break - } - switch elem[0] { - case '/': // Prefix: "/transaction" - if l := len("/transaction"); len(elem) >= l && elem[0:l] == "/transaction" { - elem = elem[l:] - } else { - break - } +// OperationID returns OpenAPI operationId. +func (r Route) OperationID() string { + return r.operationID +} - if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetTransactionByMessageHash - r.name = "GetTransactionByMessageHash" - r.operationID = "getTransactionByMessageHash" - r.args = args - r.count = 1 - return r, true - default: - return - } - } - } - } - } - case 't': // Prefix: "transactions/" - if l := len("transactions/"); len(elem) >= l && elem[0:l] == "transactions/" { - elem = elem[l:] - } else { - break - } +// Args returns parsed arguments. +func (r Route) Args() []string { + return r.args[:r.count] +} - // Param: "transaction_id" - // Leaf parameter - args[0] = elem - elem = "" +// FindRoute finds Route for given method and path. +func (s *Server) FindRoute(method, path string) (r Route, _ bool) { + var ( + args = [2]string{} + elem = path + ) + r.args = args + if elem == "" { + return r, false + } - if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetTransaction - r.name = "GetTransaction" - r.operationID = "getTransaction" - r.args = args - r.count = 1 - return r, true - default: - return - } - } - case 'v': // Prefix: "validators" - if l := len("validators"); len(elem) >= l && elem[0:l] == "validators" { + // Static code generated router with unwrapped path search. + switch { + default: + if len(elem) == 0 { + break + } + switch elem[0] { + case '/': // Prefix: "/v2/" + if l := len("/v2/"); len(elem) >= l && elem[0:l] == "/v2/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'a': // Prefix: "accounts/" + if l := len("accounts/"); len(elem) >= l && elem[0:l] == "accounts/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case '_': // Prefix: "_bulk" + if l := len("_bulk"); len(elem) >= l && elem[0:l] == "_bulk" { elem = elem[l:] } else { break @@ -2179,10 +1973,10 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { if len(elem) == 0 { switch method { - case "GET": - // Leaf: GetValidators - r.name = "GetValidators" - r.operationID = "getValidators" + case "POST": + // Leaf: GetAccounts + r.name = "GetAccounts" + r.operationID = "getAccounts" r.args = args r.count = 0 return r, true @@ -2190,20 +1984,8 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { return } } - } - case 'd': // Prefix: "dns/" - if l := len("dns/"); len(elem) >= l && elem[0:l] == "dns/" { - elem = elem[l:] - } else { - break - } - - if len(elem) == 0 { - break - } - switch elem[0] { - case 'a': // Prefix: "auctions" - if l := len("auctions"); len(elem) >= l && elem[0:l] == "auctions" { + case 's': // Prefix: "search" + if l := len("search"); len(elem) >= l && elem[0:l] == "search" { elem = elem[l:] } else { break @@ -2212,9 +1994,9 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { if len(elem) == 0 { switch method { case "GET": - // Leaf: GetAllAuctions - r.name = "GetAllAuctions" - r.operationID = "getAllAuctions" + // Leaf: GetSearchAccounts + r.name = "GetSearchAccounts" + r.operationID = "getSearchAccounts" r.args = args r.count = 0 return r, true @@ -2223,7 +2005,7 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { } } } - // Param: "domain_name" + // Param: "account_id" // Match until "/" idx := strings.IndexByte(elem, '/') if idx < 0 { @@ -2235,8 +2017,8 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { if len(elem) == 0 { switch method { case "GET": - r.name = "DnsInfo" - r.operationID = "dnsInfo" + r.name = "GetAccount" + r.operationID = "getAccount" r.args = args r.count = 1 return r, true @@ -2256,28 +2038,60 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { break } switch elem[0] { - case 'b': // Prefix: "bids" - if l := len("bids"); len(elem) >= l && elem[0:l] == "bids" { + case 'd': // Prefix: "dns/" + if l := len("dns/"); len(elem) >= l && elem[0:l] == "dns/" { elem = elem[l:] } else { break } if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetDomainBids - r.name = "GetDomainBids" - r.operationID = "getDomainBids" - r.args = args - r.count = 1 - return r, true - default: - return + break + } + switch elem[0] { + case 'b': // Prefix: "backresolve" + if l := len("backresolve"); len(elem) >= l && elem[0:l] == "backresolve" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: DnsBackResolve + r.name = "DnsBackResolve" + r.operationID = "dnsBackResolve" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 'e': // Prefix: "expiring" + if l := len("expiring"); len(elem) >= l && elem[0:l] == "expiring" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetDnsExpiring + r.name = "GetDnsExpiring" + r.operationID = "getDnsExpiring" + r.args = args + r.count = 1 + return r, true + default: + return + } } } - case 'r': // Prefix: "resolve" - if l := len("resolve"); len(elem) >= l && elem[0:l] == "resolve" { + case 'e': // Prefix: "events" + if l := len("events"); len(elem) >= l && elem[0:l] == "events" { elem = elem[l:] } else { break @@ -2286,9 +2100,217 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { if len(elem) == 0 { switch method { case "GET": - // Leaf: DnsResolve - r.name = "DnsResolve" - r.operationID = "dnsResolve" + r.name = "GetEventsByAccount" + r.operationID = "getEventsByAccount" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + switch elem[0] { + case '/': // Prefix: "/emulate" + if l := len("/emulate"); len(elem) >= l && elem[0:l] == "/emulate" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "POST": + // Leaf: EmulateMessageToAccountEvent + r.name = "EmulateMessageToAccountEvent" + r.operationID = "emulateMessageToAccountEvent" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + } + case 'j': // Prefix: "jettons" + if l := len("jettons"); len(elem) >= l && elem[0:l] == "jettons" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + r.name = "GetJettonsBalances" + r.operationID = "getJettonsBalances" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + switch elem[0] { + case '/': // Prefix: "/" + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'h': // Prefix: "history" + if l := len("history"); len(elem) >= l && elem[0:l] == "history" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetJettonsHistory + r.name = "GetJettonsHistory" + r.operationID = "getJettonsHistory" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + } + // Param: "jetton_id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[1] = elem[:idx] + elem = elem[idx:] + + if len(elem) == 0 { + break + } + switch elem[0] { + case '/': // Prefix: "/history" + if l := len("/history"); len(elem) >= l && elem[0:l] == "/history" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetJettonsHistoryByID + r.name = "GetJettonsHistoryByID" + r.operationID = "getJettonsHistoryByID" + r.args = args + r.count = 2 + return r, true + default: + return + } + } + } + } + case 'n': // Prefix: "nfts" + if l := len("nfts"); len(elem) >= l && elem[0:l] == "nfts" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetNftItemsByOwner + r.name = "GetNftItemsByOwner" + r.operationID = "getNftItemsByOwner" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 'p': // Prefix: "publickey" + if l := len("publickey"); len(elem) >= l && elem[0:l] == "publickey" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetPublicKeyByAccountID + r.name = "GetPublicKeyByAccountID" + r.operationID = "getPublicKeyByAccountID" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 'r': // Prefix: "reindex" + if l := len("reindex"); len(elem) >= l && elem[0:l] == "reindex" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "POST": + // Leaf: ReindexAccount + r.name = "ReindexAccount" + r.operationID = "reindexAccount" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 's': // Prefix: "subscriptions" + if l := len("subscriptions"); len(elem) >= l && elem[0:l] == "subscriptions" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetSubscriptionsByAccount + r.name = "GetSubscriptionsByAccount" + r.operationID = "getSubscriptionsByAccount" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 't': // Prefix: "traces" + if l := len("traces"); len(elem) >= l && elem[0:l] == "traces" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetTracesByAccount + r.name = "GetTracesByAccount" + r.operationID = "getTracesByAccount" r.args = args r.count = 1 return r, true @@ -2298,8 +2320,8 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { } } } - case 'e': // Prefix: "events/" - if l := len("events/"); len(elem) >= l && elem[0:l] == "events/" { + case 'b': // Prefix: "blockchain/" + if l := len("blockchain/"); len(elem) >= l && elem[0:l] == "blockchain/" { elem = elem[l:] } else { break @@ -2309,73 +2331,265 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { break } switch elem[0] { - case 'e': // Prefix: "emulate" - if l := len("emulate"); len(elem) >= l && elem[0:l] == "emulate" { + case 'a': // Prefix: "accounts/" + if l := len("accounts/"); len(elem) >= l && elem[0:l] == "accounts/" { elem = elem[l:] } else { break } + // Param: "account_id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[0] = elem[:idx] + elem = elem[idx:] + if len(elem) == 0 { switch method { - case "POST": - // Leaf: EmulateMessageToEvent - r.name = "EmulateMessageToEvent" - r.operationID = "emulateMessageToEvent" + case "GET": + r.name = "GetRawAccount" + r.operationID = "getRawAccount" r.args = args - r.count = 0 + r.count = 1 return r, true default: return } } - } - // Param: "event_id" - // Leaf parameter - args[0] = elem - elem = "" + switch elem[0] { + case '/': // Prefix: "/" + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + elem = elem[l:] + } else { + break + } - if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetEvent - r.name = "GetEvent" - r.operationID = "getEvent" - r.args = args - r.count = 1 - return r, true - default: - return + if len(elem) == 0 { + break + } + switch elem[0] { + case 'm': // Prefix: "methods/" + if l := len("methods/"); len(elem) >= l && elem[0:l] == "methods/" { + elem = elem[l:] + } else { + break + } + + // Param: "method_name" + // Leaf parameter + args[1] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: ExecGetMethod + r.name = "ExecGetMethod" + r.operationID = "execGetMethod" + r.args = args + r.count = 2 + return r, true + default: + return + } + } + case 't': // Prefix: "transactions" + if l := len("transactions"); len(elem) >= l && elem[0:l] == "transactions" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetAccountTransactions + r.name = "GetAccountTransactions" + r.operationID = "getAccountTransactions" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + } + } + case 'b': // Prefix: "blocks/" + if l := len("blocks/"); len(elem) >= l && elem[0:l] == "blocks/" { + elem = elem[l:] + } else { + break } - } - case 'j': // Prefix: "jettons" - if l := len("jettons"); len(elem) >= l && elem[0:l] == "jettons" { - elem = elem[l:] - } else { - break - } - if len(elem) == 0 { - switch method { - case "GET": - r.name = "GetJettons" - r.operationID = "getJettons" - r.args = args - r.count = 0 - return r, true - default: - return + // Param: "block_id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) } - } - switch elem[0] { - case '/': // Prefix: "/" - if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + args[0] = elem[:idx] + elem = elem[idx:] + + if len(elem) == 0 { + switch method { + case "GET": + r.name = "GetBlock" + r.operationID = "getBlock" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + switch elem[0] { + case '/': // Prefix: "/transactions" + if l := len("/transactions"); len(elem) >= l && elem[0:l] == "/transactions" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetBlockTransactions + r.name = "GetBlockTransactions" + r.operationID = "getBlockTransactions" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + } + case 'c': // Prefix: "config" + if l := len("config"); len(elem) >= l && elem[0:l] == "config" { elem = elem[l:] } else { break } - // Param: "account_id" + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetConfig + r.name = "GetConfig" + r.operationID = "getConfig" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + case 'm': // Prefix: "m" + if l := len("m"); len(elem) >= l && elem[0:l] == "m" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'a': // Prefix: "asterchain-head" + if l := len("asterchain-head"); len(elem) >= l && elem[0:l] == "asterchain-head" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetMasterchainHead + r.name = "GetMasterchainHead" + r.operationID = "getMasterchainHead" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + case 'e': // Prefix: "essage" + if l := len("essage"); len(elem) >= l && elem[0:l] == "essage" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "POST": + r.name = "SendMessage" + r.operationID = "sendMessage" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + switch elem[0] { + case 's': // Prefix: "s/" + if l := len("s/"); len(elem) >= l && elem[0:l] == "s/" { + elem = elem[l:] + } else { + break + } + + // Param: "msg_id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[0] = elem[:idx] + elem = elem[idx:] + + if len(elem) == 0 { + break + } + switch elem[0] { + case '/': // Prefix: "/transaction" + if l := len("/transaction"); len(elem) >= l && elem[0:l] == "/transaction" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetTransactionByMessageHash + r.name = "GetTransactionByMessageHash" + r.operationID = "getTransactionByMessageHash" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + } + } + } + case 't': // Prefix: "transactions/" + if l := len("transactions/"); len(elem) >= l && elem[0:l] == "transactions/" { + elem = elem[l:] + } else { + break + } + + // Param: "transaction_id" // Leaf parameter args[0] = elem elem = "" @@ -2383,9 +2597,9 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { if len(elem) == 0 { switch method { case "GET": - // Leaf: GetJettonInfo - r.name = "GetJettonInfo" - r.operationID = "getJettonInfo" + // Leaf: GetTransaction + r.name = "GetTransaction" + r.operationID = "getTransaction" r.args = args r.count = 1 return r, true @@ -2393,6 +2607,676 @@ func (s *Server) FindRoute(method, path string) (r Route, _ bool) { return } } + case 'v': // Prefix: "validators" + if l := len("validators"); len(elem) >= l && elem[0:l] == "validators" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetValidators + r.name = "GetValidators" + r.operationID = "getValidators" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + } + case 'd': // Prefix: "dns/" + if l := len("dns/"); len(elem) >= l && elem[0:l] == "dns/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'a': // Prefix: "auctions" + if l := len("auctions"); len(elem) >= l && elem[0:l] == "auctions" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetAllAuctions + r.name = "GetAllAuctions" + r.operationID = "getAllAuctions" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + } + // Param: "domain_name" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[0] = elem[:idx] + elem = elem[idx:] + + if len(elem) == 0 { + switch method { + case "GET": + r.name = "DnsInfo" + r.operationID = "dnsInfo" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + switch elem[0] { + case '/': // Prefix: "/" + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'b': // Prefix: "bids" + if l := len("bids"); len(elem) >= l && elem[0:l] == "bids" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetDomainBids + r.name = "GetDomainBids" + r.operationID = "getDomainBids" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 'r': // Prefix: "resolve" + if l := len("resolve"); len(elem) >= l && elem[0:l] == "resolve" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: DnsResolve + r.name = "DnsResolve" + r.operationID = "dnsResolve" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + } + } + case 'e': // Prefix: "events/" + if l := len("events/"); len(elem) >= l && elem[0:l] == "events/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'e': // Prefix: "emulate" + if l := len("emulate"); len(elem) >= l && elem[0:l] == "emulate" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "POST": + // Leaf: EmulateMessageToEvent + r.name = "EmulateMessageToEvent" + r.operationID = "emulateMessageToEvent" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + } + // Param: "event_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetEvent + r.name = "GetEvent" + r.operationID = "getEvent" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 'j': // Prefix: "jettons" + if l := len("jettons"); len(elem) >= l && elem[0:l] == "jettons" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + r.name = "GetJettons" + r.operationID = "getJettons" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + switch elem[0] { + case '/': // Prefix: "/" + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + elem = elem[l:] + } else { + break + } + + // Param: "account_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetJettonInfo + r.name = "GetJettonInfo" + r.operationID = "getJettonInfo" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + } + case 'l': // Prefix: "liteserver/" + if l := len("liteserver/"); len(elem) >= l && elem[0:l] == "liteserver/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'g': // Prefix: "get_" + if l := len("get_"); len(elem) >= l && elem[0:l] == "get_" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'a': // Prefix: "a" + if l := len("a"); len(elem) >= l && elem[0:l] == "a" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'c': // Prefix: "ccount_state/" + if l := len("ccount_state/"); len(elem) >= l && elem[0:l] == "ccount_state/" { + elem = elem[l:] + } else { + break + } + + // Param: "account_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetAccountStateLiteServer + r.name = "GetAccountStateLiteServer" + r.operationID = "getAccountStateLiteServer" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 'l': // Prefix: "ll_shards_info/" + if l := len("ll_shards_info/"); len(elem) >= l && elem[0:l] == "ll_shards_info/" { + elem = elem[l:] + } else { + break + } + + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetAllShardsInfoLiteServer + r.name = "GetAllShardsInfoLiteServer" + r.operationID = "getAllShardsInfoLiteServer" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + } + case 'b': // Prefix: "block" + if l := len("block"); len(elem) >= l && elem[0:l] == "block" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case '/': // Prefix: "/" + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + elem = elem[l:] + } else { + break + } + + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetBlockLiteServer + r.name = "GetBlockLiteServer" + r.operationID = "getBlockLiteServer" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case '_': // Prefix: "_" + if l := len("_"); len(elem) >= l && elem[0:l] == "_" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'h': // Prefix: "header/" + if l := len("header/"); len(elem) >= l && elem[0:l] == "header/" { + elem = elem[l:] + } else { + break + } + + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetBlockHeaderLiteServer + r.name = "GetBlockHeaderLiteServer" + r.operationID = "getBlockHeaderLiteServer" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 'p': // Prefix: "proof" + if l := len("proof"); len(elem) >= l && elem[0:l] == "proof" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetBlockProofLiteServer + r.name = "GetBlockProofLiteServer" + r.operationID = "getBlockProofLiteServer" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + } + } + case 'c': // Prefix: "config_all/" + if l := len("config_all/"); len(elem) >= l && elem[0:l] == "config_all/" { + elem = elem[l:] + } else { + break + } + + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetConfigAllLiteServer + r.name = "GetConfigAllLiteServer" + r.operationID = "getConfigAllLiteServer" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 'm': // Prefix: "masterchain_info" + if l := len("masterchain_info"); len(elem) >= l && elem[0:l] == "masterchain_info" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + r.name = "GetMasterchainInfoLiteServer" + r.operationID = "getMasterchainInfoLiteServer" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + switch elem[0] { + case '_': // Prefix: "_ext" + if l := len("_ext"); len(elem) >= l && elem[0:l] == "_ext" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetMasterchainInfoExtLiteServer + r.name = "GetMasterchainInfoExtLiteServer" + r.operationID = "getMasterchainInfoExtLiteServer" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + } + case 's': // Prefix: "s" + if l := len("s"); len(elem) >= l && elem[0:l] == "s" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'h': // Prefix: "hard_" + if l := len("hard_"); len(elem) >= l && elem[0:l] == "hard_" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'b': // Prefix: "block_proof/" + if l := len("block_proof/"); len(elem) >= l && elem[0:l] == "block_proof/" { + elem = elem[l:] + } else { + break + } + + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetShardBlockProofLiteServer + r.name = "GetShardBlockProofLiteServer" + r.operationID = "getShardBlockProofLiteServer" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 'i': // Prefix: "info/" + if l := len("info/"); len(elem) >= l && elem[0:l] == "info/" { + elem = elem[l:] + } else { + break + } + + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetShardInfoLiteServer + r.name = "GetShardInfoLiteServer" + r.operationID = "getShardInfoLiteServer" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + } + case 't': // Prefix: "tate/" + if l := len("tate/"); len(elem) >= l && elem[0:l] == "tate/" { + elem = elem[l:] + } else { + break + } + + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetStateLiteServer + r.name = "GetStateLiteServer" + r.operationID = "getStateLiteServer" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + } + case 't': // Prefix: "t" + if l := len("t"); len(elem) >= l && elem[0:l] == "t" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'i': // Prefix: "ime" + if l := len("ime"); len(elem) >= l && elem[0:l] == "ime" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetTimeLiteServer + r.name = "GetTimeLiteServer" + r.operationID = "getTimeLiteServer" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + case 'r': // Prefix: "ransactions/" + if l := len("ransactions/"); len(elem) >= l && elem[0:l] == "ransactions/" { + elem = elem[l:] + } else { + break + } + + // Param: "account_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetTransactionsLiteServer + r.name = "GetTransactionsLiteServer" + r.operationID = "getTransactionsLiteServer" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + } + } + case 'l': // Prefix: "list_block_transactions/" + if l := len("list_block_transactions/"); len(elem) >= l && elem[0:l] == "list_block_transactions/" { + elem = elem[l:] + } else { + break + } + + // Param: "block_id" + // Leaf parameter + args[0] = elem + elem = "" + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetListBlockTransactionsLiteServer + r.name = "GetListBlockTransactionsLiteServer" + r.operationID = "getListBlockTransactionsLiteServer" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 's': // Prefix: "send_message" + if l := len("send_message"); len(elem) >= l && elem[0:l] == "send_message" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "POST": + // Leaf: SendMessageLiteServer + r.name = "SendMessageLiteServer" + r.operationID = "sendMessageLiteServer" + r.args = args + r.count = 0 + return r, true + default: + return + } + } } case 'n': // Prefix: "nfts/" if l := len("nfts/"); len(elem) >= l && elem[0:l] == "nfts/" { diff --git a/pkg/oas/oas_schemas_gen.go b/pkg/oas/oas_schemas_gen.go index 8932f706..e1b2e8cf 100644 --- a/pkg/oas/oas_schemas_gen.go +++ b/pkg/oas/oas_schemas_gen.go @@ -1030,55 +1030,70 @@ func (s *BadRequest) SetError(val string) { s.Error = val } -func (*BadRequest) dnsBackResolveRes() {} -func (*BadRequest) dnsInfoRes() {} -func (*BadRequest) dnsResolveRes() {} -func (*BadRequest) emulateMessageToAccountEventRes() {} -func (*BadRequest) emulateMessageToEventRes() {} -func (*BadRequest) emulateMessageToTraceRes() {} -func (*BadRequest) emulateWalletMessageRes() {} -func (*BadRequest) execGetMethodRes() {} -func (*BadRequest) getAccountInfoByStateInitRes() {} -func (*BadRequest) getAccountRes() {} -func (*BadRequest) getAccountSeqnoRes() {} -func (*BadRequest) getAccountTransactionsRes() {} -func (*BadRequest) getAccountsRes() {} -func (*BadRequest) getBlockRes() {} -func (*BadRequest) getBlockTransactionsRes() {} -func (*BadRequest) getDnsExpiringRes() {} -func (*BadRequest) getDomainBidsRes() {} -func (*BadRequest) getEventRes() {} -func (*BadRequest) getEventsByAccountRes() {} -func (*BadRequest) getItemsFromCollectionRes() {} -func (*BadRequest) getJettonInfoRes() {} -func (*BadRequest) getJettonsBalancesRes() {} -func (*BadRequest) getJettonsHistoryByIDRes() {} -func (*BadRequest) getJettonsHistoryRes() {} -func (*BadRequest) getNftCollectionRes() {} -func (*BadRequest) getNftItemByAddressRes() {} -func (*BadRequest) getNftItemsByAddressesRes() {} -func (*BadRequest) getNftItemsByOwnerRes() {} -func (*BadRequest) getPublicKeyByAccountIDRes() {} -func (*BadRequest) getRatesRes() {} -func (*BadRequest) getRawAccountRes() {} -func (*BadRequest) getSearchAccountsRes() {} -func (*BadRequest) getStorageProvidersRes() {} -func (*BadRequest) getSubscriptionsByAccountRes() {} -func (*BadRequest) getTonConnectPayloadRes() {} -func (*BadRequest) getTraceRes() {} -func (*BadRequest) getTracesByAccountRes() {} -func (*BadRequest) getTransactionByMessageHashRes() {} -func (*BadRequest) getTransactionRes() {} -func (*BadRequest) getWalletBackupRes() {} -func (*BadRequest) getWalletsByPublicKeyRes() {} -func (*BadRequest) poolsByNominatorsRes() {} -func (*BadRequest) reindexAccountRes() {} -func (*BadRequest) sendMessageRes() {} -func (*BadRequest) setWalletBackupRes() {} -func (*BadRequest) stakingPoolHistoryRes() {} -func (*BadRequest) stakingPoolInfoRes() {} -func (*BadRequest) stakingPoolsRes() {} -func (*BadRequest) tonConnectProofRes() {} +func (*BadRequest) dnsBackResolveRes() {} +func (*BadRequest) dnsInfoRes() {} +func (*BadRequest) dnsResolveRes() {} +func (*BadRequest) emulateMessageToAccountEventRes() {} +func (*BadRequest) emulateMessageToEventRes() {} +func (*BadRequest) emulateMessageToTraceRes() {} +func (*BadRequest) emulateWalletMessageRes() {} +func (*BadRequest) execGetMethodRes() {} +func (*BadRequest) getAccountInfoByStateInitRes() {} +func (*BadRequest) getAccountRes() {} +func (*BadRequest) getAccountSeqnoRes() {} +func (*BadRequest) getAccountStateLiteServerRes() {} +func (*BadRequest) getAccountTransactionsRes() {} +func (*BadRequest) getAccountsRes() {} +func (*BadRequest) getAllShardsInfoLiteServerRes() {} +func (*BadRequest) getBlockHeaderLiteServerRes() {} +func (*BadRequest) getBlockLiteServerRes() {} +func (*BadRequest) getBlockProofLiteServerRes() {} +func (*BadRequest) getBlockRes() {} +func (*BadRequest) getBlockTransactionsRes() {} +func (*BadRequest) getConfigAllLiteServerRes() {} +func (*BadRequest) getDnsExpiringRes() {} +func (*BadRequest) getDomainBidsRes() {} +func (*BadRequest) getEventRes() {} +func (*BadRequest) getEventsByAccountRes() {} +func (*BadRequest) getItemsFromCollectionRes() {} +func (*BadRequest) getJettonInfoRes() {} +func (*BadRequest) getJettonsBalancesRes() {} +func (*BadRequest) getJettonsHistoryByIDRes() {} +func (*BadRequest) getJettonsHistoryRes() {} +func (*BadRequest) getListBlockTransactionsLiteServerRes() {} +func (*BadRequest) getMasterchainInfoExtLiteServerRes() {} +func (*BadRequest) getMasterchainInfoLiteServerRes() {} +func (*BadRequest) getNftCollectionRes() {} +func (*BadRequest) getNftItemByAddressRes() {} +func (*BadRequest) getNftItemsByAddressesRes() {} +func (*BadRequest) getNftItemsByOwnerRes() {} +func (*BadRequest) getPublicKeyByAccountIDRes() {} +func (*BadRequest) getRatesRes() {} +func (*BadRequest) getRawAccountRes() {} +func (*BadRequest) getSearchAccountsRes() {} +func (*BadRequest) getShardBlockProofLiteServerRes() {} +func (*BadRequest) getShardInfoLiteServerRes() {} +func (*BadRequest) getStateLiteServerRes() {} +func (*BadRequest) getStorageProvidersRes() {} +func (*BadRequest) getSubscriptionsByAccountRes() {} +func (*BadRequest) getTimeLiteServerRes() {} +func (*BadRequest) getTonConnectPayloadRes() {} +func (*BadRequest) getTraceRes() {} +func (*BadRequest) getTracesByAccountRes() {} +func (*BadRequest) getTransactionByMessageHashRes() {} +func (*BadRequest) getTransactionRes() {} +func (*BadRequest) getTransactionsLiteServerRes() {} +func (*BadRequest) getWalletBackupRes() {} +func (*BadRequest) getWalletsByPublicKeyRes() {} +func (*BadRequest) poolsByNominatorsRes() {} +func (*BadRequest) reindexAccountRes() {} +func (*BadRequest) sendMessageLiteServerRes() {} +func (*BadRequest) sendMessageRes() {} +func (*BadRequest) setWalletBackupRes() {} +func (*BadRequest) stakingPoolHistoryRes() {} +func (*BadRequest) stakingPoolInfoRes() {} +func (*BadRequest) stakingPoolsRes() {} +func (*BadRequest) tonConnectProofRes() {} // Ref: #/components/schemas/Block type Block struct { @@ -1395,6 +1410,65 @@ func (s *Block) SetCreatedBy(val string) { func (*Block) getBlockRes() {} func (*Block) getMasterchainHeadRes() {} +// Ref: #/components/schemas/BlockRaw +type BlockRaw struct { + Workchain uint32 `json:"workchain"` + Shard uint64 `json:"shard"` + Seqno uint32 `json:"seqno"` + RootHash string `json:"root_hash"` + FileHash string `json:"file_hash"` +} + +// GetWorkchain returns the value of Workchain. +func (s BlockRaw) GetWorkchain() uint32 { + return s.Workchain +} + +// GetShard returns the value of Shard. +func (s BlockRaw) GetShard() uint64 { + return s.Shard +} + +// GetSeqno returns the value of Seqno. +func (s BlockRaw) GetSeqno() uint32 { + return s.Seqno +} + +// GetRootHash returns the value of RootHash. +func (s BlockRaw) GetRootHash() string { + return s.RootHash +} + +// GetFileHash returns the value of FileHash. +func (s BlockRaw) GetFileHash() string { + return s.FileHash +} + +// SetWorkchain sets the value of Workchain. +func (s *BlockRaw) SetWorkchain(val uint32) { + s.Workchain = val +} + +// SetShard sets the value of Shard. +func (s *BlockRaw) SetShard(val uint64) { + s.Shard = val +} + +// SetSeqno sets the value of Seqno. +func (s *BlockRaw) SetSeqno(val uint32) { + s.Seqno = val +} + +// SetRootHash sets the value of RootHash. +func (s *BlockRaw) SetRootHash(val string) { + s.RootHash = val +} + +// SetFileHash sets the value of FileHash. +func (s *BlockRaw) SetFileHash(val string) { + s.FileHash = val +} + // Ref: #/components/schemas/BouncePhaseType type BouncePhaseType string @@ -2060,99 +2134,822 @@ func (s *Event) SetActions(val []Action) { s.Actions = val } -// SetValueFlow sets the value of ValueFlow. -func (s *Event) SetValueFlow(val []ValueFlow) { - s.ValueFlow = val +// SetValueFlow sets the value of ValueFlow. +func (s *Event) SetValueFlow(val []ValueFlow) { + s.ValueFlow = val +} + +// SetIsScam sets the value of IsScam. +func (s *Event) SetIsScam(val bool) { + s.IsScam = val +} + +// SetLt sets the value of Lt. +func (s *Event) SetLt(val int64) { + s.Lt = val +} + +// SetInProgress sets the value of InProgress. +func (s *Event) SetInProgress(val bool) { + s.InProgress = val +} + +func (*Event) emulateMessageToEventRes() {} +func (*Event) getEventRes() {} + +// Ref: #/components/schemas/FoundAccounts +type FoundAccounts struct { + Addresses []FoundAccountsAddressesItem `json:"addresses"` +} + +// GetAddresses returns the value of Addresses. +func (s FoundAccounts) GetAddresses() []FoundAccountsAddressesItem { + return s.Addresses +} + +// SetAddresses sets the value of Addresses. +func (s *FoundAccounts) SetAddresses(val []FoundAccountsAddressesItem) { + s.Addresses = val +} + +func (*FoundAccounts) getSearchAccountsRes() {} + +type FoundAccountsAddressesItem struct { + Address string `json:"address"` + Name string `json:"name"` +} + +// GetAddress returns the value of Address. +func (s FoundAccountsAddressesItem) GetAddress() string { + return s.Address +} + +// GetName returns the value of Name. +func (s FoundAccountsAddressesItem) GetName() string { + return s.Name +} + +// SetAddress sets the value of Address. +func (s *FoundAccountsAddressesItem) SetAddress(val string) { + s.Address = val +} + +// SetName sets the value of Name. +func (s *FoundAccountsAddressesItem) SetName(val string) { + s.Name = val +} + +type GetAccountInfoByStateInitReq struct { + StateInit string `json:"state_init"` +} + +// GetStateInit returns the value of StateInit. +func (s GetAccountInfoByStateInitReq) GetStateInit() string { + return s.StateInit +} + +// SetStateInit sets the value of StateInit. +func (s *GetAccountInfoByStateInitReq) SetStateInit(val string) { + s.StateInit = val +} + +type GetAccountStateLiteServerOK struct { + ID BlockRaw `json:"id"` + Shardblk BlockRaw `json:"shardblk"` + ShardProof string `json:"shard_proof"` + Proof string `json:"proof"` + State string `json:"state"` +} + +// GetID returns the value of ID. +func (s GetAccountStateLiteServerOK) GetID() BlockRaw { + return s.ID +} + +// GetShardblk returns the value of Shardblk. +func (s GetAccountStateLiteServerOK) GetShardblk() BlockRaw { + return s.Shardblk +} + +// GetShardProof returns the value of ShardProof. +func (s GetAccountStateLiteServerOK) GetShardProof() string { + return s.ShardProof +} + +// GetProof returns the value of Proof. +func (s GetAccountStateLiteServerOK) GetProof() string { + return s.Proof +} + +// GetState returns the value of State. +func (s GetAccountStateLiteServerOK) GetState() string { + return s.State +} + +// SetID sets the value of ID. +func (s *GetAccountStateLiteServerOK) SetID(val BlockRaw) { + s.ID = val +} + +// SetShardblk sets the value of Shardblk. +func (s *GetAccountStateLiteServerOK) SetShardblk(val BlockRaw) { + s.Shardblk = val +} + +// SetShardProof sets the value of ShardProof. +func (s *GetAccountStateLiteServerOK) SetShardProof(val string) { + s.ShardProof = val +} + +// SetProof sets the value of Proof. +func (s *GetAccountStateLiteServerOK) SetProof(val string) { + s.Proof = val +} + +// SetState sets the value of State. +func (s *GetAccountStateLiteServerOK) SetState(val string) { + s.State = val +} + +func (*GetAccountStateLiteServerOK) getAccountStateLiteServerRes() {} + +type GetAccountsReq struct { + AccountIds []string `json:"account_ids"` +} + +// GetAccountIds returns the value of AccountIds. +func (s GetAccountsReq) GetAccountIds() []string { + return s.AccountIds +} + +// SetAccountIds sets the value of AccountIds. +func (s *GetAccountsReq) SetAccountIds(val []string) { + s.AccountIds = val +} + +type GetAllShardsInfoLiteServerOK struct { + ID BlockRaw `json:"id"` + Proof string `json:"proof"` + Data string `json:"data"` +} + +// GetID returns the value of ID. +func (s GetAllShardsInfoLiteServerOK) GetID() BlockRaw { + return s.ID +} + +// GetProof returns the value of Proof. +func (s GetAllShardsInfoLiteServerOK) GetProof() string { + return s.Proof +} + +// GetData returns the value of Data. +func (s GetAllShardsInfoLiteServerOK) GetData() string { + return s.Data +} + +// SetID sets the value of ID. +func (s *GetAllShardsInfoLiteServerOK) SetID(val BlockRaw) { + s.ID = val +} + +// SetProof sets the value of Proof. +func (s *GetAllShardsInfoLiteServerOK) SetProof(val string) { + s.Proof = val +} + +// SetData sets the value of Data. +func (s *GetAllShardsInfoLiteServerOK) SetData(val string) { + s.Data = val +} + +func (*GetAllShardsInfoLiteServerOK) getAllShardsInfoLiteServerRes() {} + +type GetBlockHeaderLiteServerOK struct { + ID BlockRaw `json:"id"` + Mode uint32 `json:"mode"` + HeaderProof string `json:"header_proof"` +} + +// GetID returns the value of ID. +func (s GetBlockHeaderLiteServerOK) GetID() BlockRaw { + return s.ID +} + +// GetMode returns the value of Mode. +func (s GetBlockHeaderLiteServerOK) GetMode() uint32 { + return s.Mode +} + +// GetHeaderProof returns the value of HeaderProof. +func (s GetBlockHeaderLiteServerOK) GetHeaderProof() string { + return s.HeaderProof +} + +// SetID sets the value of ID. +func (s *GetBlockHeaderLiteServerOK) SetID(val BlockRaw) { + s.ID = val +} + +// SetMode sets the value of Mode. +func (s *GetBlockHeaderLiteServerOK) SetMode(val uint32) { + s.Mode = val +} + +// SetHeaderProof sets the value of HeaderProof. +func (s *GetBlockHeaderLiteServerOK) SetHeaderProof(val string) { + s.HeaderProof = val +} + +func (*GetBlockHeaderLiteServerOK) getBlockHeaderLiteServerRes() {} + +type GetBlockLiteServerOK struct { + ID BlockRaw `json:"id"` + Data string `json:"data"` +} + +// GetID returns the value of ID. +func (s GetBlockLiteServerOK) GetID() BlockRaw { + return s.ID +} + +// GetData returns the value of Data. +func (s GetBlockLiteServerOK) GetData() string { + return s.Data +} + +// SetID sets the value of ID. +func (s *GetBlockLiteServerOK) SetID(val BlockRaw) { + s.ID = val +} + +// SetData sets the value of Data. +func (s *GetBlockLiteServerOK) SetData(val string) { + s.Data = val +} + +func (*GetBlockLiteServerOK) getBlockLiteServerRes() {} + +type GetBlockProofLiteServerOK struct { + Complete bool `json:"complete"` + From BlockRaw `json:"from"` + To BlockRaw `json:"to"` + Steps []GetBlockProofLiteServerOKStepsItem `json:"steps"` +} + +// GetComplete returns the value of Complete. +func (s GetBlockProofLiteServerOK) GetComplete() bool { + return s.Complete +} + +// GetFrom returns the value of From. +func (s GetBlockProofLiteServerOK) GetFrom() BlockRaw { + return s.From +} + +// GetTo returns the value of To. +func (s GetBlockProofLiteServerOK) GetTo() BlockRaw { + return s.To +} + +// GetSteps returns the value of Steps. +func (s GetBlockProofLiteServerOK) GetSteps() []GetBlockProofLiteServerOKStepsItem { + return s.Steps +} + +// SetComplete sets the value of Complete. +func (s *GetBlockProofLiteServerOK) SetComplete(val bool) { + s.Complete = val +} + +// SetFrom sets the value of From. +func (s *GetBlockProofLiteServerOK) SetFrom(val BlockRaw) { + s.From = val +} + +// SetTo sets the value of To. +func (s *GetBlockProofLiteServerOK) SetTo(val BlockRaw) { + s.To = val +} + +// SetSteps sets the value of Steps. +func (s *GetBlockProofLiteServerOK) SetSteps(val []GetBlockProofLiteServerOKStepsItem) { + s.Steps = val +} + +func (*GetBlockProofLiteServerOK) getBlockProofLiteServerRes() {} + +type GetBlockProofLiteServerOKStepsItem struct { + LiteServerBlockLinkBack GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack `json:"lite_server_block_link_back"` + LiteServerBlockLinkForward GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward `json:"lite_server_block_link_forward"` +} + +// GetLiteServerBlockLinkBack returns the value of LiteServerBlockLinkBack. +func (s GetBlockProofLiteServerOKStepsItem) GetLiteServerBlockLinkBack() GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack { + return s.LiteServerBlockLinkBack +} + +// GetLiteServerBlockLinkForward returns the value of LiteServerBlockLinkForward. +func (s GetBlockProofLiteServerOKStepsItem) GetLiteServerBlockLinkForward() GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward { + return s.LiteServerBlockLinkForward +} + +// SetLiteServerBlockLinkBack sets the value of LiteServerBlockLinkBack. +func (s *GetBlockProofLiteServerOKStepsItem) SetLiteServerBlockLinkBack(val GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) { + s.LiteServerBlockLinkBack = val +} + +// SetLiteServerBlockLinkForward sets the value of LiteServerBlockLinkForward. +func (s *GetBlockProofLiteServerOKStepsItem) SetLiteServerBlockLinkForward(val GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) { + s.LiteServerBlockLinkForward = val +} + +type GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack struct { + ToKeyBlock bool `json:"to_key_block"` + From BlockRaw `json:"from"` + To BlockRaw `json:"to"` + DestProof string `json:"dest_proof"` + Proof string `json:"proof"` + StateProof string `json:"state_proof"` +} + +// GetToKeyBlock returns the value of ToKeyBlock. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) GetToKeyBlock() bool { + return s.ToKeyBlock +} + +// GetFrom returns the value of From. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) GetFrom() BlockRaw { + return s.From +} + +// GetTo returns the value of To. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) GetTo() BlockRaw { + return s.To +} + +// GetDestProof returns the value of DestProof. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) GetDestProof() string { + return s.DestProof +} + +// GetProof returns the value of Proof. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) GetProof() string { + return s.Proof +} + +// GetStateProof returns the value of StateProof. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) GetStateProof() string { + return s.StateProof +} + +// SetToKeyBlock sets the value of ToKeyBlock. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) SetToKeyBlock(val bool) { + s.ToKeyBlock = val +} + +// SetFrom sets the value of From. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) SetFrom(val BlockRaw) { + s.From = val +} + +// SetTo sets the value of To. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) SetTo(val BlockRaw) { + s.To = val +} + +// SetDestProof sets the value of DestProof. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) SetDestProof(val string) { + s.DestProof = val +} + +// SetProof sets the value of Proof. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) SetProof(val string) { + s.Proof = val +} + +// SetStateProof sets the value of StateProof. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkBack) SetStateProof(val string) { + s.StateProof = val +} + +type GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward struct { + ToKeyBlock bool `json:"to_key_block"` + From BlockRaw `json:"from"` + To BlockRaw `json:"to"` + DestProof string `json:"dest_proof"` + ConfigProof string `json:"config_proof"` + Signatures GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures `json:"signatures"` +} + +// GetToKeyBlock returns the value of ToKeyBlock. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) GetToKeyBlock() bool { + return s.ToKeyBlock +} + +// GetFrom returns the value of From. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) GetFrom() BlockRaw { + return s.From +} + +// GetTo returns the value of To. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) GetTo() BlockRaw { + return s.To +} + +// GetDestProof returns the value of DestProof. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) GetDestProof() string { + return s.DestProof +} + +// GetConfigProof returns the value of ConfigProof. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) GetConfigProof() string { + return s.ConfigProof +} + +// GetSignatures returns the value of Signatures. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) GetSignatures() GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures { + return s.Signatures +} + +// SetToKeyBlock sets the value of ToKeyBlock. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) SetToKeyBlock(val bool) { + s.ToKeyBlock = val +} + +// SetFrom sets the value of From. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) SetFrom(val BlockRaw) { + s.From = val +} + +// SetTo sets the value of To. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) SetTo(val BlockRaw) { + s.To = val +} + +// SetDestProof sets the value of DestProof. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) SetDestProof(val string) { + s.DestProof = val +} + +// SetConfigProof sets the value of ConfigProof. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) SetConfigProof(val string) { + s.ConfigProof = val +} + +// SetSignatures sets the value of Signatures. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) SetSignatures(val GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) { + s.Signatures = val +} + +type GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures struct { + ValidatorSetHash uint32 `json:"validator_set_hash"` + CatchainSeqno uint32 `json:"catchain_seqno"` + Signatures []GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem `json:"signatures"` +} + +// GetValidatorSetHash returns the value of ValidatorSetHash. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) GetValidatorSetHash() uint32 { + return s.ValidatorSetHash +} + +// GetCatchainSeqno returns the value of CatchainSeqno. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) GetCatchainSeqno() uint32 { + return s.CatchainSeqno +} + +// GetSignatures returns the value of Signatures. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) GetSignatures() []GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem { + return s.Signatures +} + +// SetValidatorSetHash sets the value of ValidatorSetHash. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) SetValidatorSetHash(val uint32) { + s.ValidatorSetHash = val +} + +// SetCatchainSeqno sets the value of CatchainSeqno. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) SetCatchainSeqno(val uint32) { + s.CatchainSeqno = val +} + +// SetSignatures sets the value of Signatures. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) SetSignatures(val []GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem) { + s.Signatures = val +} + +type GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem struct { + NodeIDShort string `json:"node_id_short"` + Signature string `json:"signature"` +} + +// GetNodeIDShort returns the value of NodeIDShort. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem) GetNodeIDShort() string { + return s.NodeIDShort +} + +// GetSignature returns the value of Signature. +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem) GetSignature() string { + return s.Signature +} + +// SetNodeIDShort sets the value of NodeIDShort. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem) SetNodeIDShort(val string) { + s.NodeIDShort = val +} + +// SetSignature sets the value of Signature. +func (s *GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignaturesSignaturesItem) SetSignature(val string) { + s.Signature = val +} + +type GetConfigAllLiteServerOK struct { + Mode uint32 `json:"mode"` + ID BlockRaw `json:"id"` + StateProof string `json:"state_proof"` + ConfigProof string `json:"config_proof"` +} + +// GetMode returns the value of Mode. +func (s GetConfigAllLiteServerOK) GetMode() uint32 { + return s.Mode +} + +// GetID returns the value of ID. +func (s GetConfigAllLiteServerOK) GetID() BlockRaw { + return s.ID +} + +// GetStateProof returns the value of StateProof. +func (s GetConfigAllLiteServerOK) GetStateProof() string { + return s.StateProof +} + +// GetConfigProof returns the value of ConfigProof. +func (s GetConfigAllLiteServerOK) GetConfigProof() string { + return s.ConfigProof +} + +// SetMode sets the value of Mode. +func (s *GetConfigAllLiteServerOK) SetMode(val uint32) { + s.Mode = val +} + +// SetID sets the value of ID. +func (s *GetConfigAllLiteServerOK) SetID(val BlockRaw) { + s.ID = val +} + +// SetStateProof sets the value of StateProof. +func (s *GetConfigAllLiteServerOK) SetStateProof(val string) { + s.StateProof = val +} + +// SetConfigProof sets the value of ConfigProof. +func (s *GetConfigAllLiteServerOK) SetConfigProof(val string) { + s.ConfigProof = val +} + +func (*GetConfigAllLiteServerOK) getConfigAllLiteServerRes() {} + +type GetListBlockTransactionsLiteServerOK struct { + ID BlockRaw `json:"id"` + ReqCount uint32 `json:"req_count"` + Incomplete bool `json:"incomplete"` + Ids []GetListBlockTransactionsLiteServerOKIdsItem `json:"ids"` + Proof string `json:"proof"` +} + +// GetID returns the value of ID. +func (s GetListBlockTransactionsLiteServerOK) GetID() BlockRaw { + return s.ID +} + +// GetReqCount returns the value of ReqCount. +func (s GetListBlockTransactionsLiteServerOK) GetReqCount() uint32 { + return s.ReqCount +} + +// GetIncomplete returns the value of Incomplete. +func (s GetListBlockTransactionsLiteServerOK) GetIncomplete() bool { + return s.Incomplete +} + +// GetIds returns the value of Ids. +func (s GetListBlockTransactionsLiteServerOK) GetIds() []GetListBlockTransactionsLiteServerOKIdsItem { + return s.Ids +} + +// GetProof returns the value of Proof. +func (s GetListBlockTransactionsLiteServerOK) GetProof() string { + return s.Proof +} + +// SetID sets the value of ID. +func (s *GetListBlockTransactionsLiteServerOK) SetID(val BlockRaw) { + s.ID = val +} + +// SetReqCount sets the value of ReqCount. +func (s *GetListBlockTransactionsLiteServerOK) SetReqCount(val uint32) { + s.ReqCount = val +} + +// SetIncomplete sets the value of Incomplete. +func (s *GetListBlockTransactionsLiteServerOK) SetIncomplete(val bool) { + s.Incomplete = val +} + +// SetIds sets the value of Ids. +func (s *GetListBlockTransactionsLiteServerOK) SetIds(val []GetListBlockTransactionsLiteServerOKIdsItem) { + s.Ids = val +} + +// SetProof sets the value of Proof. +func (s *GetListBlockTransactionsLiteServerOK) SetProof(val string) { + s.Proof = val +} + +func (*GetListBlockTransactionsLiteServerOK) getListBlockTransactionsLiteServerRes() {} + +type GetListBlockTransactionsLiteServerOKIdsItem struct { + Mode uint32 `json:"mode"` + Account OptString `json:"account"` + Lt OptUint64 `json:"lt"` + Hash OptString `json:"hash"` +} + +// GetMode returns the value of Mode. +func (s GetListBlockTransactionsLiteServerOKIdsItem) GetMode() uint32 { + return s.Mode +} + +// GetAccount returns the value of Account. +func (s GetListBlockTransactionsLiteServerOKIdsItem) GetAccount() OptString { + return s.Account +} + +// GetLt returns the value of Lt. +func (s GetListBlockTransactionsLiteServerOKIdsItem) GetLt() OptUint64 { + return s.Lt +} + +// GetHash returns the value of Hash. +func (s GetListBlockTransactionsLiteServerOKIdsItem) GetHash() OptString { + return s.Hash +} + +// SetMode sets the value of Mode. +func (s *GetListBlockTransactionsLiteServerOKIdsItem) SetMode(val uint32) { + s.Mode = val +} + +// SetAccount sets the value of Account. +func (s *GetListBlockTransactionsLiteServerOKIdsItem) SetAccount(val OptString) { + s.Account = val +} + +// SetLt sets the value of Lt. +func (s *GetListBlockTransactionsLiteServerOKIdsItem) SetLt(val OptUint64) { + s.Lt = val +} + +// SetHash sets the value of Hash. +func (s *GetListBlockTransactionsLiteServerOKIdsItem) SetHash(val OptString) { + s.Hash = val +} + +type GetMasterchainInfoExtLiteServerOK struct { + Mode uint32 `json:"mode"` + Version uint32 `json:"version"` + Capabilities uint64 `json:"capabilities"` + Last BlockRaw `json:"last"` + LastUtime uint32 `json:"last_utime"` + Now uint32 `json:"now"` + StateRootHash string `json:"state_root_hash"` + Init InitStateRaw `json:"init"` +} + +// GetMode returns the value of Mode. +func (s GetMasterchainInfoExtLiteServerOK) GetMode() uint32 { + return s.Mode +} + +// GetVersion returns the value of Version. +func (s GetMasterchainInfoExtLiteServerOK) GetVersion() uint32 { + return s.Version +} + +// GetCapabilities returns the value of Capabilities. +func (s GetMasterchainInfoExtLiteServerOK) GetCapabilities() uint64 { + return s.Capabilities } -// SetIsScam sets the value of IsScam. -func (s *Event) SetIsScam(val bool) { - s.IsScam = val +// GetLast returns the value of Last. +func (s GetMasterchainInfoExtLiteServerOK) GetLast() BlockRaw { + return s.Last } -// SetLt sets the value of Lt. -func (s *Event) SetLt(val int64) { - s.Lt = val +// GetLastUtime returns the value of LastUtime. +func (s GetMasterchainInfoExtLiteServerOK) GetLastUtime() uint32 { + return s.LastUtime } -// SetInProgress sets the value of InProgress. -func (s *Event) SetInProgress(val bool) { - s.InProgress = val +// GetNow returns the value of Now. +func (s GetMasterchainInfoExtLiteServerOK) GetNow() uint32 { + return s.Now } -func (*Event) emulateMessageToEventRes() {} -func (*Event) getEventRes() {} +// GetStateRootHash returns the value of StateRootHash. +func (s GetMasterchainInfoExtLiteServerOK) GetStateRootHash() string { + return s.StateRootHash +} -// Ref: #/components/schemas/FoundAccounts -type FoundAccounts struct { - Addresses []FoundAccountsAddressesItem `json:"addresses"` +// GetInit returns the value of Init. +func (s GetMasterchainInfoExtLiteServerOK) GetInit() InitStateRaw { + return s.Init } -// GetAddresses returns the value of Addresses. -func (s FoundAccounts) GetAddresses() []FoundAccountsAddressesItem { - return s.Addresses +// SetMode sets the value of Mode. +func (s *GetMasterchainInfoExtLiteServerOK) SetMode(val uint32) { + s.Mode = val } -// SetAddresses sets the value of Addresses. -func (s *FoundAccounts) SetAddresses(val []FoundAccountsAddressesItem) { - s.Addresses = val +// SetVersion sets the value of Version. +func (s *GetMasterchainInfoExtLiteServerOK) SetVersion(val uint32) { + s.Version = val } -func (*FoundAccounts) getSearchAccountsRes() {} +// SetCapabilities sets the value of Capabilities. +func (s *GetMasterchainInfoExtLiteServerOK) SetCapabilities(val uint64) { + s.Capabilities = val +} -type FoundAccountsAddressesItem struct { - Address string `json:"address"` - Name string `json:"name"` +// SetLast sets the value of Last. +func (s *GetMasterchainInfoExtLiteServerOK) SetLast(val BlockRaw) { + s.Last = val } -// GetAddress returns the value of Address. -func (s FoundAccountsAddressesItem) GetAddress() string { - return s.Address +// SetLastUtime sets the value of LastUtime. +func (s *GetMasterchainInfoExtLiteServerOK) SetLastUtime(val uint32) { + s.LastUtime = val } -// GetName returns the value of Name. -func (s FoundAccountsAddressesItem) GetName() string { - return s.Name +// SetNow sets the value of Now. +func (s *GetMasterchainInfoExtLiteServerOK) SetNow(val uint32) { + s.Now = val } -// SetAddress sets the value of Address. -func (s *FoundAccountsAddressesItem) SetAddress(val string) { - s.Address = val +// SetStateRootHash sets the value of StateRootHash. +func (s *GetMasterchainInfoExtLiteServerOK) SetStateRootHash(val string) { + s.StateRootHash = val } -// SetName sets the value of Name. -func (s *FoundAccountsAddressesItem) SetName(val string) { - s.Name = val +// SetInit sets the value of Init. +func (s *GetMasterchainInfoExtLiteServerOK) SetInit(val InitStateRaw) { + s.Init = val } -type GetAccountInfoByStateInitReq struct { - StateInit string `json:"state_init"` +func (*GetMasterchainInfoExtLiteServerOK) getMasterchainInfoExtLiteServerRes() {} + +type GetMasterchainInfoLiteServerOK struct { + Last BlockRaw `json:"last"` + StateRootHash string `json:"state_root_hash"` + Init InitStateRaw `json:"init"` } -// GetStateInit returns the value of StateInit. -func (s GetAccountInfoByStateInitReq) GetStateInit() string { - return s.StateInit +// GetLast returns the value of Last. +func (s GetMasterchainInfoLiteServerOK) GetLast() BlockRaw { + return s.Last } -// SetStateInit sets the value of StateInit. -func (s *GetAccountInfoByStateInitReq) SetStateInit(val string) { - s.StateInit = val +// GetStateRootHash returns the value of StateRootHash. +func (s GetMasterchainInfoLiteServerOK) GetStateRootHash() string { + return s.StateRootHash } -type GetAccountsReq struct { - AccountIds []string `json:"account_ids"` +// GetInit returns the value of Init. +func (s GetMasterchainInfoLiteServerOK) GetInit() InitStateRaw { + return s.Init } -// GetAccountIds returns the value of AccountIds. -func (s GetAccountsReq) GetAccountIds() []string { - return s.AccountIds +// SetLast sets the value of Last. +func (s *GetMasterchainInfoLiteServerOK) SetLast(val BlockRaw) { + s.Last = val } -// SetAccountIds sets the value of AccountIds. -func (s *GetAccountsReq) SetAccountIds(val []string) { - s.AccountIds = val +// SetStateRootHash sets the value of StateRootHash. +func (s *GetMasterchainInfoLiteServerOK) SetStateRootHash(val string) { + s.StateRootHash = val +} + +// SetInit sets the value of Init. +func (s *GetMasterchainInfoLiteServerOK) SetInit(val InitStateRaw) { + s.Init = val } +func (*GetMasterchainInfoLiteServerOK) getMasterchainInfoLiteServerRes() {} + type GetNftItemsByAddressesReq struct { AccountIds []string `json:"account_ids"` } @@ -2199,6 +2996,156 @@ func (s *GetRatesOK) SetRates(val jx.Raw) { func (*GetRatesOK) getRatesRes() {} +type GetShardBlockProofLiteServerOK struct { + MasterchainID BlockRaw `json:"masterchain_id"` + Links []GetShardBlockProofLiteServerOKLinksItem `json:"links"` +} + +// GetMasterchainID returns the value of MasterchainID. +func (s GetShardBlockProofLiteServerOK) GetMasterchainID() BlockRaw { + return s.MasterchainID +} + +// GetLinks returns the value of Links. +func (s GetShardBlockProofLiteServerOK) GetLinks() []GetShardBlockProofLiteServerOKLinksItem { + return s.Links +} + +// SetMasterchainID sets the value of MasterchainID. +func (s *GetShardBlockProofLiteServerOK) SetMasterchainID(val BlockRaw) { + s.MasterchainID = val +} + +// SetLinks sets the value of Links. +func (s *GetShardBlockProofLiteServerOK) SetLinks(val []GetShardBlockProofLiteServerOKLinksItem) { + s.Links = val +} + +func (*GetShardBlockProofLiteServerOK) getShardBlockProofLiteServerRes() {} + +type GetShardBlockProofLiteServerOKLinksItem struct { + ID BlockRaw `json:"id"` + Proof string `json:"proof"` +} + +// GetID returns the value of ID. +func (s GetShardBlockProofLiteServerOKLinksItem) GetID() BlockRaw { + return s.ID +} + +// GetProof returns the value of Proof. +func (s GetShardBlockProofLiteServerOKLinksItem) GetProof() string { + return s.Proof +} + +// SetID sets the value of ID. +func (s *GetShardBlockProofLiteServerOKLinksItem) SetID(val BlockRaw) { + s.ID = val +} + +// SetProof sets the value of Proof. +func (s *GetShardBlockProofLiteServerOKLinksItem) SetProof(val string) { + s.Proof = val +} + +type GetShardInfoLiteServerOK struct { + ID BlockRaw `json:"id"` + Shardblk BlockRaw `json:"shardblk"` + ShardProof string `json:"shard_proof"` + ShardDescr string `json:"shard_descr"` +} + +// GetID returns the value of ID. +func (s GetShardInfoLiteServerOK) GetID() BlockRaw { + return s.ID +} + +// GetShardblk returns the value of Shardblk. +func (s GetShardInfoLiteServerOK) GetShardblk() BlockRaw { + return s.Shardblk +} + +// GetShardProof returns the value of ShardProof. +func (s GetShardInfoLiteServerOK) GetShardProof() string { + return s.ShardProof +} + +// GetShardDescr returns the value of ShardDescr. +func (s GetShardInfoLiteServerOK) GetShardDescr() string { + return s.ShardDescr +} + +// SetID sets the value of ID. +func (s *GetShardInfoLiteServerOK) SetID(val BlockRaw) { + s.ID = val +} + +// SetShardblk sets the value of Shardblk. +func (s *GetShardInfoLiteServerOK) SetShardblk(val BlockRaw) { + s.Shardblk = val +} + +// SetShardProof sets the value of ShardProof. +func (s *GetShardInfoLiteServerOK) SetShardProof(val string) { + s.ShardProof = val +} + +// SetShardDescr sets the value of ShardDescr. +func (s *GetShardInfoLiteServerOK) SetShardDescr(val string) { + s.ShardDescr = val +} + +func (*GetShardInfoLiteServerOK) getShardInfoLiteServerRes() {} + +type GetStateLiteServerOK struct { + ID BlockRaw `json:"id"` + RootHash string `json:"root_hash"` + FileHash string `json:"file_hash"` + Data string `json:"data"` +} + +// GetID returns the value of ID. +func (s GetStateLiteServerOK) GetID() BlockRaw { + return s.ID +} + +// GetRootHash returns the value of RootHash. +func (s GetStateLiteServerOK) GetRootHash() string { + return s.RootHash +} + +// GetFileHash returns the value of FileHash. +func (s GetStateLiteServerOK) GetFileHash() string { + return s.FileHash +} + +// GetData returns the value of Data. +func (s GetStateLiteServerOK) GetData() string { + return s.Data +} + +// SetID sets the value of ID. +func (s *GetStateLiteServerOK) SetID(val BlockRaw) { + s.ID = val +} + +// SetRootHash sets the value of RootHash. +func (s *GetStateLiteServerOK) SetRootHash(val string) { + s.RootHash = val +} + +// SetFileHash sets the value of FileHash. +func (s *GetStateLiteServerOK) SetFileHash(val string) { + s.FileHash = val +} + +// SetData sets the value of Data. +func (s *GetStateLiteServerOK) SetData(val string) { + s.Data = val +} + +func (*GetStateLiteServerOK) getStateLiteServerRes() {} + type GetStorageProvidersOK struct { Providers []StorageProvider `json:"providers"` } @@ -2215,6 +3162,22 @@ func (s *GetStorageProvidersOK) SetProviders(val []StorageProvider) { func (*GetStorageProvidersOK) getStorageProvidersRes() {} +type GetTimeLiteServerOK struct { + Time uint32 `json:"time"` +} + +// GetTime returns the value of Time. +func (s GetTimeLiteServerOK) GetTime() uint32 { + return s.Time +} + +// SetTime sets the value of Time. +func (s *GetTimeLiteServerOK) SetTime(val uint32) { + s.Time = val +} + +func (*GetTimeLiteServerOK) getTimeLiteServerRes() {} + type GetTonConnectPayloadOK struct { Payload string `json:"payload"` } @@ -2231,6 +3194,33 @@ func (s *GetTonConnectPayloadOK) SetPayload(val string) { func (*GetTonConnectPayloadOK) getTonConnectPayloadRes() {} +type GetTransactionsLiteServerOK struct { + Ids []BlockRaw `json:"ids"` + Transactions string `json:"transactions"` +} + +// GetIds returns the value of Ids. +func (s GetTransactionsLiteServerOK) GetIds() []BlockRaw { + return s.Ids +} + +// GetTransactions returns the value of Transactions. +func (s GetTransactionsLiteServerOK) GetTransactions() string { + return s.Transactions +} + +// SetIds sets the value of Ids. +func (s *GetTransactionsLiteServerOK) SetIds(val []BlockRaw) { + s.Ids = val +} + +// SetTransactions sets the value of Transactions. +func (s *GetTransactionsLiteServerOK) SetTransactions(val string) { + s.Transactions = val +} + +func (*GetTransactionsLiteServerOK) getTransactionsLiteServerRes() {} + type GetWalletBackupOK struct { Dump string `json:"dump"` } @@ -2273,6 +3263,43 @@ func (s *ImagePreview) SetURL(val string) { s.URL = val } +// Ref: #/components/schemas/InitStateRaw +type InitStateRaw struct { + Workchain uint32 `json:"workchain"` + RootHash string `json:"root_hash"` + FileHash string `json:"file_hash"` +} + +// GetWorkchain returns the value of Workchain. +func (s InitStateRaw) GetWorkchain() uint32 { + return s.Workchain +} + +// GetRootHash returns the value of RootHash. +func (s InitStateRaw) GetRootHash() string { + return s.RootHash +} + +// GetFileHash returns the value of FileHash. +func (s InitStateRaw) GetFileHash() string { + return s.FileHash +} + +// SetWorkchain sets the value of Workchain. +func (s *InitStateRaw) SetWorkchain(val uint32) { + s.Workchain = val +} + +// SetRootHash sets the value of RootHash. +func (s *InitStateRaw) SetRootHash(val string) { + s.RootHash = val +} + +// SetFileHash sets the value of FileHash. +func (s *InitStateRaw) SetFileHash(val string) { + s.FileHash = val +} + type InternalError struct { Error string `json:"error"` } @@ -2287,61 +3314,76 @@ func (s *InternalError) SetError(val string) { s.Error = val } -func (*InternalError) dnsBackResolveRes() {} -func (*InternalError) dnsInfoRes() {} -func (*InternalError) dnsResolveRes() {} -func (*InternalError) emulateMessageToAccountEventRes() {} -func (*InternalError) emulateMessageToEventRes() {} -func (*InternalError) emulateMessageToTraceRes() {} -func (*InternalError) emulateWalletMessageRes() {} -func (*InternalError) execGetMethodRes() {} -func (*InternalError) getAccountInfoByStateInitRes() {} -func (*InternalError) getAccountRes() {} -func (*InternalError) getAccountSeqnoRes() {} -func (*InternalError) getAccountTransactionsRes() {} -func (*InternalError) getAccountsRes() {} -func (*InternalError) getAllAuctionsRes() {} -func (*InternalError) getBlockRes() {} -func (*InternalError) getBlockTransactionsRes() {} -func (*InternalError) getConfigRes() {} -func (*InternalError) getDnsExpiringRes() {} -func (*InternalError) getDomainBidsRes() {} -func (*InternalError) getEventRes() {} -func (*InternalError) getEventsByAccountRes() {} -func (*InternalError) getItemsFromCollectionRes() {} -func (*InternalError) getJettonInfoRes() {} -func (*InternalError) getJettonsBalancesRes() {} -func (*InternalError) getJettonsHistoryByIDRes() {} -func (*InternalError) getJettonsHistoryRes() {} -func (*InternalError) getJettonsRes() {} -func (*InternalError) getMasterchainHeadRes() {} -func (*InternalError) getNftCollectionRes() {} -func (*InternalError) getNftCollectionsRes() {} -func (*InternalError) getNftItemByAddressRes() {} -func (*InternalError) getNftItemsByAddressesRes() {} -func (*InternalError) getNftItemsByOwnerRes() {} -func (*InternalError) getPublicKeyByAccountIDRes() {} -func (*InternalError) getRatesRes() {} -func (*InternalError) getRawAccountRes() {} -func (*InternalError) getSearchAccountsRes() {} -func (*InternalError) getStorageProvidersRes() {} -func (*InternalError) getSubscriptionsByAccountRes() {} -func (*InternalError) getTonConnectPayloadRes() {} -func (*InternalError) getTraceRes() {} -func (*InternalError) getTracesByAccountRes() {} -func (*InternalError) getTransactionByMessageHashRes() {} -func (*InternalError) getTransactionRes() {} -func (*InternalError) getValidatorsRes() {} -func (*InternalError) getWalletBackupRes() {} -func (*InternalError) getWalletsByPublicKeyRes() {} -func (*InternalError) poolsByNominatorsRes() {} -func (*InternalError) reindexAccountRes() {} -func (*InternalError) sendMessageRes() {} -func (*InternalError) setWalletBackupRes() {} -func (*InternalError) stakingPoolHistoryRes() {} -func (*InternalError) stakingPoolInfoRes() {} -func (*InternalError) stakingPoolsRes() {} -func (*InternalError) tonConnectProofRes() {} +func (*InternalError) dnsBackResolveRes() {} +func (*InternalError) dnsInfoRes() {} +func (*InternalError) dnsResolveRes() {} +func (*InternalError) emulateMessageToAccountEventRes() {} +func (*InternalError) emulateMessageToEventRes() {} +func (*InternalError) emulateMessageToTraceRes() {} +func (*InternalError) emulateWalletMessageRes() {} +func (*InternalError) execGetMethodRes() {} +func (*InternalError) getAccountInfoByStateInitRes() {} +func (*InternalError) getAccountRes() {} +func (*InternalError) getAccountSeqnoRes() {} +func (*InternalError) getAccountStateLiteServerRes() {} +func (*InternalError) getAccountTransactionsRes() {} +func (*InternalError) getAccountsRes() {} +func (*InternalError) getAllAuctionsRes() {} +func (*InternalError) getAllShardsInfoLiteServerRes() {} +func (*InternalError) getBlockHeaderLiteServerRes() {} +func (*InternalError) getBlockLiteServerRes() {} +func (*InternalError) getBlockProofLiteServerRes() {} +func (*InternalError) getBlockRes() {} +func (*InternalError) getBlockTransactionsRes() {} +func (*InternalError) getConfigAllLiteServerRes() {} +func (*InternalError) getConfigRes() {} +func (*InternalError) getDnsExpiringRes() {} +func (*InternalError) getDomainBidsRes() {} +func (*InternalError) getEventRes() {} +func (*InternalError) getEventsByAccountRes() {} +func (*InternalError) getItemsFromCollectionRes() {} +func (*InternalError) getJettonInfoRes() {} +func (*InternalError) getJettonsBalancesRes() {} +func (*InternalError) getJettonsHistoryByIDRes() {} +func (*InternalError) getJettonsHistoryRes() {} +func (*InternalError) getJettonsRes() {} +func (*InternalError) getListBlockTransactionsLiteServerRes() {} +func (*InternalError) getMasterchainHeadRes() {} +func (*InternalError) getMasterchainInfoExtLiteServerRes() {} +func (*InternalError) getMasterchainInfoLiteServerRes() {} +func (*InternalError) getNftCollectionRes() {} +func (*InternalError) getNftCollectionsRes() {} +func (*InternalError) getNftItemByAddressRes() {} +func (*InternalError) getNftItemsByAddressesRes() {} +func (*InternalError) getNftItemsByOwnerRes() {} +func (*InternalError) getPublicKeyByAccountIDRes() {} +func (*InternalError) getRatesRes() {} +func (*InternalError) getRawAccountRes() {} +func (*InternalError) getSearchAccountsRes() {} +func (*InternalError) getShardBlockProofLiteServerRes() {} +func (*InternalError) getShardInfoLiteServerRes() {} +func (*InternalError) getStateLiteServerRes() {} +func (*InternalError) getStorageProvidersRes() {} +func (*InternalError) getSubscriptionsByAccountRes() {} +func (*InternalError) getTimeLiteServerRes() {} +func (*InternalError) getTonConnectPayloadRes() {} +func (*InternalError) getTraceRes() {} +func (*InternalError) getTracesByAccountRes() {} +func (*InternalError) getTransactionByMessageHashRes() {} +func (*InternalError) getTransactionRes() {} +func (*InternalError) getTransactionsLiteServerRes() {} +func (*InternalError) getValidatorsRes() {} +func (*InternalError) getWalletBackupRes() {} +func (*InternalError) getWalletsByPublicKeyRes() {} +func (*InternalError) poolsByNominatorsRes() {} +func (*InternalError) reindexAccountRes() {} +func (*InternalError) sendMessageLiteServerRes() {} +func (*InternalError) sendMessageRes() {} +func (*InternalError) setWalletBackupRes() {} +func (*InternalError) stakingPoolHistoryRes() {} +func (*InternalError) stakingPoolInfoRes() {} +func (*InternalError) stakingPoolsRes() {} +func (*InternalError) tonConnectProofRes() {} // Ref: #/components/schemas/JettonBalance type JettonBalance struct { @@ -5062,6 +6104,52 @@ func (o OptUint32) Or(d uint32) uint32 { return d } +// NewOptUint64 returns new OptUint64 with value set to v. +func NewOptUint64(v uint64) OptUint64 { + return OptUint64{ + Value: v, + Set: true, + } +} + +// OptUint64 is optional uint64. +type OptUint64 struct { + Value uint64 + Set bool +} + +// IsSet returns true if OptUint64 was set. +func (o OptUint64) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptUint64) Reset() { + var v uint64 + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptUint64) SetTo(v uint64) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptUint64) Get() (v uint64, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptUint64) Or(d uint64) uint64 { + if v, ok := o.Get(); ok { + return v + } + return d +} + // NewOptUnSubscriptionAction returns new OptUnSubscriptionAction with value set to v. func NewOptUnSubscriptionAction(v UnSubscriptionAction) OptUnSubscriptionAction { return OptUnSubscriptionAction{ @@ -5775,6 +6863,36 @@ func (s *Sale) SetPrice(val Price) { s.Price = val } +type SendMessageLiteServerOK struct { + Code uint32 `json:"code"` +} + +// GetCode returns the value of Code. +func (s SendMessageLiteServerOK) GetCode() uint32 { + return s.Code +} + +// SetCode sets the value of Code. +func (s *SendMessageLiteServerOK) SetCode(val uint32) { + s.Code = val +} + +func (*SendMessageLiteServerOK) sendMessageLiteServerRes() {} + +type SendMessageLiteServerReq struct { + Body string `json:"body"` +} + +// GetBody returns the value of Body. +func (s SendMessageLiteServerReq) GetBody() string { + return s.Body +} + +// SetBody sets the value of Body. +func (s *SendMessageLiteServerReq) SetBody(val string) { + s.Body = val +} + // SendMessageOK is response for SendMessage operation. type SendMessageOK struct{} @@ -6980,61 +8098,76 @@ func (s *UnauthorizedError) SetError(val string) { s.Error = val } -func (*UnauthorizedError) dnsBackResolveRes() {} -func (*UnauthorizedError) dnsInfoRes() {} -func (*UnauthorizedError) dnsResolveRes() {} -func (*UnauthorizedError) emulateMessageToAccountEventRes() {} -func (*UnauthorizedError) emulateMessageToEventRes() {} -func (*UnauthorizedError) emulateMessageToTraceRes() {} -func (*UnauthorizedError) emulateWalletMessageRes() {} -func (*UnauthorizedError) execGetMethodRes() {} -func (*UnauthorizedError) getAccountInfoByStateInitRes() {} -func (*UnauthorizedError) getAccountRes() {} -func (*UnauthorizedError) getAccountSeqnoRes() {} -func (*UnauthorizedError) getAccountTransactionsRes() {} -func (*UnauthorizedError) getAccountsRes() {} -func (*UnauthorizedError) getAllAuctionsRes() {} -func (*UnauthorizedError) getBlockRes() {} -func (*UnauthorizedError) getBlockTransactionsRes() {} -func (*UnauthorizedError) getConfigRes() {} -func (*UnauthorizedError) getDnsExpiringRes() {} -func (*UnauthorizedError) getDomainBidsRes() {} -func (*UnauthorizedError) getEventRes() {} -func (*UnauthorizedError) getEventsByAccountRes() {} -func (*UnauthorizedError) getItemsFromCollectionRes() {} -func (*UnauthorizedError) getJettonInfoRes() {} -func (*UnauthorizedError) getJettonsBalancesRes() {} -func (*UnauthorizedError) getJettonsHistoryByIDRes() {} -func (*UnauthorizedError) getJettonsHistoryRes() {} -func (*UnauthorizedError) getJettonsRes() {} -func (*UnauthorizedError) getMasterchainHeadRes() {} -func (*UnauthorizedError) getNftCollectionRes() {} -func (*UnauthorizedError) getNftCollectionsRes() {} -func (*UnauthorizedError) getNftItemByAddressRes() {} -func (*UnauthorizedError) getNftItemsByAddressesRes() {} -func (*UnauthorizedError) getNftItemsByOwnerRes() {} -func (*UnauthorizedError) getPublicKeyByAccountIDRes() {} -func (*UnauthorizedError) getRatesRes() {} -func (*UnauthorizedError) getRawAccountRes() {} -func (*UnauthorizedError) getSearchAccountsRes() {} -func (*UnauthorizedError) getStorageProvidersRes() {} -func (*UnauthorizedError) getSubscriptionsByAccountRes() {} -func (*UnauthorizedError) getTonConnectPayloadRes() {} -func (*UnauthorizedError) getTraceRes() {} -func (*UnauthorizedError) getTracesByAccountRes() {} -func (*UnauthorizedError) getTransactionByMessageHashRes() {} -func (*UnauthorizedError) getTransactionRes() {} -func (*UnauthorizedError) getValidatorsRes() {} -func (*UnauthorizedError) getWalletBackupRes() {} -func (*UnauthorizedError) getWalletsByPublicKeyRes() {} -func (*UnauthorizedError) poolsByNominatorsRes() {} -func (*UnauthorizedError) reindexAccountRes() {} -func (*UnauthorizedError) sendMessageRes() {} -func (*UnauthorizedError) setWalletBackupRes() {} -func (*UnauthorizedError) stakingPoolHistoryRes() {} -func (*UnauthorizedError) stakingPoolInfoRes() {} -func (*UnauthorizedError) stakingPoolsRes() {} -func (*UnauthorizedError) tonConnectProofRes() {} +func (*UnauthorizedError) dnsBackResolveRes() {} +func (*UnauthorizedError) dnsInfoRes() {} +func (*UnauthorizedError) dnsResolveRes() {} +func (*UnauthorizedError) emulateMessageToAccountEventRes() {} +func (*UnauthorizedError) emulateMessageToEventRes() {} +func (*UnauthorizedError) emulateMessageToTraceRes() {} +func (*UnauthorizedError) emulateWalletMessageRes() {} +func (*UnauthorizedError) execGetMethodRes() {} +func (*UnauthorizedError) getAccountInfoByStateInitRes() {} +func (*UnauthorizedError) getAccountRes() {} +func (*UnauthorizedError) getAccountSeqnoRes() {} +func (*UnauthorizedError) getAccountStateLiteServerRes() {} +func (*UnauthorizedError) getAccountTransactionsRes() {} +func (*UnauthorizedError) getAccountsRes() {} +func (*UnauthorizedError) getAllAuctionsRes() {} +func (*UnauthorizedError) getAllShardsInfoLiteServerRes() {} +func (*UnauthorizedError) getBlockHeaderLiteServerRes() {} +func (*UnauthorizedError) getBlockLiteServerRes() {} +func (*UnauthorizedError) getBlockProofLiteServerRes() {} +func (*UnauthorizedError) getBlockRes() {} +func (*UnauthorizedError) getBlockTransactionsRes() {} +func (*UnauthorizedError) getConfigAllLiteServerRes() {} +func (*UnauthorizedError) getConfigRes() {} +func (*UnauthorizedError) getDnsExpiringRes() {} +func (*UnauthorizedError) getDomainBidsRes() {} +func (*UnauthorizedError) getEventRes() {} +func (*UnauthorizedError) getEventsByAccountRes() {} +func (*UnauthorizedError) getItemsFromCollectionRes() {} +func (*UnauthorizedError) getJettonInfoRes() {} +func (*UnauthorizedError) getJettonsBalancesRes() {} +func (*UnauthorizedError) getJettonsHistoryByIDRes() {} +func (*UnauthorizedError) getJettonsHistoryRes() {} +func (*UnauthorizedError) getJettonsRes() {} +func (*UnauthorizedError) getListBlockTransactionsLiteServerRes() {} +func (*UnauthorizedError) getMasterchainHeadRes() {} +func (*UnauthorizedError) getMasterchainInfoExtLiteServerRes() {} +func (*UnauthorizedError) getMasterchainInfoLiteServerRes() {} +func (*UnauthorizedError) getNftCollectionRes() {} +func (*UnauthorizedError) getNftCollectionsRes() {} +func (*UnauthorizedError) getNftItemByAddressRes() {} +func (*UnauthorizedError) getNftItemsByAddressesRes() {} +func (*UnauthorizedError) getNftItemsByOwnerRes() {} +func (*UnauthorizedError) getPublicKeyByAccountIDRes() {} +func (*UnauthorizedError) getRatesRes() {} +func (*UnauthorizedError) getRawAccountRes() {} +func (*UnauthorizedError) getSearchAccountsRes() {} +func (*UnauthorizedError) getShardBlockProofLiteServerRes() {} +func (*UnauthorizedError) getShardInfoLiteServerRes() {} +func (*UnauthorizedError) getStateLiteServerRes() {} +func (*UnauthorizedError) getStorageProvidersRes() {} +func (*UnauthorizedError) getSubscriptionsByAccountRes() {} +func (*UnauthorizedError) getTimeLiteServerRes() {} +func (*UnauthorizedError) getTonConnectPayloadRes() {} +func (*UnauthorizedError) getTraceRes() {} +func (*UnauthorizedError) getTracesByAccountRes() {} +func (*UnauthorizedError) getTransactionByMessageHashRes() {} +func (*UnauthorizedError) getTransactionRes() {} +func (*UnauthorizedError) getTransactionsLiteServerRes() {} +func (*UnauthorizedError) getValidatorsRes() {} +func (*UnauthorizedError) getWalletBackupRes() {} +func (*UnauthorizedError) getWalletsByPublicKeyRes() {} +func (*UnauthorizedError) poolsByNominatorsRes() {} +func (*UnauthorizedError) reindexAccountRes() {} +func (*UnauthorizedError) sendMessageLiteServerRes() {} +func (*UnauthorizedError) sendMessageRes() {} +func (*UnauthorizedError) setWalletBackupRes() {} +func (*UnauthorizedError) stakingPoolHistoryRes() {} +func (*UnauthorizedError) stakingPoolInfoRes() {} +func (*UnauthorizedError) stakingPoolsRes() {} +func (*UnauthorizedError) tonConnectProofRes() {} // Ref: #/components/schemas/Validator type Validator struct { diff --git a/pkg/oas/oas_server_gen.go b/pkg/oas/oas_server_gen.go index 790d395f..20fcbd10 100644 --- a/pkg/oas/oas_server_gen.go +++ b/pkg/oas/oas_server_gen.go @@ -74,6 +74,12 @@ type Handler interface { // // GET /v2/wallet/{account_id}/seqno GetAccountSeqno(ctx context.Context, params GetAccountSeqnoParams) (GetAccountSeqnoRes, error) + // GetAccountStateLiteServer implements getAccountStateLiteServer operation. + // + // Get account state. + // + // GET /v2/liteserver/get_account_state/{account_id} + GetAccountStateLiteServer(ctx context.Context, params GetAccountStateLiteServerParams) (GetAccountStateLiteServerRes, error) // GetAccountTransactions implements getAccountTransactions operation. // // Get account transactions. @@ -92,12 +98,36 @@ type Handler interface { // // GET /v2/dns/auctions GetAllAuctions(ctx context.Context, params GetAllAuctionsParams) (GetAllAuctionsRes, error) + // GetAllShardsInfoLiteServer implements getAllShardsInfoLiteServer operation. + // + // Get all shards info. + // + // GET /v2/liteserver/get_all_shards_info/{block_id} + GetAllShardsInfoLiteServer(ctx context.Context, params GetAllShardsInfoLiteServerParams) (GetAllShardsInfoLiteServerRes, error) // GetBlock implements getBlock operation. // // Get block data. // // GET /v2/blockchain/blocks/{block_id} GetBlock(ctx context.Context, params GetBlockParams) (GetBlockRes, error) + // GetBlockHeaderLiteServer implements getBlockHeaderLiteServer operation. + // + // Get block header. + // + // GET /v2/liteserver/get_block_header/{block_id} + GetBlockHeaderLiteServer(ctx context.Context, params GetBlockHeaderLiteServerParams) (GetBlockHeaderLiteServerRes, error) + // GetBlockLiteServer implements getBlockLiteServer operation. + // + // Get block. + // + // GET /v2/liteserver/get_block/{block_id} + GetBlockLiteServer(ctx context.Context, params GetBlockLiteServerParams) (GetBlockLiteServerRes, error) + // GetBlockProofLiteServer implements getBlockProofLiteServer operation. + // + // Get block proof. + // + // GET /v2/liteserver/get_block_proof + GetBlockProofLiteServer(ctx context.Context, params GetBlockProofLiteServerParams) (GetBlockProofLiteServerRes, error) // GetBlockTransactions implements getBlockTransactions operation. // // Get transactions from block. @@ -110,6 +140,12 @@ type Handler interface { // // GET /v2/blockchain/config GetConfig(ctx context.Context) (GetConfigRes, error) + // GetConfigAllLiteServer implements getConfigAllLiteServer operation. + // + // Get config all. + // + // GET /v2/liteserver/get_config_all/{block_id} + GetConfigAllLiteServer(ctx context.Context, params GetConfigAllLiteServerParams) (GetConfigAllLiteServerRes, error) // GetDnsExpiring implements getDnsExpiring operation. // // Get expiring .ton dns. @@ -179,12 +215,30 @@ type Handler interface { // // GET /v2/accounts/{account_id}/jettons/{jetton_id}/history GetJettonsHistoryByID(ctx context.Context, params GetJettonsHistoryByIDParams) (GetJettonsHistoryByIDRes, error) + // GetListBlockTransactionsLiteServer implements getListBlockTransactionsLiteServer operation. + // + // Get list block transactions. + // + // GET /v2/liteserver/list_block_transactions/{block_id} + GetListBlockTransactionsLiteServer(ctx context.Context, params GetListBlockTransactionsLiteServerParams) (GetListBlockTransactionsLiteServerRes, error) // GetMasterchainHead implements getMasterchainHead operation. // // Get last known masterchain block. // // GET /v2/blockchain/masterchain-head GetMasterchainHead(ctx context.Context) (GetMasterchainHeadRes, error) + // GetMasterchainInfoExtLiteServer implements getMasterchainInfoExtLiteServer operation. + // + // Get masterchain info ext. + // + // GET /v2/liteserver/get_masterchain_info_ext + GetMasterchainInfoExtLiteServer(ctx context.Context, params GetMasterchainInfoExtLiteServerParams) (GetMasterchainInfoExtLiteServerRes, error) + // GetMasterchainInfoLiteServer implements getMasterchainInfoLiteServer operation. + // + // Get masterchain info. + // + // GET /v2/liteserver/get_masterchain_info + GetMasterchainInfoLiteServer(ctx context.Context) (GetMasterchainInfoLiteServerRes, error) // GetNftCollection implements getNftCollection operation. // // Get NFT collection by collection address. @@ -239,6 +293,24 @@ type Handler interface { // // GET /v2/accounts/search GetSearchAccounts(ctx context.Context, params GetSearchAccountsParams) (GetSearchAccountsRes, error) + // GetShardBlockProofLiteServer implements getShardBlockProofLiteServer operation. + // + // Get shard block proof. + // + // GET /v2/liteserver/get_shard_block_proof/{block_id} + GetShardBlockProofLiteServer(ctx context.Context, params GetShardBlockProofLiteServerParams) (GetShardBlockProofLiteServerRes, error) + // GetShardInfoLiteServer implements getShardInfoLiteServer operation. + // + // Get shard info. + // + // GET /v2/liteserver/get_shard_info/{block_id} + GetShardInfoLiteServer(ctx context.Context, params GetShardInfoLiteServerParams) (GetShardInfoLiteServerRes, error) + // GetStateLiteServer implements getStateLiteServer operation. + // + // Get block state. + // + // GET /v2/liteserver/get_state/{block_id} + GetStateLiteServer(ctx context.Context, params GetStateLiteServerParams) (GetStateLiteServerRes, error) // GetStorageProviders implements getStorageProviders operation. // // Get TON storage providers deployed to the blockchain. @@ -251,6 +323,12 @@ type Handler interface { // // GET /v2/accounts/{account_id}/subscriptions GetSubscriptionsByAccount(ctx context.Context, params GetSubscriptionsByAccountParams) (GetSubscriptionsByAccountRes, error) + // GetTimeLiteServer implements getTimeLiteServer operation. + // + // Get time. + // + // GET /v2/liteserver/get_time + GetTimeLiteServer(ctx context.Context) (GetTimeLiteServerRes, error) // GetTonConnectPayload implements getTonConnectPayload operation. // // Get a payload for further token receipt. @@ -281,6 +359,12 @@ type Handler interface { // // GET /v2/blockchain/messages/{msg_id}/transaction GetTransactionByMessageHash(ctx context.Context, params GetTransactionByMessageHashParams) (GetTransactionByMessageHashRes, error) + // GetTransactionsLiteServer implements getTransactionsLiteServer operation. + // + // Get transactions. + // + // GET /v2/liteserver/get_transactions/{account_id} + GetTransactionsLiteServer(ctx context.Context, params GetTransactionsLiteServerParams) (GetTransactionsLiteServerRes, error) // GetValidators implements getValidators operation. // // Get validators. @@ -317,6 +401,12 @@ type Handler interface { // // POST /v2/blockchain/message SendMessage(ctx context.Context, req SendMessageReq) (SendMessageRes, error) + // SendMessageLiteServer implements sendMessageLiteServer operation. + // + // Send message. + // + // POST /v2/liteserver/send_message + SendMessageLiteServer(ctx context.Context, req SendMessageLiteServerReq) (SendMessageLiteServerRes, error) // SetWalletBackup implements setWalletBackup operation. // // Set backup info. diff --git a/pkg/oas/oas_unimplemented_gen.go b/pkg/oas/oas_unimplemented_gen.go index 4d327fd0..33eb8223 100644 --- a/pkg/oas/oas_unimplemented_gen.go +++ b/pkg/oas/oas_unimplemented_gen.go @@ -112,6 +112,15 @@ func (UnimplementedHandler) GetAccountSeqno(ctx context.Context, params GetAccou return r, ht.ErrNotImplemented } +// GetAccountStateLiteServer implements getAccountStateLiteServer operation. +// +// Get account state. +// +// GET /v2/liteserver/get_account_state/{account_id} +func (UnimplementedHandler) GetAccountStateLiteServer(ctx context.Context, params GetAccountStateLiteServerParams) (r GetAccountStateLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + // GetAccountTransactions implements getAccountTransactions operation. // // Get account transactions. @@ -139,6 +148,15 @@ func (UnimplementedHandler) GetAllAuctions(ctx context.Context, params GetAllAuc return r, ht.ErrNotImplemented } +// GetAllShardsInfoLiteServer implements getAllShardsInfoLiteServer operation. +// +// Get all shards info. +// +// GET /v2/liteserver/get_all_shards_info/{block_id} +func (UnimplementedHandler) GetAllShardsInfoLiteServer(ctx context.Context, params GetAllShardsInfoLiteServerParams) (r GetAllShardsInfoLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + // GetBlock implements getBlock operation. // // Get block data. @@ -148,6 +166,33 @@ func (UnimplementedHandler) GetBlock(ctx context.Context, params GetBlockParams) return r, ht.ErrNotImplemented } +// GetBlockHeaderLiteServer implements getBlockHeaderLiteServer operation. +// +// Get block header. +// +// GET /v2/liteserver/get_block_header/{block_id} +func (UnimplementedHandler) GetBlockHeaderLiteServer(ctx context.Context, params GetBlockHeaderLiteServerParams) (r GetBlockHeaderLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + +// GetBlockLiteServer implements getBlockLiteServer operation. +// +// Get block. +// +// GET /v2/liteserver/get_block/{block_id} +func (UnimplementedHandler) GetBlockLiteServer(ctx context.Context, params GetBlockLiteServerParams) (r GetBlockLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + +// GetBlockProofLiteServer implements getBlockProofLiteServer operation. +// +// Get block proof. +// +// GET /v2/liteserver/get_block_proof +func (UnimplementedHandler) GetBlockProofLiteServer(ctx context.Context, params GetBlockProofLiteServerParams) (r GetBlockProofLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + // GetBlockTransactions implements getBlockTransactions operation. // // Get transactions from block. @@ -166,6 +211,15 @@ func (UnimplementedHandler) GetConfig(ctx context.Context) (r GetConfigRes, _ er return r, ht.ErrNotImplemented } +// GetConfigAllLiteServer implements getConfigAllLiteServer operation. +// +// Get config all. +// +// GET /v2/liteserver/get_config_all/{block_id} +func (UnimplementedHandler) GetConfigAllLiteServer(ctx context.Context, params GetConfigAllLiteServerParams) (r GetConfigAllLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + // GetDnsExpiring implements getDnsExpiring operation. // // Get expiring .ton dns. @@ -265,6 +319,15 @@ func (UnimplementedHandler) GetJettonsHistoryByID(ctx context.Context, params Ge return r, ht.ErrNotImplemented } +// GetListBlockTransactionsLiteServer implements getListBlockTransactionsLiteServer operation. +// +// Get list block transactions. +// +// GET /v2/liteserver/list_block_transactions/{block_id} +func (UnimplementedHandler) GetListBlockTransactionsLiteServer(ctx context.Context, params GetListBlockTransactionsLiteServerParams) (r GetListBlockTransactionsLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + // GetMasterchainHead implements getMasterchainHead operation. // // Get last known masterchain block. @@ -274,6 +337,24 @@ func (UnimplementedHandler) GetMasterchainHead(ctx context.Context) (r GetMaster return r, ht.ErrNotImplemented } +// GetMasterchainInfoExtLiteServer implements getMasterchainInfoExtLiteServer operation. +// +// Get masterchain info ext. +// +// GET /v2/liteserver/get_masterchain_info_ext +func (UnimplementedHandler) GetMasterchainInfoExtLiteServer(ctx context.Context, params GetMasterchainInfoExtLiteServerParams) (r GetMasterchainInfoExtLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + +// GetMasterchainInfoLiteServer implements getMasterchainInfoLiteServer operation. +// +// Get masterchain info. +// +// GET /v2/liteserver/get_masterchain_info +func (UnimplementedHandler) GetMasterchainInfoLiteServer(ctx context.Context) (r GetMasterchainInfoLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + // GetNftCollection implements getNftCollection operation. // // Get NFT collection by collection address. @@ -355,6 +436,33 @@ func (UnimplementedHandler) GetSearchAccounts(ctx context.Context, params GetSea return r, ht.ErrNotImplemented } +// GetShardBlockProofLiteServer implements getShardBlockProofLiteServer operation. +// +// Get shard block proof. +// +// GET /v2/liteserver/get_shard_block_proof/{block_id} +func (UnimplementedHandler) GetShardBlockProofLiteServer(ctx context.Context, params GetShardBlockProofLiteServerParams) (r GetShardBlockProofLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + +// GetShardInfoLiteServer implements getShardInfoLiteServer operation. +// +// Get shard info. +// +// GET /v2/liteserver/get_shard_info/{block_id} +func (UnimplementedHandler) GetShardInfoLiteServer(ctx context.Context, params GetShardInfoLiteServerParams) (r GetShardInfoLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + +// GetStateLiteServer implements getStateLiteServer operation. +// +// Get block state. +// +// GET /v2/liteserver/get_state/{block_id} +func (UnimplementedHandler) GetStateLiteServer(ctx context.Context, params GetStateLiteServerParams) (r GetStateLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + // GetStorageProviders implements getStorageProviders operation. // // Get TON storage providers deployed to the blockchain. @@ -373,6 +481,15 @@ func (UnimplementedHandler) GetSubscriptionsByAccount(ctx context.Context, param return r, ht.ErrNotImplemented } +// GetTimeLiteServer implements getTimeLiteServer operation. +// +// Get time. +// +// GET /v2/liteserver/get_time +func (UnimplementedHandler) GetTimeLiteServer(ctx context.Context) (r GetTimeLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + // GetTonConnectPayload implements getTonConnectPayload operation. // // Get a payload for further token receipt. @@ -418,6 +535,15 @@ func (UnimplementedHandler) GetTransactionByMessageHash(ctx context.Context, par return r, ht.ErrNotImplemented } +// GetTransactionsLiteServer implements getTransactionsLiteServer operation. +// +// Get transactions. +// +// GET /v2/liteserver/get_transactions/{account_id} +func (UnimplementedHandler) GetTransactionsLiteServer(ctx context.Context, params GetTransactionsLiteServerParams) (r GetTransactionsLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + // GetValidators implements getValidators operation. // // Get validators. @@ -472,6 +598,15 @@ func (UnimplementedHandler) SendMessage(ctx context.Context, req SendMessageReq) return r, ht.ErrNotImplemented } +// SendMessageLiteServer implements sendMessageLiteServer operation. +// +// Send message. +// +// POST /v2/liteserver/send_message +func (UnimplementedHandler) SendMessageLiteServer(ctx context.Context, req SendMessageLiteServerReq) (r SendMessageLiteServerRes, _ error) { + return r, ht.ErrNotImplemented +} + // SetWalletBackup implements setWalletBackup operation. // // Set backup info. diff --git a/pkg/oas/oas_validators_gen.go b/pkg/oas/oas_validators_gen.go index 58da7f67..b80038f1 100644 --- a/pkg/oas/oas_validators_gen.go +++ b/pkg/oas/oas_validators_gen.go @@ -948,6 +948,113 @@ func (s GetAccountsReq) Validate() error { } return nil } +func (s GetBlockProofLiteServerOK) Validate() error { + var failures []validate.FieldError + if err := func() error { + if s.Steps == nil { + return errors.New("nil is invalid value") + } + var failures []validate.FieldError + for i, elem := range s.Steps { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "steps", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} +func (s GetBlockProofLiteServerOKStepsItem) Validate() error { + var failures []validate.FieldError + if err := func() error { + if err := s.LiteServerBlockLinkForward.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "lite_server_block_link_forward", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForward) Validate() error { + var failures []validate.FieldError + if err := func() error { + if err := s.Signatures.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "signatures", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} +func (s GetBlockProofLiteServerOKStepsItemLiteServerBlockLinkForwardSignatures) Validate() error { + var failures []validate.FieldError + if err := func() error { + if s.Signatures == nil { + return errors.New("nil is invalid value") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "signatures", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} +func (s GetListBlockTransactionsLiteServerOK) Validate() error { + var failures []validate.FieldError + if err := func() error { + if s.Ids == nil { + return errors.New("nil is invalid value") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "ids", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} func (s GetNftItemsByAddressesReq) Validate() error { var failures []validate.FieldError if err := func() error { @@ -966,6 +1073,24 @@ func (s GetNftItemsByAddressesReq) Validate() error { } return nil } +func (s GetShardBlockProofLiteServerOK) Validate() error { + var failures []validate.FieldError + if err := func() error { + if s.Links == nil { + return errors.New("nil is invalid value") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "links", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} func (s GetStorageProvidersOK) Validate() error { var failures []validate.FieldError if err := func() error { @@ -984,6 +1109,24 @@ func (s GetStorageProvidersOK) Validate() error { } return nil } +func (s GetTransactionsLiteServerOK) Validate() error { + var failures []validate.FieldError + if err := func() error { + if s.Ids == nil { + return errors.New("nil is invalid value") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "ids", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} func (s JettonBalance) Validate() error { var failures []validate.FieldError if err := func() error {