add: zano trade api docs

This commit is contained in:
AzizbekFayziyev 2025-04-28 20:30:36 +05:00
parent 0cc410898c
commit 48805babd6
22 changed files with 278 additions and 0 deletions

View file

@ -0,0 +1,3 @@
{
"label": "Zano trade Api"
}

View file

@ -0,0 +1,4 @@
{
"label": "Apply for matched order",
"position": 6
}

View file

@ -0,0 +1,28 @@
# Apply for matched order
> Use this method to apply if another side hasn't done it yet.
> You can check if they applied by the **transaction** field in applyTips. If it's `false`, you can apply for it; otherwise, you are the finalizer and should use the **Confirm transaction** method.
- **METHOD**: <kbd>POST</kbd>
- **PATH**: `/api/orders/apply-order`
#### Request:
```typescript
{
token: string;
orderData: {
id: string;
connected_order_id: string;
hex_raw_proposal: string;
};
}
```
>Explanation of Fields:
>- to get `hex_raw_proposal` create [ionic swap proposal](https://docs.zano.org/docs/build/rpc-api/wallet-rpc-api/ionic_swap_generate_proposal/) via Zano wallet API;
>- hex_raw_proposal - Hex-encoded proposal raw data(encrypted with common shared key). Includes half-created transaction template and some extra information that would be needed counterparty to finialize and sign transaction
#### Response:
```typescript
success: boolean;
data?: string // error message
```

View file

@ -0,0 +1,4 @@
{
"label": "Сonfirm transaction",
"position": 7
}

View file

@ -0,0 +1,19 @@
# Confirm transaction
> Use this method to confirm that you have finalized the transaction (order or part). You can get its id from the **get-active-tx-by-orders-ids** method.
- **METHOD**: <kbd>POST</kbd>
- **PATH**: `/api/transactions/confirm`
#### Request:
```typescript
{
token: string;
transactionId: number;
}
```
#### Response:
```typescript
success: boolean;
data?: string // error message
```

View file

@ -0,0 +1,4 @@
{
"label": "Create new order",
"position": 4
}

View file

@ -0,0 +1,24 @@
# Create new order
- **METHOD**: <kbd>POST</kbd>
- **PATH**: `/api/orders/create`
#### Request:
```typescript
{
token: string;
orderData: {
type: 'buy' | 'sell';
side: 'limit'; // field naming will be fixed soon. It won't affect bots, both field names will work
price: string;
amount: string;
pairId: number;
};
}
```
#### Response:
```typescript
success: boolean;
data?: string // error message
```

View file

@ -0,0 +1,4 @@
{
"label": "Delete your order",
"position": 5
}

View file

@ -0,0 +1,17 @@
# Delete your order
- **METHOD**: <kbd>POST</kbd>
- **PATH**: `/api/orders/cancel`
#### Request:
```typescript
{
token: string;
orderId: number;
}
```
#### Response:
```typescript
success: boolean;
data?: string // error message
```

View file

@ -0,0 +1,4 @@
{
"label": "Get your active orders",
"position": 3
}

View file

@ -0,0 +1,51 @@
# Get your active orders
- **METHOD**: <kbd>POST</kbd>
- **PATH**: `/api/orders/get-user-page`
#### Request:
```typescript
{
token: string;
pairId: number;
}
#### Response:
```typescript
success: boolean;
data: {
orders: {
id: number;
type: string;
timestamp: string;
side: string;
price: string;
amount: string;
total: string;
pair_id: number;
user_id: number;
status: string;
left: string;
hasNotification: boolean;
createdAt: string;
updatedAt: string;
isInstant: boolean;
}[];
applyTips: {
id: number;
left: string;
price: string;
user: {
alias: string;
address: string;
createdAt: string;
updatedAt: string;
};
type: string;
total: string;
connected_order_id: number;
transaction: boolean;
hex_raw_proposal: string;
isInstant: boolean;
}[];
}
```

View file

@ -0,0 +1,4 @@
{
"label": "Get active Tx by orders' Ids",
"position": 10
}

View file

@ -0,0 +1,29 @@
# Get active Tx by orders' Ids
> Get active transaction data by matching 2 orders.
> So you can check if the transaction is already confirmed by another user and/or get proposal hex.
- **METHOD**: <kbd>POST</kbd>
- **PATH**: `/api/transactions/get-active-tx-by-orders-ids`
#### Request:
```typescript
{
token: string;
firstOrderId: number;
secondOrderId: number;
}
```
#### Response:
```typescript
success: boolean;
data?: {
buy_order_id: number;
sell_order_id: number;
amount: string;
timestamp: number;
status: string;
creator: string;
hex_raw_proposal: string;
} | string // error message
```

View file

@ -0,0 +1,4 @@
{
"label": "Get info about a DEX trading pair",
"position": 8
}

View file

@ -0,0 +1,11 @@
# Get info about a DEX trading pair
- **METHOD**: <kbd>POST</kbd>
- **PATH**: `/api/dex/get-pair`
#### Request:
```typescript
{
id: number;
}
```

View file

@ -0,0 +1,4 @@
{
"label": "Overview",
"position": 1
}

View file

@ -0,0 +1,9 @@
# Trade API for custom bots
## Additional Resources
- [Zano Trade Dex](https://trade.zano.org)
- [Zano Documentation](https://docs.zano.org)
- [Ionic Swaps Overview](https://docs.zano.org/docs/build/confidential-assets/ionic-swaps)
## RestAPI ENDPOINTS
**base URL** - https://trade.zano.org

View file

@ -0,0 +1,4 @@
{
"label": "Ping activity checker",
"position": 9
}

View file

@ -0,0 +1,22 @@
# Ping activity checker
> *You should call this method every 10 seconds to keep the `instant` icon active, so users know that your bot will accept the order immediately.*
> ![instant icon](../../../../static/img/build/zano-trade-api/ping-activity-checker/instant.jpg)
- **METHOD**: <kbd>POST</kbd>
- **PATH**: `/api/dex/renew-bot`
#### Request:
```typescript
{
token: string;
orderId: number;
}
```
#### Response:
```typescript
sucess: boolean;
data?: string // error message
```

View file

@ -0,0 +1,4 @@
{
"label": "Authenticate in System",
"position": 2
}

View file

@ -0,0 +1,25 @@
# Authenticate in System
- **METHOD**: <kbd>POST</kbd>
- **PATH**: `/api/auth`
#### Request:
```typescript
{
data: {
address: string;
alias: string;
message: string;
signature: string;
};
neverExpires: boolean;
}
```
>Explanation of Fields:
>- To get ```data``` you should [sign some message using Zano wallet](https://docs.zano.org/docs/build/rpc-api/wallet-rpc-api/sign_message/) (random string)
#### Response:
```typescript
success: boolean;
data?: string // error message
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB