Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.pull-request.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBWALLET_API=https://be-dev-05.subwallet.app/api
Original file line number Diff line number Diff line change
Expand Up @@ -4655,6 +4655,7 @@ export default class KoniExtension {
}

private async getLatestSwapQuote (swapRequest: SwapRequest): Promise<SwapQuoteResponse> {
// TODO (Issue-4791): this function must know previous picked quote to re-call that quote only.
const { swapQuoteResponse } = await this.#koniState.swapService.getLatestQuoteFromSwapRequest(swapRequest);

return swapQuoteResponse;
Expand Down
8 changes: 8 additions & 0 deletions packages/extension-base/src/services/swap-service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ export class SwapService implements StoppableServiceInterface {
* 4. Generate optimal process for that quote
* */

// TODO (Issue-4791): There are 2 ways:
// 1. find best quote and path, the logic here will remain same as before.
// 2. return all available (path, swapQuoteResponse). Need to update all affected uses of these two data.
const { path, swapQuoteResponse } = await this.getLatestQuoteFromSwapRequest(request);

console.group('Swap Logger');
Expand Down Expand Up @@ -207,6 +210,7 @@ export class SwapService implements StoppableServiceInterface {
let availablePath: SwapPath | undefined;

try {
// TODO (Issue-4791): findAvailablePath return SwapPath[] instead of SwapPath
availablePath = await subwalletApiSdk.swapApi.findAvailablePath(request);
} catch (e) {
console.log('Error findAvailablePath', e);
Expand Down Expand Up @@ -241,8 +245,12 @@ export class SwapService implements StoppableServiceInterface {
directSwapRequest.isCrossChain = true;
}

// TODO (Issue-4791): this function used to find all quotes and also the best quote of a path.
// In case we have many paths, we can also try finding best quote of all paths.
const swapQuoteResponse = await this.getLatestDirectQuotes(directSwapRequest);

// TODO (Issue-4791): return complex data include many (path, swapQuoteResponse) object.
// In fact, the current swapQuoteResponse included all quotes belong to the path.
return {
path,
swapQuoteResponse
Expand Down
Loading