Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement /v2/message/decode #260

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@

### 2023-10-23
- `/v2/blockchain/blocks/{block_id}` returns a value flow from a block.
-
### 2023-10-28
- `/v2/message/decode` decodes an ext in message.
178 changes: 178 additions & 0 deletions api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2457,6 +2457,157 @@
],
"type": "object"
},
"DecodedMessage": {
"properties": {
"destination": {
"$ref": "#/components/schemas/AccountAddress"
},
"destination_wallet_version": {
"example": "v3R2",
"type": "string"
},
"ext_in_msg_decoded": {
"properties": {
"wallet_highload_v2": {
"properties": {
"bounded_query_id": {
"example": "34254528475294857",
"type": "string"
},
"raw_messages": {
"items": {
"$ref": "#/components/schemas/DecodedRawMessage"
},
"type": "array"
},
"subwallet_id": {
"example": 1,
"format": "uint32",
"type": "integer"
}
},
"required": [
"subwallet_id",
"bounded_query_id",
"raw_messages"
],
"type": "object"
},
"wallet_v3": {
"properties": {
"raw_messages": {
"items": {
"$ref": "#/components/schemas/DecodedRawMessage"
},
"type": "array"
},
"seqno": {
"example": 1,
"format": "uint32",
"type": "integer"
},
"subwallet_id": {
"example": 1,
"format": "uint32",
"type": "integer"
},
"valid_until": {
"example": 1,
"format": "uint32",
"type": "integer"
}
},
"required": [
"subwallet_id",
"valid_until",
"seqno",
"op",
"raw_messages"
],
"type": "object"
},
"wallet_v4": {
"properties": {
"op": {
"example": 1,
"format": "int8",
"type": "integer"
},
"raw_messages": {
"items": {
"$ref": "#/components/schemas/DecodedRawMessage"
},
"type": "array"
},
"seqno": {
"example": 1,
"format": "uint32",
"type": "integer"
},
"subwallet_id": {
"example": 1,
"format": "uint32",
"type": "integer"
},
"valid_until": {
"example": 1,
"format": "uint32",
"type": "integer"
}
},
"required": [
"subwallet_id",
"valid_until",
"seqno",
"op",
"raw_messages"
],
"type": "object"
}
},
"type": "object"
}
},
"required": [
"destination",
"destination_wallet_version"
],
"type": "object"
},
"DecodedRawMessage": {
"properties": {
"message": {
"properties": {
"boc": {
"example": "te6ccgEBAQEABgAACCiAmCMBAgEABwA=",
"type": "string"
},
"decoded_body": {},
"decoded_op_name": {
"example": "nft_transfer",
"type": "string"
},
"op_code": {
"example": "0xdeadbeaf",
"type": "string"
}
},
"required": [
"boc"
],
"type": "object"
},
"mode": {
"example": 2,
"type": "integer"
}
},
"required": [
"message",
"mode"
],
"type": "object"
},
"DepositStakeAction": {
"description": "validator's participation in elections",
"properties": {
Expand Down Expand Up @@ -7668,6 +7819,33 @@
]
}
},
"/v2/message/decode": {
"post": {
"description": "Decode a given message. Only external incoming messages can be decoded currently.",
"operationId": "decodeMessage",
"requestBody": {
"$ref": "#/components/requestBodies/Boc"
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DecodedMessage"
}
}
},
"description": "decoded message"
},
"default": {
"$ref": "#/components/responses/Error"
}
},
"tags": [
"Emulation"
]
}
},
"/v2/nfts/_bulk": {
"post": {
"description": "Get NFT items by their addresses",
Expand Down
127 changes: 127 additions & 0 deletions api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,23 @@ paths:
$ref: '#/components/schemas/BlockchainAccountInspect'
'default':
$ref: '#/components/responses/Error'
/v2/message/decode:
post:
description: Decode a given message. Only external incoming messages can be decoded currently.
operationId: decodeMessage
tags:
- Emulation
requestBody:
$ref: "#/components/requestBodies/Boc"
responses:
'200':
description: decoded message
content:
application/json:
schema:
$ref: '#/components/schemas/DecodedMessage'
'default':
$ref: '#/components/responses/Error'
/v2/address/{account_id}/parse:
get:
description: parse address and display in all formats
Expand Down Expand Up @@ -5421,6 +5438,116 @@ components:
$ref: '#/components/schemas/AccountAddress'
jetton:
$ref: '#/components/schemas/JettonPreview'
DecodedMessage:
type: object
required:
- destination
- destination_wallet_version
properties:
destination:
$ref: '#/components/schemas/AccountAddress'
destination_wallet_version:
type: string
example: "v3R2"
ext_in_msg_decoded:
type: object
properties:
wallet_v3:
type: object
required:
- subwallet_id
- valid_until
- seqno
- op
- raw_messages
properties:
subwallet_id:
type: integer
format: uint32
example: 1
valid_until:
type: integer
format: uint32
example: 1
seqno:
type: integer
format: uint32
example: 1
raw_messages:
type: array
items:
$ref: '#/components/schemas/DecodedRawMessage'
wallet_v4:
type: object
required:
- subwallet_id
- valid_until
- seqno
- op
- raw_messages
properties:
subwallet_id:
type: integer
format: uint32
example: 1
valid_until:
type: integer
format: uint32
example: 1
seqno:
type: integer
format: uint32
example: 1
op:
type: integer
format: int8
example: 1
raw_messages:
type: array
items:
$ref: '#/components/schemas/DecodedRawMessage'
wallet_highload_v2:
type: object
required:
- subwallet_id
- bounded_query_id
- raw_messages
properties:
subwallet_id:
type: integer
format: uint32
example: 1
bounded_query_id:
type: string
example: "34254528475294857"
raw_messages:
type: array
items:
$ref: '#/components/schemas/DecodedRawMessage'
DecodedRawMessage:
type: object
required:
- message
- mode
properties:
message:
type: object
required:
- boc
properties:
boc:
type: string
example: "te6ccgEBAQEABgAACCiAmCMBAgEABwA="
decoded_op_name:
type: string
example: "nft_transfer"
op_code:
type: string
example: "0xdeadbeaf"
decoded_body: { } # Free-form JSON value
mode:
type: integer
example: 2
Event:
type: object
required:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/sourcegraph/conc v0.3.0
github.com/stretchr/testify v1.8.4
github.com/tonkeeper/scam_backoffice_rules v0.0.0-20231030143526-f717a9954e0a
github.com/tonkeeper/tongo v1.4.2-0.20231123114202-e8c3d9033f8f
github.com/tonkeeper/tongo v1.4.2-0.20231128140346-1d139dc95f4e
go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel/metric v1.19.0
go.opentelemetry.io/otel/trace v1.19.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tonkeeper/scam_backoffice_rules v0.0.0-20231030143526-f717a9954e0a h1:yYAU4WwiNTi4Xddyids0ByjudmDELHtO+wAFTYnFXJU=
github.com/tonkeeper/scam_backoffice_rules v0.0.0-20231030143526-f717a9954e0a/go.mod h1:SqZXYO9vbID8ku+xnnaKXeNGmehxigODGrk5V1KqbRA=
github.com/tonkeeper/tongo v1.4.2-0.20231123114202-e8c3d9033f8f h1:X4f9DsGTm2zrz5GoctPhPaYkylfsUgLfFkLYH3r724E=
github.com/tonkeeper/tongo v1.4.2-0.20231123114202-e8c3d9033f8f/go.mod h1:LdOBjpUz6vLp1EdX3E0XLNks9YI5XMSqaQahfOMrBEY=
github.com/tonkeeper/tongo v1.4.2-0.20231128140346-1d139dc95f4e h1:BDOzx0FAe/IX4T+HkeMTuOnPT4LAD6qumrcU111uDbQ=
github.com/tonkeeper/tongo v1.4.2-0.20231128140346-1d139dc95f4e/go.mod h1:LdOBjpUz6vLp1EdX3E0XLNks9YI5XMSqaQahfOMrBEY=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
Expand Down
Loading