Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/swapsUtil.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ describe('SwapsUtil', () => {

it('should work for direct wrapping', async () => {
mockFetch({
'https://swap.api.cx.metamask.io/networks/1/trades?destinationToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&sourceToken=0x0000000000000000000000000000000000000000&sourceAmount=1000000000000000000&slippage=3&timeout=10000&walletAddress=0xB0dA5965D43369968574D399dBe6374683773a65&enableDirectWrapping=true':
'https://swap.api.cx.metamask.io/networks/1/trades?destinationToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&sourceToken=0x0000000000000000000000000000000000000000&sourceAmount=1000000000000000000&slippage=3&timeout=10000&walletAddress=0xB0dA5965D43369968574D399dBe6374683773a65&enableGasIncludedQuotes=false&enableDirectWrapping=true':
{ body: API_TRADES },
});

Expand All @@ -390,6 +390,7 @@ describe('SwapsUtil', () => {
destinationToken: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
sourceAmount: 1000000000000000000,
walletAddress: '0xB0dA5965D43369968574D399dBe6374683773a65',
enableGasIncludedQuotes: false,
},
null,
'0x1',
Expand Down
3 changes: 3 additions & 0 deletions src/swapsUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ export function getTokenMetadataURL(chainId: Hex): string {
* @param quoteParams.sourceAmount - Source token amount.
* @param quoteParams.destinationToken - Destination token address.
* @param quoteParams.walletAddress - Address to do the swap from.
* @param quoteParams.enableGasIncludedQuotes - Whether to include gas params in quotes.
* @param abortSignal - Abort signal.
* @param chainId - Current chainId.
* @param clientId - Client id.
Expand All @@ -264,6 +265,7 @@ export async function fetchTradesInfo(
sourceAmount,
destinationToken,
walletAddress,
enableGasIncludedQuotes,
}: APIFetchQuotesParams,
abortSignal: AbortSignal | null,
chainId: Hex,
Expand All @@ -276,6 +278,7 @@ export async function fetchTradesInfo(
slippage,
timeout: 10000,
walletAddress,
enableGasIncludedQuotes,
};

if (clientId) {
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export type APIFetchQuotesMetadata = {
* @property timeout - Timeout
* @property clientId - Client id
* @property enableDirectWrapping - Enable direct wrapping
* @property enableGasIncludedQuotes - Enable quotes with gas included
*/
export type APIFetchQuotesParams = {
slippage: number;
Expand All @@ -124,6 +125,7 @@ export type APIFetchQuotesParams = {
timeout?: number;
clientId?: string;
enableDirectWrapping?: boolean;
enableGasIncludedQuotes?: boolean;
};

/**
Expand Down
Loading