Skip to content

Commit

Permalink
Merge branch 'master' into feat/ignoreBadUsdPrice
Browse files Browse the repository at this point in the history
  • Loading branch information
Velenir committed Jun 24, 2024
2 parents 9b3ca21 + c4f7abf commit 6f383d9
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/html/assets/search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/html/enums/_internal_.ParaSwapVersion.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h3 class="tsd-anchor-link"><span>V5</span><a href="#V5" aria-label="Permalink"
<li>Defined in node_modules/@paraswap/core/build/types.d.ts:65</li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum tsd-is-external"><a id="V6" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>V6</span><a href="#V6" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature">V6<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;6.1&quot;</span></div><aside class="tsd-sources">
<div class="tsd-signature">V6<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;6.2&quot;</span></div><aside class="tsd-sources">
<ul>
<li>Defined in node_modules/@paraswap/core/build/types.d.ts:66</li></ul></aside></section></section></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
Expand Down
4 changes: 2 additions & 2 deletions docs/html/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/html/types/GetRateFunctions.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h5>get<wbr/>Rate<span class="tsd-signature-symbol">: </span><a href="_internal_
<li class="tsd-parameter">
<h5>get<wbr/>Rate<wbr/>By<wbr/>Route<span class="tsd-signature-symbol">: </span><a href="_internal_.GetRateByRoute.html" class="tsd-signature-type" data-tsd-kind="Type alias">GetRateByRoute</a></h5></li></ul></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L71">src/methods/swap/rates.ts:71</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L70">src/methods/swap/rates.ts:70</a></li></ul></aside></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand Down
2 changes: 1 addition & 1 deletion docs/html/types/_internal_.CommonGetRateInput.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h5><code class="tsd-tag ts-flagOptional">Optional</code> src<wbr/>Decimals<span
<li class="tsd-parameter">
<h5><code class="tsd-tag ts-flagOptional">Optional</code> user<wbr/>Address<span class="tsd-signature-symbol">?: </span><a href="Address.html" class="tsd-signature-type" data-tsd-kind="Type alias">Address</a></h5></li></ul></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L43">src/methods/swap/rates.ts:43</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L42">src/methods/swap/rates.ts:42</a></li></ul></aside></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand Down
2 changes: 1 addition & 1 deletion docs/html/types/_internal_.GetRate.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h5>options: <a href="_internal_.GetRateInput.html" class="tsd-signature-type" d
<h5><code class="tsd-tag ts-flagOptional">Optional</code> signal: <span class="tsd-signature-type">AbortSignal</span></h5></li></ul></div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="OptimalRate.html" class="tsd-signature-type" data-tsd-kind="Type alias">OptimalRate</a><span class="tsd-signature-symbol">&gt;</span></h4></li></ul></li></ul></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L57">src/methods/swap/rates.ts:57</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L56">src/methods/swap/rates.ts:56</a></li></ul></aside></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand Down
2 changes: 1 addition & 1 deletion docs/html/types/_internal_.GetRateByRoute.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h5>options: <a href="_internal_.GetRateByRouteInput.html" class="tsd-signature-
<h5><code class="tsd-tag ts-flagOptional">Optional</code> signal: <span class="tsd-signature-type">AbortSignal</span></h5></li></ul></div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="OptimalRate.html" class="tsd-signature-type" data-tsd-kind="Type alias">OptimalRate</a><span class="tsd-signature-symbol">&gt;</span></h4></li></ul></li></ul></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L66">src/methods/swap/rates.ts:66</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L65">src/methods/swap/rates.ts:65</a></li></ul></aside></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand Down
2 changes: 1 addition & 1 deletion docs/html/types/_internal_.GetRateByRouteInput.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<h1>Type alias GetRateByRouteInput</h1></div>
<div class="tsd-signature">Get<wbr/>Rate<wbr/>By<wbr/>Route<wbr/>Input<span class="tsd-signature-symbol">:</span> <a href="_internal_.CommonGetRateInput.html" class="tsd-signature-type" data-tsd-kind="Type alias">CommonGetRateInput</a><span class="tsd-signature-symbol"> &amp; </span><span class="tsd-signature-symbol">{ </span>route<span class="tsd-signature-symbol">: </span><a href="AddressOrSymbol.html" class="tsd-signature-type" data-tsd-kind="Type alias">AddressOrSymbol</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L62">src/methods/swap/rates.ts:62</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L61">src/methods/swap/rates.ts:61</a></li></ul></aside></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand Down
2 changes: 1 addition & 1 deletion docs/html/types/_internal_.GetRateInput.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<h1>Type alias GetRateInput</h1></div>
<div class="tsd-signature">Get<wbr/>Rate<wbr/>Input<span class="tsd-signature-symbol">:</span> <a href="_internal_.CommonGetRateInput.html" class="tsd-signature-type" data-tsd-kind="Type alias">CommonGetRateInput</a><span class="tsd-signature-symbol"> &amp; </span><span class="tsd-signature-symbol">{ </span>destToken<span class="tsd-signature-symbol">: </span><a href="AddressOrSymbol.html" class="tsd-signature-type" data-tsd-kind="Type alias">AddressOrSymbol</a><span class="tsd-signature-symbol">; </span>srcToken<span class="tsd-signature-symbol">: </span><a href="AddressOrSymbol.html" class="tsd-signature-type" data-tsd-kind="Type alias">AddressOrSymbol</a><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L52">src/methods/swap/rates.ts:52</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L51">src/methods/swap/rates.ts:51</a></li></ul></aside></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand Down
4 changes: 1 addition & 3 deletions docs/html/types/_internal_.RateOptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
<li><a href="../modules/_internal_.html">&lt;internal&gt;</a></li>
<li><a href="_internal_.RateOptions.html">RateOptions</a></li></ul>
<h1>Type alias RateOptions</h1></div>
<div class="tsd-signature">Rate<wbr/>Options<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>adapterVersion<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>destTokenDexTransferFee<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>destTokenTransferFee<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>excludeContractMethods<span class="tsd-signature-symbol">?: </span><a href="../variables/ContractMethod-1.html" class="tsd-signature-type" data-tsd-kind="Variable">ContractMethod</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>excludeContractMethodsWithoutFeeModel<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>excludeDEXS<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>excludePools<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>excludePricingMethods<span class="tsd-signature-symbol">?: </span><a href="../enums/_internal_.PricingMethod.html" class="tsd-signature-type" data-tsd-kind="Enumeration">PricingMethod</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>includeContractMethods<span class="tsd-signature-symbol">?: </span><a href="../variables/ContractMethod-1.html" class="tsd-signature-type" data-tsd-kind="Variable">ContractMethod</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>includeDEXS<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>maxImpact<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>maxUSDImpact<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>otherExchangePrices<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>partner<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>srcTokenDexTransferFee<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>srcTokenTransferFee<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span></div>
<div class="tsd-signature">Rate<wbr/>Options<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>destTokenDexTransferFee<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>destTokenTransferFee<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>excludeContractMethods<span class="tsd-signature-symbol">?: </span><a href="../variables/ContractMethod-1.html" class="tsd-signature-type" data-tsd-kind="Variable">ContractMethod</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>excludeContractMethodsWithoutFeeModel<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>excludeDEXS<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>excludePools<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>excludePricingMethods<span class="tsd-signature-symbol">?: </span><a href="../enums/_internal_.PricingMethod.html" class="tsd-signature-type" data-tsd-kind="Enumeration">PricingMethod</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>includeContractMethods<span class="tsd-signature-symbol">?: </span><a href="../variables/ContractMethod-1.html" class="tsd-signature-type" data-tsd-kind="Variable">ContractMethod</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>includeDEXS<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>maxImpact<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>maxUSDImpact<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>otherExchangePrices<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>partner<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>srcTokenDexTransferFee<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>srcTokenTransferFee<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span></div>
<div class="tsd-type-declaration">
<h4>Type declaration</h4>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5><code class="tsd-tag ts-flagOptional">Optional</code> adapter<wbr/>Version<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5></li>
<li class="tsd-parameter">
<h5><code class="tsd-tag ts-flagOptional">Optional</code> dest<wbr/>Token<wbr/>Dex<wbr/>Transfer<wbr/>Fee<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span></h5></li>
<li class="tsd-parameter">
<h5><code class="tsd-tag ts-flagOptional">Optional</code> dest<wbr/>Token<wbr/>Transfer<wbr/>Fee<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span></h5></li>
Expand Down
4 changes: 2 additions & 2 deletions docs/md/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ There are multiple ways to use ParaSwap SDK, ranging from a simple construct-and

### Simple SDK

Can be created by providing `chainId` and either `axios` or `window.fetch` (or alternative `fetch` implementation). The resulting SDK will be able to use all methods that query the API.
Can be created by providing `chainId` and either `axios` or `window.fetch` (or alternative `fetch` implementation), and an optional `version` (`'5'` or `'6.2'`) parameter that corresponds to the API version SDK will be making requests to. The resulting SDK will be able to use all methods that query the API.

```ts
import { constructSimpleSDK } from '@paraswap/sdk';
Expand All @@ -38,7 +38,7 @@ Can be created by providing `chainId` and either `axios` or `window.fetch` (or a
// construct minimal SDK with fetcher only
const paraSwapMin = constructSimpleSDK({chainId: 1, axios});
// or
const paraSwapMin = constructSimpleSDK({chainId: 1, fetch: window.fetch});
const paraSwapMin = constructSimpleSDK({chainId: 1, fetch: window.fetch, version: '5'});

const ETH = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee';
const DAI = '0x6B175474E89094C44Da98b954EedeAC495271d0F';
Expand Down
2 changes: 1 addition & 1 deletion docs/md/enums/internal_.ParaSwapVersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ___

### V6

**V6** = ``"6.1"``
**V6** = ``"6.2"``

#### Defined in

Expand Down
2 changes: 1 addition & 1 deletion docs/md/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ ___

#### Defined in

[src/methods/swap/rates.ts:71](https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L71)
[src/methods/swap/rates.ts:70](https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L70)

___

Expand Down
11 changes: 5 additions & 6 deletions docs/md/modules/internal_.md
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ ___

#### Defined in

[src/methods/swap/rates.ts:43](https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L43)
[src/methods/swap/rates.ts:42](https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L42)

___

Expand Down Expand Up @@ -2008,7 +2008,7 @@ ___

#### Defined in

[src/methods/swap/rates.ts:57](https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L57)
[src/methods/swap/rates.ts:56](https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L56)

___

Expand All @@ -2033,7 +2033,7 @@ ___

#### Defined in

[src/methods/swap/rates.ts:66](https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L66)
[src/methods/swap/rates.ts:65](https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L65)

___

Expand All @@ -2043,7 +2043,7 @@ ___

#### Defined in

[src/methods/swap/rates.ts:62](https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L62)
[src/methods/swap/rates.ts:61](https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L61)

___

Expand All @@ -2053,7 +2053,7 @@ ___

#### Defined in

[src/methods/swap/rates.ts:52](https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L52)
[src/methods/swap/rates.ts:51](https://github.com/paraswap/paraswap-sdk/blob/master/src/methods/swap/rates.ts#L51)

___

Expand Down Expand Up @@ -2727,7 +2727,6 @@ ___

| Name | Type |
| :------ | :------ |
| `adapterVersion?` | `string` |
| `destTokenDexTransferFee?` | `number` |
| `destTokenTransferFee?` | `number` |
| `excludeContractMethods?` | [`ContractMethod`](../modules.md#contractmethod-1)[] |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paraswap/sdk",
"version": "6.7.0",
"version": "6.8.1",
"main": "dist/index.js",
"module": "dist/sdk.esm.js",
"typings": "dist/index.d.ts",
Expand Down
5 changes: 1 addition & 4 deletions src/methods/swap/rates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export type RateOptions = {
excludeContractMethods?: ContractMethod[];
includeContractMethods?: ContractMethod[];
excludeContractMethodsWithoutFeeModel?: boolean;
adapterVersion?: string;
partner?: string;
/** @description In %. It's a way to bypass the API price impact check (default = 15%) */
maxImpact?: number;
Expand Down Expand Up @@ -84,6 +83,7 @@ type SearchStringParams = CommonGetRateResult & {
srcToken: AddressOrSymbol;
destToken: AddressOrSymbol;
network: number;
version: string;
};

export const constructGetRate = ({
Expand Down Expand Up @@ -156,7 +156,6 @@ type CommonGetRateResult = {
excludeDEXS?: string;
includeDEXS?: string;
excludePools?: string;
version?: string;
excludePricingMethods?: string;
excludeContractMethods?: string;
includeContractMethods?: string;
Expand All @@ -176,7 +175,6 @@ function commonGetRateOptionsGetter({
excludePricingMethods,
excludeContractMethods,
includeContractMethods,
adapterVersion,
partner = DEFAULT_PARTNER,
includeDEXS,
excludeDEXS,
Expand All @@ -202,7 +200,6 @@ function commonGetRateOptionsGetter({
].map((array) => array?.join(',') || undefined);

return {
version: adapterVersion,
excludePricingMethods: _excludePricingMethods,
excludeContractMethods: _excludeContractMethods,
includeContractMethods: _includeContractMethods,
Expand Down

0 comments on commit 6f383d9

Please sign in to comment.