Skip to content

Commit

Permalink
revise client interface
Browse files Browse the repository at this point in the history
  • Loading branch information
novaliu86 committed Jun 29, 2024
1 parent d28fc76 commit dedfad4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ISwapResponse, ITokenPrice, ITokenStaticInfo } from "./common/interfaces.js";
import type { TokenOperation } from "./common/routingPlan.js";

const resolveErrorAsync = async (response: Response): Promise<{ succeeded: boolean; error: any; }> => {

Expand Down Expand Up @@ -121,7 +120,7 @@ export class SwapnetClient {

public async getTokenPricesAsync(
chainId: number,
tokenOps: TokenOperation [],
tokens: string [],
): Promise<{
succeeded: true,
tokenPrices: ITokenPrice [],
Expand All @@ -133,7 +132,7 @@ export class SwapnetClient {
const url = `${this._baseUrl}/api/${this._apiVersion}/prices?` +
`apiKey=${this._apiKey}&` +
`chainId=${chainId}&` +
`tokens=${tokenOps.map(o => o.tokenInfo.address).join(',')}`;
`tokens=${tokens.join(',')}`;

const response = await fetch(url);
const { succeeded, error } = await resolveErrorAsync(response);
Expand Down

0 comments on commit dedfad4

Please sign in to comment.