Skip to content

Commit 5508653

Browse files
create a mock extra currency methods
1 parent f8e83e2 commit 5508653

13 files changed

+2155
-273
lines changed

api/openapi.json

+173
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@
128128
"type": "string"
129129
}
130130
},
131+
"ecIDParameter": {
132+
"description": "extra currency id",
133+
"in": "path",
134+
"name": "id",
135+
"required": true,
136+
"schema": {
137+
"example": 239,
138+
"format": "int32",
139+
"type": "integer"
140+
}
141+
},
131142
"eventIDParameter": {
132143
"description": "event ID or transaction hash in hex (without 0x) or base64url format",
133144
"in": "path",
@@ -3265,6 +3276,20 @@
32653276
],
32663277
"type": "object"
32673278
},
3279+
"ExtraCurrencies": {
3280+
"properties": {
3281+
"extra_currencies": {
3282+
"items": {
3283+
"$ref": "#/components/schemas/EcPreview"
3284+
},
3285+
"type": "array"
3286+
}
3287+
},
3288+
"required": [
3289+
"extra_currencies"
3290+
],
3291+
"type": "object"
3292+
},
32683293
"ExtraCurrency": {
32693294
"properties": {
32703295
"amount": {
@@ -6749,6 +6774,86 @@
67496774
]
67506775
}
67516776
},
6777+
"/v2/accounts/{account_id}/extra-currency/{id}/history": {
6778+
"get": {
6779+
"description": "Get the transfer history of extra currencies for an account.",
6780+
"operationId": "getAccountExtraCurrencyHistoryByID",
6781+
"parameters": [
6782+
{
6783+
"$ref": "#/components/parameters/accountIDParameter"
6784+
},
6785+
{
6786+
"$ref": "#/components/parameters/ecIDParameter"
6787+
},
6788+
{
6789+
"$ref": "#/components/parameters/i18n"
6790+
},
6791+
{
6792+
"description": "omit this parameter to get last events",
6793+
"in": "query",
6794+
"name": "before_lt",
6795+
"required": false,
6796+
"schema": {
6797+
"example": 25758317000002,
6798+
"format": "int64",
6799+
"type": "integer",
6800+
"x-js-format": "bigint"
6801+
}
6802+
},
6803+
{
6804+
"in": "query",
6805+
"name": "limit",
6806+
"required": true,
6807+
"schema": {
6808+
"example": 100,
6809+
"maximum": 1000,
6810+
"minimum": 1,
6811+
"type": "integer"
6812+
}
6813+
},
6814+
{
6815+
"in": "query",
6816+
"name": "start_date",
6817+
"required": false,
6818+
"schema": {
6819+
"example": 1668436763,
6820+
"format": "int64",
6821+
"maximum": 2114380800,
6822+
"type": "integer"
6823+
}
6824+
},
6825+
{
6826+
"in": "query",
6827+
"name": "end_date",
6828+
"required": false,
6829+
"schema": {
6830+
"example": 1668436763,
6831+
"format": "int64",
6832+
"maximum": 2114380800,
6833+
"type": "integer"
6834+
}
6835+
}
6836+
],
6837+
"responses": {
6838+
"200": {
6839+
"content": {
6840+
"application/json": {
6841+
"schema": {
6842+
"$ref": "#/components/schemas/AccountEvents"
6843+
}
6844+
}
6845+
},
6846+
"description": "account extra currency history"
6847+
},
6848+
"default": {
6849+
"$ref": "#/components/responses/Error"
6850+
}
6851+
},
6852+
"tags": [
6853+
"Accounts"
6854+
]
6855+
}
6856+
},
67526857
"/v2/accounts/{account_id}/jettons": {
67536858
"get": {
67546859
"description": "Get all Jettons balances by owner address",
@@ -8440,6 +8545,67 @@
84408545
]
84418546
}
84428547
},
8548+
"/v2/extra-currencies": {
8549+
"get": {
8550+
"description": "Get a list of all extra currencies in the blockchain.",
8551+
"operationId": "getExtraCurrencies",
8552+
"parameters": [
8553+
{
8554+
"$ref": "#/components/parameters/limitQuery"
8555+
},
8556+
{
8557+
"$ref": "#/components/parameters/offsetQuery"
8558+
}
8559+
],
8560+
"responses": {
8561+
"200": {
8562+
"content": {
8563+
"application/json": {
8564+
"schema": {
8565+
"$ref": "#/components/schemas/ExtraCurrencies"
8566+
}
8567+
}
8568+
},
8569+
"description": "a list of extra currencies"
8570+
},
8571+
"default": {
8572+
"$ref": "#/components/responses/Error"
8573+
}
8574+
},
8575+
"tags": [
8576+
"ExtraCurrency"
8577+
]
8578+
}
8579+
},
8580+
"/v2/extra-currency/{id}": {
8581+
"get": {
8582+
"description": "Get extra currency info by id",
8583+
"operationId": "getExtraCurrencyInfo",
8584+
"parameters": [
8585+
{
8586+
"$ref": "#/components/parameters/ecIDParameter"
8587+
}
8588+
],
8589+
"responses": {
8590+
"200": {
8591+
"content": {
8592+
"application/json": {
8593+
"schema": {
8594+
"$ref": "#/components/schemas/EcPreview"
8595+
}
8596+
}
8597+
},
8598+
"description": "extra currency info"
8599+
},
8600+
"default": {
8601+
"$ref": "#/components/responses/Error"
8602+
}
8603+
},
8604+
"tags": [
8605+
"ExtraCurrency"
8606+
]
8607+
}
8608+
},
84438609
"/v2/gasless/config": {
84448610
"get": {
84458611
"description": "Returns configuration of gasless transfers",
@@ -10883,6 +11049,13 @@
1088311049
"url": "https://docs.tonconsole.com/tonapi/rest-api/utilities"
1088411050
},
1088511051
"name": "Utilities"
11052+
},
11053+
{
11054+
"externalDocs": {
11055+
"description": "Additional documentation",
11056+
"url": "https://docs.tonconsole.com/tonapi/rest-api/extra-currency"
11057+
},
11058+
"name": "ExtraCurrency"
1088611059
}
1088711060
]
1088811061
}

