From fc3976f0658e92884dd12a538c0ed95a9e1ef065 Mon Sep 17 00:00:00 2001 From: Velenir Date: Thu, 19 Sep 2024 18:56:29 +0200 Subject: [PATCH] update README --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 55fb7685..22bcc9fe 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Refer to the documentation of the ParaSwap API: https://developers.paraswap.network ## Features -**Versatility**: works with both [web3](https://www.npmjs.com/package/web3) and [ethers](https://www.npmjs.com/package/ethers) without direct dependency +**Versatility**: works with [web3](https://www.npmjs.com/package/web3), [ethers](https://www.npmjs.com/package/ethers) or [viem](https://viem.sh/) without direct dependency **Canonical**: bring only the functions you actually need @@ -25,6 +25,8 @@ yarn add @paraswap/sdk There are multiple ways to use ParaSwap SDK, ranging from a simple construct-and-use approach to a fully composable _bring what you need_ approach which allows for advanced tree-shaking and minimizes bundle size. +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. @@ -87,6 +89,12 @@ If optional `providerOptions` is provided as the second parameter, then the resu account: senderAddress, }; + // or with viem (from wagmi or standalone) + const providerOptionsViem = { + viemClient, // made with createWalletClient() + account: senderAddress, + }; + // or with web3.js const providerOptionsWeb3 = { web3, // new Web3(...) instance @@ -112,7 +120,7 @@ const account = '__signer_address__'; const contractCaller = constructEthersContractCaller({ ethersProviderOrSigner: signer, EthersContract: ethers.Contract, -}, account); // alternatively constructWeb3ContractCaller +}, account); // alternatively constructViemContractCaller or constructWeb3ContractCaller const fetcher = constructAxiosFetcher(axios); // alternatively constructFetchFetcher const paraswap = constructFullSDK({