Skip to content

docs: getQuote API #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

docs: getQuote API #48

wants to merge 1 commit into from

Conversation

0xtiti
Copy link
Collaborator

@0xtiti 0xtiti commented Jul 17, 2025

We've identified a key missing piece is a standardized API for requesting quotes with multi-chain inputs. This API should handle:

  1. Users have assets spread across multiple chains
  2. Providers should either return a single optimal quote or multiple options
  3. Another option is the endpoint would accept user balances across chains and desired output, returning recommended inputs

// priority: which token the user prefeer to spend (e.g., 0 = Max Priority)
userBalances: Map<chainId, {balance, tokenAddress, priority}>

// Desired amount to receive on target chain (as integer string in wei)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should consider the target outputs to be a mapping as well, accepting multiple desired outputs

targetTokenAddress: string

// Optional: specify which routing algorithm to use
algorithm?: 'greedy' | 'dynamic-programming' | 'dijkstra' | 'multi-objective' | 'genetic' | 'simulated-annealing' | 'ant-colony' | 'a-star'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the server does not support this configuration, should it return an error or simply ignore it?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could return a NotValidAttribute error, and if the algorithm attribute is valid but the algorithm is not there, we could return a NotFoundAlgorithm error, mentioning the implemented algorithms

}>

// Sum of all fees across all steps (in wei of respective native tokens)
totalFee: string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this work if there are multiple native tokens involved? We should consider this to be an array of objects (network, fee)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right let's change this for usdTotalFee and then they have each fee inside each step


### **Disadvantages:**

- **Limited Transparency**: Users cannot see alternative options or understand trade-offs

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can potentially change the response format to be an array of options, each option being the currently proposed schema, but allowing solvers to return different options that the client then can decide to show to the users

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good idea.


- **Limited Transparency**: Users cannot see alternative options or understand trade-offs
- **Reduced Control**: Wallets cannot implement custom routing preferences
- **Trust Dependency**: Users must trust the server's optimization choices

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not the definition of an intent? Users do not need to worry about middle steps, and rather select the better output.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. But anyway, I think it's worth mentioning it as a disadvantage to see the trade-offs between approaches.

Like, Approach 2: Client-Side Route Calculation plus a Route endpoint would still have Users do not need to worry about middle steps but also give flexibility for those who want to see what's happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants