diff --git a/README.md b/README.md index 22bcc9fe..2126d136 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ You can see some examples in [/src/examples](src/examples) directory. ### Simple SDK -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. +Can be created by providing `chainId` and either `axios` or `window.fetch` (or alternative `fetch` implementation), and an optional `version` (`'5'` or `'6.1'`) 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'; diff --git a/docs/html/index.html b/docs/html/index.html index e2efc4ac..b1ce50f8 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -43,7 +43,7 @@
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.
Can be created by providing chainId
and either axios
or window.fetch
(or alternative fetch
implementation), and an optional version
('5'
or '6.1'
) 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.
import { constructSimpleSDK } from '@paraswap/sdk';
import axios from 'axios';
// construct minimal SDK with fetcher only
const paraSwapMin = constructSimpleSDK({chainId: 1, axios});
// or
const paraSwapMin = constructSimpleSDK({chainId: 1, fetch: window.fetch, version: '5'});
const ETH = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee';
const DAI = '0x6B175474E89094C44Da98b954EedeAC495271d0F';
async function swapExample() {
// or any other signer/provider
const signer: JsonRpcSigner = ethers.Wallet.fromMnmemonic('__your_mnemonic__');
const senderAddress = signer.address;
const priceRoute = await paraSwapMin.swap.getRate({
srcToken: ETH,
destToken: DAI,
amount: srcAmount,
userAddress: senderAddress,
side: SwapSide.SELL,
});
const txParams = await paraSwapMin.swap.buildTx(
{
srcToken,
destToken,
srcAmount,
destAmount,
priceRoute,
userAddress: senderAddress,
partner: referrer,
}
);
const transaction = {
...txParams,
gasPrice: '0x' + new BigNumber(txParams.gasPrice).toString(16),
gasLimit: '0x' + new BigNumber(5000000).toString(16),
value: '0x' + new BigNumber(txParams.value).toString(16),
};
const txr = await signer.sendTransaction(transaction);
}
If optional providerOptions
is provided as the second parameter, then the resulting SDK will also be able to approve Tokens for swap.
Description
In %. It's a way to bypass the API price impact check (default = 15%)
+