-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* abstract away providers/findPrimaryType * add TransactionParams.maxFeeGas params * providers/viem * export from providers/viem * DEFAULT_VERSION better type * add wagmi & viem deps * SimpleSDK/viem for contractCaller * examples/viem * cleanup * examples/wagmi * tests/fix types * examples/fix types * tests/fix types * viem/fix account usage * examples/viem/fix account usage * types/TxHash=Hex * add hardhat * legacy/fix types * ignore cache files * some tests * tsconfig/allow BigInt short notation * providers/viem/reuse account * viem/fix tests * tests/viem/remove extra * tests/viem/Order signing * rename stuff * cleanup * reenable tests * tests/viem/const acc * tests/viem/update snapshots * reexport txParamsToViemTxParams * tests/viem/update snapshots * more comments * cleanup * remove extra deps * moved bignumber.js to devDeps * cleanup * update tests jpeg * update README * update snapshots * FetcherError/fix types * viem test/market swap * fix deps * update deps * update snapshots * remove dummy test * change default version * Feat/deps update/tests migration (#180) * update some deps * replace ganache with hardhat * remove ganache * fix chainId in tests mismatch * try with tevm * tevm test * add hardhat-switch-network plugin * simplify hardhat helpers * make tests work with hardhat * fix method name * disable web3 tests that break with hardhat * fix NFT tests * remove tevm * hardhat config/explicit gasPrice * NFT tests/adjust amounts * cleanup * remove temp tests * update some deps * NFT tests/workaround some errors * update ethers dep * update web3 dep(slightly) * update deps * override some deps * Feat/web3 upgrade (#181) * update some deps * hadrhat config/smaller default baseFee * NFT tests/workaround edge case * update web3 dep * update Web3 types * update web3/constructContractCaller * legacy/update types * hardhat config/fixed accounts * LOrder tests/reenable sign with web3 * NFT Order tests/reenable sign with web3 * getBalance tests workaround * cleanup * update some deps * update snapshots * update perrDeps * update required Node v * NFT tests/account for dust * hadrhat config/lower initialBaseFeePerGas * Feat/ether v6 support (#182) * install ethersV6 as alias * providers/ethersV6 * distinct ethersV5 exports * legacy/support ethersV6 * simple SDK/support ethersV6 * simpleSDK.tests/add ethersV6 * partialSDK.tests/add ethersV6 * LOrders.tests/add ethersV6 * NFT_Orders.tests/add ethersV6 * update snapshots * examples/ add ethersV6 * perrDeps/update ethers versions * update snapshots * cleanup * move ethers types to provider/ethers * move web3 types to provider/web3 * untie FetchError type from AxiosError * ethers -> ethersV5, ethersV6 -> ethers to fix types when used as lib * cleanup * README/update version * less dependency on ethers types * update README * rremove temp tests * tests/ethersV6/fix derivation path arg position
- Loading branch information
Showing
45 changed files
with
6,821 additions
and
4,900 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,6 @@ src/*.js | |
|
||
dist | ||
|
||
*.log | ||
*.log | ||
|
||
/cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import * as dotenv from 'dotenv'; | ||
import type { HardhatUserConfig } from 'hardhat/config'; | ||
import 'hardhat-switch-network'; | ||
|
||
dotenv.config(); | ||
|
||
const TEST_MNEMONIC = | ||
'radar blur cabbage chef fix engine embark joy scheme fiction master release'; | ||
|
||
const config: HardhatUserConfig = { | ||
solidity: '0.8.24', | ||
networks: { | ||
hardhat: { | ||
forking: { | ||
url: process.env.PROVIDER_URL!, // Replace with your actual Alchemy/Infura URL | ||
// Optional forking configurations (e.g., block number): | ||
// blockNumber: 12345678, | ||
}, | ||
chainId: 1, | ||
// have to config hardhat with fixed accounts unlocked, otherwise signTx and signTyped data fail when used in RPC calls to Node | ||
// which breaks web3.js | ||
// ethers signs data and txs locally off-chain as long as it has provate key | ||
// web3 is a bit harder to init wallets for locally. | ||
// impersonateAccounts doesn't work, even though it should logically fully unlock accounts, | ||
// but only remore accounts are unlocked, fixed are not, | ||
// so we always need to only use accounts generated from this mnemonic | ||
|
||
// refs: | ||
// https://github.com/NomicFoundation/hardhat/issues/3059 | ||
// https://github.com/NomicFoundation/hardhat/issues/1226 | ||
accounts: { mnemonic: TEST_MNEMONIC }, // and with fixed | ||
// dynamically switch between networks configured here | ||
// by calling `hre.switchNetwork(networkName)` thanks to hardhat-switch-network plugin | ||
gasPrice: 8e9, | ||
initialBaseFeePerGas: 1e8, // will break if used with a chain without eip1559 | ||
}, | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
import axios from 'axios'; | ||
import { ethers } from 'ethers'; | ||
import { | ||
constructPartialSDK, | ||
constructFullSDK, | ||
constructGetAdapters, | ||
constructEthersV6ContractCaller, | ||
constructAxiosFetcher, | ||
} from '..'; | ||
|
||
const fetcher = constructAxiosFetcher(axios); | ||
|
||
const provider = ethers.getDefaultProvider(1); | ||
const contractCaller = constructEthersV6ContractCaller({ | ||
ethersV6ProviderOrSigner: provider, | ||
EthersV6Contract: ethers.Contract, | ||
}); | ||
|
||
const paraswap = constructFullSDK({ | ||
chainId: 1, | ||
fetcher, | ||
contractCaller, | ||
}); | ||
|
||
const res = paraswap.swap.getAdapters(); | ||
|
||
// type Promise<ContractTransaction> | ||
const txResponse = paraswap.swap.approveToken('1', '0x...'); | ||
// type Promise<ContractTransaction[]> | ||
const txResponses = paraswap.swap.approveTokenBulk('1', ['0x...']); | ||
|
||
const partial = constructPartialSDK( | ||
{ apiURL: '', chainId: 1, fetcher }, | ||
constructGetAdapters | ||
); | ||
|
||
const res1 = partial.getAdapters(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.