initjnjnj
This commit is contained in:
@@ -426,8 +426,7 @@
|
||||
"SendRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"to",
|
||||
"amount"
|
||||
"to"
|
||||
],
|
||||
"properties": {
|
||||
"to": {
|
||||
@@ -452,6 +451,11 @@
|
||||
],
|
||||
"nullable": true,
|
||||
"description": "Default 'normal'. ETH/BSC: eth_feeHistory p25/p50/p75 priority. BTC: blockstream targets 144/6/1 блок. TRX/SOL: игнорится."
|
||||
},
|
||||
"amountHuman": {
|
||||
"type": "string",
|
||||
"description": "Human-readable amount (e.g. \"0.01\"). Server конвертит в smallest units через token decimals. Используется ВМЕСТО поля `amount` — НЕ передавай оба одновременно.",
|
||||
"example": "0.01"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -702,6 +706,196 @@
|
||||
"description": "EVM gas units (BSC). Null для TRX/SOL."
|
||||
}
|
||||
}
|
||||
},
|
||||
"SendCostEstimateResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"data": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"chain": {
|
||||
"type": "string",
|
||||
"example": "BSC"
|
||||
},
|
||||
"fee": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"asset": {
|
||||
"type": "string",
|
||||
"example": "BNB"
|
||||
},
|
||||
"amount": {
|
||||
"type": "string",
|
||||
"example": "65000000000000"
|
||||
},
|
||||
"amountFormatted": {
|
||||
"type": "string",
|
||||
"example": "0.000065"
|
||||
},
|
||||
"amountUsd": {
|
||||
"type": "number",
|
||||
"nullable": true,
|
||||
"example": 0.04
|
||||
}
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amountUsd": {
|
||||
"type": "number",
|
||||
"nullable": true,
|
||||
"example": 0.04
|
||||
}
|
||||
}
|
||||
},
|
||||
"breakdown": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"SwapCostEstimateResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"data": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"chain": {
|
||||
"type": "string",
|
||||
"example": "BSC"
|
||||
},
|
||||
"fee": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"asset": {
|
||||
"type": "string",
|
||||
"example": "BNB"
|
||||
},
|
||||
"amount": {
|
||||
"type": "string"
|
||||
},
|
||||
"amountFormatted": {
|
||||
"type": "string"
|
||||
},
|
||||
"amountUsd": {
|
||||
"type": "number",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amountUsd": {
|
||||
"type": "number",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"route": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"example": [
|
||||
"USDT",
|
||||
"BNB"
|
||||
]
|
||||
},
|
||||
"approveRequired": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"estimatedGasUnits": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"slippageBps": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"BridgeCostEstimateResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"data": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"fees": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"gas": {
|
||||
"type": "object",
|
||||
"nullable": true,
|
||||
"additionalProperties": true
|
||||
},
|
||||
"relayer": {
|
||||
"type": "object",
|
||||
"nullable": true,
|
||||
"additionalProperties": true
|
||||
},
|
||||
"app": {
|
||||
"type": "object",
|
||||
"nullable": true,
|
||||
"additionalProperties": true
|
||||
},
|
||||
"total": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amountUsd": {
|
||||
"type": "number",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"rate": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"priceImpactPct": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"priceImpactUsd": {
|
||||
"type": "number",
|
||||
"nullable": true
|
||||
},
|
||||
"timeEstimate": {
|
||||
"type": "integer",
|
||||
"nullable": true,
|
||||
"description": "Estimate в секундах"
|
||||
},
|
||||
"currencyIn": {
|
||||
"type": "object",
|
||||
"nullable": true,
|
||||
"additionalProperties": true
|
||||
},
|
||||
"currencyOut": {
|
||||
"type": "object",
|
||||
"nullable": true,
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1312,6 +1506,11 @@
|
||||
"type": "string",
|
||||
"description": "ULID quote id, полученный от POST /:chain/swap/quote.",
|
||||
"example": "q_01KRKD8GA4XZJ5W4E7VFT2N9M3"
|
||||
},
|
||||
"amountHuman": {
|
||||
"type": "string",
|
||||
"description": "Human-readable amount (e.g. \"0.01\"). Server конвертит в smallest units через token decimals. Используется ВМЕСТО поля `amount` — НЕ передавай оба одновременно.",
|
||||
"example": "0.01"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1346,6 +1545,11 @@
|
||||
"normal",
|
||||
"fast"
|
||||
]
|
||||
},
|
||||
"amountHuman": {
|
||||
"type": "string",
|
||||
"description": "Human-readable amount (e.g. \"0.01\"). Server конвертит в smallest units через token decimals. Используется ВМЕСТО поля `amount` — НЕ передавай оба одновременно.",
|
||||
"example": "0.01"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1372,6 +1576,11 @@
|
||||
"minimum": 1,
|
||||
"maximum": 1000,
|
||||
"default": 50
|
||||
},
|
||||
"amountHuman": {
|
||||
"type": "string",
|
||||
"description": "Human-readable amount (e.g. \"0.01\"). Server конвертит в smallest units через token decimals. Используется ВМЕСТО поля `amount` — НЕ передавай оба одновременно.",
|
||||
"example": "0.01"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1823,6 +2032,11 @@
|
||||
"EXACT_INPUT",
|
||||
"EXACT_OUTPUT"
|
||||
]
|
||||
},
|
||||
"amountHuman": {
|
||||
"type": "string",
|
||||
"description": "Human-readable amount (e.g. \"0.01\"). Server конвертит в smallest units через token decimals. Используется ВМЕСТО поля `amount` — НЕ передавай оба одновременно.",
|
||||
"example": "0.01"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2068,6 +2282,11 @@
|
||||
"fast"
|
||||
],
|
||||
"description": "BSC only"
|
||||
},
|
||||
"amountHuman": {
|
||||
"type": "string",
|
||||
"description": "Human-readable amount (e.g. \"0.01\"). Server конвертит в smallest units через token decimals. Используется ВМЕСТО поля `amount` — НЕ передавай оба одновременно.",
|
||||
"example": "0.01"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -2098,6 +2317,11 @@
|
||||
"minimum": 1,
|
||||
"maximum": 1000,
|
||||
"default": 50
|
||||
},
|
||||
"amountHuman": {
|
||||
"type": "string",
|
||||
"description": "Human-readable amount (e.g. \"0.01\"). Server конвертит в smallest units через token decimals. Используется ВМЕСТО поля `amount` — НЕ передавай оба одновременно.",
|
||||
"example": "0.01"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2140,6 +2364,285 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/wallets/{chain}/send/cost-estimate": {
|
||||
"post": {
|
||||
"summary": "Estimate USD cost of a /send call (read-only, без broadcast)",
|
||||
"description": "Read-only USD-оценка сколько будет стоить broadcast tx (gas/network fee).\n\nНе дёргает mnemonic, не резервирует idempotency cache, не делает RPC broadcast.\n\nBody — те же поля что у /send МИНУС `to`. Можно прислать `amount` (smallest units, legacy) ИЛИ `amountHuman` (\"0.01\").",
|
||||
"tags": [
|
||||
"Wallet Ops"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "chain",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ETH",
|
||||
"BSC",
|
||||
"BTC",
|
||||
"TRX",
|
||||
"SOL"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string",
|
||||
"description": "Token symbol (USDT, USDC, ...). Пусто = native."
|
||||
},
|
||||
"amount": {
|
||||
"type": "string",
|
||||
"description": "Smallest units (legacy)"
|
||||
},
|
||||
"amountHuman": {
|
||||
"type": "string",
|
||||
"description": "Human-readable amount (e.g. \"0.01\"). Server конвертит в smallest units через token decimals. Используется ВМЕСТО поля `amount` — НЕ передавай оба одновременно.",
|
||||
"example": "0.01"
|
||||
},
|
||||
"feeTier": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"slow",
|
||||
"normal",
|
||||
"fast"
|
||||
],
|
||||
"default": "normal",
|
||||
"description": "EVM only (ETH/BSC); ignored для TRX/SOL/BTC"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Cost estimate",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/SendCostEstimateResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Validation error"
|
||||
},
|
||||
"502": {
|
||||
"description": "Gas oracle / price oracle unavailable"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/wallets/{chain}/swap/cost-estimate": {
|
||||
"post": {
|
||||
"summary": "Estimate USD cost of a swap (без cache, без quoteId)",
|
||||
"description": "Те же поля что у /swap/quote, но возвращает ТОЛЬКО fee + route + approveRequired (без quoteId/expiry/cache).\n\nIdempotent — можно вызывать много раз. Используется для отображения USD-цены свапа в UI ДО того как юзер решит подтвердить.",
|
||||
"tags": [
|
||||
"Wallet Ops"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "chain",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"BSC",
|
||||
"TRX",
|
||||
"SOL"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"title": "BSC/TRX",
|
||||
"properties": {
|
||||
"from": {
|
||||
"type": "string"
|
||||
},
|
||||
"to": {
|
||||
"type": "string"
|
||||
},
|
||||
"amount": {
|
||||
"type": "string",
|
||||
"description": "Smallest units (legacy)"
|
||||
},
|
||||
"amountHuman": {
|
||||
"type": "string",
|
||||
"description": "Human-readable amount (e.g. \"0.01\"). Server конвертит в smallest units через token decimals. Используется ВМЕСТО поля `amount` — НЕ передавай оба одновременно.",
|
||||
"example": "0.01"
|
||||
},
|
||||
"slippageBps": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 1000,
|
||||
"default": 50
|
||||
},
|
||||
"feeTier": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"slow",
|
||||
"normal",
|
||||
"fast"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"title": "SOL",
|
||||
"properties": {
|
||||
"inputMint": {
|
||||
"type": "string"
|
||||
},
|
||||
"outputMint": {
|
||||
"type": "string"
|
||||
},
|
||||
"amount": {
|
||||
"type": "string",
|
||||
"description": "Smallest units (legacy)"
|
||||
},
|
||||
"amountHuman": {
|
||||
"type": "string",
|
||||
"description": "Human-readable amount (e.g. \"0.01\"). Server конвертит в smallest units через token decimals. Используется ВМЕСТО поля `amount` — НЕ передавай оба одновременно.",
|
||||
"example": "0.01"
|
||||
},
|
||||
"slippageBps": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 1000,
|
||||
"default": 50
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Swap cost estimate",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/SwapCostEstimateResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Validation error"
|
||||
},
|
||||
"404": {
|
||||
"description": "Wallet not found"
|
||||
},
|
||||
"502": {
|
||||
"description": "Upstream RPC / quote failed"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/relay/cost-estimate": {
|
||||
"post": {
|
||||
"summary": "Estimate USD cost of a bridge (Relay quote — trimmed, без steps[])",
|
||||
"description": "Вызывает Relay /quote внутри и фильтрует response — отдаёт только fees + details (rate, time, impact, currencyIn/Out).\n\nБез `steps[]` (которые тяжёлые и содержат unsigned txs). Поведение JWT-binding (body.user, body.recipient) — то же что у /relay/quote.",
|
||||
"tags": [
|
||||
"Bridge (Relay)"
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"user": {
|
||||
"type": "string",
|
||||
"description": "Sender address (должен совпадать с user's wallet origin chain)"
|
||||
},
|
||||
"recipient": {
|
||||
"type": "string"
|
||||
},
|
||||
"originChainId": {
|
||||
"type": "integer",
|
||||
"description": "1=ETH, 56=BSC, 792703809=SOL"
|
||||
},
|
||||
"destinationChainId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"originCurrency": {
|
||||
"type": "string",
|
||||
"description": "Contract address (для EVM) или mint (для SOL)"
|
||||
},
|
||||
"destinationCurrency": {
|
||||
"type": "string"
|
||||
},
|
||||
"amount": {
|
||||
"type": "string",
|
||||
"description": "Smallest units (legacy)"
|
||||
},
|
||||
"amountHuman": {
|
||||
"type": "string",
|
||||
"description": "Human-readable amount (e.g. \"0.01\"). Server конвертит в smallest units через token decimals. Используется ВМЕСТО поля `amount` — НЕ передавай оба одновременно.",
|
||||
"example": "0.01"
|
||||
},
|
||||
"tradeType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"EXACT_INPUT",
|
||||
"EXACT_OUTPUT"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Bridge cost estimate",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/BridgeCostEstimateResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Validation error / unknown originCurrency для amountHuman"
|
||||
},
|
||||
"403": {
|
||||
"description": "body.user/recipient не совпадает с user wallets"
|
||||
},
|
||||
"502": {
|
||||
"description": "Relay upstream error"
|
||||
},
|
||||
"504": {
|
||||
"description": "Relay timeout"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user