raydium-ui icon indicating copy to clipboard operation
raydium-ui copied to clipboard

Added harvest all button for farms & fusion

Open t-rekttt opened this issue 3 years ago • 7 comments

I think it would be more convenient for users who are farming multiple pairs on farms/fusion to have a button to quickly collect all the pending rewards, so I implemented it

Current mechanism

  • Treat the harvest function as a Promise
  • Added the harvestAll function to loop through the pairs, check their pending rewards, and trigger harvest if the amount is greater than 0
  • Harvesting in synchronous because use need to approve transactions one by one

t-rekttt avatar Apr 24 '21 15:04 t-rekttt

@t-rekttt Thanks for this PR, but if you join many pools, transaction packet data limit here, can't add many instructions in same transaction.

https://github.com/solana-labs/solana-web3.js/blob/171c73ee938c2bd12f0a0785e52d076c3f58649d/src/transaction.ts#L614

TimonPeng avatar Apr 24 '21 15:04 TimonPeng

@TimonPeng I'm processing the harvests the same way as the user clicking each of the harvest buttons, each one creates a new transaction, so I think there wouldn't be any problem with that

t-rekttt avatar Apr 24 '21 15:04 t-rekttt

@TimonPeng please check to see, it's working fine for me

t-rekttt avatar Apr 25 '21 06:04 t-rekttt

@TimonPeng please check to see, it's working fine for me

Ok, I will check it! Thanks a lot!

TimonPeng avatar Apr 25 '21 06:04 TimonPeng

@TimonPeng please check to see, it's working fine for me

Ok, I will check it! Thanks a lot!

How do you think? Please tell me if you have a better idea, I'll try to improve it

t-rekttt avatar Apr 28 '21 05:04 t-rekttt

@t-rekttt Sorry for the late reply, I'm busy with IDO development and we are planning to release a new SDK library and some features will be included in it. I will check your PR and merge it as soon as possible. Thank you again!

TimonPeng avatar Apr 28 '21 06:04 TimonPeng

@t-rekttt Sorry for the late reply, I'm busy with IDO development and we are planning to release a new SDK library and some features will be included in it. I will check your PR and merge it as soon as possible. Thank you again!

Thanks for the update. Just feel free to check whenever you have time!

t-rekttt avatar Apr 28 '21 07:04 t-rekttt