Skip to content

Commit fb5bf09

Browse files
Implement /v2/message/decode
1 parent b1b62d0 commit fb5bf09

24 files changed

+4663
-3
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@
3434

3535
### 2023-10-23
3636
- `/v2/blockchain/blocks/{block_id}` returns a value flow from a block.
37+
-
38+
### 2023-10-28
39+
- `/v2/message/decode` decodes an ext in message.

api/openapi.json

+178
Original file line numberDiff line numberDiff line change
@@ -2457,6 +2457,157 @@
24572457
],
24582458
"type": "object"
24592459
},
2460+
"DecodedMessage": {
2461+
"properties": {
2462+
"destination": {
2463+
"$ref": "#/components/schemas/AccountAddress"
2464+
},
2465+
"destination_wallet_version": {
2466+
"example": "v3R2",
2467+
"type": "string"
2468+
},
2469+
"ext_in_msg_decoded": {
2470+
"properties": {
2471+
"wallet_highload_v2": {
2472+
"properties": {
2473+
"bounded_query_id": {
2474+
"example": "34254528475294857",
2475+
"type": "string"
2476+
},
2477+
"raw_messages": {
2478+
"items": {
2479+
"$ref": "#/components/schemas/DecodedRawMessage"
2480+
},
2481+
"type": "array"
2482+
},
2483+
"subwallet_id": {
2484+
"example": 1,
2485+
"format": "uint32",
2486+
"type": "integer"
2487+
}
2488+
},
2489+
"required": [
2490+
"subwallet_id",
2491+
"bounded_query_id",
2492+
"raw_messages"
2493+
],
2494+
"type": "object"
2495+
},
2496+
"wallet_v3": {
2497+
"properties": {
2498+
"raw_messages": {
2499+
"items": {
2500+
"$ref": "#/components/schemas/DecodedRawMessage"
2501+
},
2502+
"type": "array"
2503+
},
2504+
"seqno": {
2505+
"example": 1,
2506+
"format": "uint32",
2507+
"type": "integer"
2508+
},
2509+
"subwallet_id": {
2510+
"example": 1,
2511+
"format": "uint32",
2512+
"type": "integer"
2513+
},
2514+
"valid_until": {
2515+
"example": 1,
2516+
"format": "uint32",
2517+
"type": "integer"
2518+
}
2519+
},
2520+
"required": [
2521+
"subwallet_id",
2522+
"valid_until",
2523+
"seqno",
2524+
"op",
2525+
"raw_messages"
2526+
],
2527+
"type": "object"
2528+
},
2529+
"wallet_v4": {
2530+
"properties": {
2531+
"op": {
2532+
"example": 1,
2533+
"format": "int8",
2534+
"type": "integer"
2535+
},
2536+
"raw_messages": {
2537+
"items": {
2538+
"$ref": "#/components/schemas/DecodedRawMessage"
2539+
},
2540+
"type": "array"
2541+
},
2542+
"seqno": {
2543+
"example": 1,
2544+
"format": "uint32",
2545+
"type": "integer"
2546+
},
2547+
"subwallet_id": {
2548+
"example": 1,
2549+
"format": "uint32",
2550+
"type": "integer"
2551+
},
2552+
"valid_until": {
2553+
"example": 1,
2554+
"format": "uint32",
2555+
"type": "integer"
2556+
}
2557+
},
2558+
"required": [
2559+
"subwallet_id",
2560+
"valid_until",
2561+
"seqno",
2562+
"op",
2563+
"raw_messages"
2564+
],
2565+
"type": "object"
2566+
}
2567+
},
2568+
"type": "object"
2569+
}
2570+
},
2571+
"required": [
2572+
"destination",
2573+
"destination_wallet_version"
2574+
],
2575+
"type": "object"
2576+
},
2577+
"DecodedRawMessage": {
2578+
"properties": {
2579+
"message": {
2580+
"properties": {
2581+
"boc": {
2582+
"example": "te6ccgEBAQEABgAACCiAmCMBAgEABwA=",
2583+
"type": "string"
2584+
},
2585+
"decoded_body": {},
2586+
"decoded_op_name": {
2587+
"example": "nft_transfer",
2588+
"type": "string"
2589+
},
2590+
"op_code": {
2591+
"example": "0xdeadbeaf",
2592+
"type": "string"
2593+
}
2594+
},
2595+
"required": [
2596+
"boc"
2597+
],
2598+
"type": "object"
2599+
},
2600+
"mode": {
2601+
"example": 2,
2602+
"type": "integer"
2603+
}
2604+
},
2605+
"required": [
2606+
"message",
2607+
"mode"
2608+
],
2609+
"type": "object"
2610+
},
24602611
"DepositStakeAction": {
24612612
"description": "validator's participation in elections",
24622613
"properties": {
@@ -7668,6 +7819,33 @@
76687819
]
76697820
}
76707821
},
7822+
"/v2/message/decode": {
7823+
"post": {
7824+
"description": "Decode a given message. Only external incoming messages can be decoded currently.",
7825+
"operationId": "decodeMessage",
7826+
"requestBody": {
7827+
"$ref": "#/components/requestBodies/Boc"
7828+
},
7829+
"responses": {
7830+
"200": {
7831+
"content": {
7832+
"application/json": {
7833+
"schema": {
7834+
"$ref": "#/components/schemas/DecodedMessage"
7835+
}
7836+
}
7837+
},
7838+
"description": "decoded message"
7839+
},
7840+
"default": {
7841+
"$ref": "#/components/responses/Error"
7842+
}
7843+
},
7844+
"tags": [
7845+
"Emulation"
7846+
]
7847+
}
7848+
},
76717849
"/v2/nfts/_bulk": {
76727850
"post": {
76737851
"description": "Get NFT items by their addresses",

api/openapi.yml

+127
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,23 @@ paths:
303303
$ref: '#/components/schemas/BlockchainAccountInspect'
304304
'default':
305305
$ref: '#/components/responses/Error'
306+
/v2/message/decode:
307+
post:
308+
description: Decode a given message. Only external incoming messages can be decoded currently.
309+
operationId: decodeMessage
310+
tags:
311+
- Emulation
312+
requestBody:
313+
$ref: "#/components/requestBodies/Boc"
314+
responses:
315+
'200':
316+
description: decoded message
317+
content:
318+
application/json:
319+
schema:
320+
$ref: '#/components/schemas/DecodedMessage'
321+
'default':
322+
$ref: '#/components/responses/Error'
306323
/v2/address/{account_id}/parse:
307324
get:
308325
description: parse address and display in all formats
@@ -5421,6 +5438,116 @@ components:
54215438
$ref: '#/components/schemas/AccountAddress'
54225439
jetton:
54235440
$ref: '#/components/schemas/JettonPreview'
5441+
DecodedMessage:
5442+
type: object
5443+
required:
5444+
- destination
5445+
- destination_wallet_version
5446+
properties:
5447+
destination:
5448+
$ref: '#/components/schemas/AccountAddress'
5449+
destination_wallet_version:
5450+
type: string
5451+
example: "v3R2"
5452+
ext_in_msg_decoded:
5453+
type: object
5454+
properties:
5455+
wallet_v3:
5456+
type: object
5457+
required:
5458+
- subwallet_id
5459+
- valid_until
5460+
- seqno
5461+
- op
5462+
- raw_messages
5463+
properties:
5464+
subwallet_id:
5465+
type: integer
5466+
format: uint32
5467+
example: 1
5468+
valid_until:
5469+
type: integer
5470+
format: uint32
5471+
example: 1
5472+
seqno:
5473+
type: integer
5474+
format: uint32
5475+
example: 1
5476+
raw_messages:
5477+
type: array
5478+
items:
5479+
$ref: '#/components/schemas/DecodedRawMessage'
5480+
wallet_v4:
5481+
type: object
5482+
required:
5483+
- subwallet_id
5484+
- valid_until
5485+
- seqno
5486+
- op
5487+
- raw_messages
5488+
properties:
5489+
subwallet_id:
5490+
type: integer
5491+
format: uint32
5492+
example: 1
5493+
valid_until:
5494+
type: integer
5495+
format: uint32
5496+
example: 1
5497+
seqno:
5498+
type: integer
5499+
format: uint32
5500+
example: 1
5501+
op:
5502+
type: integer
5503+
format: int8
5504+
example: 1
5505+
raw_messages:
5506+
type: array
5507+
items:
5508+
$ref: '#/components/schemas/DecodedRawMessage'
5509+
wallet_highload_v2:
5510+
type: object
5511+
required:
5512+
- subwallet_id
5513+
- bounded_query_id
5514+
- raw_messages
5515+
properties:
5516+
subwallet_id:
5517+
type: integer
5518+
format: uint32
5519+
example: 1
5520+
bounded_query_id:
5521+
type: string
5522+
example: "34254528475294857"
5523+
raw_messages:
5524+
type: array
5525+
items:
5526+
$ref: '#/components/schemas/DecodedRawMessage'
5527+
DecodedRawMessage:
5528+
type: object
5529+
required:
5530+
- message
5531+
- mode
5532+
properties:
5533+
message:
5534+
type: object
5535+
required:
5536+
- boc
5537+
properties:
5538+
boc:
5539+
type: string
5540+
example: "te6ccgEBAQEABgAACCiAmCMBAgEABwA="
5541+
decoded_op_name:
5542+
type: string
5543+
example: "nft_transfer"
5544+
op_code:
5545+
type: string
5546+
example: "0xdeadbeaf"
5547+
decoded_body: { } # Free-form JSON value
5548+
mode:
5549+
type: integer
5550+
example: 2
54245551
Event:
54255552
type: object
54265553
required:

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
github.com/sourcegraph/conc v0.3.0
2323
github.com/stretchr/testify v1.8.4
2424
github.com/tonkeeper/scam_backoffice_rules v0.0.0-20231030143526-f717a9954e0a
25-
github.com/tonkeeper/tongo v1.4.2-0.20231123114202-e8c3d9033f8f
25+
github.com/tonkeeper/tongo v1.4.2-0.20231128140346-1d139dc95f4e
2626
go.opentelemetry.io/otel v1.19.0
2727
go.opentelemetry.io/otel/metric v1.19.0
2828
go.opentelemetry.io/otel/trace v1.19.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
264264
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
265265
github.com/tonkeeper/scam_backoffice_rules v0.0.0-20231030143526-f717a9954e0a h1:yYAU4WwiNTi4Xddyids0ByjudmDELHtO+wAFTYnFXJU=
266266
github.com/tonkeeper/scam_backoffice_rules v0.0.0-20231030143526-f717a9954e0a/go.mod h1:SqZXYO9vbID8ku+xnnaKXeNGmehxigODGrk5V1KqbRA=
267-
github.com/tonkeeper/tongo v1.4.2-0.20231123114202-e8c3d9033f8f h1:X4f9DsGTm2zrz5GoctPhPaYkylfsUgLfFkLYH3r724E=
268-
github.com/tonkeeper/tongo v1.4.2-0.20231123114202-e8c3d9033f8f/go.mod h1:LdOBjpUz6vLp1EdX3E0XLNks9YI5XMSqaQahfOMrBEY=
267+
github.com/tonkeeper/tongo v1.4.2-0.20231128140346-1d139dc95f4e h1:BDOzx0FAe/IX4T+HkeMTuOnPT4LAD6qumrcU111uDbQ=
268+
github.com/tonkeeper/tongo v1.4.2-0.20231128140346-1d139dc95f4e/go.mod h1:LdOBjpUz6vLp1EdX3E0XLNks9YI5XMSqaQahfOMrBEY=
269269
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
270270
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
271271
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=

0 commit comments

Comments
 (0)