Skip to content

Commit 3f0f90e

Browse files
committed
initial api commit
1 parent f297e12 commit 3f0f90e

18 files changed

+10889
-4308
lines changed

.github/scripts/update-chains-fees.js

Lines changed: 0 additions & 162 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Convert OpenAPI YAML to JSON
2+
3+
on:
4+
push:
5+
paths:
6+
- 'api-reference/trails-api.gen.yaml'
7+
branches:
8+
- '**'
9+
10+
jobs:
11+
convert:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
fetch-depth: 0
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '18'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm install
29+
30+
- name: Convert YAML to JSON
31+
run: npm run convert-openapi
32+
33+
- name: Check for changes
34+
id: check_changes
35+
run: |
36+
git diff --exit-code api-reference/trails-api.gen.json || echo "changes=true" >> $GITHUB_OUTPUT
37+
38+
- name: Commit and push if changed
39+
if: steps.check_changes.outputs.changes == 'true'
40+
run: |
41+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
42+
git config --local user.name "github-actions[bot]"
43+
git add api-reference/trails-api.gen.json
44+
git commit -m "chore: auto-convert OpenAPI YAML to JSON"
45+
git push
46+

.github/workflows/update-chains-fees.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
title: CommitIntent
3+
openapi: ../trails-api.gen.json post /rpc/Trails/CommitIntent
4+
---
5+
6+
## Overview
7+
8+
The `CommitIntent` endpoint commits an intent to the Trails system, reserving the quote and preparing it for execution. This is a required step between getting a quote and executing the transaction.
9+
10+
## Use Cases
11+
12+
- Lock in a quote before execution
13+
- Reserve liquidity for the transaction
14+
- Prepare the intent for signing and execution
15+
- Transition from quoted to committed state
16+
17+
## Request Parameters
18+
19+
### Required Fields
20+
21+
- **intent** (Intent): The complete intent object returned from `QuoteIntent`
22+
23+
## Response
24+
25+
The response includes:
26+
27+
- **intentId** (string): Unique identifier for the committed intent
28+
29+
## Intent Lifecycle
30+
31+
```
32+
QuoteIntent → CommitIntent → ExecuteIntent → Receipt
33+
```
34+
35+
The `CommitIntent` step is crucial because it:
36+
1. Reserves the quoted rates
37+
2. Locks in the gas fee estimates
38+
3. Validates the intent parameters
39+
4. Creates a unique intent ID for tracking
40+
41+
## Example
42+
43+
```typescript
44+
// First, get a quote
45+
const quoteResponse = await fetch('https://api.trails.sequence.app/rpc/Trails/QuoteIntent', {
46+
method: 'POST',
47+
headers: {
48+
'Content-Type': 'application/json',
49+
'X-Access-Key': 'YOUR_ACCESS_KEY'
50+
},
51+
body: JSON.stringify(quoteRequest)
52+
});
53+
54+
const { intent, gasFeeOptions } = await quoteResponse.json();
55+
56+
// Then commit the intent
57+
const commitResponse = await fetch('https://api.trails.sequence.app/rpc/Trails/CommitIntent', {
58+
method: 'POST',
59+
headers: {
60+
'Content-Type': 'application/json',
61+
'X-Access-Key': 'YOUR_ACCESS_KEY'
62+
},
63+
body: JSON.stringify({ intent })
64+
});
65+
66+
const { intentId } = await commitResponse.json();
67+
console.log('Intent committed:', intentId);
68+
```
69+
70+
## Important Notes
71+
72+
<Warning>
73+
Committed intents have an expiration time. Make sure to execute the intent before it expires, or you'll need to get a new quote.
74+
</Warning>
75+
76+
<Info>
77+
The intent object from `QuoteIntent` can be modified before committing if you need to adjust parameters, but be aware that this may invalidate the quote.
78+
</Info>
79+
80+
## Next Steps
81+
82+
After committing an intent:
83+
1. Prepare the transaction signature using the provided intent details
84+
2. Execute the transaction with `ExecuteIntent`
85+
3. Monitor the transaction status with `GetIntentReceipt`
86+

0 commit comments

Comments
 (0)