Stash API quick start
Request your Stash API key via Sprinter Stash Request or contacting support@sprinter.tech
As a Solver
Sprinter Stash enables solvers to borrow crosschain credit on-demand to execute user intents without needing pre-funded inventory.
This guide covers:
- Recap of the Stash Fill Lifecycle
- Requesting a Credit Borrow Cost Estimate
- Requesting a Final Borrow Quote and Credit Authorization
- Check out the Fill Optimization Tips
1. Stash Fill Lifecycle
2. Request a Credit Borrow Cost Estimate (Optional)
Call the Borrow Cost API to preview an estimated borrowing cost for a potential fill before requesting credit.
const baseUrl = "https://api.sprinter.tech";
const destChainId = "eip155:8453"; // eip155:8453(Base), eip155:10 (Optimism), eip155:42161 (Arbitrum) destChainId must use capid format from our configuration
const protocol = "across"; // "across" or "mayan"
const txHash = "string"; // Source chain deposit TX
const response = await fetch(
`${baseUrl}/liquidity/chain/${destChainId}/protocol/${protocol}/deposit/${txHash}/requests`,
{
method: "GET",
headers: {
"X-Auth-Token": "<your_api_key>",
},
body: {
input: callData, // encoded callData of deposit
caller: "address", // the address that will execute the borrow and fill ond destChainId
},
},
);
3. Request a Final Borrow Quote
If proceeding to fill with Sprinter Stash, call the Borrow Quote API to request a borrow quote to reserve credit and authorize the fill. This can be based on input or output amount.
const baseUrl = "https://api.sprinter.tech";
const sourceChainId = "eip155:8453"; // eip155:8453(Base), eip155:10 (Optimism), eip155:42161 (Arbitrum). ChainId must use capid format from our configuration
const protocol = "across"; // "across" or "mayan"
const type = "ExactInput"; // Request will consider the amount as (input amount - borrow costs)
const amount = 10000000; // This is the ExactInput eg 1 USDC (6 decimals)
const response = await fetch(
`${baseUrl}/liquidity/chain/${sourceChainId}/protocol/${protocol}/type/${type}/quote`,
{
method: "GET",
headers: {
"X-Auth-Token": "<your_api_key>",
},
body: {
amount: amount,
token: "destination_token_address", // Token address
network: "eip155:10", // Destination_Chain_ID
},
},
);
const borrowQuote = await response.json();
console.log("Expected amount:", borrowQuote.expectedOutput);
console.log("Borrow Cost:", borrowQuote.borrowCost);
const baseUrl = "https://api.sprinter.tech";
const sourceChainId = "eip155:8453"; // eip155:8453(Base), eip155:10 (Optimism), eip155:42161 (Arbitrum). ChainId must use capid format from our configuration
const protocol = "across"; // "across" or "mayan"
const type = "ExactOutput"; // Request will consider the amount as (output amount + borrow costs)
const amount = 10000000; // This is the ExactInput eg 1 USDC (6 decimals)
const response = await fetch(
`${baseUrl}/liquidity/chain/${sourceChainId}/protocol/${protocol}/type/${type}/quote`,
{
method: "GET",
headers: {
"X-Auth-Token": "<your_api_key>",
},
body: {
amount: amount,
token: "destination_token_address", // Token address
network: "eip155:10", // Destination_Chiain_ID
},
},
);
const borrowQuote = await response.json();
console.log("Expected Input:", borrowQuote.requiredInput);
console.log("Borrow Cost:", borrowQuote.borrowCost);
4. Fill Optimization Tips
Here are some tips on getting the best performance and profit from your Sprinter Stash integration:
-
Pre-fetch Borrow Cost - Call
GET /type/{type}/quote
as early as possible (when detecting intents) to evaluate solver profitability. -
Batch Gas Where Possible - Bundle execution and repayment transactions to reduce gas costs.
-
Optimize for Slippage - Query quotes close to execution time to reduce stale pricing or slippage-induced fills.
-
Handling Rate Limits - If you hit 429s, give it a moment and retry using retry_after value. You can request higher limits via support@sprinter.tech.
-
Validate Transaction Hash Early - Ensure the user intent transaction is final and not reverted before calling
/deposit/{txHash}/request
.