- Remove resolve-ata-ix from the Instruction set and classify it as a util fn
- Add getTokenMintsFromWhirlpools function to get all token mints from a set of whirlpools
- Convert original fn to resolveAtaForMints that depends on the common-sdk resolveOrCreateATA
* fix: strict initialized checking at swapQuoteWithParams
- removed checkIfAllTickArraysInitialized from swapQuoteWithParams
- added check to ensure that all TickArrays are initialized at getSwapTx
- In a TickArraySequence, uninitialized TickArrays are truncated.
- fix sqrtPriceLimit range check
- fix commitment issue in test code
- remove test "swap with a manual quote with dev-fee of 200%" (the code does not throw the exception)
* refactor: TickArraySequence
- remove Non-null assertion operator(!)
- use simple foreach loop and early break
- avoid name ambiguity (tickArrays to sequence)
- set constructor argument (tickArrays) to readonly
passed all tests (integration & sdk)
* Changing variable type to BN to handle liquidity
- Change type of variables handling liquidity from u64 to BN
- Fix: removing "async" from describe. must be defined synchronously.
- Fix: using BN to calculate the max value of u64 (test-constants.ts)
- Fix: adding "await" to wait transaction completion(swap-test-utils.ts)
* Changing variable type to BN to handle sqrtPrice
- Change type of variables handling sqrtPrice from u64 to BN
- Refactor: changing argument name of getTokenAmountsFromLiquidity
to clarify required price is sqrtPrice
Co-authored-by: yugure <98769788+everlastingsong@users.noreply.github.com>
- More accurate quote values - ported the swap logic from contract & add comprehensive unit-test suite to confirm quote values are identical to contract results
- More info available in quote - endTickIndex, sqrtPrice, feeAmount etc...
- Additional swapQuoteFromOutputToken to allow users to ask for a quote (and swap input parameters) based on the desired receive amount
- Bug fix on TickArray calculation that led to the annoying 0x1787 (InvalidTickArraySequence) error
- Addresses all errors in the old-swap quote where it fails to traverse tick-arrays in many cases
- Bug fix on WhirlpoolClient.swap where it incorrectly uses the quote.estimated values rather than the user defined tokenAmount value
- Change parameter ordering for resolveATA as it is the most important parameter
- Default resolveATA to true. Power users who do not want to ping RPC constantly can manually turn it off
- Fix up some comments
- Method will auto-check which tick-array requires initialization
- Will generate a list of initTickArray Ix for a transaction
- Modify test to send initTickArray + openPosition together
- Refactor swapQuoteByInputToken as a convenience method to help users fetch the necessary information to perform the swap quote
- Add swapQuoteWithParams for the more advanced users who have previously fetched the data they need to perform the swap quote
- Add support for auto-resolving ATA accounts prior for decrease liquidity ix
- Removed sourceWallet support for increase_liquidity ix
- Add separate funder/payer support for Whirlpool/Position increase/decrease liquidity functions
- Add tests to verify functions work as intended