Skip to content

Commit 4f3e3fb

Browse files
authored
Merge pull request #339 from saakshiraut28/main
Add solana and update get order details docs.
2 parents 4ffb591 + 9cfebd9 commit 4f3e3fb

9 files changed

Lines changed: 196 additions & 77 deletions

File tree

content/docs/openapi/(Intents)/intents.mdx

Lines changed: 94 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ full: false
66

77
import FeatureCard from "app/components/mdx/FeatureCard";
88
import ExternalLink from "app/components/mdx/ExternalLink";
9+
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
910
import { IoPersonOutline, IoFlashOutline, IoShieldCheckmarkOutline } from 'react-icons/io5';
1011

1112
Intents are high-level abstractions for on-chain actions. Instead of constructing and managing low-level blockchain transactions, you describe what you want to achieve—the intent—and Okto handles all the technical complexity behind the scenes.
@@ -237,39 +238,106 @@ The essential parameters you provide within the `transactions` array vary by blo
237238
|---|---|---|
238239
| **EVM Chains** | `to`, `value`, `data`, `from` | Recipient address, native token amount (wei), encoded function call, sender wallet |
239240
| **Aptos** | `function`, `type_arguments`, `arguments` | Function identifier, type parameters, function arguments |
240-
| **Solana** | Coming soon | Instruction-based format |
241+
| **Solana** | `instructions`, `signer` | List of instructions (accounts, program ID, encoded data) and the signer's public key for transaction authorization. |
241242

242243
**API Endpoints:**
243244
- **Estimate:** [`/api/oc/v1/estimate`](/docs/openapi/raw-transaction-estimate)
244245
- **Execute:** [`/api/oc/v1/execute`](/docs/openapi/raw-transaction-execute)
245246

246247
The payload requires a `transactions` array, where each object represents a single contract call.
247248

248-
Example payload for an EVM chain:
249+
<Tabs items={["EVM", "Aptos", "Solana"]}>
250+
<Tab value="EVM">
249251

