Skip to content

Commit 4c40ad4

Browse files
author
itsbobbyz
committed
Update of API integration guide
1 parent d66095a commit 4c40ad4

9 files changed

+307
-234
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
## [0.3.12](https://github.com/sprintertech/sprinter-sdk/compare/docs-v0.3.11...docs-v0.3.12) (2025-10-31)
44

5-
65
### Bug Fixes
76

8-
* Update to solve api for gas limits ([#193](https://github.com/sprintertech/sprinter-sdk/issues/193)) ([f8e77a6](https://github.com/sprintertech/sprinter-sdk/commit/f8e77a667db859a184812db4d69d6a38c20776fc))
7+
- Update to solve api for gas limits ([#193](https://github.com/sprintertech/sprinter-sdk/issues/193)) ([f8e77a6](https://github.com/sprintertech/sprinter-sdk/commit/f8e77a667db859a184812db4d69d6a38c20776fc))
98

109
## [0.3.11](https://github.com/sprintertech/sprinter-sdk/compare/docs-v0.3.10...docs-v0.3.11) (2025-10-09)
1110

docs/docs/01-introduction/01-introduction.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ sidebar_position: 1
66
---
77

88
<div class="logo-container">
9-
<img src="/img/sprinter-header.png" class="logo-light-mode" alt="Sprinter Logo Black" />
10-
<img src="/img/sprinter-header.png" class="logo-dark-mode" alt="Sprinter Logo White" />
9+
<img src="/img/credit header.png" class="logo-light-mode" alt="Sprinter Logo Black" />
10+
<img src="/img/credit header.png" class="logo-dark-mode" alt="Sprinter Logo White" />
1111
</div>
1212

1313
#
@@ -16,13 +16,15 @@ Sprinter envisions a decentralized, open and equitable financial system that pro
1616

1717
# What is Sprinter?
1818

19-
Sprinter combines solving-as-a-service infrastructure with credit-based crosschain liquidity. It enables solvers to borrow and execute onchain actions without pre-funded inventory, while giving dApps and protocols access to best-in-class execution routes, powered by the Project Blanc advanced solving technology.
19+
Sprinter combines solving-as-a-service infrastructure with credit-based crosschain liquidity. It enables venues to borrow and execute onchain actions without pre-funded inventory, while giving dApps and protocols access to best-in-class execution routes, powered by the Project Blanc advanced solving technology.
2020

2121
## Sprinter’s Core Products
2222

2323
### [Sprinter Stash](Stash)
2424

25-
A crosschain credit protocol providing liquidity access to solvers and market makers without requiring collateral. Liquidity providers deposit USDC into the protocol, earning returns through solver fees and passive yield strategies.
25+
Sprinter Stash is a universal credit protocol that powers the next-generation of use cases, from solver credit lines to trading, whilst rewarding LPs with sustainable, risk-managed stablecoin yield.
26+
27+
Stash provides zero-collateral credit, so solvers don’t need capital, users don’t need to touch bridges, and dApps get instant fills.
2628

2729
### [Sprinter Solve](Solve)
2830

@@ -37,3 +39,4 @@ If you have questions about Sprinter, the code, the docs, or have a partnership
3739
- **Telegram:** [t.me/sprinter_tech](https://t.me/sprinter_tech)
3840
- **X:** [@sprinter_ux](https://x.com/sprinter_ux)
3941
- **Website:** [sprinter.tech](https://sprinter.tech)
42+
- **Blog:** [blog.sprinter.tech](https://blog.sprinter.tech)
Lines changed: 66 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
11
---
22
id: use-stash
3-
title: Stash API quick start
3+
title: Stash API Integration Guide
44
sidebar_position: 1
55
---
66

77
:::tip
88
Request your Stash API key via [Sprinter Stash Request](https://forms.gle/kgpcQK722Ley2gke7) or contacting [email protected]
99
:::
1010

11-
## As a Solver
11+
## For crosschain DeFi
1212

1313
Sprinter Stash enables solvers to **borrow crosschain credit on-demand** to execute user intents without needing pre-funded inventory.
1414

15-
This guide covers:
16-
17-
1. Recap of the [Stash Fill Lifecycle](use-stash#1-stash-solver-fill-lifecycle)
18-
2. Requesting a [Credit Borrow Quote Estimate](use-stash#2-request-a-credit-borrow-quote-estimate-optional)
19-
3. Requesting a [Final Borrow Cost and Credit Authorization](use-stash#3-request-the-final-credit-borrow-cost)
20-
4. Check out the [Fill Optimization Tips](use-stash#4-fill-optimization-tips)
21-
22-
### 1. Stash Fill Lifecycle
15+
## Overview of the Stash Fill Lifecycle
2316

2417
<div style={{ display: "flex", justifyContent: "center" }}>
2518

@@ -35,107 +28,83 @@ flowchart TD
3528
H --> I[Intent Protocol Repays Borrowed Credit + Costs]
3629
I --> J[Fill Complete]
3730
38-
click B "use-stash#2-request-a-borrow-cost-estimate-optional" "Borrow Cost"
31+
click B "borrow-quote-api" "Borrow Cost"
3932
style B fill:#FF9B43,stroke:#333,stroke-width:2px,color:#000,font-weight:bold
4033
41-
click E "use-stash#3-request-a-final-borrow-quote" "Borrow Quote"
34+
click E "borrow-cost-api" "Borrow Quote"
4235
style E fill:#FF9B43,stroke:#333,stroke-width:2px,color:#000,font-weight:bold
4336
4437
```
4538

4639
</div>
4740

48-
### 2. Request a Credit Borrow Quote Estimate (Optional)
49-
50-
Call the [**Borrow Quote API**](borrow-quote-api) to preview an estimated borrowing cost for a potential fill before requesting credit. This can be based on input or output amount.
51-
52-
```ts title="Request Borrow Quote Estimate with type ExactInput (input amount - borrow costs)"
53-
const baseUrl = "https://api.sprinter.tech";
54-
const sourceChainId = "eip155:8453"; // eip155:8453(Base), eip155:10 (Optimism), eip155:42161 (Arbitrum). ChainId must use capid format from our configuration
55-
const protocol = "across"; // "across" or "mayan"
56-
const type = "ExactInput"; // Request will consider the amount as (input amount - borrow costs)
57-
const amount = 10000000; // This is the ExactInput eg 1 USDC (6 decimals)
58-
const response = await fetch(
59-
`${baseUrl}/liquidity/chain/${sourceChainId}/protocol/${protocol}/type/${type}/quote`,
60-
{
61-
method: "GET",
62-
headers: {
63-
"X-Auth-Token": "<your_api_key>",
64-
},
65-
body: {
66-
amount: amount,
67-
token: "destination_token_address", // Token address
68-
network: "eip155:10", // Destination_Chain_ID
69-
},
70-
},
71-
);
72-
73-
const borrowQuote = await response.json();
74-
console.log("Expected amount:", borrowQuote.expectedOutput);
75-
console.log("Borrow Cost:", borrowQuote.borrowCost);
76-
```
41+
## How Stash Enables Zero-Collateral Loans
7742

78-
```ts title="Request Final Borrow Quote Estimate with type ExactOutput (output amount + borrow costs)"
79-
const baseUrl = "https://api.sprinter.tech";
80-
const sourceChainId = "eip155:8453"; // eip155:8453(Base), eip155:10 (Optimism), eip155:42161 (Arbitrum). ChainId must use capid format from our configuration
81-
const protocol = "across"; // "across" or "mayan"
82-
const type = "ExactOutput"; // Request will consider the amount as (output amount + borrow costs)
83-
const amount = 10000000; // This is the ExactInput eg 1 USDC (6 decimals)
84-
const response = await fetch(
85-
`${baseUrl}/liquidity/chain/${sourceChainId}/protocol/${protocol}/type/${type}/quote`,
86-
{
87-
method: "GET",
88-
headers: {
89-
"X-Auth-Token": "<your_api_key>",
90-
},
91-
body: {
92-
amount: amount,
93-
token: "destination_token_address", // Token address
94-
network: "eip155:10", // Destination_Chiain_ID
95-
},
96-
},
97-
);
98-
99-
const borrowQuote = await response.json();
100-
101-
console.log("Expected Input:", borrowQuote.requiredInput);
102-
console.log("Borrow Cost:", borrowQuote.borrowCost);
103-
```
43+
Sprinter Stash enables solvers to borrow liquidity with near zero collateral, and achieves this through a series of mechanisms below:
10444

105-
### 3. Request the final Credit Borrow Cost
106-
107-
If proceeding to fill with Sprinter Stash, call the [**Borrow Cost API**](borrow-cost-api) to request the final borrow cost to reserve credit and authorize the fill.
108-
109-
```ts title="Fetch Borrow Cost Example Payload"
110-
const baseUrl = "https://api.sprinter.tech";
111-
const destChainId = "eip155:8453"; // eip155:8453(Base), eip155:10 (Optimism), eip155:42161 (Arbitrum) destChainId must use capid format from our configuration
112-
const protocol = "across"; // "across" or "mayan"
113-
const txHash = "string"; // Source chain deposit TX
114-
const response = await fetch(
115-
`${baseUrl}/liquidity/chain/${destChainId}/protocol/${protocol}/deposit/${txHash}/requests`,
116-
{
117-
method: "GET",
118-
headers: {
119-
"X-Auth-Token": "<your_api_key>",
120-
},
121-
body: {
122-
input: "callData", // encoded callData for destination ( Borrow & Fill) it also contains depositData prams for MPC validation
123-
caller: "address", // the address that will execute the borrow and fill ond destChainId
124-
},
125-
},
126-
);
127-
```
45+
#### 1. Approved Solvers
46+
47+
On launch only approved solvers can access Stash credit. These solvers:
48+
49+
- Undergo screening and onboarding by the Sprinter team
50+
- Must use authenticated API keys tied to their accounts
51+
- Are rate-limited and monitored to ensure responsible usage
52+
53+
Sprinter also tracks solver performance and creditworthiness over time. Solvers who consistently repay on time may be granted higher limits, while misbehavior results in penalties or revoked access with both informed through regular reviews of:
54+
55+
- Fill accuracy and repayment behavior
56+
- Volume solved and protocols interacted with
57+
- On-chain and off-chain repayment events
58+
59+
#### 2. Transaction-Level Guarantees
60+
61+
Each fill is validated against the user’s original intent using:
62+
63+
- Verified source deposits (e.g. via Across)
64+
- MPC-signed authorization signatures
65+
- Controlled function execution (via calldata)
12866

129-
### 4. Fill Optimization Tips
67+
Sprinter acts as an intermediary: the solver never touches user funds directly. The system ensures that repayment is guaranteed by the user's transaction on the source chain before the solver receives liquidity.
13068

131-
Here are some tips on getting the best performance and profit from your Sprinter Stash integration:
69+
#### 3. Protocol Guardrails & Limits
13270

133-
1. **Pre-fetch Borrow Cost** - Call `GET /type/{type}/quote` as early as possible (when detecting intents) to evaluate solver profitability.
71+
Sprinter enforces:
72+
73+
- Per-solver daily limits (to minimize exposure)
74+
- Per-transaction liquidity caps
75+
- Circuit breakers triggered by irregular repayment behavior
76+
- Slashing (or bond requirements) for higher-risk integrations
77+
78+
#### 4. Bonding Pools
79+
80+
Sprinter will also allow Solver Operators to create Bonding Pools, that escrow funds to vouch for their solvers, enabling more favourable borrowing conditions. Sprinter Bonding Pools will be controlled by governance and similarly allow slashing by governance for any malicious activity or violations.
81+
82+
## Stash Fees
83+
84+
Sprinter Stash handles crosschain liquidity fills. Revenue is generated from the spread between between the amount the user deposited on source and the amount provided on the destination.
85+
86+
### Revenue Components
87+
88+
- **Fill Revenue:** Amount user deposits on source - amount send to user on destination
89+
- **Borrow Costs:** Cost of liquidity borrowing and crosschain repayment.
90+
- **Solver Costs:** Gas fees and execution costs fronted by solvers.
91+
92+
### Profit Calculation
93+
94+
```
95+
Fill Profit = Fill Revenue - Borrow Costs - Solver Costs
96+
```
13497

135-
2. **Batch Gas Where Possible** - Bundle execution and repayment transactions to reduce gas costs.
98+
### Monthly Distribution
13699

137-
3. **Optimize for Slippage** - Query quotes close to execution time to reduce stale pricing or slippage-induced fills.
100+
1. Withdraw raw profits from liquidity pools.
101+
2. Deduct solver gas costs.
102+
3. Distribute monthly fill profits to:
138103

139-
4. **Handling Rate Limits** - If you hit 429s, give it a moment and retry using retry_after value. You can request higher limits via [email protected].
104+
| Actor | Description | Fill Profit % |
105+
| -------- | ------------------------------------- | ------------- |
106+
| Solvers | For executing fills | 50% |
107+
| LPs | For providing liquidity | 50% |
108+
| Treasury | Protocol growth & sustainability fund | TBD |
140109

141-
5. **Validate Transaction Hash Early** - Ensure the user intent transaction is final and not reverted before calling `/deposit/{txHash}/request`.
110+
➡️ _Initial fee split is reviewed monthly by governance._

docs/docs/02-Stash/03-get-the-borrow-quote-for-a-liquidity-transaction-based-on-the-input-data.api.mdx

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,13 @@ import Heading from "@theme/Heading";
3030
context={"endpoint"}
3131
></MethodEndpoint>
3232

33-
A [borrow quote](/Resources/glossary#stash-borrow-quote) is the **preliminary estimated fee** a solver would incur to borrow credit from Sprinter Stash. It is returned off-chain via the Stash API and helps solvers determine if pursuing a fill is profitable.
34-
35-
Borrow quote includes expected gas, risk premiums, protocol fees, and capital access costs — but it is not a binding or reserved price.
33+
## Borrow quote overview
3634

37-
See the [Request a Credit Borrow Quote Estimate example payload](use-stash#2-request-a-credit-borrow-quote-estimate-optional).
35+
A [borrow quote](/Resources/glossary#stash-borrow-quote) is the **preliminary estimated fee** a solver would incur to borrow credit from Sprinter Stash. It is returned off-chain via the Stash API and helps solvers determine if pursuing a fill is profitable.
3836

39-
A [borrow quote](/Resources/glossary#stash-borrow-quote) is the final, **authorized borrowing offer** issued by Sprinter Stash when a solver decides to proceed with a fill.
40-
It reserves credit under specific conditions, allowing solvers to confidently execute the cross-chain transaction.
37+
Borrow quote includes expected gas, risk premiums, protocol fees, and capital access costs — but it is not a binding or reserved price. This can be based on input or output amount.
4138

42-
See the [Request Final Borrow Quote example payload](/Stash/use-stash#3-request-a-final-borrow-quote).
39+
See the [Request a Credit Borrow Quote Estimate example payload](borrow-quote-api#example-borrow-quote-payload).
4340

4441
<Heading
4542
id={"request"}
@@ -204,3 +201,58 @@ See the [Request Final Borrow Quote example payload](/Stash/use-stash#3-request-
204201
},
205202
}}
206203
></StatusCodes>
204+
205+
## Example Borrow Quote payload
206+
207+
```ts title="Request Borrow Quote Estimate with type ExactInput (input amount - borrow costs)"
208+
const baseUrl = "https://api.sprinter.tech";
209+
const sourceChainId = "eip155:8453"; // eip155:8453(Base), eip155:10 (Optimism), eip155:42161 (Arbitrum). ChainId must use capid format from our configuration
210+
const protocol = "across"; // "across" or "mayan"
211+
const type = "ExactInput"; // Request will consider the amount as (input amount - borrow costs)
212+
const amount = 10000000; // This is the ExactInput eg 1 USDC (6 decimals)
213+
const response = await fetch(
214+
`${baseUrl}/liquidity/chain/${sourceChainId}/protocol/${protocol}/type/${type}/quote`,
215+
{
216+
method: "GET",
217+
headers: {
218+
"X-Auth-Token": "<your_api_key>",
219+
},
220+
body: {
221+
amount: amount,
222+
token: "destination_token_address", // Token address
223+
network: "eip155:10", // Destination_Chain_ID
224+
},
225+
},
226+
);
227+
228+
const borrowQuote = await response.json();
229+
console.log("Expected amount:", borrowQuote.expectedOutput);
230+
console.log("Borrow Cost:", borrowQuote.borrowCost);
231+
```
232+
233+
```ts title="Request Final Borrow Quote Estimate with type ExactOutput (output amount + borrow costs)"
234+
const baseUrl = "https://api.sprinter.tech";
235+
const sourceChainId = "eip155:8453"; // eip155:8453(Base), eip155:10 (Optimism), eip155:42161 (Arbitrum). ChainId must use capid format from our configuration
236+
const protocol = "across"; // "across" or "mayan"
237+
const type = "ExactOutput"; // Request will consider the amount as (output amount + borrow costs)
238+
const amount = 10000000; // This is the ExactInput eg 1 USDC (6 decimals)
239+
const response = await fetch(
240+
`${baseUrl}/liquidity/chain/${sourceChainId}/protocol/${protocol}/type/${type}/quote`,
241+
{
242+
method: "GET",
243+
headers: {
244+
"X-Auth-Token": "<your_api_key>",
245+
},
246+
body: {
247+
amount: amount,
248+
token: "destination_token_address", // Token address
249+
network: "eip155:10", // Destination_Chiain_ID
250+
},
251+
},
252+
);
253+
254+
const borrowQuote = await response.json();
255+
256+
console.log("Expected Input:", borrowQuote.requiredInput);
257+
console.log("Borrow Cost:", borrowQuote.borrowCost);
258+
```

docs/docs/02-Stash/04-get-the-borrow-cost-for-a-liquidity-transaction.api.mdx

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import Heading from "@theme/Heading";
3333
A [borrow cost](/Resources/glossary#stash-borrow-cost) is the final, **authorized borrowing offer** issued by Sprinter Stash when a solver decides to proceed with a fill.
3434
It reserves credit under specific conditions, allowing solvers to confidently execute the cross-chain transaction.
3535

36-
See the [Request Final Borrow Cost example payload](use-stash#3-request-the-final-credit-borrow-cost).
36+
See the [Request Final Borrow Cost example payload](borrow-cost-api#3-request-the-final-credit-borrow-cost) and check out the [optimization tips](borrow-cost-api#fill-optimization-tips)
3737

3838
<Heading
3939
id={"request"}
@@ -133,3 +133,39 @@ See the [Request Final Borrow Cost example payload](use-stash#3-request-the-fina
133133
},
134134
}}
135135
></StatusCodes>
136+
137+
## Example Borrow Cost payload
138+
139+
```ts title="Fetch Borrow Cost Example Payload"
140+
const baseUrl = "https://api.sprinter.tech";
141+
const destChainId = "eip155:8453"; // eip155:8453(Base), eip155:10 (Optimism), eip155:42161 (Arbitrum) destChainId must use capid format from our configuration
142+
const protocol = "across"; // "across" or "mayan"
143+
const txHash = "string"; // Source chain deposit TX
144+
const response = await fetch(
145+
`${baseUrl}/liquidity/chain/${destChainId}/protocol/${protocol}/deposit/${txHash}/requests`,
146+
{
147+
method: "GET",
148+
headers: {
149+
"X-Auth-Token": "<your_api_key>",
150+
},
151+
body: {
152+
input: "callData", // encoded callData for destination ( Borrow & Fill) it also contains depositData prams for MPC validation
153+
caller: "address", // the address that will execute the borrow and fill ond destChainId
154+
},
155+
},
156+
);
157+
```
158+
159+
## Fill Optimization Tips
160+
161+
Here are some tips on getting the best performance and profit from your Sprinter Stash integration:
162+
163+
1. **Pre-fetch Borrow Cost** - Call `GET /type/{type}/quote` as early as possible (when detecting intents) to evaluate solver profitability.
164+
165+
2. **Batch Gas Where Possible** - Bundle execution and repayment transactions to reduce gas costs.
166+
167+
3. **Optimize for Slippage** - Query quotes close to execution time to reduce stale pricing or slippage-induced fills.
168+
169+
4. **Handling Rate Limits** - If you hit 429s, give it a moment and retry using retry_after value. You can request higher limits via [email protected].
170+
171+
5. **Validate Transaction Hash Early** - Ensure the user intent transaction is final and not reverted before calling `/deposit/{txHash}/request`.

0 commit comments

Comments
 (0)