api/openapi.yml

+111
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ tags:
8484
externalDocs:
8585
description: Additional documentation
8686
url: https://docs.tonconsole.com/tonapi/rest-api/utilities
87+
- name: ExtraCurrency
88+
externalDocs:
89+
description: Additional documentation
90+
url: https://docs.tonconsole.com/tonapi/rest-api/extra-currency
8791

8892
paths:
8993
/v2/openapi.json:
@@ -1101,6 +1105,59 @@ paths:
11011105
example: 1000000000
11021106
'default':
11031107
$ref: '#/components/responses/Error'
1108+
1109+
/v2/accounts/{account_id}/extra-currency/{id}/history:
1110+
get:
1111+
description: Get the transfer history of extra currencies for an account.
1112+
operationId: getAccountExtraCurrencyHistoryByID
1113+
tags:
1114+
- Accounts
1115+
parameters:
1116+
- $ref: '#/components/parameters/accountIDParameter'
1117+
- $ref: '#/components/parameters/ecIDParameter'
1118+
- $ref: '#/components/parameters/i18n'
1119+
- name: before_lt
1120+
in: query
1121+
description: "omit this parameter to get last events"
1122+
required: false
1123+
schema:
1124+
type: integer
1125+
format: int64
1126+
example: 25758317000002
1127+
x-js-format: bigint
1128+
- name: limit
1129+
in: query
1130+
required: true
1131+
schema:
1132+
type: integer
1133+
example: 100
1134+
maximum: 1000
1135+
minimum: 1
1136+
- name: start_date
1137+
in: query
1138+
required: false
1139+
schema:
1140+
type: integer
1141+
format: int64
1142+
maximum: 2114380800
1143+
example: 1668436763
1144+
- name: end_date
1145+
in: query
1146+
required: false
1147+
schema:
1148+
type: integer
1149+
format: int64
1150+
maximum: 2114380800
1151+
example: 1668436763
1152+
responses:
1153+
'200':
1154+
description: account extra currency history
1155+
content:
1156+
application/json:
1157+
schema:
1158+
$ref: '#/components/schemas/AccountEvents'
1159+
'default':
1160+
$ref: '#/components/responses/Error'
11041161