250-
```json
251-
{
252-
"type": "RAW_TRANSACTION",
253-
"jobId": "<unique-uuid-v4>",
254-
"details": {
255-
"caip2Id": "eip155:84532",
256-
"transactions": [
257-
{
258-
"to": "0x363653DE3f920Ec8710b1Fc01e24Df96Bf7fb15E",
259-
"from": "0xA8c1021b6322e5fF8e059295fa027A1380789037",
260-
"value": "0x0",
261-
"data": "0x6057361d0000000000000000000000000000000000000000000000000000000000000005"
262-
}
263-
]
264-
},
265-
// Other fields like gasDetails, paymasterData
266-
}
267-
```
268-
**Key `transactions` Object Fields for EVM Chains:**
269-
- `to`: The target smart contract address you want to interact with.
270-
- `from`: The user's smart wallet address on the specified chain.
271-
<Callout type="warn" title="Important">The `from` address **must** be the user's smart wallet address for that network. You can retrieve this address using the [Get Account](/docs/openapi/explorer/get-wallets) endpoint.</Callout>
272-
- `value`: The amount of native currency (in hex format) to send with the transaction (e.g., `"0x0"` for no value).
273-
- `data`: The ABI-encoded function call, including the function signature and parameters. You can use tools like `viem` or the [ABI Encoder](https://docs.okto.tech/tools) to generate this.
252+
#### Example payload for EVM Chains
253+
```json
254+
{
255+
"type": "RAW_TRANSACTION",
256+
"jobId": "<unique-uuid-v4>",
257+
"details": {
258+
"caip2Id": "eip155:84532", // BASE_TESTNET
259+
"transactions": [
260+
{
261+
"to": "0x363653DE3f920Ec8710b1Fc01e24Df96Bf7fb15E",
262+
"from": "0xA8c1021b6322e5fF8e059295fa027A1380789037",
263+
"value": "0x0",
264+
"data": "0x6057361d0000000000000000000000000000000000000000000000000000000000000005"
265+
}
266+
]
267+
},
268+
// Other fields like gasDetails, paymasterData
269+
}
270+
```
271+
**Key `transactions` Object Fields for EVM Chains:**
272+
- `to`: The target smart contract address you want to interact with.
273+
- `from`: The user's smart wallet address on the specified chain.
274+
<Callout type="warn" title="Important">The `from` address **must** be the user's smart wallet address for that network. You can retrieve this address using the [Get Account](/docs/openapi/explorer/get-wallets) endpoint.</Callout>
275+
- `value`: The amount of native currency (in hex format) to send with the transaction (e.g., `"0x0"` for no value).
276+
- `data`: The ABI-encoded function call, including the function signature and parameters. You can use tools like `viem` or the [ABI Encoder](https://docs.okto.tech/tools) to generate this.
277+
278+
</Tab>
279+
<Tab value="Aptos">
280+
281+
#### Example payload for Aptos Chain
282+
```json
283+
{
284+
"type": "RAW_TRANSACTION",
285+
"jobId": "<unique-uuid-v4>",
286+
"details": {
287+
"caip2Id": "aptos:testnet", // APTOS_TESTNET
288+
"transaction": {
289+
"function": "0x1::aptos_account::transfer",
290+
"typeArguments": [],
291+
"functionArguments": [
292+
"0x9ed7f8c95c5e2c3cb06dfbb48681b87401fabeb88b7d710db3720f7a2ca3fffc",
293+
"10000"
294+
]
295+
}
296+
},
297+
// Other fields like gasDetails, paymasterData
298+
}
299+
```
300+
**Key `transactions` Object Fields for Aptos Chain:**
301+
- `function`: The identifier of the Move function to invoke on-chain.
302+
- `typeArguments`: An array of type arguments to pass to the function, if applicable.
303+
- `functionArguments`: An array of arguments to pass to the Move function.
304+
305+
</Tab>
306+
<Tab value="Solana">
307+
#### Example payload for Solana Chain
308+
```json
309+
{
310+
"type": "RAW_TRANSACTION",
311+
"jobId": "<unique-uuid-v4>",
312+
"details": {
313+
"caip2Id": "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", // SOLANA_DEVNET
314+
"transaction": {
315+
"instructions": [
316+
{
317+
"keys": [
318+
{
319+
"pubkey": "CEGakCfWiBEUsh1vENRjZz26SiiVCu88ySjSPbRN7rsh",
320+
"isSigner": true,
321+
"isWritable": true
322+
}
323+
],
324+
"programId": "BTSdutYFqgaecPtnEcEefPUBsLUu6i2o1xsLrdfqKV4T",
325+
"data": [102, 232, 96, 233, 198, 89, 95, 116]
326+
}
327+
],
328+
"signer": "CEGakCfWiBEUsh1vENRjZz26SiiVCu88ySjSPbRN7rsh"
329+
}
330+
},
331+
// Other fields like gasDetails, paymasterData
332+
}
333+
```
334+
**Key `transactions` Object Fields for Solana Chain:**
335+
- `instructions`: An array of Solana instructions containing:
336+
- `keys`: Account metas involved in the instruction, specifying `pubkey`, `isSigner`, and `isWritable`.
337+
- `programId`: The program you are calling on-chain.
338+
- `data`: An array of bytes representing the instruction data.
339+
- `signer`: The user's smart wallet address on Solana, which will sign the transaction.
340+
</Tab>
341+
</Tabs>
274342

275343
---

content/docs/trade-service/usage/get-best-route.mdx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,12 @@ _openapi:
77
toc: []
88
structuredData:
99
headings: []
10-
contents:
11-
- content: >-
12-
Find the most optimal route for swapping tokens across chains. This
13-
API determines the best path based on source/destination tokens,
14-
chains, amount, and user wallet addresses. Check out the
15-
[`getBestRoute`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api)
16-
API template script for implementation details.
10+
contents: []
1711
---
1812

1913
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
20-
14+
{/* x-description-md-start */}
2115
Find the most optimal route for swapping tokens across chains. This API determines the best path based on source/destination tokens, chains, amount, and user wallet addresses. Check out the [`getBestRoute`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.
16+
{/* x-description-md-end */}
2217

2318
<APIPage document={"./public/openapi/openapi-trade-service.json"} operations={[{"path":"/vpc/v1/get-best-route","method":"post"}]} webhooks={[]} hasHead={false} />

content/docs/trade-service/usage/get-call-data.mdx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,12 @@ _openapi:
77
toc: []
88
structuredData:
99
headings: []
10-
contents:
11-
- content: >-
12-
Generate the complete calldata required to execute a token swap
13-
transaction on-chain. This API prepares the encoded calldata based on
14-
the selected route, amount, tokens, slippage, and fee configurations.
15-
It supports both same-chain and cross-chain swaps and includes
16-
optional permit data for approvals. Check out the
17-
[`getCallData`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api)
18-
API template script for implementation details.
10+
contents: []
1911
---
2012

2113
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
22-
14+
{/* x-description-md-start */}
2315
Generate the complete calldata required to execute a token swap transaction on-chain. This API prepares the encoded calldata based on the selected route, amount, tokens, slippage, and fee configurations. It supports both same-chain and cross-chain swaps and includes optional permit data for approvals. Check out the [`getCallData`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.
24-
16+
{/* x-description-md-end */}
2517

2618
<APIPage document={"./public/openapi/openapi-trade-service.json"} operations={[{"path":"/vpc/v1/get-call-data","method":"post"}]} webhooks={[]} hasHead={false} />

content/docs/trade-service/usage/get-quote.mdx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@ _openapi:
77
toc: []
88
structuredData:
99
headings: []
10-
contents:
11-
- content: >-
12-
Fetch a real-time quote for swapping a specified token amount from one
13-
chain to another. Check out the
14-
[`getQuote`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api)
15-
API template script for implementation details.
10+
contents: []
1611
---
1712

1813
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
19-
14+
{/* x-description-md-start */}
2015
Fetch a real-time quote for swapping a specified token amount from one chain to another. Check out the [`getQuote`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.
16+
{/* x-description-md-end */}
2117

2218
<APIPage document={"./public/openapi/openapi-trade-service.json"} operations={[{"path":"/vpc/v1/get-quote","method":"post"}]} webhooks={[]} hasHead={false} />

content/docs/trade-service/usage/order-details.mdx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,25 @@ _openapi:
77
toc: []
88
structuredData:
99
headings: []
10-
contents:
11-
- content: >-
12-
Fetch detailed information about a previously registered swap intent
13-
using the order ID. This API returns the status, route, fee, swapper
14-
inputs/outputs, and execution steps associated with the order. It is
15-
typically used to track the progress or outcome of a swap intent.
16-
Check out the
17-
[`orderDetails`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api)
18-
API template script for implementation details.
10+
contents: []
1911
---
2012

2113
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
22-
14+
{/* x-description-md-start */}
2315
Fetch detailed information about a previously registered swap intent using the order ID. This API returns the status, route, fee, swapper inputs/outputs, and execution steps associated with the order. It is typically used to track the progress or outcome of a swap intent. Check out the [`orderDetails`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.
2416

17+
**Understanding Order Status**
18+
19+
The `orderData.status` field in the response indicates your order’s current state:
20+
21+
| Status Code | Description |
22+
|-------------|-------------|
23+
| `-1` | Order expired. The order did not register on-chain. Terminal state. |
24+
| `0` | Order received by the backend but not yet registered on-chain. |
25+
| `1` | Order registered on-chain but not yet filled. |
26+
| `2` | Order settled successfully. Terminal state. |
27+
| `3` | Order in dispute. The order was filled but not yet settled. |
28+
| `4` | Order refunded. The order was not filled, and user was refunded. Terminal state. |
29+
{/* x-description-md-end */}
30+
2531
<APIPage document={"./public/openapi/openapi-trade-service.json"} operations={[{"path":"/vpc/v1/order-details","method":"post"}]} webhooks={[]} hasHead={false} />

content/docs/trade-service/usage/register-intent.mdx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,12 @@ _openapi:
77
toc: []
88
structuredData:
99
headings: []
10-
contents:
11-
- content: >-
12-
Registers a swap intent on the system using a signed order. This API
13-
call is typically made after generating a quote and selecting a route,
14-
and before executing the actual swap. It ensures the swap details are
15-
securely logged and authorized for processing. Check out the
16-
[`registerIntent`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api)
17-
API template script for implementation details.
10+
contents: []
1811
---
1912

2013
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
21-
14+
{/* x-description-md-start */}
2215
Registers a swap intent on the system using a signed order. This API call is typically made after generating a quote and selecting a route, and before executing the actual swap. It ensures the swap details are securely logged and authorized for processing. Check out the [`registerIntent`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.
16+
{/* x-description-md-end */}
2317

2418
<APIPage document={"./public/openapi/openapi-trade-service.json"} operations={[{"path":"/vpc/v1/register","method":"post"}]} webhooks={[]} hasHead={false} />

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"build:api-reference-docs-explorer": "node ./scripts/generate-api-reference-docs-explorer.mjs",
1111
"build:api-reference-docs-auth": "node ./scripts/generate-api-reference-docs-auth.mjs",
1212
"build:api-reference-docs-intents": "node ./scripts/generate-api-reference-docs-intents.mjs",
13-
"build:trade-service-docs": "node ./scripts/generate-trade-service-docs.mjs"
13+
"build:trade-service-docs": "node ./scripts/generate-trade-service-docs.mjs",
14+
"postbuild:trade-service-docs": "node ./scripts/inject-x-description-md.mjs"
1415
},
1516
"dependencies": {
1617
"@algolia/autocomplete-js": "^1.18.1",

public/openapi/openapi-trade-service.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"post": {
3333
"tags": ["Usage"],
3434
"summary": "Get Quote",
35-
"description": "Fetch a real-time quote for swapping a specified token amount from one chain to another. Check out the [`getQuote`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.",
35+
"x-description-md": "Fetch a real-time quote for swapping a specified token amount from one chain to another. Check out the [`getQuote`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.",
3636
"operationId": "getQuote",
3737
"requestBody": {
3838
"required": true,
@@ -175,7 +175,7 @@
175175
"post": {
176176
"tags": ["Usage"],
177177
"summary": "Get Best Route",
178-
"description": "Find the most optimal route for swapping tokens across chains. This API determines the best path based on source/destination tokens, chains, amount, and user wallet addresses. Check out the [`getBestRoute`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.",
178+
"x-description-md": "Find the most optimal route for swapping tokens across chains. This API determines the best path based on source/destination tokens, chains, amount, and user wallet addresses. Check out the [`getBestRoute`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.",
179179
"operationId": "getBestRoute",
180180
"requestBody": {
181181
"required": true,
@@ -424,7 +424,7 @@
424424
"post": {
425425
"tags": ["Usage"],
426426
"summary": "Register Intent",
427-
"description": "Registers a swap intent on the system using a signed order. This API call is typically made after generating a quote and selecting a route, and before executing the actual swap. It ensures the swap details are securely logged and authorized for processing. Check out the [`registerIntent`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.",
427+
"x-description-md": "Registers a swap intent on the system using a signed order. This API call is typically made after generating a quote and selecting a route, and before executing the actual swap. It ensures the swap details are securely logged and authorized for processing. Check out the [`registerIntent`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.",
428428
"operationId": "registerIntent",
429429
"requestBody": {
430430
"required": true,
@@ -514,7 +514,7 @@
514514
"post": {
515515
"tags": ["Usage"],
516516
"summary": "Get Order Details",
517-
"description": "Fetch detailed information about a previously registered swap intent using the order ID. This API returns the status, route, fee, swapper inputs/outputs, and execution steps associated with the order. It is typically used to track the progress or outcome of a swap intent. Check out the [`orderDetails`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.",
517+
"x-description-md": "Fetch detailed information about a previously registered swap intent using the order ID. This API returns the status, route, fee, swapper inputs/outputs, and execution steps associated with the order. It is typically used to track the progress or outcome of a swap intent. Check out the [`orderDetails`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.\n\n**Understanding Order Status**\n\nThe `orderData.status` field in the response indicates your order’s current state:\n\n| Status Code | Description |\n|-------------|-------------|\n| `-1` | Order expired. The order did not register on-chain. Terminal state. |\n| `0` | Order received by the backend but not yet registered on-chain. |\n| `1` | Order registered on-chain but not yet filled. |\n| `2` | Order settled successfully. Terminal state. |\n| `3` | Order in dispute. The order was filled but not yet settled. |\n| `4` | Order refunded. The order was not filled, and user was refunded. Terminal state. |",
518518
"operationId": "orderDetails",
519519
"requestBody": {
520520
"required": true,
@@ -691,7 +691,7 @@
691691
"post": {
692692
"tags": ["Usage"],
693693
"summary": "Get Call Data",
694-
"description": "Generate the complete calldata required to execute a token swap transaction on-chain. This API prepares the encoded calldata based on the selected route, amount, tokens, slippage, and fee configurations. It supports both same-chain and cross-chain swaps and includes optional permit data for approvals. Check out the [`getCallData`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.",
694+
"x-description-md": "Generate the complete calldata required to execute a token swap transaction on-chain. This API prepares the encoded calldata based on the selected route, amount, tokens, slippage, and fee configurations. It supports both same-chain and cross-chain swaps and includes optional permit data for approvals. Check out the [`getCallData`](https://github.com/okto-hq/okto-sdkv2-trade-service-template-app/tree/main/src/api) API template script for implementation details.",
695695
"operationId": "getCallData",
696696
"requestBody": {
697697
"required": true,

0 commit comments

Comments
 (0)