Commit Graph

70 Commits

Author SHA1 Message Date
meep 900cfb38a5
Revert back to common-js (#62) 2022-11-25 13:19:41 +07:00
meep 0fe7bda4d6
Simplify resolveATA in the Whirlpool space (#60)
- 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
2022-11-24 19:20:46 +07:00
meep 3c7b90c147
Add collectFeesAndRewardsForPositions to allow easy fee/reward collection (#57)
- Add collectFeesAndRewardsForPositions to WhirlpoolClient
- Add collectAllForPositionAddressesTxns to WhirlpoolIx
2022-11-24 15:37:41 +07:00
yugure-orca 8a7ed57bc5
fix: strict initialized checking at swapQuoteWithParams (#55)
* 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)
2022-11-24 15:13:59 +09:00
meep 61874e5c56
Fix build to unblock yarn link in dev environment (#56)
- Changing to ES6 build
- Add `process` to this build to unblock webpack 5 resolution
- Remove forced resolution of web3.js
2022-11-23 11:30:27 +07:00
atamari 571810579d
[SDK] Add `WhirlpoolClient.createPool()` (#53) 2022-11-18 13:04:45 +04:00
meep c8dd6ad3ed
Add getPositions function to WhirlpoolClient (#52)
Provide a new method to fetch many positions in a single RPC call
2022-11-17 10:32:43 +07:00
meep 2a077a7c8f
Remove async from decreaseLiquidityQuote (#51) 2022-11-17 10:23:49 +07:00
meep 4e72234a76
v0.5.3 (#49)
* v0.5.3
* Update yarn docs for new dev fee swap functions
2022-09-22 00:20:15 -07:00
FuzzyYeti 4c60463841
Add swap with dev fee to typedocs (#48)
Co-authored-by: Fuzzy Yeti <fuzzyyeti@github.com>
2022-09-21 23:59:56 -07:00
meep 3ed18b84c0
Release whirlpools-sdk 0.5.2 (#47) 2022-09-20 11:10:13 -07:00
meep 0f592f267b
Allow developers to take additional fees from a swap (#46)
- Add a new swapWithDevFees function in the Whirlpool client class
- Add new swapQuoteByInputTokenWithDevFees quote function
2022-09-20 11:03:53 -07:00
FuzzyYeti 1acd1469bd
Update protocol_fee_rate comment (#44)
Co-authored-by: Fuzzy Yeti <fuzzyyeti@github.com>
2022-09-04 08:46:50 -07:00
solbricklayer bb1b3c47bf
update anchor installation link (#39)
Old (not working): https://project-serum.github.io/anchor/getting-started/installation.html#install-rust
New (working): https://book.anchor-lang.com/getting_started/installation.html#anchor
2022-08-16 10:20:11 -07:00
skrrb e4cd6552e9
sdk tests: fix MAX_U64 const definition (#41) 2022-08-16 10:19:32 -07:00
tmoc d7cca71df8 v0.5.1 2022-08-10 14:52:24 -04:00
tmoc 16bca0ea1f
Implement batch getPools method (#42)
* Adding getPools method in SDK client

* Adding fetching of token vault infos to whirlpool retrieval

* Adding retrieval of reward infos

* Adding comment about empty pubkey constant

* Updating comments

* Using PoolUtil to check for initialized rewards

* Updating getRewardInfos comment
2022-08-10 14:50:02 -04:00
yugure-orca 8fc92ea1af
Change data type for liquidity and sqrtPrice to BN (#40)
* 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>
2022-08-01 20:49:52 +09:00
Otto Cheung a5e7d82494 v0.5.0 2022-07-22 10:17:08 -04:00
meep 11f17bae53
Upgrade Anchor (Typescript) dependency to 0.25 (#38)
- Updating the Anchor SDK dependency
- API changes on the parameters on WhirlpoolContext & WhirlpoolClient
2022-07-22 09:47:32 -04:00
Otto Cheung c33740ed3a v0.4.0 2022-07-21 15:26:09 -04:00
meep 025fbffdf0
Update typedocs and comments for swap refactor (#37) 2022-07-15 10:10:49 -04:00
meep 2df89bb552
[SDK] Refactoring swap-quote (#30)
- 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
2022-07-15 09:49:21 -04:00
meep 5798af2e51
Update comments and re-run yarn docs (#33) 2022-06-29 17:16:01 -04:00
Otto Cheung 266241f99b v0.3.1 2022-06-29 16:18:54 -04:00
meep b922062ccb
Change param ordering for Position's resolveATA (#32)
- 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
2022-06-29 15:51:18 -04:00
meep 4416732e33
Add resolveATA option for Position's increase_liquidity (#31)
- Add an option to auto-generate ATA to perform increase_liquidity for Whirlpool's position class
2022-06-29 15:22:14 -04:00
Otto Cheung 537306c096 v0.2.3 2022-06-21 11:36:09 -05:00
Otto Cheung 3bcd4ee391 upgrade common-sdk to 0.0.7 2022-06-21 10:52:56 -05:00
meep a3ee117669
Upgrade initTickArrayForTicks for WhirlpoolClient (#28)
- 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
2022-06-21 10:51:18 -05:00
Otto Cheung dfcda482ba v0.2.2 2022-06-13 16:26:54 -07:00
meep 7c8dce249e
Add PoolUtil swap direction & token type util functions (#27)
Add util functions to PoolUtil to help identify swap direction & token A/B for token mints
2022-06-13 16:24:03 -07:00
Otto Cheung 09ddd60a34 Revert unexpected PoolUtil commits 2022-06-13 16:20:16 -07:00
Otto Cheung 076b1fc49a add return types 2022-06-13 16:17:02 -07:00
Otto Cheung 2feb023309 Revert "rename the old swapdirection in swap-quote"
This reverts commit 479acf26a2.
2022-06-13 10:50:50 -07:00
Otto Cheung 479acf26a2 rename the old swapdirection in swap-quote 2022-06-13 10:45:30 -07:00
Otto Cheung efa9daa623 add tests 2022-06-13 10:31:20 -07:00
Otto Cheung 8f387e52c2 revisions 2022-06-13 10:11:33 -07:00
Otto Cheung 0e0ff71fae additional poolutil changes 2022-06-10 12:32:56 -07:00
Otto Cheung bd7c2abd44 v0.2.1 2022-06-08 21:15:15 -07:00
Otto Cheung 34040c0645 v0.2.0 2022-06-08 20:07:59 -07:00
meep a266831d7c
[v0.2.0] Refactor swapQuote functions (#20) (#25)
- 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
2022-06-08 19:49:45 -07:00
meep f888d1cf20
[v0.2.0] Improve increase/decrease liquidity functions for SDK (#16)
- 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
2022-06-08 19:36:48 -07:00
Otto Cheung efe85aa44d v0.1.7 2022-06-07 17:38:54 -07:00
Sohrab 1479717b73
fix(token): remove double clone()ing from CPI calls (#11) 2022-06-07 13:44:26 -07:00
tmoc e94d6a6314
Adding toBaseQuoteOrder method to pool-utils (#21)
* Adding toBaseQuoteOrder method to pool-utils and test

* Moving function to PoolUtil namespace

* Updating test to use PoolUtil namespace
2022-06-07 13:45:32 -04:00
tmoc 451a04040b
Variable name consistency in lib.rs and swap.rs. Regenerating IDL to pick up argument name change (#24) 2022-06-07 12:18:14 -04:00
meep c881abcc8b
Modify IncreaseLiquidity quote to use Address (#15) 2022-06-07 08:23:19 -07:00
meep 101307aa7d
update Cargo.toml to use new anchor sources (#23) 2022-06-07 08:22:20 -07:00
meep 49c8dd7c09
Fix build errors for increase/decrease liquidity Ix (#19)
Add new Increase/DecreaseLiquidityQuote type to add a layer of separation between Params and Quote
2022-06-07 08:22:01 -07:00