Skip to main content

1. Overview of Harvesting a Position

Get a quick quote on outstanding fees and rewards

There are use-cases where users would like to check the outstanding values before deciding to perform an on-chain update and harvest. In these cases, use the provided collectFeesQuote and collectRewardsQuote in the Typescript SDK.
TypeScript

Update on-chain position with the latest accrued fees

Before you fetch your owed fees, you must update the on-chain position with the latest values by calling increase_liquidity or decrease_liquidity. Alternatively, you can call update_fee_and_rewards to update without modifying liquidity. If this step is skipped, the collect instructions will only fetch the last updated values of the position. In many cases, this will be 0. Sample code on using update_fee_and_rewards:
TypeScript

Collect Fees and Rewards

Once the position has been updated, you can use collect_fees and collect_reward to harvest the position.

Collect fee

TypeScript

Collect rewards

TypeScript

3. Usage Example

Suppose you are a developer creating a bot to manage investments for a group of investors. The bot periodically collects accumulated fees and rewards from liquidity positions to distribute profits among investors. By using the SDK, you can generate the instructions to collect earnings from each active position without closing it, allowing the liquidity to continue generating returns and potentially reinvest your earned fees into the position.

4. Next Steps

After harvesting fees and rewards, you can:
  • Monitor Performance: Keep track of your position to evaluate future earnings and the overall performance.
  • Reinvest Earnings: Use the harvested fees and rewards to add more liquidity or diversify your positions.
  • Harvest Regularly: Regularly collect your earnings to maintain optimal capital efficiency while keeping your liquidity active.
By using the SDK, you can maximize the benefits of providing liquidity while keeping your position open and continuously earning fees. As the liquidity pool is traded upon, liquidity providers will begin to accrue fees and rewards. Follow the following steps to see how much you are owe and how to collect them. Harvesting a position in Orca Whirlpools allows you to collect any accumulated fees and rewards without closing the position. This process is useful when you want to claim your earnings while keeping your liquidity active in the pool, ensuring you continue to benefit from potential future fees.