Commit Graph

136 Commits

Author SHA1 Message Date
Christian Kamm 3aa7ff52e9 drop fee_growth logging 2024-04-24 15:23:24 +02:00
Christian Kamm 79c118ba8b Name matches up with repo url 2024-04-08 16:22:17 +02:00
Christian Kamm 3e7c62e054 make usable as client-only lib
- drop instruction bodies
- upgrade to anchor v0.29
- upgrade to solana v1.17
- upgrade borsh to v0.10
- drop mpl-token dependency
2024-04-08 16:11:19 +02:00
yugure-orca 3da6b8937f
use idempotent on whirlpool.swap (swapAsync) (#142)
* use idempotent on whirlpool.swap (swapAsync)

* add test case

* bump version 0.12.5
2024-03-26 09:24:53 +09:00
Will 70d45ec5a3
Remove some unnused/unnecessary lock files (#137) 2024-03-22 09:21:36 -04:00
tmoc d7a2e5e7e8
Bump common-sdk to 0.5.3 (#139)
* Bump common-sdk to 0.5.3
* Bump whirlpools-sdk to 0.12.4
2024-03-20 10:18:38 +13:00
tmoc 3ce3992e8f
Bump common-sdk to 0.5.2 (#138)
* Bump common-sdk to 0.5.2

* Lockfile

* Version bump

---------

Co-authored-by: Michael Hwang <tmoc@tmoc-mba.local>
Co-authored-by: Wilhelm Thieme <wjthieme@gmail.com>
2024-03-15 10:23:47 -04:00
meep d327356343
Price-based slippage calculation for increase liquidity (#135)
- Deprecated the old increaseLiquidityQuoteByInputToken quote function & added a new increaseLiquidityQuoteByInputTokenUsingPriceSlippage to calculate tokenMax based on price movement
- Adding increaseLiquidityQuoteByLiquidity quote function to generate a quote by a set liquidity value
2024-03-08 07:21:55 +13:00
yugure-orca 6f7277c2f7
Fix PositionUtil.getPositionStatus bug (#133)
* fix PositionUtil.getPositionStatus bug

* bump to 0.12.2

* update docs
2024-02-13 00:13:17 +09:00
Will 11aeb9eb4c
Close intermediate token accounts of 2-hop swap (#131) 2024-02-01 19:05:25 -05:00
Will c5da49a2ab
Use peer dependencies to prevent common sdk version mismatches (#129)
* Use peer dependencies to prevent common sdk version mismatches

* Bump

* Bump

* Bump
2024-01-11 15:22:18 +01:00
Will fc7dac3037
Reduced close position transaction builder to a single transaction (#128)
* New approach

* Small tweaks
2024-01-08 09:11:27 +01:00
meep 3206c9cdfb
Bump version to v0.11.8 (#127) 2023-12-21 11:45:37 +13:00
Will 7dcaa7e7e7
Fix a div by zero bug in increaseLiquidityQuoteByInputToken calculations (#126) 2023-12-20 23:36:16 +01:00
Pratham Prasoon 61b262de70
Update sdk README.md to use coral/anchor instead of serum/anchor (#125) 2023-12-19 00:46:56 +09:00
Fuzzy Yeti 3a15880bd6
bump sdk version (#123) 2023-11-15 00:46:31 +09:00
Fuzzy Yeti 2dfb9f7ecf
add optional position mint params (#121)
* add optional position mint params

* switch from keypair to pubkey

* PR fixes
2023-11-12 20:31:11 -07:00
yugure-orca 728586cc70
Add 256 to ORCA_SUPPORTED_TICK_SPACINGS (#118)
* add 256 ts

* update typedoc only
2023-11-08 13:37:50 +09:00
yugure-orca fff511aa60
update README (#119)
* update README

* Apply suggestions from code review

Co-authored-by: Phil Chen <phil.cy.chen@gmail.com>

---------

Co-authored-by: Phil Chen <phil.cy.chen@gmail.com>
2023-11-08 13:28:43 +09:00
yugure-orca 71ed7d5432
Remove lodash.combinations (#114)
* remove lodash.combinations

* fix test cases for PR104(increase fee rate limit)

https://github.com/orca-so/whirlpools/pull/104

* add newly supported tickspacing

* bump v0.11.5

* build docs only
2023-09-21 01:25:20 +09:00
yugure-orca 5f5323b8cd
add FullRange related util functions (#113) 2023-09-15 03:21:44 +09:00
Yutaro Mori a574ae5922
Increase the fee rate limit and log fee growth within the swap instruction (#104)
* Increase the fee rate limit and log fee growth within the swap instruction

* PR feedback

* log reward_growth

* remove .only

* only perform 1 log

* Revert "only perform 1 log"

This reverts commit 2ab6c5b6d2c3a29632d2285f6145231349720429.

* Revert "remove .only"

This reverts commit a39f15f6e55996155d00c26817966b22e6b26e95.

* Revert "log reward_growth"

This reverts commit f54e2060dde17c0ebb5cf5c30806c613088db165.

---------

Co-authored-by: Otto Cheung <otto@orca.so>
2023-08-22 20:35:13 -04:00
meep 7f7ee90b25
Add getAllWhirlpoolAccounts util method and fetcher.populatePools (#111)
- Add back the old listPoolsWithParams method that was missed in the previous refactor
- Add populatePools method to the fetcher to allow users to populate the cache with getAllWhirlpoolAccounts
2023-07-27 15:28:06 +08:00
meep 6d3e0a9d1d
Export Whirlpool IDL for external usage (#112) 2023-07-26 08:36:31 +08:00
yugure-orca f54632fce8
(v0.11.3) Add account resolver options (#110)
* add AccountResolverOpts

* fix invalid import statement

* use WrappedSolAccountCreateMethod from common-sdk

* update getAssociatedTokenAddressSync

* update resolveOrCreateATA(s)

* update createWrappedNativeAccountInstruction

* update createSendTokensToWalletInstruction

* bump version

* rename opts to options

* add maxTransactionSize on RouteSelectOptions

* bugfix: findBestRoute / expand selectionOpts

* address review comment

* bump to v0.11.3

* fix common-sdk version

* refactor: remove commas

* update docs
2023-07-24 13:34:30 +09:00
meep 1d6e6c44ae
Fix WhirlpoolAccountFetcher cyclical dependency (#109)
- Add `rimraf` to build to get rid of dist prior to publishing
- Remove cyclical dependency between impl & index file for fetcher

---------

Co-authored-by: yugure <109891005+yugure-orca@users.noreply.github.com>
2023-07-13 11:13:49 +08:00
meep 7f05704f39
Implement RouterUtils.getPriceImpactForRoute (#108)
- Add a function in RouterUtils to allow calculation of price impact
- Supports multi-split & multi-hop routes
- bump to v0.11.1
2023-07-05 20:36:36 +08:00
Phil Chen 42ca95a4bc
Use slippage adjusted swap quote for two hop swap (#106) 2023-06-27 13:40:49 +08:00
meep 0fdf8e5dc6
Replace AccountFetcher with WhirlpoolAccountFetcher (#107)
- Replace AccountFetcher with WhirlpoolAccountFetcher. 
- Modify fetcher references to an interface
- Update PriceModuleUtils to only take in fetcher instead of ctx
2023-06-27 13:39:37 +08:00
meep e06505fb1e
Upgrade spl-token to v0.3.8 & common 0.3.0 (#105)
- bump common-sdk to 0.3.0-beta (spl-token upgrade)
- update js target to ES2020 to use bigInt literals
- replace all deriveATA to getAssociatedTokenAddressSync
- replace all spl-token instruction builders previously under the Token namespace
- Replace all u64 with BN
- Update parser to use the EntityParser stack (TokenAccount & Mint parsers) from common-sdk. Update - - - parser method (breaking) to include address
- Replace old Token types AccountInfo & MintInfo with Account & Mint
- Remove duplicated account-request util methods. Use the ones in common-sdk
- Remove duplicated util methods createATAIx, getAssociatedTokenAddressSync, createWSOLAccountInstructions
2023-06-20 16:29:56 +08:00
meep cdd16d683c
bump to v0.10.0 (#103) 2023-05-15 10:58:32 +10:00
meep c4213bb62d
fix deep copy crash on quote adjustment (#102) 2023-05-15 10:44:55 +10:00
meep 04abca9ef0
Implement Smart Router API (#96) (#101)
- swap on routes with up to 2-hops
- swap on routes that is split into multiple smaller routes
- route selection
- Support VersionedTransaction & lookup tables
2023-05-13 11:15:27 +10:00
Sebastian bf60726d05
In tests, only create token account if needed (#99) 2023-04-24 10:35:07 +10:00
meep b21c82e2fe
Update SDK to use Anchor 0.27 & other settings for Smart-Router (#97)
- Add lookupTableFetcher into WhirlpoolContext
- Update SDK web3, anchor 0.27 deps to support VersionedTransactions
- Faster test-suite execution with faster ticks_per_slot for validator.
- Test-suite now runs the test-cases with metaplex out of the box
2023-04-24 10:13:57 +10:00
tmoc cdab58501c
Fix usage of actual size variable (#98) 2023-04-19 19:21:27 -04:00
tmoc e843b7591c
Get anchor account sizes by name instead of IDL index (#95)
* Adding function to fetch account sizes and using that instead of static export

* Adding a test for getAccountSize

* Updating test to explicitly check account sizes. Also adding reserved bytes calculations
2023-04-17 20:46:15 -04:00
yugure-orca 44021b15a7
bundled positions (#89)
## Anchor v0.26.0 upgrade (rebased)
Special thanks @dovahcrow !

* anchor 0.26 solana 1.14.12

use mpl-token-metadata 1.7 because rust 1.60 does not compile 1.8

* initialize_pool: ignore passed bump and use one anchor derived

- initialize_pool.test: update error codes, add a test case for ignoring bump

* update expected error messages

* add CHECK comments on UncheckedAccounts

* use create_metadata_accounts_v3 (v2 have been deprecated)

* update unit test cases (cargo test)

## Bundled Positions
* import bundled positions

* upgrade to Anchor v0.26.0 (position bundles related codes)

- ProgramResult to Result<()>
- add /// CHECK comments
- remove space attribute on Mint account
- change create_metadata_accounts_v2 to v3
- update testcases
  - Change in error code detected first
  - Change in account closing method
    https://github.com/coral-xyz/anchor/pull/2169

* cargo fmt

* update seed of BundledPosition

* change temporary mint_authority to position_bundle

* bump to v0.2.0

doc fields are added on IDL

* fix: accidental failure test cases

Fixed test cases that did not take into account rewards accruing up to just before the close.
This test case is not related to bundled positions.
The test case happened to fail, so I fixed them to make them all successful.

---------

Co-authored-by: Weiyuan Wu <weiyuan@crows.land>
2023-04-07 21:18:56 +09:00
yugure-orca d18229eb20
optimize price module perf (#93)
* optimize: getMostLiquidPool
* optimize: fetchTickArraysForPools
* fix: review comments
2023-03-31 13:41:32 +09:00
meep 1121065324
Rename PoolGraph API to use graph terminology (#94) 2023-03-22 16:21:03 +08:00
meep 3fe9cad66e
Add PoolGraph API and AdjacencyListGraph implementation (#90)
- Add PoolGraph API to allow trade route path finding with max hop of 2
- Add tests to verify behavior
- Update docs for PoolGraph API
- bump common-sdk to v0.1.12
2023-03-21 11:28:40 +08:00
yugure-orca 9a46642433
fix: test cases (tokenAIsNative related) (#92)
* fix: test cases (tokenAIsNative related)
2023-03-16 17:44:48 +09:00
yugure-orca e554b79a75
Bump common-sdk to v0.1.12 (#91)
- bump common-sdk to use AddressUtil.toStrings
- remove .only (test case)
2023-03-16 13:13:22 +09:00
Yutaro Mori 840b0ebbfb
Adding PriceModule class to help calculate token prices for a set of Whirlpools (#84)
Provide a shared module to provide the source of truth of token prices based off of Whirlpool account data.
Add additional liquidity criteria to filter out tokens with outlier prices

Co-authored-by: Otto Cheung <otto@orca.so>
2023-03-15 20:56:21 +08:00
Phil Chen c3a02ee3ed
Two-hop swap instruction (#87)
* Two-hop swap instruction

* Add testing infra

* Remove .only from jest test

* Try setting a sqrt price limit

* Fix price limit tests

* Add additional tests

* Fix tests

---------

Co-authored-by: Yutaro Mori <yutaro@orca.so>
2023-02-17 05:57:03 +03:00
yugure-orca 4ae25c0619
bump to v0.8.2 (#88)
- use common-sdk v0.1.10
- fix: open_position_with_metadata integration test (update URI of the metadata of position NFTs)
  related: https://github.com/orca-so/whirlpools/pull/83
2023-02-16 18:57:11 +09:00
yugure-orca 4c4c8936ea
Make collect all completely parallel (#81)
* Make collect all completely parallel

All TransactionBuilders generated by collectAllForPositionAddressesTxns can now be executed in parallel.
Since the ATA is created with CreateIdempotent when necessary, the first TransactionBuilder no longer needs to be executed first.

Added a test case that calls collectAllForPositionAddressesTxns.

``anchor test`` passed.
2023-02-03 19:06:44 +09:00
meep ce032726e6
Bump @orca-so/common-sdk to v0.1.9 (#85) 2023-01-30 15:11:17 +08:00
Yutaro Mori 2f569a7574
Update Whirlpool position NFT metadata URI (#83)
Co-authored-by: yugure-orca <109891005+yugure-orca@users.noreply.github.com>
2023-01-27 22:40:31 +03:00
Phil Chen e4bdde3bd1
Handle liquidity swapping edge case across initialized tick boundary (#82) 2023-01-24 10:45:17 -08:00