11051162
/v2/dns/{domain_name}:
11061163
get:
@@ -1667,6 +1724,42 @@ paths:
16671724
$ref: '#/components/schemas/Event'
16681725
'default':
16691726
$ref: '#/components/responses/Error'
1727+
1728+
/v2/extra-currency/{id}:
1729+
get:
1730+
description: Get extra currency info by id
1731+
operationId: getExtraCurrencyInfo
1732+
tags:
1733+
- ExtraCurrency
1734+
parameters:
1735+
- $ref: '#/components/parameters/ecIDParameter'
1736+
responses:
1737+
'200':
1738+
description: extra currency info
1739+
content:
1740+
application/json:
1741+
schema:
1742+
$ref: '#/components/schemas/EcPreview'
1743+
'default':
1744+
$ref: '#/components/responses/Error'
1745+
/v2/extra-currencies:
1746+
get:
1747+
description: Get a list of all extra currencies in the blockchain.
1748+
operationId: getExtraCurrencies
1749+
tags:
1750+
- ExtraCurrency
1751+
parameters:
1752+
- $ref: '#/components/parameters/limitQuery'
1753+
- $ref: '#/components/parameters/offsetQuery'
1754+
responses:
1755+
'200':
1756+
description: a list of extra currencies
1757+
content:
1758+
application/json:
1759+
schema:
1760+
$ref: '#/components/schemas/ExtraCurrencies'
1761+
'default':
1762+
$ref: '#/components/responses/Error'
16701763

16711764
/v2/staking/nominator/{account_id}/pools:
16721765
get:
@@ -2955,6 +3048,15 @@ components:
29553048
schema:
29563049
type: string
29573050
example: 97264395BD65A255A429B11326C84128B7D70FFED7949ABAE3036D506BA38621
3051+
ecIDParameter:
3052+
in: path
3053+
name: id
3054+
required: true
3055+
description: "extra currency id"
3056+
schema:
3057+
type: integer
3058+
example: 239
3059+
format: int32
29583060
publicKeyParameter:
29593061
in: path
29603062
name: public_key
@@ -5887,6 +5989,15 @@ components:
58875989
$ref: '#/components/schemas/EncryptedComment'
58885990
refund:
58895991
$ref: '#/components/schemas/Refund'
5992+
ExtraCurrencies:
5993+
type: object
5994+
required:
5995+
- extra_currencies
5996+
properties:
5997+
extra_currencies:
5998+
type: array
5999+
items:
6000+
$ref: '#/components/schemas/EcPreview'
58906001
EcPreview:
58916002
type: object
58926003
required:

pkg/api/account_handlers.go

+4
Original file line numberDiff line numberDiff line change
@@ -604,3 +604,7 @@ func (h *Handler) AddressParse(ctx context.Context, params oas.AddressParseParam
604604
}
605605
return &res, nil //todo: add testnet_only
606606
}
607+
608+
func (h *Handler) GetAccountExtraCurrencyHistoryByID(ctx context.Context, params oas.GetAccountExtraCurrencyHistoryByIDParams) (*oas.AccountEvents, error) {
609+
return &oas.AccountEvents{}, nil
610+
}

pkg/api/extra_currency_handlers.go

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package api
2+
3+
import (
4+
"context"
5+
6+
"github.com/tonkeeper/opentonapi/pkg/oas"
7+
)
8+
9+
func (h *Handler) GetExtraCurrencyInfo(ctx context.Context, params oas.GetExtraCurrencyInfoParams) (*oas.EcPreview, error) {
10+
return &oas.EcPreview{}, nil
11+
}
12+
13+
func (h *Handler) GetExtraCurrencies(ctx context.Context, params oas.GetExtraCurrenciesParams) (*oas.ExtraCurrencies, error) {
14+
return &oas.ExtraCurrencies{ExtraCurrencies: []oas.EcPreview{}}, nil
15+
}

0 commit comments

Comments
 (0)